Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iscsi-scst: Add transport name to sys entry for connection #276

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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