mirror of
https://github.com/systemd/systemd.git
synced 2025-01-12 13:18:14 +03:00
[PATCH] clean up block whitelist search logic a bit.
This commit is contained in:
parent
9a52390cfe
commit
fcf3ce3417
17
namedev.c
17
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user