]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Manage.c
Add --auto-detect for in-kernel autodetect.
[thirdparty/mdadm.git] / Manage.c
index 3deb8ead690d8a2af899e1fc366626192f1a529a..d857c99ea568c0f391c19649897d003f8dfd50fa 100644 (file)
--- a/Manage.c
+++ b/Manage.c
@@ -507,4 +507,17 @@ int Manage_subdevs(char *devname, int fd,
        return 0;
        
 }
+
+int autodetect(void)
+{
+       /* Open any md device, and issue the RAID_AUTORUN ioctl */
+       int rv = 1;
+       int fd = dev_open("9:0", O_RDONLY);
+       if (fd >= 0) {
+               if (ioctl(fd, RAID_AUTORUN, 0) == 0)
+                       rv = 0;
+               close(fd);
+       }
+       return rv;
+}
 #endif