diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2008-10-20 18:12:36 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2008-10-20 18:12:36 +0200 |
commit | 69239210bee89c1745f2dd5f1e7cff4efd07e429 (patch) | |
tree | 05ce2a3b745263469985116d712a9bc0da052463 /udev | |
parent | 2d9a1b1ef284663b14e2fda714eddcd9c12bc42a (diff) |
libudev: device - get_attr_value() -> get_sysattr_value()
Diffstat (limited to 'udev')
-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 |
9 files changed, 48 insertions, 48 deletions
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" |