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

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

 



On Mon, Sep 21, 2015 at 08:04:20PM +0300, Mika Eloranta wrote:
> The UUID can now be optionally specified during filesystem
> creation.

Which UUID are you wanting to set - the metadata uuid or the user
visible UUID label? Or both? Can you explain the use case for this?
i.e. I'm trying to work out why Why doesn't mkfs.xfs +
xfs_admin -U <uuid> doesn't work for you?

We need some explaination in the commit message so that when we look
at this in a couple of years time we know why we added this to
mkfs...

> @@ -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;

I'd prefer not to introduce new top level options if possible - this
seems to fit under the -m (global metadata options) option subgroup
(i.e. -m uuid=<UUID>).

>  		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);
> +	}

Just generate the uuid initially and then it gets overwritten by the
CLI option if it is set. No need for null detection and generation
here.

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

_______________________________________________
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