Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ebabe9a9 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Al Viro
Browse files

pass a struct path to vfs_statfs



We'll need the path to implement the flags field for statvfs support.
We do have it available in all callers except:

 - ecryptfs_statfs.  This one doesn't actually need vfs_statfs but just
   needs to do a caller to the lower filesystem statfs method.
 - sys_ustat.  Add a non-exported statfs_by_dentry helper for it which
   doesn't won't be able to fill out the flags field later on.

In addition rename the helpers for statfs vs fstatfs to do_*statfs instead
of the misleading vfs prefix.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 336fb3b9
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -234,11 +234,11 @@ linux_to_osf_statfs(struct kstatfs *linux_stat, struct osf_statfs __user *osf_st
}

static int
do_osf_statfs(struct dentry * dentry, struct osf_statfs __user *buffer,
do_osf_statfs(struct path *path, struct osf_statfs __user *buffer,
	      unsigned long bufsiz)
{
	struct kstatfs linux_stat;
	int error = vfs_statfs(dentry, &linux_stat);
	int error = vfs_statfs(path, &linux_stat);
	if (!error)
		error = linux_to_osf_statfs(&linux_stat, buffer, bufsiz);
	return error;	
@@ -252,7 +252,7 @@ SYSCALL_DEFINE3(osf_statfs, char __user *, pathname,

	retval = user_path(pathname, &path);
	if (!retval) {
		retval = do_osf_statfs(path.dentry, buffer, bufsiz);
		retval = do_osf_statfs(&path buffer, bufsiz);
		path_put(&path);
	}
	return retval;
@@ -267,7 +267,7 @@ SYSCALL_DEFINE3(osf_fstatfs, unsigned long, fd,
	retval = -EBADF;
	file = fget(fd);
	if (file) {
		retval = do_osf_statfs(file->f_path.dentry, buffer, bufsiz);
		retval = do_osf_statfs(&file->f_path, buffer, bufsiz);
		fput(file);
	}
	return retval;
+5 −5
Original line number Diff line number Diff line
@@ -145,7 +145,7 @@ static int hpux_ustat(dev_t dev, struct hpux_ustat __user *ubuf)
	s = user_get_super(dev);
	if (s == NULL)
		goto out;
	err = vfs_statfs(s->s_root, &sbuf);
	err = statfs_by_dentry(s->s_root, &sbuf);
	drop_super(s);
	if (err)
		goto out;
@@ -186,12 +186,12 @@ struct hpux_statfs {
     int16_t f_pad;
};

static int vfs_statfs_hpux(struct dentry *dentry, struct hpux_statfs *buf)
static int do_statfs_hpux(struct path *path, struct hpux_statfs *buf)
{
	struct kstatfs st;
	int retval;
	
	retval = vfs_statfs(dentry, &st);
	retval = vfs_statfs(path, &st);
	if (retval)
		return retval;

@@ -219,7 +219,7 @@ asmlinkage long hpux_statfs(const char __user *pathname,
	error = user_path(pathname, &path);
	if (!error) {
		struct hpux_statfs tmp;
		error = vfs_statfs_hpux(path.dentry, &tmp);
		error = do_statfs_hpux(&path, &tmp);
		if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
			error = -EFAULT;
		path_put(&path);
@@ -237,7 +237,7 @@ asmlinkage long hpux_fstatfs(unsigned int fd, struct hpux_statfs __user * buf)
	file = fget(fd);
	if (!file)
		goto out;
	error = vfs_statfs_hpux(file->f_path.dentry, &tmp);
	error = do_statfs_hpux(&file->f_path, &tmp);
	if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
		error = -EFAULT;
	fput(file);
+1 −1
Original line number Diff line number Diff line
@@ -146,7 +146,7 @@ static int cachefiles_daemon_add_cache(struct cachefiles_cache *cache)
		goto error_unsupported;

	/* get the cache size and blocksize */
	ret = vfs_statfs(root, &stats);
	ret = vfs_statfs(&path, &stats);
	if (ret < 0)
		goto error_unsupported;

+5 −1
Original line number Diff line number Diff line
@@ -683,6 +683,10 @@ int cachefiles_has_space(struct cachefiles_cache *cache,
			 unsigned fnr, unsigned bnr)
{
	struct kstatfs stats;
	struct path path = {
		.mnt	= cache->mnt,
		.dentry	= cache->mnt->mnt_root,
	};
	int ret;

	//_enter("{%llu,%llu,%llu,%llu,%llu,%llu},%u,%u",
@@ -697,7 +701,7 @@ int cachefiles_has_space(struct cachefiles_cache *cache,
	/* find out how many pages of blockdev are available */
	memset(&stats, 0, sizeof(stats));

	ret = vfs_statfs(cache->mnt->mnt_root, &stats);
	ret = vfs_statfs(&path, &stats);
	if (ret < 0) {
		if (ret == -EIO)
			cachefiles_io_error(cache, "statfs failed");
+5 −5
Original line number Diff line number Diff line
@@ -266,7 +266,7 @@ asmlinkage long compat_sys_statfs(const char __user *pathname, struct compat_sta
	error = user_path(pathname, &path);
	if (!error) {
		struct kstatfs tmp;
		error = vfs_statfs(path.dentry, &tmp);
		error = vfs_statfs(&path, &tmp);
		if (!error)
			error = put_compat_statfs(buf, &tmp);
		path_put(&path);
@@ -284,7 +284,7 @@ asmlinkage long compat_sys_fstatfs(unsigned int fd, struct compat_statfs __user
	file = fget(fd);
	if (!file)
		goto out;
	error = vfs_statfs(file->f_path.dentry, &tmp);
	error = vfs_statfs(&file->f_path, &tmp);
	if (!error)
		error = put_compat_statfs(buf, &tmp);
	fput(file);
@@ -334,7 +334,7 @@ asmlinkage long compat_sys_statfs64(const char __user *pathname, compat_size_t s
	error = user_path(pathname, &path);
	if (!error) {
		struct kstatfs tmp;
		error = vfs_statfs(path.dentry, &tmp);
		error = vfs_statfs(&path, &tmp);
		if (!error)
			error = put_compat_statfs64(buf, &tmp);
		path_put(&path);
@@ -355,7 +355,7 @@ asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, struct c
	file = fget(fd);
	if (!file)
		goto out;
	error = vfs_statfs(file->f_path.dentry, &tmp);
	error = vfs_statfs(&file->f_path, &tmp);
	if (!error)
		error = put_compat_statfs64(buf, &tmp);
	fput(file);
@@ -378,7 +378,7 @@ asmlinkage long compat_sys_ustat(unsigned dev, struct compat_ustat __user *u)
	sb = user_get_super(new_decode_dev(dev));
	if (!sb)
		return -EINVAL;
	err = vfs_statfs(sb->s_root, &sbuf);
	err = statfs_by_dentry(sb->s_root, &sbuf);
	drop_super(sb);
	if (err)
		return err;
Loading