xfs: global error sign conversion
Convert all the errors the core XFs code to negative error signs
like the rest of the kernel and remove all the sign conversion we
do in the interface layers.
Errors for conversion (and comparison) found via searches like:
$ git grep " E" fs/xfs
$ git grep "return E" fs/xfs
$ git grep " E[A-Z].*;$" fs/xfs
Negation points found via searches like:
$ git grep "= -[a-z,A-Z]" fs/xfs
$ git grep "return -[a-z,A-D,F-Z]" fs/xfs
$ git grep " -[a-z].*;" fs/xfs
[ with some bits I missed from Brian Foster ]
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c
index e4056a7..7e54992 100644
--- a/fs/xfs/xfs_itable.c
+++ b/fs/xfs/xfs_itable.c
@@ -67,11 +67,11 @@
*stat = BULKSTAT_RV_NOTHING;
if (!buffer || xfs_internal_inum(mp, ino))
- return EINVAL;
+ return -EINVAL;
buf = kmem_alloc(sizeof(*buf), KM_SLEEP | KM_MAYFAIL);
if (!buf)
- return ENOMEM;
+ return -ENOMEM;
error = xfs_iget(mp, NULL, ino,
(XFS_IGET_DONTCACHE | XFS_IGET_UNTRUSTED),
@@ -154,9 +154,9 @@
const xfs_bstat_t *buffer)
{
if (ubsize < sizeof(*buffer))
- return ENOMEM;
+ return -ENOMEM;
if (copy_to_user(ubuffer, buffer, sizeof(*buffer)))
- return EFAULT;
+ return -EFAULT;
if (ubused)
*ubused = sizeof(*buffer);
return 0;
@@ -234,7 +234,7 @@
return 0;
}
if (!ubcountp || *ubcountp <= 0) {
- return EINVAL;
+ return -EINVAL;
}
ubcount = *ubcountp; /* statstruct's */
ubleft = ubcount * statstruct_size; /* bytes */
@@ -246,7 +246,7 @@
inodes_per_cluster = blks_per_cluster << mp->m_sb.sb_inopblog;
irbuf = kmem_zalloc_greedy(&irbsize, PAGE_SIZE, PAGE_SIZE * 4);
if (!irbuf)
- return ENOMEM;
+ return -ENOMEM;
nirbuf = irbsize / sizeof(*irbuf);
@@ -452,8 +452,8 @@
error = formatter(mp, ino, ubufp, ubleft,
&ubused, &fmterror);
if (fmterror == BULKSTAT_RV_NOTHING) {
- if (error && error != ENOENT &&
- error != EINVAL) {
+ if (error && error != -ENOENT &&
+ error != -EINVAL) {
ubleft = 0;
rval = error;
break;
@@ -551,7 +551,7 @@
sizeof(xfs_bstat_t), buffer, done))
return error;
if (count == 0 || (xfs_ino_t)*lastinop != ino)
- return error == EFSCORRUPTED ?
+ return error == -EFSCORRUPTED ?
EINVAL : error;
else
return 0;
@@ -661,7 +661,7 @@
if (bufidx == bcount) {
long written;
if (formatter(ubuffer, buffer, bufidx, &written)) {
- error = EFAULT;
+ error = -EFAULT;
break;
}
ubuffer += written;
@@ -688,7 +688,7 @@
if (bufidx) {
long written;
if (formatter(ubuffer, buffer, bufidx, &written))
- error = EFAULT;
+ error = -EFAULT;
else
*count += bufidx;
}