diff --git a/scst/include/scst.h b/scst/include/scst.h index 7a4ca764e..16b92cd60 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -1354,6 +1354,11 @@ struct scst_dev_type { */ unsigned auto_cm_assignment_possible:1; + /* + * Set if this handler does not have run time devices management + */ + unsigned no_mgmt:1; + /* * Called to parse CDB from the cmd and initialize * cmd->bufflen and cmd->data_direction (both - REQUIRED). diff --git a/scst/include/scst_debug.h b/scst/include/scst_debug.h index de8f50d7e..9c075c3f0 100644 --- a/scst/include/scst_debug.h +++ b/scst/include/scst_debug.h @@ -399,4 +399,13 @@ do { \ #define SCST_SLAB_FLAGS 0L #endif +#define PRINT_WARNING_ONCE(format, args...) \ +do { \ + static bool __warned; \ + if (!__warned) { \ + __warned = true; \ + PRINT_WARNING(format, ## args); \ + } \ +} while(0) + #endif /* __SCST_DEBUG_H */ diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index c2dd44aec..7e9962bcf 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -234,6 +234,7 @@ static const struct file_operations dev_user_fops = { }; static struct scst_dev_type dev_user_devtype = { + .no_mgmt = 1, .name = DEV_USER_NAME, .type = -1, .parse = dev_usr_parse, diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 16ddb3e03..fcd8cecf4 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -865,7 +865,7 @@ static struct scst_dev_type vdisk_null_devtype = { "blocksize, " "dif_mode, " "dif_type, " - "dif_static_app_tag, ", + "dif_static_app_tag, " "dummy, " "numa_node_id, " "cluster_mode, " @@ -3847,7 +3847,7 @@ static int vdisk_unmap_file_range(struct scst_cmd *cmd, res = fd->f_op->fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, off, len); if (unlikely(res != 0)) { - PRINT_ERROR("fallocate() for %lld, len %lld " + PRINT_WARNING_ONCE("fallocate() for %lld, len %lld " "failed: %d", (unsigned long long)off, (unsigned long long)len, res); scst_set_cmd_error(cmd, diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index 9447b05f7..e1d4ce77f 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -903,7 +903,7 @@ static ssize_t scst_tgtt_mgmt_show(struct kobject *kobj, "\n" "where parameters are one or more " "param_name=value pairs separated by ';'\n\n" - "%s%s%s%s%s%s%s%s\n"; + "%s%s%s%s%s%s%s%s%s%s\n"; struct scst_tgt_template *tgtt; tgtt = container_of(kobj, struct scst_tgt_template, tgtt_kobj); @@ -916,10 +916,12 @@ static ssize_t scst_tgtt_mgmt_show(struct kobject *kobj, " echo \"add_target_attribute target_name \" >mgmt\n" " echo \"del_target_attribute target_name \" >mgmt\n" : "", (tgtt->mgmt_cmd_help) ? tgtt->mgmt_cmd_help : "", + (tgtt->mgmt_cmd_help) ? "\n" : "", (tgtt->add_target_parameters != NULL) ? "The following parameters available: " : "", (tgtt->add_target_parameters != NULL) ? tgtt->add_target_parameters : "", + (tgtt->add_target_parameters != NULL) ? "\n" : "", (tgtt->tgtt_optional_attributes != NULL) ? "The following target driver attributes available: " : "", (tgtt->tgtt_optional_attributes != NULL) ? @@ -5917,7 +5919,7 @@ static ssize_t scst_devt_mgmt_show(struct kobject *kobj, "\n" "where parameters are one or more " "param_name=value pairs separated by ';'\n\n" - "%s%s%s%s%s%s%s%s\n"; + "%s%s%s%s%s%s%s%s%s%s\n"; struct scst_dev_type *devt; devt = container_of(kobj, struct scst_dev_type, devt_kobj); @@ -5927,13 +5929,15 @@ static ssize_t scst_devt_mgmt_show(struct kobject *kobj, " echo \"add_attribute \" >mgmt\n" " echo \"del_attribute \" >mgmt\n" : "", (devt->dev_optional_attributes != NULL) ? - " echo \"add_device_attribute device_name \" >mgmt" + " echo \"add_device_attribute device_name \" >mgmt\n" " echo \"del_device_attribute device_name \" >mgmt\n" : "", (devt->mgmt_cmd_help) ? devt->mgmt_cmd_help : "", + (devt->mgmt_cmd_help) ? "\n" : "", (devt->add_device_parameters != NULL) ? "The following parameters available: " : "", (devt->add_device_parameters != NULL) ? devt->add_device_parameters : "", + (devt->add_device_parameters != NULL) ? "\n" : "", (devt->devt_optional_attributes != NULL) ? "The following dev handler attributes available: " : "", (devt->devt_optional_attributes != NULL) ? @@ -6232,7 +6236,7 @@ int scst_devt_sysfs_create(struct scst_dev_type *devt) if (devt->add_device != NULL) { res = sysfs_create_file(&devt->devt_kobj, &scst_devt_mgmt.attr); - } else { + } else if (!devt->no_mgmt) { res = sysfs_create_file(&devt->devt_kobj, &scst_devt_pass_through_mgmt.attr); }