- struct udev *udev = udev_device_get_udev(device);
- DIR *dir;
- struct dirent *dent;
-
- dir = opendir(udev_device_get_syspath(device));
- if (dir != NULL) {
- for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
- struct stat statbuf;
- char filename[UTIL_PATH_SIZE];
- const char *value;
- size_t len;
-
- if (dent->d_name[0] == '.')
- continue;
-
- if (strcmp(dent->d_name, "uevent") == 0)
- continue;
- if (strcmp(dent->d_name, "dev") == 0)
- continue;
-
- util_strlcpy(filename, udev_device_get_syspath(device), sizeof(filename));
- util_strlcat(filename, "/", sizeof(filename));
- util_strlcat(filename, dent->d_name, sizeof(filename));
- if (lstat(filename, &statbuf) != 0)
- continue;
- if (S_ISLNK(statbuf.st_mode))
- continue;
-
- value = udev_device_get_attr_value(device, dent->d_name);
- if (value == NULL)
- continue;
- dbg(udev, "attr '%s'='%s'(%zi)\n", dent->d_name, value, len);
-
- /* skip nonprintable attributes */
- len = strlen(value);
- while (len > 0 && isprint(value[len-1]))
- len--;
- if (len > 0) {
- dbg(udev, "attribute value of '%s' non-printable, skip\n", dent->d_name);
- continue;
- }
+ static const char const *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;
+}