mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-18 11:11:27 +00:00
Minor output buffer size related fixes
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1257 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -23,47 +23,43 @@
|
||||
|
||||
#ifdef CONFIG_SCST_PROC
|
||||
|
||||
static void print_conn_state(char *p, size_t size, struct iscsi_conn *conn)
|
||||
static int print_conn_state(char *p, size_t size, struct iscsi_conn *conn)
|
||||
{
|
||||
int printed = 0;
|
||||
int pos = 0;
|
||||
|
||||
if (conn->closing) {
|
||||
snprintf(p, size, "%s", "closing");
|
||||
return;
|
||||
pos += scnprintf(p, size, "%s", "closing");
|
||||
goto out;
|
||||
}
|
||||
|
||||
switch (conn->rd_state) {
|
||||
case ISCSI_CONN_RD_STATE_PROCESSING:
|
||||
size -= scnprintf(p, size, "%s", "read_processing ");
|
||||
printed = 1;
|
||||
pos += scnprintf(&p[pos], size - pos, "%s", "read_processing ");
|
||||
break;
|
||||
case ISCSI_CONN_RD_STATE_IN_LIST:
|
||||
size -= scnprintf(p, size, "%s", "in_read_list ");
|
||||
printed = 1;
|
||||
pos += scnprintf(&p[pos], size - pos, "%s", "in_read_list ");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (conn->wr_state) {
|
||||
case ISCSI_CONN_WR_STATE_PROCESSING:
|
||||
size -= scnprintf(p, size, "%s", "write_processing ");
|
||||
printed = 1;
|
||||
pos += scnprintf(&p[pos], size - pos, "%s", "write_processing ");
|
||||
break;
|
||||
case ISCSI_CONN_WR_STATE_IN_LIST:
|
||||
size -= scnprintf(p, size, "%s", "in_write_list ");
|
||||
printed = 1;
|
||||
pos += scnprintf(&p[pos], size - pos, "%s", "in_write_list ");
|
||||
break;
|
||||
case ISCSI_CONN_WR_STATE_SPACE_WAIT:
|
||||
size -= scnprintf(p, size, "%s", "space_waiting ");
|
||||
printed = 1;
|
||||
pos += scnprintf(&p[pos], size - pos, "%s", "space_waiting ");
|
||||
break;
|
||||
}
|
||||
|
||||
if (test_bit(ISCSI_CONN_REINSTATING, &conn->conn_aflags))
|
||||
snprintf(p, size, "%s", "reinstating ");
|
||||
else if (!printed)
|
||||
snprintf(p, size, "%s", "established idle ");
|
||||
pos += scnprintf(&p[pos], size - pos, "%s", "reinstating ");
|
||||
else if (pos == 0)
|
||||
pos += scnprintf(&p[pos], size - pos, "%s", "established idle ");
|
||||
|
||||
return;
|
||||
out:
|
||||
return pos;
|
||||
}
|
||||
|
||||
static void print_digest_state(char *p, size_t size, unsigned long flags)
|
||||
|
||||
@@ -339,6 +339,6 @@ enum scst_cmd_queue_type {
|
||||
/*************************************************************
|
||||
** Misc constants
|
||||
*************************************************************/
|
||||
#define SCST_SYSFS_BLOCK_SIZE (PAGE_SIZE - 64)
|
||||
#define SCST_SYSFS_BLOCK_SIZE PAGE_SIZE
|
||||
|
||||
#endif /* __SCST_CONST_H */
|
||||
|
||||
@@ -3411,9 +3411,10 @@ static ssize_t dev_user_sysfs_commands_show(struct kobject *kobj,
|
||||
atomic_read(&ucmd->ucmd_ref),
|
||||
ucmd->sent_to_user, ucmd->seen_by_user,
|
||||
ucmd->aborted, ucmd->jammed, ucmd->cmd);
|
||||
if (pos >= SCST_SYSFS_BLOCK_SIZE) {
|
||||
scnprintf(&buf[ppos],
|
||||
if (pos >= SCST_SYSFS_BLOCK_SIZE-1) {
|
||||
ppos += scnprintf(&buf[ppos],
|
||||
SCST_SYSFS_BLOCK_SIZE - ppos, "...\n");
|
||||
pos = ppos;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user