diff options
Diffstat (limited to 'arch/parisc/hpux/sys_hpux.c')
| -rw-r--r-- | arch/parisc/hpux/sys_hpux.c | 75 | 
1 files changed, 23 insertions, 52 deletions
diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c index ba430a03bc7..d9dc6cd3b7d 100644 --- a/arch/parisc/hpux/sys_hpux.c +++ b/arch/parisc/hpux/sys_hpux.c @@ -28,7 +28,6 @@  #include <linux/namei.h>  #include <linux/sched.h>  #include <linux/slab.h> -#include <linux/smp_lock.h>  #include <linux/syscalls.h>  #include <linux/utsname.h>  #include <linux/vfs.h> @@ -137,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; @@ -186,26 +178,21 @@ struct hpux_statfs {       int16_t f_pad;  }; -static int do_statfs_hpux(struct path *path, struct hpux_statfs *buf) +static int do_statfs_hpux(struct kstatfs *st, struct hpux_statfs __user *p)  { -	struct kstatfs st; -	int retval; -	 -	retval = vfs_statfs(path, &st); -	if (retval) -		return retval; - -	memset(buf, 0, sizeof(*buf)); -	buf->f_type = st.f_type; -	buf->f_bsize = st.f_bsize; -	buf->f_blocks = st.f_blocks; -	buf->f_bfree = st.f_bfree; -	buf->f_bavail = st.f_bavail; -	buf->f_files = st.f_files; -	buf->f_ffree = st.f_ffree; -	buf->f_fsid[0] = st.f_fsid.val[0]; -	buf->f_fsid[1] = st.f_fsid.val[1]; - +	struct hpux_statfs buf; +	memset(&buf, 0, sizeof(buf)); +	buf.f_type = st->f_type; +	buf.f_bsize = st->f_bsize; +	buf.f_blocks = st->f_blocks; +	buf.f_bfree = st->f_bfree; +	buf.f_bavail = st->f_bavail; +	buf.f_files = st->f_files; +	buf.f_ffree = st->f_ffree; +	buf.f_fsid[0] = st->f_fsid.val[0]; +	buf.f_fsid[1] = st->f_fsid.val[1]; +	if (copy_to_user(p, &buf, sizeof(buf))) +		return -EFAULT;  	return 0;  } @@ -213,35 +200,19 @@ static int do_statfs_hpux(struct path *path, struct hpux_statfs *buf)  asmlinkage long hpux_statfs(const char __user *pathname,  						struct hpux_statfs __user *buf)  { -	struct path path; -	int error; - -	error = user_path(pathname, &path); -	if (!error) { -		struct hpux_statfs tmp; -		error = do_statfs_hpux(&path, &tmp); -		if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) -			error = -EFAULT; -		path_put(&path); -	} +	struct kstatfs st; +	int error = user_statfs(pathname, &st); +	if (!error) +		error = do_statfs_hpux(&st, buf);  	return error;  }  asmlinkage long hpux_fstatfs(unsigned int fd, struct hpux_statfs __user * buf)  { -	struct file *file; -	struct hpux_statfs tmp; -	int error; - -	error = -EBADF; -	file = fget(fd); -	if (!file) -		goto out; -	error = do_statfs_hpux(&file->f_path, &tmp); -	if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) -		error = -EFAULT; -	fput(file); - out: +	struct kstatfs st; +	int error = fd_statfs(fd, &st); +	if (!error) +		error = do_statfs_hpux(&st, buf);  	return error;  }  | 
