]> err.no Git - systemd/commitdiff
[PATCH] clean up block whitelist search logic a bit.
authorgreg@kroah.com <greg@kroah.com>
Sat, 26 Jun 2004 08:27:12 +0000 (01:27 -0700)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 04:36:21 +0000 (21:36 -0700)
namedev.c

index 7f3a6a7783913c6bd89b49d360013b72e4176f5a..52417e3793b655fcca041ff1ead58e7a0ba8d4ce 100644 (file)
--- a/namedev.c
+++ b/namedev.c
@@ -604,9 +604,8 @@ static int match_place(struct config_device *dev, struct sysfs_class_device *cla
 
 static int whitelist_search(struct sysfs_class_device *class_dev)
 {
+       char *sysblock = "/sys/block";
        int i;
-       int list_size = 17;
-       int sysblock = 10;
 
        static char *list[] = {
                "nb",
@@ -626,15 +625,15 @@ static int whitelist_search(struct sysfs_class_device *class_dev)
                "pf",
                "scd",
                "ubd",
+               NULL,
        };
 
-       if (!strncmp(class_dev->path, "/sys/block", sysblock)) {
-               for (i=0; i < list_size; i++) {
-                       if (!strncmp(class_dev->name, list[i], strlen(list[i]))) {
-                               return 1;
-                       }
-               }
-       }
+       if (strncmp(class_dev->path, sysblock, strlen(sysblock)))
+               return 0;
+
+       for (i=0; list[i] != NULL; i++)
+               if (!strncmp(class_dev->name, list[i], strlen(list[i])))
+                       return 1;
 
        return 0;
 }