[PATCH v2 5/9] xfs_spaceman: print a nicer message when the file path isn't on an xfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>

If the file path passed in is not something on an xfs filesystem, print
a nice message about that instead of yelling about ioctls.

Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
---
 spaceman/file.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/spaceman/file.c b/spaceman/file.c
index 4c13b4a8..23f8be1c 100644
--- a/spaceman/file.c
+++ b/spaceman/file.c
@@ -69,7 +69,12 @@ openfile(
 	}
 
 	if (ioctl(fd, XFS_IOC_FSGEOMETRY, geom) < 0) {
-		perror("XFS_IOC_FSGEOMETRY");
+		if (errno == ENOTTY)
+			fprintf(stderr,
+_("%s: Not on a mounted XFS filesystem.\n"),
+					path);
+		else
+			perror("XFS_IOC_FSGEOMETRY");
 		close(fd);
 		return -1;
 	}
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux