]> git.ozlabs.org Git - petitboot/blobdiff - devices/udev-helper.c
Ignore ramdisk devices.
[petitboot] / devices / udev-helper.c
index d70a1d716718e1ea4d6e3e88eb13140a6ddb5389..84b2bef95947cd16ea70ce5d311998f250ff5bd9 100644 (file)
@@ -401,6 +401,18 @@ static int is_removable_device(const char *sysfs_path)
        return strtol(buf, NULL, 10);
 }
 
+static int is_ignored_device(const char *devname)
+{
+       static const char *ignored_devices[] = { "/dev/ram", NULL };
+       const char **dev;
+
+       for (dev = ignored_devices; *dev; dev++)
+               if (!strncmp(devname, *dev, strlen(*dev)))
+                       return 1;
+
+       return 0;
+}
+
 static int found_new_device(const char *dev_path)
 {
        char mountpoint[PATH_MAX];
@@ -573,6 +585,9 @@ int main(int argc, char **argv)
                return EXIT_FAILURE;
        }
 
+       if (is_ignored_device(dev_path))
+               return EXIT_SUCCESS;
+
        if (streq(action, "add")) {
                char *sysfs_path = getenv("DEVPATH");
                if (sysfs_path && is_removable_device(sysfs_path))