X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fioctl.c;h=b1c6cab06d64e01f6155319f9ed1af91b4ee1ab2;hb=8d4323245786070eef0252095f0d22e9ac498ab4;hp=1b18d741439bf9f8367bd9c0fbbc102fd2e46e66;hpb=cace1c4618b6c6442b7dc973e935e7f3268e4aa7;p=linux-2.6.git diff --git a/fs/ioctl.c b/fs/ioctl.c index 1b18d7414..b1c6cab06 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c @@ -4,17 +4,17 @@ * Copyright (C) 1991, 1992 Linus Torvalds */ -#include #include #include #include +#include #include #include #include #include #include #include -#include +#include #include #include @@ -40,7 +40,7 @@ static long do_ioctl(struct file *filp, unsigned int cmd, goto out; } else if (filp->f_op->ioctl) { lock_kernel(); - error = filp->f_op->ioctl(filp->f_dentry->d_inode, + error = filp->f_op->ioctl(filp->f_path.dentry->d_inode, filp, cmd, arg); unlock_kernel(); } @@ -54,7 +54,7 @@ static int file_ioctl(struct file *filp, unsigned int cmd, { int error; int block; - struct inode * inode = filp->f_dentry->d_inode; + struct inode * inode = filp->f_path.dentry->d_inode; int __user *p = (int __user *)arg; switch (cmd) { @@ -146,29 +146,29 @@ int vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, unsigned lon break; case FIOQSIZE: - if (S_ISDIR(filp->f_dentry->d_inode->i_mode) || - S_ISREG(filp->f_dentry->d_inode->i_mode) || - S_ISLNK(filp->f_dentry->d_inode->i_mode)) { - loff_t res = inode_get_bytes(filp->f_dentry->d_inode); + if (S_ISDIR(filp->f_path.dentry->d_inode->i_mode) || + S_ISREG(filp->f_path.dentry->d_inode->i_mode) || + S_ISLNK(filp->f_path.dentry->d_inode->i_mode)) { + loff_t res = inode_get_bytes(filp->f_path.dentry->d_inode); error = copy_to_user((loff_t __user *)arg, &res, sizeof(res)) ? -EFAULT : 0; } else error = -ENOTTY; break; #ifdef CONFIG_VSERVER_LEGACY -#ifndef CONFIG_INOXID_NONE - case FIOC_GETXID: { +#ifndef CONFIG_TAGGING_NONE + case FIOC_GETTAG: { struct inode *inode = filp->f_dentry->d_inode; /* fixme: if stealth, return -ENOTTY */ error = -EPERM; if (capable(CAP_CONTEXT)) - error = put_user(inode->i_xid, (int *) arg); + error = put_user(inode->i_tag, (int __user *) arg); break; } - case FIOC_SETXID: { + case FIOC_SETTAG: { struct inode *inode = filp->f_dentry->d_inode; - int xid; + int tag; /* fixme: if stealth, return -ENOTTY */ error = -EPERM; @@ -178,13 +178,13 @@ int vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, unsigned lon if (IS_RDONLY(inode)) break; error = -ENOSYS; - if (!(inode->i_sb->s_flags & MS_TAGXID)) + if (!(inode->i_sb->s_flags & MS_TAGGED)) break; error = -EFAULT; - if (get_user(xid, (int *) arg)) + if (get_user(tag, (int __user *) arg)) break; error = 0; - inode->i_xid = (xid & 0xFFFF); + inode->i_tag = (tag & 0xFFFF); inode->i_ctime = CURRENT_TIME; mark_inode_dirty(inode); break; @@ -197,8 +197,24 @@ int vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, unsigned lon error = vx_proc_ioctl(filp->f_dentry->d_inode, filp, cmd, arg); break; #endif + /* + * These cmds needed for PLK - don't lose them! + */ + case FIOC_SETIATTR: + case FIOC_GETIATTR: + /* + * Verify that this filp is a file object, + * not (say) a socket. + */ + error = -ENOTTY; + if (S_ISREG(filp->f_dentry->d_inode->i_mode) || + S_ISDIR(filp->f_dentry->d_inode->i_mode)) + error = vc_iattr_ioctl(filp->f_dentry, + cmd, arg); + break; + default: - if (S_ISREG(filp->f_dentry->d_inode->i_mode)) + if (S_ISREG(filp->f_path.dentry->d_inode->i_mode)) error = file_ioctl(filp, cmd, arg); else error = do_ioctl(filp, cmd, arg);