diff options
-rw-r--r-- | extras/usb_id/usb_id.c | 24 | ||||
-rw-r--r-- | udev/Makefile.am | 2 | ||||
-rw-r--r-- | udev/lib/exported_symbols | 6 | ||||
-rw-r--r-- | udev/lib/libudev-device.c | 26 | ||||
-rw-r--r-- | udev/lib/libudev-enumerate.c | 42 | ||||
-rw-r--r-- | udev/lib/libudev.h | 6 | ||||
-rw-r--r-- | udev/lib/test-libudev.c | 2 | ||||
-rw-r--r-- | udev/udev-event.c | 6 | ||||
-rw-r--r-- | udev/udevadm-info.c | 2 | ||||
-rw-r--r-- | udev/udevadm-trigger.c | 4 |
10 files changed, 60 insertions, 60 deletions
diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 4d5265532d..59cdd40b31 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -221,7 +221,7 @@ static int usb_id(struct udev_device *dev) return 1; } - if_class = udev_device_get_attr_value(dev_interface, "bInterfaceClass"); + if_class = udev_device_get_sysattr_value(dev_interface, "bInterfaceClass"); if (!if_class) { info(udev, "%s: cannot get bInterfaceClass attribute\n", udev_device_get_sysname(dev)); @@ -229,7 +229,7 @@ static int usb_id(struct udev_device *dev) } if_class_num = strtoul(if_class, NULL, 16); if (if_class_num == 8) { - if_subclass = udev_device_get_attr_value(dev_interface, "bInterfaceSubClass"); + if_subclass = udev_device_get_sysattr_value(dev_interface, "bInterfaceSubClass"); if (if_subclass != NULL) protocol = set_usb_mass_storage_ifsubtype(type_str, if_subclass, sizeof(type_str)-1); } else { @@ -266,7 +266,7 @@ static int usb_id(struct udev_device *dev) } /* Generic SPC-2 device */ - scsi_vendor = udev_device_get_attr_value(dev_scsi, "vendor"); + scsi_vendor = udev_device_get_sysattr_value(dev_scsi, "vendor"); if (!scsi_vendor) { info(udev, "%s: cannot get SCSI vendor attribute\n", udev_device_get_sysname(dev_scsi)); @@ -274,7 +274,7 @@ static int usb_id(struct udev_device *dev) } set_str(vendor_str, scsi_vendor, sizeof(vendor_str)-1); - scsi_model = udev_device_get_attr_value(dev_scsi, "model"); + scsi_model = udev_device_get_sysattr_value(dev_scsi, "model"); if (!scsi_model) { info(udev, "%s: cannot get SCSI model attribute\n", udev_device_get_sysname(dev_scsi)); @@ -282,7 +282,7 @@ static int usb_id(struct udev_device *dev) } set_str(model_str, scsi_model, sizeof(model_str)-1); - scsi_type = udev_device_get_attr_value(dev_scsi, "type"); + scsi_type = udev_device_get_sysattr_value(dev_scsi, "type"); if (!scsi_type) { info(udev, "%s: cannot get SCSI type attribute\n", udev_device_get_sysname(dev_scsi)); @@ -290,7 +290,7 @@ static int usb_id(struct udev_device *dev) } set_scsi_type(type_str, scsi_type, sizeof(type_str)-1); - scsi_rev = udev_device_get_attr_value(dev_scsi, "rev"); + scsi_rev = udev_device_get_sysattr_value(dev_scsi, "rev"); if (!scsi_rev) { info(udev, "%s: cannot get SCSI revision attribute\n", udev_device_get_sysname(dev_scsi)); @@ -311,10 +311,10 @@ fallback: const char *usb_vendor = NULL; if (!use_num_info) - usb_vendor = udev_device_get_attr_value(dev_usb, "manufacturer"); + usb_vendor = udev_device_get_sysattr_value(dev_usb, "manufacturer"); if (!usb_vendor) - usb_vendor = udev_device_get_attr_value(dev_usb, "idVendor"); + usb_vendor = udev_device_get_sysattr_value(dev_usb, "idVendor"); if (!usb_vendor) { info(udev, "No USB vendor information available\n"); @@ -327,10 +327,10 @@ fallback: const char *usb_model = NULL; if (!use_num_info) - usb_model = udev_device_get_attr_value(dev_usb, "product"); + usb_model = udev_device_get_sysattr_value(dev_usb, "product"); if (!usb_model) - usb_model = udev_device_get_attr_value(dev_usb, "idProduct"); + usb_model = udev_device_get_sysattr_value(dev_usb, "idProduct"); if (!usb_model) { dbg(udev, "No USB model information available\n"); @@ -342,7 +342,7 @@ fallback: if (revision_str[0] == '\0') { const char *usb_rev; - usb_rev = udev_device_get_attr_value(dev_usb, "bcdDevice"); + usb_rev = udev_device_get_sysattr_value(dev_usb, "bcdDevice"); if (usb_rev) set_str(revision_str, usb_rev, sizeof(revision_str)-1); } @@ -350,7 +350,7 @@ fallback: if (serial_str[0] == '\0') { const char *usb_serial; - usb_serial = udev_device_get_attr_value(dev_usb, "serial"); + usb_serial = udev_device_get_sysattr_value(dev_usb, "serial"); if (usb_serial) set_str(serial_str, usb_serial, sizeof(serial_str)-1); } diff --git a/udev/Makefile.am b/udev/Makefile.am index c374942c6e..faf68d6c4d 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -17,7 +17,7 @@ common_files = \ udev-sysdeps.h \ udev-event.c \ udev-node.c \ - udev-rules.c \ + udev-rules2.c \ udev-util.c \ lib/libudev.h \ lib/libudev-private.h \ diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index 1fe0cc30be..da84a8939e 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -32,7 +32,7 @@ udev_device_get_action udev_device_get_driver udev_device_get_devnum udev_device_get_seqnum -udev_device_get_attr_value +udev_device_get_sysattr_value udev_enumerate_new udev_enumerate_ref udev_enumerate_unref @@ -40,8 +40,8 @@ udev_enumerate_get_udev udev_enumerate_get_list_entry udev_enumerate_add_match_subsystem udev_enumerate_add_nomatch_subsystem -udev_enumerate_add_match_attr -udev_enumerate_add_nomatch_attr +udev_enumerate_add_match_sysattr +udev_enumerate_add_nomatch_sysattr udev_enumerate_scan_devices udev_enumerate_scan_subsystems udev_enumerate_add_syspath diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index c030eb0585..b54c7271e7 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -60,7 +60,7 @@ struct udev_device { int num_fake_partitions; int devlink_priority; int ignore_remove; - struct udev_list_node attr_list; + struct udev_list_node sysattr_list; int info_loaded; }; @@ -244,7 +244,7 @@ struct udev_device *device_new(struct udev *udev) udev_device->udev = udev; udev_list_init(&udev_device->devlinks_list); udev_list_init(&udev_device->properties_list); - udev_list_init(&udev_device->attr_list); + udev_list_init(&udev_device->sysattr_list); udev_device->event_timeout = -1; /* copy global properties */ udev_list_entry_foreach(list_entry, udev_get_properties_list_entry(udev)) @@ -610,7 +610,7 @@ void udev_device_unref(struct udev_device *udev_device) free(udev_device->driver); free(udev_device->devpath_old); free(udev_device->physdevpath); - udev_list_cleanup_entries(udev_device->udev, &udev_device->attr_list); + udev_list_cleanup_entries(udev_device->udev, &udev_device->sysattr_list); for (i = 0; i < ARRAY_SIZE(udev_device->envp) && udev_device->envp[i] != NULL; i++) free(udev_device->envp[i]); info(udev_device->udev, "udev_device: %p released\n", udev_device); @@ -823,7 +823,7 @@ unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device) return udev_device->seqnum; } -const char *udev_device_get_attr_value(struct udev_device *udev_device, const char *attr) +const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr) { struct udev_list_entry *list_entry; char path[UTIL_PATH_SIZE]; @@ -835,25 +835,25 @@ const char *udev_device_get_attr_value(struct udev_device *udev_device, const ch if (udev_device == NULL) return NULL; - if (attr == NULL) + if (sysattr == NULL) return NULL; /* look for possibly already cached result */ - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_device->attr_list)) { - if (strcmp(udev_list_entry_get_name(list_entry), attr) == 0) { + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_device->sysattr_list)) { + if (strcmp(udev_list_entry_get_name(list_entry), sysattr) == 0) { info(udev_device->udev, "got '%s' (%s) from cache\n", - attr, udev_list_entry_get_value(list_entry)); + sysattr, udev_list_entry_get_value(list_entry)); return udev_list_entry_get_value(list_entry); } } util_strlcpy(path, udev_device_get_syspath(udev_device), sizeof(path)); util_strlcat(path, "/", sizeof(path)); - util_strlcat(path, attr, sizeof(path)); + util_strlcat(path, sysattr, sizeof(path)); if (lstat(path, &statbuf) != 0) { info(udev_device->udev, "no attribute '%s', keep negative entry\n", path); - udev_list_entry_add(udev_device->udev, &udev_device->attr_list, attr, NULL, 0, 0); + udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, NULL, 0, 0); goto out; } @@ -869,8 +869,8 @@ const char *udev_device_get_attr_value(struct udev_device *udev_device, const ch pos = strrchr(target, '/'); if (pos != NULL) { pos = &pos[1]; - info(udev_device->udev, "cache '%s' with link value '%s'\n", attr, pos); - list_entry = udev_list_entry_add(udev_device->udev, &udev_device->attr_list, attr, pos, 0, 0); + info(udev_device->udev, "cache '%s' with link value '%s'\n", sysattr, pos); + list_entry = udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, pos, 0, 0); val = udev_list_entry_get_value(list_entry); } } @@ -902,7 +902,7 @@ const char *udev_device_get_attr_value(struct udev_device *udev_device, const ch value[size] = '\0'; util_remove_trailing_chars(value, '\n'); info(udev_device->udev, "'%s' has attribute value '%s'\n", path, value); - list_entry = udev_list_entry_add(udev_device->udev, &udev_device->attr_list, attr, value, 0, 0); + list_entry = udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, value, 0, 0); val = udev_list_entry_get_value(list_entry); out: return val; diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index 7a8c51c078..b35a82d0ce 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -35,8 +35,8 @@ static int devices_sort(struct udev_enumerate *udev_enumerate); struct udev_enumerate { struct udev *udev; int refcount; - struct udev_list_node attr_match_list; - struct udev_list_node attr_nomatch_list; + struct udev_list_node sysattr_match_list; + struct udev_list_node sysattr_nomatch_list; struct udev_list_node subsystem_match_list; struct udev_list_node subsystem_nomatch_list; struct udev_list_node devices_list; @@ -60,8 +60,8 @@ struct udev_enumerate *udev_enumerate_new(struct udev *udev) udev_enumerate->refcount = 1; udev_enumerate->udev = udev; udev_list_init(&udev_enumerate->devices_list); - udev_list_init(&udev_enumerate->attr_match_list); - udev_list_init(&udev_enumerate->attr_nomatch_list); + udev_list_init(&udev_enumerate->sysattr_match_list); + udev_list_init(&udev_enumerate->sysattr_nomatch_list); udev_list_init(&udev_enumerate->subsystem_match_list); udev_list_init(&udev_enumerate->subsystem_nomatch_list); return udev_enumerate; @@ -83,8 +83,8 @@ void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) if (udev_enumerate->refcount > 0) return; udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->devices_list); - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->attr_match_list); - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->attr_nomatch_list); + udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->sysattr_match_list); + udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->sysattr_nomatch_list); udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->subsystem_match_list); udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->subsystem_nomatch_list); free(udev_enumerate); @@ -130,31 +130,31 @@ int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, return 0; } -int udev_enumerate_add_match_attr(struct udev_enumerate *udev_enumerate, const char *attr, const char *value) +int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) { if (udev_enumerate == NULL) return -EINVAL; - if (attr == NULL) + if (sysattr == NULL) return 0; if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->attr_match_list, attr, value, 1, 0) == NULL) + &udev_enumerate->sysattr_match_list, sysattr, value, 1, 0) == NULL) return -ENOMEM; return 0; } -int udev_enumerate_add_nomatch_attr(struct udev_enumerate *udev_enumerate, const char *attr, const char *value) +int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) { if (udev_enumerate == NULL) return -EINVAL; - if (attr == NULL) + if (sysattr == NULL) return 0; if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->attr_nomatch_list, attr, value, 1, 0) == NULL) + &udev_enumerate->sysattr_nomatch_list, sysattr, value, 1, 0) == NULL) return -ENOMEM; return 0; } -static int match_attr_value(struct udev *udev, const char *syspath, const char *attr, const char *match_val) +static int match_sysattr_value(struct udev *udev, const char *syspath, const char *sysattr, const char *match_val) { struct udev_device *device; const char *val = NULL; @@ -163,7 +163,7 @@ static int match_attr_value(struct udev *udev, const char *syspath, const char * device = udev_device_new_from_syspath(udev, syspath); if (device == NULL) return -EINVAL; - val = udev_device_get_attr_value(device, attr); + val = udev_device_get_sysattr_value(device, sysattr); if (val == NULL) goto exit; if (match_val == NULL) { @@ -179,23 +179,23 @@ exit: return match; } -static int match_attr(struct udev_enumerate *udev_enumerate, const char *syspath) +static int match_sysattr(struct udev_enumerate *udev_enumerate, const char *syspath) { struct udev *udev = udev_enumerate_get_udev(udev_enumerate); struct udev_list_entry *list_entry; /* skip list */ - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->attr_nomatch_list)) { - if (match_attr_value(udev, syspath, + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->sysattr_nomatch_list)) { + if (match_sysattr_value(udev, syspath, udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry))) return 0; } /* include list */ - if (udev_list_get_entry(&udev_enumerate->attr_match_list) != NULL) { - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->attr_match_list)) { + if (udev_list_get_entry(&udev_enumerate->sysattr_match_list) != NULL) { + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->sysattr_match_list)) { /* anything that does not match, will make it FALSE */ - if (!match_attr_value(udev, syspath, + if (!match_sysattr_value(udev, syspath, udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry))) return 0; @@ -247,7 +247,7 @@ static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, util_strlcat(filename, "/uevent", sizeof(filename)); if (stat(filename, &statbuf) != 0) continue; - if (!match_attr(udev_enumerate, syspath)) + if (!match_sysattr(udev_enumerate, syspath)) continue; udev_list_entry_add(udev, &udev_enumerate->devices_list, syspath, NULL, 1, 1); } diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 8949724844..041ffd4dd9 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -77,7 +77,7 @@ extern const char *udev_device_get_driver(struct udev_device *udev_device); extern dev_t udev_device_get_devnum(struct udev_device *udev_device); extern const char *udev_device_get_action(struct udev_device *udev_device); extern unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device); -extern const char *udev_device_get_attr_value(struct udev_device *udev_device, const char *attr); +extern const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr); /* udev and kernel device events */ struct udev_monitor; @@ -98,8 +98,8 @@ extern void udev_enumerate_unref(struct udev_enumerate *udev_enumerate); extern struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate); extern int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem); extern int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem); -extern int udev_enumerate_add_match_attr(struct udev_enumerate *udev_enumerate, const char *attr, const char *value); -extern int udev_enumerate_add_nomatch_attr(struct udev_enumerate *udev_enumerate, const char *attr, const char *value); +extern int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value); +extern int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value); extern int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath); extern int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate); extern int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate); diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index ded65cca91..4c3bc16aed 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -97,7 +97,7 @@ static void print_device(struct udev_device *device) if (count > 0) printf("found %i properties\n", count); - str = udev_device_get_attr_value(device, "dev"); + str = udev_device_get_sysattr_value(device, "dev"); if (str != NULL) printf("attr{dev}: '%s'\n", str); diff --git a/udev/udev-event.c b/udev/udev-event.c index 54006b5927..007a14ebe9 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -141,7 +141,7 @@ int udev_event_apply_subsys_kernel(struct udev_event *udev_event, const char *st if (read_value) { const char *val; - val = udev_device_get_attr_value(dev, attr); + val = udev_device_get_sysattr_value(dev, attr); if (val != NULL) util_strlcpy(result, val, maxsize); else @@ -359,7 +359,7 @@ found: if (value[0] == '\0' && event->dev_parent != NULL && event->dev_parent != event->dev) { const char *val; - val = udev_device_get_attr_value(event->dev_parent, attr); + val = udev_device_get_sysattr_value(event->dev_parent, attr); if (val != NULL) util_strlcpy(value, val, sizeof(value)); } @@ -371,7 +371,7 @@ found: do { dbg(event->udev, "looking at '%s'\n", udev_device_get_syspath(dev_parent)); - val = udev_device_get_attr_value(dev_parent, attr); + val = udev_device_get_sysattr_value(dev_parent, attr); if (val != NULL) { util_strlcpy(value, val, sizeof(value)); break; diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 78c218eef0..d30fc0031c 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -60,7 +60,7 @@ static void print_all_attributes(struct udev_device *device, const char *key) if (S_ISLNK(statbuf.st_mode)) continue; - value = udev_device_get_attr_value(device, dent->d_name); + value = udev_device_get_sysattr_value(device, dent->d_name); if (value == NULL) continue; dbg(udev, "attr '%s'='%s'(%zi)\n", dent->d_name, value, len); diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index eb46a2983c..e475e40949 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -156,7 +156,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) val[0] = 0; val = &val[1]; } - udev_enumerate_add_match_attr(udev_enumerate, attr, val); + udev_enumerate_add_match_sysattr(udev_enumerate, attr, val); break; case 'A': util_strlcpy(attr, optarg, sizeof(attr)); @@ -165,7 +165,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) val[0] = 0; val = &val[1]; } - udev_enumerate_add_nomatch_attr(udev_enumerate, attr, val); + udev_enumerate_add_nomatch_sysattr(udev_enumerate, attr, val); break; case 'h': printf("Usage: udevadm trigger OPTIONS\n" |