+ /* process options */
+ if (query != NONE) {
+ if (path[0] == '\0') {
+ printf("query needs device path specified\n");
+ return -EINVAL;
+ }
+
+ retval = udevdb_open_ro();
+ if (retval != 0) {
+ printf("unable to open udev database\n");
+ return -EACCES;
+ }
+ retval = udevdb_get_dev(path, &dev);
+ if (retval == 0) {
+ switch(query) {
+ case NAME:
+ if (root)
+ strfieldcpy(result, udev_root);
+ strncat(result, dev.name, sizeof(result));
+ break;
+
+ case SYMLINK:
+ strfieldcpy(result, dev.symlink);
+ break;
+
+ case GROUP:
+ strfieldcpy(result, dev.group);
+ break;
+
+ case OWNER:
+ strfieldcpy(result, dev.owner);
+ break;
+
+ default:
+ break;
+ }
+ printf("%s\n", result);
+ } else {
+ printf("device not found in udev database\n");
+ }
+ udevdb_exit();
+ return retval;
+ }
+
+ if (root) {
+ printf("%s\n", udev_root);
+ return 0;
+ }
+
+help:
+ printf("Usage: [-pqrdVh]\n"
+ " -q TYPE query database for the specified value:\n"
+ " 'name' name of device node\n"
+ " 'symlink' pointing to node\n"
+ " 'owner' of node\n"
+ " 'group' of node\n"
+ " -p PATH sysfs device path used for query\n"
+ " -r print udev root\n"
+ " -d dump whole database\n"
+ " -V print udev version\n"
+ " -h print this help text\n"
+ "\n");
+ return retval;
+}
+
+static char *subsystem_blacklist[] = {
+ "net",
+ "scsi_host",
+ "scsi_device",
+ "usb_host",
+ "pci_bus",
+ "",
+};
+
+static inline int udev_hotplug(int argc, char **argv)
+{
+ char *action;
+ char *devpath;
+ char *subsystem;
+ int retval = -EINVAL;
+ int i;
+