return;
}
+/*!
+ * Read and return the requested directory page.
+ *
+ * \param[in] adc pointer to directory dcache
+ * \param[in] page number of the desired directory page
+ * \param[out] entry buffer to return requested page
+ *
+ * \retval 0 success
+ * \retval non-zero invalid directory or internal IO error
+ */
int
DRead(struct dcache *adc, int page, struct DirBuffer *entry)
{
memset(entry, 0, sizeof(struct DirBuffer));
+ if (adc->f.chunk == 0 && adc->f.chunkBytes == 0) {
+ /* The directory blob is empty, apparently. This is not a valid dir
+ * blob, so throw an error. */
+ return EIO;
+ }
+ if (page * AFS_BUFFER_PAGESIZE >= adc->f.chunkBytes) {
+ return ENOENT; /* past the end */
+ }
+
ObtainWriteLock(&afs_bufferLock, 256);
#define bufmatch(tb) (tb->page == page && tb->fid == adc->index)
ObtainWriteLock(&tb->lock, 260);
tb->lockers++;
ReleaseWriteLock(&afs_bufferLock);
- code = 0;
- if (adc->f.chunk == 0 && adc->f.chunkBytes == 0) {
- /* The directory blob is empty, apparently. This is not a valid dir
- * blob, so throw an error. */
- code = EIO;
- goto error;
- } else if (page * AFS_BUFFER_PAGESIZE >= adc->f.chunkBytes) {
- code = ENOENT; /* past the end */
- goto error;
- }
-
tfile = afs_CFileOpen(&adc->f.inode);
if (!tfile) {
code = EIO;