summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgreg@kroah.com <greg@kroah.com>2004-06-26 01:27:12 -0700
committerGreg KH <gregkh@suse.de>2005-04-26 21:36:21 -0700
commitfcf3ce3417ea0805572873451d2a4f49deefdc10 (patch)
tree1e85c2a5f40f9bc7a81e3f3565dd517df81ced6b
parent9a52390cfe0882df3a24b75cc9d8b36878a3982d (diff)
[PATCH] clean up block whitelist search logic a bit.
-rw-r--r--namedev.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/namedev.c b/namedev.c
index 7f3a6a7783..52417e3793 100644
--- 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;
}