Skip to content

Commit

Permalink
iscsi-scst: Add transport name to sys entry for connection
Browse files Browse the repository at this point in the history
This will make it possible to distinguish iSCSI-TCP connections
from iSER connections.
  • Loading branch information
bmeagherix authored and lnocturno committed Jan 29, 2025
1 parent 3e3c2e6 commit 6c5e8ad
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions iscsi-scst/kernel/conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 6c5e8ad

Please sign in to comment.