Lines Matching defs:desc
182 int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page)
184 struct file *file = desc->file;
191 __func__, (long long)desc->entry->cookie,
197 error = NFS_PROTO(inode)->readdir(file->f_path.dentry, cred, desc->entry->cookie, page,
198 NFS_SERVER(inode)->dtsize, desc->plus);
201 if (error == -ENOTSUPP && desc->plus) {
204 desc->plus = 0;
209 desc->timestamp = timestamp;
210 desc->gencount = gencount;
211 desc->timestamp_valid = 1;
229 int dir_decode(nfs_readdir_descriptor_t *desc)
231 __be32 *p = desc->ptr;
232 p = desc->decode(p, desc->entry, desc->plus);
235 desc->ptr = p;
236 if (desc->timestamp_valid) {
237 desc->entry->fattr->time_start = desc->timestamp;
238 desc->entry->fattr->gencount = desc->gencount;
240 desc->entry->fattr->valid &= ~NFS_ATTR_FATTR;
245 void dir_page_release(nfs_readdir_descriptor_t *desc)
247 kunmap(desc->page);
248 page_cache_release(desc->page);
249 desc->page = NULL;
250 desc->ptr = NULL;
255 * to readdir, find the next entry with cookie '*desc->dir_cookie'.
262 int find_dirent(nfs_readdir_descriptor_t *desc)
264 struct nfs_entry *entry = desc->entry;
268 while((status = dir_decode(desc)) == 0) {
271 if (entry->prev_cookie == *desc->dir_cookie)
283 * to readdir, find the entry at offset 'desc->file->f_pos'.
290 int find_dirent_index(nfs_readdir_descriptor_t *desc)
292 struct nfs_entry *entry = desc->entry;
297 status = dir_decode(desc);
302 (unsigned long long)entry->cookie, desc->current_index);
304 if (desc->file->f_pos == desc->current_index) {
305 *desc->dir_cookie = entry->cookie;
308 desc->current_index++;
322 int find_dirent_page(nfs_readdir_descriptor_t *desc)
324 struct inode *inode = desc->file->f_path.dentry->d_inode;
329 __func__, desc->page_index,
330 (long long) *desc->dir_cookie);
335 desc->timestamp_valid = 0;
336 page = read_cache_page(inode->i_mapping, desc->page_index,
337 (filler_t *)nfs_readdir_filler, desc);
344 desc->page = page;
345 desc->ptr = kmap(page); /* matching kunmap in nfs_do_filldir */
346 if (*desc->dir_cookie != 0)
347 status = find_dirent(desc);
349 status = find_dirent_index(desc);
351 dir_page_release(desc);
361 * The target for the search is '*desc->dir_cookie' if non-0,
362 * 'desc->file->f_pos' otherwise
365 int readdir_search_pagecache(nfs_readdir_descriptor_t *desc)
371 if (*desc->dir_cookie == 0) {
373 (long long)desc->file->f_pos);
374 desc->page_index = 0;
375 desc->entry->cookie = desc->entry->prev_cookie = 0;
376 desc->entry->eof = 0;
377 desc->current_index = 0;
380 (unsigned long long)*desc->dir_cookie);
383 res = find_dirent_page(desc);
387 desc->page_index ++;
403 static struct dentry *nfs_readdir_lookup(nfs_readdir_descriptor_t *desc);
409 int nfs_do_filldir(nfs_readdir_descriptor_t *desc, void *dirent,
412 struct file *file = desc->file;
413 struct nfs_entry *entry = desc->entry;
431 dentry = nfs_readdir_lookup(desc);
445 *desc->dir_cookie = entry->cookie;
446 if (dir_decode(desc) != 0) {
447 desc->page_index ++;
455 dir_page_release(desc);
459 (unsigned long long)*desc->dir_cookie, res);
476 int uncached_readdir(nfs_readdir_descriptor_t *desc, void *dirent,
479 struct file *file = desc->file;
487 (unsigned long long)*desc->dir_cookie);
497 *desc->dir_cookie, page,
499 desc->plus);
500 desc->page = page;
501 desc->ptr = kmap(page); /* matching kunmap in nfs_do_filldir */
503 desc->timestamp = timestamp;
504 desc->gencount = gencount;
505 desc->timestamp_valid = 1;
506 if ((status = dir_decode(desc)) == 0)
507 desc->entry->prev_cookie = *desc->dir_cookie;
513 status = nfs_do_filldir(desc, dirent, filldir);
517 desc->page_index = 0;
518 desc->entry->cookie = desc->entry->prev_cookie = 0;
519 desc->entry->eof = 0;
525 dir_page_release(desc);
538 *desc = &my_desc;
549 * *desc->dir_cookie has the cookie for the next entry. We have
553 memset(desc, 0, sizeof(*desc));
555 desc->file = filp;
556 desc->dir_cookie = &nfs_file_open_context(filp)->dir_cookie;
557 desc->decode = NFS_PROTO(inode)->decode_dirent;
558 desc->plus = NFS_USE_READDIRPLUS(inode);
567 desc->entry = &my_entry;
574 while(!desc->entry->eof) {
575 res = readdir_search_pagecache(desc);
579 if (*desc->dir_cookie && desc->entry->cookie != *desc->dir_cookie) {
581 res = uncached_readdir(desc, dirent, filldir);
588 if (res == -ETOOSMALL && desc->plus) {
591 desc->plus = 0;
592 desc->entry->eof = 0;
598 res = nfs_do_filldir(desc, dirent, filldir);
1133 static struct dentry *nfs_readdir_lookup(nfs_readdir_descriptor_t *desc)
1135 struct dentry *parent = desc->file->f_path.dentry;
1137 struct nfs_entry *entry = desc->entry;
1170 if (!desc->plus || entry->fh->size == 0)
1180 if (!desc->plus || !(entry->fattr->valid & NFS_ATTR_FATTR))