From 95b79df03ebbb2c80b6a3bbe317b983d7cebe9cc Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 5 May 2008 21:55:37 +1000 Subject: [PATCH] let '-a' be specified for Incremental mode From: Dan Williams Signed-off-by: Dan Williams --- mdadm.c | 4 +++- util.c | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/mdadm.c b/mdadm.c index b4b503d..f2a7bcd 100644 --- a/mdadm.c +++ b/mdadm.c @@ -199,7 +199,8 @@ int main(int argc, char *argv[]) case 'G': newmode = GROW; shortopt = short_bitmap_options; break; - case 'I': newmode = INCREMENTAL; break; + case 'I': newmode = INCREMENTAL; + shortopt = short_bitmap_auto_options; break; case AutoDetect: newmode = AUTODETECT; break; @@ -511,6 +512,7 @@ int main(int argc, char *argv[]) case O(CREATE,'a'): case O(BUILD,'a'): + case O(INCREMENTAL,'a'): case O(ASSEMBLE,'a'): /* auto-creation of device node */ autof = parse_auto(optarg, "--auto flag", 0); continue; diff --git a/util.c b/util.c index 514b713..108f3c1 100644 --- a/util.c +++ b/util.c @@ -884,11 +884,14 @@ int find_free_devnum(int use_partitions) for (devnum = 127; devnum != 128; devnum = devnum ? devnum-1 : (1<<22)-1) { char *dn; - if (mddev_busy(use_partitions ? (-1-devnum) : devnum)) + int _devnum; + + _devnum = use_partitions ? (-1-devnum) : devnum; + if (mddev_busy(_devnum)) continue; /* make sure it is new to /dev too, at least as a * non-standard */ - dn = map_dev(dev2major(devnum), dev2minor(devnum), 0); + dn = map_dev(dev2major(_devnum), dev2minor(_devnum), 0); if (dn && ! is_standard(dn, NULL)) continue; break;