- char callout[MAX_NAME_LEN];
-
- dprintf("target_path %s\n", target_path);
-
- /*
- * Ugly: depend on the sysfs path to tell us whether this is a
- * block or char device. This should probably be encoded in the
- * "dev" along with the major/minor.
- */
- if (has_sysfs_prefix(target_path, "/block")) {
- dev_type = S_IFBLK;
- } else if (has_sysfs_prefix(target_path, "/class")) {
- dev_type = S_IFCHR;
- } else {
- if (!hotplug_mode) {
- log_message(LOG_WARNING,
- "Non block or class device '%s'\n",
- target_path);
- return 1;
- } else {
- /*
- * Expected in some cases.
- */
- dprintf("Non block or class device\n");
- return 0;
- }
- }
-
- if (sysfs_get_actual_dev(target_path, full_dev_path, MAX_NAME_LEN))
- return 1;
-
- dprintf("full_dev_path %s\n", full_dev_path);
-
- /*
- * Allow only scsi devices (those that have a matching device
- * under /bus/scsi/devices).
- *
- * Other block devices can support SG IO, but only ide-cd does, so
- * for now, don't bother with anything else.
- */
- retval = sysfs_is_bus(full_dev_path, "scsi");
- if (retval == 0) {
- if (hotplug_mode)
- /*
- * Expected in some cases.
- */
- dprintf("%s is not a scsi device\n", target_path);
- else
- log_message(LOG_WARNING, "%s is not a scsi device\n",
- target_path);
- return 1;
- } else if (retval < 0) {
- log_message(LOG_WARNING, "sysfs_is_bus failed: %s\n",
- strerror(errno));
- return 1;
- }
-
- /*
- * mknod a temp dev to communicate with the device.
- */
- if (!dev_specified && create_tmp_dev(target_path, maj_min_dev,
- dev_type)) {
- dprintf("create_tmp_dev failed\n");
- return 1;
- }