diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index f402c7d28..87195f746 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -6993,6 +6993,33 @@ static int vdev_parse_add_dev_params(struct scst_vdisk_dev *virt_dev, continue; } + if (!strcasecmp("t10_dev_id", p)) { + /* Handle in a fashion similar to vdev_sysfs_t10_dev_id_store */ + int i, length = strlen(pp); + + if (length >= sizeof(virt_dev->t10_dev_id)) { + PRINT_ERROR("T10 device id is too long (max %zd " + "characters)", sizeof(virt_dev->t10_dev_id)-1); + res = -EINVAL; + goto out; + } + + memset(virt_dev->t10_dev_id, 0, sizeof(virt_dev->t10_dev_id)); + memcpy(virt_dev->t10_dev_id, pp, length); + + i = 0; + while (i < sizeof(virt_dev->t10_dev_id)) { + if (virt_dev->t10_dev_id[i] == '\n') { + virt_dev->t10_dev_id[i] = '\0'; + break; + } + i++; + } + + virt_dev->t10_dev_id_set = 1; + continue; + } + res = kstrtoll(pp, 0, &ll_val); if (res != 0) { PRINT_ERROR("strtoll() for %s failed: %d (device %s)", @@ -9604,6 +9631,7 @@ static const char *const fileio_add_dev_params[] = { "rotational", "thin_provisioned", "tst", + "t10_dev_id", "write_through", NULL }; @@ -9695,6 +9723,7 @@ static const char *const blockio_add_dev_params[] = { "rotational", "thin_provisioned", "tst", + "t10_dev_id", "write_through", NULL }; @@ -9768,6 +9797,7 @@ static const char *const nullio_add_dev_params[] = { "size", "size_mb", "tst", + "t10_dev_id", NULL }; diff --git a/scstadmin/scstadmin.sysfs/scst-1.0.0/lib/SCST/SCST.pm b/scstadmin/scstadmin.sysfs/scst-1.0.0/lib/SCST/SCST.pm index df34d0052..c8d3b2053 100644 --- a/scstadmin/scstadmin.sysfs/scst-1.0.0/lib/SCST/SCST.pm +++ b/scstadmin/scstadmin.sysfs/scst-1.0.0/lib/SCST/SCST.pm @@ -3911,10 +3911,17 @@ sub openDevice { if (!valid($handler, $device, $attributes)); my $o_string = ""; + ## Special case cluster_mode as we want to set it after t10_dev_id + my $cm_string = ""; foreach my $attribute (keys %{$attributes}) { my $value = $$attributes{$attribute}; - $o_string .= "$attribute=$value;"; + if ($attribute eq "cluster_mode") { + $cm_string = "$attribute=$value;"; + } else { + $o_string .= "$attribute=$value;"; + } } + $o_string .= $cm_string; $o_string =~ s/\s$//;