@@ -143,7 +143,7 @@ int cifs_sign_rqst(struct smb_rqst *rqst, struct cifs_server_info *server,
spin_lock(&g_servers_lock);
if (!(cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) ||
- server->status == CifsNeedNegotiate) {
+ server->status == SERVER_STATUS_NEED_NEGOTIATE) {
spin_unlock(&g_servers_lock);
return rc;
}
@@ -111,14 +111,14 @@
*/
/* associated with each connection */
-enum statusEnum {
- CifsNew = 0,
- CifsGood,
- CifsExiting,
- CifsNeedReconnect,
- CifsNeedNegotiate,
- CifsInNegotiate,
-};
+typedef enum {
+ SERVER_STATUS_NEW = 0,
+ SERVER_STATUS_GOOD,
+ SERVER_STATUS_EXITING,
+ SERVER_STATUS_NEED_RECONNECT,
+ SERVER_STATUS_NEED_NEGOTIATE,
+ SERVER_STATUS_IN_NEGOTIATE,
+} cifs_server_status_t;
/* associated with each smb session */
enum ses_status_enum {
@@ -612,7 +612,7 @@ struct cifs_server_info {
struct smb_version_operations *ops;
struct smb_version_values *vals;
/* updates to status protected by g_servers_lock */
- enum statusEnum status; /* what we think the status is */
+ cifs_server_status_t status; /* what we think the status is */
char *hostname; /* hostname portion of UNC string */
struct socket *ssocket;
struct sockaddr_storage dstaddr;
@@ -154,9 +154,9 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
* reconnect -- should be greater than cifs socket timeout which is 7
* seconds.
*/
- while (server->status == CifsNeedReconnect) {
+ while (server->status == SERVER_STATUS_NEED_RECONNECT) {
rc = wait_event_interruptible_timeout(server->response_q,
- (server->status != CifsNeedReconnect),
+ (server->status != SERVER_STATUS_NEED_RECONNECT),
10 * HZ);
if (rc < 0) {
cifs_dbg(FYI, "%s: aborting reconnect due to a received signal by the process\n",
@@ -166,7 +166,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
/* are we still trying to reconnect? */
spin_lock(&g_servers_lock);
- if (server->status != CifsNeedReconnect) {
+ if (server->status != SERVER_STATUS_NEED_RECONNECT) {
spin_unlock(&g_servers_lock);
break;
}
@@ -202,7 +202,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
* and status set to reconnect.
*/
spin_lock(&g_servers_lock);
- if (server->status == CifsNeedReconnect) {
+ if (server->status == SERVER_STATUS_NEED_RECONNECT) {
spin_unlock(&g_servers_lock);
rc = -EHOSTDOWN;
goto out;
@@ -207,7 +207,7 @@ cifs_signal_cifsd_for_reconnect(struct cifs_server_info *server,
spin_lock(&g_servers_lock);
if (!all_channels) {
- pserver->status = CifsNeedReconnect;
+ pserver->status = SERVER_STATUS_NEED_RECONNECT;
spin_unlock(&g_servers_lock);
return;
}
@@ -215,7 +215,7 @@ cifs_signal_cifsd_for_reconnect(struct cifs_server_info *server,
list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) {
spin_lock(&ses->chan_lock);
for (i = 0; i < ses->chan_count; i++)
- ses->chans[i].server->status = CifsNeedReconnect;
+ ses->chans[i].server->status = SERVER_STATUS_NEED_RECONNECT;
spin_unlock(&ses->chan_lock);
}
spin_unlock(&g_servers_lock);
@@ -228,7 +228,7 @@ cifs_signal_cifsd_for_reconnect(struct cifs_server_info *server,
* cifs_signal_cifsd_for_reconnect
*
* @server: the tcp ses for which reconnect is needed
- * @server needs to be previously set to CifsNeedReconnect.
+ * @server needs to be previously set to SERVER_STATUS_NEED_RECONNECT.
* @mark_smb_session: whether even sessions need to be marked
*/
void
@@ -352,7 +352,7 @@ static bool cifs_server_needs_reconnect(struct cifs_server_info *server, int num
{
spin_lock(&g_servers_lock);
server->nr_targets = num_targets;
- if (server->status == CifsExiting) {
+ if (server->status == SERVER_STATUS_EXITING) {
/* the demux thread will exit normally next time through the loop */
spin_unlock(&g_servers_lock);
wake_up(&server->response_q);
@@ -362,7 +362,7 @@ static bool cifs_server_needs_reconnect(struct cifs_server_info *server, int num
cifs_dbg(FYI, "Mark tcp session as need reconnect\n");
trace_smb3_reconnect(server->current_mid, server->conn_id,
server->hostname);
- server->status = CifsNeedReconnect;
+ server->status = SERVER_STATUS_NEED_RECONNECT;
spin_unlock(&g_servers_lock);
return true;
@@ -415,17 +415,17 @@ static int __cifs_reconnect(struct cifs_server_info *server,
atomic_inc(&g_server_reconnect_count);
set_credits(server, 1);
spin_lock(&g_servers_lock);
- if (server->status != CifsExiting)
- server->status = CifsNeedNegotiate;
+ if (server->status != SERVER_STATUS_EXITING)
+ server->status = SERVER_STATUS_NEED_NEGOTIATE;
spin_unlock(&g_servers_lock);
cifs_swn_reset_server_dstaddr(server);
cifs_server_unlock(server);
mod_delayed_work(cifsiod_wq, &server->reconnect, 0);
}
- } while (server->status == CifsNeedReconnect);
+ } while (server->status == SERVER_STATUS_NEED_RECONNECT);
spin_lock(&g_servers_lock);
- if (server->status == CifsNeedNegotiate)
+ if (server->status == SERVER_STATUS_NEED_NEGOTIATE)
mod_delayed_work(cifsiod_wq, &server->echo, 0);
spin_unlock(&g_servers_lock);
@@ -535,20 +535,20 @@ static int reconnect_dfs_server(struct cifs_server_info *server)
continue;
}
/*
- * Socket was created. Update tcp session status to CifsNeedNegotiate so that a
+ * Socket was created. Update tcp session status to SERVER_STATUS_NEED_NEGOTIATE so that a
* process waiting for reconnect will know it needs to re-establish session and tcon
* through the reconnected target server.
*/
atomic_inc(&g_server_reconnect_count);
set_credits(server, 1);
spin_lock(&g_servers_lock);
- if (server->status != CifsExiting)
- server->status = CifsNeedNegotiate;
+ if (server->status != SERVER_STATUS_EXITING)
+ server->status = SERVER_STATUS_NEED_NEGOTIATE;
spin_unlock(&g_servers_lock);
cifs_swn_reset_server_dstaddr(server);
cifs_server_unlock(server);
mod_delayed_work(cifsiod_wq, &server->reconnect, 0);
- } while (server->status == CifsNeedReconnect);
+ } while (server->status == SERVER_STATUS_NEED_RECONNECT);
if (target_hint)
dfs_cache_noreq_update_tgthint(refpath, target_hint);
@@ -557,7 +557,7 @@ static int reconnect_dfs_server(struct cifs_server_info *server)
/* Need to set up echo worker again once connection has been established */
spin_lock(&g_servers_lock);
- if (server->status == CifsNeedNegotiate)
+ if (server->status == SERVER_STATUS_NEED_NEGOTIATE)
mod_delayed_work(cifsiod_wq, &server->echo, 0);
spin_unlock(&g_servers_lock);
@@ -604,9 +604,9 @@ cifs_echo_request(struct work_struct *work)
* Also, no need to ping if we got a response recently.
*/
- if (server->status == CifsNeedReconnect ||
- server->status == CifsExiting ||
- server->status == CifsNew ||
+ if (server->status == SERVER_STATUS_NEED_RECONNECT ||
+ server->status == SERVER_STATUS_EXITING ||
+ server->status == SERVER_STATUS_NEW ||
(server->ops->can_echo && !server->ops->can_echo(server)) ||
time_before(jiffies, server->lstrp + server->echo_interval - HZ))
goto requeue_echo;
@@ -671,8 +671,8 @@ server_unresponsive(struct cifs_server_info *server)
* a response in >60s.
*/
spin_lock(&g_servers_lock);
- if ((server->status == CifsGood ||
- server->status == CifsNeedNegotiate) &&
+ if ((server->status == SERVER_STATUS_GOOD ||
+ server->status == SERVER_STATUS_NEED_NEGOTIATE) &&
(!server->ops->can_echo || server->ops->can_echo(server)) &&
time_after(jiffies, server->lstrp + 3 * server->echo_interval)) {
spin_unlock(&g_servers_lock);
@@ -727,12 +727,12 @@ cifs_readv_from_socket(struct cifs_server_info *server, struct msghdr *smb_msg)
length = sock_recvmsg(server->ssocket, smb_msg, 0);
spin_lock(&g_servers_lock);
- if (server->status == CifsExiting) {
+ if (server->status == SERVER_STATUS_EXITING) {
spin_unlock(&g_servers_lock);
return -ESHUTDOWN;
}
- if (server->status == CifsNeedReconnect) {
+ if (server->status == SERVER_STATUS_NEED_RECONNECT) {
spin_unlock(&g_servers_lock);
cifs_reconnect(server, false);
return -ECONNABORTED;
@@ -745,7 +745,7 @@ cifs_readv_from_socket(struct cifs_server_info *server, struct msghdr *smb_msg)
/*
* Minimum sleep to prevent looping, allowing socket
* to clear and app threads to set status
- * CifsNeedReconnect if server hung.
+ * SERVER_STATUS_NEED_RECONNECT if server hung.
*/
usleep_range(1000, 2000);
length = 0;
@@ -916,7 +916,7 @@ static void clean_demultiplex_info(struct cifs_server_info *server)
cancel_delayed_work_sync(&server->resolve);
spin_lock(&g_servers_lock);
- server->status = CifsExiting;
+ server->status = SERVER_STATUS_EXITING;
spin_unlock(&g_servers_lock);
wake_up_all(&server->response_q);
@@ -1123,7 +1123,7 @@ cifs_demultiplex_thread(void *p)
set_freezable();
allow_kernel_signal(SIGKILL);
- while (server->status != CifsExiting) {
+ while (server->status != SERVER_STATUS_EXITING) {
if (try_to_freeze())
continue;
@@ -1534,7 +1534,7 @@ cifs_put_server(struct cifs_server_info *server, int from_reconnect)
cancel_delayed_work_sync(&server->reconnect);
spin_lock(&g_servers_lock);
- server->status = CifsExiting;
+ server->status = SERVER_STATUS_EXITING;
spin_unlock(&g_servers_lock);
cifs_crypto_secmech_release(server);
@@ -1634,7 +1634,7 @@ cifs_get_server(struct smb3_fs_context *ctx,
* to the struct since the kernel thread not created yet
* no need to spinlock this init of status or srv_count
*/
- server->status = CifsNew;
+ server->status = SERVER_STATUS_NEW;
++server->srv_count;
if (ctx->echo_interval >= SMB_ECHO_INTERVAL_MIN &&
@@ -1685,7 +1685,7 @@ cifs_get_server(struct smb3_fs_context *ctx,
* no need to spinlock this update of status
*/
spin_lock(&g_servers_lock);
- server->status = CifsNeedNegotiate;
+ server->status = SERVER_STATUS_NEED_NEGOTIATE;
spin_unlock(&g_servers_lock);
if ((ctx->max_credits < 20) || (ctx->max_credits > 60000))
@@ -3179,7 +3179,7 @@ static int mount_get_conns(struct mount_ctx *mnt_ctx)
*/
reset_cifs_unix_caps(xid, tcon, cifs_sb, ctx);
spin_lock(&g_servers_lock);
- if ((tcon->ses->server->status == CifsNeedReconnect) &&
+ if ((tcon->ses->server->status == SERVER_STATUS_NEED_RECONNECT) &&
(le64_to_cpu(tcon->fsUnixInfo.Capability) &
CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP)) {
spin_unlock(&g_servers_lock);
@@ -3988,25 +3988,25 @@ cifs_negotiate_protocol(const unsigned int xid, struct cifs_ses *ses,
/* only send once per connect */
spin_lock(&g_servers_lock);
if (!server->ops->need_neg(server) ||
- server->status != CifsNeedNegotiate) {
+ server->status != SERVER_STATUS_NEED_NEGOTIATE) {
spin_unlock(&g_servers_lock);
return 0;
}
- server->status = CifsInNegotiate;
+ server->status = SERVER_STATUS_IN_NEGOTIATE;
spin_unlock(&g_servers_lock);
rc = server->ops->negotiate(xid, ses, server);
if (rc == 0) {
spin_lock(&g_servers_lock);
- if (server->status == CifsInNegotiate)
- server->status = CifsGood;
+ if (server->status == SERVER_STATUS_IN_NEGOTIATE)
+ server->status = SERVER_STATUS_GOOD;
else
rc = -EHOSTDOWN;
spin_unlock(&g_servers_lock);
} else {
spin_lock(&g_servers_lock);
- if (server->status == CifsInNegotiate)
- server->status = CifsNeedNegotiate;
+ if (server->status == SERVER_STATUS_IN_NEGOTIATE)
+ server->status = SERVER_STATUS_NEED_NEGOTIATE;
spin_unlock(&g_servers_lock);
}
@@ -1024,7 +1024,7 @@ cifs_dir_needs_close(struct cifs_file_info *cfile)
static bool
cifs_can_echo(struct cifs_server_info *server)
{
- if (server->status == CifsGood)
+ if (server->status == SERVER_STATUS_GOOD)
return true;
return false;
@@ -127,8 +127,8 @@ smb2_add_credits(struct cifs_server_info *server,
}
spin_lock(&g_servers_lock);
- if (server->status == CifsNeedReconnect
- || server->status == CifsExiting) {
+ if (server->status == SERVER_STATUS_NEED_RECONNECT
+ || server->status == SERVER_STATUS_EXITING) {
spin_unlock(&g_servers_lock);
return;
}
@@ -219,7 +219,7 @@ smb2_wait_mtu_credits(struct cifs_server_info *server, unsigned int size,
} else {
spin_unlock(&server->req_lock);
spin_lock(&g_servers_lock);
- if (server->status == CifsExiting) {
+ if (server->status == SERVER_STATUS_EXITING) {
spin_unlock(&g_servers_lock);
return -ENOENT;
}
@@ -5080,7 +5080,7 @@ static void smb2_decrypt_offload(struct work_struct *work)
} else {
spin_lock(&g_servers_lock);
spin_lock(&g_mid_lock);
- if (dw->server->status == CifsNeedReconnect) {
+ if (dw->server->status == SERVER_STATUS_NEED_RECONNECT) {
mid->mid_state = MID_RETRY_NEEDED;
spin_unlock(&g_mid_lock);
spin_unlock(&g_servers_lock);
@@ -191,7 +191,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
* reconnect -- should be greater than cifs socket timeout which is 7
* seconds.
*/
- while (server->status == CifsNeedReconnect) {
+ while (server->status == SERVER_STATUS_NEED_RECONNECT) {
/*
* Return to caller for TREE_DISCONNECT and LOGOFF and CLOSE
* here since they are implicitly done when session drops.
@@ -208,7 +208,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
}
rc = wait_event_interruptible_timeout(server->response_q,
- (server->status != CifsNeedReconnect),
+ (server->status != SERVER_STATUS_NEED_RECONNECT),
10 * HZ);
if (rc < 0) {
cifs_dbg(FYI, "%s: aborting reconnect due to a received signal by the process\n",
@@ -218,7 +218,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
/* are we still trying to reconnect? */
spin_lock(&g_servers_lock);
- if (server->status != CifsNeedReconnect) {
+ if (server->status != SERVER_STATUS_NEED_RECONNECT) {
spin_unlock(&g_servers_lock);
break;
}
@@ -257,7 +257,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
* and status set to reconnect.
*/
spin_lock(&g_servers_lock);
- if (server->status == CifsNeedReconnect) {
+ if (server->status == SERVER_STATUS_NEED_RECONNECT) {
spin_unlock(&g_servers_lock);
rc = -EHOSTDOWN;
goto out;
@@ -763,18 +763,18 @@ smb2_get_mid_entry(struct cifs_ses *ses, struct cifs_server_info *server,
struct smb2_hdr *shdr, struct mid_q_entry **mid)
{
spin_lock(&g_servers_lock);
- if (server->status == CifsExiting) {
+ if (server->status == SERVER_STATUS_EXITING) {
spin_unlock(&g_servers_lock);
return -ENOENT;
}
- if (server->status == CifsNeedReconnect) {
+ if (server->status == SERVER_STATUS_NEED_RECONNECT) {
spin_unlock(&g_servers_lock);
cifs_dbg(FYI, "tcp session dead - return to caller to retry\n");
return -EAGAIN;
}
- if (server->status == CifsNeedNegotiate &&
+ if (server->status == SERVER_STATUS_NEED_NEGOTIATE &&
shdr->Command != SMB2_NEGOTIATE) {
spin_unlock(&g_servers_lock);
return -EAGAIN;
@@ -870,7 +870,7 @@ smb2_setup_async_request(struct cifs_server_info *server, struct smb_rqst *rqst)
struct mid_q_entry *mid;
spin_lock(&g_servers_lock);
- if (server->status == CifsNeedNegotiate &&
+ if (server->status == SERVER_STATUS_NEED_NEGOTIATE &&
shdr->Command != SMB2_NEGOTIATE) {
spin_unlock(&g_servers_lock);
return ERR_PTR(-EAGAIN);
@@ -578,7 +578,7 @@ wait_for_free_credits(struct cifs_server_info *server, const int num_credits,
spin_unlock(&server->req_lock);
spin_lock(&g_servers_lock);
- if (server->status == CifsExiting) {
+ if (server->status == SERVER_STATUS_EXITING) {
spin_unlock(&g_servers_lock);
return -ENOENT;
}
@@ -1079,7 +1079,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
}
spin_lock(&g_servers_lock);
- if (server->status == CifsExiting) {
+ if (server->status == SERVER_STATUS_EXITING) {
spin_unlock(&g_servers_lock);
return -ENOENT;
}
@@ -1361,7 +1361,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses,
}
spin_lock(&g_servers_lock);
- if (server->status == CifsExiting) {
+ if (server->status == SERVER_STATUS_EXITING) {
spin_unlock(&g_servers_lock);
return -ENOENT;
}
@@ -1506,7 +1506,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
}
spin_lock(&g_servers_lock);
- if (server->status == CifsExiting) {
+ if (server->status == SERVER_STATUS_EXITING) {
spin_unlock(&g_servers_lock);
return -ENOENT;
}
@@ -1564,15 +1564,15 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
/* Wait for a reply - allow signals to interrupt. */
rc = wait_event_interruptible(server->response_q,
(!(midQ->mid_state == MID_REQUEST_SUBMITTED)) ||
- ((server->status != CifsGood) &&
- (server->status != CifsNew)));
+ ((server->status != SERVER_STATUS_GOOD) &&
+ (server->status != SERVER_STATUS_NEW)));
/* Were we interrupted by a signal ? */
spin_lock(&g_servers_lock);
if ((rc == -ERESTARTSYS) &&
(midQ->mid_state == MID_REQUEST_SUBMITTED) &&
- ((server->status == CifsGood) ||
- (server->status == CifsNew))) {
+ ((server->status == SERVER_STATUS_GOOD) ||
+ (server->status == SERVER_STATUS_NEW))) {
spin_unlock(&g_servers_lock);
if (in_buf->Command == SMB_COM_TRANSACTION2) {
typedef "enum statusEnum" to "cifs_server_status_t". Rename the status values from CamelCase to snake_case. Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de> --- fs/cifs/cifsencrypt.c | 2 +- fs/cifs/cifsglob.h | 18 +++++------ fs/cifs/cifssmb.c | 8 ++--- fs/cifs/connect.c | 68 ++++++++++++++++++++--------------------- fs/cifs/smb1ops.c | 2 +- fs/cifs/smb2ops.c | 8 ++--- fs/cifs/smb2pdu.c | 8 ++--- fs/cifs/smb2transport.c | 8 ++--- fs/cifs/transport.c | 16 +++++----- 9 files changed, 69 insertions(+), 69 deletions(-)