From 99ef400eac1d4d2d976d7f798e829cedc81fa00e Mon Sep 17 00:00:00 2001 From: Brian M Date: Tue, 28 Jan 2025 10:33:26 -0800 Subject: [PATCH] iscsi-scst: Add transport name to sys entry for connection This will make it possible to distinguish iSCSI-TCP connections from iSER connections. --- iscsi-scst/kernel/conn.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/iscsi-scst/kernel/conn.c b/iscsi-scst/kernel/conn.c index 60398da3b..212e9739a 100644 --- a/iscsi-scst/kernel/conn.c +++ b/iscsi-scst/kernel/conn.c @@ -166,6 +166,25 @@ static ssize_t iscsi_conn_target_ip_show(struct kobject *kobj, struct kobj_attri static struct kobj_attribute iscsi_conn_target_ip_attr = __ATTR(target_ip, 0444, iscsi_conn_target_ip_show, NULL); +static ssize_t iscsi_conn_transport_show(struct kobject *kobj, struct kobj_attribute *attr, + char *buf) +{ + int pos; + struct iscsi_conn *conn; + + TRACE_ENTRY(); + + conn = container_of(kobj, struct iscsi_conn, conn_kobj); + + pos = snprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", conn->transport->name); + + TRACE_EXIT_RES(pos); + return pos; +} + +static struct kobj_attribute iscsi_conn_transport_attr = + __ATTR(transport, 0444, iscsi_conn_transport_show, NULL); + static ssize_t iscsi_conn_cid_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { int pos; @@ -287,6 +306,13 @@ int conn_sysfs_add(struct iscsi_conn *conn) goto out_err; } + res = sysfs_create_file(&conn->conn_kobj, &iscsi_conn_transport_attr.attr); + if (res != 0) { + PRINT_ERROR("Unable create sysfs attribute %s for conn %s", + iscsi_conn_transport_attr.attr.name, addr); + goto out_err; + } + out: TRACE_EXIT_RES(res); return res;