@@ -602,7 +602,7 @@ fsrfs(char *mntdir, xfs_ino_t startino, int targetrange)
return -1;
}
- ret = xfd_open(&fsxfd, mntdir, O_RDONLY);
+ ret = -xfd_open(&fsxfd, mntdir, O_RDONLY);
if (ret) {
fsrprintf(_("unable to open XFS file: %s: %s\n"),
mntdir, strerror(ret));
@@ -748,7 +748,7 @@ fsrfile(
* Need to open something on the same filesystem as the
* file. Open the parent.
*/
- error = xfd_open(&fsxfd, getparent(fname), O_RDONLY);
+ error = -xfd_open(&fsxfd, getparent(fname), O_RDONLY);
if (error) {
fsrprintf(_("unable to open sys handle for XFS file %s: %s\n"),
fname, strerror(error));
@@ -166,7 +166,7 @@ main(int argc, char **argv)
}
/* get the current filesystem size & geometry */
- ret = xfrog_geometry(ffd, &geo);
+ ret = -xfrog_geometry(ffd, &geo);
if (ret) {
fprintf(stderr,
_("%s: cannot determine geometry of filesystem mounted at %s: %s\n"),
@@ -352,7 +352,7 @@ main(int argc, char **argv)
}
}
- ret = xfrog_geometry(ffd, &ngeo);
+ ret = -xfrog_geometry(ffd, &ngeo);
if (ret) {
fprintf(stderr, _("%s: XFS_IOC_FSGEOMETRY xfsctl failed: %s\n"),
progname, strerror(ret));
@@ -106,7 +106,7 @@ bmap_f(
bmv_iflags &= ~(BMV_IF_PREALLOC|BMV_IF_NO_DMAPI_READ);
if (vflag) {
- c = xfrog_geometry(file->fd, &fsgeo);
+ c = -xfrog_geometry(file->fd, &fsgeo);
if (c) {
fprintf(stderr,
_("%s: can't get geometry [\"%s\"]: %s\n"),
@@ -163,7 +163,7 @@ bulkstat_f(
return 0;
}
- ret = xfd_prepare_geometry(&xfd);
+ ret = -xfd_prepare_geometry(&xfd);
if (ret) {
xfrog_perror(ret, "xfd_prepare_geometry");
exitcode = 1;
@@ -271,7 +271,7 @@ bulkstat_single_f(
}
}
- ret = xfd_prepare_geometry(&xfd);
+ ret = -xfd_prepare_geometry(&xfd);
if (ret) {
xfrog_perror(ret, "xfd_prepare_geometry");
exitcode = 1;
@@ -419,7 +419,7 @@ inumbers_f(
return 0;
}
- ret = xfd_prepare_geometry(&xfd);
+ ret = -xfd_prepare_geometry(&xfd);
if (ret) {
xfrog_perror(ret, "xfd_prepare_geometry");
exitcode = 1;
@@ -448,11 +448,11 @@ fsmap_f(
}
if (vflag) {
- c = xfrog_geometry(file->fd, &fsgeo);
+ c = -xfrog_geometry(file->fd, &fsgeo);
if (c) {
fprintf(stderr,
_("%s: can't get geometry [\"%s\"]: %s\n"),
- progname, file->name, strerror(errno));
+ progname, file->name, strerror(c));
exitcode = 1;
return 0;
}
@@ -124,7 +124,7 @@ openfile(
} else {
int ret;
- ret = xfrog_geometry(fd, geom);
+ ret = -xfrog_geometry(fd, geom);
if (ret) {
xfrog_perror(ret, "XFS_IOC_FSGEOMETRY");
close(fd);
@@ -197,7 +197,7 @@ statfs_f(
}
if (file->flags & IO_FOREIGN)
return 0;
- ret = xfrog_geometry(file->fd, &fsgeo);
+ ret = -xfrog_geometry(file->fd, &fsgeo);
if (ret) {
xfrog_perror(ret, "XFS_IOC_FSGEOMETRY");
} else {
@@ -39,7 +39,7 @@ xfrog_bulkstat_prep_v1_emulation(
if (xfd->fsgeom.blocksize > 0)
return 0;
- return xfd_prepare_geometry(xfd);
+ return -xfd_prepare_geometry(xfd);
}
/* Bulkstat a single inode using v5 ioctl. */
@@ -69,7 +69,7 @@ xfs_report_geom(
(unsigned long long)geo->rtextents);
}
-/* Try to obtain the xfs geometry. On error returns a positive error code. */
+/* Try to obtain the xfs geometry. On error returns a negative error code. */
int
xfrog_geometry(
int fd,
@@ -91,12 +91,12 @@ xfrog_geometry(
if (!ret)
return 0;
- return errno;
+ return -errno;
}
/*
* Prepare xfs_fd structure for future ioctl operations by computing the xfs
- * geometry for @xfd->fd. Returns zero or a positive error code.
+ * geometry for @xfd->fd. Returns zero or a negative error code.
*/
int
xfd_prepare_geometry(
@@ -117,7 +117,7 @@ xfd_prepare_geometry(
return 0;
}
-/* Open a file on an XFS filesystem. Returns zero or a positive error code. */
+/* Open a file on an XFS filesystem. Returns zero or a negative error code. */
int
xfd_open(
struct xfs_fd *xfd,
@@ -128,7 +128,7 @@ xfd_open(
xfd->fd = open(pathname, flags);
if (xfd->fd < 0)
- return errno;
+ return -errno;
ret = xfd_prepare_geometry(xfd);
if (ret) {
@@ -141,7 +141,7 @@ xfd_open(
/*
* Release any resources associated with this xfs_fd structure. Returns zero
- * or a positive error code.
+ * or a negative error code.
*/
int
xfd_close(
@@ -155,12 +155,12 @@ xfd_close(
ret = close(xfd->fd);
xfd->fd = -1;
if (ret < 0)
- return errno;
+ return -errno;
return 0;
}
-/* Try to obtain an AG's geometry. Returns zero or a positive error code. */
+/* Try to obtain an AG's geometry. Returns zero or a negative error code. */
int
xfrog_ag_geometry(
int fd,
@@ -172,6 +172,6 @@ xfrog_ag_geometry(
ageo->ag_number = agno;
ret = ioctl(fd, XFS_IOC_AG_GEOMETRY, ageo);
if (ret)
- return errno;
+ return -errno;
return 0;
}
@@ -69,7 +69,7 @@ mount_free_space_data(
}
if (!(mount->fs_flags & FS_FOREIGN)) {
- ret = xfrog_geometry(fd, &fsgeo);
+ ret = -xfrog_geometry(fd, &fsgeo);
if (ret) {
xfrog_perror(ret, "XFS_IOC_FSGEOMETRY");
close(fd);
@@ -146,7 +146,7 @@ quot_bulkstat_mount(
*dp = NULL;
ndu[0] = ndu[1] = ndu[2] = 0;
- ret = xfd_open(&fsxfd, fsdir, O_RDONLY);
+ ret = -xfd_open(&fsxfd, fsdir, O_RDONLY);
if (ret) {
xfrog_perror(ret, fsdir);
return;
@@ -642,7 +642,7 @@ check_fs_vs_host_sectsize(
fd = libxfs_device_to_fd(x.ddev);
- ret = xfrog_geometry(fd, &geom);
+ ret = -xfrog_geometry(fd, &geom);
if (ret) {
do_log(_("Cannot get host filesystem geometry.\n"
"Repair may fail if there is a sector size mismatch between\n"
@@ -378,7 +378,7 @@ xfsrtextsize( char *path)
progname, path, strerror(errno));
return -1;
}
- rval = xfrog_geometry(fd, &geo);
+ rval = -xfrog_geometry(fd, &geo);
close(fd);
if (rval)
return -1;
@@ -60,7 +60,7 @@ scrub_cleanup(
if (ctx->datadev)
disk_close(ctx->datadev);
fshandle_destroy();
- error = xfd_close(&ctx->mnt);
+ error = -xfd_close(&ctx->mnt);
if (error)
str_liberror(ctx, error, _("closing mountpoint fd"));
fs_table_destroy();
@@ -84,7 +84,7 @@ phase1_func(
* CAP_SYS_ADMIN, which we probably need to do anything fancy
* with the (XFS driver) kernel.
*/
- error = xfd_open(&ctx->mnt, ctx->mntpoint,
+ error = -xfd_open(&ctx->mnt, ctx->mntpoint,
O_RDONLY | O_NOATIME | O_DIRECTORY);
if (error) {
if (error == EPERM)
@@ -52,7 +52,7 @@ openfile(
struct fs_path *fsp;
int ret;
- ret = xfd_open(xfd, path, O_RDONLY);
+ ret = -xfd_open(xfd, path, O_RDONLY);
if (ret) {
if (ret == ENOTTY)
fprintf(stderr,
@@ -192,7 +192,7 @@ report_ag_sick(
char descr[256];
int ret;
- ret = xfrog_ag_geometry(file->xfd.fd, agno, &ageo);
+ ret = -xfrog_ag_geometry(file->xfd.fd, agno, &ageo);
if (ret) {
xfrog_perror(ret, "ag_geometry");
return 1;