]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mdstat.c
Add new mode: --incremental
[thirdparty/mdadm.git] / mdstat.c
index 8836828657c7bfff5c0019557fa871cef8727a57..de31acbf305ea96c6101857ff1b228ee23eb1719 100644 (file)
--- a/mdstat.c
+++ b/mdstat.c
@@ -43,7 +43,7 @@
  *  read_ahead {not set|%d sectors}
  *  mdN : {in}active {(readonly)} raidX dev[%d]{(F)} ... %d blocks STATUS RESYNC
  *  ... Only initialised arrays listed
- *  unused: dev dev dev | <none>
+ *  unused devices: {dev dev ... | <none>}
  *
  * STATUS is personality dependant:
  *    linear:  %dk rounding
@@ -62,7 +62,7 @@
  *  mdN : {in}active {(read-only)} raidX dev[%d]{(F)} ...
  *       %d blocks STATUS
  *       RESYNC
- *  unused: dev dev .. | <none>
+ *  unused devices: {dev dev .. | <none>}
  *
  *  STATUS matches 0.90.0/2.2
  *  RESYNC includes [===>....],
@@ -251,3 +251,15 @@ void mdstat_wait(int seconds)
        tm.tv_usec = 0;
        select(mdstat_fd >2 ? mdstat_fd+1:3, NULL, NULL, &fds, &tm);
 }
+
+int mddev_busy(int devnum)
+{
+       struct mdstat_ent *mdstat = mdstat_read(0, 0);
+       struct mdstat_ent *me;
+
+       for (me = mdstat ; me ; me = me->next)
+               if (me->devnum == devnum)
+                       break;
+       free_mdstat(mdstat);
+       return me != NULL;
+}