diff options
author | Erez Zadok <ezk@cs.sunysb.edu> | 2008-02-07 03:13:25 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-07 11:42:16 -0500 |
commit | deb21db7788b97a2bccdefe605433ef97f482689 (patch) | |
tree | 9adc35a3f7271c7c328f6b835203150763683ddb | |
parent | c9845ff1df5ba007b576c26c4f1e7ca43b7c7e87 (diff) |
VFS: swap do_ioctl and vfs_ioctl names
Rename old vfs_ioctl to do_ioctl, because the comment above it clearly
indicates that it is an internal function not to be exported to modules;
therefore it should have a more traditional do_XXX name. The new do_ioctl
is exported in fs.h but not to modules.
Rename the old do_ioctl to vfs_ioctl because the names vfs_XXX should
preferably be reserved to callable VFS functions which modules may call, as
many other vfs_XXX functions already do. Export the new vfs_ioctl to GPL
modules so others can use it (including Unionfs and eCryptfs). Add DocBook
for new vfs_ioctl.
[akpm@linux-foundation.org: fix build]
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/compat_ioctl.c | 2 | ||||
-rw-r--r-- | fs/ioctl.c | 28 | ||||
-rw-r--r-- | include/linux/fs.h | 4 |
3 files changed, 24 insertions, 10 deletions
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index ffdc022cae64..614bd75b5a4a 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -2986,7 +2986,7 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd, | |||
2986 | } | 2986 | } |
2987 | 2987 | ||
2988 | do_ioctl: | 2988 | do_ioctl: |
2989 | error = vfs_ioctl(filp, fd, cmd, arg); | 2989 | error = do_vfs_ioctl(filp, fd, cmd, arg); |
2990 | out_fput: | 2990 | out_fput: |
2991 | fput_light(filp, fput_needed); | 2991 | fput_light(filp, fput_needed); |
2992 | out: | 2992 | out: |
diff --git a/fs/ioctl.c b/fs/ioctl.c index 652cacf433ff..e6500cd12258 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c | |||
@@ -16,8 +16,20 @@ | |||
16 | 16 | ||
17 | #include <asm/ioctls.h> | 17 | #include <asm/ioctls.h> |
18 | 18 | ||
19 | static long do_ioctl(struct file *filp, unsigned int cmd, | 19 | /** |
20 | unsigned long arg) | 20 | * vfs_ioctl - call filesystem specific ioctl methods |
21 | * @filp: [in] open file to invoke ioctl method on | ||
22 | * @cmd: [in] ioctl command to execute | ||
23 | * @arg: [in/out] command-specific argument for ioctl | ||
24 | * | ||
25 | * Invokes filesystem specific ->unlocked_ioctl, if one exists; otherwise | ||
26 | * invokes * filesystem specific ->ioctl method. If neither method exists, | ||
27 | * returns -ENOTTY. | ||
28 | * | ||
29 | * Returns 0 on success, -errno on error. | ||
30 | */ | ||
31 | long vfs_ioctl(struct file *filp, unsigned int cmd, | ||
32 | unsigned long arg) | ||
21 | { | 33 | { |
22 | int error = -ENOTTY; | 34 | int error = -ENOTTY; |
23 | 35 | ||
@@ -72,18 +84,18 @@ static int file_ioctl(struct file *filp, unsigned int cmd, | |||
72 | return put_user(i_size_read(inode) - filp->f_pos, p); | 84 | return put_user(i_size_read(inode) - filp->f_pos, p); |
73 | } | 85 | } |
74 | 86 | ||
75 | return do_ioctl(filp, cmd, arg); | 87 | return vfs_ioctl(filp, cmd, arg); |
76 | } | 88 | } |
77 | 89 | ||
78 | /* | 90 | /* |
79 | * When you add any new common ioctls to the switches above and below | 91 | * When you add any new common ioctls to the switches above and below |
80 | * please update compat_sys_ioctl() too. | 92 | * please update compat_sys_ioctl() too. |
81 | * | 93 | * |
82 | * vfs_ioctl() is not for drivers and not intended to be EXPORT_SYMBOL()'d. | 94 | * do_vfs_ioctl() is not for drivers and not intended to be EXPORT_SYMBOL()'d. |
83 | * It's just a simple helper for sys_ioctl and compat_sys_ioctl. | 95 | * It's just a simple helper for sys_ioctl and compat_sys_ioctl. |
84 | */ | 96 | */ |
85 | int vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, | 97 | int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, |
86 | unsigned long arg) | 98 | unsigned long arg) |
87 | { | 99 | { |
88 | unsigned int flag; | 100 | unsigned int flag; |
89 | int on, error = 0; | 101 | int on, error = 0; |
@@ -152,7 +164,7 @@ int vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, | |||
152 | if (S_ISREG(filp->f_path.dentry->d_inode->i_mode)) | 164 | if (S_ISREG(filp->f_path.dentry->d_inode->i_mode)) |
153 | error = file_ioctl(filp, cmd, arg); | 165 | error = file_ioctl(filp, cmd, arg); |
154 | else | 166 | else |
155 | error = do_ioctl(filp, cmd, arg); | 167 | error = vfs_ioctl(filp, cmd, arg); |
156 | break; | 168 | break; |
157 | } | 169 | } |
158 | return error; | 170 | return error; |
@@ -172,7 +184,7 @@ asmlinkage long sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) | |||
172 | if (error) | 184 | if (error) |
173 | goto out_fput; | 185 | goto out_fput; |
174 | 186 | ||
175 | error = vfs_ioctl(filp, fd, cmd, arg); | 187 | error = do_vfs_ioctl(filp, fd, cmd, arg); |
176 | out_fput: | 188 | out_fput: |
177 | fput_light(filp, fput_needed); | 189 | fput_light(filp, fput_needed); |
178 | out: | 190 | out: |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 109734bf6377..2925f7011ece 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1941,7 +1941,9 @@ extern int vfs_stat_fd(int dfd, char __user *, struct kstat *); | |||
1941 | extern int vfs_lstat_fd(int dfd, char __user *, struct kstat *); | 1941 | extern int vfs_lstat_fd(int dfd, char __user *, struct kstat *); |
1942 | extern int vfs_fstat(unsigned int, struct kstat *); | 1942 | extern int vfs_fstat(unsigned int, struct kstat *); |
1943 | 1943 | ||
1944 | extern int vfs_ioctl(struct file *, unsigned int, unsigned int, unsigned long); | 1944 | extern long vfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); |
1945 | extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, | ||
1946 | unsigned long arg); | ||
1945 | 1947 | ||
1946 | extern void get_filesystem(struct file_system_type *fs); | 1948 | extern void get_filesystem(struct file_system_type *fs); |
1947 | extern void put_filesystem(struct file_system_type *fs); | 1949 | extern void put_filesystem(struct file_system_type *fs); |