+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
+ */