* [PATCH] e2fsprogs: Make -U option consistent between tune2fs and mke2fs
@ 2017-04-13 19:47 Drew Davenport
2017-04-13 22:24 ` Andreas Dilger
0 siblings, 1 reply; 4+ messages in thread
From: Drew Davenport @ 2017-04-13 19:47 UTC (permalink / raw)
To: linux-ext4
Allow "null", "clear", "random", or "time" for the -U option for
mke2fs, which are already allowed options for tune2fs.
Signed-off-by: Drew Davenport <ddavenport@google.com>
---
misc/mke2fs.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 49c6e94d..b8d078a0 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -2914,7 +2914,14 @@ int main (int argc, char *argv[])
* Parse or generate a UUID for the filesystem
*/
if (fs_uuid) {
- if (uuid_parse(fs_uuid, fs->super->s_uuid) !=0) {
+ if ((strcasecmp(fs_uuid, "null") == 0) ||
+ (strcasecmp(fs_uuid, "clear") == 0)) {
+ uuid_clear(fs->super->s_uuid);
+ } else if (strcasecmp(fs_uuid, "time") == 0) {
+ uuid_generate_time(fs->super->s_uuid);
+ } else if (strcasecmp(fs_uuid, "random") == 0) {
+ uuid_generate(fs->super->s_uuid);
+ } else if (uuid_parse(fs_uuid, fs->super->s_uuid) != 0) {
com_err(device_name, 0, "could not parse UUID: %s\n",
fs_uuid);
exit(1);
--
2.12.2.762.g0e3151a226-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] e2fsprogs: Make -U option consistent between tune2fs and mke2fs
2017-04-13 19:47 [PATCH] e2fsprogs: Make -U option consistent between tune2fs and mke2fs Drew Davenport
@ 2017-04-13 22:24 ` Andreas Dilger
2017-04-13 23:56 ` [PATCH v2] " Drew Davenport
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Dilger @ 2017-04-13 22:24 UTC (permalink / raw)
To: Drew Davenport; +Cc: linux-ext4
[-- Attachment #1: Type: text/plain, Size: 1325 bytes --]
On Apr 13, 2017, at 1:47 PM, Drew Davenport <ddavenport@google.com> wrote:
>
> Allow "null", "clear", "random", or "time" for the -U option for
> mke2fs, which are already allowed options for tune2fs.
>
> Signed-off-by: Drew Davenport <ddavenport@google.com>
Looks OK, but please also add this to the mke2fs man page, then you can add:
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
> ---
> misc/mke2fs.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/misc/mke2fs.c b/misc/mke2fs.c
> index 49c6e94d..b8d078a0 100644
> --- a/misc/mke2fs.c
> +++ b/misc/mke2fs.c
> @@ -2914,7 +2914,14 @@ int main (int argc, char *argv[])
> * Parse or generate a UUID for the filesystem
> */
> if (fs_uuid) {
> - if (uuid_parse(fs_uuid, fs->super->s_uuid) !=0) {
> + if ((strcasecmp(fs_uuid, "null") == 0) ||
> + (strcasecmp(fs_uuid, "clear") == 0)) {
> + uuid_clear(fs->super->s_uuid);
> + } else if (strcasecmp(fs_uuid, "time") == 0) {
> + uuid_generate_time(fs->super->s_uuid);
> + } else if (strcasecmp(fs_uuid, "random") == 0) {
> + uuid_generate(fs->super->s_uuid);
> + } else if (uuid_parse(fs_uuid, fs->super->s_uuid) != 0) {
> com_err(device_name, 0, "could not parse UUID: %s\n",
> fs_uuid);
> exit(1);
> --
> 2.12.2.762.g0e3151a226-goog
>
Cheers, Andreas
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] e2fsprogs: Make -U option consistent between tune2fs and mke2fs
2017-04-13 22:24 ` Andreas Dilger
@ 2017-04-13 23:56 ` Drew Davenport
2017-05-29 23:10 ` Theodore Ts'o
0 siblings, 1 reply; 4+ messages in thread
From: Drew Davenport @ 2017-04-13 23:56 UTC (permalink / raw)
To: linux-ext4
Allow "null", "clear", "random", or "time" for the -U option for
mke2fs, which are already allowed options for tune2fs.
Signed-off-by: Drew Davenport <ddavenport@google.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
---
misc/mke2fs.8.in | 20 +++++++++++++++++++-
misc/mke2fs.c | 9 ++++++++-
2 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/misc/mke2fs.8.in b/misc/mke2fs.8.in
index ef56d9ea..1c8c20f2 100644
--- a/misc/mke2fs.8.in
+++ b/misc/mke2fs.8.in
@@ -738,7 +738,25 @@ will use the default filesystem type
.IR default .
.TP
.BI \-U " UUID"
-Create the filesystem with the specified UUID.
+Set the universally unique identifier (UUID) of the filesystem to
+.IR UUID .
+The format of the UUID is a series of hex digits separated by hyphens,
+like this:
+"c1b9d5a2-f162-11cf-9ece-0020afc76f16".
+The
+.I UUID
+parameter may also be one of the following:
+.RS 1.2i
+.TP
+.I clear
+clear the filesystem UUID
+.TP
+.I random
+generate a new randomly-generated UUID
+.TP
+.I time
+generate a new time-based UUID
+.RE
.TP
.B \-v
Verbose execution.
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 49c6e94d..b8d078a0 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -2914,7 +2914,14 @@ int main (int argc, char *argv[])
* Parse or generate a UUID for the filesystem
*/
if (fs_uuid) {
- if (uuid_parse(fs_uuid, fs->super->s_uuid) !=0) {
+ if ((strcasecmp(fs_uuid, "null") == 0) ||
+ (strcasecmp(fs_uuid, "clear") == 0)) {
+ uuid_clear(fs->super->s_uuid);
+ } else if (strcasecmp(fs_uuid, "time") == 0) {
+ uuid_generate_time(fs->super->s_uuid);
+ } else if (strcasecmp(fs_uuid, "random") == 0) {
+ uuid_generate(fs->super->s_uuid);
+ } else if (uuid_parse(fs_uuid, fs->super->s_uuid) != 0) {
com_err(device_name, 0, "could not parse UUID: %s\n",
fs_uuid);
exit(1);
--
2.12.2.762.g0e3151a226-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] e2fsprogs: Make -U option consistent between tune2fs and mke2fs
2017-04-13 23:56 ` [PATCH v2] " Drew Davenport
@ 2017-05-29 23:10 ` Theodore Ts'o
0 siblings, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2017-05-29 23:10 UTC (permalink / raw)
To: Drew Davenport; +Cc: linux-ext4
On Thu, Apr 13, 2017 at 04:56:28PM -0700, Drew Davenport wrote:
> Allow "null", "clear", "random", or "time" for the -U option for
> mke2fs, which are already allowed options for tune2fs.
>
> Signed-off-by: Drew Davenport <ddavenport@google.com>
> Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Thanks, applied.
- Ted
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-05-29 23:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-13 19:47 [PATCH] e2fsprogs: Make -U option consistent between tune2fs and mke2fs Drew Davenport
2017-04-13 22:24 ` Andreas Dilger
2017-04-13 23:56 ` [PATCH v2] " Drew Davenport
2017-05-29 23:10 ` Theodore Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).