Merge git://oss.sgi.com:8090/xfs/xfs-2.6
[linux-drm-fsl-dcu.git] / fs / xfs / linux-2.6 / xfs_ioctl.c
index a74f854d91e6afe1d86ba2da278a733a5afa48e5..ff5c41ff8d40cd8c67d7609383cac2a8ff529d25 100644 (file)
@@ -41,8 +41,6 @@
 #include "xfs_error.h"
 #include "xfs_rw.h"
 #include "xfs_acl.h"
-#include "xfs_cap.h"
-#include "xfs_mac.h"
 #include "xfs_attr.h"
 #include "xfs_bmap.h"
 #include "xfs_buf_item.h"
@@ -107,9 +105,9 @@ xfs_find_handle(
                if (!file)
                    return -EBADF;
 
-               ASSERT(file->f_dentry);
-               ASSERT(file->f_dentry->d_inode);
-               inode = igrab(file->f_dentry->d_inode);
+               ASSERT(file->f_path.dentry);
+               ASSERT(file->f_path.dentry->d_inode);
+               inode = igrab(file->f_path.dentry->d_inode);
                fput(file);
                break;
        }
@@ -333,16 +331,19 @@ xfs_open_by_handle(
        }
 
        /* Ensure umount returns EBUSY on umounts while this file is open. */
-       mntget(parfilp->f_vfsmnt);
+       mntget(parfilp->f_path.mnt);
 
        /* Create file pointer. */
-       filp = dentry_open(dentry, parfilp->f_vfsmnt, hreq.oflags);
+       filp = dentry_open(dentry, parfilp->f_path.mnt, hreq.oflags);
        if (IS_ERR(filp)) {
                put_unused_fd(new_fd);
                return -XFS_ERROR(-PTR_ERR(filp));
        }
-       if (inode->i_mode & S_IFREG)
+       if (inode->i_mode & S_IFREG) {
+               /* invisible operation should not change atime */
+               filp->f_flags |= O_NOATIME;
                filp->f_op = &xfs_invis_file_operations;
+       }
 
        fd_install(new_fd, filp);
        return new_fd;
