mirror of
https://github.com/SCST-project/scst.git
synced 2026-10-22 06:02:33 +00:00
scst: Normalize local and private state names
Use lowercase names for local text-negotiation, tape-residual, reset and random-generator variables. Rename private iSCSI thread/connection wait queues, the event queue and the SRPT release queue, updating all in-tree uses including the event fixture. Protocol strings, exported names, installed SCST interface members and all behavior remain unchanged. Checkpatch reports CAMELCASE: Avoid CamelCase: <setUA>
This commit is contained in:
@@ -364,7 +364,7 @@ void iscsi_make_conn_rd_active(struct iscsi_conn *conn)
|
||||
if (conn->rd_state == ISCSI_CONN_RD_STATE_IDLE) {
|
||||
list_add_tail(&conn->rd_list_entry, &p->rd_list);
|
||||
conn->rd_state = ISCSI_CONN_RD_STATE_IN_LIST;
|
||||
wake_up(&p->rd_waitQ);
|
||||
wake_up(&p->rd_waitq);
|
||||
}
|
||||
|
||||
spin_unlock_bh(&p->rd_lock);
|
||||
@@ -393,7 +393,7 @@ void iscsi_make_conn_wr_active(struct iscsi_conn *conn)
|
||||
if (conn->wr_state == ISCSI_CONN_WR_STATE_IDLE) {
|
||||
list_add_tail(&conn->wr_list_entry, &p->wr_list);
|
||||
conn->wr_state = ISCSI_CONN_WR_STATE_IN_LIST;
|
||||
wake_up(&p->wr_waitQ);
|
||||
wake_up(&p->wr_waitq);
|
||||
}
|
||||
|
||||
spin_unlock_bh(&p->wr_lock);
|
||||
@@ -487,7 +487,7 @@ void __iscsi_write_space_ready(struct iscsi_conn *conn)
|
||||
TRACE_DBG("wr space ready (conn %p)", conn);
|
||||
list_add_tail(&conn->wr_list_entry, &p->wr_list);
|
||||
conn->wr_state = ISCSI_CONN_WR_STATE_IN_LIST;
|
||||
wake_up(&p->wr_waitQ);
|
||||
wake_up(&p->wr_waitq);
|
||||
}
|
||||
spin_unlock_bh(&p->wr_lock);
|
||||
|
||||
@@ -855,7 +855,7 @@ int iscsi_init_conn(struct iscsi_session *session,
|
||||
INIT_LIST_HEAD(&conn->write_list);
|
||||
INIT_LIST_HEAD(&conn->write_timeout_list);
|
||||
timer_setup(&conn->rsp_timer, conn_rsp_timer_fn, 0);
|
||||
init_waitqueue_head(&conn->read_state_waitQ);
|
||||
init_waitqueue_head(&conn->read_state_waitq);
|
||||
init_completion(&conn->ready_to_free);
|
||||
INIT_LIST_HEAD(&conn->reinst_pending_cmd_list);
|
||||
INIT_LIST_HEAD(&conn->nop_req_list);
|
||||
|
||||
@@ -3243,7 +3243,7 @@ static void iscsi_tcp_preprocessing_done(struct iscsi_cmnd *req)
|
||||
iscsi_make_conn_rd_active(req->conn);
|
||||
if (unlikely(req->conn->closing)) {
|
||||
TRACE_DBG("Waking up closing conn %p", req->conn);
|
||||
wake_up(&req->conn->read_state_waitQ);
|
||||
wake_up(&req->conn->read_state_waitq);
|
||||
}
|
||||
cmnd_put(req);
|
||||
}
|
||||
@@ -3304,7 +3304,7 @@ static void iscsi_try_local_processing(struct iscsi_cmnd *req)
|
||||
} else if (test_write_ready(conn)) {
|
||||
list_add_tail(&conn->wr_list_entry, &p->wr_list);
|
||||
conn->wr_state = ISCSI_CONN_WR_STATE_IN_LIST;
|
||||
wake_up(&p->wr_waitQ);
|
||||
wake_up(&p->wr_waitq);
|
||||
} else {
|
||||
conn->wr_state = ISCSI_CONN_WR_STATE_IDLE;
|
||||
}
|
||||
@@ -4090,10 +4090,10 @@ create:
|
||||
|
||||
spin_lock_init(&p->rd_lock);
|
||||
INIT_LIST_HEAD(&p->rd_list);
|
||||
init_waitqueue_head(&p->rd_waitQ);
|
||||
init_waitqueue_head(&p->rd_waitq);
|
||||
spin_lock_init(&p->wr_lock);
|
||||
INIT_LIST_HEAD(&p->wr_list);
|
||||
init_waitqueue_head(&p->wr_waitQ);
|
||||
init_waitqueue_head(&p->wr_waitq);
|
||||
if (!cpu_mask)
|
||||
cpumask_setall(&p->cpu_mask);
|
||||
else
|
||||
|
||||
@@ -81,12 +81,12 @@ struct iscsi_thread {
|
||||
struct iscsi_thread_pool {
|
||||
spinlock_t rd_lock;
|
||||
struct list_head rd_list;
|
||||
wait_queue_head_t rd_waitQ;
|
||||
wait_queue_head_t rd_waitq;
|
||||
|
||||
/* It's used by another thread, hence aligned */
|
||||
spinlock_t wr_lock ____cacheline_aligned_in_smp;
|
||||
struct list_head wr_list;
|
||||
wait_queue_head_t wr_waitQ;
|
||||
wait_queue_head_t wr_waitq;
|
||||
|
||||
cpumask_t cpu_mask;
|
||||
bool dedicated;
|
||||
@@ -304,7 +304,7 @@ struct iscsi_conn {
|
||||
struct iscsi_conn *conn_reinst_successor;
|
||||
struct list_head reinst_pending_cmd_list;
|
||||
|
||||
wait_queue_head_t read_state_waitQ;
|
||||
wait_queue_head_t read_state_waitq;
|
||||
struct completion ready_to_free;
|
||||
|
||||
/* Doesn't need any protection */
|
||||
|
||||
@@ -269,7 +269,7 @@ static void close_conn(struct iscsi_conn *conn)
|
||||
TRACE_CONN_CLOSE_DBG("Going to wait for cmnd %p to change state from RX_CMD",
|
||||
cmnd);
|
||||
}
|
||||
wait_event(conn->read_state_waitQ, cmnd->scst_state != ISCSI_CMD_STATE_RX_CMD);
|
||||
wait_event(conn->read_state_waitq, cmnd->scst_state != ISCSI_CMD_STATE_RX_CMD);
|
||||
|
||||
TRACE_CONN_CLOSE_DBG("Releasing conn->read_cmnd %p (conn %p)",
|
||||
conn->read_cmnd, conn);
|
||||
@@ -936,7 +936,7 @@ int istrd(void *arg)
|
||||
|
||||
spin_lock_bh(&p->rd_lock);
|
||||
while (!kthread_should_stop()) {
|
||||
scst_wait_event_interruptible_lock_bh(p->rd_waitQ, test_rd_list(p), p->rd_lock);
|
||||
scst_wait_event_interruptible_lock_bh(p->rd_waitq, test_rd_list(p), p->rd_lock);
|
||||
scst_do_job_rd(p);
|
||||
}
|
||||
spin_unlock_bh(&p->rd_lock);
|
||||
@@ -1595,7 +1595,7 @@ int istwr(void *arg)
|
||||
|
||||
spin_lock_bh(&p->wr_lock);
|
||||
while (!kthread_should_stop()) {
|
||||
scst_wait_event_interruptible_lock_bh(p->wr_waitQ, test_wr_list(p), p->wr_lock);
|
||||
scst_wait_event_interruptible_lock_bh(p->wr_waitq, test_wr_list(p), p->wr_lock);
|
||||
scst_do_job_wr(p);
|
||||
}
|
||||
spin_unlock_bh(&p->wr_lock);
|
||||
|
||||
@@ -50,13 +50,13 @@ static struct iscsi_key login_keys[] = {
|
||||
{ .name = NULL,},
|
||||
};
|
||||
|
||||
char *text_key_find(struct connection *conn, const char *searchKey)
|
||||
char *text_key_find(struct connection *conn, const char *search_key)
|
||||
{
|
||||
char *data, *value;
|
||||
const char *key;
|
||||
int keylen, datasize;
|
||||
|
||||
keylen = strlen(searchKey);
|
||||
keylen = strlen(search_key);
|
||||
data = conn->req.data;
|
||||
datasize = conn->req.datasize;
|
||||
|
||||
@@ -76,7 +76,7 @@ char *text_key_find(struct connection *conn, const char *searchKey)
|
||||
datasize--;
|
||||
|
||||
if (keylen == value - key - 1
|
||||
&& !strncasecmp(key, searchKey, keylen))
|
||||
&& !strncasecmp(key, search_key, keylen))
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -222,7 +222,7 @@ static void login_rsp_tgt_err(struct connection *conn, int status_detail)
|
||||
|
||||
static void text_scan_security(struct connection *conn)
|
||||
{
|
||||
char *value, *data, *nextValue;
|
||||
char *value, *data, *next_value;
|
||||
const char *key;
|
||||
int datasize;
|
||||
|
||||
@@ -234,9 +234,9 @@ static void text_scan_security(struct connection *conn)
|
||||
;
|
||||
} else if (!strcmp(key, "AuthMethod")) {
|
||||
do {
|
||||
nextValue = strchr(value, ',');
|
||||
if (nextValue)
|
||||
*nextValue++ = 0;
|
||||
next_value = strchr(value, ',');
|
||||
if (next_value)
|
||||
*next_value++ = 0;
|
||||
|
||||
if (!strcmp(value, "None")) {
|
||||
if (!accounts_empty(conn->tid, ISCSI_USER_DIR_INCOMING))
|
||||
@@ -251,7 +251,7 @@ static void text_scan_security(struct connection *conn)
|
||||
text_key_add(conn, key, "CHAP");
|
||||
break;
|
||||
}
|
||||
} while ((value = nextValue));
|
||||
} while ((value = next_value));
|
||||
|
||||
if (conn->auth_method == AUTH_UNKNOWN)
|
||||
text_key_add_reject(conn, key);
|
||||
|
||||
@@ -267,7 +267,7 @@ extern int logins_suspended;
|
||||
|
||||
int cmnd_execute(struct connection *conn);
|
||||
void cmnd_finish(struct connection *conn);
|
||||
char *text_key_find(struct connection *conn, const char *searchKey);
|
||||
char *text_key_find(struct connection *conn, const char *search_key);
|
||||
void text_key_add(struct connection *conn, const char *key,
|
||||
const char *value);
|
||||
|
||||
|
||||
@@ -267,20 +267,20 @@ static int tape_done(struct scst_cmd *cmd)
|
||||
|
||||
if (opcode == READ_6 && !(cmd->cdb[1] & SILI_BIT) && (cmd->sense[2] & 0xe0)) {
|
||||
/* EOF, EOM, or ILI */
|
||||
unsigned int TransferLength, Residue = 0;
|
||||
unsigned int transfer_length, residue = 0;
|
||||
|
||||
if ((cmd->sense[2] & 0x0f) == BLANK_CHECK)
|
||||
/* No need for EOM in this case */
|
||||
cmd->sense[2] &= 0xcf;
|
||||
TransferLength = get_unaligned_be24(&cmd->cdb[2]);
|
||||
transfer_length = get_unaligned_be24(&cmd->cdb[2]);
|
||||
/* Compute the residual count */
|
||||
if ((cmd->sense[0] & 0x80) != 0)
|
||||
Residue = get_unaligned_be32(&cmd->sense[3]);
|
||||
residue = get_unaligned_be32(&cmd->sense[3]);
|
||||
TRACE_DBG("Checking the sense key sn[2]=%x cmd->cdb[0,1]=%x,%x TransLen/Resid %d/%d",
|
||||
(int)cmd->sense[2], cmd->cdb[0], cmd->cdb[1], TransferLength,
|
||||
Residue);
|
||||
if (TransferLength > Residue) {
|
||||
int resp_data_len = TransferLength - Residue;
|
||||
(int)cmd->sense[2], cmd->cdb[0], cmd->cdb[1], transfer_length,
|
||||
residue);
|
||||
if (transfer_length > residue) {
|
||||
int resp_data_len = transfer_length - residue;
|
||||
|
||||
if (cmd->cdb[1] & 1) {
|
||||
/*
|
||||
|
||||
@@ -183,7 +183,7 @@ int event_test_init(struct kunit *test)
|
||||
INIT_LIST_HEAD(&f->priv.allowed_events_list);
|
||||
INIT_LIST_HEAD(&f->priv.queued_events_list);
|
||||
INIT_LIST_HEAD(&f->priv.processing_events_list);
|
||||
init_waitqueue_head(&f->priv.queued_events_waitQ);
|
||||
init_waitqueue_head(&f->priv.queued_events_waitq);
|
||||
f->file.private_data = &f->priv;
|
||||
f->user_size = INT_MAX;
|
||||
memset(f->output, 0xa5, sizeof(f->output));
|
||||
|
||||
@@ -252,7 +252,7 @@ static void __scst_event_queue(struct scst_event_entry *event_entry)
|
||||
new_event_entry->event.issuer_name,
|
||||
new_event_entry->event.event_id, new_event_entry);
|
||||
|
||||
wake_up_all(&priv->queued_events_waitQ);
|
||||
wake_up_all(&priv->queued_events_waitq);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -565,7 +565,7 @@ static int scst_event_release(struct inode *inode, struct file *file)
|
||||
TRACE_DBG("Going to release event priv %p", priv);
|
||||
|
||||
priv->going_to_exit = 1;
|
||||
wake_up_all(&priv->queued_events_waitQ);
|
||||
wake_up_all(&priv->queued_events_waitq);
|
||||
|
||||
list_for_each_entry_safe(e, et, &priv->allowed_events_list, events_list_entry) {
|
||||
TRACE_MEM("Deleting allowed event entry %p", e);
|
||||
@@ -774,7 +774,7 @@ static int scst_event_user_next_event(struct scst_event_priv *priv, void __user
|
||||
/* Waiting for at least one event, if blocking */
|
||||
while (list_empty(&priv->queued_events_list)) {
|
||||
mutex_unlock(&scst_event_mutex);
|
||||
wait_event_interruptible(priv->queued_events_waitQ,
|
||||
wait_event_interruptible(priv->queued_events_waitq,
|
||||
(!list_empty(&priv->queued_events_list) ||
|
||||
priv->going_to_exit || !priv->blocking ||
|
||||
signal_pending(current)));
|
||||
@@ -916,7 +916,7 @@ static int scst_event_create_priv(struct file *file)
|
||||
|
||||
priv->owner_pid = current->pid;
|
||||
INIT_LIST_HEAD(&priv->allowed_events_list);
|
||||
init_waitqueue_head(&priv->queued_events_waitQ);
|
||||
init_waitqueue_head(&priv->queued_events_waitq);
|
||||
INIT_LIST_HEAD(&priv->queued_events_list);
|
||||
INIT_LIST_HEAD(&priv->processing_events_list);
|
||||
if (file->f_flags & O_NONBLOCK) {
|
||||
@@ -1027,7 +1027,7 @@ static __poll_t scst_event_poll(struct file *file, poll_table *wait)
|
||||
mutex_unlock(&scst_event_mutex);
|
||||
|
||||
TRACE_DBG("Before poll_wait() (priv %p)", priv);
|
||||
poll_wait(file, &priv->queued_events_waitQ, wait);
|
||||
poll_wait(file, &priv->queued_events_waitq, wait);
|
||||
TRACE_DBG("After poll_wait() (priv %p)", priv);
|
||||
|
||||
mutex_lock(&scst_event_mutex);
|
||||
|
||||
@@ -20,7 +20,7 @@ struct scst_event_priv {
|
||||
*/
|
||||
struct list_head allowed_events_list;
|
||||
struct list_head queued_events_list;
|
||||
wait_queue_head_t queued_events_waitQ;
|
||||
wait_queue_head_t queued_events_waitq;
|
||||
struct list_head processing_events_list;
|
||||
};
|
||||
|
||||
|
||||
+9
-9
@@ -13138,7 +13138,7 @@ EXPORT_SYMBOL(scst_to_tgt_dma_dir);
|
||||
*/
|
||||
void scst_process_reset(struct scst_device *dev,
|
||||
const struct scst_session *originator, const struct scst_cmd *exclude_cmd,
|
||||
struct scst_mgmt_cmd *mcmd, bool setUA)
|
||||
struct scst_mgmt_cmd *mcmd, bool set_ua)
|
||||
{
|
||||
struct scst_tgt_dev *tgt_dev;
|
||||
struct scst_cmd *cmd;
|
||||
@@ -13196,7 +13196,7 @@ void scst_process_reset(struct scst_device *dev,
|
||||
scst_clear_aca(tgt_dev, (tgt_dev->sess != originator));
|
||||
}
|
||||
|
||||
if (setUA) {
|
||||
if (set_ua) {
|
||||
u8 sense_buffer[SCST_STANDARD_SENSE_LEN];
|
||||
int sl = scst_set_sense(sense_buffer, sizeof(sense_buffer),
|
||||
dev->d_sense, SCST_LOAD_SENSE(scst_sense_reset_UA));
|
||||
@@ -15777,8 +15777,8 @@ void scst_lib_exit(void)
|
||||
*/
|
||||
unsigned long scst_random(void)
|
||||
{
|
||||
static int Inited;
|
||||
static unsigned long RandomValue;
|
||||
static int initialized;
|
||||
static unsigned long random_value;
|
||||
static DEFINE_SPINLOCK(lock);
|
||||
/* cycles pseudo-randomly through all values between 1 and 2^31 - 2 */
|
||||
register long rv;
|
||||
@@ -15787,17 +15787,17 @@ unsigned long scst_random(void)
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&lock, flags);
|
||||
if (!Inited) {
|
||||
RandomValue = jiffies;
|
||||
Inited = 1;
|
||||
if (!initialized) {
|
||||
random_value = jiffies;
|
||||
initialized = 1;
|
||||
}
|
||||
rv = RandomValue;
|
||||
rv = random_value;
|
||||
hi = rv / 127773;
|
||||
lo = rv % 127773;
|
||||
rv = 16807 * lo - 2836 * hi;
|
||||
if (rv <= 0)
|
||||
rv += 2147483647;
|
||||
RandomValue = rv;
|
||||
random_value = rv;
|
||||
spin_unlock_irqrestore(&lock, flags);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -563,7 +563,7 @@ void scst_report_luns_changed(struct scst_acg *acg);
|
||||
void scst_abort_cmd(struct scst_cmd *cmd, struct scst_mgmt_cmd *mcmd, bool other_ini,
|
||||
bool call_dev_task_mgmt_fn_received);
|
||||
void scst_process_reset(struct scst_device *dev, const struct scst_session *originator,
|
||||
const struct scst_cmd *exclude_cmd, struct scst_mgmt_cmd *mcmd, bool setUA);
|
||||
const struct scst_cmd *exclude_cmd, struct scst_mgmt_cmd *mcmd, bool set_ua);
|
||||
void __scst_unblock_aborted_cmds(const struct scst_tgt *tgt, const struct scst_session *sess,
|
||||
const struct scst_device *device);
|
||||
void scst_unblock_aborted_cmds(const struct scst_tgt *tgt, const struct scst_session *sess,
|
||||
|
||||
+3
-3
@@ -2181,7 +2181,7 @@ static void srpt_unreg_ch(struct srpt_rdma_ch *ch)
|
||||
*/
|
||||
mutex_lock(&sport->mutex);
|
||||
list_del_rcu(&ch->list);
|
||||
wake_up(&sport->ch_releaseQ);
|
||||
wake_up(&sport->ch_release_waitq);
|
||||
mutex_unlock(&sport->mutex);
|
||||
|
||||
kref_put(&ch->kref, srpt_free_ch);
|
||||
@@ -3880,7 +3880,7 @@ static int srpt_release_sport(struct srpt_port *sport)
|
||||
__srpt_close_all_ch(sport);
|
||||
mutex_unlock(&sport->mutex);
|
||||
|
||||
while (wait_event_timeout(sport->ch_releaseQ,
|
||||
while (wait_event_timeout(sport->ch_release_waitq,
|
||||
srpt_ch_list_empty(sport), 5 * HZ) <= 0) {
|
||||
pr_info("%s: waiting for session unregistration ...\n",
|
||||
sport->scst_tgt->tgt_name);
|
||||
@@ -4251,7 +4251,7 @@ static void srpt_init_sport(struct srpt_port *sport, const struct ib_device *ib_
|
||||
int i;
|
||||
|
||||
INIT_LIST_HEAD(&sport->nexus_list);
|
||||
init_waitqueue_head(&sport->ch_releaseQ);
|
||||
init_waitqueue_head(&sport->ch_release_waitq);
|
||||
mutex_init(&sport->mutex);
|
||||
strscpy(sport->port_id, DEFAULT_SRPT_ID_STRING,
|
||||
sizeof(sport->port_id));
|
||||
|
||||
+2
-2
@@ -464,7 +464,7 @@ struct srpt_nexus {
|
||||
* @lid: cached value of the port's lid.
|
||||
* @gid: cached value of the port's gid.
|
||||
* @work: work structure for refreshing the aforementioned cached values.
|
||||
* @ch_releaseQ: Enables waiting for removal from nexus_list.
|
||||
* @ch_release_waitq: Enables waiting for removal from nexus_list.
|
||||
* @mutex: Protects @nexus_list and srpt_nexus.ch_list.
|
||||
* @nexus_list: Per-device I_T nexus list.
|
||||
* @scst_tgt: SCST target information associated with this HCA.
|
||||
@@ -481,7 +481,7 @@ struct srpt_port {
|
||||
u32 lid;
|
||||
union ib_gid gid;
|
||||
struct work_struct work;
|
||||
wait_queue_head_t ch_releaseQ;
|
||||
wait_queue_head_t ch_release_waitq;
|
||||
struct mutex mutex;
|
||||
struct list_head nexus_list;
|
||||
struct scst_tgt *scst_tgt;
|
||||
|
||||
Reference in New Issue
Block a user