xfs: global error sign conversion
[deliverable/linux.git] / fs / xfs / xfs_ioctl32.c
index 944d5baa710a39da9aa1d6a82a27013c15813d64..e65ea67e3ae3005c37990589bac0d7942fc98eff 100644 (file)
@@ -56,7 +56,7 @@ xfs_compat_flock64_copyin(
            get_user(bf->l_sysid,       &arg32->l_sysid) ||
            get_user(bf->l_pid,         &arg32->l_pid) ||
            copy_from_user(bf->l_pad,   &arg32->l_pad,  4*sizeof(u32)))
-               return -XFS_ERROR(EFAULT);
+               return -EFAULT;
        return 0;
 }
 
@@ -70,10 +70,10 @@ xfs_compat_ioc_fsgeometry_v1(
 
        error = xfs_fs_geometry(mp, &fsgeo, 3);
        if (error)
-               return -error;
+               return error;
        /* The 32-bit variant simply has some padding at the end */
        if (copy_to_user(arg32, &fsgeo, sizeof(struct compat_xfs_fsop_geom_v1)))
-               return -XFS_ERROR(EFAULT);
+               return -EFAULT;
        return 0;
 }
 
@@ -84,7 +84,7 @@ xfs_compat_growfs_data_copyin(
 {
        if (get_user(in->newblocks, &arg32->newblocks) ||
            get_user(in->imaxpct,   &arg32->imaxpct))
-               return -XFS_ERROR(EFAULT);
+               return -EFAULT;
        return 0;
 }
 
@@ -95,7 +95,7 @@ xfs_compat_growfs_rt_copyin(
 {
        if (get_user(in->newblocks, &arg32->newblocks) ||
            get_user(in->extsize,   &arg32->extsize))
-               return -XFS_ERROR(EFAULT);
+               return -EFAULT;
        return 0;
 }
 
@@ -113,7 +113,7 @@ xfs_inumbers_fmt_compat(
                if (put_user(buffer[i].xi_startino,   &p32[i].xi_startino) ||
                    put_user(buffer[i].xi_alloccount, &p32[i].xi_alloccount) ||
                    put_user(buffer[i].xi_allocmask,  &p32[i].xi_allocmask))
-                       return -XFS_ERROR(EFAULT);
+                       return -EFAULT;
        }
        *written = count * sizeof(*p32);
        return 0;
@@ -132,7 +132,7 @@ xfs_ioctl32_bstime_copyin(
 
        if (get_user(sec32,             &bstime32->tv_sec)      ||
            get_user(bstime->tv_nsec,   &bstime32->tv_nsec))
-               return -XFS_ERROR(EFAULT);
+               return -EFAULT;
        bstime->tv_sec = sec32;
        return 0;
 }
@@ -164,7 +164,7 @@ xfs_ioctl32_bstat_copyin(
            get_user(bstat->bs_dmevmask, &bstat32->bs_dmevmask) ||
            get_user(bstat->bs_dmstate, &bstat32->bs_dmstate)   ||
            get_user(bstat->bs_aextents, &bstat32->bs_aextents))
-               return -XFS_ERROR(EFAULT);
+               return -EFAULT;
        return 0;
 }
 
@@ -180,7 +180,7 @@ xfs_bstime_store_compat(
        sec32 = p->tv_sec;
        if (put_user(sec32, &p32->tv_sec) ||
            put_user(p->tv_nsec, &p32->tv_nsec))
-               return -XFS_ERROR(EFAULT);
+               return -EFAULT;
        return 0;
 }
 
@@ -195,7 +195,7 @@ xfs_bulkstat_one_fmt_compat(
        compat_xfs_bstat_t      __user *p32 = ubuffer;
 
        if (ubsize < sizeof(*p32))
-               return XFS_ERROR(ENOMEM);
+               return -ENOMEM;
 
        if (put_user(buffer->bs_ino,      &p32->bs_ino)         ||
            put_user(buffer->bs_mode,     &p32->bs_mode)        ||
@@ -218,7 +218,7 @@ xfs_bulkstat_one_fmt_compat(
            put_user(buffer->bs_dmevmask, &p32->bs_dmevmask)    ||
            put_user(buffer->bs_dmstate,  &p32->bs_dmstate)     ||
            put_user(buffer->bs_aextents, &p32->bs_aextents))
-               return XFS_ERROR(EFAULT);
+               return -EFAULT;
        if (ubused)
                *ubused = sizeof(*p32);
        return 0;
@@ -256,30 +256,30 @@ xfs_compat_ioc_bulkstat(
        /* should be called again (unused here, but used in dmapi) */
 
        if (!capable(CAP_SYS_ADMIN))
-               return -XFS_ERROR(EPERM);
+               return -EPERM;
 
        if (XFS_FORCED_SHUTDOWN(mp))
-               return -XFS_ERROR(EIO);
+               return -EIO;
 
        if (get_user(addr, &p32->lastip))
-               return -XFS_ERROR(EFAULT);
+               return -EFAULT;
        bulkreq.lastip = compat_ptr(addr);
        if (get_user(bulkreq.icount, &p32->icount) ||
            get_user(addr, &p32->ubuffer))
-               return -XFS_ERROR(EFAULT);
+               return -EFAULT;
        bulkreq.ubuffer = compat_ptr(addr);
        if (get_user(addr, &p32->ocount))
-               return -XFS_ERROR(EFAULT);
+               return -EFAULT;
        bulkreq.ocount = compat_ptr(addr);
 
        if (copy_from_user(&inlast, bulkreq.lastip, sizeof(__s64)))
-               return -XFS_ERROR(EFAULT);
+               return -EFAULT;
 
        if ((count = bulkreq.icount) <= 0)
-               return -XFS_ERROR(EINVAL);
+               return -EINVAL;
 
        if (bulkreq.ubuffer == NULL)
-               return -XFS_ERROR(EINVAL);
+               return -EINVAL;
 
        if (cmd == XFS_IOC_FSINUMBERS_32) {
                error = xfs_inumbers(mp, &inlast, &count,
@@ -294,17 +294,17 @@ xfs_compat_ioc_bulkstat(
                        xfs_bulkstat_one_compat, sizeof(compat_xfs_bstat_t),
                        bulkreq.ubuffer, &done);
        } else
-               error = XFS_ERROR(EINVAL);
+               error = -EINVAL;
        if (error)
-               return -error;
+               return error;
 
        if (bulkreq.ocount != NULL) {
                if (copy_to_user(bulkreq.lastip, &inlast,
                                                sizeof(xfs_ino_t)))
-                       return -XFS_ERROR(EFAULT);
+                       return -EFAULT;
 
                if (copy_to_user(bulkreq.ocount, &count, sizeof(count)))
-                       return -XFS_ERROR(EFAULT);
+                       return -EFAULT;
        }
 
        return 0;
@@ -318,7 +318,7 @@ xfs_compat_handlereq_copyin(
        compat_xfs_fsop_handlereq_t     hreq32;
 
        if (copy_from_user(&hreq32, arg32, sizeof(compat_xfs_fsop_handlereq_t)))
-               return -XFS_ERROR(EFAULT);
+               return -EFAULT;
 
        hreq->fd = hreq32.fd;
        hreq->path = compat_ptr(hreq32.path);
@@ -352,19 +352,19 @@ xfs_compat_attrlist_by_handle(
        char                    *kbuf;
 
        if (!capable(CAP_SYS_ADMIN))
-               return -XFS_ERROR(EPERM);
+               return -EPERM;
        if (copy_from_user(&al_hreq, arg,
                           sizeof(compat_xfs_fsop_attrlist_handlereq_t)))
-               return -XFS_ERROR(EFAULT);
+               return -EFAULT;
        if (al_hreq.buflen < sizeof(struct attrlist) ||
            al_hreq.buflen > XATTR_LIST_MAX)
-               return -XFS_ERROR(EINVAL);
+               return -EINVAL;
 
        /*
         * Reject flags, only allow namespaces.
         */
        if (al_hreq.flags & ~(ATTR_ROOT | ATTR_SECURE))
-               return -XFS_ERROR(EINVAL);
+               return -EINVAL;
 
        dentry = xfs_compat_handlereq_to_dentry(parfilp, &al_hreq.hreq);
        if (IS_ERR(dentry))
@@ -376,7 +376,7 @@ xfs_compat_attrlist_by_handle(
                goto out_dput;
 
        cursor = (attrlist_cursor_kern_t *)&al_hreq.pos;
-       error = -xfs_attr_list(XFS_I(dentry->d_inode), kbuf, al_hreq.buflen,
+       error = xfs_attr_list(XFS_I(dentry->d_inode), kbuf, al_hreq.buflen,
                                        al_hreq.flags, cursor);
        if (error)
                goto out_kfree;
@@ -404,10 +404,10 @@ xfs_compat_attrmulti_by_handle(
        unsigned char                           *attr_name;
 
        if (!capable(CAP_SYS_ADMIN))
-               return -XFS_ERROR(EPERM);
+               return -EPERM;
        if (copy_from_user(&am_hreq, arg,
                           sizeof(compat_xfs_fsop_attrmulti_handlereq_t)))
-               return -XFS_ERROR(EFAULT);
+               return -EFAULT;
 
        /* overflow check */
        if (am_hreq.opcount >= INT_MAX / sizeof(compat_xfs_attr_multiop_t))
@@ -417,7 +417,7 @@ xfs_compat_attrmulti_by_handle(
        if (IS_ERR(dentry))
                return PTR_ERR(dentry);
 
-       error = E2BIG;
+       error = -E2BIG;
        size = am_hreq.opcount * sizeof(compat_xfs_attr_multiop_t);
        if (!size || size > 16 * PAGE_SIZE)
                goto out_dput;
@@ -428,7 +428,7 @@ xfs_compat_attrmulti_by_handle(
                goto out_dput;
        }
 
-       error = ENOMEM;
+       error = -ENOMEM;
        attr_name = kmalloc(MAXNAMELEN, GFP_KERNEL);
        if (!attr_name)
                goto out_kfree_ops;
@@ -439,7 +439,7 @@ xfs_compat_attrmulti_by_handle(
                                compat_ptr(ops[i].am_attrname),
                                MAXNAMELEN);
                if (ops[i].am_error == 0 || ops[i].am_error == MAXNAMELEN)
-                       error = ERANGE;
+                       error = -ERANGE;
                if (ops[i].am_error < 0)
                        break;
 
@@ -470,19 +470,19 @@ xfs_compat_attrmulti_by_handle(
                        mnt_drop_write_file(parfilp);
                        break;
                default:
-                       ops[i].am_error = EINVAL;
+                       ops[i].am_error = -EINVAL;
                }
        }
 
        if (copy_to_user(compat_ptr(am_hreq.ops), ops, size))
-               error = XFS_ERROR(EFAULT);
+               error = -EFAULT;
 
        kfree(attr_name);
  out_kfree_ops:
        kfree(ops);
  out_dput:
        dput(dentry);
-       return -error;
+       return error;
 }
 
 STATIC int
@@ -496,26 +496,26 @@ xfs_compat_fssetdm_by_handle(
        struct dentry           *dentry;
 
        if (!capable(CAP_MKNOD))
-               return -XFS_ERROR(EPERM);
+               return -EPERM;
        if (copy_from_user(&dmhreq, arg,
                           sizeof(compat_xfs_fsop_setdm_handlereq_t)))
-               return -XFS_ERROR(EFAULT);
+               return -EFAULT;
 
        dentry = xfs_compat_handlereq_to_dentry(parfilp, &dmhreq.hreq);
        if (IS_ERR(dentry))
                return PTR_ERR(dentry);
 
        if (IS_IMMUTABLE(dentry->d_inode) || IS_APPEND(dentry->d_inode)) {
-               error = -XFS_ERROR(EPERM);
+               error = -EPERM;
                goto out;
        }
 
        if (copy_from_user(&fsd, compat_ptr(dmhreq.data), sizeof(fsd))) {
-               error = -XFS_ERROR(EFAULT);
+               error = -EFAULT;
                goto out;
        }
 
-       error = -xfs_set_dmattrs(XFS_I(dentry->d_inode), fsd.fsd_dmevmask,
+       error = xfs_set_dmattrs(XFS_I(dentry->d_inode), fsd.fsd_dmevmask,
                                 fsd.fsd_dmstate);
 
 out:
@@ -588,7 +588,7 @@ xfs_file_compat_ioctl(
                struct xfs_flock64      bf;
 
                if (xfs_compat_flock64_copyin(&bf, arg))
-                       return -XFS_ERROR(EFAULT);
+                       return -EFAULT;
                cmd = _NATIVE_IOC(cmd, struct xfs_flock64);
                return xfs_ioc_space(ip, inode, filp, ioflags, cmd, &bf);
        }
@@ -598,25 +598,25 @@ xfs_file_compat_ioctl(
                struct xfs_growfs_data  in;
 
                if (xfs_compat_growfs_data_copyin(&in, arg))
-                       return -XFS_ERROR(EFAULT);
+                       return -EFAULT;
                error = mnt_want_write_file(filp);
                if (error)
                        return error;
                error = xfs_growfs_data(mp, &in);
                mnt_drop_write_file(filp);
-               return -error;
+               return error;
        }
        case XFS_IOC_FSGROWFSRT_32: {
                struct xfs_growfs_rt    in;
 
                if (xfs_compat_growfs_rt_copyin(&in, arg))
-                       return -XFS_ERROR(EFAULT);
+                       return -EFAULT;
                error = mnt_want_write_file(filp);
                if (error)
                        return error;
                error = xfs_growfs_rt(mp, &in);
                mnt_drop_write_file(filp);
-               return -error;
+               return error;
        }
 #endif
        /* long changes size, but xfs only copiese out 32 bits */
@@ -633,13 +633,13 @@ xfs_file_compat_ioctl(
                if (copy_from_user(&sxp, sxu,
                                   offsetof(struct xfs_swapext, sx_stat)) ||
                    xfs_ioctl32_bstat_copyin(&sxp.sx_stat, &sxu->sx_stat))
-                       return -XFS_ERROR(EFAULT);
+                       return -EFAULT;
                error = mnt_want_write_file(filp);
                if (error)
                        return error;
                error = xfs_ioc_swapext(&sxp);
                mnt_drop_write_file(filp);
-               return -error;
+               return error;
        }
        case XFS_IOC_FSBULKSTAT_32:
        case XFS_IOC_FSBULKSTAT_SINGLE_32:
@@ -651,7 +651,7 @@ xfs_file_compat_ioctl(
                struct xfs_fsop_handlereq       hreq;
 
                if (xfs_compat_handlereq_copyin(&hreq, arg))
-                       return -XFS_ERROR(EFAULT);
+                       return -EFAULT;
                cmd = _NATIVE_IOC(cmd, struct xfs_fsop_handlereq);
                return xfs_find_handle(cmd, &hreq);
        }
@@ -659,14 +659,14 @@ xfs_file_compat_ioctl(
                struct xfs_fsop_handlereq       hreq;
 
                if (xfs_compat_handlereq_copyin(&hreq, arg))
-                       return -XFS_ERROR(EFAULT);
+                       return -EFAULT;
                return xfs_open_by_handle(filp, &hreq);
        }
        case XFS_IOC_READLINK_BY_HANDLE_32: {
                struct xfs_fsop_handlereq       hreq;
 
                if (xfs_compat_handlereq_copyin(&hreq, arg))
-                       return -XFS_ERROR(EFAULT);
+                       return -EFAULT;
                return xfs_readlink_by_handle(filp, &hreq);
        }
        case XFS_IOC_ATTRLIST_BY_HANDLE_32:
@@ -676,6 +676,6 @@ xfs_file_compat_ioctl(
        case XFS_IOC_FSSETDM_BY_HANDLE_32:
                return xfs_compat_fssetdm_by_handle(filp, arg);
        default:
-               return -XFS_ERROR(ENOIOCTLCMD);
+               return -ENOIOCTLCMD;
        }
 }
This page took 0.0325 seconds and 5 git commands to generate.