chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[PATCH] fix up segfaulting binaries with new klibc
[elogind.git]
/
namedev_parse.c
diff --git
a/namedev_parse.c
b/namedev_parse.c
index 981daa7b3b1d3e5e6a173c2e75e8b3d308d37ee3..e360565950c71768975891c8264f76e21031e3b7 100644
(file)
--- a/
namedev_parse.c
+++ b/
namedev_parse.c
@@
-98,7
+98,7
@@
static char *get_key_attribute(char *str)
return NULL;
}
return NULL;
}
-static int namedev_parse(
const char *filename, void *data
)
+static int namedev_parse(
struct udevice *udev, const char *filename
)
{
char line[LINE_SIZE];
char *bufline;
{
char line[LINE_SIZE];
char *bufline;
@@
-153,7
+153,7
@@
static int namedev_parse(const char *filename, void *data)
/* skip backslash and newline from multi line rules */
for (i = j = 0; i < count; i++) {
/* skip backslash and newline from multi line rules */
for (i = j = 0; i < count; i++) {
- if (bufline[i] == '\\'
|| bufline[i
] == '\n')
+ if (bufline[i] == '\\'
&& bufline[i+1
] == '\n')
continue;
line[j++] = bufline[i];
continue;
line[j++] = bufline[i];
@@
-171,6
+171,18
@@
static int namedev_parse(const char *filename, void *data)
if (retval)
break;
if (retval)
break;
+ if (strcasecmp(temp2, FIELD_KERNEL) == 0) {
+ strfieldcpy(dev.kernel, temp3);
+ valid = 1;
+ continue;
+ }
+
+ if (strcasecmp(temp2, FIELD_SUBSYSTEM) == 0) {
+ strfieldcpy(dev.subsystem, temp3);
+ valid = 1;
+ continue;
+ }
+
if (strcasecmp(temp2, FIELD_BUS) == 0) {
strfieldcpy(dev.bus, temp3);
valid = 1;
if (strcasecmp(temp2, FIELD_BUS) == 0) {
strfieldcpy(dev.bus, temp3);
valid = 1;
@@
-215,18
+227,6
@@
static int namedev_parse(const char *filename, void *data)
continue;
}
continue;
}
- if (strcasecmp(temp2, FIELD_KERNEL) == 0) {
- strfieldcpy(dev.kernel, temp3);
- valid = 1;
- continue;
- }
-
- if (strcasecmp(temp2, FIELD_SUBSYSTEM) == 0) {
- strfieldcpy(dev.subsystem, temp3);
- valid = 1;
- continue;
- }
-
if (strcasecmp(temp2, FIELD_DRIVER) == 0) {
strfieldcpy(dev.driver, temp3);
valid = 1;
if (strcasecmp(temp2, FIELD_DRIVER) == 0) {
strfieldcpy(dev.driver, temp3);
valid = 1;
@@
-250,16
+250,19
@@
static int namedev_parse(const char *filename, void *data)
attr = get_key_attribute(temp2 + sizeof(FIELD_NAME)-1);
/* FIXME: remove old style options and make OPTIONS= mandatory */
if (attr != NULL) {
attr = get_key_attribute(temp2 + sizeof(FIELD_NAME)-1);
/* FIXME: remove old style options and make OPTIONS= mandatory */
if (attr != NULL) {
- if (strstr(attr,
ATTR
_PARTITIONS) != NULL) {
+ if (strstr(attr,
OPTION
_PARTITIONS) != NULL) {
dbg_parse("creation of partition nodes requested");
dev.partitions = DEFAULT_PARTITIONS_COUNT;
}
dbg_parse("creation of partition nodes requested");
dev.partitions = DEFAULT_PARTITIONS_COUNT;
}
- if (strstr(attr,
ATTR
_IGNORE_REMOVE) != NULL) {
+ if (strstr(attr,
OPTION
_IGNORE_REMOVE) != NULL) {
dbg_parse("remove event should be ignored");
dev.ignore_remove = 1;
}
}
dbg_parse("remove event should be ignored");
dev.ignore_remove = 1;
}
}
- strfieldcpy(dev.name, temp3);
+ if (temp3[0] != '\0')
+ strfieldcpy(dev.name, temp3);
+ else
+ dev.ignore_device = 1;
valid = 1;
continue;
}
valid = 1;
continue;
}
@@
-289,15
+292,15
@@
static int namedev_parse(const char *filename, void *data)
}
if (strcasecmp(temp2, FIELD_OPTIONS) == 0) {
}
if (strcasecmp(temp2, FIELD_OPTIONS) == 0) {
- if (strstr(temp3,
ATTR
_IGNORE_DEVICE) != NULL) {
+ if (strstr(temp3,
OPTION
_IGNORE_DEVICE) != NULL) {
dbg_parse("device should be ignored");
dev.ignore_device = 1;
}
dbg_parse("device should be ignored");
dev.ignore_device = 1;
}
- if (strstr(temp3,
ATTR
_IGNORE_REMOVE) != NULL) {
+ if (strstr(temp3,
OPTION
_IGNORE_REMOVE) != NULL) {
dbg_parse("remove event should be ignored");
dev.ignore_remove = 1;
}
dbg_parse("remove event should be ignored");
dev.ignore_remove = 1;
}
- if (strstr(temp3,
ATTR
_PARTITIONS) != NULL) {
+ if (strstr(temp3,
OPTION
_PARTITIONS) != NULL) {
dbg_parse("creation of partition nodes requested");
dev.partitions = DEFAULT_PARTITIONS_COUNT;
}
dbg_parse("creation of partition nodes requested");
dev.partitions = DEFAULT_PARTITIONS_COUNT;
}
@@
-351,9
+354,9
@@
int namedev_init(void)
return -1;
if ((stats.st_mode & S_IFMT) != S_IFDIR)
return -1;
if ((stats.st_mode & S_IFMT) != S_IFDIR)
- retval = namedev_parse(
udev_rules_filename, NULL
);
+ retval = namedev_parse(
NULL, udev_rules_filename
);
else
else
- retval = call_foreach_file(namedev_parse,
udev_rules_filename, RULEFILE_SUFFIX, NULL
);
+ retval = call_foreach_file(namedev_parse,
NULL, udev_rules_filename, RULEFILE_SUFFIX
);
return retval;
}
return retval;
}
@@
-361,8
+364,9
@@
int namedev_init(void)
void namedev_close(void)
{
struct config_device *dev;
void namedev_close(void)
{
struct config_device *dev;
+ struct config_device *temp_dev;
- list_for_each_entry
(
dev, &config_device_list, node) {
+ list_for_each_entry
_safe(dev, temp_
dev, &config_device_list, node) {
list_del(&dev->node);
free(dev);
}
list_del(&dev->node);
free(dev);
}