示例#1
0
int vfs_statfs(struct path *path, struct kstatfs *buf)
{
	int error;

	error = statfs_by_dentry(path->dentry, buf);
	if (!error)
		buf->f_flags = calculate_f_flags(path->mnt);
	return error;
}
示例#2
0
int vfs_ustat(dev_t dev, struct kstatfs *sbuf)
{
	struct super_block *s = user_get_super(dev);
	int err;
	if (!s)
		return -EINVAL;

	err = statfs_by_dentry(s->s_root, sbuf);
	drop_super(s);
	return err;
}
示例#3
0
SYSCALL_DEFINE2(ustat, unsigned, dev, struct ustat __user *, ubuf)
{
	struct super_block *s;
	struct ustat tmp;
	struct kstatfs sbuf;
	int err;

	s = user_get_super(new_decode_dev(dev));
	if (!s)
		return -EINVAL;

	err = statfs_by_dentry(s->s_root, &sbuf);
	drop_super(s);
	if (err)
		return err;

	memset(&tmp,0,sizeof(struct ustat));
	tmp.f_tfree = sbuf.f_bfree;
	tmp.f_tinode = sbuf.f_ffree;

	return copy_to_user(ubuf, &tmp, sizeof(struct ustat)) ? -EFAULT : 0;
}
示例#4
0
int vfs_statfs(struct path *path, struct kstatfs *buf)
{
	int error;

	ktime_t statfs_t, statfs_diff;
	char pathname[256], *statfs_path;
	if (path) {
		statfs_path = d_path(path, pathname, sizeof(pathname));
		if (IS_ERR(statfs_path))
			statfs_path = "(unknown)";
	} else
		statfs_path = "(unknown)";

	statfs_t = ktime_get();
	error = statfs_by_dentry(path->dentry, buf);
	if (!error)
		buf->f_flags = calculate_f_flags(path->mnt);
	statfs_diff = ktime_sub(ktime_get(), statfs_t);
	if (ktime_to_ns(statfs_diff) >= 5000000000LL)
		pr_info("VFS: %s pid:%d(%s)(parent:%d/%s) takes %lld nsec to statfs %s.\n", __func__, current->pid, current->comm, current->parent->pid, current->parent->comm, ktime_to_ns(statfs_diff), statfs_path);
	return error;
}
示例#5
0
/*
 * This is a copy of sys_ustat, just dealing with a structure layout.
 * Given how simple this syscall is that apporach is more maintainable
 * than the various conversion hacks.
 */
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);
	if (err)
		return err;

	memset(&tmp, 0, sizeof(struct compat_ustat));
	tmp.f_tfree = sbuf.f_bfree;
	tmp.f_tinode = sbuf.f_ffree;
	if (copy_to_user(u, &tmp, sizeof(struct compat_ustat)))
		return -EFAULT;
	return 0;
}
示例#6
0
int vfs_statfs(struct path *path, struct kstatfs *buf)
{
	return statfs_by_dentry(path->dentry, buf);
}