mirror of
https://github.com/SCST-project/scst.git
synced 2026-09-13 03:24:14 +00:00
scst: Use sysfs_emit/sysfs_emit_at instead of scnprintf()
Replace scnprintf() with sysfs_emit() and sysfs_emit_at() in sysfs show handlers. These helper functions are specifically designed for sysfs output, providing safer handling of buffer lengths and consistency across kernel sysfs interfaces. This patch does not change any functionality.
This commit is contained in:
+10
-10
@@ -29,22 +29,22 @@ static ssize_t iscsi_version_show(struct kobject *kobj, struct kobj_attribute *a
|
|||||||
|
|
||||||
TRACE_ENTRY();
|
TRACE_ENTRY();
|
||||||
|
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "%s\n", ISCSI_VERSION_STRING);
|
ret += sysfs_emit_at(buf, ret, "%s\n", ISCSI_VERSION_STRING);
|
||||||
|
|
||||||
#ifdef CONFIG_SCST_EXTRACHECKS
|
#ifdef CONFIG_SCST_EXTRACHECKS
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "EXTRACHECKS\n");
|
ret += sysfs_emit_at(buf, ret, "EXTRACHECKS\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SCST_TRACING
|
#ifdef CONFIG_SCST_TRACING
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "TRACING\n");
|
ret += sysfs_emit_at(buf, ret, "TRACING\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SCST_DEBUG
|
#ifdef CONFIG_SCST_DEBUG
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "DEBUG\n");
|
ret += sysfs_emit_at(buf, ret, "DEBUG\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SCST_ISCSI_DEBUG_DIGEST_FAILURES
|
#ifdef CONFIG_SCST_ISCSI_DEBUG_DIGEST_FAILURES
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "DEBUG_DIGEST_FAILURES\n");
|
ret += sysfs_emit_at(buf, ret, "DEBUG_DIGEST_FAILURES\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TRACE_EXIT();
|
TRACE_EXIT();
|
||||||
@@ -60,16 +60,16 @@ static ssize_t iscsi_open_state_show(struct kobject *kobj, struct kobj_attribute
|
|||||||
|
|
||||||
switch (ctr_open_state) {
|
switch (ctr_open_state) {
|
||||||
case ISCSI_CTR_OPEN_STATE_CLOSED:
|
case ISCSI_CTR_OPEN_STATE_CLOSED:
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "closed\n");
|
ret = sysfs_emit(buf, "closed\n");
|
||||||
break;
|
break;
|
||||||
case ISCSI_CTR_OPEN_STATE_OPEN:
|
case ISCSI_CTR_OPEN_STATE_OPEN:
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "open\n");
|
ret = sysfs_emit(buf, "open\n");
|
||||||
break;
|
break;
|
||||||
case ISCSI_CTR_OPEN_STATE_CLOSING:
|
case ISCSI_CTR_OPEN_STATE_CLOSING:
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "closing\n");
|
ret = sysfs_emit(buf, "closing\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "unknown\n");
|
ret = sysfs_emit(buf, "unknown\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -442,7 +442,7 @@ static ssize_t iscsi_attr_show(struct kobject *kobj, struct kobj_attribute *attr
|
|||||||
if (pos != 0)
|
if (pos != 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
pos = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", (char *)value);
|
pos = sysfs_emit(buf, "%s\n", (char *)value);
|
||||||
|
|
||||||
kfree(value);
|
kfree(value);
|
||||||
|
|
||||||
|
|||||||
+33
-33
@@ -35,43 +35,43 @@ static struct lockdep_map scst_conn_dep_map =
|
|||||||
STATIC_LOCKDEP_MAP_INIT("iscsi_conn_kref", &scst_conn_key);
|
STATIC_LOCKDEP_MAP_INIT("iscsi_conn_kref", &scst_conn_key);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int print_conn_state(char *p, size_t size, struct iscsi_conn *conn)
|
static ssize_t print_conn_state(char *buf, size_t size, struct iscsi_conn *conn)
|
||||||
{
|
{
|
||||||
int pos = 0;
|
ssize_t ret = 0;
|
||||||
|
|
||||||
if (conn->closing) {
|
if (conn->closing) {
|
||||||
pos += scnprintf(p, size, "closing");
|
ret += scnprintf(buf, size, "closing");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (conn->rd_state) {
|
switch (conn->rd_state) {
|
||||||
case ISCSI_CONN_RD_STATE_PROCESSING:
|
case ISCSI_CONN_RD_STATE_PROCESSING:
|
||||||
pos += scnprintf(&p[pos], size - pos, "read_processing ");
|
ret += scnprintf(buf + ret, size - ret, "read_processing ");
|
||||||
break;
|
break;
|
||||||
case ISCSI_CONN_RD_STATE_IN_LIST:
|
case ISCSI_CONN_RD_STATE_IN_LIST:
|
||||||
pos += scnprintf(&p[pos], size - pos, "in_read_list ");
|
ret += scnprintf(buf + ret, size - ret, "in_read_list ");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (conn->wr_state) {
|
switch (conn->wr_state) {
|
||||||
case ISCSI_CONN_WR_STATE_PROCESSING:
|
case ISCSI_CONN_WR_STATE_PROCESSING:
|
||||||
pos += scnprintf(&p[pos], size - pos, "write_processing ");
|
ret += scnprintf(buf + ret, size - ret, "write_processing ");
|
||||||
break;
|
break;
|
||||||
case ISCSI_CONN_WR_STATE_IN_LIST:
|
case ISCSI_CONN_WR_STATE_IN_LIST:
|
||||||
pos += scnprintf(&p[pos], size - pos, "in_write_list ");
|
ret += scnprintf(buf + ret, size - ret, "in_write_list ");
|
||||||
break;
|
break;
|
||||||
case ISCSI_CONN_WR_STATE_SPACE_WAIT:
|
case ISCSI_CONN_WR_STATE_SPACE_WAIT:
|
||||||
pos += scnprintf(&p[pos], size - pos, "space_waiting ");
|
ret += scnprintf(buf + ret, size - ret, "space_waiting ");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (test_bit(ISCSI_CONN_REINSTATING, &conn->conn_aflags))
|
if (test_bit(ISCSI_CONN_REINSTATING, &conn->conn_aflags))
|
||||||
pos += scnprintf(&p[pos], size - pos, "reinstating ");
|
ret += scnprintf(buf + ret, size - ret, "reinstating ");
|
||||||
else if (pos == 0)
|
else if (ret == 0)
|
||||||
pos += scnprintf(&p[pos], size - pos, "established idle ");
|
ret += scnprintf(buf + ret, size - ret, "established idle ");
|
||||||
|
|
||||||
out:
|
out:
|
||||||
return pos;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void iscsi_conn_release(struct kobject *kobj)
|
static void iscsi_conn_release(struct kobject *kobj)
|
||||||
@@ -98,17 +98,17 @@ static ssize_t iscsi_get_initiator_ip(struct iscsi_conn *conn, char *buf, int si
|
|||||||
|
|
||||||
static ssize_t iscsi_conn_ip_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
|
static ssize_t iscsi_conn_ip_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
int pos;
|
|
||||||
struct iscsi_conn *conn;
|
struct iscsi_conn *conn;
|
||||||
|
ssize_t ret;
|
||||||
|
|
||||||
TRACE_ENTRY();
|
TRACE_ENTRY();
|
||||||
|
|
||||||
conn = container_of(kobj, struct iscsi_conn, conn_kobj);
|
conn = container_of(kobj, struct iscsi_conn, conn_kobj);
|
||||||
|
|
||||||
pos = iscsi_get_initiator_ip(conn, buf, SCST_SYSFS_BLOCK_SIZE);
|
ret = iscsi_get_initiator_ip(conn, buf, SCST_SYSFS_BLOCK_SIZE);
|
||||||
|
|
||||||
TRACE_EXIT_RES(pos);
|
TRACE_EXIT_RES(ret);
|
||||||
return pos;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct kobj_attribute iscsi_conn_ip_attr =
|
static struct kobj_attribute iscsi_conn_ip_attr =
|
||||||
@@ -116,8 +116,8 @@ static struct kobj_attribute iscsi_conn_ip_attr =
|
|||||||
|
|
||||||
static ssize_t iscsi_get_target_ip(struct iscsi_conn *conn, char *buf, int size)
|
static ssize_t iscsi_get_target_ip(struct iscsi_conn *conn, char *buf, int size)
|
||||||
{
|
{
|
||||||
int pos;
|
|
||||||
struct sock *sk;
|
struct sock *sk;
|
||||||
|
ssize_t ret;
|
||||||
|
|
||||||
TRACE_ENTRY();
|
TRACE_ENTRY();
|
||||||
|
|
||||||
@@ -127,40 +127,40 @@ static ssize_t iscsi_get_target_ip(struct iscsi_conn *conn, char *buf, int size)
|
|||||||
sk = conn->sock->sk;
|
sk = conn->sock->sk;
|
||||||
switch (sk->sk_family) {
|
switch (sk->sk_family) {
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
pos = scnprintf(buf, size, "%pI4", &inet_sk(sk)->inet_saddr);
|
ret = scnprintf(buf, size, "%pI4", &inet_sk(sk)->inet_saddr);
|
||||||
break;
|
break;
|
||||||
#ifdef CONFIG_IPV6
|
#ifdef CONFIG_IPV6
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
|
||||||
pos = scnprintf(buf, size, "[%pI6]", &inet6_sk(sk)->saddr);
|
ret = scnprintf(buf, size, "[%pI6]", &inet6_sk(sk)->saddr);
|
||||||
#else
|
#else
|
||||||
pos = scnprintf(buf, size, "[%pI6]", &sk->sk_v6_rcv_saddr);
|
ret = scnprintf(buf, size, "[%pI6]", &sk->sk_v6_rcv_saddr);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
pos = scnprintf(buf, size, "Unknown family %d", sk->sk_family);
|
ret = scnprintf(buf, size, "Unknown family %d", sk->sk_family);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE_EXIT_RES(pos);
|
TRACE_EXIT_RES(ret);
|
||||||
return pos;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t iscsi_conn_target_ip_show(struct kobject *kobj, struct kobj_attribute *attr,
|
static ssize_t iscsi_conn_target_ip_show(struct kobject *kobj, struct kobj_attribute *attr,
|
||||||
char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
int pos;
|
|
||||||
struct iscsi_conn *conn;
|
struct iscsi_conn *conn;
|
||||||
|
ssize_t ret;
|
||||||
|
|
||||||
TRACE_ENTRY();
|
TRACE_ENTRY();
|
||||||
|
|
||||||
conn = container_of(kobj, struct iscsi_conn, conn_kobj);
|
conn = container_of(kobj, struct iscsi_conn, conn_kobj);
|
||||||
|
|
||||||
pos = iscsi_get_target_ip(conn, buf, SCST_SYSFS_BLOCK_SIZE);
|
ret = iscsi_get_target_ip(conn, buf, SCST_SYSFS_BLOCK_SIZE);
|
||||||
|
|
||||||
TRACE_EXIT_RES(pos);
|
TRACE_EXIT_RES(ret);
|
||||||
return pos;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct kobj_attribute iscsi_conn_target_ip_attr =
|
static struct kobj_attribute iscsi_conn_target_ip_attr =
|
||||||
@@ -176,7 +176,7 @@ static ssize_t iscsi_conn_transport_show(struct kobject *kobj, struct kobj_attri
|
|||||||
|
|
||||||
conn = container_of(kobj, struct iscsi_conn, conn_kobj);
|
conn = container_of(kobj, struct iscsi_conn, conn_kobj);
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", conn->transport->name);
|
ret = sysfs_emit(buf, "%s\n", conn->transport->name);
|
||||||
|
|
||||||
TRACE_EXIT_RES(ret);
|
TRACE_EXIT_RES(ret);
|
||||||
return ret;
|
return ret;
|
||||||
@@ -194,7 +194,7 @@ static ssize_t iscsi_conn_cid_show(struct kobject *kobj, struct kobj_attribute *
|
|||||||
|
|
||||||
conn = container_of(kobj, struct iscsi_conn, conn_kobj);
|
conn = container_of(kobj, struct iscsi_conn, conn_kobj);
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%u", conn->cid);
|
ret = sysfs_emit(buf, "%u", conn->cid);
|
||||||
|
|
||||||
TRACE_EXIT_RES(ret);
|
TRACE_EXIT_RES(ret);
|
||||||
return ret;
|
return ret;
|
||||||
@@ -205,17 +205,17 @@ static struct kobj_attribute iscsi_conn_cid_attr =
|
|||||||
|
|
||||||
static ssize_t iscsi_conn_state_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
|
static ssize_t iscsi_conn_state_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
int pos;
|
|
||||||
struct iscsi_conn *conn;
|
struct iscsi_conn *conn;
|
||||||
|
ssize_t ret;
|
||||||
|
|
||||||
TRACE_ENTRY();
|
TRACE_ENTRY();
|
||||||
|
|
||||||
conn = container_of(kobj, struct iscsi_conn, conn_kobj);
|
conn = container_of(kobj, struct iscsi_conn, conn_kobj);
|
||||||
|
|
||||||
pos = print_conn_state(buf, SCST_SYSFS_BLOCK_SIZE, conn);
|
ret = print_conn_state(buf, SCST_SYSFS_BLOCK_SIZE, conn);
|
||||||
|
|
||||||
TRACE_EXIT_RES(pos);
|
TRACE_EXIT_RES(ret);
|
||||||
return pos;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct kobj_attribute iscsi_conn_state_attr =
|
static struct kobj_attribute iscsi_conn_state_attr =
|
||||||
|
|||||||
@@ -388,7 +388,7 @@ static ssize_t iscsi_sess_show_##name(struct kobject *kobj, \
|
|||||||
scst_sess = container_of(kobj, struct scst_session, sess_kobj); \
|
scst_sess = container_of(kobj, struct scst_session, sess_kobj); \
|
||||||
sess = (struct iscsi_session *)scst_sess_get_tgt_priv(scst_sess); \
|
sess = (struct iscsi_session *)scst_sess_get_tgt_priv(scst_sess); \
|
||||||
\
|
\
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", \
|
return sysfs_emit(buf, "%s\n", \
|
||||||
iscsi_get_bool_value(sess->sess_params.name)); \
|
iscsi_get_bool_value(sess->sess_params.name)); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
@@ -405,7 +405,7 @@ static ssize_t iscsi_sess_show_##name(struct kobject *kobj, \
|
|||||||
scst_sess = container_of(kobj, struct scst_session, sess_kobj); \
|
scst_sess = container_of(kobj, struct scst_session, sess_kobj); \
|
||||||
sess = (struct iscsi_session *)scst_sess_get_tgt_priv(scst_sess); \
|
sess = (struct iscsi_session *)scst_sess_get_tgt_priv(scst_sess); \
|
||||||
\
|
\
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n", \
|
return sysfs_emit(buf, "%d\n", \
|
||||||
sess->sess_params.name); \
|
sess->sess_params.name); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
@@ -423,7 +423,7 @@ static ssize_t iscsi_sess_show_##name(struct kobject *kobj, \
|
|||||||
scst_sess = container_of(kobj, struct scst_session, sess_kobj); \
|
scst_sess = container_of(kobj, struct scst_session, sess_kobj); \
|
||||||
sess = (struct iscsi_session *)scst_sess_get_tgt_priv(scst_sess); \
|
sess = (struct iscsi_session *)scst_sess_get_tgt_priv(scst_sess); \
|
||||||
\
|
\
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", \
|
return sysfs_emit(buf, "%s\n", \
|
||||||
iscsi_get_digest_name(sess->sess_params.name, digest_name)); \
|
iscsi_get_digest_name(sess->sess_params.name, digest_name)); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
@@ -451,7 +451,7 @@ static ssize_t iscsi_sess_sid_show(struct kobject *kobj, struct kobj_attribute *
|
|||||||
scst_sess = container_of(kobj, struct scst_session, sess_kobj);
|
scst_sess = container_of(kobj, struct scst_session, sess_kobj);
|
||||||
sess = (struct iscsi_session *)scst_sess_get_tgt_priv(scst_sess);
|
sess = (struct iscsi_session *)scst_sess_get_tgt_priv(scst_sess);
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%llx\n", sess->sid);
|
ret = sysfs_emit(buf, "%llx\n", sess->sid);
|
||||||
|
|
||||||
TRACE_EXIT_RES(ret);
|
TRACE_EXIT_RES(ret);
|
||||||
return ret;
|
return ret;
|
||||||
@@ -472,7 +472,7 @@ static ssize_t iscsi_sess_reinstating_show(struct kobject *kobj, struct kobj_att
|
|||||||
scst_sess = container_of(kobj, struct scst_session, sess_kobj);
|
scst_sess = container_of(kobj, struct scst_session, sess_kobj);
|
||||||
sess = (struct iscsi_session *)scst_sess_get_tgt_priv(scst_sess);
|
sess = (struct iscsi_session *)scst_sess_get_tgt_priv(scst_sess);
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n", sess->sess_reinstating ? 1 : 0);
|
ret = sysfs_emit(buf, "%d\n", sess->sess_reinstating ? 1 : 0);
|
||||||
|
|
||||||
TRACE_EXIT_RES(ret);
|
TRACE_EXIT_RES(ret);
|
||||||
return ret;
|
return ret;
|
||||||
@@ -497,7 +497,7 @@ static ssize_t iscsi_sess_thread_pid_show(struct kobject *kobj, struct kobj_attr
|
|||||||
|
|
||||||
mutex_lock(&thr_pool->tp_mutex);
|
mutex_lock(&thr_pool->tp_mutex);
|
||||||
list_for_each_entry(t, &thr_pool->threads_list, threads_list_entry)
|
list_for_each_entry(t, &thr_pool->threads_list, threads_list_entry)
|
||||||
res += scnprintf(buf + res, SCST_SYSFS_BLOCK_SIZE - res, "%d%s",
|
res += sysfs_emit_at(buf, res, "%d%s",
|
||||||
task_pid_vnr(t->thr),
|
task_pid_vnr(t->thr),
|
||||||
list_is_last(&t->threads_list_entry,
|
list_is_last(&t->threads_list_entry,
|
||||||
&thr_pool->threads_list) ?
|
&thr_pool->threads_list) ?
|
||||||
|
|||||||
@@ -404,7 +404,7 @@ static ssize_t iscsi_tgt_tid_show(struct kobject *kobj, struct kobj_attribute *a
|
|||||||
if (!tgt)
|
if (!tgt)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%u\n", tgt->tid);
|
res = sysfs_emit(buf, "%u\n", tgt->tid);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
TRACE_EXIT_RES(res);
|
TRACE_EXIT_RES(res);
|
||||||
@@ -577,7 +577,7 @@ static ssize_t iscsi_acg_sess_dedicated_threads_show(struct kobject *kobj,
|
|||||||
acg = container_of(kobj, struct scst_acg, acg_kobj);
|
acg = container_of(kobj, struct scst_acg, acg_kobj);
|
||||||
dedicated = scst_get_acg_tgt_priv(acg);
|
dedicated = scst_get_acg_tgt_priv(acg);
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
ret = sysfs_emit(buf, "%d\n%s",
|
||||||
dedicated, dedicated ? SCST_SYSFS_KEY_MARK "\n" : "");
|
dedicated, dedicated ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
|
|
||||||
TRACE_EXIT_RES(ret);
|
TRACE_EXIT_RES(ret);
|
||||||
|
|||||||
@@ -895,28 +895,27 @@ static ssize_t sqa_version_show(struct kobject *kobj,
|
|||||||
{
|
{
|
||||||
ssize_t ret = 0;
|
ssize_t ret = 0;
|
||||||
|
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret,
|
ret += sysfs_emit_at(buf, ret, "INTERFACE=%s\nSCST=%s\nQLOGIC=%s\n",
|
||||||
"INTERFACE=%s\nSCST=%s\nQLOGIC=%s\n",
|
|
||||||
SQA_VERSION, SCST_VERSION_NAME, QLA2XXX_VERSION);
|
SQA_VERSION, SCST_VERSION_NAME, QLA2XXX_VERSION);
|
||||||
|
|
||||||
#ifdef CONFIG_SCST_EXTRACHECKS
|
#ifdef CONFIG_SCST_EXTRACHECKS
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "EXTRACHECKS\n");
|
ret += sysfs_emit_at(buf, ret, "EXTRACHECKS\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SCST_TRACING
|
#ifdef CONFIG_SCST_TRACING
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "TRACING\n");
|
ret += sysfs_emit_at(buf, ret, "TRACING\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SCST_DEBUG
|
#ifdef CONFIG_SCST_DEBUG
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "DEBUG\n");
|
ret += sysfs_emit_at(buf, ret, "DEBUG\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_QLA_TGT_DEBUG_WORK_IN_THREAD
|
#ifdef CONFIG_QLA_TGT_DEBUG_WORK_IN_THREAD
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "QLA_TGT_DEBUG_WORK_IN_THREAD\n");
|
ret += sysfs_emit_at(buf, ret, "QLA_TGT_DEBUG_WORK_IN_THREAD\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_QLA_TGT_DEBUG_SRR
|
#ifdef CONFIG_QLA_TGT_DEBUG_SRR
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "DEBUG_SRR\n");
|
ret += sysfs_emit_at(buf, ret, "DEBUG_SRR\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TRACE_EXIT();
|
TRACE_EXIT();
|
||||||
@@ -935,8 +934,7 @@ static ssize_t sqa_hw_target_show(struct kobject *kobj,
|
|||||||
|
|
||||||
tgt = sqa_tgt->qla_tgt;
|
tgt = sqa_tgt->qla_tgt;
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n",
|
return sysfs_emit(buf, "%d\n", tgt->vha->vp_idx == 0 ? 1 : 0);
|
||||||
tgt->vha->vp_idx == 0 ? 1 : 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t sqa_node_name_show(struct kobject *kobj,
|
static ssize_t sqa_node_name_show(struct kobject *kobj,
|
||||||
@@ -973,11 +971,10 @@ static ssize_t sqa_node_name_show(struct kobject *kobj,
|
|||||||
if (res != 0)
|
if (res != 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", wwn);
|
res = sysfs_emit(buf, "%s\n", wwn);
|
||||||
|
|
||||||
if (ha->tgt.node_name_set)
|
if (ha->tgt.node_name_set)
|
||||||
res += scnprintf(buf + res, SCST_SYSFS_BLOCK_SIZE - res, "%s\n",
|
res += sysfs_emit_at(buf, res, "%s\n", SCST_SYSFS_KEY_MARK);
|
||||||
SCST_SYSFS_KEY_MARK);
|
|
||||||
|
|
||||||
kfree(wwn);
|
kfree(wwn);
|
||||||
|
|
||||||
@@ -1072,7 +1069,7 @@ static ssize_t sqa_vp_parent_host_show(struct kobject *kobj,
|
|||||||
if (res != 0)
|
if (res != 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s\n", wwn, SCST_SYSFS_KEY_MARK);
|
res = sysfs_emit(buf, "%s\n%s\n", wwn, SCST_SYSFS_KEY_MARK);
|
||||||
|
|
||||||
kfree(wwn);
|
kfree(wwn);
|
||||||
|
|
||||||
@@ -1095,7 +1092,7 @@ static ssize_t sqa_show_expl_conf_enabled(struct kobject *kobj,
|
|||||||
tgt = sqa_tgt->qla_tgt;
|
tgt = sqa_tgt->qla_tgt;
|
||||||
ha = tgt->ha;
|
ha = tgt->ha;
|
||||||
|
|
||||||
return scnprintf(buffer, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
return sysfs_emit(buffer, "%d\n%s",
|
||||||
ha->base_qpair->enable_explicit_conf,
|
ha->base_qpair->enable_explicit_conf,
|
||||||
ha->base_qpair->enable_explicit_conf ?
|
ha->base_qpair->enable_explicit_conf ?
|
||||||
SCST_SYSFS_KEY_MARK "\n" : "");
|
SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
|
|||||||
@@ -6601,8 +6601,8 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ssize_t q2t_show_expl_conf_enabled(struct kobject *kobj,
|
static ssize_t q2t_show_expl_conf_enabled(struct kobject *kobj, struct kobj_attribute *attr,
|
||||||
struct kobj_attribute *attr, char *buffer)
|
char *buffer)
|
||||||
{
|
{
|
||||||
struct scst_tgt *scst_tgt;
|
struct scst_tgt *scst_tgt;
|
||||||
struct q2t_tgt *tgt;
|
struct q2t_tgt *tgt;
|
||||||
@@ -6613,9 +6613,10 @@ static ssize_t q2t_show_expl_conf_enabled(struct kobject *kobj,
|
|||||||
tgt = scst_tgt_get_tgt_priv(scst_tgt);
|
tgt = scst_tgt_get_tgt_priv(scst_tgt);
|
||||||
if (!tgt)
|
if (!tgt)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
vha = tgt->vha;
|
vha = tgt->vha;
|
||||||
|
|
||||||
res = scnprintf(buffer, PAGE_SIZE, "%d\n%s",
|
res = sysfs_emit(buffer, "%d\n%s",
|
||||||
vha->hw->enable_explicit_conf,
|
vha->hw->enable_explicit_conf,
|
||||||
vha->hw->enable_explicit_conf ? SCST_SYSFS_KEY_MARK "\n" : "");
|
vha->hw->enable_explicit_conf ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
|
|
||||||
@@ -6709,22 +6710,22 @@ static ssize_t q2t_version_show(struct kobject *kobj, struct kobj_attribute *att
|
|||||||
{
|
{
|
||||||
size_t ret = 0;
|
size_t ret = 0;
|
||||||
|
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "%s\n", Q2T_VERSION_STRING);
|
ret += sysfs_emit_at(buf, ret, "%s\n", Q2T_VERSION_STRING);
|
||||||
|
|
||||||
#ifdef CONFIG_SCST_EXTRACHECKS
|
#ifdef CONFIG_SCST_EXTRACHECKS
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "EXTRACHECKS\n");
|
ret += sysfs_emit_at(buf, ret, "EXTRACHECKS\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SCST_TRACING
|
#ifdef CONFIG_SCST_TRACING
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "TRACING\n");
|
ret += sysfs_emit_at(buf, ret, "TRACING\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SCST_DEBUG
|
#ifdef CONFIG_SCST_DEBUG
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "DEBUG\n");
|
ret += sysfs_emit_at(buf, ret, "DEBUG\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_QLA_TGT_DEBUG_WORK_IN_THREAD
|
#ifdef CONFIG_QLA_TGT_DEBUG_WORK_IN_THREAD
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "QLA_TGT_DEBUG_WORK_IN_THREAD\n");
|
ret += sysfs_emit_at(buf, ret, "QLA_TGT_DEBUG_WORK_IN_THREAD\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TRACE_EXIT();
|
TRACE_EXIT();
|
||||||
@@ -6733,7 +6734,7 @@ static ssize_t q2t_version_show(struct kobject *kobj, struct kobj_attribute *att
|
|||||||
|
|
||||||
static ssize_t q2t_hw_target_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
|
static ssize_t q2t_hw_target_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n", 1);
|
return sysfs_emit(buf, "%d\n", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t q2t_node_name_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
|
static ssize_t q2t_node_name_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
|
||||||
@@ -6757,12 +6758,11 @@ static ssize_t q2t_node_name_show(struct kobject *kobj, struct kobj_attribute *a
|
|||||||
if (res != 0)
|
if (res != 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", wwn);
|
res = sysfs_emit(buf, "%s\n", wwn);
|
||||||
|
|
||||||
/* For virtual ports it's always key */
|
/* For virtual ports it's always key */
|
||||||
if (vha->node_name_set || (vha->vp_idx != 0))
|
if (vha->node_name_set || (vha->vp_idx != 0))
|
||||||
res += scnprintf(buf + res, SCST_SYSFS_BLOCK_SIZE - res, "%s\n",
|
res += sysfs_emit_at(buf, res, "%s\n", SCST_SYSFS_KEY_MARK);
|
||||||
SCST_SYSFS_KEY_MARK);
|
|
||||||
|
|
||||||
kfree(wwn);
|
kfree(wwn);
|
||||||
|
|
||||||
@@ -6860,12 +6860,11 @@ static ssize_t q2t_port_name_show(struct kobject *kobj, struct kobj_attribute *a
|
|||||||
if (res != 0)
|
if (res != 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
res = scnprintf(buf, "%s\n", wwn);
|
res = sysfs_emit(buf, "%s\n", wwn);
|
||||||
|
|
||||||
/* For virtual ports it's always key */
|
/* For virtual ports it's always key */
|
||||||
if ((vha->vp_idx != 0) || vha->port_name_set)
|
if ((vha->vp_idx != 0) || vha->port_name_set)
|
||||||
res += scnprintf(buf + res, SCST_SYSFS_BLOCK_SIZE - res, "%s\n",
|
res += sysfs_emit_at(buf, res, "%s\n", SCST_SYSFS_KEY_MARK);
|
||||||
SCST_SYSFS_KEY_MARK);
|
|
||||||
|
|
||||||
kfree(wwn);
|
kfree(wwn);
|
||||||
|
|
||||||
@@ -6958,7 +6957,7 @@ static ssize_t q2t_vp_parent_host_show(struct kobject *kobj, struct kobj_attribu
|
|||||||
if (res != 0)
|
if (res != 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s\n", wwn, SCST_SYSFS_KEY_MARK);
|
res = sysfs_emit(buf, "%s\n%s\n", wwn, SCST_SYSFS_KEY_MARK);
|
||||||
|
|
||||||
kfree(wwn);
|
kfree(wwn);
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,11 @@
|
|||||||
#include <linux/iocontext.h>
|
#include <linux/iocontext.h>
|
||||||
#include <linux/kobject_ns.h>
|
#include <linux/kobject_ns.h>
|
||||||
#include <linux/scatterlist.h> /* struct scatterlist */
|
#include <linux/scatterlist.h> /* struct scatterlist */
|
||||||
|
#include <linux/shrinker.h>
|
||||||
#include <linux/slab.h> /* kmalloc() */
|
#include <linux/slab.h> /* kmalloc() */
|
||||||
#include <linux/stddef.h> /* sizeof_field() */
|
#include <linux/stddef.h> /* sizeof_field() */
|
||||||
|
#include <linux/string.h>
|
||||||
|
#include <linux/sysfs.h>
|
||||||
#include <linux/timer.h>
|
#include <linux/timer.h>
|
||||||
#include <linux/vmalloc.h>
|
#include <linux/vmalloc.h>
|
||||||
#include <linux/workqueue.h>
|
#include <linux/workqueue.h>
|
||||||
@@ -1565,6 +1568,79 @@ static inline ssize_t strscpy(char *dest, const char *src, size_t count)
|
|||||||
#define __ATTR_RW(_name) __ATTR(_name, 0644, _name##_show, _name##_store)
|
#define __ATTR_RW(_name) __ATTR(_name, 0644, _name##_show, _name##_store)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) && \
|
||||||
|
(LINUX_VERSION_CODE >> 8 != KERNEL_VERSION(4, 9, 0) >> 8 || \
|
||||||
|
LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 260)) && \
|
||||||
|
(LINUX_VERSION_CODE >> 8 != KERNEL_VERSION(4, 14, 0) >> 8 || \
|
||||||
|
LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 224)) && \
|
||||||
|
(LINUX_VERSION_CODE >> 8 != KERNEL_VERSION(4, 19, 0) >> 8 || \
|
||||||
|
LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 179)) && \
|
||||||
|
(LINUX_VERSION_CODE >> 8 != KERNEL_VERSION(5, 4, 0) >> 8 || \
|
||||||
|
LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 103))
|
||||||
|
/*
|
||||||
|
* See also commit 2efc459d06f1 ("sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output")
|
||||||
|
* # v5.10.
|
||||||
|
* See also commit f3c3dcf35532 # v4.9.260.
|
||||||
|
* See also commit 390881843b4f # v4.14.224.
|
||||||
|
* See also commit cb1f69d53ac8 # v4.19.179.
|
||||||
|
* See also commit 5f4243642873 # v5.4.103.
|
||||||
|
*/
|
||||||
|
static inline __printf(2, 3)
|
||||||
|
int sysfs_emit(char *buf, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
int len;
|
||||||
|
|
||||||
|
if (WARN(!buf ||
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0)
|
||||||
|
/*
|
||||||
|
* For kernel releases older than 4.20, using the SLUB allocator will cause
|
||||||
|
* this alignment check to fail as that allocator did NOT align kmalloc
|
||||||
|
* allocations on a PAGE_SIZE boundary.
|
||||||
|
*/
|
||||||
|
false,
|
||||||
|
#else
|
||||||
|
offset_in_page(buf),
|
||||||
|
#endif
|
||||||
|
"invalid sysfs_emit: buf:%p\n", buf))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
va_start(args, fmt);
|
||||||
|
len = vscnprintf(buf, PAGE_SIZE, fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline __printf(3, 4)
|
||||||
|
int sysfs_emit_at(char *buf, int at, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
int len;
|
||||||
|
|
||||||
|
if (WARN(!buf ||
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0)
|
||||||
|
/*
|
||||||
|
* For kernel releases older than 4.20, using the SLUB allocator will cause
|
||||||
|
* this alignment check to fail as that allocator did NOT align kmalloc
|
||||||
|
* allocations on a PAGE_SIZE boundary.
|
||||||
|
*/
|
||||||
|
false ||
|
||||||
|
#else
|
||||||
|
offset_in_page(buf) ||
|
||||||
|
#endif
|
||||||
|
at < 0 || at >= PAGE_SIZE,
|
||||||
|
"invalid sysfs_emit_at: buf:%p at:%d\n", buf, at))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
va_start(args, fmt);
|
||||||
|
len = vscnprintf(buf + at, PAGE_SIZE - at, fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* <linux/t10-pi.h> */
|
/* <linux/t10-pi.h> */
|
||||||
|
|
||||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)
|
||||||
|
|||||||
@@ -565,7 +565,7 @@ static ssize_t disk_sysfs_cluster_mode_show(struct kobject *kobj, struct kobj_at
|
|||||||
struct scst_device *dev = container_of(kobj, struct scst_device,
|
struct scst_device *dev = container_of(kobj, struct scst_device,
|
||||||
dev_kobj);
|
dev_kobj);
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
return sysfs_emit(buf, "%d\n%s",
|
||||||
dev->cluster_mode,
|
dev->cluster_mode,
|
||||||
dev->cluster_mode ? SCST_SYSFS_KEY_MARK "\n" : "");
|
dev->cluster_mode ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3897,10 +3897,10 @@ out:
|
|||||||
static ssize_t dev_user_sysfs_commands_show(struct kobject *kobj, struct kobj_attribute *attr,
|
static ssize_t dev_user_sysfs_commands_show(struct kobject *kobj, struct kobj_attribute *attr,
|
||||||
char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
int pos = 0, ppos, i;
|
|
||||||
struct scst_device *dev;
|
struct scst_device *dev;
|
||||||
struct scst_user_dev *udev;
|
struct scst_user_dev *udev;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
int i, ret = 0, pos;
|
||||||
|
|
||||||
TRACE_ENTRY();
|
TRACE_ENTRY();
|
||||||
|
|
||||||
@@ -3913,26 +3913,24 @@ static ssize_t dev_user_sysfs_commands_show(struct kobject *kobj, struct kobj_at
|
|||||||
struct scst_user_cmd *ucmd;
|
struct scst_user_cmd *ucmd;
|
||||||
|
|
||||||
list_for_each_entry(ucmd, head, hash_list_entry) {
|
list_for_each_entry(ucmd, head, hash_list_entry) {
|
||||||
ppos = pos;
|
pos = ret;
|
||||||
pos += scnprintf(&buf[pos],
|
ret += sysfs_emit_at(buf, ret,
|
||||||
SCST_SYSFS_BLOCK_SIZE - pos,
|
|
||||||
"ucmd %p (state %x, ref %d), sent_to_user %d, seen_by_user %d, aborted %d, jammed %d, scst_cmd %p\n",
|
"ucmd %p (state %x, ref %d), sent_to_user %d, seen_by_user %d, aborted %d, jammed %d, scst_cmd %p\n",
|
||||||
ucmd, ucmd->state,
|
ucmd, ucmd->state,
|
||||||
atomic_read(&ucmd->ucmd_ref),
|
atomic_read(&ucmd->ucmd_ref),
|
||||||
ucmd->sent_to_user, ucmd->seen_by_user,
|
ucmd->sent_to_user, ucmd->seen_by_user,
|
||||||
ucmd->aborted, ucmd->jammed, ucmd->cmd);
|
ucmd->aborted, ucmd->jammed, ucmd->cmd);
|
||||||
if (pos >= SCST_SYSFS_BLOCK_SIZE - 1) {
|
if (ret >= SCST_SYSFS_BLOCK_SIZE - 1) {
|
||||||
ppos += scnprintf(&buf[ppos],
|
pos += sysfs_emit_at(buf, pos, "...\n");
|
||||||
SCST_SYSFS_BLOCK_SIZE - ppos, "...\n");
|
ret = pos;
|
||||||
pos = ppos;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
spin_unlock_irqrestore(&udev->udev_cmd_threads.cmd_list_lock, flags);
|
spin_unlock_irqrestore(&udev->udev_cmd_threads.cmd_list_lock, flags);
|
||||||
|
|
||||||
TRACE_EXIT_RES(pos);
|
TRACE_EXIT_RES(ret);
|
||||||
return pos;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int test_cleanup_list(void)
|
static inline int test_cleanup_list(void)
|
||||||
|
|||||||
@@ -7734,7 +7734,7 @@ static ssize_t vdev_size_show(struct kobject *kobj, struct kobj_attribute *attr,
|
|||||||
*/
|
*/
|
||||||
key = !(virt_dev->nullio && size == VDISK_NULLIO_SIZE) && !size_shift;
|
key = !(virt_dev->nullio && size == VDISK_NULLIO_SIZE) && !size_shift;
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%llu\n%s",
|
return sysfs_emit(buf, "%llu\n%s",
|
||||||
size >> size_shift, key ? SCST_SYSFS_KEY_MARK "\n" : "");
|
size >> size_shift, key ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7764,7 +7764,7 @@ static ssize_t vdisk_sysfs_blocksize_show(struct kobject *kobj, struct kobj_attr
|
|||||||
|
|
||||||
dev = container_of(kobj, struct scst_device, dev_kobj);
|
dev = container_of(kobj, struct scst_device, dev_kobj);
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
ret = sysfs_emit(buf, "%d\n%s",
|
||||||
dev->block_size, dev->block_size == (1 << DEF_DISK_BLOCK_SHIFT) ? "" :
|
dev->block_size, dev->block_size == (1 << DEF_DISK_BLOCK_SHIFT) ? "" :
|
||||||
SCST_SYSFS_KEY_MARK "\n");
|
SCST_SYSFS_KEY_MARK "\n");
|
||||||
|
|
||||||
@@ -7807,7 +7807,7 @@ static ssize_t vdisk_opt_trans_len_show(struct kobject *kobj,
|
|||||||
container_of(kobj, struct scst_device, dev_kobj);
|
container_of(kobj, struct scst_device, dev_kobj);
|
||||||
struct scst_vdisk_dev *virt_dev = dev->dh_priv;
|
struct scst_vdisk_dev *virt_dev = dev->dh_priv;
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
return sysfs_emit(buf, "%d\n%s",
|
||||||
virt_dev->opt_trans_len,
|
virt_dev->opt_trans_len,
|
||||||
virt_dev->opt_trans_len_set ? SCST_SYSFS_KEY_MARK "\n" : "");
|
virt_dev->opt_trans_len_set ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
}
|
}
|
||||||
@@ -7824,7 +7824,7 @@ static ssize_t vdisk_sysfs_rd_only_show(struct kobject *kobj, struct kobj_attrib
|
|||||||
dev = container_of(kobj, struct scst_device, dev_kobj);
|
dev = container_of(kobj, struct scst_device, dev_kobj);
|
||||||
virt_dev = dev->dh_priv;
|
virt_dev = dev->dh_priv;
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
ret = sysfs_emit(buf, "%d\n%s",
|
||||||
virt_dev->rd_only,
|
virt_dev->rd_only,
|
||||||
virt_dev->rd_only == DEF_RD_ONLY ? "" : SCST_SYSFS_KEY_MARK "\n");
|
virt_dev->rd_only == DEF_RD_ONLY ? "" : SCST_SYSFS_KEY_MARK "\n");
|
||||||
|
|
||||||
@@ -7843,7 +7843,7 @@ static ssize_t vdisk_sysfs_wt_show(struct kobject *kobj, struct kobj_attribute *
|
|||||||
dev = container_of(kobj, struct scst_device, dev_kobj);
|
dev = container_of(kobj, struct scst_device, dev_kobj);
|
||||||
virt_dev = dev->dh_priv;
|
virt_dev = dev->dh_priv;
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
ret = sysfs_emit(buf, "%d\n%s",
|
||||||
virt_dev->wt_flag,
|
virt_dev->wt_flag,
|
||||||
virt_dev->wt_flag == DEF_WRITE_THROUGH ? "" : SCST_SYSFS_KEY_MARK "\n");
|
virt_dev->wt_flag == DEF_WRITE_THROUGH ? "" : SCST_SYSFS_KEY_MARK "\n");
|
||||||
|
|
||||||
@@ -7862,7 +7862,7 @@ static ssize_t vdisk_sysfs_tp_show(struct kobject *kobj, struct kobj_attribute *
|
|||||||
dev = container_of(kobj, struct scst_device, dev_kobj);
|
dev = container_of(kobj, struct scst_device, dev_kobj);
|
||||||
virt_dev = dev->dh_priv;
|
virt_dev = dev->dh_priv;
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
ret = sysfs_emit(buf, "%d\n%s",
|
||||||
virt_dev->thin_provisioned,
|
virt_dev->thin_provisioned,
|
||||||
virt_dev->thin_provisioned_manually_set ? SCST_SYSFS_KEY_MARK "\n" : "");
|
virt_dev->thin_provisioned_manually_set ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
|
|
||||||
@@ -7902,7 +7902,7 @@ static ssize_t vdisk_sysfs_expl_alua_show(struct kobject *kobj,
|
|||||||
struct scst_device *dev = container_of(kobj, struct scst_device,
|
struct scst_device *dev = container_of(kobj, struct scst_device,
|
||||||
dev_kobj);
|
dev_kobj);
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
return sysfs_emit(buf, "%d\n%s",
|
||||||
dev->expl_alua,
|
dev->expl_alua,
|
||||||
dev->expl_alua != DEF_EXPL_ALUA ? SCST_SYSFS_KEY_MARK "\n" : "");
|
dev->expl_alua != DEF_EXPL_ALUA ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
}
|
}
|
||||||
@@ -7939,7 +7939,7 @@ static ssize_t vdisk_sysfs_nv_cache_show(struct kobject *kobj, struct kobj_attri
|
|||||||
dev = container_of(kobj, struct scst_device, dev_kobj);
|
dev = container_of(kobj, struct scst_device, dev_kobj);
|
||||||
virt_dev = dev->dh_priv;
|
virt_dev = dev->dh_priv;
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
ret = sysfs_emit(buf, "%d\n%s",
|
||||||
virt_dev->nv_cache,
|
virt_dev->nv_cache,
|
||||||
virt_dev->nv_cache == DEF_NV_CACHE ? "" : SCST_SYSFS_KEY_MARK "\n");
|
virt_dev->nv_cache == DEF_NV_CACHE ? "" : SCST_SYSFS_KEY_MARK "\n");
|
||||||
|
|
||||||
@@ -7959,7 +7959,7 @@ static ssize_t vdisk_sysfs_o_direct_show(struct kobject *kobj, struct kobj_attri
|
|||||||
dev = container_of(kobj, struct scst_device, dev_kobj);
|
dev = container_of(kobj, struct scst_device, dev_kobj);
|
||||||
virt_dev = dev->dh_priv;
|
virt_dev = dev->dh_priv;
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
ret = sysfs_emit(buf, "%d\n%s",
|
||||||
virt_dev->o_direct_flag,
|
virt_dev->o_direct_flag,
|
||||||
virt_dev->o_direct_flag == DEF_O_DIRECT ? "" : SCST_SYSFS_KEY_MARK "\n");
|
virt_dev->o_direct_flag == DEF_O_DIRECT ? "" : SCST_SYSFS_KEY_MARK "\n");
|
||||||
|
|
||||||
@@ -7974,7 +7974,7 @@ static ssize_t vdev_sysfs_dummy_show(struct kobject *kobj,
|
|||||||
dev_kobj);
|
dev_kobj);
|
||||||
struct scst_vdisk_dev *virt_dev = dev->dh_priv;
|
struct scst_vdisk_dev *virt_dev = dev->dh_priv;
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
return sysfs_emit(buf, "%d\n%s",
|
||||||
virt_dev->dummy,
|
virt_dev->dummy,
|
||||||
virt_dev->dummy != DEF_DUMMY ? SCST_SYSFS_KEY_MARK "\n" : "");
|
virt_dev->dummy != DEF_DUMMY ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
}
|
}
|
||||||
@@ -7987,7 +7987,7 @@ static ssize_t vdev_sysfs_rz_show(struct kobject *kobj,
|
|||||||
struct scst_vdisk_dev *virt_dev = dev->dh_priv;
|
struct scst_vdisk_dev *virt_dev = dev->dh_priv;
|
||||||
bool read_zero = virt_dev->read_zero;
|
bool read_zero = virt_dev->read_zero;
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
return sysfs_emit(buf, "%d\n%s",
|
||||||
read_zero,
|
read_zero,
|
||||||
read_zero != DEF_READ_ZERO ? SCST_SYSFS_KEY_MARK "\n" : "");
|
read_zero != DEF_READ_ZERO ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
}
|
}
|
||||||
@@ -8033,11 +8033,10 @@ static ssize_t vdisk_sysfs_removable_show(struct kobject *kobj, struct kobj_attr
|
|||||||
dev = container_of(kobj, struct scst_device, dev_kobj);
|
dev = container_of(kobj, struct scst_device, dev_kobj);
|
||||||
virt_dev = dev->dh_priv;
|
virt_dev = dev->dh_priv;
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n", virt_dev->removable);
|
ret = sysfs_emit(buf, "%d\n", virt_dev->removable);
|
||||||
|
|
||||||
if (virt_dev->dev->type != TYPE_ROM && virt_dev->removable != DEF_REMOVABLE)
|
if (virt_dev->dev->type != TYPE_ROM && virt_dev->removable != DEF_REMOVABLE)
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "%s\n",
|
ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK);
|
||||||
SCST_SYSFS_KEY_MARK);
|
|
||||||
|
|
||||||
TRACE_EXIT_RES(ret);
|
TRACE_EXIT_RES(ret);
|
||||||
return ret;
|
return ret;
|
||||||
@@ -8054,11 +8053,10 @@ static ssize_t vdisk_sysfs_tst_show(struct kobject *kobj, struct kobj_attribute
|
|||||||
dev = container_of(kobj, struct scst_device, dev_kobj);
|
dev = container_of(kobj, struct scst_device, dev_kobj);
|
||||||
virt_dev = dev->dh_priv;
|
virt_dev = dev->dh_priv;
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n", virt_dev->tst);
|
ret = sysfs_emit(buf, "%d\n", virt_dev->tst);
|
||||||
|
|
||||||
if (virt_dev->tst != DEF_TST)
|
if (virt_dev->tst != DEF_TST)
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "%s\n",
|
ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK);
|
||||||
SCST_SYSFS_KEY_MARK);
|
|
||||||
|
|
||||||
TRACE_EXIT_RES(ret);
|
TRACE_EXIT_RES(ret);
|
||||||
return ret;
|
return ret;
|
||||||
@@ -8076,11 +8074,10 @@ static ssize_t vdisk_sysfs_rotational_show(struct kobject *kobj, struct kobj_att
|
|||||||
dev = container_of(kobj, struct scst_device, dev_kobj);
|
dev = container_of(kobj, struct scst_device, dev_kobj);
|
||||||
virt_dev = dev->dh_priv;
|
virt_dev = dev->dh_priv;
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n", virt_dev->rotational);
|
ret = sysfs_emit(buf, "%d\n", virt_dev->rotational);
|
||||||
|
|
||||||
if (virt_dev->rotational != DEF_ROTATIONAL)
|
if (virt_dev->rotational != DEF_ROTATIONAL)
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "%s\n",
|
ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK);
|
||||||
SCST_SYSFS_KEY_MARK);
|
|
||||||
|
|
||||||
TRACE_EXIT_RES(ret);
|
TRACE_EXIT_RES(ret);
|
||||||
return ret;
|
return ret;
|
||||||
@@ -8175,7 +8172,7 @@ static ssize_t vdev_sysfs_filename_show(struct kobject *kobj, struct kobj_attrib
|
|||||||
if (res != 0)
|
if (res != 0)
|
||||||
goto out_put;
|
goto out_put;
|
||||||
|
|
||||||
res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", work->res_buf);
|
res = sysfs_emit(buf, "%s\n", work->res_buf);
|
||||||
|
|
||||||
out_put:
|
out_put:
|
||||||
scst_sysfs_work_put(work);
|
scst_sysfs_work_put(work);
|
||||||
@@ -8291,7 +8288,7 @@ static ssize_t vdev_sysfs_cluster_mode_show(struct kobject *kobj, struct kobj_at
|
|||||||
{
|
{
|
||||||
struct scst_device *dev = container_of(kobj, struct scst_device, dev_kobj);
|
struct scst_device *dev = container_of(kobj, struct scst_device, dev_kobj);
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
return sysfs_emit(buf, "%d\n%s",
|
||||||
dev->cluster_mode,
|
dev->cluster_mode,
|
||||||
dev->cluster_mode ? SCST_SYSFS_KEY_MARK "\n" : "");
|
dev->cluster_mode ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
}
|
}
|
||||||
@@ -8477,7 +8474,7 @@ static ssize_t vdev_sysfs_t10_vend_id_show(struct kobject *kobj,
|
|||||||
virt_dev = dev->dh_priv;
|
virt_dev = dev->dh_priv;
|
||||||
|
|
||||||
read_lock(&vdisk_serial_rwlock);
|
read_lock(&vdisk_serial_rwlock);
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s",
|
ret = sysfs_emit(buf, "%s\n%s",
|
||||||
virt_dev->t10_vend_id,
|
virt_dev->t10_vend_id,
|
||||||
virt_dev->t10_vend_id_set ? SCST_SYSFS_KEY_MARK "\n" : "");
|
virt_dev->t10_vend_id_set ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
read_unlock(&vdisk_serial_rwlock);
|
read_unlock(&vdisk_serial_rwlock);
|
||||||
@@ -8537,7 +8534,7 @@ static ssize_t vdev_sysfs_vend_specific_id_show(struct kobject *kobj,
|
|||||||
virt_dev = dev->dh_priv;
|
virt_dev = dev->dh_priv;
|
||||||
|
|
||||||
read_lock(&vdisk_serial_rwlock);
|
read_lock(&vdisk_serial_rwlock);
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s",
|
ret = sysfs_emit(buf, "%s\n%s",
|
||||||
virt_dev->vend_specific_id,
|
virt_dev->vend_specific_id,
|
||||||
virt_dev->vend_specific_id_set ? SCST_SYSFS_KEY_MARK "\n" : "");
|
virt_dev->vend_specific_id_set ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
read_unlock(&vdisk_serial_rwlock);
|
read_unlock(&vdisk_serial_rwlock);
|
||||||
@@ -8597,7 +8594,7 @@ static ssize_t vdev_sysfs_prod_id_show(struct kobject *kobj,
|
|||||||
virt_dev = dev->dh_priv;
|
virt_dev = dev->dh_priv;
|
||||||
|
|
||||||
read_lock(&vdisk_serial_rwlock);
|
read_lock(&vdisk_serial_rwlock);
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s",
|
ret = sysfs_emit(buf, "%s\n%s",
|
||||||
virt_dev->prod_id,
|
virt_dev->prod_id,
|
||||||
virt_dev->prod_id_set ? SCST_SYSFS_KEY_MARK "\n" : "");
|
virt_dev->prod_id_set ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
read_unlock(&vdisk_serial_rwlock);
|
read_unlock(&vdisk_serial_rwlock);
|
||||||
@@ -8657,7 +8654,7 @@ static ssize_t vdev_sysfs_prod_rev_lvl_show(struct kobject *kobj,
|
|||||||
virt_dev = dev->dh_priv;
|
virt_dev = dev->dh_priv;
|
||||||
|
|
||||||
read_lock(&vdisk_serial_rwlock);
|
read_lock(&vdisk_serial_rwlock);
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s",
|
ret = sysfs_emit(buf, "%s\n%s",
|
||||||
virt_dev->prod_rev_lvl,
|
virt_dev->prod_rev_lvl,
|
||||||
virt_dev->prod_rev_lvl_set ? SCST_SYSFS_KEY_MARK "\n" : "");
|
virt_dev->prod_rev_lvl_set ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
read_unlock(&vdisk_serial_rwlock);
|
read_unlock(&vdisk_serial_rwlock);
|
||||||
@@ -8718,7 +8715,7 @@ static ssize_t vdev_sysfs_scsi_device_name_show(struct kobject *kobj, struct kob
|
|||||||
virt_dev = dev->dh_priv;
|
virt_dev = dev->dh_priv;
|
||||||
|
|
||||||
read_lock(&vdisk_serial_rwlock);
|
read_lock(&vdisk_serial_rwlock);
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s",
|
ret = sysfs_emit(buf, "%s\n%s",
|
||||||
virt_dev->scsi_device_name,
|
virt_dev->scsi_device_name,
|
||||||
virt_dev->scsi_device_name_set ? SCST_SYSFS_KEY_MARK "\n" : "");
|
virt_dev->scsi_device_name_set ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
read_unlock(&vdisk_serial_rwlock);
|
read_unlock(&vdisk_serial_rwlock);
|
||||||
@@ -8777,7 +8774,7 @@ static ssize_t vdev_sysfs_t10_dev_id_show(struct kobject *kobj, struct kobj_attr
|
|||||||
virt_dev = dev->dh_priv;
|
virt_dev = dev->dh_priv;
|
||||||
|
|
||||||
read_lock(&vdisk_serial_rwlock);
|
read_lock(&vdisk_serial_rwlock);
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s",
|
ret = sysfs_emit(buf, "%s\n%s",
|
||||||
virt_dev->t10_dev_id,
|
virt_dev->t10_dev_id,
|
||||||
virt_dev->t10_dev_id_set ? SCST_SYSFS_KEY_MARK "\n" : "");
|
virt_dev->t10_dev_id_set ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
read_unlock(&vdisk_serial_rwlock);
|
read_unlock(&vdisk_serial_rwlock);
|
||||||
@@ -8846,13 +8843,12 @@ static ssize_t vdev_sysfs_eui64_id_show(struct kobject *kobj,
|
|||||||
|
|
||||||
read_lock(&vdisk_serial_rwlock);
|
read_lock(&vdisk_serial_rwlock);
|
||||||
if (virt_dev->eui64_id_len)
|
if (virt_dev->eui64_id_len)
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "0x");
|
ret += sysfs_emit_at(buf, ret, "0x");
|
||||||
|
|
||||||
for (i = 0; i < virt_dev->eui64_id_len; i++)
|
for (i = 0; i < virt_dev->eui64_id_len; i++)
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "%02x",
|
ret += sysfs_emit_at(buf, ret, "%02x", virt_dev->eui64_id[i]);
|
||||||
virt_dev->eui64_id[i]);
|
|
||||||
|
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "\n%s",
|
ret += sysfs_emit_at(buf, ret, "\n%s",
|
||||||
virt_dev->eui64_id_len ? SCST_SYSFS_KEY_MARK "\n" : "");
|
virt_dev->eui64_id_len ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
read_unlock(&vdisk_serial_rwlock);
|
read_unlock(&vdisk_serial_rwlock);
|
||||||
|
|
||||||
@@ -8925,13 +8921,12 @@ static ssize_t vdev_sysfs_naa_id_show(struct kobject *kobj, struct kobj_attribut
|
|||||||
|
|
||||||
read_lock(&vdisk_serial_rwlock);
|
read_lock(&vdisk_serial_rwlock);
|
||||||
if (virt_dev->naa_id_len)
|
if (virt_dev->naa_id_len)
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "0x");
|
ret += sysfs_emit_at(buf, ret, "0x");
|
||||||
|
|
||||||
for (i = 0; i < virt_dev->naa_id_len; i++)
|
for (i = 0; i < virt_dev->naa_id_len; i++)
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "%02x",
|
ret += sysfs_emit_at(buf, ret, "%02x", virt_dev->naa_id[i]);
|
||||||
virt_dev->naa_id[i]);
|
|
||||||
|
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "\n%s",
|
ret += sysfs_emit_at(buf, ret, "\n%s",
|
||||||
virt_dev->naa_id_len ? SCST_SYSFS_KEY_MARK "\n" : "");
|
virt_dev->naa_id_len ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
read_unlock(&vdisk_serial_rwlock);
|
read_unlock(&vdisk_serial_rwlock);
|
||||||
|
|
||||||
@@ -9000,7 +8995,7 @@ static ssize_t vdev_sysfs_usn_show(struct kobject *kobj, struct kobj_attribute *
|
|||||||
virt_dev = dev->dh_priv;
|
virt_dev = dev->dh_priv;
|
||||||
|
|
||||||
read_lock(&vdisk_serial_rwlock);
|
read_lock(&vdisk_serial_rwlock);
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s",
|
ret = sysfs_emit(buf, "%s\n%s",
|
||||||
virt_dev->usn,
|
virt_dev->usn,
|
||||||
virt_dev->usn_set ? SCST_SYSFS_KEY_MARK "\n" : "");
|
virt_dev->usn_set ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
read_unlock(&vdisk_serial_rwlock);
|
read_unlock(&vdisk_serial_rwlock);
|
||||||
@@ -9050,7 +9045,7 @@ static ssize_t vdev_sysfs_inq_vend_specific_show(struct kobject *kobj,
|
|||||||
virt_dev = dev->dh_priv;
|
virt_dev = dev->dh_priv;
|
||||||
|
|
||||||
read_lock(&vdisk_serial_rwlock);
|
read_lock(&vdisk_serial_rwlock);
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%.*s\n%s",
|
ret = sysfs_emit(buf, "%.*s\n%s",
|
||||||
virt_dev->inq_vend_specific_len,
|
virt_dev->inq_vend_specific_len,
|
||||||
virt_dev->inq_vend_specific,
|
virt_dev->inq_vend_specific,
|
||||||
virt_dev->inq_vend_specific_len ? SCST_SYSFS_KEY_MARK "\n" : "");
|
virt_dev->inq_vend_specific_len ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
@@ -9069,7 +9064,7 @@ static ssize_t vdev_sysfs_active_show(struct kobject *kobj,
|
|||||||
dev = container_of(kobj, struct scst_device, dev_kobj);
|
dev = container_of(kobj, struct scst_device, dev_kobj);
|
||||||
virt_dev = dev->dh_priv;
|
virt_dev = dev->dh_priv;
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
return sysfs_emit(buf, "%d\n%s",
|
||||||
virt_dev->dev_active,
|
virt_dev->dev_active,
|
||||||
virt_dev->dev_active != DEF_DEV_ACTIVE ? SCST_SYSFS_KEY_MARK "\n" : "");
|
virt_dev->dev_active != DEF_DEV_ACTIVE ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
}
|
}
|
||||||
@@ -9188,7 +9183,7 @@ static ssize_t vdev_sysfs_bind_alua_state_show(struct kobject *kobj,
|
|||||||
bind_alua_state = virt_dev->bind_alua_state;
|
bind_alua_state = virt_dev->bind_alua_state;
|
||||||
spin_unlock(&virt_dev->flags_lock);
|
spin_unlock(&virt_dev->flags_lock);
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
ret = sysfs_emit(buf, "%d\n%s",
|
||||||
bind_alua_state,
|
bind_alua_state,
|
||||||
bind_alua_state != DEF_BIND_ALUA_STATE ? SCST_SYSFS_KEY_MARK "\n" : "");
|
bind_alua_state != DEF_BIND_ALUA_STATE ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
|
|
||||||
@@ -9255,7 +9250,7 @@ static ssize_t vdev_async_show(struct kobject *kobj,
|
|||||||
container_of(kobj, struct scst_device, dev_kobj);
|
container_of(kobj, struct scst_device, dev_kobj);
|
||||||
struct scst_vdisk_dev *virt_dev = dev->dh_priv;
|
struct scst_vdisk_dev *virt_dev = dev->dh_priv;
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
return sysfs_emit(buf, "%d\n%s",
|
||||||
virt_dev->async,
|
virt_dev->async,
|
||||||
virt_dev->async ? SCST_SYSFS_KEY_MARK "\n" : "");
|
virt_dev->async ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
}
|
}
|
||||||
@@ -9271,7 +9266,7 @@ static ssize_t vdev_dif_filename_show(struct kobject *kobj, struct kobj_attribut
|
|||||||
dev = container_of(kobj, struct scst_device, dev_kobj);
|
dev = container_of(kobj, struct scst_device, dev_kobj);
|
||||||
virt_dev = dev->dh_priv;
|
virt_dev = dev->dh_priv;
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s",
|
ret = sysfs_emit(buf, "%s\n%s",
|
||||||
virt_dev->dif_filename,
|
virt_dev->dif_filename,
|
||||||
virt_dev->dif_filename ? SCST_SYSFS_KEY_MARK "\n" : "");
|
virt_dev->dif_filename ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
|
|
||||||
@@ -9308,7 +9303,7 @@ static ssize_t vdev_lb_per_pb_exp_show(struct kobject *kobj, struct kobj_attribu
|
|||||||
container_of(kobj, struct scst_device, dev_kobj);
|
container_of(kobj, struct scst_device, dev_kobj);
|
||||||
struct scst_vdisk_dev *virt_dev = dev->dh_priv;
|
struct scst_vdisk_dev *virt_dev = dev->dh_priv;
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
return sysfs_emit(buf, "%d\n%s",
|
||||||
virt_dev->lb_per_pb_exp,
|
virt_dev->lb_per_pb_exp,
|
||||||
virt_dev->lb_per_pb_exp == DEF_LB_PER_PB_EXP ? "" :
|
virt_dev->lb_per_pb_exp == DEF_LB_PER_PB_EXP ? "" :
|
||||||
SCST_SYSFS_KEY_MARK "\n");
|
SCST_SYSFS_KEY_MARK "\n");
|
||||||
|
|||||||
@@ -3715,7 +3715,7 @@ static ssize_t scst_cm_allow_not_conn_copy_show(struct kobject *kobj, struct kob
|
|||||||
|
|
||||||
TRACE_ENTRY();
|
TRACE_ENTRY();
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
ret = sysfs_emit(buf, "%d\n%s",
|
||||||
scst_cm_allow_not_connected_copy,
|
scst_cm_allow_not_connected_copy,
|
||||||
scst_cm_allow_not_connected_copy == SCST_ALLOW_NOT_CONN_COPY_DEF ?
|
scst_cm_allow_not_connected_copy == SCST_ALLOW_NOT_CONN_COPY_DEF ?
|
||||||
"" : SCST_SYSFS_KEY_MARK "\n");
|
"" : SCST_SYSFS_KEY_MARK "\n");
|
||||||
|
|||||||
+6
-6
@@ -1925,10 +1925,10 @@ static ssize_t sgv_sysfs_stat_show(struct kobject *kobj, struct kobj_attribute *
|
|||||||
merged += atomic_read(&pool->cache_acc[i].merged);
|
merged += atomic_read(&pool->cache_acc[i].merged);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%-30s %-11s %-11s %-11s %-11s",
|
ret = sysfs_emit(buf, "%-30s %-11s %-11s %-11s %-11s",
|
||||||
"Name", "Hit", "Total", "% merged", "Cached (P/I/O)");
|
"Name", "Hit", "Total", "% merged", "Cached (P/I/O)");
|
||||||
|
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret,
|
ret += sysfs_emit_at(buf, ret,
|
||||||
"\n%-30s %-11d %-11d %-11d %d/%d/%d\n",
|
"\n%-30s %-11d %-11d %-11d %d/%d/%d\n",
|
||||||
pool->name, hit, total,
|
pool->name, hit, total,
|
||||||
allocated != 0 ? merged * 100 / allocated : 0,
|
allocated != 0 ? merged * 100 / allocated : 0,
|
||||||
@@ -1941,7 +1941,7 @@ static ssize_t sgv_sysfs_stat_show(struct kobject *kobj, struct kobj_attribute *
|
|||||||
allocated = t * (1 << i);
|
allocated = t * (1 << i);
|
||||||
merged = atomic_read(&pool->cache_acc[i].merged);
|
merged = atomic_read(&pool->cache_acc[i].merged);
|
||||||
|
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret,
|
ret += sysfs_emit_at(buf, ret,
|
||||||
" %-28s %-11d %-11d %d\n",
|
" %-28s %-11d %-11d %d\n",
|
||||||
pool->cache_names[i],
|
pool->cache_names[i],
|
||||||
atomic_read(&pool->cache_acc[i].hit_alloc),
|
atomic_read(&pool->cache_acc[i].hit_alloc),
|
||||||
@@ -1954,7 +1954,7 @@ static ssize_t sgv_sysfs_stat_show(struct kobject *kobj, struct kobj_attribute *
|
|||||||
oa = atomic_read(&pool->other_pages);
|
oa = atomic_read(&pool->other_pages);
|
||||||
om = atomic_read(&pool->other_merged);
|
om = atomic_read(&pool->other_merged);
|
||||||
|
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret,
|
ret += sysfs_emit_at(buf, ret,
|
||||||
" %-40s %d/%-9d %d/%d\n", "big/other",
|
" %-40s %d/%-9d %d/%d\n", "big/other",
|
||||||
atomic_read(&pool->big_alloc), atomic_read(&pool->other_alloc),
|
atomic_read(&pool->big_alloc), atomic_read(&pool->other_alloc),
|
||||||
allocated != 0 ? merged * 100 / allocated : 0,
|
allocated != 0 ? merged * 100 / allocated : 0,
|
||||||
@@ -2008,10 +2008,10 @@ static ssize_t sgv_sysfs_global_stat_show(struct kobject *kobj, struct kobj_attr
|
|||||||
spin_unlock_bh(&sgv_pools_lock);
|
spin_unlock_bh(&sgv_pools_lock);
|
||||||
|
|
||||||
#ifdef CONFIG_SCST_NO_TOTAL_MEM_CHECKS
|
#ifdef CONFIG_SCST_NO_TOTAL_MEM_CHECKS
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%-42s %d\n", "Inactive pages",
|
ret = sysfs_emit(buf, "%-42s %d\n", "Inactive pages",
|
||||||
inactive_pages);
|
inactive_pages);
|
||||||
#else
|
#else
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%-42s %d/%d\n%-42s %d/%d\n%-42s %d/%d\n"
|
ret = sysfs_emit(buf, "%-42s %d/%d\n%-42s %d/%d\n%-42s %d/%d\n"
|
||||||
"%-42s %-11d\n",
|
"%-42s %-11d\n",
|
||||||
"Inactive/active pages", inactive_pages,
|
"Inactive/active pages", inactive_pages,
|
||||||
atomic_read(&sgv_pages_total) - inactive_pages,
|
atomic_read(&sgv_pages_total) - inactive_pages,
|
||||||
|
|||||||
+124
-155
@@ -142,7 +142,7 @@ static ssize_t scst_read_trace_tbl(const struct scst_trace_log *tbl, char *buf,
|
|||||||
|
|
||||||
while (t->token) {
|
while (t->token) {
|
||||||
if (log_level & t->val)
|
if (log_level & t->val)
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "%s%s",
|
ret += sysfs_emit_at(buf, ret, "%s%s",
|
||||||
ret == 0 ? "" : " | ", t->token);
|
ret == 0 ? "" : " | ", t->token);
|
||||||
t++;
|
t++;
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ static ssize_t scst_trace_level_show(const struct scst_trace_log *local_tbl,
|
|||||||
ret += scst_read_trace_tbl(scst_trace_tbl, buf, log_level, ret);
|
ret += scst_read_trace_tbl(scst_trace_tbl, buf, log_level, ret);
|
||||||
ret += scst_read_trace_tbl(local_tbl, buf, log_level, ret);
|
ret += scst_read_trace_tbl(local_tbl, buf, log_level, ret);
|
||||||
|
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret,
|
ret += sysfs_emit_at(buf, ret,
|
||||||
"\n\n\nUsage:\n"
|
"\n\n\nUsage:\n"
|
||||||
" echo \"all|none|default\" >trace_level\n"
|
" echo \"all|none|default\" >trace_level\n"
|
||||||
" echo \"value DEC|0xHEX|0OCT\" >trace_level\n"
|
" echo \"value DEC|0xHEX|0OCT\" >trace_level\n"
|
||||||
@@ -849,7 +849,7 @@ static ssize_t scst_tgtt_mgmt_show(struct kobject *kobj, struct kobj_attribute *
|
|||||||
|
|
||||||
tgtt = container_of(kobj, struct scst_tgt_template, tgtt_kobj);
|
tgtt = container_of(kobj, struct scst_tgt_template, tgtt_kobj);
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, help,
|
return sysfs_emit(buf, help,
|
||||||
tgtt->tgtt_optional_attributes ?
|
tgtt->tgtt_optional_attributes ?
|
||||||
" echo \"add_attribute <attribute> <value>\" >mgmt\n"
|
" echo \"add_attribute <attribute> <value>\" >mgmt\n"
|
||||||
" echo \"del_attribute <attribute> <value>\" >mgmt\n" : "",
|
" echo \"del_attribute <attribute> <value>\" >mgmt\n" : "",
|
||||||
@@ -989,42 +989,35 @@ static ssize_t scst_tgtt_dif_capable_show(struct kobject *kobj, struct kobj_attr
|
|||||||
|
|
||||||
EXTRACHECKS_BUG_ON(!tgtt->dif_supported);
|
EXTRACHECKS_BUG_ON(!tgtt->dif_supported);
|
||||||
|
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret,
|
ret += sysfs_emit_at(buf, ret, "dif_supported");
|
||||||
"dif_supported");
|
|
||||||
|
|
||||||
if (tgtt->hw_dif_type1_supported)
|
if (tgtt->hw_dif_type1_supported)
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret,
|
ret += sysfs_emit_at(buf, ret, ", hw_dif_type1_supported");
|
||||||
", hw_dif_type1_supported");
|
|
||||||
|
|
||||||
if (tgtt->hw_dif_type2_supported)
|
if (tgtt->hw_dif_type2_supported)
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret,
|
ret += sysfs_emit_at(buf, ret, ", hw_dif_type2_supported");
|
||||||
", hw_dif_type2_supported");
|
|
||||||
|
|
||||||
if (tgtt->hw_dif_type3_supported)
|
if (tgtt->hw_dif_type3_supported)
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret,
|
ret += sysfs_emit_at(buf, ret, ", hw_dif_type3_supported");
|
||||||
", hw_dif_type3_supported");
|
|
||||||
|
|
||||||
if (tgtt->hw_dif_ip_supported)
|
if (tgtt->hw_dif_ip_supported)
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret,
|
ret += sysfs_emit_at(buf, ret, ", hw_dif_ip_supported");
|
||||||
", hw_dif_ip_supported");
|
|
||||||
|
|
||||||
if (tgtt->hw_dif_same_sg_layout_required)
|
if (tgtt->hw_dif_same_sg_layout_required)
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret,
|
ret += sysfs_emit_at(buf, ret, ", hw_dif_same_sg_layout_required");
|
||||||
", hw_dif_same_sg_layout_required");
|
|
||||||
|
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "\n");
|
ret += sysfs_emit_at(buf, ret, "\n");
|
||||||
|
|
||||||
if (tgtt->supported_dif_block_sizes) {
|
if (tgtt->supported_dif_block_sizes) {
|
||||||
const int *p = tgtt->supported_dif_block_sizes;
|
const int *p = tgtt->supported_dif_block_sizes;
|
||||||
ssize_t pos;
|
ssize_t pos;
|
||||||
|
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret,
|
ret += sysfs_emit_at(buf, ret, "Supported blocks: ");
|
||||||
"Supported blocks: ");
|
|
||||||
pos = ret;
|
pos = ret;
|
||||||
|
|
||||||
while (*p != 0) {
|
while (*p != 0) {
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret,
|
ret += sysfs_emit_at(buf, ret, "%s%d",
|
||||||
"%s%d", ret == pos ? "" : ", ", *p);
|
ret == pos ? "" : ", ", *p);
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1492,9 +1485,9 @@ static ssize_t scst_luns_mgmt_show(struct kobject *kobj,
|
|||||||
" echo \"clear\" >mgmt\n"
|
" echo \"clear\" >mgmt\n"
|
||||||
"\n"
|
"\n"
|
||||||
"where parameters are one or more param_name=value pairs separated by ';'\n"
|
"where parameters are one or more param_name=value pairs separated by ';'\n"
|
||||||
"\nThe following parameters available: read_only\n";
|
"\nThe following parameters available: read_only";
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s", help);
|
return sysfs_emit(buf, "%s\n", help);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t scst_luns_mgmt_store(struct kobject *kobj,
|
static ssize_t scst_luns_mgmt_store(struct kobject *kobj,
|
||||||
@@ -1525,22 +1518,21 @@ static ssize_t __scst_acg_addr_method_show(struct scst_acg *acg, char *buf)
|
|||||||
|
|
||||||
switch (acg->addr_method) {
|
switch (acg->addr_method) {
|
||||||
case SCST_LUN_ADDR_METHOD_FLAT:
|
case SCST_LUN_ADDR_METHOD_FLAT:
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "FLAT\n");
|
ret = sysfs_emit(buf, "FLAT\n");
|
||||||
break;
|
break;
|
||||||
case SCST_LUN_ADDR_METHOD_PERIPHERAL:
|
case SCST_LUN_ADDR_METHOD_PERIPHERAL:
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "PERIPHERAL\n");
|
ret = sysfs_emit(buf, "PERIPHERAL\n");
|
||||||
break;
|
break;
|
||||||
case SCST_LUN_ADDR_METHOD_LUN:
|
case SCST_LUN_ADDR_METHOD_LUN:
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "LUN\n");
|
ret = sysfs_emit(buf, "LUN\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "UNKNOWN\n");
|
ret = sysfs_emit(buf, "UNKNOWN\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (acg->addr_method != acg->tgt->tgtt->preferred_addr_method)
|
if (acg->addr_method != acg->tgt->tgtt->preferred_addr_method)
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret,
|
ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK);
|
||||||
"%s\n", SCST_SYSFS_KEY_MARK);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -1604,18 +1596,18 @@ static ssize_t __scst_acg_io_grouping_type_show(struct scst_acg *acg, char *buf)
|
|||||||
|
|
||||||
switch (acg->acg_io_grouping_type) {
|
switch (acg->acg_io_grouping_type) {
|
||||||
case SCST_IO_GROUPING_AUTO:
|
case SCST_IO_GROUPING_AUTO:
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", SCST_IO_GROUPING_AUTO_STR);
|
ret = sysfs_emit(buf, "%s\n", SCST_IO_GROUPING_AUTO_STR);
|
||||||
break;
|
break;
|
||||||
case SCST_IO_GROUPING_THIS_GROUP_ONLY:
|
case SCST_IO_GROUPING_THIS_GROUP_ONLY:
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s\n",
|
ret = sysfs_emit(buf, "%s\n%s\n",
|
||||||
SCST_IO_GROUPING_THIS_GROUP_ONLY_STR, SCST_SYSFS_KEY_MARK);
|
SCST_IO_GROUPING_THIS_GROUP_ONLY_STR, SCST_SYSFS_KEY_MARK);
|
||||||
break;
|
break;
|
||||||
case SCST_IO_GROUPING_NEVER:
|
case SCST_IO_GROUPING_NEVER:
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s\n",
|
ret = sysfs_emit(buf, "%s\n%s\n",
|
||||||
SCST_IO_GROUPING_NEVER_STR, SCST_SYSFS_KEY_MARK);
|
SCST_IO_GROUPING_NEVER_STR, SCST_SYSFS_KEY_MARK);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s\n",
|
ret = sysfs_emit(buf, "%d\n%s\n",
|
||||||
acg->acg_io_grouping_type, SCST_SYSFS_KEY_MARK);
|
acg->acg_io_grouping_type, SCST_SYSFS_KEY_MARK);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1758,7 +1750,7 @@ static ssize_t __scst_acg_black_hole_show(struct scst_acg *acg, char *buf)
|
|||||||
{
|
{
|
||||||
int t = acg->acg_black_hole_type;
|
int t = acg->acg_black_hole_type;
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n", t);
|
return sysfs_emit(buf, "%d\n", t);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t __scst_acg_black_hole_store(struct scst_acg *acg, const char *buf, size_t count)
|
static ssize_t __scst_acg_black_hole_store(struct scst_acg *acg, const char *buf, size_t count)
|
||||||
@@ -1882,13 +1874,12 @@ static ssize_t __scst_acg_cpu_mask_show(struct scst_acg *acg, char *buf)
|
|||||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
|
||||||
ret = cpumask_scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, &acg->acg_cpu_mask);
|
ret = cpumask_scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, &acg->acg_cpu_mask);
|
||||||
#else
|
#else
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%*pb", cpumask_pr_args(&acg->acg_cpu_mask));
|
ret = sysfs_emit(buf, "%*pb", cpumask_pr_args(&acg->acg_cpu_mask));
|
||||||
#endif
|
#endif
|
||||||
if (!cpumask_equal(&acg->acg_cpu_mask, &default_cpu_mask))
|
if (!cpumask_equal(&acg->acg_cpu_mask, &default_cpu_mask))
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret,
|
ret += sysfs_emit_at(buf, ret, "\n%s\n", SCST_SYSFS_KEY_MARK);
|
||||||
"\n%s\n", SCST_SYSFS_KEY_MARK);
|
|
||||||
else
|
else
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "\n");
|
ret += sysfs_emit_at(buf, ret, "\n");
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -2047,9 +2038,9 @@ static ssize_t scst_ini_group_mgmt_show(struct kobject *kobj, struct kobj_attrib
|
|||||||
{
|
{
|
||||||
static const char help[] =
|
static const char help[] =
|
||||||
"Usage: echo \"create GROUP_NAME\" >mgmt\n"
|
"Usage: echo \"create GROUP_NAME\" >mgmt\n"
|
||||||
" echo \"del GROUP_NAME\" >mgmt\n";
|
" echo \"del GROUP_NAME\" >mgmt";
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s", help);
|
return sysfs_emit(buf, "%s\n", help);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int scst_process_ini_group_mgmt_store(char *buffer, struct scst_tgt *tgt)
|
static int scst_process_ini_group_mgmt_store(char *buffer, struct scst_tgt *tgt)
|
||||||
@@ -2202,7 +2193,7 @@ static ssize_t scst_tgt_enable_show(struct kobject *kobj, struct kobj_attribute
|
|||||||
|
|
||||||
enabled = tgt->tgtt->is_target_enabled(tgt);
|
enabled = tgt->tgtt->is_target_enabled(tgt);
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n", enabled ? 1 : 0);
|
ret = sysfs_emit(buf, "%d\n", enabled ? 1 : 0);
|
||||||
|
|
||||||
TRACE_EXIT_RES(ret);
|
TRACE_EXIT_RES(ret);
|
||||||
return ret;
|
return ret;
|
||||||
@@ -2312,7 +2303,7 @@ static ssize_t scst_rel_tgt_id_show(struct kobject *kobj, struct kobj_attribute
|
|||||||
|
|
||||||
tgt = container_of(kobj, struct scst_tgt, tgt_kobj);
|
tgt = container_of(kobj, struct scst_tgt, tgt_kobj);
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
ret = sysfs_emit(buf, "%d\n%s",
|
||||||
tgt->rel_tgt_id,
|
tgt->rel_tgt_id,
|
||||||
tgt->rel_tgt_id != 0 ? SCST_SYSFS_KEY_MARK "\n" : "");
|
tgt->rel_tgt_id != 0 ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
|
|
||||||
@@ -2417,7 +2408,7 @@ static ssize_t scst_tgt_forward_src_show(struct kobject *kobj, struct kobj_attri
|
|||||||
{
|
{
|
||||||
struct scst_tgt *tgt = container_of(kobj, struct scst_tgt, tgt_kobj);
|
struct scst_tgt *tgt = container_of(kobj, struct scst_tgt, tgt_kobj);
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
return sysfs_emit(buf, "%d\n%s",
|
||||||
tgt->tgt_forward_src,
|
tgt->tgt_forward_src,
|
||||||
tgt->tgt_forward_src ? SCST_SYSFS_KEY_MARK "\n" : "");
|
tgt->tgt_forward_src ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
}
|
}
|
||||||
@@ -2460,7 +2451,7 @@ static ssize_t scst_tgt_forward_dst_show(struct kobject *kobj, struct kobj_attri
|
|||||||
|
|
||||||
tgt = container_of(kobj, struct scst_tgt, tgt_kobj);
|
tgt = container_of(kobj, struct scst_tgt, tgt_kobj);
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
ret = sysfs_emit(buf, "%d\n%s",
|
||||||
tgt->tgt_forward_dst,
|
tgt->tgt_forward_dst,
|
||||||
tgt->tgt_forward_dst ? SCST_SYSFS_KEY_MARK "\n" : "");
|
tgt->tgt_forward_dst ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
|
|
||||||
@@ -2561,7 +2552,7 @@ static ssize_t scst_tgt_aen_disabled_show(struct kobject *kobj, struct kobj_attr
|
|||||||
|
|
||||||
tgt = container_of(kobj, struct scst_tgt, tgt_kobj);
|
tgt = container_of(kobj, struct scst_tgt, tgt_kobj);
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
ret = sysfs_emit(buf, "%d\n%s",
|
||||||
tgt->tgt_aen_disabled,
|
tgt->tgt_aen_disabled,
|
||||||
tgt->tgt_aen_disabled ? SCST_SYSFS_KEY_MARK "\n" : "");
|
tgt->tgt_aen_disabled ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
|
|
||||||
@@ -2659,8 +2650,8 @@ static ssize_t scst_tgt_comment_show(struct kobject *kobj, struct kobj_attribute
|
|||||||
tgt = container_of(kobj, struct scst_tgt, tgt_kobj);
|
tgt = container_of(kobj, struct scst_tgt, tgt_kobj);
|
||||||
|
|
||||||
if (tgt->tgt_comment)
|
if (tgt->tgt_comment)
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s",
|
ret = sysfs_emit(buf, "%s\n%s\n",
|
||||||
tgt->tgt_comment, SCST_SYSFS_KEY_MARK "\n");
|
tgt->tgt_comment, SCST_SYSFS_KEY_MARK);
|
||||||
else
|
else
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
@@ -2752,40 +2743,34 @@ static ssize_t scst_tgt_dif_capable_show(struct kobject *kobj, struct kobj_attri
|
|||||||
|
|
||||||
EXTRACHECKS_BUG_ON(!tgt->tgt_dif_supported);
|
EXTRACHECKS_BUG_ON(!tgt->tgt_dif_supported);
|
||||||
|
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "dif_supported");
|
ret += sysfs_emit_at(buf, ret, "dif_supported");
|
||||||
|
|
||||||
if (tgt->tgt_hw_dif_type1_supported)
|
if (tgt->tgt_hw_dif_type1_supported)
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret,
|
ret += sysfs_emit_at(buf, ret, ", hw_dif_type1_supported");
|
||||||
", hw_dif_type1_supported");
|
|
||||||
|
|
||||||
if (tgt->tgt_hw_dif_type2_supported)
|
if (tgt->tgt_hw_dif_type2_supported)
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret,
|
ret += sysfs_emit_at(buf, ret, ", hw_dif_type2_supported");
|
||||||
", hw_dif_type2_supported");
|
|
||||||
|
|
||||||
if (tgt->tgt_hw_dif_type3_supported)
|
if (tgt->tgt_hw_dif_type3_supported)
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret,
|
ret += sysfs_emit_at(buf, ret, ", hw_dif_type3_supported");
|
||||||
", hw_dif_type3_supported");
|
|
||||||
|
|
||||||
if (tgt->tgt_hw_dif_ip_supported)
|
if (tgt->tgt_hw_dif_ip_supported)
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret,
|
ret += sysfs_emit_at(buf, ret, ", hw_dif_ip_supported");
|
||||||
", hw_dif_ip_supported");
|
|
||||||
|
|
||||||
if (tgt->tgt_hw_dif_same_sg_layout_required)
|
if (tgt->tgt_hw_dif_same_sg_layout_required)
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret,
|
ret += sysfs_emit_at(buf, ret, ", hw_dif_same_sg_layout_required");
|
||||||
", hw_dif_same_sg_layout_required");
|
|
||||||
|
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "\n");
|
ret += sysfs_emit_at(buf, ret, "\n");
|
||||||
|
|
||||||
if (tgt->tgt_supported_dif_block_sizes) {
|
if (tgt->tgt_supported_dif_block_sizes) {
|
||||||
const int *p = tgt->tgt_supported_dif_block_sizes;
|
const int *p = tgt->tgt_supported_dif_block_sizes;
|
||||||
ssize_t pos;
|
ssize_t pos;
|
||||||
|
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "Supported blocks: ");
|
ret += sysfs_emit_at(buf, ret, "Supported blocks: ");
|
||||||
pos = ret;
|
pos = ret;
|
||||||
|
|
||||||
while (*p != 0) {
|
while (*p != 0) {
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret,
|
ret += sysfs_emit_at(buf, ret, "%s%d", ret == pos ? "" : ", ", *p);
|
||||||
"%s%d", ret == pos ? "" : ", ", *p);
|
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2804,7 +2789,7 @@ static ssize_t scst_tgt_dif_checks_failed_show(struct kobject *kobj, struct kobj
|
|||||||
|
|
||||||
tgt = container_of(kobj, struct scst_tgt, tgt_kobj);
|
tgt = container_of(kobj, struct scst_tgt, tgt_kobj);
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE,
|
return sysfs_emit(buf,
|
||||||
"\tapp\tref\tguard\ntgt\t%d\t%d\t%d\nscst\t%d\t%d\t%d\ndev\t%d\t%d\t%d\n",
|
"\tapp\tref\tguard\ntgt\t%d\t%d\t%d\nscst\t%d\t%d\t%d\ndev\t%d\t%d\t%d\n",
|
||||||
atomic_read(&tgt->tgt_dif_app_failed_tgt),
|
atomic_read(&tgt->tgt_dif_app_failed_tgt),
|
||||||
atomic_read(&tgt->tgt_dif_ref_failed_tgt),
|
atomic_read(&tgt->tgt_dif_ref_failed_tgt),
|
||||||
@@ -2889,7 +2874,7 @@ static ssize_t scst_tgt_sysfs_##attr##_show(struct kobject *kobj, \
|
|||||||
scst_sysfs_work_get(work); \
|
scst_sysfs_work_get(work); \
|
||||||
res = scst_sysfs_queue_wait_work(work); \
|
res = scst_sysfs_queue_wait_work(work); \
|
||||||
if (res == 0) \
|
if (res == 0) \
|
||||||
res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s", work->res_buf); \
|
res = sysfs_emit(buf, "%s", work->res_buf); \
|
||||||
scst_sysfs_work_put(work); \
|
scst_sysfs_work_put(work); \
|
||||||
\
|
\
|
||||||
out: \
|
out: \
|
||||||
@@ -3095,7 +3080,7 @@ static ssize_t scst_dev_sysfs_type_show(struct kobject *kobj, struct kobj_attrib
|
|||||||
|
|
||||||
dev = container_of(kobj, struct scst_device, dev_kobj);
|
dev = container_of(kobj, struct scst_device, dev_kobj);
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d - %s\n",
|
return sysfs_emit(buf, "%d - %s\n",
|
||||||
dev->type,
|
dev->type,
|
||||||
(unsigned int)dev->type >= ARRAY_SIZE(scst_dev_handler_types) ?
|
(unsigned int)dev->type >= ARRAY_SIZE(scst_dev_handler_types) ?
|
||||||
"unknown" : scst_dev_handler_types[dev->type]);
|
"unknown" : scst_dev_handler_types[dev->type]);
|
||||||
@@ -3116,7 +3101,7 @@ static ssize_t scst_dev_sysfs_pr_file_name_show(struct kobject *kobj,
|
|||||||
res = mutex_lock_interruptible(&dev->dev_pr_mutex);
|
res = mutex_lock_interruptible(&dev->dev_pr_mutex);
|
||||||
if (res != 0)
|
if (res != 0)
|
||||||
goto out;
|
goto out;
|
||||||
res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s",
|
res = sysfs_emit(buf, "%s\n%s",
|
||||||
dev->pr_file_name ? : "",
|
dev->pr_file_name ? : "",
|
||||||
dev->pr_file_name_is_set ? SCST_SYSFS_KEY_MARK "\n" : "");
|
dev->pr_file_name_is_set ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
mutex_unlock(&dev->dev_pr_mutex);
|
mutex_unlock(&dev->dev_pr_mutex);
|
||||||
@@ -3357,7 +3342,7 @@ static ssize_t scst_dev_sysfs_threads_num_show(struct kobject *kobj, struct kobj
|
|||||||
|
|
||||||
dev = container_of(kobj, struct scst_device, dev_kobj);
|
dev = container_of(kobj, struct scst_device, dev_kobj);
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
ret = sysfs_emit(buf, "%d\n%s",
|
||||||
dev->threads_num,
|
dev->threads_num,
|
||||||
dev->threads_num != dev->handler->threads_num ?
|
dev->threads_num != dev->handler->threads_num ?
|
||||||
SCST_SYSFS_KEY_MARK "\n" : "");
|
SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
@@ -3427,28 +3412,28 @@ static ssize_t scst_dev_sysfs_threads_pool_type_show(struct kobject *kobj,
|
|||||||
dev = container_of(kobj, struct scst_device, dev_kobj);
|
dev = container_of(kobj, struct scst_device, dev_kobj);
|
||||||
|
|
||||||
if (dev->threads_num == 0) {
|
if (dev->threads_num == 0) {
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "Async\n");
|
ret = sysfs_emit(buf, "Async\n");
|
||||||
goto out;
|
goto out;
|
||||||
} else if (dev->threads_num < 0) {
|
} else if (dev->threads_num < 0) {
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "Not valid\n");
|
ret = sysfs_emit(buf, "Not valid\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (dev->threads_pool_type) {
|
switch (dev->threads_pool_type) {
|
||||||
case SCST_THREADS_POOL_PER_INITIATOR:
|
case SCST_THREADS_POOL_PER_INITIATOR:
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s",
|
ret = sysfs_emit(buf, "%s\n%s",
|
||||||
SCST_THREADS_POOL_PER_INITIATOR_STR,
|
SCST_THREADS_POOL_PER_INITIATOR_STR,
|
||||||
dev->threads_pool_type != dev->handler->threads_pool_type ?
|
dev->threads_pool_type != dev->handler->threads_pool_type ?
|
||||||
SCST_SYSFS_KEY_MARK "\n" : "");
|
SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
break;
|
break;
|
||||||
case SCST_THREADS_POOL_SHARED:
|
case SCST_THREADS_POOL_SHARED:
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s",
|
ret = sysfs_emit(buf, "%s\n%s",
|
||||||
SCST_THREADS_POOL_SHARED_STR,
|
SCST_THREADS_POOL_SHARED_STR,
|
||||||
dev->threads_pool_type != dev->handler->threads_pool_type ?
|
dev->threads_pool_type != dev->handler->threads_pool_type ?
|
||||||
SCST_SYSFS_KEY_MARK "\n" : "");
|
SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "Unknown\n");
|
ret = sysfs_emit(buf, "Unknown\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3516,7 +3501,7 @@ static ssize_t scst_dev_sysfs_max_tgt_dev_commands_show(struct kobject *kobj,
|
|||||||
|
|
||||||
dev = container_of(kobj, struct scst_device, dev_kobj);
|
dev = container_of(kobj, struct scst_device, dev_kobj);
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
ret = sysfs_emit(buf, "%d\n%s",
|
||||||
dev->max_tgt_dev_commands,
|
dev->max_tgt_dev_commands,
|
||||||
dev->max_tgt_dev_commands != dev->handler->max_tgt_dev_commands ?
|
dev->max_tgt_dev_commands != dev->handler->max_tgt_dev_commands ?
|
||||||
SCST_SYSFS_KEY_MARK "\n" : "");
|
SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
@@ -3576,7 +3561,7 @@ static ssize_t scst_dev_numa_node_id_show(struct kobject *kobj, struct kobj_attr
|
|||||||
|
|
||||||
dev = container_of(kobj, struct scst_device, dev_kobj);
|
dev = container_of(kobj, struct scst_device, dev_kobj);
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
ret = sysfs_emit(buf, "%d\n%s",
|
||||||
dev->dev_numa_node_id,
|
dev->dev_numa_node_id,
|
||||||
dev->dev_numa_node_id != NUMA_NO_NODE ? SCST_SYSFS_KEY_MARK "\n" : "");
|
dev->dev_numa_node_id != NUMA_NO_NODE ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
|
|
||||||
@@ -3634,7 +3619,7 @@ static ssize_t scst_dev_block_show(struct kobject *kobj, struct kobj_attribute *
|
|||||||
|
|
||||||
dev = container_of(kobj, struct scst_device, dev_kobj);
|
dev = container_of(kobj, struct scst_device, dev_kobj);
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d %d\n",
|
ret = sysfs_emit(buf, "%d %d\n",
|
||||||
READ_ONCE(dev->ext_blocks_cnt), dev->ext_blocking_pending);
|
READ_ONCE(dev->ext_blocks_cnt), dev->ext_blocking_pending);
|
||||||
|
|
||||||
TRACE_EXIT_RES(ret);
|
TRACE_EXIT_RES(ret);
|
||||||
@@ -3981,30 +3966,26 @@ static ssize_t scst_dev_dif_mode_show(struct kobject *kobj, struct kobj_attribut
|
|||||||
dev = container_of(kobj, struct scst_device, dev_kobj);
|
dev = container_of(kobj, struct scst_device, dev_kobj);
|
||||||
|
|
||||||
if (dev->dev_dif_mode == SCST_DIF_MODE_NONE) {
|
if (dev->dev_dif_mode == SCST_DIF_MODE_NONE) {
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "None\n");
|
ret = sysfs_emit(buf, "None\n");
|
||||||
} else {
|
} else {
|
||||||
ssize_t pos = ret;
|
ssize_t pos = ret;
|
||||||
|
|
||||||
if (dev->dev_dif_mode & SCST_DIF_MODE_TGT)
|
if (dev->dev_dif_mode & SCST_DIF_MODE_TGT)
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret,
|
ret += sysfs_emit_at(buf, ret, "%s", SCST_DIF_MODE_TGT_STR);
|
||||||
"%s", SCST_DIF_MODE_TGT_STR);
|
|
||||||
|
|
||||||
if (dev->dev_dif_mode & SCST_DIF_MODE_SCST)
|
if (dev->dev_dif_mode & SCST_DIF_MODE_SCST)
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret,
|
ret += sysfs_emit_at(buf, ret, "%s%s",
|
||||||
"%s%s", ret == pos ? "" : "|", SCST_DIF_MODE_SCST_STR);
|
ret == pos ? "" : "|", SCST_DIF_MODE_SCST_STR);
|
||||||
|
|
||||||
if (dev->dev_dif_mode & SCST_DIF_MODE_DEV_CHECK)
|
if (dev->dev_dif_mode & SCST_DIF_MODE_DEV_CHECK)
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret,
|
ret += sysfs_emit_at(buf, ret, "%s%s",
|
||||||
"%s%s", ret == pos ? "" : "|",
|
ret == pos ? "" : "|", SCST_DIF_MODE_DEV_CHECK_STR);
|
||||||
SCST_DIF_MODE_DEV_CHECK_STR);
|
|
||||||
|
|
||||||
if (dev->dev_dif_mode & SCST_DIF_MODE_DEV_STORE)
|
if (dev->dev_dif_mode & SCST_DIF_MODE_DEV_STORE)
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret,
|
ret += sysfs_emit_at(buf, ret, "%s%s",
|
||||||
"%s%s", ret == pos ? "" : "|",
|
ret == pos ? "" : "|", SCST_DIF_MODE_DEV_STORE_STR);
|
||||||
SCST_DIF_MODE_DEV_STORE_STR);
|
|
||||||
|
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret,
|
ret += sysfs_emit_at(buf, ret, "\n%s\n", SCST_SYSFS_KEY_MARK);
|
||||||
"\n%s", SCST_SYSFS_KEY_MARK "\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE_EXIT_RES(ret);
|
TRACE_EXIT_RES(ret);
|
||||||
@@ -4023,7 +4004,7 @@ static ssize_t scst_dev_dif_type_show(struct kobject *kobj, struct kobj_attribut
|
|||||||
|
|
||||||
dev = container_of(kobj, struct scst_device, dev_kobj);
|
dev = container_of(kobj, struct scst_device, dev_kobj);
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
ret = sysfs_emit(buf, "%d\n%s",
|
||||||
dev->dev_dif_type,
|
dev->dev_dif_type,
|
||||||
dev->dev_dif_type != 0 ? SCST_SYSFS_KEY_MARK "\n" : "");
|
dev->dev_dif_type != 0 ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
|
|
||||||
@@ -4079,9 +4060,9 @@ static ssize_t scst_dev_sysfs_dif_static_app_tag_show(struct kobject *kobj,
|
|||||||
|
|
||||||
a = scst_dev_get_dif_static_app_tag_combined(dev);
|
a = scst_dev_get_dif_static_app_tag_combined(dev);
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "0x%llx\n%s",
|
ret = sysfs_emit(buf, "0x%llx\n%s",
|
||||||
(unsigned long long)be64_to_cpu(a),
|
(unsigned long long)be64_to_cpu(a),
|
||||||
(a != SCST_DIF_NO_CHECK_APP_TAG) ? SCST_SYSFS_KEY_MARK "\n" : "");
|
a != SCST_DIF_NO_CHECK_APP_TAG ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
|
|
||||||
TRACE_EXIT_RES(ret);
|
TRACE_EXIT_RES(ret);
|
||||||
return ret;
|
return ret;
|
||||||
@@ -4139,7 +4120,7 @@ static ssize_t scst_tgt_dev_thread_index_show(struct kobject *kobj,
|
|||||||
struct scst_tgt_dev *tgt_dev =
|
struct scst_tgt_dev *tgt_dev =
|
||||||
container_of(kobj, struct scst_tgt_dev, tgt_dev_kobj);
|
container_of(kobj, struct scst_tgt_dev, tgt_dev_kobj);
|
||||||
|
|
||||||
return scnprintf(buffer, SCST_SYSFS_BLOCK_SIZE, "%d\n", tgt_dev->thread_index);
|
return sysfs_emit(buffer, "%d\n", tgt_dev->thread_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct kobj_attribute tgt_dev_thread_idx_attr =
|
static struct kobj_attribute tgt_dev_thread_idx_attr =
|
||||||
@@ -4157,7 +4138,7 @@ static ssize_t scst_tgt_dev_thread_pid_show(struct kobject *kobj,
|
|||||||
|
|
||||||
spin_lock(&cmd_threads->thr_lock);
|
spin_lock(&cmd_threads->thr_lock);
|
||||||
list_for_each_entry(t, &cmd_threads->threads_list, thread_list_entry)
|
list_for_each_entry(t, &cmd_threads->threads_list, thread_list_entry)
|
||||||
ret += scnprintf(buffer + ret, SCST_SYSFS_BLOCK_SIZE - ret, "%d%s",
|
ret += sysfs_emit_at(buffer, ret, "%d%s",
|
||||||
task_pid_vnr(t->cmd_thread),
|
task_pid_vnr(t->cmd_thread),
|
||||||
list_is_last(&t->thread_list_entry,
|
list_is_last(&t->thread_list_entry,
|
||||||
&cmd_threads->threads_list) ? "\n" : " ");
|
&cmd_threads->threads_list) ? "\n" : " ");
|
||||||
@@ -4176,7 +4157,7 @@ static ssize_t scst_tgt_dev_active_commands_show(struct kobject *kobj, struct ko
|
|||||||
|
|
||||||
tgt_dev = container_of(kobj, struct scst_tgt_dev, tgt_dev_kobj);
|
tgt_dev = container_of(kobj, struct scst_tgt_dev, tgt_dev_kobj);
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n",
|
return sysfs_emit(buf, "%d\n",
|
||||||
atomic_read(&tgt_dev->tgt_dev_cmd_count));
|
atomic_read(&tgt_dev->tgt_dev_cmd_count));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4190,7 +4171,7 @@ static ssize_t scst_tgt_dev_dif_checks_failed_show(struct kobject *kobj,
|
|||||||
|
|
||||||
tgt_dev = container_of(kobj, struct scst_tgt_dev, tgt_dev_kobj);
|
tgt_dev = container_of(kobj, struct scst_tgt_dev, tgt_dev_kobj);
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE,
|
return sysfs_emit(buf,
|
||||||
"\tapp\tref\tguard\ntgt\t%d\t%d\t%d\nscst\t%d\t%d\t%d\ndev\t%d\t%d\t%d\n",
|
"\tapp\tref\tguard\ntgt\t%d\t%d\t%d\nscst\t%d\t%d\t%d\ndev\t%d\t%d\t%d\n",
|
||||||
atomic_read(&tgt_dev->tgt_dev_dif_app_failed_tgt),
|
atomic_read(&tgt_dev->tgt_dev_dif_app_failed_tgt),
|
||||||
atomic_read(&tgt_dev->tgt_dev_dif_ref_failed_tgt),
|
atomic_read(&tgt_dev->tgt_dev_dif_ref_failed_tgt),
|
||||||
@@ -4385,8 +4366,7 @@ static ssize_t scst_sess_latency_show(struct kobject *kobj, struct kobj_attribut
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
res += scnprintf(buf + res, SCST_SYSFS_BLOCK_SIZE - res,
|
res += sysfs_emit_at(buf, res, "state count min max avg stddev\n");
|
||||||
"state count min max avg stddev\n");
|
|
||||||
|
|
||||||
spin_lock_irq(&sess->lat_stats_lock);
|
spin_lock_irq(&sess->lat_stats_lock);
|
||||||
for (k = 0; k < SCST_CMD_STATE_COUNT; k++) {
|
for (k = 0; k < SCST_CMD_STATE_COUNT; k++) {
|
||||||
@@ -4410,7 +4390,7 @@ static ssize_t scst_sess_latency_show(struct kobject *kobj, struct kobj_attribut
|
|||||||
avg_mod_10 = do_div(avg_div_10, 10);
|
avg_mod_10 = do_div(avg_div_10, 10);
|
||||||
stddev_div_10 = stddev;
|
stddev_div_10 = stddev;
|
||||||
stddev_mod_10 = do_div(stddev_div_10, 10);
|
stddev_mod_10 = do_div(stddev_div_10, 10);
|
||||||
res += scnprintf(buf + res, SCST_SYSFS_BLOCK_SIZE - res,
|
res += sysfs_emit_at(buf, res,
|
||||||
"%s %d %lld.%01d %lld.%01d %lld.%01d %lld.%01d us\n",
|
"%s %d %lld.%01d %lld.%01d %lld.%01d %lld.%01d us\n",
|
||||||
state_name, d->count,
|
state_name, d->count,
|
||||||
d_min_div_10, d_min_mod_10,
|
d_min_div_10, d_min_mod_10,
|
||||||
@@ -4422,7 +4402,7 @@ static ssize_t scst_sess_latency_show(struct kobject *kobj, struct kobj_attribut
|
|||||||
max = d->maxc * 10000 / (tsc_khz / 100);
|
max = d->maxc * 10000 / (tsc_khz / 100);
|
||||||
avg = d->sumc * 10000 / (d->count * 1ull * tsc_khz / 100);
|
avg = d->sumc * 10000 / (d->count * 1ull * tsc_khz / 100);
|
||||||
stddev = calc_stddev(d->sumsqc, d->sumc, d->count) * 1000000 / tsc_khz;
|
stddev = calc_stddev(d->sumsqc, d->sumc, d->count) * 1000000 / tsc_khz;
|
||||||
res += scnprintf(buf + res, SCST_SYSFS_BLOCK_SIZE - res,
|
res += sysfs_emit_at(buf, res,
|
||||||
"%s %d %lld.%01lld %lld.%01lld %lld.%01lld %lld.%01lld cc -> us\n",
|
"%s %d %lld.%01lld %lld.%01lld %lld.%01lld %lld.%01lld cc -> us\n",
|
||||||
state_name, d->count,
|
state_name, d->count,
|
||||||
min / 10, min % 10,
|
min / 10, min % 10,
|
||||||
@@ -4444,7 +4424,7 @@ static ssize_t scst_sess_latency_show(struct kobject *kobj, struct kobj_attribut
|
|||||||
#ifdef SCST_MEASURE_CLOCK_CYCLES
|
#ifdef SCST_MEASURE_CLOCK_CYCLES
|
||||||
avg = numst * sumc / (count * 1ull * tsc_khz / 1000000);
|
avg = numst * sumc / (count * 1ull * tsc_khz / 1000000);
|
||||||
stddev = calc_stddev(sumsqc, sumc, count) * numst * 1000000 / tsc_khz;
|
stddev = calc_stddev(sumsqc, sumc, count) * numst * 1000000 / tsc_khz;
|
||||||
res += scnprintf(buf + res, SCST_SYSFS_BLOCK_SIZE - res,
|
res += sysfs_emit_at(buf, res,
|
||||||
"total %d - - %lld.%01lld %lld.%01lld cc -> us\n",
|
"total %d - - %lld.%01lld %lld.%01lld cc -> us\n",
|
||||||
count / numst, avg / 10, avg % 10, stddev / 10,
|
count / numst, avg / 10, avg % 10, stddev / 10,
|
||||||
stddev % 10);
|
stddev % 10);
|
||||||
@@ -4456,7 +4436,7 @@ static ssize_t scst_sess_latency_show(struct kobject *kobj, struct kobj_attribut
|
|||||||
avg_mod_10 = do_div(avg_div_10, 10);
|
avg_mod_10 = do_div(avg_div_10, 10);
|
||||||
stddev_div_10 = stddev;
|
stddev_div_10 = stddev;
|
||||||
stddev_mod_10 = do_div(stddev_div_10, 10);
|
stddev_mod_10 = do_div(stddev_div_10, 10);
|
||||||
res += scnprintf(buf + res, SCST_SYSFS_BLOCK_SIZE - res,
|
res += sysfs_emit_at(buf, res,
|
||||||
"total %d - - %lld.%01d %lld.%01d us\n",
|
"total %d - - %lld.%01d %lld.%01d us\n",
|
||||||
count / numst, avg_div_10, avg_mod_10,
|
count / numst, avg_div_10, avg_mod_10,
|
||||||
stddev_div_10, stddev_mod_10);
|
stddev_div_10, stddev_mod_10);
|
||||||
@@ -4488,7 +4468,7 @@ static ssize_t scst_sess_sysfs_commands_show(struct kobject *kobj, struct kobj_a
|
|||||||
|
|
||||||
sess = container_of(kobj, struct scst_session, sess_kobj);
|
sess = container_of(kobj, struct scst_session, sess_kobj);
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n", atomic_read(&sess->sess_cmd_count));
|
return sysfs_emit(buf, "%d\n", atomic_read(&sess->sess_cmd_count));
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct kobj_attribute session_commands_attr =
|
static struct kobj_attribute session_commands_attr =
|
||||||
@@ -4544,7 +4524,7 @@ static ssize_t scst_sess_sysfs_active_commands_show(struct kobject *kobj,
|
|||||||
|
|
||||||
res = scst_sysfs_queue_wait_work(work);
|
res = scst_sysfs_queue_wait_work(work);
|
||||||
if (res != -EAGAIN)
|
if (res != -EAGAIN)
|
||||||
res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n", res);
|
res = sysfs_emit(buf, "%d\n", res);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
return res;
|
return res;
|
||||||
@@ -4619,7 +4599,7 @@ static ssize_t scst_sess_sysfs_dif_checks_failed_show(struct kobject *kobj,
|
|||||||
if (res != 0)
|
if (res != 0)
|
||||||
goto out_put;
|
goto out_put;
|
||||||
|
|
||||||
res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s", work->res_buf);
|
res = sysfs_emit(buf, "%s", work->res_buf);
|
||||||
|
|
||||||
out_put:
|
out_put:
|
||||||
scst_sysfs_work_put(work);
|
scst_sysfs_work_put(work);
|
||||||
@@ -4707,7 +4687,7 @@ static ssize_t scst_sess_sysfs_initiator_name_show(struct kobject *kobj,
|
|||||||
|
|
||||||
sess = container_of(kobj, struct scst_session, sess_kobj);
|
sess = container_of(kobj, struct scst_session, sess_kobj);
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", sess->initiator_name);
|
return sysfs_emit(buf, "%s\n", sess->initiator_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct kobj_attribute session_initiator_name_attr =
|
static struct kobj_attribute session_initiator_name_attr =
|
||||||
@@ -4732,7 +4712,7 @@ static ssize_t scst_sess_sysfs_##exported_name##_show(struct kobject *kobj, \
|
|||||||
v = sess->io_stats[dir].name; \
|
v = sess->io_stats[dir].name; \
|
||||||
if (kb) \
|
if (kb) \
|
||||||
v >>= 10; \
|
v >>= 10; \
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%llu\n", (unsigned long long)v); \
|
return sysfs_emit(buf, "%llu\n", (unsigned long long)v); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
static ssize_t scst_sess_sysfs_##exported_name##_store(struct kobject *kobj, \
|
static ssize_t scst_sess_sysfs_##exported_name##_store(struct kobject *kobj, \
|
||||||
@@ -5046,9 +5026,9 @@ static ssize_t scst_lun_rd_only_show(struct kobject *kobj, struct kobj_attribute
|
|||||||
acg_dev = container_of(kobj, struct scst_acg_dev, acg_dev_kobj);
|
acg_dev = container_of(kobj, struct scst_acg_dev, acg_dev_kobj);
|
||||||
|
|
||||||
if (acg_dev->acg_dev_rd_only || acg_dev->dev->dev_rd_only)
|
if (acg_dev->acg_dev_rd_only || acg_dev->dev->dev_rd_only)
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s\n", 1, SCST_SYSFS_KEY_MARK);
|
return sysfs_emit(buf, "%d\n%s\n", 1, SCST_SYSFS_KEY_MARK);
|
||||||
else
|
else
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n", 0);
|
return sysfs_emit(buf, "%d\n", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct kobj_attribute lun_options_attr =
|
static struct kobj_attribute lun_options_attr =
|
||||||
@@ -5170,9 +5150,9 @@ static ssize_t scst_acg_ini_mgmt_show(struct kobject *kobj, struct kobj_attribut
|
|||||||
"Usage: echo \"add INITIATOR_NAME\" >mgmt\n"
|
"Usage: echo \"add INITIATOR_NAME\" >mgmt\n"
|
||||||
" echo \"del INITIATOR_NAME\" >mgmt\n"
|
" echo \"del INITIATOR_NAME\" >mgmt\n"
|
||||||
" echo \"move INITIATOR_NAME DEST_GROUP_NAME\" >mgmt\n"
|
" echo \"move INITIATOR_NAME DEST_GROUP_NAME\" >mgmt\n"
|
||||||
" echo \"clear\" >mgmt\n";
|
" echo \"clear\" >mgmt";
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s", help);
|
return sysfs_emit(buf, "%s\n", help);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int scst_process_acg_ini_mgmt_store(char *buffer, struct scst_tgt *tgt,
|
static int scst_process_acg_ini_mgmt_store(char *buffer, struct scst_tgt *tgt,
|
||||||
@@ -5602,7 +5582,7 @@ out_del:
|
|||||||
|
|
||||||
static ssize_t scst_acn_file_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
|
static ssize_t scst_acn_file_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", attr->attr.name);
|
return sysfs_emit(buf, "%s\n", attr->attr.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int scst_acn_sysfs_create(struct scst_acn *acn)
|
int scst_acn_sysfs_create(struct scst_acn *acn)
|
||||||
@@ -5741,7 +5721,7 @@ static ssize_t scst_devt_type_show(struct kobject *kobj, struct kobj_attribute *
|
|||||||
|
|
||||||
devt = container_of(kobj, struct scst_dev_type, devt_kobj);
|
devt = container_of(kobj, struct scst_dev_type, devt_kobj);
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d - %s\n",
|
return sysfs_emit(buf, "%d - %s\n",
|
||||||
devt->type,
|
devt->type,
|
||||||
(unsigned int)devt->type >= ARRAY_SIZE(scst_dev_handler_types) ?
|
(unsigned int)devt->type >= ARRAY_SIZE(scst_dev_handler_types) ?
|
||||||
"unknown" : scst_dev_handler_types[devt->type]);
|
"unknown" : scst_dev_handler_types[devt->type]);
|
||||||
@@ -5807,7 +5787,7 @@ static ssize_t scst_devt_mgmt_show(struct kobject *kobj, struct kobj_attribute *
|
|||||||
|
|
||||||
devt = container_of(kobj, struct scst_dev_type, devt_kobj);
|
devt = container_of(kobj, struct scst_dev_type, devt_kobj);
|
||||||
p = scst_dev_params(devt);
|
p = scst_dev_params(devt);
|
||||||
res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, help,
|
res = sysfs_emit(buf, help,
|
||||||
devt->devt_optional_attributes ?
|
devt->devt_optional_attributes ?
|
||||||
" echo \"add_attribute <attribute> <value>\" >mgmt\n"
|
" echo \"add_attribute <attribute> <value>\" >mgmt\n"
|
||||||
" echo \"del_attribute <attribute> <value>\" >mgmt\n" : "",
|
" echo \"del_attribute <attribute> <value>\" >mgmt\n" : "",
|
||||||
@@ -5947,9 +5927,9 @@ static ssize_t scst_devt_pass_through_mgmt_show(struct kobject *kobj, struct kob
|
|||||||
{
|
{
|
||||||
static const char help[] =
|
static const char help[] =
|
||||||
"Usage: echo \"add_device H:C:I:L\" >mgmt\n"
|
"Usage: echo \"add_device H:C:I:L\" >mgmt\n"
|
||||||
" echo \"del_device H:C:I:L\" >mgmt\n";
|
" echo \"del_device H:C:I:L\" >mgmt";
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s", help);
|
return sysfs_emit(buf, "%s\n", help);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int scst_process_devt_pass_through_mgmt_store(char *buffer, struct scst_dev_type *devt)
|
static int scst_process_devt_pass_through_mgmt_store(char *buffer, struct scst_dev_type *devt)
|
||||||
@@ -6193,7 +6173,7 @@ static ssize_t scst_dg_devs_mgmt_show(struct kobject *kobj, struct kobj_attribut
|
|||||||
"Usage: echo \"add device\" >mgmt\n"
|
"Usage: echo \"add device\" >mgmt\n"
|
||||||
" echo \"del device\" >mgmt\n";
|
" echo \"del device\" >mgmt\n";
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, help);
|
return sysfs_emit(buf, help);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int scst_dg_devs_mgmt_store_work_fn(struct scst_sysfs_work_item *w)
|
static int scst_dg_devs_mgmt_store_work_fn(struct scst_sysfs_work_item *w)
|
||||||
@@ -6285,7 +6265,7 @@ static ssize_t scst_tg_tgt_rel_tgt_id_show(struct kobject *kobj,
|
|||||||
struct scst_tg_tgt *tg_tgt;
|
struct scst_tg_tgt *tg_tgt;
|
||||||
|
|
||||||
tg_tgt = container_of(kobj, struct scst_tg_tgt, kobj);
|
tg_tgt = container_of(kobj, struct scst_tg_tgt, kobj);
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%u\n" SCST_SYSFS_KEY_MARK "\n",
|
return sysfs_emit(buf, "%u\n" SCST_SYSFS_KEY_MARK "\n",
|
||||||
tg_tgt->rel_tgt_id);
|
tg_tgt->rel_tgt_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6374,7 +6354,7 @@ static ssize_t scst_tg_group_id_show(struct kobject *kobj,
|
|||||||
struct scst_target_group *tg;
|
struct scst_target_group *tg;
|
||||||
|
|
||||||
tg = container_of(kobj, struct scst_target_group, kobj);
|
tg = container_of(kobj, struct scst_target_group, kobj);
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%u\n" SCST_SYSFS_KEY_MARK "\n",
|
return sysfs_emit(buf, "%u\n" SCST_SYSFS_KEY_MARK "\n",
|
||||||
tg->group_id);
|
tg->group_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6414,7 +6394,7 @@ static ssize_t scst_tg_preferred_show(struct kobject *kobj,
|
|||||||
|
|
||||||
tg = container_of(kobj, struct scst_target_group, kobj);
|
tg = container_of(kobj, struct scst_target_group, kobj);
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%u\n%s", tg->preferred,
|
return sysfs_emit(buf, "%u\n%s", tg->preferred,
|
||||||
tg->preferred ? SCST_SYSFS_KEY_MARK "\n" : "");
|
tg->preferred ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6487,7 +6467,7 @@ static ssize_t scst_tg_state_show(struct kobject *kobj,
|
|||||||
tg = container_of(kobj, struct scst_target_group, kobj);
|
tg = container_of(kobj, struct scst_target_group, kobj);
|
||||||
n = scst_alua_state_name(tg->state);
|
n = scst_alua_state_name(tg->state);
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n" SCST_SYSFS_KEY_MARK "\n",
|
return sysfs_emit(buf, "%s\n" SCST_SYSFS_KEY_MARK "\n",
|
||||||
n ? n : "???");
|
n ? n : "???");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6565,7 +6545,7 @@ static ssize_t scst_tg_mgmt_show(struct kobject *kobj,
|
|||||||
"Usage: echo \"add target\" >mgmt\n"
|
"Usage: echo \"add target\" >mgmt\n"
|
||||||
" echo \"del target\" >mgmt\n";
|
" echo \"del target\" >mgmt\n";
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, help);
|
return sysfs_emit(buf, help);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int scst_tg_mgmt_store_work_fn(struct scst_sysfs_work_item *w)
|
static int scst_tg_mgmt_store_work_fn(struct scst_sysfs_work_item *w)
|
||||||
@@ -6687,7 +6667,7 @@ static ssize_t scst_dg_tgs_mgmt_show(struct kobject *kobj, struct kobj_attribute
|
|||||||
"Usage: echo \"create group_name\" >mgmt\n"
|
"Usage: echo \"create group_name\" >mgmt\n"
|
||||||
" echo \"del group_name\" >mgmt\n";
|
" echo \"del group_name\" >mgmt\n";
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, help);
|
return sysfs_emit(buf, help);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int scst_dg_tgs_mgmt_store_work_fn(struct scst_sysfs_work_item *w)
|
static int scst_dg_tgs_mgmt_store_work_fn(struct scst_sysfs_work_item *w)
|
||||||
@@ -6827,7 +6807,7 @@ static ssize_t scst_device_groups_mgmt_show(struct kobject *kobj,
|
|||||||
"Usage: echo \"create group_name\" >mgmt\n"
|
"Usage: echo \"create group_name\" >mgmt\n"
|
||||||
" echo \"del group_name\" >mgmt\n";
|
" echo \"del group_name\" >mgmt\n";
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, help);
|
return sysfs_emit(buf, help);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t scst_device_groups_mgmt_store(struct kobject *kobj,
|
static ssize_t scst_device_groups_mgmt_store(struct kobject *kobj,
|
||||||
@@ -6883,7 +6863,7 @@ static struct kobject scst_sysfs_root_kobj;
|
|||||||
static ssize_t scst_measure_latency_show(struct kobject *kobj, struct kobj_attribute *attr,
|
static ssize_t scst_measure_latency_show(struct kobject *kobj, struct kobj_attribute *attr,
|
||||||
char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n", atomic_read(&scst_measure_latency));
|
return sysfs_emit(buf, "%d\n", atomic_read(&scst_measure_latency));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void scst_free_lat_stats_mem(void)
|
static void scst_free_lat_stats_mem(void)
|
||||||
@@ -6985,7 +6965,7 @@ static ssize_t scst_threads_show(struct kobject *kobj, struct kobj_attribute *at
|
|||||||
|
|
||||||
TRACE_ENTRY();
|
TRACE_ENTRY();
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s",
|
ret = sysfs_emit(buf, "%d\n%s",
|
||||||
scst_main_cmd_threads.nr_threads,
|
scst_main_cmd_threads.nr_threads,
|
||||||
(scst_main_cmd_threads.nr_threads != scst_threads) ?
|
(scst_main_cmd_threads.nr_threads != scst_threads) ?
|
||||||
SCST_SYSFS_KEY_MARK "\n" : "");
|
SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
@@ -7092,9 +7072,9 @@ static ssize_t scst_setup_id_show(struct kobject *kobj,
|
|||||||
|
|
||||||
TRACE_ENTRY();
|
TRACE_ENTRY();
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "0x%x\n%s\n",
|
ret = sysfs_emit(buf, "0x%x\n%s",
|
||||||
scst_setup_id,
|
scst_setup_id,
|
||||||
scst_setup_id == 0 ? "" : SCST_SYSFS_KEY_MARK);
|
scst_setup_id == 0 ? "" : SCST_SYSFS_KEY_MARK "\n");
|
||||||
|
|
||||||
TRACE_EXIT();
|
TRACE_EXIT();
|
||||||
|
|
||||||
@@ -7135,10 +7115,10 @@ static ssize_t scst_max_tasklet_cmd_show(struct kobject *kobj, struct kobj_attri
|
|||||||
|
|
||||||
TRACE_ENTRY();
|
TRACE_ENTRY();
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s\n",
|
ret = sysfs_emit(buf, "%d\n%s",
|
||||||
scst_max_tasklet_cmd,
|
scst_max_tasklet_cmd,
|
||||||
scst_max_tasklet_cmd == SCST_DEF_MAX_TASKLET_CMD ?
|
scst_max_tasklet_cmd == SCST_DEF_MAX_TASKLET_CMD ?
|
||||||
"" : SCST_SYSFS_KEY_MARK);
|
"" : SCST_SYSFS_KEY_MARK "\n");
|
||||||
|
|
||||||
TRACE_EXIT();
|
TRACE_EXIT();
|
||||||
|
|
||||||
@@ -7180,9 +7160,9 @@ static ssize_t scst_poll_us_show(struct kobject *kobj, struct kobj_attribute *at
|
|||||||
TRACE_ENTRY();
|
TRACE_ENTRY();
|
||||||
|
|
||||||
do_div(t, 1000);
|
do_div(t, 1000);
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%lld\n%s\n",
|
ret = sysfs_emit(buf, "%lld\n%s",
|
||||||
t,
|
t,
|
||||||
scst_poll_ns == SCST_DEF_POLL_NS ? "" : SCST_SYSFS_KEY_MARK);
|
scst_poll_ns == SCST_DEF_POLL_NS ? "" : SCST_SYSFS_KEY_MARK "\n");
|
||||||
|
|
||||||
TRACE_EXIT();
|
TRACE_EXIT();
|
||||||
|
|
||||||
@@ -7225,7 +7205,7 @@ static ssize_t scst_suspend_show(struct kobject *kobj,
|
|||||||
|
|
||||||
TRACE_ENTRY();
|
TRACE_ENTRY();
|
||||||
|
|
||||||
ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n", scst_get_suspend_count());
|
ret = sysfs_emit(buf, "%d\n", scst_get_suspend_count());
|
||||||
|
|
||||||
TRACE_EXIT();
|
TRACE_EXIT();
|
||||||
|
|
||||||
@@ -7304,7 +7284,7 @@ static struct kobj_attribute scst_main_trace_level_attr =
|
|||||||
static ssize_t scst_force_global_sgv_pool_show(struct kobject *kobj, struct kobj_attribute *attr,
|
static ssize_t scst_force_global_sgv_pool_show(struct kobject *kobj, struct kobj_attribute *attr,
|
||||||
char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s\n",
|
return sysfs_emit(buf, "%d\n%s",
|
||||||
scst_force_global_sgv_pool,
|
scst_force_global_sgv_pool,
|
||||||
scst_force_global_sgv_pool ? SCST_SYSFS_KEY_MARK "\n" : "");
|
scst_force_global_sgv_pool ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
}
|
}
|
||||||
@@ -7378,7 +7358,7 @@ static ssize_t scst_show_trace_cmds(struct kobject *kobj,
|
|||||||
if (res != 0)
|
if (res != 0)
|
||||||
goto put;
|
goto put;
|
||||||
|
|
||||||
res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s", work->res_buf);
|
res = sysfs_emit(buf, "%s", work->res_buf);
|
||||||
|
|
||||||
put:
|
put:
|
||||||
scst_sysfs_work_put(work);
|
scst_sysfs_work_put(work);
|
||||||
@@ -7409,7 +7389,7 @@ put:
|
|||||||
static ssize_t scst_show_trace_mcmds(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
|
static ssize_t scst_show_trace_mcmds(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct scst_sysfs_work_item *work;
|
struct scst_sysfs_work_item *work;
|
||||||
int res;
|
ssize_t res;
|
||||||
|
|
||||||
res = scst_alloc_sysfs_work(scst_process_show_trace_mcmds, true,
|
res = scst_alloc_sysfs_work(scst_process_show_trace_mcmds, true,
|
||||||
&work);
|
&work);
|
||||||
@@ -7422,7 +7402,7 @@ static ssize_t scst_show_trace_mcmds(struct kobject *kobj, struct kobj_attribute
|
|||||||
if (res != 0)
|
if (res != 0)
|
||||||
goto put;
|
goto put;
|
||||||
|
|
||||||
res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s", work->res_buf);
|
res = sysfs_emit(buf, "%s", work->res_buf);
|
||||||
|
|
||||||
put:
|
put:
|
||||||
scst_sysfs_work_put(work);
|
scst_sysfs_work_put(work);
|
||||||
@@ -7443,26 +7423,15 @@ static ssize_t scst_version_show(struct kobject *kobj,
|
|||||||
|
|
||||||
TRACE_ENTRY();
|
TRACE_ENTRY();
|
||||||
|
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "SCST version: %s\n",
|
ret += sysfs_emit_at(buf, ret, "SCST version: %s\n", SCST_VERSION_STRING);
|
||||||
SCST_VERSION_STRING);
|
ret += sysfs_emit_at(buf, ret, "SCST build date: %s\n", SCST_BUILD_DATE_STRING);
|
||||||
|
ret += sysfs_emit_at(buf, ret, "SCST git commit sha1: %s\n", SCST_GIT_COMMIT_STRING);
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "SCST build date: %s\n",
|
ret += sysfs_emit_at(buf, ret, "SCST kver: %s\n", SCST_KVER_STRING);
|
||||||
SCST_BUILD_DATE_STRING);
|
ret += sysfs_emit_at(buf, ret, "SCST build number: %s\n", SCST_BUILD_NUMBER_STRING);
|
||||||
|
ret += sysfs_emit_at(buf, ret, "SCST arch type: %s\n", SCST_ARCH_TYPE_STRING);
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "SCST git commit sha1: %s\n",
|
|
||||||
SCST_GIT_COMMIT_STRING);
|
|
||||||
|
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "SCST kver: %s\n",
|
|
||||||
SCST_KVER_STRING);
|
|
||||||
|
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "SCST build number: %s\n",
|
|
||||||
SCST_BUILD_NUMBER_STRING);
|
|
||||||
|
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "SCST arch type: %s\n",
|
|
||||||
SCST_ARCH_TYPE_STRING);
|
|
||||||
|
|
||||||
if (scst_dump_config(config, sizeof(config)))
|
if (scst_dump_config(config, sizeof(config)))
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "%s\n", config);
|
ret += sysfs_emit_at(buf, ret, "%s\n", config);
|
||||||
|
|
||||||
TRACE_EXIT();
|
TRACE_EXIT();
|
||||||
|
|
||||||
@@ -7484,7 +7453,7 @@ static ssize_t scst_last_sysfs_mgmt_res_show(struct kobject *kobj, struct kobj_a
|
|||||||
if (active_sysfs_works > 0)
|
if (active_sysfs_works > 0)
|
||||||
res = -EAGAIN;
|
res = -EAGAIN;
|
||||||
else
|
else
|
||||||
res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n", last_sysfs_work_res);
|
res = sysfs_emit(buf, "%d\n", last_sysfs_work_res);
|
||||||
spin_unlock(&sysfs_work_lock);
|
spin_unlock(&sysfs_work_lock);
|
||||||
|
|
||||||
TRACE_EXIT_RES(res);
|
TRACE_EXIT_RES(res);
|
||||||
@@ -7501,7 +7470,7 @@ static ssize_t scst_cluster_name_show(struct kobject *kobj, struct kobj_attribut
|
|||||||
TRACE_ENTRY();
|
TRACE_ENTRY();
|
||||||
|
|
||||||
if (scst_cluster_name)
|
if (scst_cluster_name)
|
||||||
res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s",
|
res = sysfs_emit(buf, "%s\n%s",
|
||||||
scst_cluster_name, SCST_SYSFS_KEY_MARK "\n");
|
scst_cluster_name, SCST_SYSFS_KEY_MARK "\n");
|
||||||
|
|
||||||
TRACE_EXIT_RES(res);
|
TRACE_EXIT_RES(res);
|
||||||
|
|||||||
+11
-11
@@ -246,19 +246,19 @@ static ssize_t scst_local_version_show(struct kobject *kobj, struct kobj_attribu
|
|||||||
{
|
{
|
||||||
ssize_t ret = 0;
|
ssize_t ret = 0;
|
||||||
|
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "%s/%s\n",
|
ret += sysfs_emit_at(buf, ret, "%s/%s\n",
|
||||||
SCST_LOCAL_VERSION, scst_local_version_date);
|
SCST_LOCAL_VERSION, scst_local_version_date);
|
||||||
|
|
||||||
#ifdef CONFIG_SCST_EXTRACHECKS
|
#ifdef CONFIG_SCST_EXTRACHECKS
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "EXTRACHECKS\n");
|
ret += sysfs_emit_at(buf, ret, "EXTRACHECKS\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SCST_TRACING
|
#ifdef CONFIG_SCST_TRACING
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "TRACING\n");
|
ret += sysfs_emit_at(buf, ret, "TRACING\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SCST_DEBUG
|
#ifdef CONFIG_SCST_DEBUG
|
||||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "DEBUG\n");
|
ret += sysfs_emit_at(buf, ret, "DEBUG\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TRACE_EXIT();
|
TRACE_EXIT();
|
||||||
@@ -271,7 +271,7 @@ static struct kobj_attribute scst_local_version_attr =
|
|||||||
|
|
||||||
static ssize_t scst_local_stats_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
|
static ssize_t scst_local_stats_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE,
|
return sysfs_emit(buf,
|
||||||
"Aborts: %d, Device Resets: %d, Target Resets: %d\n",
|
"Aborts: %d, Device Resets: %d, Target Resets: %d\n",
|
||||||
atomic_read(&num_aborts), atomic_read(&num_dev_resets),
|
atomic_read(&num_aborts), atomic_read(&num_dev_resets),
|
||||||
atomic_read(&num_target_resets));
|
atomic_read(&num_target_resets));
|
||||||
@@ -308,10 +308,10 @@ static ssize_t scst_local_scsi_transport_version_show(struct kobject *kobj,
|
|||||||
goto out_up;
|
goto out_up;
|
||||||
|
|
||||||
if (tgt->scsi_transport_version != 0)
|
if (tgt->scsi_transport_version != 0)
|
||||||
res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "0x%x\n%s",
|
res = sysfs_emit(buf, "0x%x\n%s\n",
|
||||||
tgt->scsi_transport_version, SCST_SYSFS_KEY_MARK "\n");
|
tgt->scsi_transport_version, SCST_SYSFS_KEY_MARK);
|
||||||
else
|
else
|
||||||
res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "0x%x\n", 0x0BE0); /* SAS */
|
res = sysfs_emit(buf, "0x%x\n", 0x0BE0); /* SAS */
|
||||||
|
|
||||||
out_up:
|
out_up:
|
||||||
up_read(&scst_local_exit_rwsem);
|
up_read(&scst_local_exit_rwsem);
|
||||||
@@ -376,7 +376,7 @@ static ssize_t scst_local_phys_transport_version_show(struct kobject *kobj,
|
|||||||
if (!tgt)
|
if (!tgt)
|
||||||
goto out_up;
|
goto out_up;
|
||||||
|
|
||||||
res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "0x%x\n%s",
|
res = sysfs_emit(buf, "0x%x\n%s",
|
||||||
tgt->phys_transport_version,
|
tgt->phys_transport_version,
|
||||||
tgt->phys_transport_version != 0 ? SCST_SYSFS_KEY_MARK "\n" : "");
|
tgt->phys_transport_version != 0 ? SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
|
|
||||||
@@ -446,7 +446,7 @@ static ssize_t host_no_show(struct kobject *kobj, struct kobj_attribute *attr, c
|
|||||||
if (!host)
|
if (!host)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%u\n", host->host_no);
|
return sysfs_emit(buf, "%u\n", host->host_no);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct kobj_attribute scst_local_host_no_attr = __ATTR_RO(host_no);
|
static struct kobj_attribute scst_local_host_no_attr = __ATTR_RO(host_no);
|
||||||
@@ -479,7 +479,7 @@ static ssize_t scst_local_transport_id_show(struct kobject *kobj, struct kobj_at
|
|||||||
|
|
||||||
res = 0;
|
res = 0;
|
||||||
for (i = 0; i < tr_id_len; i++)
|
for (i = 0; i < tr_id_len; i++)
|
||||||
res += scnprintf(buf + res, SCST_SYSFS_BLOCK_SIZE - res, "%c", tr_id[i]);
|
res += sysfs_emit_at(buf, res, "%c", tr_id[i]);
|
||||||
|
|
||||||
if (!sess->transport_id)
|
if (!sess->transport_id)
|
||||||
kfree(tr_id);
|
kfree(tr_id);
|
||||||
|
|||||||
+14
-12
@@ -3956,11 +3956,10 @@ static ssize_t show_comp_v_mask(struct kobject *kobj,
|
|||||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
|
||||||
res = cpumask_scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, &sport->comp_v_mask);
|
res = cpumask_scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, &sport->comp_v_mask);
|
||||||
#else
|
#else
|
||||||
res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%*pb",
|
res = sysfs_emit(buf, "%*pb",
|
||||||
cpumask_pr_args(&sport->comp_v_mask));
|
cpumask_pr_args(&sport->comp_v_mask));
|
||||||
#endif
|
#endif
|
||||||
res += scnprintf(buf + res, SCST_SYSFS_BLOCK_SIZE - res, "\n%s\n",
|
res += sysfs_emit_at(buf, res, "\n%s\n", SCST_SYSFS_KEY_MARK);
|
||||||
SCST_SYSFS_KEY_MARK);
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
return res;
|
return res;
|
||||||
@@ -4019,7 +4018,7 @@ static ssize_t srpt_show_device(struct kobject *kobj,
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
sdev = sport->sdev;
|
sdev = sport->sdev;
|
||||||
res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", dev_name(&sdev->device->dev));
|
res = sysfs_emit(buf, "%s\n", dev_name(&sdev->device->dev));
|
||||||
|
|
||||||
out:
|
out:
|
||||||
return res;
|
return res;
|
||||||
@@ -4055,7 +4054,7 @@ static ssize_t srpt_show_link_layer(struct kobject *kobj,
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", lln);
|
res = sysfs_emit(buf, "%s\n", lln);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
return res;
|
return res;
|
||||||
@@ -4074,7 +4073,7 @@ static ssize_t show_port_id(struct kobject *kobj, struct kobj_attribute *attr, c
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
mutex_lock(&sport->mutex);
|
mutex_lock(&sport->mutex);
|
||||||
res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s",
|
res = sysfs_emit(buf, "%s\n%s",
|
||||||
sport->port_id,
|
sport->port_id,
|
||||||
strcmp(sport->port_id, DEFAULT_SRPT_ID_STRING) ?
|
strcmp(sport->port_id, DEFAULT_SRPT_ID_STRING) ?
|
||||||
SCST_SYSFS_KEY_MARK "\n" : "");
|
SCST_SYSFS_KEY_MARK "\n" : "");
|
||||||
@@ -4127,7 +4126,7 @@ static ssize_t show_login_info(struct kobject *kobj,
|
|||||||
if (!sport)
|
if (!sport)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE,
|
res = sysfs_emit(buf,
|
||||||
"tid_ext=%016llx,ioc_guid=%016llx,pkey=ffff,dgid=%04x%04x%04x%04x%04x%04x%04x%04x,service_id=%016llx\n",
|
"tid_ext=%016llx,ioc_guid=%016llx,pkey=ffff,dgid=%04x%04x%04x%04x%04x%04x%04x%04x,service_id=%016llx\n",
|
||||||
srpt_service_guid, srpt_service_guid,
|
srpt_service_guid, srpt_service_guid,
|
||||||
be16_to_cpu(((__be16 *) sport->gid.raw)[0]),
|
be16_to_cpu(((__be16 *) sport->gid.raw)[0]),
|
||||||
@@ -4167,7 +4166,7 @@ static ssize_t show_req_lim(struct kobject *kobj,
|
|||||||
if (!ch)
|
if (!ch)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n", ch->req_lim);
|
return sysfs_emit(buf, "%d\n", ch->req_lim);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t show_req_lim_delta(struct kobject *kobj,
|
static ssize_t show_req_lim_delta(struct kobject *kobj,
|
||||||
@@ -4181,7 +4180,7 @@ static ssize_t show_req_lim_delta(struct kobject *kobj,
|
|||||||
if (!ch)
|
if (!ch)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n", ch->req_lim_delta);
|
return sysfs_emit(buf, "%d\n", ch->req_lim_delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t show_ch_state(struct kobject *kobj, struct kobj_attribute *attr,
|
static ssize_t show_ch_state(struct kobject *kobj, struct kobj_attribute *attr,
|
||||||
@@ -4195,7 +4194,7 @@ static ssize_t show_ch_state(struct kobject *kobj, struct kobj_attribute *attr,
|
|||||||
if (!ch)
|
if (!ch)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", get_ch_state_name(ch->state));
|
return sysfs_emit(buf, "%s\n", get_ch_state_name(ch->state));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t show_comp_vector(struct kobject *kobj,
|
static ssize_t show_comp_vector(struct kobject *kobj,
|
||||||
@@ -4205,9 +4204,12 @@ static ssize_t show_comp_vector(struct kobject *kobj,
|
|||||||
struct srpt_rdma_ch *ch;
|
struct srpt_rdma_ch *ch;
|
||||||
|
|
||||||
sess = container_of(kobj, struct scst_session, sess_kobj);
|
sess = container_of(kobj, struct scst_session, sess_kobj);
|
||||||
ch = scst_sess_get_tgt_priv(sess);
|
|
||||||
|
|
||||||
return ch ? scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%u\n", ch->comp_vector) : -ENOENT;
|
ch = scst_sess_get_tgt_priv(sess);
|
||||||
|
if (!ch)
|
||||||
|
return -ENOENT;
|
||||||
|
|
||||||
|
return sysfs_emit(buf, "%u\n", ch->comp_vector);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct kobj_attribute srpt_req_lim_attr =
|
static const struct kobj_attribute srpt_req_lim_attr =
|
||||||
|
|||||||
Reference in New Issue
Block a user