public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mkfs.xfs: add [-U uuid] option
@ 2015-09-21 17:04 Mika Eloranta
  2015-09-21 22:18 ` Dave Chinner
  0 siblings, 1 reply; 10+ messages in thread
From: Mika Eloranta @ 2015-09-21 17:04 UTC (permalink / raw)
  To: xfs; +Cc: Mika Eloranta

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@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-09-22  8:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-21 17:04 [PATCH] mkfs.xfs: add [-U uuid] option Mika Eloranta
2015-09-21 22:18 ` Dave Chinner
2015-09-21 22:56   ` Mika Eloranta
2015-09-21 23:36     ` Dave Chinner
2015-09-22  6:43       ` Mika Eloranta
2015-09-22  7:22         ` Carlos Maiolino
2015-09-22  7:52         ` Dave Chinner
2015-09-22  8:06           ` Mika Eloranta
2015-09-22  8:25             ` Dave Chinner
2015-09-22  1:42   ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox