- /*
- * The close of scsi_dev will close class_dev or class_dev_parent.
- */
-
- /*
- * We assume we are called after the device is completely ready,
- * so we don't have to loop here like udev. (And we are usually
- * called via udev.)
- */
- if (!scsi_dev) {
- /*
- * errno is not set if we can't find the device link, so
- * don't print it out here.
- */
- log_message(LOG_WARNING, "Cannot find sysfs device associated with %s\n",
- target_path);
- return 1;
- }
-
-
- /*
- * Allow only scsi devices.
- *
- * Other block devices can support SG IO, but only ide-cd does, so
- * for now, don't bother with anything else.
- */
- if (strcmp(scsi_dev->bus, "scsi") != 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;
- }
-
- /*
- * mknod a temp dev to communicate with the device.
- *
- * XXX pass down class_dev or class_dev_parent.
- */
- if (!dev_specified && create_tmp_dev(target_path, maj_min_dev,
- dev_type)) {
- dprintf("create_tmp_dev failed\n");
- return 1;
- }
-
- /*
- * Get any per device (vendor + model) options from the config
- * file.
- */
- retval = per_dev_options(scsi_dev, &good_dev, &page_code, callout);
- dprintf("per dev options: good %d; page code 0x%x; callout '%s'\n",
- good_dev, page_code, callout);
-
-#define ALIGN 512
- unaligned_buf = malloc(MAX_SERIAL_LEN + ALIGN);
- serial = (char*) (((int) unaligned_buf + (ALIGN - 1)) & ~(ALIGN - 1));
- dprintf("buffer unaligned 0x%p; aligned 0x%p\n", unaligned_buf, serial);
-#undef ALIGN