diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-01-02 22:28:36 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-01-03 22:53:07 -0500 |
commit | cf31e70d6cf93f19fe9bf1144966ef40991ac723 (patch) | |
tree | 39cdc07b9d46b17ef882ddeb5041f4faec808662 /fs | |
parent | c972b4bc8331b432f51a5f1bc3ca7e020172717f (diff) |
vfs: new helper - vfs_ustat()
... and bury user_get_super()/statfs_by_dentry() - they are
purely internal now.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/compat.c | 9 | ||||
-rw-r--r-- | fs/internal.h | 1 | ||||
-rw-r--r-- | fs/statfs.c | 21 |
3 files changed, 15 insertions, 16 deletions
diff --git a/fs/compat.c b/fs/compat.c index c98787536bb8..9db5a6076610 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -342,16 +342,9 @@ asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, struct c | |||
342 | */ | 342 | */ |
343 | asmlinkage long compat_sys_ustat(unsigned dev, struct compat_ustat __user *u) | 343 | asmlinkage long compat_sys_ustat(unsigned dev, struct compat_ustat __user *u) |
344 | { | 344 | { |
345 | struct super_block *sb; | ||
346 | struct compat_ustat tmp; | 345 | struct compat_ustat tmp; |
347 | struct kstatfs sbuf; | 346 | struct kstatfs sbuf; |
348 | int err; | 347 | int err = vfs_ustat(new_decode_dev(dev), &sbuf); |
349 | |||
350 | sb = user_get_super(new_decode_dev(dev)); | ||
351 | if (!sb) | ||
352 | return -EINVAL; | ||
353 | err = statfs_by_dentry(sb->s_root, &sbuf); | ||
354 | drop_super(sb); | ||
355 | if (err) | 348 | if (err) |
356 | return err; | 349 | return err; |
357 | 350 | ||
diff --git a/fs/internal.h b/fs/internal.h index 839d3f9e9173..7b1cb1528ac2 100644 --- a/fs/internal.h +++ b/fs/internal.h | |||
@@ -78,6 +78,7 @@ extern int do_remount_sb(struct super_block *, int, void *, int); | |||
78 | extern bool grab_super_passive(struct super_block *sb); | 78 | extern bool grab_super_passive(struct super_block *sb); |
79 | extern struct dentry *mount_fs(struct file_system_type *, | 79 | extern struct dentry *mount_fs(struct file_system_type *, |
80 | int, const char *, void *); | 80 | int, const char *, void *); |
81 | extern struct super_block *user_get_super(dev_t); | ||
81 | 82 | ||
82 | /* | 83 | /* |
83 | * open.c | 84 | * open.c |
diff --git a/fs/statfs.c b/fs/statfs.c index 9cf04a118965..2aa6a22e0be2 100644 --- a/fs/statfs.c +++ b/fs/statfs.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/statfs.h> | 7 | #include <linux/statfs.h> |
8 | #include <linux/security.h> | 8 | #include <linux/security.h> |
9 | #include <linux/uaccess.h> | 9 | #include <linux/uaccess.h> |
10 | #include "internal.h" | ||
10 | 11 | ||
11 | static int flags_by_mnt(int mnt_flags) | 12 | static int flags_by_mnt(int mnt_flags) |
12 | { | 13 | { |
@@ -45,7 +46,7 @@ static int calculate_f_flags(struct vfsmount *mnt) | |||
45 | flags_by_sb(mnt->mnt_sb->s_flags); | 46 | flags_by_sb(mnt->mnt_sb->s_flags); |
46 | } | 47 | } |
47 | 48 | ||
48 | int statfs_by_dentry(struct dentry *dentry, struct kstatfs *buf) | 49 | static int statfs_by_dentry(struct dentry *dentry, struct kstatfs *buf) |
49 | { | 50 | { |
50 | int retval; | 51 | int retval; |
51 | 52 | ||
@@ -205,19 +206,23 @@ SYSCALL_DEFINE3(fstatfs64, unsigned int, fd, size_t, sz, struct statfs64 __user | |||
205 | return error; | 206 | return error; |
206 | } | 207 | } |
207 | 208 | ||
208 | SYSCALL_DEFINE2(ustat, unsigned, dev, struct ustat __user *, ubuf) | 209 | int vfs_ustat(dev_t dev, struct kstatfs *sbuf) |
209 | { | 210 | { |
210 | struct super_block *s; | 211 | struct super_block *s = user_get_super(dev); |
211 | struct ustat tmp; | ||
212 | struct kstatfs sbuf; | ||
213 | int err; | 212 | int err; |
214 | |||
215 | s = user_get_super(new_decode_dev(dev)); | ||
216 | if (!s) | 213 | if (!s) |
217 | return -EINVAL; | 214 | return -EINVAL; |
218 | 215 | ||
219 | err = statfs_by_dentry(s->s_root, &sbuf); | 216 | err = statfs_by_dentry(s->s_root, sbuf); |
220 | drop_super(s); | 217 | drop_super(s); |
218 | return err; | ||
219 | } | ||
220 | |||
221 | SYSCALL_DEFINE2(ustat, unsigned, dev, struct ustat __user *, ubuf) | ||
222 | { | ||
223 | struct ustat tmp; | ||
224 | struct kstatfs sbuf; | ||
225 | int err = vfs_ustat(new_decode_dev(dev), &sbuf); | ||
221 | if (err) | 226 | if (err) |
222 | return err; | 227 | return err; |
223 | 228 | ||