From cbfbcb0b503752a560e607039924f3192fde314b Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Mon, 23 Oct 2006 08:56:27 +1000 Subject: [PATCH] Improve error message when wrong --update option is given. --- ChangeLog | 1 + ReadMe.c | 4 ++-- mdadm.c | 8 +++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1aaa1ee..7cb07fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,7 @@ Changes Prior to this release - When --assemble --scan is run, if all arrays that could be found have already been started, don't report an error. - Fix a couple of bugs related to raid10 and the new 'offset' layout. + - Improve error message when a wrong '--update' option is given. Changes Prior to 2.5.4 release - When creating devices in /dev/md/ create matching symlinks diff --git a/ReadMe.c b/ReadMe.c index 5704423..2a352ef 100644 --- a/ReadMe.c +++ b/ReadMe.c @@ -272,7 +272,7 @@ char OptionHelp[] = " --config= -c : config file\n" " --scan -s : scan config file for missing information\n" " --force -f : Assemble the array even if some superblocks appear out-of-date\n" -" --update= -U : Update superblock: one of sparc2.2, super-minor or summaries\n" +" --update= -U : Update superblock: try '-A --update=?' for list of options.\n" " --auto(=p) -a : Automatically allocate new (partitioned) md array if needed.\n" " --no-degraded : Do not start any degraded arrays - default unless --scan.\n" "\n" @@ -414,7 +414,7 @@ char Help_assemble[] = " for a full array are present\n" " --force -f : Assemble the array even if some superblocks appear\n" " : out-of-date. This involves modifying the superblocks.\n" -" --update= -U : Update superblock: one of sparc2.2, super-minor or summaries\n" +" --update= -U : Update superblock: try '-A --update=?' for option list.\n" " --no-degraded : Assemble but do not start degraded arrays.\n" ; diff --git a/mdadm.c b/mdadm.c index 00514a6..41e6c4c 100644 --- a/mdadm.c +++ b/mdadm.c @@ -596,7 +596,13 @@ int main(int argc, char *argv[]) continue; } - fprintf(stderr, Name ": '--update %s' invalid. Only 'sparc2.2', 'super-minor', 'uuid', 'resync' or 'summaries' supported\n",update); + if (strcmp(update,"?") == 0 || strcmp(update, "help") == 0) + fprintf(stderr, Name ": "); + else + fprintf(stderr, Name ": '--update=%s' is invalid. ", update); + fprintf(stderr, "Valid --update options are:\n" + " 'sparc2.2', 'super-minor', 'uuid', 'name', 'resync',\n" + " 'summaries', 'homehost', 'byteorder'.\n"); exit(2); case O(ASSEMBLE,NoDegraded): /* --no-degraded */