[PATCH] mkfs.xfs: add [-U uuid] option

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

 



The UUID can now be optionally specified during filesystem
creation.
---
 man/man8/mkfs.xfs.8 |  7 +++++++
 mkfs/xfs_mkfs.c     | 12 ++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/man/man8/mkfs.xfs.8 b/man/man8/mkfs.xfs.8
index 6260e0c..ab48dd7 100644
--- a/man/man8/mkfs.xfs.8
+++ b/man/man8/mkfs.xfs.8
@@ -38,6 +38,9 @@ mkfs.xfs \- construct an XFS filesystem
 .B \-L
 .I label
 ] [
+.B \-U
+.I uuid
+] [
 .B \-N
 ] [
 .B \-K
@@ -816,6 +819,10 @@ will not proceed with creating the filesystem.  Refer to the
 .BR mount "(8) and " xfs_admin (8)
 manual entries for additional information.
 .TP
+.BI \-U " uuid"
+Create the filesystem with the specified
+.IR UUID .
+.TP
 .B \-N
 Causes the file system parameters to be printed out without really
 creating the file system.
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index d993fc0..9fc5c67 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -948,6 +948,7 @@ main(
 	bool			finobtflag;
 	int			spinodes;
 
+	platform_uuid_clear(&uuid);
 	progname = basename(argv[0]);
 	setlocale(LC_ALL, "");
 	bindtextdomain(PACKAGE, LOCALEDIR);
@@ -990,7 +991,7 @@ main(
 	xi.isdirect = LIBXFS_DIRECT;
 	xi.isreadonly = LIBXFS_EXCLUSIVELY;
 
-	while ((c = getopt(argc, argv, "b:d:i:l:L:m:n:KNp:qr:s:CfV")) != EOF) {
+	while ((c = getopt(argc, argv, "b:d:i:l:L:U:m:n:KNp:qr:s:CfV")) != EOF) {
 		switch (c) {
 		case 'C':
 		case 'f':
@@ -1465,6 +1466,10 @@ main(
 				illegal(optarg, "L");
 			label = optarg;
 			break;
+		case 'U':
+			if (platform_uuid_parse(optarg, &uuid))
+				illegal(optarg, "U");
+			break;
 		case 'm':
 			p = optarg;
 			while (*p != '\0') {
@@ -2550,7 +2555,9 @@ _("size %s specified for log subvolume is too large, maximum is %lld blocks\n"),
 	sbp->sb_dblocks = dblocks;
 	sbp->sb_rblocks = rtblocks;
 	sbp->sb_rextents = rtextents;
-	platform_uuid_generate(&uuid);
+	if (platform_uuid_is_null(&uuid)) {
+	    platform_uuid_generate(&uuid);
+	}
 	platform_uuid_copy(&sbp->sb_uuid, &uuid);
 	/* Only in memory; libxfs expects this as if read from disk */
 	platform_uuid_copy(&sbp->sb_meta_uuid, &uuid);
@@ -3175,6 +3182,7 @@ usage( void )
 			    sunit=value|su=num,sectlog=n|sectsize=num,\n\
 			    lazy-count=0|1]\n\
 /* label */		[-L label (maximum 12 characters)]\n\
+/* uuid */		[-U uuid]\n\
 /* naming */		[-n log=n|size=num,version=2|ci,ftype=0|1]\n\
 /* no-op info only */	[-N]\n\
 /* prototype file */	[-p fname]\n\
-- 
2.3.5

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs



[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux