Skip to content

Commit 99ef400

Browse files
committed
iscsi-scst: Add transport name to sys entry for connection
This will make it possible to distinguish iSCSI-TCP connections from iSER connections.
1 parent 3e3c2e6 commit 99ef400

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

iscsi-scst/kernel/conn.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,25 @@ static ssize_t iscsi_conn_target_ip_show(struct kobject *kobj, struct kobj_attri
166166
static struct kobj_attribute iscsi_conn_target_ip_attr =
167167
__ATTR(target_ip, 0444, iscsi_conn_target_ip_show, NULL);
168168

169+
static ssize_t iscsi_conn_transport_show(struct kobject *kobj, struct kobj_attribute *attr,
170+
char *buf)
171+
{
172+
int pos;
173+
struct iscsi_conn *conn;
174+
175+
TRACE_ENTRY();
176+
177+
conn = container_of(kobj, struct iscsi_conn, conn_kobj);
178+
179+
pos = snprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", conn->transport->name);
180+
181+
TRACE_EXIT_RES(pos);
182+
return pos;
183+
}
184+
185+
static struct kobj_attribute iscsi_conn_transport_attr =
186+
__ATTR(transport, 0444, iscsi_conn_transport_show, NULL);
187+
169188
static ssize_t iscsi_conn_cid_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
170189
{
171190
int pos;
@@ -287,6 +306,13 @@ int conn_sysfs_add(struct iscsi_conn *conn)
287306
goto out_err;
288307
}
289308

309+
res = sysfs_create_file(&conn->conn_kobj, &iscsi_conn_transport_attr.attr);
310+
if (res != 0) {
311+
PRINT_ERROR("Unable create sysfs attribute %s for conn %s",
312+
iscsi_conn_transport_attr.attr.name, addr);
313+
goto out_err;
314+
}
315+
290316
out:
291317
TRACE_EXIT_RES(res);
292318
return res;

0 commit comments

Comments
 (0)