[readdir] introduce iterate_dir() and dir_context
iterate_dir(): new helper, replacing vfs_readdir(). struct dir_context: contains the readdir callback (and will get more stuff in it), embedded into whatever data that callback wants to deal with; eventually, we'll be passing it to ->readdir() replacement instead of (data,filldir) pair. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -1912,6 +1912,7 @@ struct buffered_dirent {
|
||||
};
|
||||
|
||||
struct readdir_data {
|
||||
struct dir_context ctx;
|
||||
char *dirent;
|
||||
size_t used;
|
||||
int full;
|
||||
@@ -1949,6 +1950,7 @@ static __be32 nfsd_buffered_readdir(struct file *file, filldir_t func,
|
||||
int size;
|
||||
loff_t offset;
|
||||
|
||||
buf.ctx.actor = nfsd_buffered_filldir;
|
||||
buf.dirent = (void *)__get_free_page(GFP_KERNEL);
|
||||
if (!buf.dirent)
|
||||
return nfserrno(-ENOMEM);
|
||||
@@ -1963,7 +1965,7 @@ static __be32 nfsd_buffered_readdir(struct file *file, filldir_t func,
|
||||
buf.used = 0;
|
||||
buf.full = 0;
|
||||
|
||||
host_err = vfs_readdir(file, nfsd_buffered_filldir, &buf);
|
||||
host_err = iterate_dir(file, &buf.ctx);
|
||||
if (buf.full)
|
||||
host_err = 0;
|
||||
|
||||
|
Reference in New Issue
Block a user