summaryrefslogtreecommitdiffstats
path: root/mdadm.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.com>2016-11-29 23:02:11 +0100
committerJes Sorensen <Jes.Sorensen@redhat.com>2016-11-29 23:12:13 +0100
commite22fe3ae15901d723aa6a0d319cd18564156c50b (patch)
tree7311d646a0a6dc72571b6816fb10669c0f3bc2b5 /mdadm.c
parentmdmon: bad block support for external metadata - clear bad blocks (diff)
downloadmdadm-e22fe3ae15901d723aa6a0d319cd18564156c50b.tar.xz
mdadm-e22fe3ae15901d723aa6a0d319cd18564156c50b.zip
Introduce enum flag_mode for setting and clearing flags.
We currently use '1' to indicate that a flag (writemostly or failfast) needs to be set, and '2' to indicate that it needs to be cleared. Using magic number like this is not a best-practice. So replaced them with values from a enum. No functional change. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Diffstat (limited to 'mdadm.c')
-rw-r--r--mdadm.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/mdadm.c b/mdadm.c
index 3c8f273c..c3a265b8 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -89,8 +89,8 @@ int main(int argc, char *argv[])
int oneshot = 0;
int spare_sharing = 1;
struct supertype *ss = NULL;
- int writemostly = 0;
- int failfast = 0;
+ enum flag_mode writemostly = FlagDefault;
+ enum flag_mode failfast = FlagDefault;
char *shortopt = short_options;
int dosyslog = 0;
int rebuild_map = 0;
@@ -412,20 +412,20 @@ int main(int argc, char *argv[])
case O(CREATE,'W'):
case O(CREATE,WriteMostly):
/* set write-mostly for following devices */
- writemostly = 1;
+ writemostly = FlagSet;
continue;
case O(MANAGE,'w'):
/* clear write-mostly for following devices */
- writemostly = 2;
+ writemostly = FlagClear;
continue;
case O(MANAGE,FailFast):
case O(CREATE,FailFast):
- failfast = 1;
+ failfast = FlagSet;
continue;
case O(MANAGE,NoFailFast):
- failfast = 2;
+ failfast = FlagClear;
continue;
case O(GROW,'z'):