@@ -352,7 +353,6 @@ STATIC int
 xfs_readlink_by_handle(
        xfs_mount_t             *mp,
        void                    __user *arg,
-       struct file             *parfilp,
        struct inode            *parinode)
 {
        int                     error;
@@ -385,7 +385,7 @@ xfs_readlink_by_handle(
        aiov.iov_len    = olen;
        aiov.iov_base   = hreq.ohandle;
 
-       auio.uio_iov    = &aiov;
+       auio.uio_iov    = (struct kvec *)&aiov;
        auio.uio_iovcnt = 1;
        auio.uio_offset = 0;
        auio.uio_segflg = UIO_USERSPACE;
@@ -403,7 +403,6 @@ STATIC int
 xfs_fssetdm_by_handle(
        xfs_mount_t             *mp,
        void                    __user *arg,
-       struct file             *parfilp,
        struct inode            *parinode)
 {
        int                     error;
@@ -445,7 +444,6 @@ STATIC int
 xfs_attrlist_by_handle(
        xfs_mount_t             *mp,
        void                    __user *arg,
-       struct file             *parfilp,
        struct inode            *parinode)
 {
        int                     error;
@@ -566,7 +564,6 @@ STATIC int
 xfs_attrmulti_by_handle(
        xfs_mount_t             *mp,
        void                    __user *arg,
-       struct file             *parfilp,
        struct inode            *parinode)
 {
        int                     error;
@@ -686,7 +683,6 @@ xfs_ioc_xattr(
 STATIC int
 xfs_ioc_getbmap(
        bhv_desc_t              *bdp,
-       struct file             *filp,
        int                     flags,
        unsigned int            cmd,
        void                    __user *arg);
@@ -785,7 +781,7 @@ xfs_ioctl(
 
        case XFS_IOC_GETBMAP:
        case XFS_IOC_GETBMAPA:
-               return xfs_ioc_getbmap(bdp, filp, ioflags, cmd, arg);
+               return xfs_ioc_getbmap(bdp, ioflags, cmd, arg);
 
        case XFS_IOC_GETBMAPX:
                return xfs_ioc_getbmapx(bdp, arg);
@@ -799,16 +795,16 @@ xfs_ioctl(
                return xfs_open_by_handle(mp, arg, filp, inode);
 
        case XFS_IOC_FSSETDM_BY_HANDLE:
-               return xfs_fssetdm_by_handle(mp, arg, filp, inode);
+               return xfs_fssetdm_by_handle(mp, arg, inode);
 
        case XFS_IOC_READLINK_BY_HANDLE:
-               return xfs_readlink_by_handle(mp, arg, filp, inode);
+               return xfs_readlink_by_handle(mp, arg, inode);
 
        case XFS_IOC_ATTRLIST_BY_HANDLE:
-               return xfs_attrlist_by_handle(mp, arg, filp, inode);
+               return xfs_attrlist_by_handle(mp, arg, inode);
 
        case XFS_IOC_ATTRMULTI_BY_HANDLE:
-               return xfs_attrmulti_by_handle(mp, arg, filp, inode);
+               return xfs_attrmulti_by_handle(mp, arg, inode);
 
        case XFS_IOC_SWAPEXT: {
                error = xfs_swapext((struct xfs_swapext __user *)arg);
@@ -1092,11 +1088,6 @@ xfs_ioc_fsgeometry(
 /*
  * Linux extended inode flags interface.
  */
-#define LINUX_XFLAG_SYNC       0x00000008 /* Synchronous updates */
-#define LINUX_XFLAG_IMMUTABLE  0x00000010 /* Immutable file */
-#define LINUX_XFLAG_APPEND     0x00000020 /* writes to file may only append */
-#define LINUX_XFLAG_NODUMP     0x00000040 /* do not dump file */
-#define LINUX_XFLAG_NOATIME    0x00000080 /* do not update atime */
 
 STATIC unsigned int
 xfs_merge_ioc_xflags(
@@ -1105,23 +1096,23 @@ xfs_merge_ioc_xflags(
 {
        unsigned int    xflags = start;
 
-       if (flags & LINUX_XFLAG_IMMUTABLE)
+       if (flags & FS_IMMUTABLE_FL)
                xflags |= XFS_XFLAG_IMMUTABLE;
        else
                xflags &= ~XFS_XFLAG_IMMUTABLE;
-       if (flags & LINUX_XFLAG_APPEND)
+       if (flags & FS_APPEND_FL)
                xflags |= XFS_XFLAG_APPEND;
        else
                xflags &= ~XFS_XFLAG_APPEND;
-       if (flags & LINUX_XFLAG_SYNC)
+       if (flags & FS_SYNC_FL)
                xflags |= XFS_XFLAG_SYNC;
        else
                xflags &= ~XFS_XFLAG_SYNC;
-       if (flags & LINUX_XFLAG_NOATIME)
+       if (flags & FS_NOATIME_FL)
                xflags |= XFS_XFLAG_NOATIME;
        else
                xflags &= ~XFS_XFLAG_NOATIME;
-       if (flags & LINUX_XFLAG_NODUMP)
+       if (flags & FS_NODUMP_FL)
                xflags |= XFS_XFLAG_NODUMP;
        else
                xflags &= ~XFS_XFLAG_NODUMP;
@@ -1136,15 +1127,15 @@ xfs_di2lxflags(
        unsigned int    flags = 0;
 
        if (di_flags & XFS_DIFLAG_IMMUTABLE)
-               flags |= LINUX_XFLAG_IMMUTABLE;
+               flags |= FS_IMMUTABLE_FL;
        if (di_flags & XFS_DIFLAG_APPEND)
-               flags |= LINUX_XFLAG_APPEND;
+               flags |= FS_APPEND_FL;
        if (di_flags & XFS_DIFLAG_SYNC)
-               flags |= LINUX_XFLAG_SYNC;
+               flags |= FS_SYNC_FL;
        if (di_flags & XFS_DIFLAG_NOATIME)
-               flags |= LINUX_XFLAG_NOATIME;
+               flags |= FS_NOATIME_FL;
        if (di_flags & XFS_DIFLAG_NODUMP)
-               flags |= LINUX_XFLAG_NODUMP;
+               flags |= FS_NODUMP_FL;
        return flags;
 }
 
@@ -1244,9 +1235,9 @@ xfs_ioc_xattr(
                        break;
                }
 
-               if (flags & ~(LINUX_XFLAG_IMMUTABLE | LINUX_XFLAG_APPEND | \
-                             LINUX_XFLAG_NOATIME | LINUX_XFLAG_NODUMP | \
-                             LINUX_XFLAG_SYNC)) {
+               if (flags & ~(FS_IMMUTABLE_FL | FS_APPEND_FL | \
+                             FS_NOATIME_FL | FS_NODUMP_FL | \
+                             FS_SYNC_FL)) {
                        error = -EOPNOTSUPP;
                        break;
                }
@@ -1278,7 +1269,6 @@ xfs_ioc_xattr(
 STATIC int
 xfs_ioc_getbmap(
        bhv_desc_t              *bdp,
-       struct file             *filp,
        int                     ioflags,
        unsigned int            cmd,
        void                    __user *arg)