#include <linux/pagemap.h>
#include <linux/syscalls.h>
#include <linux/rcupdate.h>
-#include <linux/audit.h>
#include <linux/vs_limit.h>
#include <linux/vs_dlimit.h>
#include <linux/vserver/xid.h>
#include <asm/unistd.h>
-int vfs_statfs(struct dentry *dentry, struct kstatfs *buf)
+int vfs_statfs(struct super_block *sb, struct kstatfs *buf)
{
int retval = -ENODEV;
- if (dentry) {
- struct super_block *sb = dentry->d_sb;
-
+ if (sb) {
retval = -ENOSYS;
if (sb->s_op->statfs) {
memset(buf, 0, sizeof(*buf));
- retval = security_sb_statfs(dentry);
+ retval = security_sb_statfs(sb);
if (retval)
return retval;
- retval = sb->s_op->statfs(dentry, buf);
+ retval = sb->s_op->statfs(sb, buf);
if (retval == 0 && buf->f_frsize == 0)
buf->f_frsize = buf->f_bsize;
}
EXPORT_SYMBOL(vfs_statfs);
-static int vfs_statfs_native(struct dentry *dentry, struct statfs *buf)
+static int vfs_statfs_native(struct super_block *sb, struct statfs *buf)
{
struct kstatfs st;
int retval;
- retval = vfs_statfs(dentry, &st);
+ retval = vfs_statfs(sb, &st);
if (retval)
return retval;
return 0;
}
-static int vfs_statfs64(struct dentry *dentry, struct statfs64 *buf)
+static int vfs_statfs64(struct super_block *sb, struct statfs64 *buf)
{
struct kstatfs st;
int retval;
- retval = vfs_statfs(dentry, &st);
+ retval = vfs_statfs(sb, &st);
if (retval)
return retval;
error = user_path_walk(path, &nd);
if (!error) {
struct statfs tmp;
- error = vfs_statfs_native(nd.dentry, &tmp);
+ error = vfs_statfs_native(nd.dentry->d_inode->i_sb, &tmp);
if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
error = -EFAULT;
path_release(&nd);
error = user_path_walk(path, &nd);
if (!error) {
struct statfs64 tmp;
- error = vfs_statfs64(nd.dentry, &tmp);
+ error = vfs_statfs64(nd.dentry->d_inode->i_sb, &tmp);
if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
error = -EFAULT;
path_release(&nd);
file = fget(fd);
if (!file)
goto out;
- error = vfs_statfs_native(file->f_dentry, &tmp);
+ error = vfs_statfs_native(file->f_dentry->d_inode->i_sb, &tmp);
if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
error = -EFAULT;
fput(file);
file = fget(fd);
if (!file)
goto out;
- error = vfs_statfs64(file->f_dentry, &tmp);
+ error = vfs_statfs64(file->f_dentry->d_inode->i_sb, &tmp);
if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
error = -EFAULT;
fput(file);
error = locks_verify_truncate(inode, file, length);
if (!error)
- error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, file);
+ error = do_truncate(dentry, length, 0, file);
out_putf:
fput(file);
out:
return error;
}
-EXPORT_SYMBOL_GPL(sys_chdir);
-
asmlinkage long sys_fchdir(unsigned int fd)
{
struct file *file;
return error;
}
-EXPORT_SYMBOL_GPL(sys_chroot);
-
asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
{
struct inode * inode;
dentry = file->f_dentry;
inode = dentry->d_inode;
- audit_inode(NULL, inode);
-
err = -EROFS;
if (IS_RDONLY(inode) || MNT_IS_RDONLY(file->f_vfsmnt))
goto out_putf;
file = fget(fd);
if (file) {
- struct dentry * dentry;
- dentry = file->f_dentry;
- audit_inode(NULL, dentry->d_inode);
- error = chown_common(dentry, file->f_vfsmnt, user, group);
+ error = chown_common(file->f_dentry, file->f_vfsmnt, user, group);
fput(file);
}
return error;
* a fully instantiated struct file to the caller.
* This function is meant to be called from within a filesystem's
* lookup method.
- * Beware of calling it for non-regular files! Those ->open methods might block
- * (e.g. in fifo_open), leaving you with parent locked (and in case of fifo,
- * leading to a deadlock, as nobody can open that fifo anymore, because
- * another process to open fifo will block on locked parent when doing lookup).
* Note that in case of error, nd->intent.open.file is destroyed, but the
* path information remains valid.
* If the open callback is set to NULL, then the standard f_op->open()
fdt = files_fdtable(files);
fd = find_next_zero_bit(fdt->open_fds->fds_bits,
fdt->max_fdset,
- files->next_fd);
+ fdt->next_fd);
/*
* N.B. For clone tasks sharing a files structure, this test
FD_SET(fd, fdt->open_fds);
FD_CLR(fd, fdt->close_on_exec);
- files->next_fd = fd + 1;
+ fdt->next_fd = fd + 1;
vx_openfd_inc(fd);
#if 1
/* Sanity check */
{
struct fdtable *fdt = files_fdtable(files);
__FD_CLR(fd, fdt->open_fds);
- if (fd < files->next_fd)
- files->next_fd = fd;
+ if (fd < fdt->next_fd)
+ fdt->next_fd = fd;
vx_openfd_dec(fd);
}
prevent_tail_call(ret);
return ret;
}
+EXPORT_SYMBOL_GPL(sys_open);
asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
int mode)
prevent_tail_call(ret);
return ret;
}
+EXPORT_SYMBOL_GPL(sys_openat);
#ifndef __alpha__
}
if (filp->f_op && filp->f_op->flush)
- retval = filp->f_op->flush(filp, id);
+ retval = filp->f_op->flush(filp);
dnotify_flush(filp, id);
locks_remove_posix(filp, id);
asmlinkage long sys_vhangup(void)
{
if (capable(CAP_SYS_TTY_CONFIG)) {
- /* XXX: this needs locking */
tty_vhangup(current->signal->tty);
return 0;
}