summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>2024-10-31 13:29:01 +0100
committerMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>2024-11-05 13:36:43 +0100
commitfca47dc730e3871f6e2123f34375c69274269bcd (patch)
tree3e20383e231de9f6b30685efed573b75e188ce10
parentmdmon: delegate removal to managemon (diff)
downloadmdadm-fca47dc730e3871f6e2123f34375c69274269bcd.tar.xz
mdadm-fca47dc730e3871f6e2123f34375c69274269bcd.zip
ReadMe: Fix stylistic issues
No functional changes, just adopt style to allow checkpatch to pass. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
-rw-r--r--ReadMe.c322
-rw-r--r--mdadm.c38
-rw-r--r--mdadm.h6
3 files changed, 155 insertions, 211 deletions
diff --git a/ReadMe.c b/ReadMe.c
index d57ebb6c..7f1baa7a 100644
--- a/ReadMe.c
+++ b/ReadMe.c
@@ -81,140 +81,138 @@ char Version[] = "mdadm - v" VERSION " - " VERS_DATE EXTRAVERSION "\n";
* found, it is started.
*/
-char short_options[]="-ABCDEFGIQhVXYWZ:vqbc:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tye:k:";
-char short_monitor_options[]="-ABCDEFGIQhVXYWZ:vqbc:i:l:p:m:r:n:x:u:c:d:z:U:N:safRSow1tye:k:";
-char short_bitmap_options[]=
- "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tye:k:";
-char short_bitmap_auto_options[]=
- "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sa:rfRSow1tye:k:";
+char short_opts[] = "-ABCDEFGIQhVXYWZ:vqbc:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tye:k:";
+char short_monitor_opts[] = "-ABCDEFGIQhVXYWZ:vqbc:i:l:p:m:r:n:x:u:c:d:z:U:N:safRSow1tye:k:";
+char short_bitmap_opts[] = "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tye:k:";
+char short_bitmap_auto_opts[] = "-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sa:rfRSow1tye:k:";
struct option long_options[] = {
- {"manage", 0, 0, ManageOpt},
- {"misc", 0, 0, MiscOpt},
- {"assemble", 0, 0, 'A'},
- {"build", 0, 0, 'B'},
- {"create", 0, 0, 'C'},
- {"detail", 0, 0, 'D'},
- {"examine", 0, 0, 'E'},
- {"follow", 0, 0, 'F'},
- {"grow", 0, 0, 'G'},
- {"incremental",0,0, 'I'},
- {"zero-superblock", 0, 0, KillOpt}, /* deliberately not a short_option */
- {"query", 0, 0, 'Q'},
- {"examine-bitmap", 0, 0, 'X'},
- {"auto-detect", 0, 0, AutoDetect},
- {"detail-platform", 0, 0, DetailPlatform},
- {"kill-subarray", 1, 0, KillSubarray},
- {"update-subarray", 1, 0, UpdateSubarray},
- {"udev-rules", 2, 0, UdevRules},
- {"offroot", 0, 0, OffRootOpt},
- {"examine-badblocks", 0, 0, ExamineBB},
-
- {"dump", 1, 0, Dump},
- {"restore", 1, 0, Restore},
-
- /* synonyms */
- {"monitor", 0, 0, 'F'},
-
- /* after those will normally come the name of the md device */
-
- {"help", 0, 0, 'h'},
- {"help-options",0,0, HelpOptions},
- {"version", 0, 0, 'V'},
- {"verbose", 0, 0, 'v'},
- {"quiet", 0, 0, 'q'},
-
- /* For create or build: */
- {"chunk", 1, 0, ChunkSize},
- {"rounding", 1, 0, ChunkSize}, /* for linear, chunk is really a
- * rounding number */
- {"level", 1, 0, 'l'}, /* 0,1,4,5,6,linear */
- {"parity", 1, 0, Layout}, /* {left,right}-{a,}symmetric */
- {"layout", 1, 0, Layout},
- {"raid-disks",1, 0, 'n'},
- {"raid-devices",1, 0, 'n'},
- {"spare-disks",1,0, 'x'},
- {"spare-devices",1,0, 'x'},
- {"size", 1, 0, 'z'},
- {"auto", 1, 0, Auto}, /* also for --assemble */
- {"assume-clean",0,0, AssumeClean },
- {"write-zeroes",0,0, WriteZeroes },
- {"metadata", 1, 0, 'e'}, /* superblock format */
- {"bitmap", 1, 0, Bitmap},
- {"bitmap-chunk", 1, 0, BitmapChunk},
- {"write-behind", 2, 0, WriteBehind},
- {"write-mostly",0, 0, WriteMostly},
- {"failfast", 0, 0, FailFast},
- {"nofailfast",0, 0, NoFailFast},
- {"re-add", 0, 0, ReAdd},
- {"homehost", 1, 0, HomeHost},
- {"data-offset",1, 0, DataOffset},
- {"nodes",1, 0, Nodes}, /* also for --assemble */
- {"home-cluster",1, 0, ClusterName},
- {"write-journal",1, 0, WriteJournal},
- {"consistency-policy", 1, 0, 'k'},
-
- /* For assemble */
- {"uuid", 1, 0, 'u'},
- {"super-minor",1,0, SuperMinor},
- {"name", 1, 0, 'N'},
- {"config", 1, 0, ConfigFile},
- {"scan", 0, 0, 's'},
- {"force", 0, 0, Force},
- {"update", 1, 0, 'U'},
- {"freeze-reshape", 0, 0, FreezeReshape},
-
- /* Management */
- {"add", 0, 0, Add},
- {"add-spare", 0, 0, AddSpare},
- {"add-journal", 0, 0, AddJournal},
- {"remove", 0, 0, Remove},
- {"fail", 0, 0, Fail},
- {"set-faulty",0, 0, Fail},
- {"replace", 0, 0, Replace},
- {"with", 0, 0, With},
- {"run", 0, 0, 'R'},
- {"stop", 0, 0, 'S'},
- {"readonly", 0, 0, 'o'},
- {"readwrite", 0, 0, 'w'},
- {"no-degraded",0,0, NoDegraded },
- {"wait", 0, 0, WaitOpt},
- {"wait-clean", 0, 0, Waitclean },
- {"action", 1, 0, Action },
- {"cluster-confirm", 0, 0, ClusterConfirm},
-
- /* For Detail/Examine */
- {"brief", 0, 0, Brief},
- {"no-devices",0, 0, NoDevices},
- {"export", 0, 0, 'Y'},
- {"sparc2.2", 0, 0, Sparc22},
- {"test", 0, 0, 't'},
- {"prefer", 1, 0, Prefer},
-
- /* For Follow/monitor */
- {"mail", 1, 0, EMail},
- {"program", 1, 0, ProgramOpt},
- {"alert", 1, 0, ProgramOpt},
- {"increment", 1, 0, Increment},
- {"delay", 1, 0, 'd'},
- {"daemonise", 0, 0, Fork},
- {"daemonize", 0, 0, Fork},
- {"oneshot", 0, 0, '1'},
- {"pid-file", 1, 0, 'i'},
- {"syslog", 0, 0, 'y'},
- {"no-sharing", 0, 0, NoSharing},
-
- /* For Grow */
- {"backup-file", 1,0, BackupFile},
- {"invalid-backup",0,0,InvalidBackup},
- {"array-size", 1, 0, 'Z'},
- {"continue", 0, 0, Continue},
-
- /* For Incremental */
- {"rebuild-map", 0, 0, RebuildMapOpt},
- {"path", 1, 0, IncrementalPath},
-
- {0, 0, 0, 0}
+ {"manage", 0, 0, ManageOpt},
+ {"misc", 0, 0, MiscOpt},
+ {"assemble", 0, 0, 'A'},
+ {"build", 0, 0, 'B'},
+ {"create", 0, 0, 'C'},
+ {"detail", 0, 0, 'D'},
+ {"examine", 0, 0, 'E'},
+
+ {"follow", 0, 0, 'F'},
+ {"monitor", 0, 0, 'F'},
+
+ {"grow", 0, 0, 'G'},
+ {"incremental", 0, 0, 'I'},
+ {"zero-superblock", 0, 0, KillOpt}, /* deliberately not a short_option */
+ {"query", 0, 0, 'Q'},
+ {"examine-bitmap", 0, 0, 'X'},
+ {"auto-detect", 0, 0, AutoDetect},
+ {"detail-platform", 0, 0, DetailPlatform},
+ {"kill-subarray", 1, 0, KillSubarray},
+ {"update-subarray", 1, 0, UpdateSubarray},
+ {"udev-rules", 2, 0, UdevRules},
+ {"offroot", 0, 0, OffRootOpt},
+ {"examine-badblocks", 0, 0, ExamineBB},
+
+ {"dump", 1, 0, Dump},
+ {"restore", 1, 0, Restore},
+
+ /* after those will normally come the name of the md device */
+ {"help", 0, 0, 'h'},
+ {"help-options", 0, 0, HelpOptions},
+ {"version", 0, 0, 'V'},
+ {"verbose", 0, 0, 'v'},
+ {"quiet", 0, 0, 'q'},
+
+ /* For create or build: */
+ {"chunk", 1, 0, ChunkSize},
+ {"rounding", 1, 0, ChunkSize}, /* for linear, chunk is really a rounding number */
+ {"level", 1, 0, 'l'}, /* 0, 1, 4, 5, 6, linear */
+ {"parity", 1, 0, Layout}, /* {left,right}-{a,}symmetric */
+ {"layout", 1, 0, Layout},
+ {"raid-disks", 1, 0, 'n'},
+ {"raid-devices", 1, 0, 'n'},
+ {"spare-disks", 1, 0, 'x'},
+ {"spare-devices", 1, 0, 'x'},
+ {"size", 1, 0, 'z'},
+ {"auto", 1, 0, Auto},
+ {"assume-clean", 0, 0, AssumeClean },
+ {"write-zeroes", 0, 0, WriteZeroes },
+ {"metadata", 1, 0, 'e'}, /* superblock format */
+ {"bitmap", 1, 0, Bitmap},
+ {"bitmap-chunk", 1, 0, BitmapChunk},
+ {"write-behind", 2, 0, WriteBehind},
+ {"write-mostly", 0, 0, WriteMostly},
+ {"failfast", 0, 0, FailFast},
+ {"nofailfast", 0, 0, NoFailFast},
+ {"re-add", 0, 0, ReAdd},
+ {"homehost", 1, 0, HomeHost},
+ {"data-offset", 1, 0, DataOffset},
+ {"nodes", 1, 0, Nodes},
+ {"home-cluster", 1, 0, ClusterName},
+ {"write-journal", 1, 0, WriteJournal},
+ {"consistency-policy", 1, 0, 'k'},
+
+ /* For assemble */
+ {"uuid", 1, 0, 'u'},
+ {"super-minor", 1, 0, SuperMinor},
+ {"name", 1, 0, 'N'},
+ {"config", 1, 0, ConfigFile},
+ {"scan", 0, 0, 's'},
+ {"force", 0, 0, Force},
+ {"update", 1, 0, 'U'},
+ {"freeze-reshape", 0, 0, FreezeReshape},
+
+ /* Management */
+ {"add", 0, 0, Add},
+ {"add-spare", 0, 0, AddSpare},
+ {"add-journal", 0, 0, AddJournal},
+ {"remove", 0, 0, Remove},
+ {"fail", 0, 0, Fail},
+ {"set-faulty", 0, 0, Fail},
+ {"replace", 0, 0, Replace},
+ {"with", 0, 0, With},
+ {"run", 0, 0, 'R'},
+ {"stop", 0, 0, 'S'},
+ {"readonly", 0, 0, 'o'},
+ {"readwrite", 0, 0, 'w'},
+ {"no-degraded", 0, 0, NoDegraded},
+ {"wait", 0, 0, WaitOpt},
+ {"wait-clean", 0, 0, Waitclean},
+ {"action", 1, 0, Action},
+ {"cluster-confirm", 0, 0, ClusterConfirm},
+
+ /* For Detail/Examine */
+ {"brief", 0, 0, Brief},
+ {"no-devices", 0, 0, NoDevices},
+ {"export", 0, 0, 'Y'},
+ {"sparc2.2", 0, 0, Sparc22},
+ {"test", 0, 0, 't'},
+ {"prefer", 1, 0, Prefer},
+
+ /* For Follow/monitor */
+ {"mail", 1, 0, EMail},
+ {"program", 1, 0, ProgramOpt},
+ {"alert", 1, 0, ProgramOpt},
+ {"increment", 1, 0, Increment},
+ {"delay", 1, 0, 'd'},
+
+ {"daemonise", 0, 0, Fork},
+ {"daemonize", 0, 0, Fork},
+
+ {"oneshot", 0, 0, '1'},
+ {"pid-file", 1, 0, 'i'},
+ {"syslog", 0, 0, 'y'},
+ {"no-sharing", 0, 0, NoSharing},
+
+ /* For Grow */
+ {"backup-file", 1, 0, BackupFile},
+ {"invalid-backup", 0, 0, InvalidBackup},
+ {"array-size", 1, 0, 'Z'},
+ {"continue", 0, 0, Continue},
+
+ /* For Incremental */
+ {"rebuild-map", 0, 0, RebuildMapOpt},
+ {"path", 1, 0, IncrementalPath},
+
+ {0, 0, 0, 0}
};
char Usage[] =
@@ -287,64 +285,6 @@ char OptionHelp[] =
" device relates to the md driver\n"
" --auto-detect : Start arrays auto-detected by the kernel\n"
;
-/*
-"\n"
-" For create or build:\n"
-" --bitmap= -b : File to store bitmap in - may pre-exist for --build\n"
-" --chunk= -c : chunk size of kibibytes\n"
-" --rounding= : rounding factor for linear array (==chunk size)\n"
-" --level= -l : raid level: 0,1,4,5,6,10,linear, or mp for create.\n"
-" : 0,1,10,mp,faulty or linear for build.\n"
-" --parity= -p : raid5/6 parity algorithm: {left,right}-{,a}symmetric\n"
-" --layout= : same as --parity, for RAID10: [fno]NN \n"
-" --raid-devices= -n : number of active devices in array\n"
-" --spare-devices= -x: number of spare (eXtra) devices in initial array\n"
-" --size= -z : Size (in K) of each drive in RAID1/4/5/6/10 - optional\n"
-" --force -f : Honour devices as listed on command line. Don't\n"
-" : insert a missing drive for RAID5.\n"
-" --assume-clean : Assume the array is already in-sync. This is dangerous for RAID5.\n"
-" --bitmap-chunk= : chunksize of bitmap in bitmap file (Kilobytes)\n"
-" --delay= -d : seconds between bitmap updates\n"
-" --write-behind= : number of simultaneous write-behind requests to allow (requires bitmap)\n"
-" --name= -N : Textual name for array - max 32 characters\n"
-"\n"
-" For assemble:\n"
-" --bitmap= -b : File to find bitmap information in\n"
-" --uuid= -u : uuid of array to assemble. Devices which don't\n"
-" have this uuid are excluded\n"
-" --super-minor= -m : minor number to look for in super-block when\n"
-" choosing devices to use.\n"
-" --name= -N : Array name to look for in super-block.\n"
-" --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: try '-A --update=?' for list of options.\n"
-" --no-degraded : Do not start any degraded arrays - default unless --scan.\n"
-"\n"
-" For detail or examine:\n"
-" --brief -b : Just print device name and UUID\n"
-"\n"
-" For follow/monitor:\n"
-" --mail= -m : Address to mail alerts of failure to\n"
-" --program= -p : Program to run when an event is detected\n"
-" --alert= : same as --program\n"
-" --delay= -d : seconds of delay between polling state. default=60\n"
-"\n"
-" General management:\n"
-" --add -a : add, or hotadd subsequent devices\n"
-" --re-add : re-add a recently removed device\n"
-" --remove -r : remove subsequent devices\n"
-" --fail -f : mark subsequent devices as faulty\n"
-" --set-faulty : same as --fail\n"
-" --replace : mark a device for replacement\n"
-" --run -R : start a partially built array\n"
-" --stop -S : deactivate array, releasing all resources\n"
-" --readonly -o : mark array as readonly\n"
-" --readwrite -w : mark array as readwrite\n"
-" --zero-superblock : erase the MD superblock from a device.\n"
-" --wait -W : wait for recovery/resync/reshape to finish.\n"
-;
-*/
char Help_create[] =
"Usage: mdadm --create device --chunk=X --level=Y --raid-devices=Z devices\n"
@@ -374,7 +314,7 @@ char Help_create[] =
" --rounding= : rounding factor for linear array (==chunk size)\n"
" --level= -l : raid level: 0,1,4,5,6,10,linear,multipath and synonyms\n"
" --parity= -p : raid5/6 parity algorithm: {left,right}-{,a}symmetric\n"
-" --layout= : same as --parity, for RAID10: [fno]NN \n"
+" --layout= : same as --parity, for RAID10: [fno]NN\n"
" --raid-devices= -n : number of active devices in array\n"
" --spare-devices= -x : number of spare (eXtra) devices in initial array\n"
" --size= -z : Size (in K) of each drive in RAID1/4/5/6/10 - optional\n"
diff --git a/mdadm.c b/mdadm.c
index de7cde07..83051a1b 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -139,7 +139,7 @@ int main(int argc, char *argv[])
struct supertype *ss = NULL;
enum flag_mode writemostly = FlagDefault;
enum flag_mode failfast = FlagDefault;
- char *shortopt = short_options;
+ char *shortopt = short_opts;
int dosyslog = 0;
int rebuild_map = 0;
char *remove_path = NULL;
@@ -228,10 +228,10 @@ int main(int argc, char *argv[])
* set the mode if it isn't already
*/
- switch(opt) {
+ switch (opt) {
case ManageOpt:
newmode = MANAGE;
- shortopt = short_bitmap_options;
+ shortopt = short_bitmap_opts;
break;
case 'a':
case Add:
@@ -247,27 +247,33 @@ int main(int argc, char *argv[])
case ClusterConfirm:
if (!mode) {
newmode = MANAGE;
- shortopt = short_bitmap_options;
+ shortopt = short_bitmap_opts;
}
break;
- case 'A': newmode = ASSEMBLE;
- shortopt = short_bitmap_auto_options;
+ case 'A':
+ newmode = ASSEMBLE;
+ shortopt = short_bitmap_auto_opts;
break;
- case 'B': newmode = BUILD;
- shortopt = short_bitmap_auto_options;
+ case 'B':
+ newmode = BUILD;
+ shortopt = short_bitmap_auto_opts;
break;
- case 'C': newmode = CREATE;
- shortopt = short_bitmap_auto_options;
+ case 'C':
+ newmode = CREATE;
+ shortopt = short_bitmap_auto_opts;
break;
- case 'F': newmode = MONITOR;
- shortopt = short_monitor_options;
+ case 'F':
+ newmode = MONITOR;
+ shortopt = short_monitor_opts;
break;
- case 'G': newmode = GROW;
- shortopt = short_bitmap_options;
+ case 'G':
+ newmode = GROW;
+ shortopt = short_bitmap_opts;
break;
- case 'I': newmode = INCREMENTAL;
- shortopt = short_bitmap_auto_options;
+ case 'I':
+ newmode = INCREMENTAL;
+ shortopt = short_bitmap_auto_opts;
break;
case AutoDetect:
newmode = AUTODETECT;
diff --git a/mdadm.h b/mdadm.h
index 260cdf54..0f40af93 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -470,10 +470,8 @@ enum mode {
mode_count
};
-extern char short_options[];
-extern char short_monitor_options[];
-extern char short_bitmap_options[];
-extern char short_bitmap_auto_options[];
+extern char short_opts[], short_monitor_opts[], short_bitmap_opts[], short_bitmap_auto_opts[];
+
extern struct option long_options[];
extern char Version[], Usage[], Help[], OptionHelp[],
*mode_help[],