summaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2004-08-11 02:16:01 +0000
committerNeil Brown <neilb@suse.de>2004-08-11 02:16:01 +0000
commite5329c3747a4e9eb7addbfaa59b8d5e8688ce2a1 (patch)
tree889e38efabcc146f7ee4c59f39c79aae7c783d8d /util.c
parentdd0781e50555c32ff2f808ec46f4b03a5693ea47 (diff)
downloadmdadm-e5329c3747a4e9eb7addbfaa59b8d5e8688ce2a1.tar.gz
mdadm-e5329c3747a4e9eb7addbfaa59b8d5e8688ce2a1.tar.xz
mdadm-e5329c3747a4e9eb7addbfaa59b8d5e8688ce2a1.zip
mdadm-1.7.0mdadm-1.7.0
Diffstat (limited to 'util.c')
-rw-r--r--util.c53
1 files changed, 28 insertions, 25 deletions
diff --git a/util.c b/util.c
index 2f4ad96..5ef59c0 100644
--- a/util.c
+++ b/util.c
@@ -121,6 +121,8 @@ int get_linux_version()
int enough(int level, int raid_disks, int avail_disks)
{
switch (level) {
+ case 10: return 1; /* a lie, but it is hard to tell */
+
case -4:
return avail_disks>= 1;
case -1:
@@ -375,6 +377,32 @@ int map_name(mapping_t *map, char *name)
return UnSet;
}
+
+int is_standard(char *dev)
+{
+ /* tests if dev is a "standard" md dev name.
+ * i.e if the last component is "/dNN" or "/mdNN",
+ * where NN is a string of digits
+ */
+ dev = strrchr(dev, '/');
+ if (!dev)
+ return 0;
+ if (strncmp(dev, "/d",2)==0)
+ dev += 2;
+ else if (strncmp(dev, "/md", 3)==0)
+ dev += 3;
+ else
+ return 0;
+ if (!*dev)
+ return 0;
+ while (isdigit(*dev))
+ dev++;
+ if (*dev)
+ return 0;
+ return 1;
+}
+
+
/*
* convert a major/minor pair for a block device into a name in /dev, if possible.
* On the first call, walk /dev collecting name.
@@ -421,31 +449,6 @@ int add_dev(const char *name, const struct stat *stb, int flag)
return 0;
}
-int is_standard(char *dev)
-{
- /* tests if dev is a "standard" md dev name.
- * i.e if the last component is "/dNN" or "/mdNN",
- * where NN is a string of digits
- */
- dev = strrchr(dev, '/');
- if (!dev)
- return 0;
- if (strncmp(dev, "/d",2)==0)
- dev += 2;
- else if (strncmp(dev, "/md", 3)==0)
- dev += 3;
- else
- return 0;
- if (!*dev)
- return 0;
- while (isdigit(*dev))
- dev++;
- if (*dev)
- return 0;
- return 1;
-}
-
-
/*
* Find a block device with the right major/minor number.
* Avoid /dev/mdNN and /dev/md/dNN is possible