diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2011-03-04 23:00:52 +0100 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2011-03-04 23:00:52 +0100 |
commit | 20bee04c19e49a0cef3bd7dfec9028270c46172b (patch) | |
tree | 398a225511469070114d7d993ee1499f747343af /udev | |
parent | d53a3878d2e21cbaa0dec1c6b397ebac7057b090 (diff) |
libudev: udev_device_get_sysattr_list_entry() update
Diffstat (limited to 'udev')
-rw-r--r-- | udev/udevadm-info.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index f60ad2c450..a231fd8d0b 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -31,37 +31,50 @@ #include "udev.h" +static bool skip_attribute(const char *name) +{ + char *skip[] = { + "uevent", + "dev", + "modalias", + "resource", + "driver", + "subsystem", + "module", + }; + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(skip); i++) + if (strcmp(name, skip[i]) == 0) + return true; + return false; +} + static void print_all_attributes(struct udev_device *device, const char *key) { struct udev_list_entry *sysattr; udev_list_entry_foreach(sysattr, udev_device_get_sysattr_list_entry(device)) { + struct udev *udev = udev_device_get_udev(device); const char *name; const char *value; size_t len; - /* skip symlinks */ - if (0 == strcmp("s", udev_list_entry_get_value(sysattr))) - continue; - name = udev_list_entry_get_name(sysattr); - if (strcmp(name, "uevent") == 0) - continue; - if (strcmp(name, "dev") == 0) + if (skip_attribute(name)) continue; value = udev_device_get_sysattr_value(device, name); if (value == NULL) continue; - dbg(udev_device_get_udev(device), "attr '%s'='%s'\n", name, value); + dbg(udev, "attr '%s'='%s'\n", name, value); /* skip nonprintable attributes */ len = strlen(value); while (len > 0 && isprint(value[len-1])) len--; if (len > 0) { - dbg(udev_device_get_udev(device), - "attribute value of '%s' non-printable, skip\n", name); + dbg(udev, "attribute value of '%s' non-printable, skip\n", name); continue; } |