[XFS] Fix merge failures
[pandora-kernel.git] / fs / xfs / linux-2.6 / xfs_ioctl.c
index 03c55b8..67205f6 100644 (file)
@@ -68,7 +68,7 @@
  * XFS_IOC_PATH_TO_HANDLE
  *    returns full handle for a path
  */
-STATIC int
+int
 xfs_find_handle(
        unsigned int            cmd,
        xfs_fsop_handlereq_t    *hreq)
@@ -245,13 +245,14 @@ xfs_vget_fsop_handlereq(
        return 0;
 }
 
-STATIC int
+int
 xfs_open_by_handle(
        xfs_mount_t             *mp,
        xfs_fsop_handlereq_t    *hreq,
        struct file             *parfilp,
        struct inode            *parinode)
 {
+       const struct cred       *cred = current_cred();
        int                     error;
        int                     new_fd;
        int                     permflag;
@@ -314,15 +315,16 @@ xfs_open_by_handle(
        mntget(parfilp->f_path.mnt);
 
        /* Create file pointer. */
-       filp = dentry_open(dentry, parfilp->f_path.mnt, hreq->oflags);
+       filp = dentry_open(dentry, parfilp->f_path.mnt, hreq->oflags, cred);
        if (IS_ERR(filp)) {
                put_unused_fd(new_fd);
                return -XFS_ERROR(-PTR_ERR(filp));
        }
+
        if (inode->i_mode & S_IFREG) {
                /* invisible operation should not change atime */
                filp->f_flags |= O_NOATIME;
-               filp->f_op = &xfs_invis_file_operations;
+               filp->f_mode |= FMODE_NOCMTIME;
        }
 
        fd_install(new_fd, filp);
@@ -355,7 +357,7 @@ do_readlink(
 }
 
 
-STATIC int
+int
 xfs_readlink_by_handle(
        xfs_mount_t             *mp,
        xfs_fsop_handlereq_t    *hreq,
@@ -490,7 +492,7 @@ xfs_attrlist_by_handle(
        return -error;
 }
 
-STATIC int
+int
 xfs_attrmulti_attr_get(
        struct inode            *inode,
        char                    *name,
@@ -519,7 +521,7 @@ xfs_attrmulti_attr_get(
        return error;
 }
 
-STATIC int
+int
 xfs_attrmulti_attr_set(
        struct inode            *inode,
        char                    *name,
@@ -549,7 +551,7 @@ xfs_attrmulti_attr_set(
        return error;
 }
 
-STATIC int
+int
 xfs_attrmulti_attr_remove(
        struct inode            *inode,
        char                    *name,
@@ -651,7 +653,7 @@ xfs_attrmulti_by_handle(
        return -error;
 }
 
-STATIC int
+int
 xfs_ioc_space(
        struct xfs_inode        *ip,
        struct inode            *inode,
@@ -1328,21 +1330,31 @@ xfs_ioc_getbmapx(
        return 0;
 }
 
-int
-xfs_ioctl(
-       xfs_inode_t             *ip,
+/*
+ * Note: some of the ioctl's return positive numbers as a
+ * byte count indicating success, such as readlink_by_handle.
+ * So we don't "sign flip" like most other routines.  This means
+ * true errors need to be returned as a negative value.
+ */
+long
+xfs_file_ioctl(
        struct file             *filp,
-       int                     ioflags,
        unsigned int            cmd,
-       void                    __user *arg)
+       unsigned long           p)
 {
        struct inode            *inode = filp->f_path.dentry->d_inode;
-       xfs_mount_t             *mp = ip->i_mount;
+       struct xfs_inode        *ip = XFS_I(inode);
+       struct xfs_mount        *mp = ip->i_mount;
+       void                    __user *arg = (void __user *)p;
+       int                     ioflags = 0;
        int                     error;
 
-       xfs_itrace_entry(XFS_I(inode));
-       switch (cmd) {
+       if (filp->f_mode & FMODE_NOCMTIME)
+               ioflags |= IO_INVIS;
 
+       xfs_itrace_entry(ip);
+
+       switch (cmd) {
        case XFS_IOC_ALLOCSP:
        case XFS_IOC_FREESP:
        case XFS_IOC_RESVSP: