summaryrefslogtreecommitdiff
path: root/mdstat.c
diff options
context:
space:
mode:
Diffstat (limited to 'mdstat.c')
-rw-r--r--mdstat.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/mdstat.c b/mdstat.c
index 5eeac6cc..de31acbf 100644
--- a/mdstat.c
+++ b/mdstat.c
@@ -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;
+}