Re: [PATCH 5/5] xfs_io: add label command

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

 





On 5/14/18 11:32 PM, Dave Chinner wrote:
On Mon, May 14, 2018 at 12:43:20PM -0500, Eric Sandeen wrote:
This adds a get/set label command to xfs_io.
....
+static int
+label_f(
+	int		argc,
+	char		**argv)
+{
+	int		error;
+	char		label[FSLABEL_MAX];
+
+	if (argc == 1) {
+		memset(&label, 0, sizeof(label));
+		error = ioctl(file->fd, FS_IOC_GET_FSLABEL, &label);
+	} else {
+		strncpy(label, argv[1], sizeof(label));
+		error = ioctl(file->fd, FS_IOC_SET_FSLABEL, &label);
+	}
+
+	if (error)
+		perror("label");

Need to set exitcode = 1 here so that xfs_io fails with a non-zero
exit status....

+	else
+		printf("label = \"%s\"\n", label);
+
+	return error;

Because this isn't the exit status - this is the "continue
processing the next command" return value. i.e. return 0 if we want
to continue, non-zero if we want to abort further CLI processing....

Hm, ok.  Today we only set exitcode for bmap, fiemap, freeze/thaw, and
imap.  It's really consistently used at all, and needs an audit I guess.

Maybe we should add an io_error() which sets it automatically, or something.

Anyway, I can add it here.

-Eric
--
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