|
From: Gleb C. <lna...@ya...> - 2025-09-08 13:43:52
|
Commit: f8bfa63 GitHub URL: https://github.com/SCST-project/scst/commit/f8bfa638b692f322196822e1b08e02feb217664e Author: Tony Battersby Date: 2025-09-08T16:40:12+03:00 Log Message: ----------- scst: Export scst_tgt->sg_tablesize via sysfs This value is available in initiator mode via /sys/class/scsi_host/hostN/sg_tablesize; make it available in target mode as well. Userspace code may use it when making decisions about buffer sizes. Signed-off-by: Tony Battersby <to...@cy...> Modified Paths: -------------- scst/src/scst_sysfs.c | 21 +++++++++++++++ 1 file changed, 21 insertions(+) =================================================================== diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index 340e735..131f1b1 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -2718,6 +2718,26 @@ out: static struct kobj_attribute scst_tgt_comment = __ATTR(comment, 0644, scst_tgt_comment_show, scst_tgt_comment_store); + +static ssize_t scst_tgt_sg_tablesize_show(struct kobject *kobj, struct kobj_attribute *attr, + char *buf) +{ + struct scst_tgt *tgt; + int ret; + + TRACE_ENTRY(); + + tgt = container_of(kobj, struct scst_tgt, tgt_kobj); + + ret = sysfs_emit(buf, "%d\n", tgt->sg_tablesize); + + TRACE_EXIT_RES(ret); + return ret; +} + +static struct kobj_attribute scst_tgt_sg_tablesize = + __ATTR(sg_tablesize, 0444, scst_tgt_sg_tablesize_show, NULL); + /* * Creates an attribute entry for one target. Allows for target driver to * create an attribute that is not for every target. @@ -2910,6 +2930,7 @@ static struct attribute *scst_tgt_attrs[] = { &scst_tgt_aen_disabled.attr, &scst_tgt_forwarding.attr, &scst_tgt_comment.attr, + &scst_tgt_sg_tablesize.attr, &scst_tgt_addr_method.attr, &scst_tgt_io_grouping_type.attr, &scst_tgt_black_hole.attr, |