提交 cf31e70d 编写于 作者: A Al Viro

vfs: new helper - vfs_ustat()

... and bury user_get_super()/statfs_by_dentry() - they are
purely internal now.
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 c972b4bc
......@@ -136,16 +136,9 @@ struct hpux_ustat {
*/
static int hpux_ustat(dev_t dev, struct hpux_ustat __user *ubuf)
{
struct super_block *s;
struct hpux_ustat tmp; /* Changed to hpux_ustat */
struct kstatfs sbuf;
int err = -EINVAL;
s = user_get_super(dev);
if (s == NULL)
goto out;
err = statfs_by_dentry(s->s_root, &sbuf);
drop_super(s);
int err = vfs_ustat(dev, &sbuf);
if (err)
goto out;
......
......@@ -342,16 +342,9 @@ asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, struct c
*/
asmlinkage long compat_sys_ustat(unsigned dev, struct compat_ustat __user *u)
{
struct super_block *sb;
struct compat_ustat tmp;
struct kstatfs sbuf;
int err;
sb = user_get_super(new_decode_dev(dev));
if (!sb)
return -EINVAL;
err = statfs_by_dentry(sb->s_root, &sbuf);
drop_super(sb);
int err = vfs_ustat(new_decode_dev(dev), &sbuf);
if (err)
return err;
......
......@@ -78,6 +78,7 @@ extern int do_remount_sb(struct super_block *, int, void *, int);
extern bool grab_super_passive(struct super_block *sb);
extern struct dentry *mount_fs(struct file_system_type *,
int, const char *, void *);
extern struct super_block *user_get_super(dev_t);
/*
* open.c
......
......@@ -7,6 +7,7 @@
#include <linux/statfs.h>
#include <linux/security.h>
#include <linux/uaccess.h>
#include "internal.h"
static int flags_by_mnt(int mnt_flags)
{
......@@ -45,7 +46,7 @@ static int calculate_f_flags(struct vfsmount *mnt)
flags_by_sb(mnt->mnt_sb->s_flags);
}
int statfs_by_dentry(struct dentry *dentry, struct kstatfs *buf)
static int statfs_by_dentry(struct dentry *dentry, struct kstatfs *buf)
{
int retval;
......@@ -205,19 +206,23 @@ SYSCALL_DEFINE3(fstatfs64, unsigned int, fd, size_t, sz, struct statfs64 __user
return error;
}
SYSCALL_DEFINE2(ustat, unsigned, dev, struct ustat __user *, ubuf)
int vfs_ustat(dev_t dev, struct kstatfs *sbuf)
{
struct super_block *s;
struct ustat tmp;
struct kstatfs sbuf;
struct super_block *s = user_get_super(dev);
int err;
s = user_get_super(new_decode_dev(dev));
if (!s)
return -EINVAL;
err = statfs_by_dentry(s->s_root, &sbuf);
err = statfs_by_dentry(s->s_root, sbuf);
drop_super(s);
return err;
}
SYSCALL_DEFINE2(ustat, unsigned, dev, struct ustat __user *, ubuf)
{
struct ustat tmp;
struct kstatfs sbuf;
int err = vfs_ustat(new_decode_dev(dev), &sbuf);
if (err)
return err;
......
......@@ -1939,7 +1939,7 @@ extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
extern int vfs_statfs(struct path *, struct kstatfs *);
extern int user_statfs(const char __user *, struct kstatfs *);
extern int fd_statfs(int, struct kstatfs *);
extern int statfs_by_dentry(struct dentry *, struct kstatfs *);
extern int vfs_ustat(dev_t, struct kstatfs *);
extern int freeze_super(struct super_block *super);
extern int thaw_super(struct super_block *super);
extern bool our_mnt(struct vfsmount *mnt);
......@@ -2531,7 +2531,6 @@ extern void put_filesystem(struct file_system_type *fs);
extern struct file_system_type *get_fs_type(const char *name);
extern struct super_block *get_super(struct block_device *);
extern struct super_block *get_active_super(struct block_device *bdev);
extern struct super_block *user_get_super(dev_t);
extern void drop_super(struct super_block *sb);
extern void iterate_supers(void (*)(struct super_block *, void *), void *);
extern void iterate_supers_type(struct file_system_type *,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册