diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-05-22 21:44:23 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-06-29 04:57:04 -0400 |
commit | 2233f31aade393641f0eaed43a71110e629bb900 (patch) | |
tree | 3993793028cb6c8dae41d407cb2217d221d9399c | |
parent | 2de5f059c4422e357b7df021b487a37b1d61356b (diff) |
[readdir] ->readdir() is gone
everything's converted to ->iterate()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | Documentation/filesystems/Locking | 2 | ||||
-rw-r--r-- | Documentation/filesystems/porting | 3 | ||||
-rw-r--r-- | Documentation/filesystems/vfs.txt | 4 | ||||
-rw-r--r-- | fs/bad_inode.c | 4 | ||||
-rw-r--r-- | fs/exportfs/expfs.c | 2 | ||||
-rw-r--r-- | fs/readdir.c | 13 | ||||
-rw-r--r-- | include/linux/fs.h | 1 |
7 files changed, 13 insertions, 16 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking index 0706d32a61e6..bdd82b2339d9 100644 --- a/Documentation/filesystems/Locking +++ b/Documentation/filesystems/Locking | |||
@@ -414,7 +414,7 @@ prototypes: | |||
414 | ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); | 414 | ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); |
415 | ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t); | 415 | ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t); |
416 | ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); | 416 | ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); |
417 | int (*readdir) (struct file *, void *, filldir_t); | 417 | int (*iterate) (struct file *, struct dir_context *); |
418 | unsigned int (*poll) (struct file *, struct poll_table_struct *); | 418 | unsigned int (*poll) (struct file *, struct poll_table_struct *); |
419 | long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); | 419 | long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); |
420 | long (*compat_ioctl) (struct file *, unsigned int, unsigned long); | 420 | long (*compat_ioctl) (struct file *, unsigned int, unsigned long); |
diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting index 85a4a033bae7..206a1bdc7321 100644 --- a/Documentation/filesystems/porting +++ b/Documentation/filesystems/porting | |||
@@ -448,3 +448,6 @@ in your dentry operations instead. | |||
448 | -- | 448 | -- |
449 | [mandatory] | 449 | [mandatory] |
450 | vfs_readdir() is gone; switch to iterate_dir() instead | 450 | vfs_readdir() is gone; switch to iterate_dir() instead |
451 | -- | ||
452 | [mandatory] | ||
453 | ->readdir() is gone now; switch to ->iterate() | ||
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt index bc4b06b3160a..4a35f6614a66 100644 --- a/Documentation/filesystems/vfs.txt +++ b/Documentation/filesystems/vfs.txt | |||
@@ -777,7 +777,7 @@ struct file_operations { | |||
777 | ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); | 777 | ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); |
778 | ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t); | 778 | ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t); |
779 | ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); | 779 | ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); |
780 | int (*readdir) (struct file *, void *, filldir_t); | 780 | int (*iterate) (struct file *, struct dir_context *); |
781 | unsigned int (*poll) (struct file *, struct poll_table_struct *); | 781 | unsigned int (*poll) (struct file *, struct poll_table_struct *); |
782 | long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); | 782 | long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); |
783 | long (*compat_ioctl) (struct file *, unsigned int, unsigned long); | 783 | long (*compat_ioctl) (struct file *, unsigned int, unsigned long); |
@@ -815,7 +815,7 @@ otherwise noted. | |||
815 | 815 | ||
816 | aio_write: called by io_submit(2) and other asynchronous I/O operations | 816 | aio_write: called by io_submit(2) and other asynchronous I/O operations |
817 | 817 | ||
818 | readdir: called when the VFS needs to read the directory contents | 818 | iterate: called when the VFS needs to read the directory contents |
819 | 819 | ||
820 | poll: called by the VFS when a process wants to check if there is | 820 | poll: called by the VFS when a process wants to check if there is |
821 | activity on this file and (optionally) go to sleep until there | 821 | activity on this file and (optionally) go to sleep until there |
diff --git a/fs/bad_inode.c b/fs/bad_inode.c index 922ad460bff9..7c93953030fb 100644 --- a/fs/bad_inode.c +++ b/fs/bad_inode.c | |||
@@ -45,7 +45,7 @@ static ssize_t bad_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
45 | return -EIO; | 45 | return -EIO; |
46 | } | 46 | } |
47 | 47 | ||
48 | static int bad_file_readdir(struct file *filp, void *dirent, filldir_t filldir) | 48 | static int bad_file_readdir(struct file *file, struct dir_context *ctx) |
49 | { | 49 | { |
50 | return -EIO; | 50 | return -EIO; |
51 | } | 51 | } |
@@ -152,7 +152,7 @@ static const struct file_operations bad_file_ops = | |||
152 | .write = bad_file_write, | 152 | .write = bad_file_write, |
153 | .aio_read = bad_file_aio_read, | 153 | .aio_read = bad_file_aio_read, |
154 | .aio_write = bad_file_aio_write, | 154 | .aio_write = bad_file_aio_write, |
155 | .readdir = bad_file_readdir, | 155 | .iterate = bad_file_readdir, |
156 | .poll = bad_file_poll, | 156 | .poll = bad_file_poll, |
157 | .unlocked_ioctl = bad_file_unlocked_ioctl, | 157 | .unlocked_ioctl = bad_file_unlocked_ioctl, |
158 | .compat_ioctl = bad_file_compat_ioctl, | 158 | .compat_ioctl = bad_file_compat_ioctl, |
diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c index 6c8ef1dd4bdf..78072e65f926 100644 --- a/fs/exportfs/expfs.c +++ b/fs/exportfs/expfs.c | |||
@@ -272,7 +272,7 @@ static int get_name(const struct path *path, char *name, struct dentry *child) | |||
272 | goto out; | 272 | goto out; |
273 | 273 | ||
274 | error = -EINVAL; | 274 | error = -EINVAL; |
275 | if (!file->f_op->readdir && !file->f_op->iterate) | 275 | if (!file->f_op->iterate) |
276 | goto out_close; | 276 | goto out_close; |
277 | 277 | ||
278 | buffer.name = name; | 278 | buffer.name = name; |
diff --git a/fs/readdir.c b/fs/readdir.c index 5d6578affbbf..a6245c9fd0e6 100644 --- a/fs/readdir.c +++ b/fs/readdir.c | |||
@@ -24,7 +24,7 @@ int iterate_dir(struct file *file, struct dir_context *ctx) | |||
24 | { | 24 | { |
25 | struct inode *inode = file_inode(file); | 25 | struct inode *inode = file_inode(file); |
26 | int res = -ENOTDIR; | 26 | int res = -ENOTDIR; |
27 | if (!file->f_op || (!file->f_op->readdir && !file->f_op->iterate)) | 27 | if (!file->f_op || !file->f_op->iterate) |
28 | goto out; | 28 | goto out; |
29 | 29 | ||
30 | res = security_file_permission(file, MAY_READ); | 30 | res = security_file_permission(file, MAY_READ); |
@@ -37,14 +37,9 @@ int iterate_dir(struct file *file, struct dir_context *ctx) | |||
37 | 37 | ||
38 | res = -ENOENT; | 38 | res = -ENOENT; |
39 | if (!IS_DEADDIR(inode)) { | 39 | if (!IS_DEADDIR(inode)) { |
40 | if (file->f_op->iterate) { | 40 | ctx->pos = file->f_pos; |
41 | ctx->pos = file->f_pos; | 41 | res = file->f_op->iterate(file, ctx); |
42 | res = file->f_op->iterate(file, ctx); | 42 | file->f_pos = ctx->pos; |
43 | file->f_pos = ctx->pos; | ||
44 | } else { | ||
45 | res = file->f_op->readdir(file, ctx, ctx->actor); | ||
46 | ctx->pos = file->f_pos; | ||
47 | } | ||
48 | file_accessed(file); | 43 | file_accessed(file); |
49 | } | 44 | } |
50 | mutex_unlock(&inode->i_mutex); | 45 | mutex_unlock(&inode->i_mutex); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index aa9770c7e8df..237af62976a6 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1526,7 +1526,6 @@ struct file_operations { | |||
1526 | ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); | 1526 | ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); |
1527 | ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t); | 1527 | ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t); |
1528 | ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); | 1528 | ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); |
1529 | int (*readdir) (struct file *, void *, filldir_t); | ||
1530 | int (*iterate) (struct file *, struct dir_context *); | 1529 | int (*iterate) (struct file *, struct dir_context *); |
1531 | unsigned int (*poll) (struct file *, struct poll_table_struct *); | 1530 | unsigned int (*poll) (struct file *, struct poll_table_struct *); |
1532 | long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); | 1531 | long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); |