- goto print;
- }
-
- printf("query needs device path(-p) or node name(-n) specified\n");
- goto exit;
-
-print:
- 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;
-
- case PATH:
- strfieldcpy(result, path);
- break;
-
- default:
- goto exit;
- }
- printf("%s\n", result);
-
-exit:
- udevdb_exit();
- return retval;
- }
-
- if (root) {
- printf("%s\n", udev_root);
- return 0;
- }
-
-help:
- printf("Usage: [-npqrdVh]\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"
- " 'path' sysfs device path\n"
- " -p PATH sysfs device path used for query\n"
- " -n NAME node name used for query\n"
- "\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;
-
- subsystem = argv[1];
-
- devpath = get_devpath();
- if (!devpath) {
- dbg ("no devpath?");
- goto exit;
- }
- dbg("looking at '%s'", devpath);
-
- /* we only care about class devices and block stuff */
- if (!strstr(devpath, "class") &&
- !strstr(devpath, "block")) {
- dbg("not a block or class device");
- goto exit;
- }
-
- /* skip blacklisted subsystems */
- i = 0;
- while (subsystem_blacklist[i][0] != '\0') {
- if (strcmp(subsystem, subsystem_blacklist[i]) == 0) {
- dbg("don't care about '%s' devices", subsystem);
- goto exit;