+ if (strcasecmp(temp2, FIELD_BUS) == 0) {
+ strfieldcpy(dev.bus, temp3);
+ valid = 1;
+ continue;
+ }
+
+ if (strcasecmp(temp2, FIELD_ID) == 0) {
+ strfieldcpy(dev.id, temp3);
+ valid = 1;
+ continue;
+ }
+
+ if (strcasecmp(temp2, FIELD_PLACE) == 0) {
+ strfieldcpy(dev.place, temp3);
+ valid = 1;
+ continue;
+ }
+
+ if (strncasecmp(temp2, FIELD_SYSFS, sizeof(FIELD_SYSFS)-1) == 0) {
+ struct sysfs_pair *pair = &dev.sysfs_pair[0];
+ int sysfs_pair_num = 0;
+
+ /* find first unused pair */
+ while (pair->file[0] != '\0') {
+ ++sysfs_pair_num;
+ if (sysfs_pair_num >= MAX_SYSFS_PAIRS) {
+ pair = NULL;
+ break;
+ }
+ ++pair;
+ }
+ if (pair) {
+ attr = get_key_attribute(temp2 + sizeof(FIELD_SYSFS)-1);
+ if (attr == NULL) {
+ dbg("error parsing " FIELD_SYSFS " attribute");
+ continue;
+ }
+ strfieldcpy(pair->file, attr);
+ strfieldcpy(pair->value, temp3);
+ valid = 1;
+ }
+ 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;
+ continue;
+ }
+
+ if (strcasecmp(temp2, FIELD_PROGRAM) == 0) {
+ program_given = 1;
+ strfieldcpy(dev.program, temp3);
+ valid = 1;
+ continue;
+ }
+
+ if (strcasecmp(temp2, FIELD_RESULT) == 0) {
+ strfieldcpy(dev.result, temp3);
+ valid = 1;
+ continue;
+ }
+
+ if (strncasecmp(temp2, FIELD_NAME, sizeof(FIELD_NAME)-1) == 0) {
+ attr = get_key_attribute(temp2 + sizeof(FIELD_NAME)-1);
+ if (attr != NULL) {
+ if (strstr(attr, ATTR_PARTITIONS) != NULL) {
+ dbg_parse("creation of partition nodes requested");
+ dev.partitions = PARTITIONS_COUNT;
+ }
+ if (strstr(attr, ATTR_IGNORE_REMOVE) != NULL) {
+ dbg_parse("remove event should be ignored");
+ dev.ignore_remove = 1;
+ }
+ }
+ strfieldcpy(dev.name, temp3);
+ valid = 1;
+ continue;
+ }
+
+ if (strcasecmp(temp2, FIELD_SYMLINK) == 0) {
+ strfieldcpy(dev.symlink, temp3);
+ valid = 1;
+ continue;
+ }
+
+ if (strcasecmp(temp2, FIELD_OWNER) == 0) {
+ strfieldcpy(dev.owner, temp3);
+ valid = 1;
+ continue;
+ }
+
+ if (strcasecmp(temp2, FIELD_GROUP) == 0) {
+ strfieldcpy(dev.group, temp3);
+ valid = 1;
+ continue;
+ }
+
+ if (strcasecmp(temp2, FIELD_MODE) == 0) {
+ dev.mode = strtol(temp3, NULL, 8);
+ valid = 1;
+ continue;
+ }
+
+ dbg("unknown type of field '%s'", temp2);
+ goto error;