cifs: rename of several structs and variables
Subsystems (2)
v2 cover cifs: rename of several structs and variables
Hi all,
This patch set (v2) renames several cifs.ko data structures, variables, and functions with the goal to improve readability of the code.
In summary, what's been done:
- change from CamelCase to snake_case
- try to give more meaning to globals and struct members
- rename status fields (server, ses, tcon), define constants for the various statuses (4/11 can be shared between those structs, others are specific to each)
- rename of list_head variables to better represent whether they'are used as a list element ("head") or a list per se. Also tried to give more meaning to these, as "rlist", "tlist", "llist" looked confusing and, sometimes, ambiguous.
- remove redundant prefixes from struct members name, e.g. tcon_tlink's tl_*, smb_rqst's rq_*, cifs_fattr's cf_*, etc
No functional changes has been made.
I know these touch some very old code that older devs are highly used to, but I see this as an improvement to reading the code for everyone.
I'll be waiting for your reviews and feedback.
Cheers,
Enzo
v2:
- remove status typedefs (suggested by Christoph Hellwig)
- define status constants instead, reuse some between different structs so we don't have to create a different set of statuses for each cifs struct
Enzo Matsumiya (10):
cifs: rename xid/mid globals
cifs: rename global counters
cifs: rename "TCP_Server_Info" struct to "cifs_server_info"
cifs: rename cifs{File,Lock,Inode}Info structs and more
cifs: convert server info vars to snake_case
cifs: change status and security types enums to constants
cifs: rename cifsFYI to debug_level
cifs: rename list_head fields
cifs: rename more CamelCase to snake_case
cifs: rename more list_heads, remove redundant prefixes
fs/cifs/Kconfig | 2 +- fs/cifs/asn1.c | 4 +- fs/cifs/cifs_debug.c | 158 ++++----- fs/cifs/cifs_debug.h | 29 +- fs/cifs/cifs_spnego.c | 4 +- fs/cifs/cifs_spnego.h | 2 +- fs/cifs/cifs_swn.c | 24 +- fs/cifs/cifs_swn.h | 8 +- fs/cifs/cifs_unicode.c | 4 +- fs/cifs/cifs_unicode.h | 2 +- fs/cifs/cifsacl.c | 22 +- fs/cifs/cifsencrypt.c | 78 ++--- fs/cifs/cifsfs.c | 124 +++---- fs/cifs/cifsglob.h | 694 ++++++++++++++++++++-------------------- fs/cifs/cifsproto.h | 172 +++++----- fs/cifs/cifssmb.c | 356 ++++++++++----------- fs/cifs/connect.c | 574 ++++++++++++++++----------------- fs/cifs/dfs_cache.c | 178 +++++------ fs/cifs/dfs_cache.h | 40 +-- fs/cifs/dir.c | 16 +- fs/cifs/file.c | 636 ++++++++++++++++++------------------ fs/cifs/fs_context.c | 8 +- fs/cifs/fs_context.h | 2 +- fs/cifs/fscache.c | 18 +- fs/cifs/fscache.h | 10 +- fs/cifs/inode.c | 530 +++++++++++++++--------------- fs/cifs/ioctl.c | 18 +- fs/cifs/link.c | 26 +- fs/cifs/misc.c | 185 ++++++----- fs/cifs/netmisc.c | 4 +- fs/cifs/ntlmssp.h | 6 +- fs/cifs/readdir.c | 344 ++++++++++---------- fs/cifs/sess.c | 142 ++++---- fs/cifs/smb1ops.c | 182 +++++------ fs/cifs/smb2file.c | 36 +-- fs/cifs/smb2inode.c | 136 ++++---- fs/cifs/smb2maperror.c | 2 +- fs/cifs/smb2misc.c | 72 ++--- fs/cifs/smb2ops.c | 555 ++++++++++++++++---------------- fs/cifs/smb2pdu.c | 596 +++++++++++++++++----------------- fs/cifs/smb2proto.h | 68 ++-- fs/cifs/smb2transport.c | 112 +++---- fs/cifs/smbdirect.c | 28 +- fs/cifs/smbdirect.h | 16 +- fs/cifs/transport.c | 236 +++++++------- fs/cifs/xattr.c | 12 +- 46 files changed, 3230 insertions(+), 3241 deletions(-)
Signature · 1 line
2.35.3
RFC PATCH v2 1/10 cifs: rename xid/mid globals
Rename XID and MID global locks and counters.
Convert from CamelCase to snake_case.
Prepend "g_" to indicate a global.
--- fs/cifs/cifs_debug.c | 18 +++++++++--------- fs/cifs/cifsfs.c | 6 +++--- fs/cifs/cifsglob.h | 12 ++++++------ fs/cifs/connect.c | 14 +++++++------- fs/cifs/misc.c | 22 +++++++++++----------- fs/cifs/smb1ops.c | 10 +++++----- fs/cifs/smb2ops.c | 24 ++++++++++++------------ fs/cifs/smb2transport.c | 4 ++-- fs/cifs/transport.c | 38 +++++++++++++++++++------------------- 9 files changed, 74 insertions(+), 74 deletions(-)
fs/cifs/cifs_debug.c +9 -9
@@ -55,7 +55,7 @@ void cifs_dump_mids(struct TCP_Server_Info *server)return ;cifs_dbg (VFS ,"Dump pending requests:\n" ); -spin_lock (&GlobalMid_Lock); +spin_lock (&g_mid_lock);list_for_each_entry (mid_entry, &server->pending_mid_q, qhead) { cifs_dbg(VFS, "State: %d Cmd: %d Pid: %d Cbdata: %p Mid %llu\n", mid_entry->mid_state,
@@ -78,7 +78,7 @@ void cifs_dump_mids(struct TCP_Server_Info *server) mid_entry->resp_buf, 62); } } -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock);#endif /* CONFIG_CIFS_DEBUG2 */ }
@@ -262,7 +262,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)#endif seq_putc (m,'\n' );seq_printf (m,"CIFSMaxBufSize: %d\n" , CIFSMaxBufSize); -seq_printf (m,"Active VFS Requests: %d\n" , GlobalTotalActiveXid); +seq_printf (m,"Active VFS Requests: %d\n" , g_total_active_xid);seq_printf (m,"\nServers: " );
@@ -463,7 +463,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)seq_printf (m,"\n\t\t[NONE]" );seq_puts (m,"\n\n\tMIDs: " ); -spin_lock (&GlobalMid_Lock); +spin_lock (&g_mid_lock);list_for_each_entry (mid_entry, &server->pending_mid_q, qhead) { seq_printf(m, "\n\tState: %d com: %d pid:" " %d cbdata: %p mid %llu\n",
@@ -473,7 +473,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v) mid_entry->callback_data, mid_entry->mid); } -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock);seq_printf (m,"\n--\n" ); }if (c ==0 )
@@ -507,10 +507,10 @@ static ssize_t cifs_stats_proc_write(struct file *file,atomic_set (&tcpSesReconnectCount,0 );atomic_set (&tconInfoReconnectCount,0 ); -spin_lock (&GlobalMid_Lock); +spin_lock (&g_mid_lock); GlobalMaxActiveXid =0 ; - GlobalCurrentXid =0 ; -spin_unlock (&GlobalMid_Lock); + g_current_xid =0 ; +spin_unlock (&g_mid_lock);spin_lock (&g_servers_lock);list_for_each_entry (server, &g_servers_list, server_head) { server->max_in_flight =0 ;
@@ -575,7 +575,7 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)seq_printf (m,"Total vfs operations: %d maximum at one time: %d\n" , - GlobalCurrentXid, GlobalMaxActiveXid); + g_current_xid, GlobalMaxActiveXid); i =0 ;spin_lock (&g_servers_lock);
fs/cifs/cifsfs.c +3 -3
@@ -1601,11 +1601,11 @@ init_cifs(void)#endif /* CONFIG_CIFS_STATS2 */ atomic_set (&mid_count,0 ); - GlobalCurrentXid =0 ; - GlobalTotalActiveXid =0 ; + g_current_xid =0 ; + g_total_active_xid =0 ; GlobalMaxActiveXid =0 ;spin_lock_init (&g_servers_lock); -spin_lock_init (&GlobalMid_Lock); +spin_lock_init (&g_mid_lock); cifs_lock_secret =get_random_u32 ();
fs/cifs/cifsglob.h +6 -6
@@ -658,7 +658,7 @@ struct TCP_Server_Info {/* SMB_COM_WRITE_RAW or SMB_COM_READ_RAW. */ unsigned int capabilities;/* selective disabling of caps by smb sess */ int timeAdj;/* Adjust for difference in server time zone in sec */ -__u64 CurrentMid;/* multiplex id - rotating counter, protected by GlobalMid_Lock */ +__u64 CurrentMid;/* multiplex id - rotating counter, protected by g_mid_lock */ char cryptkey[CIFS_CRYPTO_KEY_SIZE ];/* used by ntlm, ntlmv2 etc */ /* 16th byte of RFC1001 workstation name is always null */ char workstation_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL ];
@@ -1904,7 +1904,7 @@ require use of the stronger protocol */* * Spinlocks * --------- -* GlobalMid_Lock protects: +* g_mid_lock protects: * list operations on pending_mid_q and oplockQ * updates to XID counters, multiplex id and SMB sequence numbers * list operations on global DnotifyReqList
@@ -1958,10 +1958,10 @@ extern spinlock_t g_servers_lock;/* * Global transaction id (XID) information */ -GLOBAL_EXTERN unsigned int GlobalCurrentXid; /* protected by GlobalMid_Sem */ -GLOBAL_EXTERN unsigned int GlobalTotalActiveXid; /* prot by GlobalMid_Sem */ -GLOBAL_EXTERN unsigned int GlobalMaxActiveXid; /* prot by GlobalMid_Sem */ -GLOBAL_EXTERN spinlock_t GlobalMid_Lock; /* protects above & list operations */ +GLOBAL_EXTERN unsigned int g_current_xid; /* protected by g_mid_lock */ +GLOBAL_EXTERN unsigned int g_total_active_xid; /* prot by g_mid_lock */ +GLOBAL_EXTERN unsigned int g_max_active_xid /* prot by g_mid_lock */ +GLOBAL_EXTERN spinlock_t g_mid_lock; /* protects above & list operations *//* on midQ entries */ /* * Global counters, updated atomically
fs/cifs/connect.c +7 -7
@@ -323,7 +323,7 @@ cifs_abort_connection(struct TCP_Server_Info *server)/* mark submitted MIDs for retry and issue callback */ INIT_LIST_HEAD (&retry_list);cifs_dbg (FYI ,"%s: moving mids to private list\n" , __func__); -spin_lock (&GlobalMid_Lock); +spin_lock (&g_mid_lock);list_for_each_entry_safe (mid, nmid, &server->pending_mid_q, qhead) {kref_get (&mid->refcount);if (mid->mid_state ==MID_REQUEST_SUBMITTED )
@@ -331,7 +331,7 @@ cifs_abort_connection(struct TCP_Server_Info *server)list_move (&mid->qhead, &retry_list); mid->mid_flags |=MID_DELETED ; } -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock);cifs_server_unlock (server);cifs_dbg (FYI ,"%s: issuing mid callbacks\n" , __func__);
@@ -849,7 +849,7 @@ dequeue_mid(struct mid_q_entry *mid, bool malformed)#ifdef CONFIG_CIFS_STATS2 mid->when_received = jiffies;#endif -spin_lock (&GlobalMid_Lock); +spin_lock (&g_mid_lock);if (!malformed) mid->mid_state =MID_RESPONSE_RECEIVED ;else
@@ -859,12 +859,12 @@ dequeue_mid(struct mid_q_entry *mid, bool malformed)* function has finished processing it is a bug. */ if (mid->mid_flags &MID_DELETED ) { -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock);pr_warn_once ("trying to dequeue a deleted mid\n" ); }else {list_del_init (&mid->qhead); mid->mid_flags |=MID_DELETED ; -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock); } }
@@ -948,7 +948,7 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server)struct list_head *tmp, *tmp2;INIT_LIST_HEAD (&dispose_list); -spin_lock (&GlobalMid_Lock); +spin_lock (&g_mid_lock);list_for_each_safe (tmp, tmp2, &server->pending_mid_q) { mid_entry = list_entry(tmp, struct mid_q_entry, qhead);cifs_dbg (FYI ,"Clearing mid %llu\n" , mid_entry->mid);
@@ -957,7 +957,7 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server)list_move (&mid_entry->qhead, &dispose_list); mid_entry->mid_flags |=MID_DELETED ; } -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock);/* now walk dispose list and issue callbacks */ list_for_each_safe (tmp, tmp2, &dispose_list) {
fs/cifs/misc.c +11 -11
@@ -38,27 +38,27 @@ _get_xid(void) {unsigned int xid; -spin_lock (&GlobalMid_Lock); - GlobalTotalActiveXid++; +spin_lock (&g_mid_lock); + g_total_active_xid++;/* keep high water mark for number of simultaneous ops in filesystem */ -if (GlobalTotalActiveXid > GlobalMaxActiveXid) - GlobalMaxActiveXid = GlobalTotalActiveXid; -if (GlobalTotalActiveXid >65000 ) +if (g_total_active_xid > GlobalMaxActiveXid) + GlobalMaxActiveXid = g_total_active_xid; +if (g_total_active_xid >65000 )cifs_dbg (FYI ,"warning: more than 65000 requests active\n" ); - xid = GlobalCurrentXid++; -spin_unlock (&GlobalMid_Lock); + xid = g_current_xid++; +spin_unlock (&g_mid_lock);return xid; }void _free_xid (unsigned int xid) { -spin_lock (&GlobalMid_Lock); -/* if (GlobalTotalActiveXid == 0) +spin_lock (&g_mid_lock); +/* if (g_total_active_xid == 0) BUG(); */ - GlobalTotalActiveXid--; -spin_unlock (&GlobalMid_Lock); + g_total_active_xid--; +spin_unlock (&g_mid_lock); } struct cifs_ses *
fs/cifs/smb1ops.c +5 -5
@@ -92,17 +92,17 @@ cifs_find_mid(struct TCP_Server_Info *server, char *buffer)struct smb_hdr *buf = (struct smb_hdr *)buffer;struct mid_q_entry *mid; -spin_lock (&GlobalMid_Lock); +spin_lock (&g_mid_lock);list_for_each_entry (mid, &server->pending_mid_q, qhead) {if (compare_mid (mid->mid, buf) && mid->mid_state ==MID_REQUEST_SUBMITTED &&le16_to_cpu (mid->command) == buf->Command) {kref_get (&mid->refcount); -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock);return mid; } } -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock);return NULL ; }
@@ -166,7 +166,7 @@ cifs_get_next_mid(struct TCP_Server_Info *server)__u16 last_mid, cur_mid;bool collision, reconnect = false; -spin_lock (&GlobalMid_Lock); +spin_lock (&g_mid_lock);/* mid is 16 bit only for CIFS/SMB */ cur_mid = (__u16)((server->CurrentMid) &0xffff );
@@ -225,7 +225,7 @@ cifs_get_next_mid(struct TCP_Server_Info *server) } cur_mid++; } -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock);if (reconnect) {cifs_signal_cifsd_for_reconnect (server, false);
fs/cifs/smb2ops.c +12 -12
@@ -319,19 +319,19 @@ smb2_get_next_mid(struct TCP_Server_Info *server) {__u64 mid;/* for SMB2 we need the current value */ -spin_lock (&GlobalMid_Lock); +spin_lock (&g_mid_lock); mid = server->CurrentMid++; -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock);return mid; }static void smb2_revert_current_mid (struct TCP_Server_Info *server,const unsigned int val) { -spin_lock (&GlobalMid_Lock); +spin_lock (&g_mid_lock);if (server->CurrentMid >= val) server->CurrentMid -= val; -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock); } static struct mid_q_entry *
@@ -346,7 +346,7 @@ __smb2_find_mid(struct TCP_Server_Info *server, char *buf, bool dequeue)return NULL ; } -spin_lock (&GlobalMid_Lock); +spin_lock (&g_mid_lock);list_for_each_entry (mid, &server->pending_mid_q, qhead) { if ((mid->mid == wire_mid) && (mid->mid_state == MID_REQUEST_SUBMITTED) &&
@@ -356,11 +356,11 @@ __smb2_find_mid(struct TCP_Server_Info *server, char *buf, bool dequeue)list_del_init (&mid->qhead); mid->mid_flags |=MID_DELETED ; } -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock);return mid; } } -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock);return NULL ; }
@@ -403,9 +403,9 @@ smb2_negotiate(const unsigned int xid, {int rc; -spin_lock (&GlobalMid_Lock); +spin_lock (&g_mid_lock); server->CurrentMid =0 ; -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock); rc =SMB2_negotiate (xid, ses, server);/* BB we probably don't need to retry with modern servers */ if (rc == -EAGAIN )
@@ -5079,10 +5079,10 @@ static void smb2_decrypt_offload(struct work_struct *work) mid->callback (mid); }else {spin_lock (&g_servers_lock); -spin_lock (&GlobalMid_Lock); +spin_lock (&g_mid_lock);if (dw->server->tcpStatus == CifsNeedReconnect) { mid->mid_state =MID_RETRY_NEEDED ; -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock);spin_unlock (&g_servers_lock); mid->callback (mid); }else {
@@ -5090,7 +5090,7 @@ static void smb2_decrypt_offload(struct work_struct *work) mid->mid_flags &= ~(MID_DELETED );list_add_tail (&mid->qhead, &dw->server->pending_mid_q); -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock);spin_unlock (&g_servers_lock); } }
fs/cifs/smb2transport.c +2 -2
@@ -801,9 +801,9 @@ smb2_get_mid_entry(struct cifs_ses *ses, struct TCP_Server_Info *server, *mid =smb2_mid_entry_alloc (shdr, server);if (*mid ==NULL )return -ENOMEM ; -spin_lock (&GlobalMid_Lock); +spin_lock (&g_mid_lock);list_add_tail (&(*mid)->qhead, &server->pending_mid_q); -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock);return 0 ; }
fs/cifs/transport.c +19 -19
@@ -154,9 +154,9 @@ static void _cifs_mid_q_entry_release(struct kref *refcount)void cifs_mid_q_entry_release (struct mid_q_entry *midEntry) { -spin_lock (&GlobalMid_Lock); +spin_lock (&g_mid_lock);kref_put (&midEntry->refcount, _cifs_mid_q_entry_release); -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock); }void DeleteMidQEntry (struct mid_q_entry *midEntry)
@@ -167,12 +167,12 @@ void DeleteMidQEntry(struct mid_q_entry *midEntry)void cifs_delete_mid (struct mid_q_entry *mid) { -spin_lock (&GlobalMid_Lock); +spin_lock (&g_mid_lock);if (!(mid->mid_flags &MID_DELETED )) {list_del_init (&mid->qhead); mid->mid_flags |=MID_DELETED ; } -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock);DeleteMidQEntry (mid); }
@@ -748,9 +748,9 @@ static int allocate_mid(struct cifs_ses *ses, struct smb_hdr *in_buf, *ppmidQ =AllocMidQEntry (in_buf, ses->server);if (*ppmidQ ==NULL )return -ENOMEM ; -spin_lock (&GlobalMid_Lock); +spin_lock (&g_mid_lock);list_add_tail (&(*ppmidQ)->qhead, &ses->server->pending_mid_q); -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock);return 0 ; }
@@ -849,9 +849,9 @@ cifs_call_async(struct TCP_Server_Info *server, struct smb_rqst *rqst, mid->mid_state =MID_REQUEST_SUBMITTED ;/* put it on the pending_mid_q */ -spin_lock (&GlobalMid_Lock); +spin_lock (&g_mid_lock);list_add_tail (&mid->qhead, &server->pending_mid_q); -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock);/* * Need to store the time in mid before calling I/O. For call_async,
@@ -912,10 +912,10 @@ cifs_sync_mid_result(struct mid_q_entry *mid, struct TCP_Server_Info *server)cifs_dbg (FYI ,"%s: cmd=%d mid=%llu state=%d\n" , __func__,le16_to_cpu (mid->command), mid->mid, mid->mid_state); -spin_lock (&GlobalMid_Lock); +spin_lock (&g_mid_lock);switch (mid->mid_state) {case MID_RESPONSE_RECEIVED : -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock);return rc;case MID_RETRY_NEEDED : rc = -EAGAIN ;
@@ -935,7 +935,7 @@ cifs_sync_mid_result(struct mid_q_entry *mid, struct TCP_Server_Info *server) __func__, mid->mid, mid->mid_state); rc = -EIO ; } -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock);DeleteMidQEntry (mid);return rc;
@@ -1208,14 +1208,14 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,cifs_server_dbg (FYI ,"Cancelling wait for mid %llu cmd: %d\n" , midQ[i]->mid,le16_to_cpu (midQ[i]->command));send_cancel (server, &rqst[i], midQ[i]); -spin_lock (&GlobalMid_Lock); +spin_lock (&g_mid_lock); midQ[i]->mid_flags |=MID_WAIT_CANCELLED ;if (midQ[i]->mid_state ==MID_REQUEST_SUBMITTED ) { midQ[i]->callback = cifs_cancelled_callback; cancelled_mid[i] = true; credits[i].value =0 ; } -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock); } }
@@ -1419,15 +1419,15 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses, rc =wait_for_response (server, midQ);if (rc !=0 ) {send_cancel (server, &rqst, midQ); -spin_lock (&GlobalMid_Lock); +spin_lock (&g_mid_lock);if (midQ->mid_state ==MID_REQUEST_SUBMITTED ) {/* no longer considered to be "in-flight" */ midQ->callback = DeleteMidQEntry; -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock);add_credits (server, &credits,0 );return rc; } -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock); } rc =cifs_sync_mid_result (midQ, server);
@@ -1600,14 +1600,14 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon, rc =wait_for_response (server, midQ);if (rc) {send_cancel (server, &rqst, midQ); -spin_lock (&GlobalMid_Lock); +spin_lock (&g_mid_lock);if (midQ->mid_state ==MID_REQUEST_SUBMITTED ) {/* no longer considered to be "in-flight" */ midQ->callback = DeleteMidQEntry; -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock);return rc; } -spin_unlock (&GlobalMid_Lock); +spin_unlock (&g_mid_lock); }/* We got the response - restart system call. */
Signature · 1 line
2.35.3
RFC PATCH v2 2/10 cifs: rename global counters
In reply to Enzo MatsumiyaRename global counters from CamelCase to snake_case. Rename server counters from "tcpSes" to use "servers" instead. Prepend "g_" to indicate global.
--- fs/cifs/cifs_debug.c | 16 ++++++++-------- fs/cifs/cifsfs.c | 14 +++++++------- fs/cifs/cifsglob.h | 18 +++++++++--------- fs/cifs/cifssmb.c | 2 +- fs/cifs/connect.c | 10 +++++----- fs/cifs/misc.c | 12 ++++++------ fs/cifs/smb2pdu.c | 2 +- 7 files changed, 37 insertions(+), 37 deletions(-)
fs/cifs/cifs_debug.c +8 -8
@@ -504,11 +504,11 @@ static ssize_t cifs_stats_proc_write(struct file *file,atomic_set (&total_buf_alloc_count,0 );atomic_set (&total_small_buf_alloc_count,0 );#endif /* CONFIG_CIFS_STATS2 */ -atomic_set (&tcpSesReconnectCount,0 ); -atomic_set (&tconInfoReconnectCount,0 ); +atomic_set (&g_server_reconnect_count,0 ); +atomic_set (&g_tcon_reconnect_count,0 );spin_lock (&g_mid_lock); - GlobalMaxActiveXid =0 ; + g_max_active_xid =0 ; g_current_xid =0 ;spin_unlock (&g_mid_lock);spin_lock (&g_servers_lock);
@@ -554,12 +554,12 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)struct cifs_tcon *tcon;seq_printf (m,"Resources in use\nCIFS Session: %d\n" , - sesInfoAllocCount.counter); + g_ses_alloc_count.counter);seq_printf (m,"Share (unique mount targets): %d\n" , - tconInfoAllocCount.counter); + g_tcon_alloc_count.counter);seq_printf (m,"SMB Request/Response Buffer: %d Pool size: %d\n" , buf_alloc_count.counter, - cifs_min_rcv + tcpSesAllocCount.counter); + cifs_min_rcv + g_server_alloc_count.counter);seq_printf (m,"SMB Small Req/Resp Buffer: %d Pool size: %d\n" , small_buf_alloc_count.counter, cifs_min_small);#ifdef CONFIG_CIFS_STATS2
@@ -571,11 +571,11 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)seq_printf (m,"Operations (MIDs): %d\n" ,atomic_read (&mid_count));seq_printf (m,"\n%d session %d share reconnects\n" , - tcpSesReconnectCount.counter, tconInfoReconnectCount.counter); + g_server_reconnect_count.counter, g_tcon_reconnect_count.counter);seq_printf (m,"Total vfs operations: %d maximum at one time: %d\n" , - g_current_xid, GlobalMaxActiveXid); + g_current_xid, g_max_active_xid); i =0 ;spin_lock (&g_servers_lock);
fs/cifs/cifsfs.c +7 -7
@@ -1581,12 +1581,12 @@ init_cifs(void)/* * Initialize Global counters */ -atomic_set (&sesInfoAllocCount,0 ); -atomic_set (&tconInfoAllocCount,0 ); -atomic_set (&tcpSesNextId,0 ); -atomic_set (&tcpSesAllocCount,0 ); -atomic_set (&tcpSesReconnectCount,0 ); -atomic_set (&tconInfoReconnectCount,0 ); +atomic_set (&g_ses_alloc_count,0 ); +atomic_set (&g_tcon_alloc_count,0 ); +atomic_set (&g_server_next_id,0 ); +atomic_set (&g_server_alloc_count,0 ); +atomic_set (&g_server_reconnect_count,0 ); +atomic_set (&g_tcon_reconnect_count,0 );atomic_set (&buf_alloc_count,0 );atomic_set (&small_buf_alloc_count,0 );
@@ -1603,7 +1603,7 @@ init_cifs(void)atomic_set (&mid_count,0 ); g_current_xid =0 ; g_total_active_xid =0 ; - GlobalMaxActiveXid =0 ; + g_max_active_xid =0 ;spin_lock_init (&g_servers_lock);spin_lock_init (&g_mid_lock);
fs/cifs/cifsglob.h +9 -9
@@ -1958,20 +1958,20 @@ extern spinlock_t g_servers_lock;/* * Global transaction id (XID) information */ -GLOBAL_EXTERN unsigned int g_current_xid; /* protected by g_mid_lock */ +GLOBAL_EXTERN unsigned int g_current_xid; /* protected by g_mid_lock */ GLOBAL_EXTERN unsigned int g_total_active_xid; /* prot by g_mid_lock */ -GLOBAL_EXTERN unsigned int g_max_active_xid /* prot by g_mid_lock */ -GLOBAL_EXTERN spinlock_t g_mid_lock; /* protects above & list operations */ +GLOBAL_EXTERN unsigned int g_max_active_xid; /* prot by g_mid_lock */ +GLOBAL_EXTERN spinlock_t g_mid_lock; /* protects above & list operations *//* on midQ entries */ /* * Global counters, updated atomically */ -GLOBAL_EXTERN atomic_t sesInfoAllocCount; -GLOBAL_EXTERN atomic_t tconInfoAllocCount; -GLOBAL_EXTERN atomic_t tcpSesNextId; -GLOBAL_EXTERN atomic_t tcpSesAllocCount; -GLOBAL_EXTERN atomic_t tcpSesReconnectCount; -GLOBAL_EXTERN atomic_t tconInfoReconnectCount; +GLOBAL_EXTERN atomic_t g_ses_alloc_count; +GLOBAL_EXTERN atomic_t g_tcon_alloc_count; +GLOBAL_EXTERN atomic_t g_server_next_id; +GLOBAL_EXTERN atomic_t g_server_alloc_count; +GLOBAL_EXTERN atomic_t g_server_reconnect_count; +GLOBAL_EXTERN atomic_t g_tcon_reconnect_count;/* Various Debug counters */ extern atomic_t buf_alloc_count;/* current number allocated */
fs/cifs/cifssmb.c +1 -1
@@ -248,7 +248,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command) goto out; } -atomic_inc (&tconInfoReconnectCount); +atomic_inc (&g_tcon_reconnect_count);/* tell server Unix caps we support */ if (cap_unix (ses))
fs/cifs/connect.c +5 -5
@@ -412,7 +412,7 @@ static int __cifs_reconnect(struct TCP_Server_Info *server,cifs_dbg (FYI ,"%s: reconnect error %d\n" , __func__, rc);msleep (3000 ); }else { -atomic_inc (&tcpSesReconnectCount); +atomic_inc (&g_server_reconnect_count);set_credits (server,1 );spin_lock (&g_servers_lock);if (server->tcpStatus != CifsExiting)
@@ -539,7 +539,7 @@ static int reconnect_dfs_server(struct TCP_Server_Info *server)* process waiting for reconnect will know it needs to re-establish session and tcon * through the reconnected target server. */ -atomic_inc (&tcpSesReconnectCount); +atomic_inc (&g_server_reconnect_count);set_credits (server,1 );spin_lock (&g_servers_lock);if (server->tcpStatus != CifsExiting)
@@ -994,7 +994,7 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server)#endif kfree (server); - length =atomic_dec_return (&tcpSesAllocCount); + length =atomic_dec_return (&g_server_alloc_count);if (length >0 )mempool_resize (cifs_req_poolp, length + cifs_min_rcv); }
@@ -1117,7 +1117,7 @@ cifs_demultiplex_thread(void *p) noreclaim_flag =memalloc_noreclaim_save ();cifs_dbg (FYI ,"Demultiplex PID: %d\n" ,task_pid_nr (current)); - length =atomic_inc_return (&tcpSesAllocCount); + length =atomic_inc_return (&g_server_alloc_count);if (length >1 )mempool_resize (cifs_req_poolp, length + cifs_min_rcv);
@@ -1582,7 +1582,7 @@ cifs_get_server(struct smb3_fs_context *ctx, server->vals = ctx->vals;cifs_set_net_ns (server,get_net (current->nsproxy->net_ns)); - server->conn_id =atomic_inc_return (&tcpSesNextId); + server->conn_id =atomic_inc_return (&g_server_next_id); server->noblockcnt = ctx->rootfs; server->noblocksnd = ctx->noblocksnd || ctx->rootfs; server->noautotune = ctx->noautotune;
fs/cifs/misc.c +6 -6
@@ -42,8 +42,8 @@ _get_xid(void) g_total_active_xid++;/* keep high water mark for number of simultaneous ops in filesystem */ -if (g_total_active_xid > GlobalMaxActiveXid) - GlobalMaxActiveXid = g_total_active_xid; +if (g_total_active_xid > g_max_active_xid) + g_max_active_xid = g_total_active_xid;if (g_total_active_xid >65000 )cifs_dbg (FYI ,"warning: more than 65000 requests active\n" ); xid = g_current_xid++;
@@ -68,7 +68,7 @@ sesInfoAlloc(void) ret_buf =kzalloc (sizeof (struct cifs_ses ),GFP_KERNEL );if (ret_buf) { -atomic_inc (&sesInfoAllocCount); +atomic_inc (&g_ses_alloc_count); ret_buf->ses_status =SES_NEW ; ++ret_buf->ses_count;INIT_LIST_HEAD (&ret_buf->smb_ses_list);
@@ -91,7 +91,7 @@ sesInfoFree(struct cifs_ses *buf_to_free)return ; } -atomic_dec (&sesInfoAllocCount); +atomic_dec (&g_ses_alloc_count);kfree (buf_to_free->serverOS);kfree (buf_to_free->serverDomain);kfree (buf_to_free->serverNOS);
@@ -123,7 +123,7 @@ tconInfoAlloc(void)INIT_LIST_HEAD (&ret_buf->crfid.dirents.entries);mutex_init (&ret_buf->crfid.dirents.de_mutex); -atomic_inc (&tconInfoAllocCount); +atomic_inc (&g_tcon_alloc_count); ret_buf->status =TID_NEW ; ++ret_buf->tc_count;INIT_LIST_HEAD (&ret_buf->openFileList);
@@ -144,7 +144,7 @@ tconInfoFree(struct cifs_tcon *buf_to_free)cifs_dbg (FYI ,"Null buffer passed to tconInfoFree\n" );return ; } -atomic_dec (&tconInfoAllocCount); +atomic_dec (&g_tcon_alloc_count);kfree (buf_to_free->nativeFileSystem);kfree_sensitive (buf_to_free->password);kfree (buf_to_free->crfid.fid);
fs/cifs/smb2pdu.c +1 -1
@@ -321,7 +321,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,if (smb2_command !=SMB2_INTERNAL_CMD )mod_delayed_work (cifsiod_wq, &server->reconnect,0 ); -atomic_inc (&tconInfoReconnectCount); +atomic_inc (&g_tcon_reconnect_count); out:/* * Check if handle based operation so we know whether we can continue
Signature · 1 line
2.35.3
RFC PATCH v2 5/10 cifs: convert server info vars to snake_case
In reply to Enzo MatsumiyaRename cifs_server_info variables that were still in CamelCase or Camel_Case to snake_case.
Rename [Alloc,Delete]MidQEntry() functions to
cifs_{alloc,delete}_mid_q_entry().
--- fs/cifs/cifs_debug.c | 4 +- fs/cifs/cifsencrypt.c | 2 +- fs/cifs/cifsglob.h | 24 ++++++------ fs/cifs/cifsproto.h | 4 +- fs/cifs/cifssmb.c | 38 +++++++++---------- fs/cifs/connect.c | 84 ++++++++++++++++++++--------------------- fs/cifs/file.c | 8 ++-- fs/cifs/inode.c | 8 ++-- fs/cifs/readdir.c | 2 +- fs/cifs/sess.c | 2 +- fs/cifs/smb1ops.c | 12 +++--- fs/cifs/smb2file.c | 8 ++-- fs/cifs/smb2ops.c | 36 +++++++++--------- fs/cifs/smb2pdu.c | 20 +++++----- fs/cifs/smb2transport.c | 10 ++--- fs/cifs/transport.c | 54 +++++++++++++------------- 16 files changed, 158 insertions(+), 158 deletions(-)
fs/cifs/cifs_debug.c +2 -2
@@ -136,7 +136,7 @@ cifs_dump_channel(struct seq_file *m, int i, struct cifs_chan *chan) i+1 , server->conn_id, server->credits, server->dialect, - server->tcpStatus, + server->status, server->reconnect_instance, server->srv_count, server->sec_mode,
@@ -364,7 +364,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)seq_printf (m,"\nRDMA " );seq_printf (m,"\nTCP status: %d Instance: %d" "\nLocal Users To Server: %d SecMode: 0x%x Req On Wire: %d" , - server->tcpStatus, + server->status, server->reconnect_instance, server->srv_count, server->sec_mode,in_flight (server));
fs/cifs/cifsencrypt.c +1 -1
@@ -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->tcpStatus == CifsNeedNegotiate) { + server->status == CifsNeedNegotiate) {spin_unlock (&g_servers_lock);return rc; }
fs/cifs/cifsglob.h +12 -12
@@ -608,11 +608,11 @@ struct cifs_server_info {__u64 conn_id;/* connection identifier (useful for debugging) */ int srv_count;/* reference counter */ /* 15 character server name + 0x20 16th byte indicating type = srv */ -char server_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL ]; +char server_rfc1001_name[RFC1001_NAME_LEN_WITH_NULL ];struct smb_version_operations *ops;struct smb_version_values *vals; -/* updates to tcpStatus protected by g_servers_lock */ -enum statusEnum tcpStatus;/* what we think the status is */ +/* updates to status protected by g_servers_lock */ +enum statusEnum status;/* what we think the status is */ char *hostname;/* hostname portion of UNC string */ struct socket *ssocket;struct sockaddr_storage dstaddr;
@@ -635,7 +635,7 @@ struct cifs_server_info {struct mutex _srv_mutex;unsigned int nofs_flag;struct task_struct *tsk; -char server_GUID[16 ]; +char server_guid[16 ];__u16 sec_mode;bool sign;/* is signing enabled on this connection? */ bool ignore_signature:1; /* skip validation of signatures in SMB2/3 rsp */
@@ -646,19 +646,19 @@ struct cifs_server_info {__u8 client_guid[SMB2_CLIENT_GUID_SIZE ];/* Client GUID */ u16 dialect;/* dialect index that server chose */ bool oplocks:1; /* enable oplocks */ -unsigned int maxReq;/* Clients should submit no more */ -/* than maxReq distinct unanswered SMBs to the server when using */ +unsigned int max_req;/* Clients should submit no more */ +/* than max_req distinct unanswered SMBs to the server when using */ /* multiplexed reads or writes (for SMB1/CIFS only, not SMB2/SMB3) */ -unsigned int maxBuf;/* maxBuf specifies the maximum */ +unsigned int max_buf;/* max_buf specifies the maximum */ /* message size the server can send or receive for non-raw SMBs */ -/* maxBuf is returned by SMB NegotiateProtocol so maxBuf is only 0 */ +/* max_buf is returned by SMB NegotiateProtocol so max_buf is only 0 */ /* when socket is setup (and during reconnect) before NegProt sent */ unsigned int max_rw;/* maxRw specifies the maximum */ /* message size the server can send or receive for */ /* SMB_COM_WRITE_RAW or SMB_COM_READ_RAW. */ unsigned int capabilities;/* selective disabling of caps by smb sess */ -int timeAdj;/* Adjust for difference in server time zone in sec */ -__u64 CurrentMid;/* multiplex id - rotating counter, protected by g_mid_lock */ +int time_adjust;/* Adjust for difference in server time zone in sec */ +__u64 current_mid;/* multiplex id - rotating counter, protected by g_mid_lock */ char cryptkey[CIFS_CRYPTO_KEY_SIZE ];/* used by ntlm, ntlmv2 etc */ /* 16th byte of RFC1001 workstation name is always null */ char workstation_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL ];
@@ -1908,8 +1908,8 @@ require use of the stronger protocol */* list operations on pending_mid_q and oplockQ * updates to XID counters, multiplex id and SMB sequence numbers * list operations on global DnotifyReqList -* updates to ses->status and cifs_server_info->tcpStatus -* updates to server->CurrentMid +* updates to ses->status and cifs_server_info->status +* updates to server->current_mid * g_servers_lock protects: * list operations on tcp and SMB session lists * tcon->open_file_lock protects the list of open files hanging off the tcon
fs/cifs/cifsproto.h +2 -2
@@ -79,9 +79,9 @@ extern char *cifs_compose_mount_options(const char *sb_mountdata, const char *fullpath, const struct dfs_info3_param *ref, char **devname);/* extern void renew_parental_timestamps(struct dentry *direntry);*/ -extern struct mid_q_entry *AllocMidQEntry (const struct smb_hdr *smb_buffer, +extern struct mid_q_entry *cifs_alloc_mid_q_entry (const struct smb_hdr *smb_buffer,struct cifs_server_info *server); -extern void DeleteMidQEntry (struct mid_q_entry *midEntry); +extern void cifs_delete_mid_q_entry (struct mid_q_entry *midEntry);extern void cifs_delete_mid (struct mid_q_entry *mid);extern void cifs_mid_q_entry_release (struct mid_q_entry *midEntry);extern void cifs_wake_up_task (struct mid_q_entry *mid);
fs/cifs/cifssmb.c +19 -19
@@ -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->tcpStatus == CifsNeedReconnect) { +while (server->status == CifsNeedReconnect) { rc =wait_event_interruptible_timeout (server->response_q, - (server->tcpStatus != CifsNeedReconnect), + (server->status != CifsNeedReconnect),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->tcpStatus != CifsNeedReconnect) { +if (server->status != CifsNeedReconnect) {spin_unlock (&g_servers_lock);break ; }
@@ -199,10 +199,10 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)/* * Recheck after acquire mutex. If another thread is negotiating * and the server never sends an answer the socket will be closed -* and tcpStatus set to reconnect. +* and status set to reconnect. */ spin_lock (&g_servers_lock); -if (server->tcpStatus == CifsNeedReconnect) { +if (server->status == CifsNeedReconnect) {spin_unlock (&g_servers_lock); rc = -EHOSTDOWN ; goto out;
@@ -435,13 +435,13 @@ decode_ext_sec_blob(struct cifs_ses *ses, NEGOTIATE_RSP *pSMBr)spin_lock (&g_servers_lock);if (server->srv_count >1 ) {spin_unlock (&g_servers_lock); -if (memcmp (server->server_GUID, guid,SMB1_CLIENT_GUID_SIZE ) !=0 ) { +if (memcmp (server->server_guid, guid,SMB1_CLIENT_GUID_SIZE ) !=0 ) {cifs_dbg (FYI ,"server UID changed\n" ); -memcpy (server->server_GUID, guid,SMB1_CLIENT_GUID_SIZE ); +memcpy (server->server_guid, guid,SMB1_CLIENT_GUID_SIZE ); } }else {spin_unlock (&g_servers_lock); -memcpy (server->server_GUID, guid,SMB1_CLIENT_GUID_SIZE ); +memcpy (server->server_guid, guid,SMB1_CLIENT_GUID_SIZE ); }if (count ==SMB1_CLIENT_GUID_SIZE ) {
@@ -591,18 +591,18 @@ CIFSSMBNegotiate(const unsigned int xid,/* one byte, so no need to convert this or EncryptionKeyLen from little endian */ - server->maxReq = min_t(unsigned int, le16_to_cpu(pSMBr->MaxMpxCount), + server->max_req = min_t(unsigned int, le16_to_cpu(pSMBr->MaxMpxCount), cifs_max_pending); -set_credits (server, server->maxReq); +set_credits (server, server->max_req);/* probably no need to store and check maxvcs */ - server->maxBuf =le32_to_cpu (pSMBr->MaxBufferSize); + server->max_buf =le32_to_cpu (pSMBr->MaxBufferSize);/* set up max_read for readahead check */ - server->max_read = server->maxBuf; + server->max_read = server->max_buf; server->max_rw =le32_to_cpu (pSMBr->MaxRawSize); -cifs_dbg (NOISY ,"Max buf = %d\n" , ses->server->maxBuf); +cifs_dbg (NOISY ,"Max buf = %d\n" , ses->server->max_buf); server->capabilities =le32_to_cpu (pSMBr->Capabilities); - server->timeAdj = (int )(__s16 )le16_to_cpu (pSMBr->ServerTimeZone); - server->timeAdj *=60 ; + server->time_adjust = (int )(__s16 )le16_to_cpu (pSMBr->ServerTimeZone); + server->time_adjust *=60 ;if (pSMBr->EncryptionKeyLength ==CIFS_CRYPTO_KEY_SIZE ) { server->negflavor =CIFS_NEGFLAVOR_UNENCAP ;
@@ -684,7 +684,7 @@ cifs_echo_callback(struct mid_q_entry *mid)struct cifs_server_info *server = mid->callback_data;struct cifs_credits credits = { .value =1 , .instance =0 }; -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid);add_credits (server, &credits,CIFS_ECHO_OP ); }
@@ -1607,7 +1607,7 @@ cifs_readv_callback(struct mid_q_entry *mid) }queue_work (cifsiod_wq, &rdata->work); -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid);add_credits (server, &credits,0 ); }
@@ -1849,7 +1849,7 @@ CIFSSMBWrite(const unsigned int xid, struct cifs_io_parms *io_parms,if (tcon->ses->capabilities &CAP_LARGE_WRITE_X ) { bytes_sent = min_t(const unsigned int, CIFSMaxBufSize, count); }else { - bytes_sent = (tcon->ses->server->maxBuf -MAX_CIFS_HDR_SIZE ) + bytes_sent = (tcon->ses->server->max_buf -MAX_CIFS_HDR_SIZE ) & ~0xFF ; }
@@ -2132,7 +2132,7 @@ cifs_writev_callback(struct mid_q_entry *mid) }queue_work (cifsiod_wq, &wdata->work); -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid);add_credits (tcon->ses->server, &credits,0 ); }
fs/cifs/connect.c +42 -42
262 lines not on this page · raw message
fs/cifs/file.c +4 -4
@@ -1267,10 +1267,10 @@ cifs_push_mandatory_locks(struct cifs_file_info *cfile) tcon =tlink_tcon (cfile->tlink);/* -* Accessing maxBuf is racy with cifs_reconnect - need to store value +* Accessing max_buf is racy with cifs_reconnect - need to store value * and check it before using. */ - max_buf = tcon->ses->server->maxBuf; + max_buf = tcon->ses->server->max_buf;if (max_buf < (sizeof (struct smb_hdr ) +sizeof (LOCKING_ANDX_RANGE ))) {free_xid (xid);return -EINVAL ;
@@ -1611,10 +1611,10 @@ cifs_unlock_range(struct cifs_file_info *cfile, struct file_lock *flock,INIT_LIST_HEAD (&tmp_llist);/* -* Accessing maxBuf is racy with cifs_reconnect - need to store value +* Accessing max_buf is racy with cifs_reconnect - need to store value * and check it before using. */ - max_buf = tcon->ses->server->maxBuf; + max_buf = tcon->ses->server->max_buf;if (max_buf < (sizeof (struct smb_hdr ) +sizeof (LOCKING_ANDX_RANGE )))return -EINVAL ;
fs/cifs/inode.c +4 -4
@@ -613,8 +613,8 @@ smb311_posix_info_to_fattr(struct cifs_fattr *fattr, struct smb311_posix_qinfo * fattr->cf_mtime =cifs_NTtimeToUnix (info->LastWriteTime);if (adjust_tz) { - fattr->cf_ctime.tv_sec += tcon->ses->server->timeAdj; - fattr->cf_mtime.tv_sec += tcon->ses->server->timeAdj; + fattr->cf_ctime.tv_sec += tcon->ses->server->time_adjust; + fattr->cf_mtime.tv_sec += tcon->ses->server->time_adjust; } fattr->cf_eof =le64_to_cpu (info->EndOfFile);
@@ -669,8 +669,8 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, fattr->cf_mtime =cifs_NTtimeToUnix (info->LastWriteTime);if (adjust_tz) { - fattr->cf_ctime.tv_sec += tcon->ses->server->timeAdj; - fattr->cf_mtime.tv_sec += tcon->ses->server->timeAdj; + fattr->cf_ctime.tv_sec += tcon->ses->server->time_adjust; + fattr->cf_mtime.tv_sec += tcon->ses->server->time_adjust; } fattr->cf_eof =le64_to_cpu (info->EndOfFile);
fs/cifs/readdir.c +1 -1
@@ -318,7 +318,7 @@ static void cifs_std_info_to_fattr(struct cifs_fattr *fattr, FIND_FILE_STANDARD_INFO *info, struct cifs_sb_info *cifs_sb) { - int offset = cifs_sb_master_tcon(cifs_sb)->ses->server->timeAdj; + int offset = cifs_sb_master_tcon(cifs_sb)->ses->server->time_adjust;memset (fattr,0 ,sizeof (*fattr)); fattr->cf_atime = cnvrtDosUnixTm(info->LastAccessDate,
fs/cifs/sess.c +1 -1
@@ -514,7 +514,7 @@ static __u32 cifs_ssetup_hdr(struct cifs_ses *ses, pSMB->req.MaxBufferSize =cpu_to_le16 (min_t (u32, CIFSMaxBufSize +MAX_CIFS_HDR_SIZE -4 ,USHRT_MAX )); - pSMB->req.MaxMpxCount =cpu_to_le16 (server->maxReq); + pSMB->req.MaxMpxCount =cpu_to_le16 (server->max_req); pSMB->req.VcNumber =cpu_to_le16 (1 );/* Now no need to set SMBFLG_CASELESS or obsolete CANONICAL PATH */
fs/cifs/smb1ops.c +6 -6
@@ -169,7 +169,7 @@ cifs_get_next_mid(struct cifs_server_info *server)spin_lock (&g_mid_lock);/* mid is 16 bit only for CIFS/SMB */ - cur_mid = (__u16)((server->CurrentMid) &0xffff ); + cur_mid = (__u16)((server->current_mid) &0xffff );/* we do not want to loop forever */ last_mid = cur_mid; cur_mid++;
@@ -220,7 +220,7 @@ cifs_get_next_mid(struct cifs_server_info *server)if (!collision) { mid = (__u64 )cur_mid; - server->CurrentMid = mid; + server->current_mid = mid;break ; } cur_mid++;
@@ -416,7 +416,7 @@ cifs_check_trans2(struct mid_q_entry *mid, struct cifs_server_info *server,static bool cifs_need_neg (struct cifs_server_info *server) { -return server->maxBuf ==0 ; +return server->max_buf ==0 ; } static int
@@ -463,7 +463,7 @@ cifs_negotiate_wsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)if (!(server->capabilities &CAP_LARGE_WRITE_X ) || (!(server->capabilities &CAP_UNIX ) && server->sign)) wsize = min_t(unsigned int, wsize, - server->maxBuf -sizeof (WRITE_REQ ) +4 ); + server->max_buf -sizeof (WRITE_REQ ) +4 );/* hard limit of CIFS_MAX_WSIZE */ wsize = min_t(unsigned int, wsize, CIFS_MAX_WSIZE);
@@ -495,7 +495,7 @@ cifs_negotiate_rsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)else if (server->capabilities &CAP_LARGE_READ_X ) defsize =CIFS_DEFAULT_NON_POSIX_RSIZE ;else - defsize = server->maxBuf -sizeof (READ_RSP ); + defsize = server->max_buf -sizeof (READ_RSP ); rsize = ctx->rsize ? ctx->rsize : defsize;
@@ -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->tcpStatus == CifsGood) +if (server->status == CifsGood)return true;return false;
fs/cifs/smb2file.c +4 -4
@@ -116,10 +116,10 @@ smb2_unlock_range(struct cifs_file_info *cfile, struct file_lock *flock,INIT_LIST_HEAD (&tmp_llist);/* -* Accessing maxBuf is racy with cifs_reconnect - need to store value +* Accessing max_buf is racy with cifs_reconnect - need to store value * and check it before using. */ - max_buf = tcon->ses->server->maxBuf; + max_buf = tcon->ses->server->max_buf;if (max_buf <sizeof (struct smb2_lock_element ))return -EINVAL ;
@@ -257,10 +257,10 @@ smb2_push_mandatory_locks(struct cifs_file_info *cfile) xid =get_xid ();/* -* Accessing maxBuf is racy with cifs_reconnect - need to store value +* Accessing max_buf is racy with cifs_reconnect - need to store value * and check it for zero before using. */ - max_buf =tlink_tcon (cfile->tlink)->ses->server->maxBuf; + max_buf =tlink_tcon (cfile->tlink)->ses->server->max_buf;if (max_buf <sizeof (struct smb2_lock_element )) {free_xid (xid);return -EINVAL ;
fs/cifs/smb2ops.c +18 -18
@@ -86,7 +86,7 @@ smb2_add_credits(struct cifs_server_info *server,if (*val >65000 ) { *val =65000 ;/* Don't get near 64K credits, avoid srv bugs */ pr_warn_once ("server overflowed SMB3 credits\n" ); -trace_smb3_overflow_credits (server->CurrentMid, +trace_smb3_overflow_credits (server->current_mid, server->conn_id, server->hostname, *val, add, server->in_flight); }
@@ -112,7 +112,7 @@ smb2_add_credits(struct cifs_server_info *server,wake_up (&server->request_q);if (reconnect_detected) { -trace_smb3_reconnect_detected (server->CurrentMid, +trace_smb3_reconnect_detected (server->current_mid, server->conn_id, server->hostname, scredits, add, in_flight); cifs_dbg(FYI, "trying to put %d credits from the old server instance %d\n",
@@ -120,15 +120,15 @@ smb2_add_credits(struct cifs_server_info *server, }if (reconnect_with_invalid_credits) { -trace_smb3_reconnect_with_invalid_credits (server->CurrentMid, +trace_smb3_reconnect_with_invalid_credits (server->current_mid, server->conn_id, server->hostname, scredits, add, in_flight);cifs_dbg (FYI ,"Negotiate operation when server credits is non-zero. Optype: %d, server credits: %d, credits added: %d\n" , optype, scredits, add); }spin_lock (&g_servers_lock); -if (server->tcpStatus == CifsNeedReconnect - || server->tcpStatus == CifsExiting) { +if (server->status == CifsNeedReconnect + || server->status == CifsExiting) {spin_unlock (&g_servers_lock);return ; }
@@ -152,7 +152,7 @@ smb2_add_credits(struct cifs_server_info *server,break ; } -trace_smb3_add_credits (server->CurrentMid, +trace_smb3_add_credits (server->current_mid, server->conn_id, server->hostname, scredits, add, in_flight);cifs_dbg (FYI ,"%s: added %u credits total=%d\n" , __func__, add, scredits); }
@@ -170,7 +170,7 @@ smb2_set_credits(struct cifs_server_info *server, const int val) in_flight = server->in_flight;spin_unlock (&server->req_lock); -trace_smb3_set_credits (server->CurrentMid, +trace_smb3_set_credits (server->current_mid, server->conn_id, server->hostname, scredits, val, in_flight);cifs_dbg (FYI ,"%s: set %u credits\n" , __func__, val);
@@ -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->tcpStatus == CifsExiting) { +if (server->status == CifsExiting) {spin_unlock (&g_servers_lock);return -ENOENT ; }
@@ -254,7 +254,7 @@ smb2_wait_mtu_credits(struct cifs_server_info *server, unsigned int size, in_flight = server->in_flight;spin_unlock (&server->req_lock); -trace_smb3_wait_credits (server->CurrentMid, +trace_smb3_wait_credits (server->current_mid, server->conn_id, server->hostname, scredits, -(credits->value), in_flight);cifs_dbg (FYI ,"%s: removed %u credits total=%d\n" , __func__, credits->value, scredits);
@@ -274,7 +274,7 @@ smb2_adjust_credits(struct cifs_server_info *server,return 0 ;if (credits->value < new_val) { -trace_smb3_too_many_credits (server->CurrentMid, +trace_smb3_too_many_credits (server->current_mid, server->conn_id, server->hostname,0 , credits->value - new_val,0 );cifs_server_dbg (VFS ,"request has less credits (%d) than required (%d)" , credits->value, new_val);
@@ -289,7 +289,7 @@ smb2_adjust_credits(struct cifs_server_info *server, in_flight = server->in_flight;spin_unlock (&server->req_lock); -trace_smb3_reconnect_detected (server->CurrentMid, +trace_smb3_reconnect_detected (server->current_mid, server->conn_id, server->hostname, scredits, credits->value - new_val, in_flight); cifs_server_dbg(VFS, "trying to return %d credits to old session\n",
@@ -303,7 +303,7 @@ smb2_adjust_credits(struct cifs_server_info *server,spin_unlock (&server->req_lock);wake_up (&server->request_q); -trace_smb3_adj_credits (server->CurrentMid, +trace_smb3_adj_credits (server->current_mid, server->conn_id, server->hostname, scredits, credits->value - new_val, in_flight); cifs_dbg(FYI, "%s: adjust added %u credits total=%d\n",
@@ -320,7 +320,7 @@ smb2_get_next_mid(struct cifs_server_info *server)__u64 mid;/* for SMB2 we need the current value */ spin_lock (&g_mid_lock); - mid = server->CurrentMid++; + mid = server->current_mid++;spin_unlock (&g_mid_lock);return mid; }
@@ -329,8 +329,8 @@ static void smb2_revert_current_mid(struct cifs_server_info *server, const unsigned int val) { spin_lock(&g_mid_lock); -if (server->CurrentMid >= val) - server->CurrentMid -= val; +if (server->current_mid >= val) + server->current_mid -= val;spin_unlock (&g_mid_lock); }
@@ -404,7 +404,7 @@ smb2_negotiate(const unsigned int xid,int rc;spin_lock (&g_mid_lock); - server->CurrentMid =0 ; + server->current_mid =0 ;spin_unlock (&g_mid_lock); rc =SMB2_negotiate (xid, ses, server);/* BB we probably don't need to retry with modern servers */
@@ -2532,7 +2532,7 @@ smb2_is_status_pending(char *buf, struct cifs_server_info *server)spin_unlock (&server->req_lock);wake_up (&server->request_q); -trace_smb3_pend_credits (server->CurrentMid, +trace_smb3_pend_credits (server->current_mid, server->conn_id, server->hostname, scredits,le16_to_cpu (shdr->CreditRequest), in_flight); cifs_dbg(FYI, "%s: status pending add %u credits total=%d\n",
@@ -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->tcpStatus == CifsNeedReconnect) { +if (dw->server->status == CifsNeedReconnect) { mid->mid_state =MID_RETRY_NEEDED ;spin_unlock (&g_mid_lock);spin_unlock (&g_servers_lock);
fs/cifs/smb2pdu.c +10 -10
@@ -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->tcpStatus == CifsNeedReconnect) { +while (server->status == CifsNeedReconnect) {/* * 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->tcpStatus != CifsNeedReconnect), + (server->status != CifsNeedReconnect),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->tcpStatus != CifsNeedReconnect) { +if (server->status != CifsNeedReconnect) {spin_unlock (&g_servers_lock);break ; }
@@ -254,10 +254,10 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,/* * Recheck after acquire mutex. If another thread is negotiating * and the server never sends an answer the socket will be closed -* and tcpStatus set to reconnect. +* and status set to reconnect. */ spin_lock (&g_servers_lock); -if (server->tcpStatus == CifsNeedReconnect) { +if (server->status == CifsNeedReconnect) {spin_unlock (&g_servers_lock); rc = -EHOSTDOWN ; goto out;
@@ -1032,7 +1032,7 @@ SMB2_negotiate(const unsigned int xid,/* SMB2 only has an extended negflavor */ server->negflavor =CIFS_NEGFLAVOR_EXTENDED ;/* set it to the maximum buffer size value we can send with 1 credit */ - server->maxBuf = min_t(unsigned int, le32_to_cpu(rsp->MaxTransactSize), + server->max_buf = min_t(unsigned int, le32_to_cpu(rsp->MaxTransactSize),SMB2_MAX_BUFFER_SIZE ); server->max_read =le32_to_cpu (rsp->MaxReadSize); server->max_write =le32_to_cpu (rsp->MaxWriteSize);
@@ -3776,7 +3776,7 @@ smb2_echo_callback(struct mid_q_entry *mid) credits.instance = server->reconnect_instance; } -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid);add_credits (server, &credits,CIFS_ECHO_OP ); }
@@ -4201,7 +4201,7 @@ smb2_readv_callback(struct mid_q_entry *mid) rdata->offset, rdata->got_bytes);queue_work (cifsiod_wq, &rdata->work); -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid);add_credits (server, &credits,0 ); }
@@ -4440,7 +4440,7 @@ smb2_writev_callback(struct mid_q_entry *mid) wdata->offset, wdata->bytes);queue_work (cifsiod_wq, &wdata->work); -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid);add_credits (server, &credits,0 ); }
@@ -4874,7 +4874,7 @@ int SMB2_query_directory_init(const unsigned int xid,* BB could be 30 bytes or so longer if we used SMB2 specific * buffer lengths, but this is safe and close enough. */ - output_size = min_t(unsigned int, output_size, server->maxBuf); + output_size = min_t(unsigned int, output_size, server->max_buf); output_size = min_t(unsigned int, output_size, 2 << 15); req->OutputBufferLength =cpu_to_le32 (output_size);
fs/cifs/smb2transport.c +5 -5
@@ -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->tcpStatus == CifsExiting) { +if (server->status == CifsExiting) {spin_unlock (&g_servers_lock);return -ENOENT ; } -if (server->tcpStatus == CifsNeedReconnect) { +if (server->status == CifsNeedReconnect) {spin_unlock (&g_servers_lock);cifs_dbg (FYI ,"tcp session dead - return to caller to retry\n" );return -EAGAIN ; } -if (server->tcpStatus == CifsNeedNegotiate && +if (server->status == CifsNeedNegotiate && 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->tcpStatus == CifsNeedNegotiate && +if (server->status == CifsNeedNegotiate && shdr->Command !=SMB2_NEGOTIATE ) {spin_unlock (&g_servers_lock);return ERR_PTR (-EAGAIN );
@@ -888,7 +888,7 @@ smb2_setup_async_request(struct cifs_server_info *server, struct smb_rqst *rqst) rc =smb2_sign_rqst (rqst, server);if (rc) {revert_current_mid_from_hdr (server, shdr); -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid);return ERR_PTR (rc); }
fs/cifs/transport.c +27 -27
200 lines not on this page · raw message
Signature · 1 line
2.35.3
Re: [RFC PATCH v2 05/10] cifs: convert server info vars to snake_case
I doubt that renaming tcpStatus to "status" helps much. If it has to do with the socket, included tcp or socket or connection in the name seems plausible/helpful. I don't mind removing the came cause (e.g. "tcp_status" or something similar) but prefer other types of cleanup to be the focus (moving smb1 code out of mixed smb1/smb2/smb3 c files into smb1 specific ones that are compiled out when legacy is disabled etc.
Quoted 1,233 lines · Enzo Matsumiya
Rename
cifs_server_infovariables that were still in CamelCase orCamel_Casetosnake_case.Rename [Alloc,Delete]MidQEntry() functions to
cifs_{alloc,delete}_mid_q_entry().Signed-off-by Enzo Matsumiya <[email protected]>--- fs/cifs/cifs_debug.c | 4 +- fs/cifs/cifsencrypt.c | 2 +- fs/cifs/cifsglob.h | 24 ++++++------ fs/cifs/cifsproto.h | 4 +- fs/cifs/cifssmb.c | 38 +++++++++---------- fs/cifs/connect.c | 84 ++++++++++++++++++++--------------------- fs/cifs/file.c | 8 ++-- fs/cifs/inode.c | 8 ++-- fs/cifs/readdir.c | 2 +- fs/cifs/sess.c | 2 +- fs/cifs/smb1ops.c | 12 +++--- fs/cifs/smb2file.c | 8 ++-- fs/cifs/smb2ops.c | 36 +++++++++--------- fs/cifs/smb2pdu.c | 20 +++++----- fs/cifs/smb2transport.c | 10 ++--- fs/cifs/transport.c | 54 +++++++++++++------------- 16 files changed, 158 insertions(+), 158 deletions(-)fs/cifs/cifs_debug.c +2
-2@@ -136,7 +136,7 @@ cifs_dump_channel(struct seq_file *m, int i, struct cifs_chan *chan) i+1 , server->conn_id, server->credits, server->dialect, - server->tcpStatus, + server->status, server->reconnect_instance, server->srv_count, server->sec_mode,@@ -364,7 +364,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)seq_printf (m,"\nRDMA " );seq_printf (m,"\nTCP status: %d Instance: %d" "\nLocal Users To Server: %d SecMode: 0x%x Req On Wire: %d" , - server->tcpStatus, + server->status, server->reconnect_instance, server->srv_count, server->sec_mode,in_flight (server));fs/cifs/cifsencrypt.c +1
-1@@ -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->tcpStatus == CifsNeedNegotiate) { + server->status == CifsNeedNegotiate) {spin_unlock (&g_servers_lock);return rc; }fs/cifs/cifsglob.h +12
-12@@ -608,11 +608,11 @@ struct cifs_server_info {__u64 conn_id;/* connection identifier (useful for debugging) */ int srv_count;/* reference counter */ /* 15 character server name + 0x20 16th byte indicating type = srv */ -char server_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL ]; +char server_rfc1001_name[RFC1001_NAME_LEN_WITH_NULL ];struct smb_version_operations *ops;struct smb_version_values *vals; -/* updates to tcpStatus protected by g_servers_lock */ -enum statusEnum tcpStatus;/* what we think the status is */ +/* updates to status protected by g_servers_lock */ +enum statusEnum status;/* what we think the status is */ char *hostname;/* hostname portion of UNC string */ struct socket *ssocket;struct sockaddr_storage dstaddr;@@ -635,7 +635,7 @@ struct cifs_server_info {struct mutex _srv_mutex;unsigned int nofs_flag;struct task_struct *tsk; -char server_GUID[16 ]; +char server_guid[16 ];__u16 sec_mode;bool sign;/* is signing enabled on this connection? */ bool ignore_signature:1; /* skip validation of signatures in SMB2/3 rsp */@@ -646,19 +646,19 @@ struct cifs_server_info {__u8 client_guid[SMB2_CLIENT_GUID_SIZE ];/* Client GUID */ u16 dialect;/* dialect index that server chose */ bool oplocks:1; /* enable oplocks */ -unsigned int maxReq;/* Clients should submit no more */ -/* than maxReq distinct unanswered SMBs to the server when using */ +unsigned int max_req;/* Clients should submit no more */ +/* than max_req distinct unanswered SMBs to the server when using */ /* multiplexed reads or writes (for SMB1/CIFS only, not SMB2/SMB3) */ -unsigned int maxBuf;/* maxBuf specifies the maximum */ +unsigned int max_buf;/* max_buf specifies the maximum */ /* message size the server can send or receive for non-raw SMBs */ -/* maxBuf is returned by SMB NegotiateProtocol so maxBuf is only 0 */ +/* max_buf is returned by SMB NegotiateProtocol so max_buf is only 0 */ /* when socket is setup (and during reconnect) before NegProt sent */ unsigned int max_rw;/* maxRw specifies the maximum */ /* message size the server can send or receive for */ /* SMB_COM_WRITE_RAW or SMB_COM_READ_RAW. */ unsigned int capabilities;/* selective disabling of caps by smb sess */ -int timeAdj;/* Adjust for difference in server time zone in sec */ -__u64 CurrentMid;/* multiplex id - rotating counter, protected by g_mid_lock */ +int time_adjust;/* Adjust for difference in server time zone in sec */ +__u64 current_mid;/* multiplex id - rotating counter, protected by g_mid_lock */ char cryptkey[CIFS_CRYPTO_KEY_SIZE ];/* used by ntlm, ntlmv2 etc */ /* 16th byte of RFC1001 workstation name is always null */ char workstation_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL ];@@ -1908,8 +1908,8 @@ require use of the stronger protocol */* list operations on pending_mid_q and oplockQ * updates to XID counters, multiplex id and SMB sequence numbers * list operations on global DnotifyReqList -* updates to ses->status and cifs_server_info->tcpStatus -* updates to server->CurrentMid +* updates to ses->status and cifs_server_info->status +* updates to server->current_mid * g_servers_lock protects: * list operations on tcp and SMB session lists * tcon->open_file_lock protects the list of open files hanging off the tcon fs/cifs/cifsproto.h +2
-2@@ -79,9 +79,9 @@ extern char *cifs_compose_mount_options(const char *sb_mountdata, const char *fullpath, const struct dfs_info3_param *ref, char **devname);/* extern void renew_parental_timestamps(struct dentry *direntry);*/ -extern struct mid_q_entry *AllocMidQEntry (const struct smb_hdr *smb_buffer, +extern struct mid_q_entry *cifs_alloc_mid_q_entry (const struct smb_hdr *smb_buffer,struct cifs_server_info *server); -extern void DeleteMidQEntry (struct mid_q_entry *midEntry); +extern void cifs_delete_mid_q_entry (struct mid_q_entry *midEntry);extern void cifs_delete_mid (struct mid_q_entry *mid);extern void cifs_mid_q_entry_release (struct mid_q_entry *midEntry);extern void cifs_wake_up_task (struct mid_q_entry *mid);fs/cifs/cifssmb.c +19
-19@@ -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->tcpStatus == CifsNeedReconnect) { +while (server->status == CifsNeedReconnect) { rc =wait_event_interruptible_timeout (server->response_q, - (server->tcpStatus != CifsNeedReconnect), + (server->status != CifsNeedReconnect),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->tcpStatus != CifsNeedReconnect) { +if (server->status != CifsNeedReconnect) {spin_unlock (&g_servers_lock);break ; }@@ -199,10 +199,10 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)/* * Recheck after acquire mutex. If another thread is negotiating * and the server never sends an answer the socket will be closed -* and tcpStatus set to reconnect. +* and status set to reconnect. */ spin_lock (&g_servers_lock); -if (server->tcpStatus == CifsNeedReconnect) { +if (server->status == CifsNeedReconnect) {spin_unlock (&g_servers_lock); rc = -EHOSTDOWN ; goto out;@@ -435,13 +435,13 @@ decode_ext_sec_blob(struct cifs_ses *ses, NEGOTIATE_RSP *pSMBr)spin_lock (&g_servers_lock);if (server->srv_count >1 ) {spin_unlock (&g_servers_lock); -if (memcmp (server->server_GUID, guid,SMB1_CLIENT_GUID_SIZE ) !=0 ) { +if (memcmp (server->server_guid, guid,SMB1_CLIENT_GUID_SIZE ) !=0 ) {cifs_dbg (FYI ,"server UID changed\n" ); -memcpy (server->server_GUID, guid,SMB1_CLIENT_GUID_SIZE ); +memcpy (server->server_guid, guid,SMB1_CLIENT_GUID_SIZE ); } }else {spin_unlock (&g_servers_lock); -memcpy (server->server_GUID, guid,SMB1_CLIENT_GUID_SIZE ); +memcpy (server->server_guid, guid,SMB1_CLIENT_GUID_SIZE ); }if (count ==SMB1_CLIENT_GUID_SIZE ) {@@ -591,18 +591,18 @@ CIFSSMBNegotiate(const unsigned int xid,/* one byte, so no need to convert this or EncryptionKeyLen from little endian */ - server->maxReq = min_t(unsigned int, le16_to_cpu(pSMBr->MaxMpxCount), + server->max_req = min_t(unsigned int, le16_to_cpu(pSMBr->MaxMpxCount), cifs_max_pending); -set_credits (server, server->maxReq); +set_credits (server, server->max_req);/* probably no need to store and check maxvcs */ - server->maxBuf =le32_to_cpu (pSMBr->MaxBufferSize); + server->max_buf =le32_to_cpu (pSMBr->MaxBufferSize);/* set up max_read for readahead check */ - server->max_read = server->maxBuf; + server->max_read = server->max_buf; server->max_rw =le32_to_cpu (pSMBr->MaxRawSize); -cifs_dbg (NOISY ,"Max buf = %d\n" , ses->server->maxBuf); +cifs_dbg (NOISY ,"Max buf = %d\n" , ses->server->max_buf); server->capabilities =le32_to_cpu (pSMBr->Capabilities); - server->timeAdj = (int )(__s16 )le16_to_cpu (pSMBr->ServerTimeZone); - server->timeAdj *=60 ; + server->time_adjust = (int )(__s16 )le16_to_cpu (pSMBr->ServerTimeZone); + server->time_adjust *=60 ;if (pSMBr->EncryptionKeyLength ==CIFS_CRYPTO_KEY_SIZE ) { server->negflavor =CIFS_NEGFLAVOR_UNENCAP ;@@ -684,7 +684,7 @@ cifs_echo_callback(struct mid_q_entry *mid)struct cifs_server_info *server = mid->callback_data;struct cifs_credits credits = { .value =1 , .instance =0 }; -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid);add_credits (server, &credits,CIFS_ECHO_OP ); }@@ -1607,7 +1607,7 @@ cifs_readv_callback(struct mid_q_entry *mid) }queue_work (cifsiod_wq, &rdata->work); -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid);add_credits (server, &credits,0 ); }@@ -1849,7 +1849,7 @@ CIFSSMBWrite(const unsigned int xid, struct cifs_io_parms *io_parms,if (tcon->ses->capabilities &CAP_LARGE_WRITE_X ) { bytes_sent = min_t(const unsigned int, CIFSMaxBufSize, count); }else { - bytes_sent = (tcon->ses->server->maxBuf -MAX_CIFS_HDR_SIZE ) + bytes_sent = (tcon->ses->server->max_buf -MAX_CIFS_HDR_SIZE ) & ~0xFF ; }@@ -2132,7 +2132,7 @@ cifs_writev_callback(struct mid_q_entry *mid) }queue_work (cifsiod_wq, &wdata->work); -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid);add_credits (tcon->ses->server, &credits,0 ); }fs/cifs/connect.c +42
-42@@ -186,7 +186,7 @@ static void cifs_resolve_server(struct work_struct *work) }/* -* Update the tcpStatus for the server. +* Update the status for the server. * This is used to signal the cifsd thread to call cifs_reconnect * ONLY cifsd thread should call cifs_reconnect. For any other * thread, use this function @@ -207,7 +207,7 @@ cifs_signal_cifsd_for_reconnect(struct cifs_server_info *server,spin_lock (&g_servers_lock);if (!all_channels) { - pserver->tcpStatus = CifsNeedReconnect; + pserver->status = CifsNeedReconnect;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->tcpStatus = CifsNeedReconnect; + ses->chans[i].server->status = CifsNeedReconnect;spin_unlock (&ses->chan_lock); }spin_unlock (&g_servers_lock);@@ -298,7 +298,7 @@ cifs_abort_connection(struct cifs_server_info *server)struct mid_q_entry *mid, *nmid;struct list_head retry_list; - server->maxBuf =0 ; + server->max_buf =0 ; server->max_read =0 ;/* do not want to be sending data on a socket we are freeing */ @@ -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->tcpStatus == CifsExiting) { +if (server->status == CifsExiting) {/* the demux thread will exit normally next time through the loop */ spin_unlock (&g_servers_lock);wake_up (&server->response_q);@@ -360,9 +360,9 @@ 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->CurrentMid, server->conn_id, +trace_smb3_reconnect (server->current_mid, server->conn_id, server->hostname); - server->tcpStatus = CifsNeedReconnect; + server->status = CifsNeedReconnect;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->tcpStatus != CifsExiting) - server->tcpStatus = CifsNeedNegotiate; +if (server->status != CifsExiting) + server->status = CifsNeedNegotiate;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->tcpStatus == CifsNeedReconnect); + }while (server->status == CifsNeedReconnect);spin_lock (&g_servers_lock); -if (server->tcpStatus == CifsNeedNegotiate) +if (server->status == CifsNeedNegotiate)mod_delayed_work (cifsiod_wq, &server->echo,0 );spin_unlock (&g_servers_lock);@@ -542,13 +542,13 @@ static int reconnect_dfs_server(struct cifs_server_info *server)atomic_inc (&g_server_reconnect_count);set_credits (server,1 );spin_lock (&g_servers_lock); -if (server->tcpStatus != CifsExiting) - server->tcpStatus = CifsNeedNegotiate; +if (server->status != CifsExiting) + server->status = CifsNeedNegotiate;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->tcpStatus == CifsNeedReconnect); + }while (server->status == CifsNeedReconnect);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->tcpStatus == CifsNeedNegotiate) +if (server->status == CifsNeedNegotiate)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->tcpStatus == CifsNeedReconnect || - server->tcpStatus == CifsExiting || - server->tcpStatus == CifsNew || +if (server->status == CifsNeedReconnect || + server->status == CifsExiting || + server->status == CifsNew || (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->tcpStatus == CifsGood || - server->tcpStatus == CifsNeedNegotiate) && +if ((server->status == CifsGood || + server->status == CifsNeedNegotiate) && (!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->tcpStatus == CifsExiting) { +if (server->status == CifsExiting) {spin_unlock (&g_servers_lock);return -ESHUTDOWN ; } -if (server->tcpStatus == CifsNeedReconnect) { +if (server->status == CifsNeedReconnect) {spin_unlock (&g_servers_lock);cifs_reconnect (server, false);return -ECONNABORTED ;@@ -744,7 +744,7 @@ cifs_readv_from_socket(struct cifs_server_info *server, struct msghdr *smb_msg) length == -EINTR) {/* * Minimum sleep to prevent looping, allowing socket -* to clear and app threads to set tcpStatus +* to clear and app threads to set status * CifsNeedReconnect if server hung. */ usleep_range (1000 ,2000 );@@ -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->tcpStatus = CifsExiting; + server->status = CifsExiting;spin_unlock (&g_servers_lock);wake_up_all (&server->response_q);@@ -1091,7 +1091,7 @@ smb2_add_credits_from_hdr(char *buffer, struct cifs_server_info *server)spin_unlock (&server->req_lock);wake_up (&server->request_q); -trace_smb3_hdr_credits (server->CurrentMid, +trace_smb3_hdr_credits (server->current_mid, server->conn_id, server->hostname, scredits,le16_to_cpu (shdr->CreditRequest), in_flight); cifs_server_dbg(FYI, "%s: added %u credits total=%d\n",@@ -1123,7 +1123,7 @@ cifs_demultiplex_thread(void *p)set_freezable ();allow_kernel_signal (SIGKILL ); -while (server->tcpStatus != CifsExiting) { +while (server->status != CifsExiting) {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->tcpStatus = CifsExiting; + server->status = CifsExiting;spin_unlock (&g_servers_lock);cifs_crypto_secmech_release (server);@@ -1603,7 +1603,7 @@ cifs_get_server(struct smb3_fs_context *ctx,mutex_init (&server->_srv_mutex);memcpy (server->workstation_RFC1001_name, ctx->source_rfc1001_name,RFC1001_NAME_LEN_WITH_NULL ); -memcpy (server->server_RFC1001_name, +memcpy (server->server_rfc1001_name, ctx->target_rfc1001_name,RFC1001_NAME_LEN_WITH_NULL ); server->session_estab = false; server->sequence_number =0 ;@@ -1632,9 +1632,9 @@ cifs_get_server(struct smb3_fs_context *ctx,/* * at this point we are the only ones with the pointer * to the struct since the kernel thread not created yet -* no need to spinlock this init of tcpStatus or srv_count +* no need to spinlock this init of status or srv_count */ - server->tcpStatus = CifsNew; + server->status = CifsNew; ++server->srv_count; if (ctx->echo_interval >= SMB_ECHO_INTERVAL_MIN &&@@ -1682,10 +1682,10 @@ cifs_get_server(struct smb3_fs_context *ctx,/* * at this point we are the only ones with the pointer * to the struct since the kernel thread not created yet -* no need to spinlock this update of tcpStatus +* no need to spinlock this update of status */ spin_lock (&g_servers_lock); - server->tcpStatus = CifsNeedNegotiate; + server->status = CifsNeedNegotiate;spin_unlock (&g_servers_lock);if ((ctx->max_credits <20 ) || (ctx->max_credits >60000 ))@@ -2767,10 +2767,10 @@ ip_rfc1001_connect(struct cifs_server_info *server)if (ses_init_buf) { ses_init_buf->trailer.session_req.called_len =32 ; -if (server->server_RFC1001_name[0 ] !=0 ) +if (server->server_rfc1001_name[0 ] !=0 )rfc1002mangle (ses_init_buf->trailer. session_req.called_name, - server->server_RFC1001_name, + server->server_rfc1001_name,RFC1001_NAME_LEN_WITH_NULL );else rfc1002mangle(ses_init_buf->trailer.@@ -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->tcpStatus == CifsNeedReconnect) && +if ((tcon->ses->server->status == CifsNeedReconnect) && (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->tcpStatus != CifsNeedNegotiate) { + server->status != CifsNeedNegotiate) {spin_unlock (&g_servers_lock);return 0 ; } - server->tcpStatus = CifsInNegotiate; + server->status = CifsInNegotiate;spin_unlock (&g_servers_lock); rc = server->ops->negotiate (xid, ses, server);if (rc ==0 ) {spin_lock (&g_servers_lock); -if (server->tcpStatus == CifsInNegotiate) - server->tcpStatus = CifsGood; +if (server->status == CifsInNegotiate) + server->status = CifsGood;else rc = -EHOSTDOWN ;spin_unlock (&g_servers_lock); }else {spin_lock (&g_servers_lock); -if (server->tcpStatus == CifsInNegotiate) - server->tcpStatus = CifsNeedNegotiate; +if (server->status == CifsInNegotiate) + server->status = CifsNeedNegotiate;spin_unlock (&g_servers_lock); }@@ -4067,7 +4067,7 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses, }cifs_dbg (FYI ,"Security Mode: 0x%x Capabilities: 0x%x TimeAdjust: %d\n" , - server->sec_mode, server->capabilities, server->timeAdj); + server->sec_mode, server->capabilities, server->time_adjust);if (server->ops->sess_setup) rc = server->ops->sess_setup (xid, ses, server, nls_info);fs/cifs/file.c +4
-4@@ -1267,10 +1267,10 @@ cifs_push_mandatory_locks(struct cifs_file_info *cfile) tcon =tlink_tcon (cfile->tlink);/* -* Accessing maxBuf is racy with cifs_reconnect - need to store value +* Accessing max_buf is racy with cifs_reconnect - need to store value * and check it before using. */ - max_buf = tcon->ses->server->maxBuf; + max_buf = tcon->ses->server->max_buf;if (max_buf < (sizeof (struct smb_hdr ) +sizeof (LOCKING_ANDX_RANGE ))) {free_xid (xid);return -EINVAL ;@@ -1611,10 +1611,10 @@ cifs_unlock_range(struct cifs_file_info *cfile, struct file_lock *flock,INIT_LIST_HEAD (&tmp_llist);/* -* Accessing maxBuf is racy with cifs_reconnect - need to store value +* Accessing max_buf is racy with cifs_reconnect - need to store value * and check it before using. */ - max_buf = tcon->ses->server->maxBuf; + max_buf = tcon->ses->server->max_buf;if (max_buf < (sizeof (struct smb_hdr ) +sizeof (LOCKING_ANDX_RANGE )))return -EINVAL ;fs/cifs/inode.c +4
-4@@ -613,8 +613,8 @@ smb311_posix_info_to_fattr(struct cifs_fattr *fattr, struct smb311_posix_qinfo * fattr->cf_mtime =cifs_NTtimeToUnix (info->LastWriteTime);if (adjust_tz) { - fattr->cf_ctime.tv_sec += tcon->ses->server->timeAdj; - fattr->cf_mtime.tv_sec += tcon->ses->server->timeAdj; + fattr->cf_ctime.tv_sec += tcon->ses->server->time_adjust; + fattr->cf_mtime.tv_sec += tcon->ses->server->time_adjust; } fattr->cf_eof =le64_to_cpu (info->EndOfFile);@@ -669,8 +669,8 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, fattr->cf_mtime =cifs_NTtimeToUnix (info->LastWriteTime);if (adjust_tz) { - fattr->cf_ctime.tv_sec += tcon->ses->server->timeAdj; - fattr->cf_mtime.tv_sec += tcon->ses->server->timeAdj; + fattr->cf_ctime.tv_sec += tcon->ses->server->time_adjust; + fattr->cf_mtime.tv_sec += tcon->ses->server->time_adjust; } fattr->cf_eof =le64_to_cpu (info->EndOfFile);fs/cifs/readdir.c +1
-1@@ -318,7 +318,7 @@ static void cifs_std_info_to_fattr(struct cifs_fattr *fattr, FIND_FILE_STANDARD_INFO *info, struct cifs_sb_info *cifs_sb) { - int offset = cifs_sb_master_tcon(cifs_sb)->ses->server->timeAdj; + int offset = cifs_sb_master_tcon(cifs_sb)->ses->server->time_adjust;memset (fattr,0 ,sizeof (*fattr)); fattr->cf_atime = cnvrtDosUnixTm(info->LastAccessDate,fs/cifs/sess.c +1
-1@@ -514,7 +514,7 @@ static __u32 cifs_ssetup_hdr(struct cifs_ses *ses, pSMB->req.MaxBufferSize =cpu_to_le16 (min_t (u32, CIFSMaxBufSize +MAX_CIFS_HDR_SIZE -4 ,USHRT_MAX )); - pSMB->req.MaxMpxCount =cpu_to_le16 (server->maxReq); + pSMB->req.MaxMpxCount =cpu_to_le16 (server->max_req); pSMB->req.VcNumber =cpu_to_le16 (1 );/* Now no need to set SMBFLG_CASELESS or obsolete CANONICAL PATH */ fs/cifs/smb1ops.c +6
-6@@ -169,7 +169,7 @@ cifs_get_next_mid(struct cifs_server_info *server)spin_lock (&g_mid_lock);/* mid is 16 bit only for CIFS/SMB */ - cur_mid = (__u16)((server->CurrentMid) &0xffff ); + cur_mid = (__u16)((server->current_mid) &0xffff );/* we do not want to loop forever */ last_mid = cur_mid; cur_mid++;@@ -220,7 +220,7 @@ cifs_get_next_mid(struct cifs_server_info *server)if (!collision) { mid = (__u64 )cur_mid; - server->CurrentMid = mid; + server->current_mid = mid;break ; } cur_mid++;@@ -416,7 +416,7 @@ cifs_check_trans2(struct mid_q_entry *mid, struct cifs_server_info *server,static bool cifs_need_neg (struct cifs_server_info *server) { -return server->maxBuf ==0 ; +return server->max_buf ==0 ; } static int@@ -463,7 +463,7 @@ cifs_negotiate_wsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)if (!(server->capabilities &CAP_LARGE_WRITE_X ) || (!(server->capabilities &CAP_UNIX ) && server->sign)) wsize = min_t(unsigned int, wsize, - server->maxBuf -sizeof (WRITE_REQ ) +4 ); + server->max_buf -sizeof (WRITE_REQ ) +4 );/* hard limit of CIFS_MAX_WSIZE */ wsize = min_t(unsigned int, wsize, CIFS_MAX_WSIZE);@@ -495,7 +495,7 @@ cifs_negotiate_rsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)else if (server->capabilities &CAP_LARGE_READ_X ) defsize =CIFS_DEFAULT_NON_POSIX_RSIZE ;else - defsize = server->maxBuf -sizeof (READ_RSP ); + defsize = server->max_buf -sizeof (READ_RSP ); rsize = ctx->rsize ? ctx->rsize : defsize;@@ -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->tcpStatus == CifsGood) +if (server->status == CifsGood)return true;return false;fs/cifs/smb2file.c +4
-4@@ -116,10 +116,10 @@ smb2_unlock_range(struct cifs_file_info *cfile, struct file_lock *flock,INIT_LIST_HEAD (&tmp_llist);/* -* Accessing maxBuf is racy with cifs_reconnect - need to store value +* Accessing max_buf is racy with cifs_reconnect - need to store value * and check it before using. */ - max_buf = tcon->ses->server->maxBuf; + max_buf = tcon->ses->server->max_buf;if (max_buf <sizeof (struct smb2_lock_element ))return -EINVAL ;@@ -257,10 +257,10 @@ smb2_push_mandatory_locks(struct cifs_file_info *cfile) xid =get_xid ();/* -* Accessing maxBuf is racy with cifs_reconnect - need to store value +* Accessing max_buf is racy with cifs_reconnect - need to store value * and check it for zero before using. */ - max_buf =tlink_tcon (cfile->tlink)->ses->server->maxBuf; + max_buf =tlink_tcon (cfile->tlink)->ses->server->max_buf;if (max_buf <sizeof (struct smb2_lock_element )) {free_xid (xid);return -EINVAL ;fs/cifs/smb2ops.c +18
-18@@ -86,7 +86,7 @@ smb2_add_credits(struct cifs_server_info *server,if (*val >65000 ) { *val =65000 ;/* Don't get near 64K credits, avoid srv bugs */ pr_warn_once ("server overflowed SMB3 credits\n" ); -trace_smb3_overflow_credits (server->CurrentMid, +trace_smb3_overflow_credits (server->current_mid, server->conn_id, server->hostname, *val, add, server->in_flight); }@@ -112,7 +112,7 @@ smb2_add_credits(struct cifs_server_info *server,wake_up (&server->request_q);if (reconnect_detected) { -trace_smb3_reconnect_detected (server->CurrentMid, +trace_smb3_reconnect_detected (server->current_mid, server->conn_id, server->hostname, scredits, add, in_flight); cifs_dbg(FYI, "trying to put %d credits from the old server instance %d\n",@@ -120,15 +120,15 @@ smb2_add_credits(struct cifs_server_info *server, }if (reconnect_with_invalid_credits) { -trace_smb3_reconnect_with_invalid_credits (server->CurrentMid, +trace_smb3_reconnect_with_invalid_credits (server->current_mid, server->conn_id, server->hostname, scredits, add, in_flight);cifs_dbg (FYI ,"Negotiate operation when server credits is non-zero. Optype: %d, server credits: %d, credits added: %d\n" , optype, scredits, add); }spin_lock (&g_servers_lock); -if (server->tcpStatus == CifsNeedReconnect - || server->tcpStatus == CifsExiting) { +if (server->status == CifsNeedReconnect + || server->status == CifsExiting) {spin_unlock (&g_servers_lock);return ; }@@ -152,7 +152,7 @@ smb2_add_credits(struct cifs_server_info *server,break ; } -trace_smb3_add_credits (server->CurrentMid, +trace_smb3_add_credits (server->current_mid, server->conn_id, server->hostname, scredits, add, in_flight);cifs_dbg (FYI ,"%s: added %u credits total=%d\n" , __func__, add, scredits); }@@ -170,7 +170,7 @@ smb2_set_credits(struct cifs_server_info *server, const int val) in_flight = server->in_flight;spin_unlock (&server->req_lock); -trace_smb3_set_credits (server->CurrentMid, +trace_smb3_set_credits (server->current_mid, server->conn_id, server->hostname, scredits, val, in_flight);cifs_dbg (FYI ,"%s: set %u credits\n" , __func__, val);@@ -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->tcpStatus == CifsExiting) { +if (server->status == CifsExiting) {spin_unlock (&g_servers_lock);return -ENOENT ; }@@ -254,7 +254,7 @@ smb2_wait_mtu_credits(struct cifs_server_info *server, unsigned int size, in_flight = server->in_flight;spin_unlock (&server->req_lock); -trace_smb3_wait_credits (server->CurrentMid, +trace_smb3_wait_credits (server->current_mid, server->conn_id, server->hostname, scredits, -(credits->value), in_flight);cifs_dbg (FYI ,"%s: removed %u credits total=%d\n" , __func__, credits->value, scredits);@@ -274,7 +274,7 @@ smb2_adjust_credits(struct cifs_server_info *server,return 0 ;if (credits->value < new_val) { -trace_smb3_too_many_credits (server->CurrentMid, +trace_smb3_too_many_credits (server->current_mid, server->conn_id, server->hostname,0 , credits->value - new_val,0 );cifs_server_dbg (VFS ,"request has less credits (%d) than required (%d)" , credits->value, new_val);@@ -289,7 +289,7 @@ smb2_adjust_credits(struct cifs_server_info *server, in_flight = server->in_flight;spin_unlock (&server->req_lock); -trace_smb3_reconnect_detected (server->CurrentMid, +trace_smb3_reconnect_detected (server->current_mid, server->conn_id, server->hostname, scredits, credits->value - new_val, in_flight); cifs_server_dbg(VFS, "trying to return %d credits to old session\n",@@ -303,7 +303,7 @@ smb2_adjust_credits(struct cifs_server_info *server,spin_unlock (&server->req_lock);wake_up (&server->request_q); -trace_smb3_adj_credits (server->CurrentMid, +trace_smb3_adj_credits (server->current_mid, server->conn_id, server->hostname, scredits, credits->value - new_val, in_flight); cifs_dbg(FYI, "%s: adjust added %u credits total=%d\n",@@ -320,7 +320,7 @@ smb2_get_next_mid(struct cifs_server_info *server)__u64 mid;/* for SMB2 we need the current value */ spin_lock (&g_mid_lock); - mid = server->CurrentMid++; + mid = server->current_mid++;spin_unlock (&g_mid_lock);return mid; }@@ -329,8 +329,8 @@ static void smb2_revert_current_mid(struct cifs_server_info *server, const unsigned int val) { spin_lock(&g_mid_lock); -if (server->CurrentMid >= val) - server->CurrentMid -= val; +if (server->current_mid >= val) + server->current_mid -= val;spin_unlock (&g_mid_lock); }@@ -404,7 +404,7 @@ smb2_negotiate(const unsigned int xid,int rc;spin_lock (&g_mid_lock); - server->CurrentMid =0 ; + server->current_mid =0 ;spin_unlock (&g_mid_lock); rc =SMB2_negotiate (xid, ses, server);/* BB we probably don't need to retry with modern servers */ @@ -2532,7 +2532,7 @@ smb2_is_status_pending(char *buf, struct cifs_server_info *server)spin_unlock (&server->req_lock);wake_up (&server->request_q); -trace_smb3_pend_credits (server->CurrentMid, +trace_smb3_pend_credits (server->current_mid, server->conn_id, server->hostname, scredits,le16_to_cpu (shdr->CreditRequest), in_flight); cifs_dbg(FYI, "%s: status pending add %u credits total=%d\n",@@ -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->tcpStatus == CifsNeedReconnect) { +if (dw->server->status == CifsNeedReconnect) { mid->mid_state =MID_RETRY_NEEDED ;spin_unlock (&g_mid_lock);spin_unlock (&g_servers_lock);fs/cifs/smb2pdu.c +10
-10@@ -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->tcpStatus == CifsNeedReconnect) { +while (server->status == CifsNeedReconnect) {/* * 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->tcpStatus != CifsNeedReconnect), + (server->status != CifsNeedReconnect),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->tcpStatus != CifsNeedReconnect) { +if (server->status != CifsNeedReconnect) {spin_unlock (&g_servers_lock);break ; }@@ -254,10 +254,10 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,/* * Recheck after acquire mutex. If another thread is negotiating * and the server never sends an answer the socket will be closed -* and tcpStatus set to reconnect. +* and status set to reconnect. */ spin_lock (&g_servers_lock); -if (server->tcpStatus == CifsNeedReconnect) { +if (server->status == CifsNeedReconnect) {spin_unlock (&g_servers_lock); rc = -EHOSTDOWN ; goto out;@@ -1032,7 +1032,7 @@ SMB2_negotiate(const unsigned int xid,/* SMB2 only has an extended negflavor */ server->negflavor =CIFS_NEGFLAVOR_EXTENDED ;/* set it to the maximum buffer size value we can send with 1 credit */ - server->maxBuf = min_t(unsigned int, le32_to_cpu(rsp->MaxTransactSize), + server->max_buf = min_t(unsigned int, le32_to_cpu(rsp->MaxTransactSize),SMB2_MAX_BUFFER_SIZE ); server->max_read =le32_to_cpu (rsp->MaxReadSize); server->max_write =le32_to_cpu (rsp->MaxWriteSize);@@ -3776,7 +3776,7 @@ smb2_echo_callback(struct mid_q_entry *mid) credits.instance = server->reconnect_instance; } -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid);add_credits (server, &credits,CIFS_ECHO_OP ); }@@ -4201,7 +4201,7 @@ smb2_readv_callback(struct mid_q_entry *mid) rdata->offset, rdata->got_bytes);queue_work (cifsiod_wq, &rdata->work); -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid);add_credits (server, &credits,0 ); }@@ -4440,7 +4440,7 @@ smb2_writev_callback(struct mid_q_entry *mid) wdata->offset, wdata->bytes);queue_work (cifsiod_wq, &wdata->work); -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid);add_credits (server, &credits,0 ); }@@ -4874,7 +4874,7 @@ int SMB2_query_directory_init(const unsigned int xid,* BB could be 30 bytes or so longer if we used SMB2 specific * buffer lengths, but this is safe and close enough. */ - output_size = min_t(unsigned int, output_size, server->maxBuf); + output_size = min_t(unsigned int, output_size, server->max_buf); output_size = min_t(unsigned int, output_size, 2 << 15); req->OutputBufferLength =cpu_to_le32 (output_size);fs/cifs/smb2transport.c +5
-5@@ -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->tcpStatus == CifsExiting) { +if (server->status == CifsExiting) {spin_unlock (&g_servers_lock);return -ENOENT ; } -if (server->tcpStatus == CifsNeedReconnect) { +if (server->status == CifsNeedReconnect) {spin_unlock (&g_servers_lock);cifs_dbg (FYI ,"tcp session dead - return to caller to retry\n" );return -EAGAIN ; } -if (server->tcpStatus == CifsNeedNegotiate && +if (server->status == CifsNeedNegotiate && 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->tcpStatus == CifsNeedNegotiate && +if (server->status == CifsNeedNegotiate && shdr->Command !=SMB2_NEGOTIATE ) {spin_unlock (&g_servers_lock);return ERR_PTR (-EAGAIN );@@ -888,7 +888,7 @@ smb2_setup_async_request(struct cifs_server_info *server, struct smb_rqst *rqst) rc =smb2_sign_rqst (rqst, server);if (rc) {revert_current_mid_from_hdr (server, shdr); -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid);return ERR_PTR (rc); }fs/cifs/transport.c +27
-28@@ -38,12 +38,12 @@ cifs_wake_up_task(struct mid_q_entry *mid) }struct mid_q_entry * -AllocMidQEntry (const struct smb_hdr *smb_buffer,struct cifs_server_info *server) +cifs_alloc_mid_q_entry (const struct smb_hdr *smb_buffer,struct cifs_server_info *server) {struct mid_q_entry *temp;if (server ==NULL ) { -cifs_dbg (VFS ,"Null TCP session in AllocMidQEntry\n" ); +cifs_dbg (VFS ,"Null TCP session in cifs_alloc_mid_q_entry\n" );return NULL ; }@@ -159,7 +159,7 @@ void cifs_mid_q_entry_release(struct mid_q_entry *midEntry)spin_unlock (&g_mid_lock); } -void DeleteMidQEntry (struct mid_q_entry *midEntry) +void cifs_delete_mid_q_entry (struct mid_q_entry *midEntry) {cifs_mid_q_entry_release (midEntry); }@@ -174,7 +174,7 @@ cifs_delete_mid(struct mid_q_entry *mid) }spin_unlock (&g_mid_lock); -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid); }/* @@ -431,7 +431,7 @@ __smb_send_rqst(struct cifs_server_info *server, int num_rqst,* socket so the server throws away the partial SMB */ cifs_signal_cifsd_for_reconnect (server, false); -trace_smb3_partial_send_reconnect (server->CurrentMid, +trace_smb3_partial_send_reconnect (server->current_mid, server->conn_id, server->hostname); } smbd_done:@@ -541,7 +541,7 @@ wait_for_free_credits(struct cifs_server_info *server, const int num_credits, in_flight = server->in_flight;spin_unlock (&server->req_lock); -trace_smb3_nblk_credits (server->CurrentMid, +trace_smb3_nblk_credits (server->current_mid, server->conn_id, server->hostname, scredits,-1 , in_flight);cifs_dbg (FYI ,"%s: remove %u credits total=%d\n" , __func__,1 , scredits);@@ -564,7 +564,7 @@ wait_for_free_credits(struct cifs_server_info *server, const int num_credits, in_flight = server->in_flight;spin_unlock (&server->req_lock); -trace_smb3_credit_timeout (server->CurrentMid, +trace_smb3_credit_timeout (server->current_mid, server->conn_id, server->hostname, scredits, num_credits, in_flight); cifs_server_dbg(VFS, "wait timed out after %d ms\n",@@ -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->tcpStatus == CifsExiting) { +if (server->status == CifsExiting) {spin_unlock (&g_servers_lock);return -ENOENT ; }@@ -617,7 +617,7 @@ wait_for_free_credits(struct cifs_server_info *server, const int num_credits,spin_unlock (&server->req_lock);trace_smb3_credit_timeout ( - server->CurrentMid, + server->current_mid, server->conn_id, server->hostname, scredits, num_credits, in_flight); cifs_server_dbg(VFS, "wait timed out after %d ms\n",@@ -647,7 +647,7 @@ wait_for_free_credits(struct cifs_server_info *server, const int num_credits, in_flight = server->in_flight;spin_unlock (&server->req_lock); -trace_smb3_waitff_credits (server->CurrentMid, +trace_smb3_waitff_credits (server->current_mid, server->conn_id, server->hostname, scredits, -(num_credits), in_flight); cifs_dbg(FYI, "%s: remove %u credits total=%d\n",@@ -698,7 +698,7 @@ wait_for_compound_request(struct cifs_server_info *server, int num,*/ if (server->in_flight ==0 ) {spin_unlock (&server->req_lock); -trace_smb3_insufficient_credits (server->CurrentMid, +trace_smb3_insufficient_credits (server->current_mid, server->conn_id, server->hostname, scredits, num, in_flight); cifs_dbg(FYI, "%s: %d requests in flight, needed %d total=%d\n",@@ -745,7 +745,7 @@ static int allocate_mid(struct cifs_ses *ses, struct smb_hdr *in_buf, }spin_unlock (&g_servers_lock); - *ppmidQ =AllocMidQEntry (in_buf, ses->server); + *ppmidQ =cifs_alloc_mid_q_entry (in_buf, ses->server);if (*ppmidQ ==NULL )return -ENOMEM ;spin_lock (&g_mid_lock);@@ -782,13 +782,13 @@ cifs_setup_async_request(struct cifs_server_info *server, struct smb_rqst *rqst)if (server->sign) hdr->Flags2 |=SMBFLG2_SECURITY_SIGNATURE ; - mid =AllocMidQEntry (hdr, server); + mid =cifs_alloc_mid_q_entry (hdr, server);if (mid ==NULL )return ERR_PTR (-ENOMEM ); rc =cifs_sign_rqst (rqst, server, &mid->sequence_number);if (rc) { -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid);return ERR_PTR (rc); }@@ -937,7 +937,7 @@ cifs_sync_mid_result(struct mid_q_entry *mid, struct cifs_server_info *server) }spin_unlock (&g_mid_lock); -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid);return rc; }@@ -1026,7 +1026,7 @@ static void cifs_cancelled_callback(struct mid_q_entry *mid) {cifs_compound_callback (mid); -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid); }/* @@ -1079,7 +1079,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, }spin_lock (&g_servers_lock); -if (server->tcpStatus == CifsExiting) { +if (server->status == CifsExiting) {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->tcpStatus == CifsExiting) { +if (server->status == CifsExiting) {spin_unlock (&g_servers_lock);return -ENOENT ; }@@ -1369,7 +1369,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses,/* Ensure that we do not send more than 50 overlapping requests to the same server. We may make this configurable later or -use ses->maxReq */ +use ses->max_req */ if (len > CIFSMaxBufSize +MAX_CIFS_HDR_SIZE -4 ) { cifs_server_dbg(VFS, "Invalid length, greater than maximum frame, %d\n",@@ -1422,7 +1422,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses,spin_lock (&g_mid_lock);if (midQ->mid_state ==MID_REQUEST_SUBMITTED ) {/* no longer considered to be "in-flight" */ - midQ->callback = DeleteMidQEntry; + midQ->callback = cifs_delete_mid_q_entry;spin_unlock (&g_mid_lock);add_credits (server, &credits,0 );return rc;@@ -1506,7 +1506,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon, }spin_lock (&g_servers_lock); -if (server->tcpStatus == CifsExiting) { +if (server->status == CifsExiting) {spin_unlock (&g_servers_lock);return -ENOENT ; }@@ -1514,7 +1514,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,/* Ensure that we do not send more than 50 overlapping requests to the same server. We may make this configurable later or -use ses->maxReq */ +use ses->max_req */ if (len > CIFSMaxBufSize +MAX_CIFS_HDR_SIZE -4 ) { cifs_tcon_dbg(VFS, "Invalid length, greater than maximum frame, %d\n",@@ -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->tcpStatus != CifsGood) && - (server->tcpStatus != CifsNew))); + ((server->status != CifsGood) && + (server->status != CifsNew)));/* Were we interrupted by a signal ? */ spin_lock (&g_servers_lock);if ((rc == -ERESTARTSYS ) && (midQ->mid_state ==MID_REQUEST_SUBMITTED ) && - ((server->tcpStatus == CifsGood) || - (server->tcpStatus == CifsNew))) { + ((server->status == CifsGood) || + (server->status == CifsNew))) {spin_unlock (&g_servers_lock);if (in_buf->Command ==SMB_COM_TRANSACTION2 ) {@@ -1603,7 +1603,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,spin_lock (&g_mid_lock);if (midQ->mid_state ==MID_REQUEST_SUBMITTED ) {/* no longer considered to be "in-flight" */ - midQ->callback = DeleteMidQEntry; + midQ->callback = cifs_delete_mid_q_entry;spin_unlock (&g_mid_lock);return rc; } --2.35.3
Signature · 3 lines
Thanks, Steve
Re: [RFC PATCH v2 05/10] cifs: convert server info vars to snake_case
Quoted 7 lines · Steve French
I doubt that renaming tcpStatus to "status" helps much. If it has to do with the socket, included tcp or socket or connection in the name seems plausible/helpful. I don't mind removing the came cause (e.g. "
tcp_status" or something similar) but prefer other types of cleanup to be the focus (moving smb1 code out of mixed smb1/smb2/smb3 c files into smb1 specific ones that are compiled out when legacy is disabled etc.
Steve, the way I see it is, if we have a struct names "server_info" or similar, there's no need to include a prefix in its fields' names, especially when there's only one "status" variable for that struct (which should always be the case), e.g. "server->server_status" looks ugly and one might assume that "server" holds another different status, which it doesn't and it would be wrong if it did.
Also, if you want to see the, e.g., socket state, why not use "server->ssocket->state" instead of creating/keeping yet another server_info variable?
My 2c,
Enzo
Quoted 1,240 lines · Enzo Matsumiya
Quoted 1,233 lines
Rename
cifs_server_infovariables that were still in CamelCase orCamel_Casetosnake_case.Rename [Alloc,Delete]MidQEntry() functions to
cifs_{alloc,delete}_mid_q_entry().Signed-off-by Enzo Matsumiya <[email protected]>--- fs/cifs/cifs_debug.c | 4 +- fs/cifs/cifsencrypt.c | 2 +- fs/cifs/cifsglob.h | 24 ++++++------ fs/cifs/cifsproto.h | 4 +- fs/cifs/cifssmb.c | 38 +++++++++---------- fs/cifs/connect.c | 84 ++++++++++++++++++++--------------------- fs/cifs/file.c | 8 ++-- fs/cifs/inode.c | 8 ++-- fs/cifs/readdir.c | 2 +- fs/cifs/sess.c | 2 +- fs/cifs/smb1ops.c | 12 +++--- fs/cifs/smb2file.c | 8 ++-- fs/cifs/smb2ops.c | 36 +++++++++--------- fs/cifs/smb2pdu.c | 20 +++++----- fs/cifs/smb2transport.c | 10 ++--- fs/cifs/transport.c | 54 +++++++++++++------------- 16 files changed, 158 insertions(+), 158 deletions(-)fs/cifs/cifs_debug.c +2
-2@@ -136,7 +136,7 @@ cifs_dump_channel(struct seq_file *m, int i, struct cifs_chan *chan) i+1 , server->conn_id, server->credits, server->dialect, - server->tcpStatus, + server->status, server->reconnect_instance, server->srv_count, server->sec_mode,@@ -364,7 +364,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)seq_printf (m,"\nRDMA " );seq_printf (m,"\nTCP status: %d Instance: %d" "\nLocal Users To Server: %d SecMode: 0x%x Req On Wire: %d" , - server->tcpStatus, + server->status, server->reconnect_instance, server->srv_count, server->sec_mode,in_flight (server));fs/cifs/cifsencrypt.c +1
-1@@ -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->tcpStatus == CifsNeedNegotiate) { + server->status == CifsNeedNegotiate) {spin_unlock (&g_servers_lock);return rc; }fs/cifs/cifsglob.h +12
-12@@ -608,11 +608,11 @@ struct cifs_server_info {__u64 conn_id;/* connection identifier (useful for debugging) */ int srv_count;/* reference counter */ /* 15 character server name + 0x20 16th byte indicating type = srv */ -char server_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL ]; +char server_rfc1001_name[RFC1001_NAME_LEN_WITH_NULL ];struct smb_version_operations *ops;struct smb_version_values *vals; -/* updates to tcpStatus protected by g_servers_lock */ -enum statusEnum tcpStatus;/* what we think the status is */ +/* updates to status protected by g_servers_lock */ +enum statusEnum status;/* what we think the status is */ char *hostname;/* hostname portion of UNC string */ struct socket *ssocket;struct sockaddr_storage dstaddr;@@ -635,7 +635,7 @@ struct cifs_server_info {struct mutex _srv_mutex;unsigned int nofs_flag;struct task_struct *tsk; -char server_GUID[16 ]; +char server_guid[16 ];__u16 sec_mode;bool sign;/* is signing enabled on this connection? */ bool ignore_signature:1; /* skip validation of signatures in SMB2/3 rsp */@@ -646,19 +646,19 @@ struct cifs_server_info {__u8 client_guid[SMB2_CLIENT_GUID_SIZE ];/* Client GUID */ u16 dialect;/* dialect index that server chose */ bool oplocks:1; /* enable oplocks */ -unsigned int maxReq;/* Clients should submit no more */ -/* than maxReq distinct unanswered SMBs to the server when using */ +unsigned int max_req;/* Clients should submit no more */ +/* than max_req distinct unanswered SMBs to the server when using */ /* multiplexed reads or writes (for SMB1/CIFS only, not SMB2/SMB3) */ -unsigned int maxBuf;/* maxBuf specifies the maximum */ +unsigned int max_buf;/* max_buf specifies the maximum */ /* message size the server can send or receive for non-raw SMBs */ -/* maxBuf is returned by SMB NegotiateProtocol so maxBuf is only 0 */ +/* max_buf is returned by SMB NegotiateProtocol so max_buf is only 0 */ /* when socket is setup (and during reconnect) before NegProt sent */ unsigned int max_rw;/* maxRw specifies the maximum */ /* message size the server can send or receive for */ /* SMB_COM_WRITE_RAW or SMB_COM_READ_RAW. */ unsigned int capabilities;/* selective disabling of caps by smb sess */ -int timeAdj;/* Adjust for difference in server time zone in sec */ -__u64 CurrentMid;/* multiplex id - rotating counter, protected by g_mid_lock */ +int time_adjust;/* Adjust for difference in server time zone in sec */ +__u64 current_mid;/* multiplex id - rotating counter, protected by g_mid_lock */ char cryptkey[CIFS_CRYPTO_KEY_SIZE ];/* used by ntlm, ntlmv2 etc */ /* 16th byte of RFC1001 workstation name is always null */ char workstation_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL ];@@ -1908,8 +1908,8 @@ require use of the stronger protocol */* list operations on pending_mid_q and oplockQ * updates to XID counters, multiplex id and SMB sequence numbers * list operations on global DnotifyReqList -* updates to ses->status and cifs_server_info->tcpStatus -* updates to server->CurrentMid +* updates to ses->status and cifs_server_info->status +* updates to server->current_mid * g_servers_lock protects: * list operations on tcp and SMB session lists * tcon->open_file_lock protects the list of open files hanging off the tcon fs/cifs/cifsproto.h +2
-2@@ -79,9 +79,9 @@ extern char *cifs_compose_mount_options(const char *sb_mountdata, const char *fullpath, const struct dfs_info3_param *ref, char **devname);/* extern void renew_parental_timestamps(struct dentry *direntry);*/ -extern struct mid_q_entry *AllocMidQEntry (const struct smb_hdr *smb_buffer, +extern struct mid_q_entry *cifs_alloc_mid_q_entry (const struct smb_hdr *smb_buffer,struct cifs_server_info *server); -extern void DeleteMidQEntry (struct mid_q_entry *midEntry); +extern void cifs_delete_mid_q_entry (struct mid_q_entry *midEntry);extern void cifs_delete_mid (struct mid_q_entry *mid);extern void cifs_mid_q_entry_release (struct mid_q_entry *midEntry);extern void cifs_wake_up_task (struct mid_q_entry *mid);fs/cifs/cifssmb.c +19
-19@@ -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->tcpStatus == CifsNeedReconnect) { +while (server->status == CifsNeedReconnect) { rc =wait_event_interruptible_timeout (server->response_q, - (server->tcpStatus != CifsNeedReconnect), + (server->status != CifsNeedReconnect),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->tcpStatus != CifsNeedReconnect) { +if (server->status != CifsNeedReconnect) {spin_unlock (&g_servers_lock);break ; }@@ -199,10 +199,10 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)/* * Recheck after acquire mutex. If another thread is negotiating * and the server never sends an answer the socket will be closed -* and tcpStatus set to reconnect. +* and status set to reconnect. */ spin_lock (&g_servers_lock); -if (server->tcpStatus == CifsNeedReconnect) { +if (server->status == CifsNeedReconnect) {spin_unlock (&g_servers_lock); rc = -EHOSTDOWN ; goto out;@@ -435,13 +435,13 @@ decode_ext_sec_blob(struct cifs_ses *ses, NEGOTIATE_RSP *pSMBr)spin_lock (&g_servers_lock);if (server->srv_count >1 ) {spin_unlock (&g_servers_lock); -if (memcmp (server->server_GUID, guid,SMB1_CLIENT_GUID_SIZE ) !=0 ) { +if (memcmp (server->server_guid, guid,SMB1_CLIENT_GUID_SIZE ) !=0 ) {cifs_dbg (FYI ,"server UID changed\n" ); -memcpy (server->server_GUID, guid,SMB1_CLIENT_GUID_SIZE ); +memcpy (server->server_guid, guid,SMB1_CLIENT_GUID_SIZE ); } }else {spin_unlock (&g_servers_lock); -memcpy (server->server_GUID, guid,SMB1_CLIENT_GUID_SIZE ); +memcpy (server->server_guid, guid,SMB1_CLIENT_GUID_SIZE ); }if (count ==SMB1_CLIENT_GUID_SIZE ) {@@ -591,18 +591,18 @@ CIFSSMBNegotiate(const unsigned int xid,/* one byte, so no need to convert this or EncryptionKeyLen from little endian */ - server->maxReq = min_t(unsigned int, le16_to_cpu(pSMBr->MaxMpxCount), + server->max_req = min_t(unsigned int, le16_to_cpu(pSMBr->MaxMpxCount), cifs_max_pending); -set_credits (server, server->maxReq); +set_credits (server, server->max_req);/* probably no need to store and check maxvcs */ - server->maxBuf =le32_to_cpu (pSMBr->MaxBufferSize); + server->max_buf =le32_to_cpu (pSMBr->MaxBufferSize);/* set up max_read for readahead check */ - server->max_read = server->maxBuf; + server->max_read = server->max_buf; server->max_rw =le32_to_cpu (pSMBr->MaxRawSize); -cifs_dbg (NOISY ,"Max buf = %d\n" , ses->server->maxBuf); +cifs_dbg (NOISY ,"Max buf = %d\n" , ses->server->max_buf); server->capabilities =le32_to_cpu (pSMBr->Capabilities); - server->timeAdj = (int )(__s16 )le16_to_cpu (pSMBr->ServerTimeZone); - server->timeAdj *=60 ; + server->time_adjust = (int )(__s16 )le16_to_cpu (pSMBr->ServerTimeZone); + server->time_adjust *=60 ;if (pSMBr->EncryptionKeyLength ==CIFS_CRYPTO_KEY_SIZE ) { server->negflavor =CIFS_NEGFLAVOR_UNENCAP ;@@ -684,7 +684,7 @@ cifs_echo_callback(struct mid_q_entry *mid)struct cifs_server_info *server = mid->callback_data;struct cifs_credits credits = { .value =1 , .instance =0 }; -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid);add_credits (server, &credits,CIFS_ECHO_OP ); }@@ -1607,7 +1607,7 @@ cifs_readv_callback(struct mid_q_entry *mid) }queue_work (cifsiod_wq, &rdata->work); -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid);add_credits (server, &credits,0 ); }@@ -1849,7 +1849,7 @@ CIFSSMBWrite(const unsigned int xid, struct cifs_io_parms *io_parms,if (tcon->ses->capabilities &CAP_LARGE_WRITE_X ) { bytes_sent = min_t(const unsigned int, CIFSMaxBufSize, count); }else { - bytes_sent = (tcon->ses->server->maxBuf -MAX_CIFS_HDR_SIZE ) + bytes_sent = (tcon->ses->server->max_buf -MAX_CIFS_HDR_SIZE ) & ~0xFF ; }@@ -2132,7 +2132,7 @@ cifs_writev_callback(struct mid_q_entry *mid) }queue_work (cifsiod_wq, &wdata->work); -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid);add_credits (tcon->ses->server, &credits,0 ); }fs/cifs/connect.c +42
-42@@ -186,7 +186,7 @@ static void cifs_resolve_server(struct work_struct *work) }/* -* Update the tcpStatus for the server. +* Update the status for the server. * This is used to signal the cifsd thread to call cifs_reconnect * ONLY cifsd thread should call cifs_reconnect. For any other * thread, use this function @@ -207,7 +207,7 @@ cifs_signal_cifsd_for_reconnect(struct cifs_server_info *server,spin_lock (&g_servers_lock);if (!all_channels) { - pserver->tcpStatus = CifsNeedReconnect; + pserver->status = CifsNeedReconnect;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->tcpStatus = CifsNeedReconnect; + ses->chans[i].server->status = CifsNeedReconnect;spin_unlock (&ses->chan_lock); }spin_unlock (&g_servers_lock);@@ -298,7 +298,7 @@ cifs_abort_connection(struct cifs_server_info *server)struct mid_q_entry *mid, *nmid;struct list_head retry_list; - server->maxBuf =0 ; + server->max_buf =0 ; server->max_read =0 ;/* do not want to be sending data on a socket we are freeing */ @@ -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->tcpStatus == CifsExiting) { +if (server->status == CifsExiting) {/* the demux thread will exit normally next time through the loop */ spin_unlock (&g_servers_lock);wake_up (&server->response_q);@@ -360,9 +360,9 @@ 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->CurrentMid, server->conn_id, +trace_smb3_reconnect (server->current_mid, server->conn_id, server->hostname); - server->tcpStatus = CifsNeedReconnect; + server->status = CifsNeedReconnect;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->tcpStatus != CifsExiting) - server->tcpStatus = CifsNeedNegotiate; +if (server->status != CifsExiting) + server->status = CifsNeedNegotiate;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->tcpStatus == CifsNeedReconnect); + }while (server->status == CifsNeedReconnect);spin_lock (&g_servers_lock); -if (server->tcpStatus == CifsNeedNegotiate) +if (server->status == CifsNeedNegotiate)mod_delayed_work (cifsiod_wq, &server->echo,0 );spin_unlock (&g_servers_lock);@@ -542,13 +542,13 @@ static int reconnect_dfs_server(struct cifs_server_info *server)atomic_inc (&g_server_reconnect_count);set_credits (server,1 );spin_lock (&g_servers_lock); -if (server->tcpStatus != CifsExiting) - server->tcpStatus = CifsNeedNegotiate; +if (server->status != CifsExiting) + server->status = CifsNeedNegotiate;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->tcpStatus == CifsNeedReconnect); + }while (server->status == CifsNeedReconnect);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->tcpStatus == CifsNeedNegotiate) +if (server->status == CifsNeedNegotiate)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->tcpStatus == CifsNeedReconnect || - server->tcpStatus == CifsExiting || - server->tcpStatus == CifsNew || +if (server->status == CifsNeedReconnect || + server->status == CifsExiting || + server->status == CifsNew || (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->tcpStatus == CifsGood || - server->tcpStatus == CifsNeedNegotiate) && +if ((server->status == CifsGood || + server->status == CifsNeedNegotiate) && (!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->tcpStatus == CifsExiting) { +if (server->status == CifsExiting) {spin_unlock (&g_servers_lock);return -ESHUTDOWN ; } -if (server->tcpStatus == CifsNeedReconnect) { +if (server->status == CifsNeedReconnect) {spin_unlock (&g_servers_lock);cifs_reconnect (server, false);return -ECONNABORTED ;@@ -744,7 +744,7 @@ cifs_readv_from_socket(struct cifs_server_info *server, struct msghdr *smb_msg) length == -EINTR) {/* * Minimum sleep to prevent looping, allowing socket -* to clear and app threads to set tcpStatus +* to clear and app threads to set status * CifsNeedReconnect if server hung. */ usleep_range (1000 ,2000 );@@ -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->tcpStatus = CifsExiting; + server->status = CifsExiting;spin_unlock (&g_servers_lock);wake_up_all (&server->response_q);@@ -1091,7 +1091,7 @@ smb2_add_credits_from_hdr(char *buffer, struct cifs_server_info *server)spin_unlock (&server->req_lock);wake_up (&server->request_q); -trace_smb3_hdr_credits (server->CurrentMid, +trace_smb3_hdr_credits (server->current_mid, server->conn_id, server->hostname, scredits,le16_to_cpu (shdr->CreditRequest), in_flight); cifs_server_dbg(FYI, "%s: added %u credits total=%d\n",@@ -1123,7 +1123,7 @@ cifs_demultiplex_thread(void *p)set_freezable ();allow_kernel_signal (SIGKILL ); -while (server->tcpStatus != CifsExiting) { +while (server->status != CifsExiting) {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->tcpStatus = CifsExiting; + server->status = CifsExiting;spin_unlock (&g_servers_lock);cifs_crypto_secmech_release (server);@@ -1603,7 +1603,7 @@ cifs_get_server(struct smb3_fs_context *ctx,mutex_init (&server->_srv_mutex);memcpy (server->workstation_RFC1001_name, ctx->source_rfc1001_name,RFC1001_NAME_LEN_WITH_NULL ); -memcpy (server->server_RFC1001_name, +memcpy (server->server_rfc1001_name, ctx->target_rfc1001_name,RFC1001_NAME_LEN_WITH_NULL ); server->session_estab = false; server->sequence_number =0 ;@@ -1632,9 +1632,9 @@ cifs_get_server(struct smb3_fs_context *ctx,/* * at this point we are the only ones with the pointer * to the struct since the kernel thread not created yet -* no need to spinlock this init of tcpStatus or srv_count +* no need to spinlock this init of status or srv_count */ - server->tcpStatus = CifsNew; + server->status = CifsNew; ++server->srv_count; if (ctx->echo_interval >= SMB_ECHO_INTERVAL_MIN &&@@ -1682,10 +1682,10 @@ cifs_get_server(struct smb3_fs_context *ctx,/* * at this point we are the only ones with the pointer * to the struct since the kernel thread not created yet -* no need to spinlock this update of tcpStatus +* no need to spinlock this update of status */ spin_lock (&g_servers_lock); - server->tcpStatus = CifsNeedNegotiate; + server->status = CifsNeedNegotiate;spin_unlock (&g_servers_lock);if ((ctx->max_credits <20 ) || (ctx->max_credits >60000 ))@@ -2767,10 +2767,10 @@ ip_rfc1001_connect(struct cifs_server_info *server)if (ses_init_buf) { ses_init_buf->trailer.session_req.called_len =32 ; -if (server->server_RFC1001_name[0 ] !=0 ) +if (server->server_rfc1001_name[0 ] !=0 )rfc1002mangle (ses_init_buf->trailer. session_req.called_name, - server->server_RFC1001_name, + server->server_rfc1001_name,RFC1001_NAME_LEN_WITH_NULL );else rfc1002mangle(ses_init_buf->trailer.@@ -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->tcpStatus == CifsNeedReconnect) && +if ((tcon->ses->server->status == CifsNeedReconnect) && (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->tcpStatus != CifsNeedNegotiate) { + server->status != CifsNeedNegotiate) {spin_unlock (&g_servers_lock);return 0 ; } - server->tcpStatus = CifsInNegotiate; + server->status = CifsInNegotiate;spin_unlock (&g_servers_lock); rc = server->ops->negotiate (xid, ses, server);if (rc ==0 ) {spin_lock (&g_servers_lock); -if (server->tcpStatus == CifsInNegotiate) - server->tcpStatus = CifsGood; +if (server->status == CifsInNegotiate) + server->status = CifsGood;else rc = -EHOSTDOWN ;spin_unlock (&g_servers_lock); }else {spin_lock (&g_servers_lock); -if (server->tcpStatus == CifsInNegotiate) - server->tcpStatus = CifsNeedNegotiate; +if (server->status == CifsInNegotiate) + server->status = CifsNeedNegotiate;spin_unlock (&g_servers_lock); }@@ -4067,7 +4067,7 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses, }cifs_dbg (FYI ,"Security Mode: 0x%x Capabilities: 0x%x TimeAdjust: %d\n" , - server->sec_mode, server->capabilities, server->timeAdj); + server->sec_mode, server->capabilities, server->time_adjust);if (server->ops->sess_setup) rc = server->ops->sess_setup (xid, ses, server, nls_info);fs/cifs/file.c +4
-4@@ -1267,10 +1267,10 @@ cifs_push_mandatory_locks(struct cifs_file_info *cfile) tcon =tlink_tcon (cfile->tlink);/* -* Accessing maxBuf is racy with cifs_reconnect - need to store value +* Accessing max_buf is racy with cifs_reconnect - need to store value * and check it before using. */ - max_buf = tcon->ses->server->maxBuf; + max_buf = tcon->ses->server->max_buf;if (max_buf < (sizeof (struct smb_hdr ) +sizeof (LOCKING_ANDX_RANGE ))) {free_xid (xid);return -EINVAL ;@@ -1611,10 +1611,10 @@ cifs_unlock_range(struct cifs_file_info *cfile, struct file_lock *flock,INIT_LIST_HEAD (&tmp_llist);/* -* Accessing maxBuf is racy with cifs_reconnect - need to store value +* Accessing max_buf is racy with cifs_reconnect - need to store value * and check it before using. */ - max_buf = tcon->ses->server->maxBuf; + max_buf = tcon->ses->server->max_buf;if (max_buf < (sizeof (struct smb_hdr ) +sizeof (LOCKING_ANDX_RANGE )))return -EINVAL ;fs/cifs/inode.c +4
-4@@ -613,8 +613,8 @@ smb311_posix_info_to_fattr(struct cifs_fattr *fattr, struct smb311_posix_qinfo * fattr->cf_mtime =cifs_NTtimeToUnix (info->LastWriteTime);if (adjust_tz) { - fattr->cf_ctime.tv_sec += tcon->ses->server->timeAdj; - fattr->cf_mtime.tv_sec += tcon->ses->server->timeAdj; + fattr->cf_ctime.tv_sec += tcon->ses->server->time_adjust; + fattr->cf_mtime.tv_sec += tcon->ses->server->time_adjust; } fattr->cf_eof =le64_to_cpu (info->EndOfFile);@@ -669,8 +669,8 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, fattr->cf_mtime =cifs_NTtimeToUnix (info->LastWriteTime);if (adjust_tz) { - fattr->cf_ctime.tv_sec += tcon->ses->server->timeAdj; - fattr->cf_mtime.tv_sec += tcon->ses->server->timeAdj; + fattr->cf_ctime.tv_sec += tcon->ses->server->time_adjust; + fattr->cf_mtime.tv_sec += tcon->ses->server->time_adjust; } fattr->cf_eof =le64_to_cpu (info->EndOfFile);fs/cifs/readdir.c +1
-1@@ -318,7 +318,7 @@ static void cifs_std_info_to_fattr(struct cifs_fattr *fattr, FIND_FILE_STANDARD_INFO *info, struct cifs_sb_info *cifs_sb) { - int offset = cifs_sb_master_tcon(cifs_sb)->ses->server->timeAdj; + int offset = cifs_sb_master_tcon(cifs_sb)->ses->server->time_adjust;memset (fattr,0 ,sizeof (*fattr)); fattr->cf_atime = cnvrtDosUnixTm(info->LastAccessDate,fs/cifs/sess.c +1
-1@@ -514,7 +514,7 @@ static __u32 cifs_ssetup_hdr(struct cifs_ses *ses, pSMB->req.MaxBufferSize =cpu_to_le16 (min_t (u32, CIFSMaxBufSize +MAX_CIFS_HDR_SIZE -4 ,USHRT_MAX )); - pSMB->req.MaxMpxCount =cpu_to_le16 (server->maxReq); + pSMB->req.MaxMpxCount =cpu_to_le16 (server->max_req); pSMB->req.VcNumber =cpu_to_le16 (1 );/* Now no need to set SMBFLG_CASELESS or obsolete CANONICAL PATH */ fs/cifs/smb1ops.c +6
-6@@ -169,7 +169,7 @@ cifs_get_next_mid(struct cifs_server_info *server)spin_lock (&g_mid_lock);/* mid is 16 bit only for CIFS/SMB */ - cur_mid = (__u16)((server->CurrentMid) &0xffff ); + cur_mid = (__u16)((server->current_mid) &0xffff );/* we do not want to loop forever */ last_mid = cur_mid; cur_mid++;@@ -220,7 +220,7 @@ cifs_get_next_mid(struct cifs_server_info *server)if (!collision) { mid = (__u64 )cur_mid; - server->CurrentMid = mid; + server->current_mid = mid;break ; } cur_mid++;@@ -416,7 +416,7 @@ cifs_check_trans2(struct mid_q_entry *mid, struct cifs_server_info *server,static bool cifs_need_neg (struct cifs_server_info *server) { -return server->maxBuf ==0 ; +return server->max_buf ==0 ; } static int@@ -463,7 +463,7 @@ cifs_negotiate_wsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)if (!(server->capabilities &CAP_LARGE_WRITE_X ) || (!(server->capabilities &CAP_UNIX ) && server->sign)) wsize = min_t(unsigned int, wsize, - server->maxBuf -sizeof (WRITE_REQ ) +4 ); + server->max_buf -sizeof (WRITE_REQ ) +4 );/* hard limit of CIFS_MAX_WSIZE */ wsize = min_t(unsigned int, wsize, CIFS_MAX_WSIZE);@@ -495,7 +495,7 @@ cifs_negotiate_rsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)else if (server->capabilities &CAP_LARGE_READ_X ) defsize =CIFS_DEFAULT_NON_POSIX_RSIZE ;else - defsize = server->maxBuf -sizeof (READ_RSP ); + defsize = server->max_buf -sizeof (READ_RSP ); rsize = ctx->rsize ? ctx->rsize : defsize;@@ -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->tcpStatus == CifsGood) +if (server->status == CifsGood)return true;return false;fs/cifs/smb2file.c +4
-4@@ -116,10 +116,10 @@ smb2_unlock_range(struct cifs_file_info *cfile, struct file_lock *flock,INIT_LIST_HEAD (&tmp_llist);/* -* Accessing maxBuf is racy with cifs_reconnect - need to store value +* Accessing max_buf is racy with cifs_reconnect - need to store value * and check it before using. */ - max_buf = tcon->ses->server->maxBuf; + max_buf = tcon->ses->server->max_buf;if (max_buf <sizeof (struct smb2_lock_element ))return -EINVAL ;@@ -257,10 +257,10 @@ smb2_push_mandatory_locks(struct cifs_file_info *cfile) xid =get_xid ();/* -* Accessing maxBuf is racy with cifs_reconnect - need to store value +* Accessing max_buf is racy with cifs_reconnect - need to store value * and check it for zero before using. */ - max_buf =tlink_tcon (cfile->tlink)->ses->server->maxBuf; + max_buf =tlink_tcon (cfile->tlink)->ses->server->max_buf;if (max_buf <sizeof (struct smb2_lock_element )) {free_xid (xid);return -EINVAL ;fs/cifs/smb2ops.c +18
-18@@ -86,7 +86,7 @@ smb2_add_credits(struct cifs_server_info *server,if (*val >65000 ) { *val =65000 ;/* Don't get near 64K credits, avoid srv bugs */ pr_warn_once ("server overflowed SMB3 credits\n" ); -trace_smb3_overflow_credits (server->CurrentMid, +trace_smb3_overflow_credits (server->current_mid, server->conn_id, server->hostname, *val, add, server->in_flight); }@@ -112,7 +112,7 @@ smb2_add_credits(struct cifs_server_info *server,wake_up (&server->request_q);if (reconnect_detected) { -trace_smb3_reconnect_detected (server->CurrentMid, +trace_smb3_reconnect_detected (server->current_mid, server->conn_id, server->hostname, scredits, add, in_flight); cifs_dbg(FYI, "trying to put %d credits from the old server instance %d\n",@@ -120,15 +120,15 @@ smb2_add_credits(struct cifs_server_info *server, }if (reconnect_with_invalid_credits) { -trace_smb3_reconnect_with_invalid_credits (server->CurrentMid, +trace_smb3_reconnect_with_invalid_credits (server->current_mid, server->conn_id, server->hostname, scredits, add, in_flight);cifs_dbg (FYI ,"Negotiate operation when server credits is non-zero. Optype: %d, server credits: %d, credits added: %d\n" , optype, scredits, add); }spin_lock (&g_servers_lock); -if (server->tcpStatus == CifsNeedReconnect - || server->tcpStatus == CifsExiting) { +if (server->status == CifsNeedReconnect + || server->status == CifsExiting) {spin_unlock (&g_servers_lock);return ; }@@ -152,7 +152,7 @@ smb2_add_credits(struct cifs_server_info *server,break ; } -trace_smb3_add_credits (server->CurrentMid, +trace_smb3_add_credits (server->current_mid, server->conn_id, server->hostname, scredits, add, in_flight);cifs_dbg (FYI ,"%s: added %u credits total=%d\n" , __func__, add, scredits); }@@ -170,7 +170,7 @@ smb2_set_credits(struct cifs_server_info *server, const int val) in_flight = server->in_flight;spin_unlock (&server->req_lock); -trace_smb3_set_credits (server->CurrentMid, +trace_smb3_set_credits (server->current_mid, server->conn_id, server->hostname, scredits, val, in_flight);cifs_dbg (FYI ,"%s: set %u credits\n" , __func__, val);@@ -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->tcpStatus == CifsExiting) { +if (server->status == CifsExiting) {spin_unlock (&g_servers_lock);return -ENOENT ; }@@ -254,7 +254,7 @@ smb2_wait_mtu_credits(struct cifs_server_info *server, unsigned int size, in_flight = server->in_flight;spin_unlock (&server->req_lock); -trace_smb3_wait_credits (server->CurrentMid, +trace_smb3_wait_credits (server->current_mid, server->conn_id, server->hostname, scredits, -(credits->value), in_flight);cifs_dbg (FYI ,"%s: removed %u credits total=%d\n" , __func__, credits->value, scredits);@@ -274,7 +274,7 @@ smb2_adjust_credits(struct cifs_server_info *server,return 0 ;if (credits->value < new_val) { -trace_smb3_too_many_credits (server->CurrentMid, +trace_smb3_too_many_credits (server->current_mid, server->conn_id, server->hostname,0 , credits->value - new_val,0 );cifs_server_dbg (VFS ,"request has less credits (%d) than required (%d)" , credits->value, new_val);@@ -289,7 +289,7 @@ smb2_adjust_credits(struct cifs_server_info *server, in_flight = server->in_flight;spin_unlock (&server->req_lock); -trace_smb3_reconnect_detected (server->CurrentMid, +trace_smb3_reconnect_detected (server->current_mid, server->conn_id, server->hostname, scredits, credits->value - new_val, in_flight); cifs_server_dbg(VFS, "trying to return %d credits to old session\n",@@ -303,7 +303,7 @@ smb2_adjust_credits(struct cifs_server_info *server,spin_unlock (&server->req_lock);wake_up (&server->request_q); -trace_smb3_adj_credits (server->CurrentMid, +trace_smb3_adj_credits (server->current_mid, server->conn_id, server->hostname, scredits, credits->value - new_val, in_flight); cifs_dbg(FYI, "%s: adjust added %u credits total=%d\n",@@ -320,7 +320,7 @@ smb2_get_next_mid(struct cifs_server_info *server)__u64 mid;/* for SMB2 we need the current value */ spin_lock (&g_mid_lock); - mid = server->CurrentMid++; + mid = server->current_mid++;spin_unlock (&g_mid_lock);return mid; }@@ -329,8 +329,8 @@ static void smb2_revert_current_mid(struct cifs_server_info *server, const unsigned int val) { spin_lock(&g_mid_lock); -if (server->CurrentMid >= val) - server->CurrentMid -= val; +if (server->current_mid >= val) + server->current_mid -= val;spin_unlock (&g_mid_lock); }@@ -404,7 +404,7 @@ smb2_negotiate(const unsigned int xid,int rc;spin_lock (&g_mid_lock); - server->CurrentMid =0 ; + server->current_mid =0 ;spin_unlock (&g_mid_lock); rc =SMB2_negotiate (xid, ses, server);/* BB we probably don't need to retry with modern servers */ @@ -2532,7 +2532,7 @@ smb2_is_status_pending(char *buf, struct cifs_server_info *server)spin_unlock (&server->req_lock);wake_up (&server->request_q); -trace_smb3_pend_credits (server->CurrentMid, +trace_smb3_pend_credits (server->current_mid, server->conn_id, server->hostname, scredits,le16_to_cpu (shdr->CreditRequest), in_flight); cifs_dbg(FYI, "%s: status pending add %u credits total=%d\n",@@ -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->tcpStatus == CifsNeedReconnect) { +if (dw->server->status == CifsNeedReconnect) { mid->mid_state =MID_RETRY_NEEDED ;spin_unlock (&g_mid_lock);spin_unlock (&g_servers_lock);fs/cifs/smb2pdu.c +10
-10@@ -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->tcpStatus == CifsNeedReconnect) { +while (server->status == CifsNeedReconnect) {/* * 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->tcpStatus != CifsNeedReconnect), + (server->status != CifsNeedReconnect),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->tcpStatus != CifsNeedReconnect) { +if (server->status != CifsNeedReconnect) {spin_unlock (&g_servers_lock);break ; }@@ -254,10 +254,10 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,/* * Recheck after acquire mutex. If another thread is negotiating * and the server never sends an answer the socket will be closed -* and tcpStatus set to reconnect. +* and status set to reconnect. */ spin_lock (&g_servers_lock); -if (server->tcpStatus == CifsNeedReconnect) { +if (server->status == CifsNeedReconnect) {spin_unlock (&g_servers_lock); rc = -EHOSTDOWN ; goto out;@@ -1032,7 +1032,7 @@ SMB2_negotiate(const unsigned int xid,/* SMB2 only has an extended negflavor */ server->negflavor =CIFS_NEGFLAVOR_EXTENDED ;/* set it to the maximum buffer size value we can send with 1 credit */ - server->maxBuf = min_t(unsigned int, le32_to_cpu(rsp->MaxTransactSize), + server->max_buf = min_t(unsigned int, le32_to_cpu(rsp->MaxTransactSize),SMB2_MAX_BUFFER_SIZE ); server->max_read =le32_to_cpu (rsp->MaxReadSize); server->max_write =le32_to_cpu (rsp->MaxWriteSize);@@ -3776,7 +3776,7 @@ smb2_echo_callback(struct mid_q_entry *mid) credits.instance = server->reconnect_instance; } -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid);add_credits (server, &credits,CIFS_ECHO_OP ); }@@ -4201,7 +4201,7 @@ smb2_readv_callback(struct mid_q_entry *mid) rdata->offset, rdata->got_bytes);queue_work (cifsiod_wq, &rdata->work); -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid);add_credits (server, &credits,0 ); }@@ -4440,7 +4440,7 @@ smb2_writev_callback(struct mid_q_entry *mid) wdata->offset, wdata->bytes);queue_work (cifsiod_wq, &wdata->work); -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid);add_credits (server, &credits,0 ); }@@ -4874,7 +4874,7 @@ int SMB2_query_directory_init(const unsigned int xid,* BB could be 30 bytes or so longer if we used SMB2 specific * buffer lengths, but this is safe and close enough. */ - output_size = min_t(unsigned int, output_size, server->maxBuf); + output_size = min_t(unsigned int, output_size, server->max_buf); output_size = min_t(unsigned int, output_size, 2 << 15); req->OutputBufferLength =cpu_to_le32 (output_size);fs/cifs/smb2transport.c +5
-5@@ -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->tcpStatus == CifsExiting) { +if (server->status == CifsExiting) {spin_unlock (&g_servers_lock);return -ENOENT ; } -if (server->tcpStatus == CifsNeedReconnect) { +if (server->status == CifsNeedReconnect) {spin_unlock (&g_servers_lock);cifs_dbg (FYI ,"tcp session dead - return to caller to retry\n" );return -EAGAIN ; } -if (server->tcpStatus == CifsNeedNegotiate && +if (server->status == CifsNeedNegotiate && 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->tcpStatus == CifsNeedNegotiate && +if (server->status == CifsNeedNegotiate && shdr->Command !=SMB2_NEGOTIATE ) {spin_unlock (&g_servers_lock);return ERR_PTR (-EAGAIN );@@ -888,7 +888,7 @@ smb2_setup_async_request(struct cifs_server_info *server, struct smb_rqst *rqst) rc =smb2_sign_rqst (rqst, server);if (rc) {revert_current_mid_from_hdr (server, shdr); -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid);return ERR_PTR (rc); }fs/cifs/transport.c +27
-28@@ -38,12 +38,12 @@ cifs_wake_up_task(struct mid_q_entry *mid) }struct mid_q_entry * -AllocMidQEntry (const struct smb_hdr *smb_buffer,struct cifs_server_info *server) +cifs_alloc_mid_q_entry (const struct smb_hdr *smb_buffer,struct cifs_server_info *server) {struct mid_q_entry *temp;if (server ==NULL ) { -cifs_dbg (VFS ,"Null TCP session in AllocMidQEntry\n" ); +cifs_dbg (VFS ,"Null TCP session in cifs_alloc_mid_q_entry\n" );return NULL ; }@@ -159,7 +159,7 @@ void cifs_mid_q_entry_release(struct mid_q_entry *midEntry)spin_unlock (&g_mid_lock); } -void DeleteMidQEntry (struct mid_q_entry *midEntry) +void cifs_delete_mid_q_entry (struct mid_q_entry *midEntry) {cifs_mid_q_entry_release (midEntry); }@@ -174,7 +174,7 @@ cifs_delete_mid(struct mid_q_entry *mid) }spin_unlock (&g_mid_lock); -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid); }/* @@ -431,7 +431,7 @@ __smb_send_rqst(struct cifs_server_info *server, int num_rqst,* socket so the server throws away the partial SMB */ cifs_signal_cifsd_for_reconnect (server, false); -trace_smb3_partial_send_reconnect (server->CurrentMid, +trace_smb3_partial_send_reconnect (server->current_mid, server->conn_id, server->hostname); } smbd_done:@@ -541,7 +541,7 @@ wait_for_free_credits(struct cifs_server_info *server, const int num_credits, in_flight = server->in_flight;spin_unlock (&server->req_lock); -trace_smb3_nblk_credits (server->CurrentMid, +trace_smb3_nblk_credits (server->current_mid, server->conn_id, server->hostname, scredits,-1 , in_flight);cifs_dbg (FYI ,"%s: remove %u credits total=%d\n" , __func__,1 , scredits);@@ -564,7 +564,7 @@ wait_for_free_credits(struct cifs_server_info *server, const int num_credits, in_flight = server->in_flight;spin_unlock (&server->req_lock); -trace_smb3_credit_timeout (server->CurrentMid, +trace_smb3_credit_timeout (server->current_mid, server->conn_id, server->hostname, scredits, num_credits, in_flight); cifs_server_dbg(VFS, "wait timed out after %d ms\n",@@ -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->tcpStatus == CifsExiting) { +if (server->status == CifsExiting) {spin_unlock (&g_servers_lock);return -ENOENT ; }@@ -617,7 +617,7 @@ wait_for_free_credits(struct cifs_server_info *server, const int num_credits,spin_unlock (&server->req_lock);trace_smb3_credit_timeout ( - server->CurrentMid, + server->current_mid, server->conn_id, server->hostname, scredits, num_credits, in_flight); cifs_server_dbg(VFS, "wait timed out after %d ms\n",@@ -647,7 +647,7 @@ wait_for_free_credits(struct cifs_server_info *server, const int num_credits, in_flight = server->in_flight;spin_unlock (&server->req_lock); -trace_smb3_waitff_credits (server->CurrentMid, +trace_smb3_waitff_credits (server->current_mid, server->conn_id, server->hostname, scredits, -(num_credits), in_flight); cifs_dbg(FYI, "%s: remove %u credits total=%d\n",@@ -698,7 +698,7 @@ wait_for_compound_request(struct cifs_server_info *server, int num,*/ if (server->in_flight ==0 ) {spin_unlock (&server->req_lock); -trace_smb3_insufficient_credits (server->CurrentMid, +trace_smb3_insufficient_credits (server->current_mid, server->conn_id, server->hostname, scredits, num, in_flight); cifs_dbg(FYI, "%s: %d requests in flight, needed %d total=%d\n",@@ -745,7 +745,7 @@ static int allocate_mid(struct cifs_ses *ses, struct smb_hdr *in_buf, }spin_unlock (&g_servers_lock); - *ppmidQ =AllocMidQEntry (in_buf, ses->server); + *ppmidQ =cifs_alloc_mid_q_entry (in_buf, ses->server);if (*ppmidQ ==NULL )return -ENOMEM ;spin_lock (&g_mid_lock);@@ -782,13 +782,13 @@ cifs_setup_async_request(struct cifs_server_info *server, struct smb_rqst *rqst)if (server->sign) hdr->Flags2 |=SMBFLG2_SECURITY_SIGNATURE ; - mid =AllocMidQEntry (hdr, server); + mid =cifs_alloc_mid_q_entry (hdr, server);if (mid ==NULL )return ERR_PTR (-ENOMEM ); rc =cifs_sign_rqst (rqst, server, &mid->sequence_number);if (rc) { -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid);return ERR_PTR (rc); }@@ -937,7 +937,7 @@ cifs_sync_mid_result(struct mid_q_entry *mid, struct cifs_server_info *server) }spin_unlock (&g_mid_lock); -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid);return rc; }@@ -1026,7 +1026,7 @@ static void cifs_cancelled_callback(struct mid_q_entry *mid) {cifs_compound_callback (mid); -DeleteMidQEntry (mid); +cifs_delete_mid_q_entry (mid); }/* @@ -1079,7 +1079,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, }spin_lock (&g_servers_lock); -if (server->tcpStatus == CifsExiting) { +if (server->status == CifsExiting) {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->tcpStatus == CifsExiting) { +if (server->status == CifsExiting) {spin_unlock (&g_servers_lock);return -ENOENT ; }@@ -1369,7 +1369,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses,/* Ensure that we do not send more than 50 overlapping requests to the same server. We may make this configurable later or -use ses->maxReq */ +use ses->max_req */ if (len > CIFSMaxBufSize +MAX_CIFS_HDR_SIZE -4 ) { cifs_server_dbg(VFS, "Invalid length, greater than maximum frame, %d\n",@@ -1422,7 +1422,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses,spin_lock (&g_mid_lock);if (midQ->mid_state ==MID_REQUEST_SUBMITTED ) {/* no longer considered to be "in-flight" */ - midQ->callback = DeleteMidQEntry; + midQ->callback = cifs_delete_mid_q_entry;spin_unlock (&g_mid_lock);add_credits (server, &credits,0 );return rc;@@ -1506,7 +1506,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon, }spin_lock (&g_servers_lock); -if (server->tcpStatus == CifsExiting) { +if (server->status == CifsExiting) {spin_unlock (&g_servers_lock);return -ENOENT ; }@@ -1514,7 +1514,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,/* Ensure that we do not send more than 50 overlapping requests to the same server. We may make this configurable later or -use ses->maxReq */ +use ses->max_req */ if (len > CIFSMaxBufSize +MAX_CIFS_HDR_SIZE -4 ) { cifs_tcon_dbg(VFS, "Invalid length, greater than maximum frame, %d\n",@@ -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->tcpStatus != CifsGood) && - (server->tcpStatus != CifsNew))); + ((server->status != CifsGood) && + (server->status != CifsNew)));/* Were we interrupted by a signal ? */ spin_lock (&g_servers_lock);if ((rc == -ERESTARTSYS ) && (midQ->mid_state ==MID_REQUEST_SUBMITTED ) && - ((server->tcpStatus == CifsGood) || - (server->tcpStatus == CifsNew))) { + ((server->status == CifsGood) || + (server->status == CifsNew))) {spin_unlock (&g_servers_lock);if (in_buf->Command ==SMB_COM_TRANSACTION2 ) {@@ -1603,7 +1603,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,spin_lock (&g_mid_lock);if (midQ->mid_state ==MID_REQUEST_SUBMITTED ) {/* no longer considered to be "in-flight" */ - midQ->callback = DeleteMidQEntry; + midQ->callback = cifs_delete_mid_q_entry;spin_unlock (&g_mid_lock);return rc; } --2.35.3
Signature · 3 lines
Thanks, Steve
Re: [RFC PATCH v2 05/10] cifs: convert server info vars to snake_case
Quoted 10 lines · Enzo Matsumiya
Quoted 7 lines · Steve French
I doubt that renaming tcpStatus to "status" helps much. If it has to do with the socket, included tcp or socket or connection in the name seems plausible/helpful. I don't mind removing the came cause (e.g. "
tcp_status" or something similar) but prefer other types of cleanup to be the focus (moving smb1 code out of mixed smb1/smb2/smb3 c files into smb1 specific ones that are compiled out when legacy is disabled etc.
Quoted 5 lines
Steve, the way I see it is, if we have a struct names "
server_info" or similar, there's no need to include a prefix in its fields' names, especially when there's only one "status" variable for that struct (which should always be the case), e.g. "server->server_status" looks ugly and one might assume that "server" holds another different status,
That point makes sense - but these kind of renames are lower priority than getting the features/bugfixes cleaned up for the merge window.
Lots of interesting things to work on relating to multichannel, leases, compression support, signing negotation (helps perf), fixing the swapfile feature, sparse file improvements, more testing of posix extensions etc.
Re: [RFC PATCH v2 05/10] cifs: convert server info vars to snake_case
Quoted 17 lines · Steve French
Quoted 10 lines · Enzo Matsumiya
Quoted 7 lines · Steve French
I doubt that renaming tcpStatus to "status" helps much. If it has to do with the socket, included tcp or socket or connection in the name seems plausible/helpful. I don't mind removing the came cause (e.g. "
tcp_status" or something similar) but prefer other types of cleanup to be the focus (moving smb1 code out of mixed smb1/smb2/smb3 c files into smb1 specific ones that are compiled out when legacy is disabled etc.Quoted 5 lines
Steve, the way I see it is, if we have a struct names "
server_info" or similar, there's no need to include a prefix in its fields' names, especially when there's only one "status" variable for that struct (which should always be the case), e.g. "server->server_status" looks ugly and one might assume that "server" holds another different status,
Quoted 7 lines
That point makes sense - but these kind of renames are lower priority than getting the features/bugfixes cleaned up for the merge window.
Lots of interesting things to work on relating to multichannel, leases, compression support, signing negotation (helps perf), fixing the swapfile feature, sparse file improvements, more testing of posix extensions etc.
I understand that, my changes were more to "lay the ground" for such fixes/features :) also, sent as RFC because I don't think this is for this merge window.
RFC PATCH v2 6/10 cifs: change status and security types enums to constants
In reply to Enzo MatsumiyaChange server, tcon, and session status, and security types enums to constants integers.
Since some of the status values were common between server, tcon, and session, define a "generic" status code instead of having specific enums for each data structure.
--- fs/cifs/cifs_debug.c | 4 +- fs/cifs/cifs_swn.c | 8 +-- fs/cifs/cifsencrypt.c | 2 +- fs/cifs/cifsfs.c | 14 ++-- fs/cifs/cifsglob.h | 82 +++++++++-------------- fs/cifs/cifsproto.h | 6 +- fs/cifs/cifssmb.c | 26 ++++---- fs/cifs/connect.c | 144 ++++++++++++++++++++-------------------- fs/cifs/fs_context.c | 8 +-- fs/cifs/fs_context.h | 2 +- fs/cifs/misc.c | 4 +- fs/cifs/sess.c | 32 ++++----- fs/cifs/smb1ops.c | 2 +- fs/cifs/smb2ops.c | 8 +-- fs/cifs/smb2pdu.c | 44 ++++++------ fs/cifs/smb2proto.h | 4 +- fs/cifs/smb2transport.c | 12 ++-- fs/cifs/transport.c | 24 +++---- 18 files changed, 203 insertions(+), 223 deletions(-)
fs/cifs/cifs_debug.c +2 -2
@@ -382,7 +382,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v) (ses->serverNOS == NULL)) {seq_printf (m,"\n\t%d) Address: %s Uses: %d Capability: 0x%x\tSession Status: %d " , i, ses->ip_addr, ses->ses_count, - ses->capabilities, ses->ses_status); + ses->capabilities, ses->status);if (ses->session_flags &SMB2_SESSION_FLAG_IS_GUEST )seq_printf (m,"Guest " );else if (ses->session_flags &SMB2_SESSION_FLAG_IS_NULL )
@@ -394,7 +394,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)"\n\tSMB session status: %d " , i, ses->ip_addr, ses->serverDomain, ses->ses_count, ses->serverOS, ses->serverNOS, - ses->capabilities, ses->ses_status); + ses->capabilities, ses->status); } seq_printf(m, "\n\tSecurity type: %s ",
fs/cifs/cifs_swn.c +4 -4
@@ -77,7 +77,7 @@ static int cifs_swn_send_register_message(struct cifs_swn_reg *swnreg) {struct sk_buff *skb;struct genlmsghdr *hdr; -enum securityEnum authtype; +int authtype;struct sockaddr_storage *addr;int ret;
@@ -140,15 +140,15 @@ static int cifs_swn_send_register_message(struct cifs_swn_reg *swnreg) authtype =cifs_select_sectype (swnreg->tcon->ses->server, swnreg->tcon->ses->sectype);switch (authtype) { -case Kerberos: +case CIFS_SECTYPE_KERBEROS : ret =cifs_swn_auth_info_krb (swnreg->tcon, skb);if (ret <0 ) {cifs_dbg (VFS ,"%s: Failed to get kerberos auth info: %d\n" , __func__, ret); goto nlmsg_fail; }break ; -case NTLMv2: -case RawNTLMSSP: +case CIFS_SECTYPE_NTLMV2 : +case CIFS_SECTYPE_RAW_NTLMSSP : ret =cifs_swn_auth_info_ntlm (swnreg->tcon, skb);if (ret <0 ) {cifs_dbg (VFS ,"%s: Failed to get NTLM auth info: %d\n" , __func__, ret);
fs/cifs/cifsencrypt.c +1 -1
@@ -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 ==CIFS_STATUS_NEED_NEGOTIATE ) {spin_unlock (&g_servers_lock);return rc; }
fs/cifs/cifsfs.c +7 -7
@@ -449,7 +449,7 @@ cifs_show_address(struct seq_file *s, struct cifs_server_info *server)static void cifs_show_security (struct seq_file *s,struct cifs_ses *ses) { -if (ses->sectype == Unspecified) { +if (ses->sectype ==CIFS_SECTYPE_UNSPEC ) {if (ses->user_name ==NULL )seq_puts (s,",sec=none" );return ;
@@ -458,13 +458,13 @@ cifs_show_security(struct seq_file *s, struct cifs_ses *ses)seq_puts (s,",sec=" );switch (ses->sectype) { -case NTLMv2: +case CIFS_SECTYPE_NTLMV2 :seq_puts (s,"ntlmv2" );break ; -case Kerberos: +case CIFS_SECTYPE_KERBEROS :seq_puts (s,"krb5" );break ; -case RawNTLMSSP: +case CIFS_SECTYPE_RAW_NTLMSSP :seq_puts (s,"ntlmssp" );break ;default :
@@ -476,7 +476,7 @@ cifs_show_security(struct seq_file *s, struct cifs_ses *ses)if (ses->sign)seq_puts (s,"i" ); -if (ses->sectype == Kerberos) +if (ses->sectype ==CIFS_SECTYPE_KERBEROS )seq_printf (s,",cruid=%u" ,from_kuid_munged (&init_user_ns, ses->cred_uid)); }
@@ -712,14 +712,14 @@ static void cifs_umount_begin(struct super_block *sb) tcon =cifs_sb_master_tcon (cifs_sb);spin_lock (&g_servers_lock); -if ((tcon->tc_count >1 ) || (tcon->status ==TID_EXITING )) { +if ((tcon->tc_count >1 ) || (tcon->status ==CIFS_STATUS_EXITING )) {/* we have other mounts to same share or we have already tried to force umount this and woken up all waiting network requests, nothing to do */ spin_unlock (&g_servers_lock);return ; }else if (tcon->tc_count ==1 ) - tcon->status =TID_EXITING ; + tcon->status =CIFS_STATUS_EXITING ;spin_unlock (&g_servers_lock);/* cancel_brl_requests(tcon); */ /* BB mark all brl mids as exiting */
fs/cifs/cifsglob.h +32 -50
141 lines not on this page · raw message
fs/cifs/cifsproto.h +2 -4
@@ -168,8 +168,7 @@ extern void header_assemble(struct smb_hdr *, char /* command */ ,extern int small_smb_init_no_tc (const int smb_cmd,const int wct,struct cifs_ses *ses,void **request_buf); -extern enum securityEnum select_sectype (struct cifs_server_info *server, -enum securityEnum requested); +extern int select_sectype (struct cifs_server_info *server,int requested);extern int CIFS_SessSetup (const unsigned int xid,struct cifs_ses *ses,struct cifs_server_info *server,const struct nls_table *nls_cp);
@@ -594,8 +593,7 @@ int cifs_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,int __cifs_calc_signature (struct smb_rqst *rqst,struct cifs_server_info *server,char *signature,struct shash_desc *shash); -enum securityEnum cifs_select_sectype (struct cifs_server_info *, -enum securityEnum ); +int cifs_select_sectype (struct cifs_server_info *,int );struct cifs_aio_ctx *cifs_aio_ctx_alloc (void );void cifs_aio_ctx_release (struct kref *refcount);int setup_aio_ctx_iter (struct cifs_aio_ctx *ctx,struct iov_iter *iter,int rw);
fs/cifs/cifssmb.c +13 -13
@@ -75,11 +75,11 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon)/* only send once per connect */ spin_lock (&g_servers_lock); -if ((tcon->ses->ses_status !=SES_GOOD ) || (tcon->status !=TID_NEED_RECON )) { +if ((tcon->ses->status !=CIFS_STATUS_GOOD ) || (tcon->status !=CIFS_STATUS_NEED_RECONNECT )) {spin_unlock (&g_servers_lock);return ; } - tcon->status =TID_IN_FILES_INVALIDATE ; + tcon->status =CIFS_STATUS_IN_FILES_INVALIDATE ;spin_unlock (&g_servers_lock);/* list all files open on tree connection and mark them invalid */
@@ -99,8 +99,8 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon)mutex_unlock (&tcon->crfid.fid_mutex);spin_lock (&g_servers_lock); -if (tcon->status ==TID_IN_FILES_INVALIDATE ) - tcon->status =TID_NEED_TCON ; +if (tcon->status ==CIFS_STATUS_IN_FILES_INVALIDATE ) + tcon->status =CIFS_STATUS_NEED_TCON ;spin_unlock (&g_servers_lock);/*
@@ -135,7 +135,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)* have tcon) are allowed as we start force umount */ spin_lock (&g_servers_lock); -if (tcon->status ==TID_EXITING ) { +if (tcon->status ==CIFS_STATUS_EXITING ) {if (smb_command !=SMB_COM_WRITE_ANDX && smb_command !=SMB_COM_OPEN_ANDX && smb_command !=SMB_COM_TREE_DISCONNECT ) {
@@ -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 ==CIFS_STATUS_NEED_RECONNECT ) { rc =wait_event_interruptible_timeout (server->response_q, - (server->status != CifsNeedReconnect), + (server->status !=CIFS_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 !=CIFS_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 ==CIFS_STATUS_NEED_RECONNECT ) {spin_unlock (&g_servers_lock); rc = -EHOSTDOWN ; goto out;
@@ -504,13 +504,13 @@ cifs_enable_signing(struct cifs_server_info *server, bool mnt_sign_required) }static bool -should_set_ext_sec_flag (enum securityEnum sectype) +should_set_ext_sec_flag (int sectype) {switch (sectype) { -case RawNTLMSSP: -case Kerberos: +case CIFS_SECTYPE_RAW_NTLMSSP : +case CIFS_SECTYPE_KERBEROS :return true; -case Unspecified: +case CIFS_SECTYPE_UNSPEC :if (global_secflags & (CIFSSEC_MAY_KRB5 |CIFSSEC_MAY_NTLMSSP ))return true;
fs/cifs/connect.c +72 -72
421 lines not on this page · raw message
fs/cifs/fs_context.c +4 -4
@@ -203,7 +203,7 @@ cifs_parse_security_flavors(struct fs_context *fc, char *value, struct smb3_fs_c* With mount options, the last one should win. Reset any existing * settings back to default. */ - ctx->sectype = Unspecified; + ctx->sectype =CIFS_SECTYPE_UNSPEC ; ctx->sign = false;switch (match_token (value, cifs_secflavor_tokens, args)) {
@@ -214,19 +214,19 @@ cifs_parse_security_flavors(struct fs_context *fc, char *value, struct smb3_fs_c ctx->sign = true; fallthrough;case Opt_sec_krb5: - ctx->sectype = Kerberos; + ctx->sectype =CIFS_SECTYPE_KERBEROS ;break ;case Opt_sec_ntlmsspi: ctx->sign = true; fallthrough;case Opt_sec_ntlmssp: - ctx->sectype = RawNTLMSSP; + ctx->sectype =CIFS_SECTYPE_RAW_NTLMSSP ;break ;case Opt_sec_ntlmv2i: ctx->sign = true; fallthrough;case Opt_sec_ntlmv2: - ctx->sectype = NTLMv2; + ctx->sectype =CIFS_SECTYPE_NTLMV2 ;break ;case Opt_sec_none: ctx->nullauth =1 ;
fs/cifs/fs_context.h +1 -1
@@ -182,7 +182,7 @@ struct smb3_fs_context {kgid_t backupgid;umode_t file_mode;umode_t dir_mode; -enum securityEnum sectype;/* sectype requested via mnt opts */ +int sectype;/* sectype requested via mnt opts */ bool sign;/* was signing requested via mnt opts? */ bool ignore_signature:1; bool retry:1;
fs/cifs/misc.c +2 -2
@@ -69,7 +69,7 @@ sesInfoAlloc(void) ret_buf =kzalloc (sizeof (struct cifs_ses ),GFP_KERNEL );if (ret_buf) {atomic_inc (&g_ses_alloc_count); - ret_buf->ses_status =SES_NEW ; + ret_buf->status =CIFS_STATUS_NEW ; ++ret_buf->ses_count;INIT_LIST_HEAD (&ret_buf->smb_ses_list);INIT_LIST_HEAD (&ret_buf->tcon_list);
@@ -124,7 +124,7 @@ tconInfoAlloc(void)mutex_init (&ret_buf->crfid.dirents.de_mutex);atomic_inc (&g_tcon_alloc_count); - ret_buf->status =TID_NEW ; + ret_buf->status =CIFS_STATUS_NEW ; ++ret_buf->tc_count;INIT_LIST_HEAD (&ret_buf->openFileList);INIT_LIST_HEAD (&ret_buf->tcon_list);
fs/cifs/sess.c +16 -16
@@ -1114,40 +1114,40 @@ int build_ntlmssp_auth_blob(unsigned char **pbuffer,return rc; } -enum securityEnum -cifs_select_sectype (struct cifs_server_info *server,enum securityEnum requested) +int +cifs_select_sectype (struct cifs_server_info *server,int requested) {switch (server->negflavor) {case CIFS_NEGFLAVOR_EXTENDED :switch (requested) { -case Kerberos: -case RawNTLMSSP: +case CIFS_SECTYPE_KERBEROS : +case CIFS_SECTYPE_RAW_NTLMSSP :return requested; -case Unspecified: +case CIFS_SECTYPE_UNSPEC :if (server->sec_ntlmssp && (global_secflags &CIFSSEC_MAY_NTLMSSP )) -return RawNTLMSSP; +return CIFS_SECTYPE_RAW_NTLMSSP ;if ((server->sec_kerberos || server->sec_mskerberos) && (global_secflags &CIFSSEC_MAY_KRB5 )) -return Kerberos; +return CIFS_SECTYPE_KERBEROS ; fallthrough;default : -return Unspecified; +return CIFS_SECTYPE_UNSPEC ; }case CIFS_NEGFLAVOR_UNENCAP :switch (requested) { -case NTLMv2: +case CIFS_SECTYPE_NTLMV2 :return requested; -case Unspecified: +case CIFS_SECTYPE_UNSPEC :if (global_secflags &CIFSSEC_MAY_NTLMV2 ) -return NTLMv2; +return CIFS_SECTYPE_NTLMV2 ;break ;default :break ; } fallthrough;default : -return Unspecified; +return CIFS_SECTYPE_UNSPEC ; } }
@@ -1782,16 +1782,16 @@ static int select_sec(struct sess_data *sess_data) type =cifs_select_sectype (server, ses->sectype);cifs_dbg (FYI ,"sess setup type %d\n" , type); -if (type == Unspecified) { +if (type ==CIFS_SECTYPE_UNSPEC ) {cifs_dbg (VFS ,"Unable to select appropriate authentication method!\n" );return -EINVAL ; }switch (type) { -case NTLMv2: +case CIFS_SECTYPE_NTLMV2 : sess_data->func = sess_auth_ntlmv2;break ; -case Kerberos: +case CIFS_SECTYPE_KERBEROS :#ifdef CONFIG_CIFS_UPCALL sess_data->func = sess_auth_kerberos;break ;
@@ -1799,7 +1799,7 @@ static int select_sec(struct sess_data *sess_data)cifs_dbg (VFS ,"Kerberos negotiated but upcall support disabled!\n" );return -ENOSYS ;#endif /* CONFIG_CIFS_UPCALL */ -case RawNTLMSSP: +case CIFS_SECTYPE_RAW_NTLMSSP : sess_data->func = sess_auth_rawntlmssp_negotiate;break ;default :
fs/cifs/smb1ops.c +1 -1
@@ -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 ==CIFS_STATUS_GOOD )return true;return false;
fs/cifs/smb2ops.c +4 -4
@@ -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 ==CIFS_STATUS_NEED_RECONNECT + || server->status ==CIFS_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 ==CIFS_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 ==CIFS_STATUS_NEED_RECONNECT ) { mid->mid_state =MID_RETRY_NEEDED ;spin_unlock (&g_mid_lock);spin_unlock (&g_servers_lock);
fs/cifs/smb2pdu.c +22 -22
126 lines not on this page · raw message
fs/cifs/smb2proto.h +2 -2
@@ -260,8 +260,8 @@ extern int SMB2_lease_break(const unsigned int xid, struct cifs_tcon *tcon, __u8 *lease_key, const __le32 lease_state);extern int smb3_validate_negotiate (const unsigned int ,struct cifs_tcon *); -extern enum securityEnum smb2_select_sectype (struct cifs_server_info *, -enum securityEnum ); +extern int smb2_select_sectype (struct cifs_server_info *, +int ); extern void smb2_parse_contexts(struct cifs_server_info *server, struct smb2_create_rsp *rsp, unsigned int *epoch, char *lease_key,
fs/cifs/smb2transport.c +6 -6
@@ -763,24 +763,24 @@ 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 ==CIFS_STATUS_EXITING ) {spin_unlock (&g_servers_lock);return -ENOENT ; } -if (server->status == CifsNeedReconnect) { +if (server->status ==CIFS_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 ==CIFS_STATUS_NEED_NEGOTIATE && shdr->Command !=SMB2_NEGOTIATE ) {spin_unlock (&g_servers_lock);return -EAGAIN ; } -if (ses->ses_status ==SES_NEW ) { +if (ses->status ==CIFS_STATUS_NEW ) {if ((shdr->Command !=SMB2_SESSION_SETUP ) && (shdr->Command !=SMB2_NEGOTIATE )) {spin_unlock (&g_servers_lock);
@@ -789,7 +789,7 @@ smb2_get_mid_entry(struct cifs_ses *ses, struct cifs_server_info *server,/* else ok - we are setting up session */ } -if (ses->ses_status ==SES_EXITING ) { +if (ses->status ==CIFS_STATUS_EXITING ) {if (shdr->Command !=SMB2_LOGOFF ) {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 ==CIFS_STATUS_NEED_NEGOTIATE && shdr->Command !=SMB2_NEGOTIATE ) {spin_unlock (&g_servers_lock);return ERR_PTR (-EAGAIN );
fs/cifs/transport.c +12 -12
@@ -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 ==CIFS_STATUS_EXITING ) {spin_unlock (&g_servers_lock);return -ENOENT ; }
@@ -726,7 +726,7 @@ static int allocate_mid(struct cifs_ses *ses, struct smb_hdr *in_buf, struct mid_q_entry **ppmidQ) {spin_lock (&g_servers_lock); -if (ses->ses_status ==SES_NEW ) { +if (ses->status ==CIFS_STATUS_NEW ) {if ((in_buf->Command !=SMB_COM_SESSION_SETUP_ANDX ) && (in_buf->Command !=SMB_COM_NEGOTIATE )) {spin_unlock (&g_servers_lock);
@@ -735,7 +735,7 @@ static int allocate_mid(struct cifs_ses *ses, struct smb_hdr *in_buf,/* else ok - we are setting up session */ } -if (ses->ses_status ==SES_EXITING ) { +if (ses->status ==CIFS_STATUS_EXITING ) {/* check if SMB session is bad because we are setting it up */ if (in_buf->Command !=SMB_COM_LOGOFF_ANDX ) {spin_unlock (&g_servers_lock);
@@ -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 ==CIFS_STATUS_EXITING ) {spin_unlock (&g_servers_lock);return -ENOENT ; }
@@ -1187,7 +1187,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,* Compounding is never used during session establish. */ spin_lock (&g_servers_lock); -if ((ses->ses_status ==SES_NEW ) || (optype &CIFS_NEG_OP ) || (optype &CIFS_SESS_OP )) { +if ((ses->status ==CIFS_STATUS_NEW ) || (optype &CIFS_NEG_OP ) || (optype &CIFS_SESS_OP )) {spin_unlock (&g_servers_lock);cifs_server_lock (server);
@@ -1260,7 +1260,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,* Compounding is never used during session establish. */ spin_lock (&g_servers_lock); -if ((ses->ses_status ==SES_NEW ) || (optype &CIFS_NEG_OP ) || (optype &CIFS_SESS_OP )) { +if ((ses->status ==CIFS_STATUS_NEW ) || (optype &CIFS_NEG_OP ) || (optype &CIFS_SESS_OP )) {struct kvec iov = { .iov_base = resp_iov[0 ].iov_base, .iov_len = resp_iov[0 ].iov_len
@@ -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 ==CIFS_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 ==CIFS_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 !=CIFS_STATUS_GOOD ) && + (server->status !=CIFS_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 ==CIFS_STATUS_GOOD ) || + (server->status ==CIFS_STATUS_NEW ))) {spin_unlock (&g_servers_lock);if (in_buf->Command ==SMB_COM_TRANSACTION2 ) {
Signature · 1 line
2.35.3
Re: [RFC PATCH v2 06/10] cifs: change status and security types enums to constants
enums for status seem safer since it will prevent coding errors when
we set invalid status values for the various status enums. There are
subtle differences between the valid status states of socket, server channel, session and tcon.
Quoted 1,386 lines · Enzo Matsumiya
Change server, tcon, and session status, and security types enums to constants integers.
Since some of the status values were common between server, tcon, and session, define a "generic" status code instead of having specific enums for each data structure.
Signed-off-by Enzo Matsumiya <[email protected]>--- fs/cifs/cifs_debug.c | 4 +- fs/cifs/cifs_swn.c | 8 +-- fs/cifs/cifsencrypt.c | 2 +- fs/cifs/cifsfs.c | 14 ++-- fs/cifs/cifsglob.h | 82 +++++++++-------------- fs/cifs/cifsproto.h | 6 +- fs/cifs/cifssmb.c | 26 ++++---- fs/cifs/connect.c | 144 ++++++++++++++++++++-------------------- fs/cifs/fs_context.c | 8 +-- fs/cifs/fs_context.h | 2 +- fs/cifs/misc.c | 4 +- fs/cifs/sess.c | 32 ++++----- fs/cifs/smb1ops.c | 2 +- fs/cifs/smb2ops.c | 8 +-- fs/cifs/smb2pdu.c | 44 ++++++------ fs/cifs/smb2proto.h | 4 +- fs/cifs/smb2transport.c | 12 ++-- fs/cifs/transport.c | 24 +++---- 18 files changed, 203 insertions(+), 223 deletions(-)fs/cifs/cifs_debug.c +2
-2@@ -382,7 +382,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v) (ses->serverNOS == NULL)) {seq_printf (m,"\n\t%d) Address: %s Uses: %d Capability: 0x%x\tSession Status: %d " , i, ses->ip_addr, ses->ses_count, - ses->capabilities, ses->ses_status); + ses->capabilities, ses->status);if (ses->session_flags &SMB2_SESSION_FLAG_IS_GUEST )seq_printf (m,"Guest " );else if (ses->session_flags &SMB2_SESSION_FLAG_IS_NULL )@@ -394,7 +394,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)"\n\tSMB session status: %d " , i, ses->ip_addr, ses->serverDomain, ses->ses_count, ses->serverOS, ses->serverNOS, - ses->capabilities, ses->ses_status); + ses->capabilities, ses->status); } seq_printf(m, "\n\tSecurity type: %s ",fs/cifs/cifs_swn.c +4
-4@@ -77,7 +77,7 @@ static int cifs_swn_send_register_message(struct cifs_swn_reg *swnreg) {struct sk_buff *skb;struct genlmsghdr *hdr; -enum securityEnum authtype; +int authtype;struct sockaddr_storage *addr;int ret;@@ -140,15 +140,15 @@ static int cifs_swn_send_register_message(struct cifs_swn_reg *swnreg) authtype =cifs_select_sectype (swnreg->tcon->ses->server, swnreg->tcon->ses->sectype);switch (authtype) { -case Kerberos: +case CIFS_SECTYPE_KERBEROS : ret =cifs_swn_auth_info_krb (swnreg->tcon, skb);if (ret <0 ) {cifs_dbg (VFS ,"%s: Failed to get kerberos auth info: %d\n" , __func__, ret); goto nlmsg_fail; }break ; -case NTLMv2: -case RawNTLMSSP: +case CIFS_SECTYPE_NTLMV2 : +case CIFS_SECTYPE_RAW_NTLMSSP : ret =cifs_swn_auth_info_ntlm (swnreg->tcon, skb);if (ret <0 ) {cifs_dbg (VFS ,"%s: Failed to get NTLM auth info: %d\n" , __func__, ret);fs/cifs/cifsencrypt.c +1
-1@@ -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 ==CIFS_STATUS_NEED_NEGOTIATE ) {spin_unlock (&g_servers_lock);return rc; }fs/cifs/cifsfs.c +7
-7@@ -449,7 +449,7 @@ cifs_show_address(struct seq_file *s, struct cifs_server_info *server)static void cifs_show_security (struct seq_file *s,struct cifs_ses *ses) { -if (ses->sectype == Unspecified) { +if (ses->sectype ==CIFS_SECTYPE_UNSPEC ) {if (ses->user_name ==NULL )seq_puts (s,",sec=none" );return ;@@ -458,13 +458,13 @@ cifs_show_security(struct seq_file *s, struct cifs_ses *ses)seq_puts (s,",sec=" );switch (ses->sectype) { -case NTLMv2: +case CIFS_SECTYPE_NTLMV2 :seq_puts (s,"ntlmv2" );break ; -case Kerberos: +case CIFS_SECTYPE_KERBEROS :seq_puts (s,"krb5" );break ; -case RawNTLMSSP: +case CIFS_SECTYPE_RAW_NTLMSSP :seq_puts (s,"ntlmssp" );break ;default :@@ -476,7 +476,7 @@ cifs_show_security(struct seq_file *s, struct cifs_ses *ses)if (ses->sign)seq_puts (s,"i" ); -if (ses->sectype == Kerberos) +if (ses->sectype ==CIFS_SECTYPE_KERBEROS )seq_printf (s,",cruid=%u" ,from_kuid_munged (&init_user_ns, ses->cred_uid)); }@@ -712,14 +712,14 @@ static void cifs_umount_begin(struct super_block *sb) tcon =cifs_sb_master_tcon (cifs_sb);spin_lock (&g_servers_lock); -if ((tcon->tc_count >1 ) || (tcon->status ==TID_EXITING )) { +if ((tcon->tc_count >1 ) || (tcon->status ==CIFS_STATUS_EXITING )) {/* we have other mounts to same share or we have already tried to force umount this and woken up all waiting network requests, nothing to do */ spin_unlock (&g_servers_lock);return ; }else if (tcon->tc_count ==1 ) - tcon->status =TID_EXITING ; + tcon->status =CIFS_STATUS_EXITING ;spin_unlock (&g_servers_lock);/* cancel_brl_requests(tcon); */ /* BB mark all brl mids as exiting */ fs/cifs/cifsglob.h +32
-50@@ -25,6 +25,7 @@#include <uapi/linux/cifs/cifs_mount.h> #include "../smbfs_common/smb2pdu.h" #include "smb2pdu.h" +#include "cifspdu.h" #define SMB_PATH_MAX 260#define CIFS_PORT 445@@ -107,46 +108,27 @@#define CIFS_MAX_WORKSTATION_LEN (__NEW_UTS_LEN + 1)/* reasonable max for client */ /* -* CIFS vfs client Status information (based on what we know.) +* Status information */ +#define CIFS_STATUS_NEW 0x0/* server, ses, tcon */ +#define CIFS_STATUS_GOOD 0x1/* server, ses, tcon */ +#define CIFS_STATUS_EXITING 0x2/* server, ses, tcon */ +#define CIFS_STATUS_NEED_RECONNECT 0x3/* server, ses, tcon */ +#define CIFS_STATUS_NEED_NEGOTIATE 0x4/* server */ +#define CIFS_STATUS_NEED_TCON 0x5/* tcon */ +#define CIFS_STATUS_IN_NEGOTIATE 0x6/* server */ +#define CIFS_STATUS_IN_SETUP 0x7/* ses */ +#define CIFS_STATUS_IN_TCON 0x8/* tcon */ +#define CIFS_STATUS_NEED_FILES_INVALIDATE 0x9/* ses */ +#define CIFS_STATUS_IN_FILES_INVALIDATE 0xa/* ses */ -/* associated with each connection */ -enum statusEnum { - CifsNew =0 , - CifsGood, - CifsExiting, - CifsNeedReconnect, - CifsNeedNegotiate, - CifsInNegotiate, -}; - -/* associated with each smb session */ -enum ses_status_enum { -SES_NEW =0 , -SES_GOOD , -SES_EXITING , -SES_NEED_RECON , -SES_IN_SETUP -}; - -/* associated with each tree connection to the server */ -enum tid_status_enum { -TID_NEW =0 , -TID_GOOD , -TID_EXITING , -TID_NEED_RECON , -TID_NEED_TCON , -TID_IN_TCON , -TID_NEED_FILES_INVALIDATE ,/* currently unused */ -TID_IN_FILES_INVALIDATE -}; - -enum securityEnum { - Unspecified =0 ,/* not specified */ - NTLMv2,/* Legacy NTLM auth with NTLMv2 hash */ - RawNTLMSSP,/* NTLMSSP without SPNEGO, NTLMv2 hash */ - Kerberos,/* Kerberos via SPNEGO */ -}; +/* +* Security types +*/ +#define CIFS_SECTYPE_UNSPEC 0x0/* not specified */ +#define CIFS_SECTYPE_NTLMV2 0x1/* Legacy NTLM auth with NTLMv2 hash */ +#define CIFS_SECTYPE_RAW_NTLMSSP 0x2/* NTLMSSP without SPNEGO, NTLMv2 hash */ +#define CIFS_SECTYPE_KERBEROS 0x3/* Kerberos via SPNEGO */ struct session_key {unsigned int len;@@ -506,8 +488,8 @@ struct smb_version_operations {int (*is_transform_hdr)(void *buf);int (*receive_transform)(struct cifs_server_info *,struct mid_q_entry **,char **,int *); -enum securityEnum (*select_sectype)(struct cifs_server_info *, -enum securityEnum ); +int (*select_sectype)(struct cifs_server_info *, +int );int (*next_header)(char *);/* ioctl passthrough for query_info */ int (*ioctl_query_info)(const unsigned int xid,@@ -612,7 +594,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 */ +int status;/* what we think the status is */ char *hostname;/* hostname portion of UNC string */ struct socket *ssocket;struct sockaddr_storage dstaddr;@@ -1011,7 +993,7 @@ struct cifs_ses {struct mutex session_mutex;struct cifs_server_info *server;/* pointer to server info */ int ses_count;/* reference counter */ -enum ses_status_enum ses_status;/* updates protected by g_servers_lock */ +int status;/* updates protected by g_servers_lock */ unsigned overrideSecFlg;/* if non-zero override global sec flags */ char *serverOS;/* name of operating system underlying server */ char *serverNOS;/* name of network operating system of server */ @@ -1028,7 +1010,7 @@ struct cifs_ses {char workstation_name[CIFS_MAX_WORKSTATION_LEN ];struct session_key auth_key;struct ntlmssp_auth *ntlmssp;/* ciphertext, flags, server challenge */ -enum securityEnum sectype;/* what security flavor was specified? */ +int sectype;/* what security flavor was specified? */ bool sign;/* is signing required? */ bool domainAuto:1;__u16 session_flags;@@ -1179,7 +1161,7 @@ struct cifs_tcon {char *password;/* for share-level security */ __u32 tid;/* The 4 byte tree id */ __u16 Flags;/* optional support bits */ -enum tid_status_enum status; +int status;atomic_t num_smbs_sent; union { struct {@@ -1948,7 +1930,7 @@ extern struct list_head g_servers_list;* tcp session, and the list of tcon's per smb session. It also protects * the reference counters for the server, smb session, and tcon. It also * protects some fields in the cifs_server_info struct such as dstaddr. Finally, -* changes to the tcon->tidStatus should be done while holding this lock. +* changes to the tcon->status should be done while holding this lock. * generally the locks should be taken in order g_servers_lock before * tcon->open_file_lock and that before file->file_info_lock since the * structure order is cifs_socket-->cifs_ses-->cifs_tcon-->cifs_file @@ -2041,14 +2023,14 @@ extern struct smb_version_values smb302_values;extern struct smb_version_operations smb311_operations;extern struct smb_version_values smb311_values; -static inline char *get_security_type_str (enum securityEnum sectype) +static inline char *get_security_type_str (int sectype) {switch (sectype) { -case RawNTLMSSP: -return "RawNTLMSSP" ; -case Kerberos: +case CIFS_SECTYPE_RAW_NTLMSSP : +return "CIFS_SECTYPE_RAW_NTLMSSP" ; +case CIFS_SECTYPE_KERBEROS :return "Kerberos" ; -case NTLMv2: +case CIFS_SECTYPE_NTLMV2 :return "NTLMv2" ;default :return "Unknown" ;fs/cifs/cifsproto.h +2
-4@@ -168,8 +168,7 @@ extern void header_assemble(struct smb_hdr *, char /* command */ ,extern int small_smb_init_no_tc (const int smb_cmd,const int wct,struct cifs_ses *ses,void **request_buf); -extern enum securityEnum select_sectype (struct cifs_server_info *server, -enum securityEnum requested); +extern int select_sectype (struct cifs_server_info *server,int requested);extern int CIFS_SessSetup (const unsigned int xid,struct cifs_ses *ses,struct cifs_server_info *server,const struct nls_table *nls_cp);@@ -594,8 +593,7 @@ int cifs_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,int __cifs_calc_signature (struct smb_rqst *rqst,struct cifs_server_info *server,char *signature,struct shash_desc *shash); -enum securityEnum cifs_select_sectype (struct cifs_server_info *, -enum securityEnum ); +int cifs_select_sectype (struct cifs_server_info *,int );struct cifs_aio_ctx *cifs_aio_ctx_alloc (void );void cifs_aio_ctx_release (struct kref *refcount);int setup_aio_ctx_iter (struct cifs_aio_ctx *ctx,struct iov_iter *iter,int rw);fs/cifs/cifssmb.c +13
-13@@ -75,11 +75,11 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon)/* only send once per connect */ spin_lock (&g_servers_lock); -if ((tcon->ses->ses_status !=SES_GOOD ) || (tcon->status !=TID_NEED_RECON )) { +if ((tcon->ses->status !=CIFS_STATUS_GOOD ) || (tcon->status !=CIFS_STATUS_NEED_RECONNECT )) {spin_unlock (&g_servers_lock);return ; } - tcon->status =TID_IN_FILES_INVALIDATE ; + tcon->status =CIFS_STATUS_IN_FILES_INVALIDATE ;spin_unlock (&g_servers_lock);/* list all files open on tree connection and mark them invalid */ @@ -99,8 +99,8 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon)mutex_unlock (&tcon->crfid.fid_mutex);spin_lock (&g_servers_lock); -if (tcon->status ==TID_IN_FILES_INVALIDATE ) - tcon->status =TID_NEED_TCON ; +if (tcon->status ==CIFS_STATUS_IN_FILES_INVALIDATE ) + tcon->status =CIFS_STATUS_NEED_TCON ;spin_unlock (&g_servers_lock);/* @@ -135,7 +135,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)* have tcon) are allowed as we start force umount */ spin_lock (&g_servers_lock); -if (tcon->status ==TID_EXITING ) { +if (tcon->status ==CIFS_STATUS_EXITING ) {if (smb_command !=SMB_COM_WRITE_ANDX && smb_command !=SMB_COM_OPEN_ANDX && smb_command !=SMB_COM_TREE_DISCONNECT ) {@@ -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 ==CIFS_STATUS_NEED_RECONNECT ) { rc =wait_event_interruptible_timeout (server->response_q, - (server->status != CifsNeedReconnect), + (server->status !=CIFS_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 !=CIFS_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 ==CIFS_STATUS_NEED_RECONNECT ) {spin_unlock (&g_servers_lock); rc = -EHOSTDOWN ; goto out;@@ -504,13 +504,13 @@ cifs_enable_signing(struct cifs_server_info *server, bool mnt_sign_required) }static bool -should_set_ext_sec_flag (enum securityEnum sectype) +should_set_ext_sec_flag (int sectype) {switch (sectype) { -case RawNTLMSSP: -case Kerberos: +case CIFS_SECTYPE_RAW_NTLMSSP : +case CIFS_SECTYPE_KERBEROS :return true; -case Unspecified: +case CIFS_SECTYPE_UNSPEC :if (global_secflags & (CIFSSEC_MAY_KRB5 |CIFSSEC_MAY_NTLMSSP ))return true;fs/cifs/connect.c +72
-72@@ -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 =CIFS_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 =CIFS_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 CIFS_STATUS_NEED_RECONNECT. * @mark_smb_session: whether even sessions need to be marked */ void @@ -277,11 +277,11 @@ cifs_mark_server_conns_for_reconnect(struct cifs_server_info *server,if (!mark_smb_session && !CIFS_ALL_CHANS_NEED_RECONNECT (ses)) goto next_session; - ses->ses_status =SES_NEED_RECON ; + ses->status =CIFS_STATUS_NEED_RECONNECT ;list_for_each_entry (tcon, &ses->tcon_list, tcon_list) { tcon->need_reconnect = true; - tcon->status =TID_NEED_RECON ; + tcon->status =CIFS_STATUS_NEED_RECONNECT ; }if (ses->tcon_ipc) ses->tcon_ipc->need_reconnect = true;@@ -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 ==CIFS_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 numcifs_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 =CIFS_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 !=CIFS_STATUS_EXITING ) + server->status =CIFS_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 ==CIFS_STATUS_NEED_RECONNECT );spin_lock (&g_servers_lock); -if (server->status == CifsNeedNegotiate) +if (server->status ==CIFS_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 CIFS_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 !=CIFS_STATUS_EXITING ) + server->status =CIFS_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 ==CIFS_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 ==CIFS_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 ==CIFS_STATUS_NEED_RECONNECT || + server->status ==CIFS_STATUS_EXITING || + server->status ==CIFS_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 ==CIFS_STATUS_GOOD || + server->status ==CIFS_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 ==CIFS_STATUS_EXITING ) {spin_unlock (&g_servers_lock);return -ESHUTDOWN ; } -if (server->status == CifsNeedReconnect) { +if (server->status ==CIFS_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. +* CIFS_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 =CIFS_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 !=CIFS_STATUS_EXITING ) {if (try_to_freeze ())continue ;@@ -1392,11 +1392,11 @@ match_security(struct cifs_server_info *server, struct smb3_fs_context *ctx) {/* * The select_sectype function should either return the ctx->sectype -* that was specified, or "Unspecified" if that sectype was not +* that was specified, or "CIFS_SECTYPE_UNSPEC" if that sectype was not * compatible with the given NEGOTIATE request. */ if (server->ops->select_sectype (server, ctx->sectype) - == Unspecified) + ==CIFS_SECTYPE_UNSPEC )return false;/* @@ -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 =CIFS_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 =CIFS_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 =CIFS_STATUS_NEED_NEGOTIATE ;spin_unlock (&g_servers_lock);if ((ctx->max_credits <20 ) || (ctx->max_credits >60000 ))@@ -1730,7 +1730,7 @@ cifs_get_server(struct smb3_fs_context *ctx,static int match_session (struct cifs_ses *ses,struct smb3_fs_context *ctx) { -if (ctx->sectype != Unspecified && +if (ctx->sectype !=CIFS_SECTYPE_UNSPEC && ctx->sectype != ses->sectype)return 0 ;@@ -1746,7 +1746,7 @@ static int match_session(struct cifs_ses *ses, struct smb3_fs_context *ctx)spin_unlock (&ses->chan_lock);switch (ses->sectype) { -case Kerberos: +case CIFS_SECTYPE_KERBEROS :if (!uid_eq (ctx->cred_uid, ses->cred_uid))return 0 ;break ;@@ -1863,7 +1863,7 @@ cifs_find_smb_ses(struct cifs_server_info *server, struct smb3_fs_context *ctx)spin_lock (&g_servers_lock);list_for_each_entry (ses, &server->smb_ses_list, smb_ses_list) { -if (ses->ses_status ==SES_EXITING ) +if (ses->status ==CIFS_STATUS_EXITING )continue ;if (!match_session (ses, ctx))continue ;@@ -1882,7 +1882,7 @@ void cifs_put_smb_ses(struct cifs_ses *ses)struct cifs_server_info *server = ses->server;spin_lock (&g_servers_lock); -if (ses->ses_status ==SES_EXITING ) { +if (ses->status ==CIFS_STATUS_EXITING ) {spin_unlock (&g_servers_lock);return ; }@@ -1898,13 +1898,13 @@ void cifs_put_smb_ses(struct cifs_ses *ses)/* ses_count can never go negative */ WARN_ON (ses->ses_count <0 ); -if (ses->ses_status ==SES_GOOD ) - ses->ses_status =SES_EXITING ; +if (ses->status ==CIFS_STATUS_GOOD ) + ses->status =CIFS_STATUS_EXITING ;spin_unlock (&g_servers_lock);cifs_free_ipc (ses); -if (ses->ses_status ==SES_EXITING && server->ops->logoff) { +if (ses->status ==CIFS_STATUS_EXITING && server->ops->logoff) { xid =get_xid (); rc = server->ops->logoff (xid, ses);if (rc)@@ -2113,7 +2113,7 @@ cifs_get_smb_ses(struct cifs_server_info *server, struct smb3_fs_context *ctx) ses =cifs_find_smb_ses (server, ctx);if (ses) {cifs_dbg (FYI ,"Existing smb sess found (status=%d)\n" , - ses->ses_status); + ses->status);spin_lock (&ses->chan_lock);if (cifs_chan_needs_reconnect (ses, server)) {@@ -2237,7 +2237,7 @@ cifs_get_smb_ses(struct cifs_server_info *server, struct smb3_fs_context *ctx)static int match_tcon (struct cifs_tcon *tcon,struct smb3_fs_context *ctx) { -if (tcon->status ==TID_EXITING ) +if (tcon->status ==CIFS_STATUS_EXITING )return 0 ;if (strncmp (tcon->treeName, ctx->UNC,MAX_TREE_SIZE ))return 0 ;@@ -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 ==CIFS_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 !=CIFS_STATUS_NEED_NEGOTIATE ) {spin_unlock (&g_servers_lock);return 0 ; } - server->status = CifsInNegotiate; + server->status =CIFS_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 ==CIFS_STATUS_IN_NEGOTIATE ) + server->status =CIFS_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 ==CIFS_STATUS_IN_NEGOTIATE ) + server->status =CIFS_STATUS_NEED_NEGOTIATE ;spin_unlock (&g_servers_lock); }@@ -4029,9 +4029,9 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,else scnprintf (ses->ip_addr,sizeof (ses->ip_addr),"%pI4" , &addr->sin_addr); -if (ses->ses_status !=SES_GOOD && - ses->ses_status !=SES_NEW && - ses->ses_status !=SES_NEED_RECON ) { +if (ses->status !=CIFS_STATUS_GOOD && + ses->status !=CIFS_STATUS_NEW && + ses->status !=CIFS_STATUS_NEED_RECONNECT ) {spin_unlock (&g_servers_lock);return 0 ; }@@ -4049,7 +4049,7 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,spin_unlock (&ses->chan_lock);if (!is_binding) - ses->ses_status =SES_IN_SETUP ; + ses->status =CIFS_STATUS_IN_SETUP ;spin_unlock (&g_servers_lock);if (!is_binding) {@@ -4075,16 +4075,16 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,if (rc) {cifs_server_dbg (VFS ,"Send error in SessSetup = %d\n" , rc);spin_lock (&g_servers_lock); -if (ses->ses_status ==SES_IN_SETUP ) - ses->ses_status =SES_NEED_RECON ; +if (ses->status ==CIFS_STATUS_IN_SETUP ) + ses->status =CIFS_STATUS_NEED_RECONNECT ;spin_lock (&ses->chan_lock);cifs_chan_clear_in_reconnect (ses, server);spin_unlock (&ses->chan_lock);spin_unlock (&g_servers_lock); }else {spin_lock (&g_servers_lock); -if (ses->ses_status ==SES_IN_SETUP ) - ses->ses_status =SES_GOOD ; +if (ses->status ==CIFS_STATUS_IN_SETUP ) + ses->status =CIFS_STATUS_GOOD ;spin_lock (&ses->chan_lock);cifs_chan_clear_in_reconnect (ses, server);cifs_chan_clear_need_reconnect (ses, server);@@ -4101,7 +4101,7 @@ cifs_set_vol_auth(struct smb3_fs_context *ctx, struct cifs_ses *ses) ctx->sectype = ses->sectype;/* krb5 is special, since we don't need username or pw */ -if (ctx->sectype == Kerberos) +if (ctx->sectype ==CIFS_SECTYPE_KERBEROS )return 0 ;return cifs_set_cifscreds (ctx, ses);@@ -4559,13 +4559,13 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru/* only send once per connect */ spin_lock (&g_servers_lock); -if (tcon->ses->ses_status !=SES_GOOD || - (tcon->status !=TID_NEW && - tcon->status !=TID_NEED_TCON )) { +if (tcon->ses->status !=CIFS_STATUS_GOOD || + (tcon->status !=CIFS_STATUS_NEW && + tcon->status !=CIFS_STATUS_NEED_TCON )) {spin_unlock (&g_servers_lock);return 0 ; } - tcon->status =TID_IN_TCON ; + tcon->status =CIFS_STATUS_IN_TCON ;spin_unlock (&g_servers_lock); tree =kzalloc (MAX_TREE_SIZE ,GFP_KERNEL );@@ -4606,13 +4606,13 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const struif (rc) {spin_lock (&g_servers_lock); -if (tcon->status ==TID_IN_TCON ) - tcon->status =TID_NEED_TCON ; +if (tcon->status ==CIFS_STATUS_IN_TCON ) + tcon->status =CIFS_STATUS_NEED_TCON ;spin_unlock (&g_servers_lock); }else {spin_lock (&g_servers_lock); -if (tcon->status ==TID_IN_TCON ) - tcon->status =TID_GOOD ; +if (tcon->status ==CIFS_STATUS_IN_TCON ) + tcon->status =CIFS_STATUS_GOOD ;spin_unlock (&g_servers_lock); tcon->need_reconnect = false; }@@ -4627,25 +4627,25 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru/* only send once per connect */ spin_lock (&g_servers_lock); -if (tcon->ses->ses_status !=SES_GOOD || - (tcon->status !=TID_NEW && - tcon->status !=TID_NEED_TCON )) { +if (tcon->ses->status !=CIFS_STATUS_GOOD || + (tcon->status !=CIFS_STATUS_NEW && + tcon->status !=CIFS_STATUS_NEED_TCON )) {spin_unlock (&g_servers_lock);return 0 ; } - tcon->status =TID_IN_TCON ; + tcon->status =CIFS_STATUS_IN_TCON ;spin_unlock (&g_servers_lock); rc = ops->tree_connect (xid, tcon->ses, tcon->treeName, tcon, nlsc);if (rc) {spin_lock (&g_servers_lock); -if (tcon->status ==TID_IN_TCON ) - tcon->status =TID_NEED_TCON ; +if (tcon->status ==CIFS_STATUS_IN_TCON ) + tcon->status =CIFS_STATUS_NEED_TCON ;spin_unlock (&g_servers_lock); }else {spin_lock (&g_servers_lock); -if (tcon->status ==TID_IN_TCON ) - tcon->status =TID_GOOD ; +if (tcon->status ==CIFS_STATUS_IN_TCON ) + tcon->status =CIFS_STATUS_GOOD ;spin_unlock (&g_servers_lock); tcon->need_reconnect = false; }fs/cifs/fs_context.c +4
-4@@ -203,7 +203,7 @@ cifs_parse_security_flavors(struct fs_context *fc, char *value, struct smb3_fs_c* With mount options, the last one should win. Reset any existing * settings back to default. */ - ctx->sectype = Unspecified; + ctx->sectype =CIFS_SECTYPE_UNSPEC ; ctx->sign = false;switch (match_token (value, cifs_secflavor_tokens, args)) {@@ -214,19 +214,19 @@ cifs_parse_security_flavors(struct fs_context *fc, char *value, struct smb3_fs_c ctx->sign = true; fallthrough;case Opt_sec_krb5: - ctx->sectype = Kerberos; + ctx->sectype =CIFS_SECTYPE_KERBEROS ;break ;case Opt_sec_ntlmsspi: ctx->sign = true; fallthrough;case Opt_sec_ntlmssp: - ctx->sectype = RawNTLMSSP; + ctx->sectype =CIFS_SECTYPE_RAW_NTLMSSP ;break ;case Opt_sec_ntlmv2i: ctx->sign = true; fallthrough;case Opt_sec_ntlmv2: - ctx->sectype = NTLMv2; + ctx->sectype =CIFS_SECTYPE_NTLMV2 ;break ;case Opt_sec_none: ctx->nullauth =1 ;fs/cifs/fs_context.h +1
-1@@ -182,7 +182,7 @@ struct smb3_fs_context {kgid_t backupgid;umode_t file_mode;umode_t dir_mode; -enum securityEnum sectype;/* sectype requested via mnt opts */ +int sectype;/* sectype requested via mnt opts */ bool sign;/* was signing requested via mnt opts? */ bool ignore_signature:1; bool retry:1;fs/cifs/misc.c +2
-2@@ -69,7 +69,7 @@ sesInfoAlloc(void) ret_buf =kzalloc (sizeof (struct cifs_ses ),GFP_KERNEL );if (ret_buf) {atomic_inc (&g_ses_alloc_count); - ret_buf->ses_status =SES_NEW ; + ret_buf->status =CIFS_STATUS_NEW ; ++ret_buf->ses_count;INIT_LIST_HEAD (&ret_buf->smb_ses_list);INIT_LIST_HEAD (&ret_buf->tcon_list);@@ -124,7 +124,7 @@ tconInfoAlloc(void)mutex_init (&ret_buf->crfid.dirents.de_mutex);atomic_inc (&g_tcon_alloc_count); - ret_buf->status =TID_NEW ; + ret_buf->status =CIFS_STATUS_NEW ; ++ret_buf->tc_count;INIT_LIST_HEAD (&ret_buf->openFileList);INIT_LIST_HEAD (&ret_buf->tcon_list);fs/cifs/sess.c +16
-16@@ -1114,40 +1114,40 @@ int build_ntlmssp_auth_blob(unsigned char **pbuffer,return rc; } -enum securityEnum -cifs_select_sectype (struct cifs_server_info *server,enum securityEnum requested) +int +cifs_select_sectype (struct cifs_server_info *server,int requested) {switch (server->negflavor) {case CIFS_NEGFLAVOR_EXTENDED :switch (requested) { -case Kerberos: -case RawNTLMSSP: +case CIFS_SECTYPE_KERBEROS : +case CIFS_SECTYPE_RAW_NTLMSSP :return requested; -case Unspecified: +case CIFS_SECTYPE_UNSPEC :if (server->sec_ntlmssp && (global_secflags &CIFSSEC_MAY_NTLMSSP )) -return RawNTLMSSP; +return CIFS_SECTYPE_RAW_NTLMSSP ;if ((server->sec_kerberos || server->sec_mskerberos) && (global_secflags &CIFSSEC_MAY_KRB5 )) -return Kerberos; +return CIFS_SECTYPE_KERBEROS ; fallthrough;default : -return Unspecified; +return CIFS_SECTYPE_UNSPEC ; }case CIFS_NEGFLAVOR_UNENCAP :switch (requested) { -case NTLMv2: +case CIFS_SECTYPE_NTLMV2 :return requested; -case Unspecified: +case CIFS_SECTYPE_UNSPEC :if (global_secflags &CIFSSEC_MAY_NTLMV2 ) -return NTLMv2; +return CIFS_SECTYPE_NTLMV2 ;break ;default :break ; } fallthrough;default : -return Unspecified; +return CIFS_SECTYPE_UNSPEC ; } }@@ -1782,16 +1782,16 @@ static int select_sec(struct sess_data *sess_data) type =cifs_select_sectype (server, ses->sectype);cifs_dbg (FYI ,"sess setup type %d\n" , type); -if (type == Unspecified) { +if (type ==CIFS_SECTYPE_UNSPEC ) {cifs_dbg (VFS ,"Unable to select appropriate authentication method!\n" );return -EINVAL ; }switch (type) { -case NTLMv2: +case CIFS_SECTYPE_NTLMV2 : sess_data->func = sess_auth_ntlmv2;break ; -case Kerberos: +case CIFS_SECTYPE_KERBEROS :#ifdef CONFIG_CIFS_UPCALL sess_data->func = sess_auth_kerberos;break ;@@ -1799,7 +1799,7 @@ static int select_sec(struct sess_data *sess_data)cifs_dbg (VFS ,"Kerberos negotiated but upcall support disabled!\n" );return -ENOSYS ;#endif /* CONFIG_CIFS_UPCALL */ -case RawNTLMSSP: +case CIFS_SECTYPE_RAW_NTLMSSP : sess_data->func = sess_auth_rawntlmssp_negotiate;break ;default :fs/cifs/smb1ops.c +1
-1@@ -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 ==CIFS_STATUS_GOOD )return true;return false;fs/cifs/smb2ops.c +4
-4@@ -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 ==CIFS_STATUS_NEED_RECONNECT + || server->status ==CIFS_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 ==CIFS_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 ==CIFS_STATUS_NEED_RECONNECT ) { mid->mid_state =MID_RETRY_NEEDED ;spin_unlock (&g_mid_lock);spin_unlock (&g_servers_lock);fs/cifs/smb2pdu.c +22
-22@@ -163,7 +163,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,return 0 ;spin_lock (&g_servers_lock); -if (tcon->status ==TID_EXITING ) { +if (tcon->status ==CIFS_STATUS_EXITING ) {/* * only tree disconnect, open, and write, * (and ulogoff which does not have tcon) @@ -179,7 +179,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon, } }spin_unlock (&g_servers_lock); -if ((!tcon->ses) || (tcon->ses->ses_status ==SES_EXITING ) || +if ((!tcon->ses) || (tcon->ses->status ==CIFS_STATUS_EXITING ) || (!tcon->ses->server) || !server)return -EIO ;@@ -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 ==CIFS_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 !=CIFS_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 !=CIFS_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 ==CIFS_STATUS_NEED_RECONNECT ) {spin_unlock (&g_servers_lock); rc = -EHOSTDOWN ; goto out;@@ -1056,7 +1056,7 @@ SMB2_negotiate(const unsigned int xid,/* * See MS-SMB2 section 2.2.4: if no blob, client picks default which * for us will be -* ses->sectype = RawNTLMSSP; +* ses->sectype = CIFS_SECTYPE_RAW_NTLMSSP; * but for time being this is our only auth choice so doesn't matter. * We just found a server which sets blob length to zero expecting raw. */ @@ -1227,25 +1227,25 @@ int smb3_validate_negotiate(const unsigned int xid, struct cifs_tcon *tcon)return rc; } -enum securityEnum -smb2_select_sectype (struct cifs_server_info *server,enum securityEnum requested) +int +smb2_select_sectype (struct cifs_server_info *server,int requested) {switch (requested) { -case Kerberos: -case RawNTLMSSP: +case CIFS_SECTYPE_KERBEROS : +case CIFS_SECTYPE_RAW_NTLMSSP :return requested; -case NTLMv2: -return RawNTLMSSP; -case Unspecified: +case CIFS_SECTYPE_NTLMV2 : +return CIFS_SECTYPE_RAW_NTLMSSP ; +case CIFS_SECTYPE_UNSPEC :if (server->sec_ntlmssp && (global_secflags &CIFSSEC_MAY_NTLMSSP )) -return RawNTLMSSP; +return CIFS_SECTYPE_RAW_NTLMSSP ;if ((server->sec_kerberos || server->sec_mskerberos) && (global_secflags &CIFSSEC_MAY_KRB5 )) -return Kerberos; +return CIFS_SECTYPE_KERBEROS ; fallthrough;default : -return Unspecified; +return CIFS_SECTYPE_UNSPEC ; } }@@ -1671,16 +1671,16 @@ SMB2_select_sec(struct SMB2_sess_data *sess_data) type =smb2_select_sectype (server, ses->sectype);cifs_dbg (FYI ,"sess setup type %d\n" , type); -if (type == Unspecified) { +if (type ==CIFS_SECTYPE_UNSPEC ) {cifs_dbg (VFS ,"Unable to select appropriate authentication method!\n" );return -EINVAL ; }switch (type) { -case Kerberos: +case CIFS_SECTYPE_KERBEROS : sess_data->func = SMB2_auth_kerberos;break ; -case RawNTLMSSP: +case CIFS_SECTYPE_RAW_NTLMSSP : sess_data->func = SMB2_sess_auth_rawntlmssp_negotiate;break ;default :@@ -1884,7 +1884,7 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree, !smb3_encryption_required (tcon) && !(ses->session_flags & (SMB2_SESSION_FLAG_IS_GUEST |SMB2_SESSION_FLAG_IS_NULL )) && - ((ses->user_name != NULL) || (ses->sectype == Kerberos))) + ((ses->user_name != NULL) || (ses->sectype == CIFS_SECTYPE_KERBEROS))) req->hdr.Flags |= SMB2_FLAGS_SIGNED;memset (&rqst,0 ,sizeof (struct smb_rqst ));@@ -3873,7 +3873,7 @@ void smb2_reconnect_server(struct work_struct *work) goto done; } - tcon->status =TID_GOOD ; + tcon->status =CIFS_STATUS_GOOD ; tcon->retry = false; tcon->need_reconnect = false;fs/cifs/smb2proto.h +2
-2@@ -260,8 +260,8 @@ extern int SMB2_lease_break(const unsigned int xid, struct cifs_tcon *tcon, __u8 *lease_key, const __le32 lease_state);extern int smb3_validate_negotiate (const unsigned int ,struct cifs_tcon *); -extern enum securityEnum smb2_select_sectype (struct cifs_server_info *, -enum securityEnum ); +extern int smb2_select_sectype (struct cifs_server_info *, +int ); extern void smb2_parse_contexts(struct cifs_server_info *server, struct smb2_create_rsp *rsp, unsigned int *epoch, char *lease_key,fs/cifs/smb2transport.c +6
-6@@ -763,24 +763,24 @@ 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 ==CIFS_STATUS_EXITING ) {spin_unlock (&g_servers_lock);return -ENOENT ; } -if (server->status == CifsNeedReconnect) { +if (server->status ==CIFS_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 ==CIFS_STATUS_NEED_NEGOTIATE && shdr->Command !=SMB2_NEGOTIATE ) {spin_unlock (&g_servers_lock);return -EAGAIN ; } -if (ses->ses_status ==SES_NEW ) { +if (ses->status ==CIFS_STATUS_NEW ) {if ((shdr->Command !=SMB2_SESSION_SETUP ) && (shdr->Command !=SMB2_NEGOTIATE )) {spin_unlock (&g_servers_lock);@@ -789,7 +789,7 @@ smb2_get_mid_entry(struct cifs_ses *ses, struct cifs_server_info *server,/* else ok - we are setting up session */ } -if (ses->ses_status ==SES_EXITING ) { +if (ses->status ==CIFS_STATUS_EXITING ) {if (shdr->Command !=SMB2_LOGOFF ) {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 ==CIFS_STATUS_NEED_NEGOTIATE && shdr->Command !=SMB2_NEGOTIATE ) {spin_unlock (&g_servers_lock);return ERR_PTR (-EAGAIN );fs/cifs/transport.c +12
-13@@ -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 ==CIFS_STATUS_EXITING ) {spin_unlock (&g_servers_lock);return -ENOENT ; }@@ -726,7 +726,7 @@ static int allocate_mid(struct cifs_ses *ses, struct smb_hdr *in_buf, struct mid_q_entry **ppmidQ) {spin_lock (&g_servers_lock); -if (ses->ses_status ==SES_NEW ) { +if (ses->status ==CIFS_STATUS_NEW ) {if ((in_buf->Command !=SMB_COM_SESSION_SETUP_ANDX ) && (in_buf->Command !=SMB_COM_NEGOTIATE )) {spin_unlock (&g_servers_lock);@@ -735,7 +735,7 @@ static int allocate_mid(struct cifs_ses *ses, struct smb_hdr *in_buf,/* else ok - we are setting up session */ } -if (ses->ses_status ==SES_EXITING ) { +if (ses->status ==CIFS_STATUS_EXITING ) {/* check if SMB session is bad because we are setting it up */ if (in_buf->Command !=SMB_COM_LOGOFF_ANDX ) {spin_unlock (&g_servers_lock);@@ -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 ==CIFS_STATUS_EXITING ) {spin_unlock (&g_servers_lock);return -ENOENT ; }@@ -1187,7 +1187,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,* Compounding is never used during session establish. */ spin_lock (&g_servers_lock); -if ((ses->ses_status ==SES_NEW ) || (optype &CIFS_NEG_OP ) || (optype &CIFS_SESS_OP )) { +if ((ses->status ==CIFS_STATUS_NEW ) || (optype &CIFS_NEG_OP ) || (optype &CIFS_SESS_OP )) {spin_unlock (&g_servers_lock);cifs_server_lock (server);@@ -1260,7 +1260,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,* Compounding is never used during session establish. */ spin_lock (&g_servers_lock); -if ((ses->ses_status ==SES_NEW ) || (optype &CIFS_NEG_OP ) || (optype &CIFS_SESS_OP )) { +if ((ses->status ==CIFS_STATUS_NEW ) || (optype &CIFS_NEG_OP ) || (optype &CIFS_SESS_OP )) {struct kvec iov = { .iov_base = resp_iov[0 ].iov_base, .iov_len = resp_iov[0 ].iov_len@@ -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 ==CIFS_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 ==CIFS_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 !=CIFS_STATUS_GOOD ) && + (server->status !=CIFS_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 ==CIFS_STATUS_GOOD ) || + (server->status ==CIFS_STATUS_NEW ))) {spin_unlock (&g_servers_lock);if (in_buf->Command ==SMB_COM_TRANSACTION2 ) { --2.35.3
Signature · 3 lines
Thanks, Steve
Re: [RFC PATCH v2 06/10] cifs: change status and security types enums to constants
Quoted 4 lines · Steve French
enums for status seem safer since it will prevent coding errors when
we set invalid status values for the various status enums. There are
subtle differences between the valid status states of socket, server channel, session and tcon.
Noted.
As for server (socket), channel, session, tcon, I didn't spot any obvious difference in the values used.
One could infer the meaning from context, e.g. I know that "ses->status == CIFS_STATUS_NEW" is different from "server->status == CIFS_STATUS_NEW" because when I see the former, I know there's already a valid "server".
Doesn't that make sense?
Quoted 1,393 lines · Enzo Matsumiya
Quoted 1,386 lines
Change server, tcon, and session status, and security types enums to constants integers.
Since some of the status values were common between server, tcon, and session, define a "generic" status code instead of having specific enums for each data structure.
Signed-off-by Enzo Matsumiya <[email protected]>--- fs/cifs/cifs_debug.c | 4 +- fs/cifs/cifs_swn.c | 8 +-- fs/cifs/cifsencrypt.c | 2 +- fs/cifs/cifsfs.c | 14 ++-- fs/cifs/cifsglob.h | 82 +++++++++-------------- fs/cifs/cifsproto.h | 6 +- fs/cifs/cifssmb.c | 26 ++++---- fs/cifs/connect.c | 144 ++++++++++++++++++++-------------------- fs/cifs/fs_context.c | 8 +-- fs/cifs/fs_context.h | 2 +- fs/cifs/misc.c | 4 +- fs/cifs/sess.c | 32 ++++----- fs/cifs/smb1ops.c | 2 +- fs/cifs/smb2ops.c | 8 +-- fs/cifs/smb2pdu.c | 44 ++++++------ fs/cifs/smb2proto.h | 4 +- fs/cifs/smb2transport.c | 12 ++-- fs/cifs/transport.c | 24 +++---- 18 files changed, 203 insertions(+), 223 deletions(-)fs/cifs/cifs_debug.c +2
-2@@ -382,7 +382,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v) (ses->serverNOS == NULL)) {seq_printf (m,"\n\t%d) Address: %s Uses: %d Capability: 0x%x\tSession Status: %d " , i, ses->ip_addr, ses->ses_count, - ses->capabilities, ses->ses_status); + ses->capabilities, ses->status);if (ses->session_flags &SMB2_SESSION_FLAG_IS_GUEST )seq_printf (m,"Guest " );else if (ses->session_flags &SMB2_SESSION_FLAG_IS_NULL )@@ -394,7 +394,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)"\n\tSMB session status: %d " , i, ses->ip_addr, ses->serverDomain, ses->ses_count, ses->serverOS, ses->serverNOS, - ses->capabilities, ses->ses_status); + ses->capabilities, ses->status); } seq_printf(m, "\n\tSecurity type: %s ",fs/cifs/cifs_swn.c +4
-4@@ -77,7 +77,7 @@ static int cifs_swn_send_register_message(struct cifs_swn_reg *swnreg) {struct sk_buff *skb;struct genlmsghdr *hdr; -enum securityEnum authtype; +int authtype;struct sockaddr_storage *addr;int ret;@@ -140,15 +140,15 @@ static int cifs_swn_send_register_message(struct cifs_swn_reg *swnreg) authtype =cifs_select_sectype (swnreg->tcon->ses->server, swnreg->tcon->ses->sectype);switch (authtype) { -case Kerberos: +case CIFS_SECTYPE_KERBEROS : ret =cifs_swn_auth_info_krb (swnreg->tcon, skb);if (ret <0 ) {cifs_dbg (VFS ,"%s: Failed to get kerberos auth info: %d\n" , __func__, ret); goto nlmsg_fail; }break ; -case NTLMv2: -case RawNTLMSSP: +case CIFS_SECTYPE_NTLMV2 : +case CIFS_SECTYPE_RAW_NTLMSSP : ret =cifs_swn_auth_info_ntlm (swnreg->tcon, skb);if (ret <0 ) {cifs_dbg (VFS ,"%s: Failed to get NTLM auth info: %d\n" , __func__, ret);fs/cifs/cifsencrypt.c +1
-1@@ -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 ==CIFS_STATUS_NEED_NEGOTIATE ) {spin_unlock (&g_servers_lock);return rc; }fs/cifs/cifsfs.c +7
-7@@ -449,7 +449,7 @@ cifs_show_address(struct seq_file *s, struct cifs_server_info *server)static void cifs_show_security (struct seq_file *s,struct cifs_ses *ses) { -if (ses->sectype == Unspecified) { +if (ses->sectype ==CIFS_SECTYPE_UNSPEC ) {if (ses->user_name ==NULL )seq_puts (s,",sec=none" );return ;@@ -458,13 +458,13 @@ cifs_show_security(struct seq_file *s, struct cifs_ses *ses)seq_puts (s,",sec=" );switch (ses->sectype) { -case NTLMv2: +case CIFS_SECTYPE_NTLMV2 :seq_puts (s,"ntlmv2" );break ; -case Kerberos: +case CIFS_SECTYPE_KERBEROS :seq_puts (s,"krb5" );break ; -case RawNTLMSSP: +case CIFS_SECTYPE_RAW_NTLMSSP :seq_puts (s,"ntlmssp" );break ;default :@@ -476,7 +476,7 @@ cifs_show_security(struct seq_file *s, struct cifs_ses *ses)if (ses->sign)seq_puts (s,"i" ); -if (ses->sectype == Kerberos) +if (ses->sectype ==CIFS_SECTYPE_KERBEROS )seq_printf (s,",cruid=%u" ,from_kuid_munged (&init_user_ns, ses->cred_uid)); }@@ -712,14 +712,14 @@ static void cifs_umount_begin(struct super_block *sb) tcon =cifs_sb_master_tcon (cifs_sb);spin_lock (&g_servers_lock); -if ((tcon->tc_count >1 ) || (tcon->status ==TID_EXITING )) { +if ((tcon->tc_count >1 ) || (tcon->status ==CIFS_STATUS_EXITING )) {/* we have other mounts to same share or we have already tried to force umount this and woken up all waiting network requests, nothing to do */ spin_unlock (&g_servers_lock);return ; }else if (tcon->tc_count ==1 ) - tcon->status =TID_EXITING ; + tcon->status =CIFS_STATUS_EXITING ;spin_unlock (&g_servers_lock);/* cancel_brl_requests(tcon); */ /* BB mark all brl mids as exiting */ fs/cifs/cifsglob.h +32
-50@@ -25,6 +25,7 @@#include <uapi/linux/cifs/cifs_mount.h> #include "../smbfs_common/smb2pdu.h" #include "smb2pdu.h" +#include "cifspdu.h" #define SMB_PATH_MAX 260#define CIFS_PORT 445@@ -107,46 +108,27 @@#define CIFS_MAX_WORKSTATION_LEN (__NEW_UTS_LEN + 1)/* reasonable max for client */ /* -* CIFS vfs client Status information (based on what we know.) +* Status information */ +#define CIFS_STATUS_NEW 0x0/* server, ses, tcon */ +#define CIFS_STATUS_GOOD 0x1/* server, ses, tcon */ +#define CIFS_STATUS_EXITING 0x2/* server, ses, tcon */ +#define CIFS_STATUS_NEED_RECONNECT 0x3/* server, ses, tcon */ +#define CIFS_STATUS_NEED_NEGOTIATE 0x4/* server */ +#define CIFS_STATUS_NEED_TCON 0x5/* tcon */ +#define CIFS_STATUS_IN_NEGOTIATE 0x6/* server */ +#define CIFS_STATUS_IN_SETUP 0x7/* ses */ +#define CIFS_STATUS_IN_TCON 0x8/* tcon */ +#define CIFS_STATUS_NEED_FILES_INVALIDATE 0x9/* ses */ +#define CIFS_STATUS_IN_FILES_INVALIDATE 0xa/* ses */ -/* associated with each connection */ -enum statusEnum { - CifsNew =0 , - CifsGood, - CifsExiting, - CifsNeedReconnect, - CifsNeedNegotiate, - CifsInNegotiate, -}; - -/* associated with each smb session */ -enum ses_status_enum { -SES_NEW =0 , -SES_GOOD , -SES_EXITING , -SES_NEED_RECON , -SES_IN_SETUP -}; - -/* associated with each tree connection to the server */ -enum tid_status_enum { -TID_NEW =0 , -TID_GOOD , -TID_EXITING , -TID_NEED_RECON , -TID_NEED_TCON , -TID_IN_TCON , -TID_NEED_FILES_INVALIDATE ,/* currently unused */ -TID_IN_FILES_INVALIDATE -}; - -enum securityEnum { - Unspecified =0 ,/* not specified */ - NTLMv2,/* Legacy NTLM auth with NTLMv2 hash */ - RawNTLMSSP,/* NTLMSSP without SPNEGO, NTLMv2 hash */ - Kerberos,/* Kerberos via SPNEGO */ -}; +/* +* Security types +*/ +#define CIFS_SECTYPE_UNSPEC 0x0/* not specified */ +#define CIFS_SECTYPE_NTLMV2 0x1/* Legacy NTLM auth with NTLMv2 hash */ +#define CIFS_SECTYPE_RAW_NTLMSSP 0x2/* NTLMSSP without SPNEGO, NTLMv2 hash */ +#define CIFS_SECTYPE_KERBEROS 0x3/* Kerberos via SPNEGO */ struct session_key {unsigned int len;@@ -506,8 +488,8 @@ struct smb_version_operations {int (*is_transform_hdr)(void *buf);int (*receive_transform)(struct cifs_server_info *,struct mid_q_entry **,char **,int *); -enum securityEnum (*select_sectype)(struct cifs_server_info *, -enum securityEnum ); +int (*select_sectype)(struct cifs_server_info *, +int );int (*next_header)(char *);/* ioctl passthrough for query_info */ int (*ioctl_query_info)(const unsigned int xid,@@ -612,7 +594,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 */ +int status;/* what we think the status is */ char *hostname;/* hostname portion of UNC string */ struct socket *ssocket;struct sockaddr_storage dstaddr;@@ -1011,7 +993,7 @@ struct cifs_ses {struct mutex session_mutex;struct cifs_server_info *server;/* pointer to server info */ int ses_count;/* reference counter */ -enum ses_status_enum ses_status;/* updates protected by g_servers_lock */ +int status;/* updates protected by g_servers_lock */ unsigned overrideSecFlg;/* if non-zero override global sec flags */ char *serverOS;/* name of operating system underlying server */ char *serverNOS;/* name of network operating system of server */ @@ -1028,7 +1010,7 @@ struct cifs_ses {char workstation_name[CIFS_MAX_WORKSTATION_LEN ];struct session_key auth_key;struct ntlmssp_auth *ntlmssp;/* ciphertext, flags, server challenge */ -enum securityEnum sectype;/* what security flavor was specified? */ +int sectype;/* what security flavor was specified? */ bool sign;/* is signing required? */ bool domainAuto:1;__u16 session_flags;@@ -1179,7 +1161,7 @@ struct cifs_tcon {char *password;/* for share-level security */ __u32 tid;/* The 4 byte tree id */ __u16 Flags;/* optional support bits */ -enum tid_status_enum status; +int status;atomic_t num_smbs_sent; union { struct {@@ -1948,7 +1930,7 @@ extern struct list_head g_servers_list;* tcp session, and the list of tcon's per smb session. It also protects * the reference counters for the server, smb session, and tcon. It also * protects some fields in the cifs_server_info struct such as dstaddr. Finally, -* changes to the tcon->tidStatus should be done while holding this lock. +* changes to the tcon->status should be done while holding this lock. * generally the locks should be taken in order g_servers_lock before * tcon->open_file_lock and that before file->file_info_lock since the * structure order is cifs_socket-->cifs_ses-->cifs_tcon-->cifs_file @@ -2041,14 +2023,14 @@ extern struct smb_version_values smb302_values;extern struct smb_version_operations smb311_operations;extern struct smb_version_values smb311_values; -static inline char *get_security_type_str (enum securityEnum sectype) +static inline char *get_security_type_str (int sectype) {switch (sectype) { -case RawNTLMSSP: -return "RawNTLMSSP" ; -case Kerberos: +case CIFS_SECTYPE_RAW_NTLMSSP : +return "CIFS_SECTYPE_RAW_NTLMSSP" ; +case CIFS_SECTYPE_KERBEROS :return "Kerberos" ; -case NTLMv2: +case CIFS_SECTYPE_NTLMV2 :return "NTLMv2" ;default :return "Unknown" ;fs/cifs/cifsproto.h +2
-4@@ -168,8 +168,7 @@ extern void header_assemble(struct smb_hdr *, char /* command */ ,extern int small_smb_init_no_tc (const int smb_cmd,const int wct,struct cifs_ses *ses,void **request_buf); -extern enum securityEnum select_sectype (struct cifs_server_info *server, -enum securityEnum requested); +extern int select_sectype (struct cifs_server_info *server,int requested);extern int CIFS_SessSetup (const unsigned int xid,struct cifs_ses *ses,struct cifs_server_info *server,const struct nls_table *nls_cp);@@ -594,8 +593,7 @@ int cifs_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,int __cifs_calc_signature (struct smb_rqst *rqst,struct cifs_server_info *server,char *signature,struct shash_desc *shash); -enum securityEnum cifs_select_sectype (struct cifs_server_info *, -enum securityEnum ); +int cifs_select_sectype (struct cifs_server_info *,int );struct cifs_aio_ctx *cifs_aio_ctx_alloc (void );void cifs_aio_ctx_release (struct kref *refcount);int setup_aio_ctx_iter (struct cifs_aio_ctx *ctx,struct iov_iter *iter,int rw);fs/cifs/cifssmb.c +13
-13@@ -75,11 +75,11 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon)/* only send once per connect */ spin_lock (&g_servers_lock); -if ((tcon->ses->ses_status !=SES_GOOD ) || (tcon->status !=TID_NEED_RECON )) { +if ((tcon->ses->status !=CIFS_STATUS_GOOD ) || (tcon->status !=CIFS_STATUS_NEED_RECONNECT )) {spin_unlock (&g_servers_lock);return ; } - tcon->status =TID_IN_FILES_INVALIDATE ; + tcon->status =CIFS_STATUS_IN_FILES_INVALIDATE ;spin_unlock (&g_servers_lock);/* list all files open on tree connection and mark them invalid */ @@ -99,8 +99,8 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon)mutex_unlock (&tcon->crfid.fid_mutex);spin_lock (&g_servers_lock); -if (tcon->status ==TID_IN_FILES_INVALIDATE ) - tcon->status =TID_NEED_TCON ; +if (tcon->status ==CIFS_STATUS_IN_FILES_INVALIDATE ) + tcon->status =CIFS_STATUS_NEED_TCON ;spin_unlock (&g_servers_lock);/* @@ -135,7 +135,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)* have tcon) are allowed as we start force umount */ spin_lock (&g_servers_lock); -if (tcon->status ==TID_EXITING ) { +if (tcon->status ==CIFS_STATUS_EXITING ) {if (smb_command !=SMB_COM_WRITE_ANDX && smb_command !=SMB_COM_OPEN_ANDX && smb_command !=SMB_COM_TREE_DISCONNECT ) {@@ -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 ==CIFS_STATUS_NEED_RECONNECT ) { rc =wait_event_interruptible_timeout (server->response_q, - (server->status != CifsNeedReconnect), + (server->status !=CIFS_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 !=CIFS_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 ==CIFS_STATUS_NEED_RECONNECT ) {spin_unlock (&g_servers_lock); rc = -EHOSTDOWN ; goto out;@@ -504,13 +504,13 @@ cifs_enable_signing(struct cifs_server_info *server, bool mnt_sign_required) }static bool -should_set_ext_sec_flag (enum securityEnum sectype) +should_set_ext_sec_flag (int sectype) {switch (sectype) { -case RawNTLMSSP: -case Kerberos: +case CIFS_SECTYPE_RAW_NTLMSSP : +case CIFS_SECTYPE_KERBEROS :return true; -case Unspecified: +case CIFS_SECTYPE_UNSPEC :if (global_secflags & (CIFSSEC_MAY_KRB5 |CIFSSEC_MAY_NTLMSSP ))return true;fs/cifs/connect.c +72
-72@@ -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 =CIFS_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 =CIFS_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 CIFS_STATUS_NEED_RECONNECT. * @mark_smb_session: whether even sessions need to be marked */ void @@ -277,11 +277,11 @@ cifs_mark_server_conns_for_reconnect(struct cifs_server_info *server,if (!mark_smb_session && !CIFS_ALL_CHANS_NEED_RECONNECT (ses)) goto next_session; - ses->ses_status =SES_NEED_RECON ; + ses->status =CIFS_STATUS_NEED_RECONNECT ;list_for_each_entry (tcon, &ses->tcon_list, tcon_list) { tcon->need_reconnect = true; - tcon->status =TID_NEED_RECON ; + tcon->status =CIFS_STATUS_NEED_RECONNECT ; }if (ses->tcon_ipc) ses->tcon_ipc->need_reconnect = true;@@ -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 ==CIFS_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 numcifs_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 =CIFS_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 !=CIFS_STATUS_EXITING ) + server->status =CIFS_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 ==CIFS_STATUS_NEED_RECONNECT );spin_lock (&g_servers_lock); -if (server->status == CifsNeedNegotiate) +if (server->status ==CIFS_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 CIFS_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 !=CIFS_STATUS_EXITING ) + server->status =CIFS_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 ==CIFS_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 ==CIFS_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 ==CIFS_STATUS_NEED_RECONNECT || + server->status ==CIFS_STATUS_EXITING || + server->status ==CIFS_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 ==CIFS_STATUS_GOOD || + server->status ==CIFS_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 ==CIFS_STATUS_EXITING ) {spin_unlock (&g_servers_lock);return -ESHUTDOWN ; } -if (server->status == CifsNeedReconnect) { +if (server->status ==CIFS_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. +* CIFS_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 =CIFS_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 !=CIFS_STATUS_EXITING ) {if (try_to_freeze ())continue ;@@ -1392,11 +1392,11 @@ match_security(struct cifs_server_info *server, struct smb3_fs_context *ctx) {/* * The select_sectype function should either return the ctx->sectype -* that was specified, or "Unspecified" if that sectype was not +* that was specified, or "CIFS_SECTYPE_UNSPEC" if that sectype was not * compatible with the given NEGOTIATE request. */ if (server->ops->select_sectype (server, ctx->sectype) - == Unspecified) + ==CIFS_SECTYPE_UNSPEC )return false;/* @@ -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 =CIFS_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 =CIFS_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 =CIFS_STATUS_NEED_NEGOTIATE ;spin_unlock (&g_servers_lock);if ((ctx->max_credits <20 ) || (ctx->max_credits >60000 ))@@ -1730,7 +1730,7 @@ cifs_get_server(struct smb3_fs_context *ctx,static int match_session (struct cifs_ses *ses,struct smb3_fs_context *ctx) { -if (ctx->sectype != Unspecified && +if (ctx->sectype !=CIFS_SECTYPE_UNSPEC && ctx->sectype != ses->sectype)return 0 ;@@ -1746,7 +1746,7 @@ static int match_session(struct cifs_ses *ses, struct smb3_fs_context *ctx)spin_unlock (&ses->chan_lock);switch (ses->sectype) { -case Kerberos: +case CIFS_SECTYPE_KERBEROS :if (!uid_eq (ctx->cred_uid, ses->cred_uid))return 0 ;break ;@@ -1863,7 +1863,7 @@ cifs_find_smb_ses(struct cifs_server_info *server, struct smb3_fs_context *ctx)spin_lock (&g_servers_lock);list_for_each_entry (ses, &server->smb_ses_list, smb_ses_list) { -if (ses->ses_status ==SES_EXITING ) +if (ses->status ==CIFS_STATUS_EXITING )continue ;if (!match_session (ses, ctx))continue ;@@ -1882,7 +1882,7 @@ void cifs_put_smb_ses(struct cifs_ses *ses)struct cifs_server_info *server = ses->server;spin_lock (&g_servers_lock); -if (ses->ses_status ==SES_EXITING ) { +if (ses->status ==CIFS_STATUS_EXITING ) {spin_unlock (&g_servers_lock);return ; }@@ -1898,13 +1898,13 @@ void cifs_put_smb_ses(struct cifs_ses *ses)/* ses_count can never go negative */ WARN_ON (ses->ses_count <0 ); -if (ses->ses_status ==SES_GOOD ) - ses->ses_status =SES_EXITING ; +if (ses->status ==CIFS_STATUS_GOOD ) + ses->status =CIFS_STATUS_EXITING ;spin_unlock (&g_servers_lock);cifs_free_ipc (ses); -if (ses->ses_status ==SES_EXITING && server->ops->logoff) { +if (ses->status ==CIFS_STATUS_EXITING && server->ops->logoff) { xid =get_xid (); rc = server->ops->logoff (xid, ses);if (rc)@@ -2113,7 +2113,7 @@ cifs_get_smb_ses(struct cifs_server_info *server, struct smb3_fs_context *ctx) ses =cifs_find_smb_ses (server, ctx);if (ses) {cifs_dbg (FYI ,"Existing smb sess found (status=%d)\n" , - ses->ses_status); + ses->status);spin_lock (&ses->chan_lock);if (cifs_chan_needs_reconnect (ses, server)) {@@ -2237,7 +2237,7 @@ cifs_get_smb_ses(struct cifs_server_info *server, struct smb3_fs_context *ctx)static int match_tcon (struct cifs_tcon *tcon,struct smb3_fs_context *ctx) { -if (tcon->status ==TID_EXITING ) +if (tcon->status ==CIFS_STATUS_EXITING )return 0 ;if (strncmp (tcon->treeName, ctx->UNC,MAX_TREE_SIZE ))return 0 ;@@ -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 ==CIFS_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 !=CIFS_STATUS_NEED_NEGOTIATE ) {spin_unlock (&g_servers_lock);return 0 ; } - server->status = CifsInNegotiate; + server->status =CIFS_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 ==CIFS_STATUS_IN_NEGOTIATE ) + server->status =CIFS_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 ==CIFS_STATUS_IN_NEGOTIATE ) + server->status =CIFS_STATUS_NEED_NEGOTIATE ;spin_unlock (&g_servers_lock); }@@ -4029,9 +4029,9 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,else scnprintf (ses->ip_addr,sizeof (ses->ip_addr),"%pI4" , &addr->sin_addr); -if (ses->ses_status !=SES_GOOD && - ses->ses_status !=SES_NEW && - ses->ses_status !=SES_NEED_RECON ) { +if (ses->status !=CIFS_STATUS_GOOD && + ses->status !=CIFS_STATUS_NEW && + ses->status !=CIFS_STATUS_NEED_RECONNECT ) {spin_unlock (&g_servers_lock);return 0 ; }@@ -4049,7 +4049,7 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,spin_unlock (&ses->chan_lock);if (!is_binding) - ses->ses_status =SES_IN_SETUP ; + ses->status =CIFS_STATUS_IN_SETUP ;spin_unlock (&g_servers_lock);if (!is_binding) {@@ -4075,16 +4075,16 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,if (rc) {cifs_server_dbg (VFS ,"Send error in SessSetup = %d\n" , rc);spin_lock (&g_servers_lock); -if (ses->ses_status ==SES_IN_SETUP ) - ses->ses_status =SES_NEED_RECON ; +if (ses->status ==CIFS_STATUS_IN_SETUP ) + ses->status =CIFS_STATUS_NEED_RECONNECT ;spin_lock (&ses->chan_lock);cifs_chan_clear_in_reconnect (ses, server);spin_unlock (&ses->chan_lock);spin_unlock (&g_servers_lock); }else {spin_lock (&g_servers_lock); -if (ses->ses_status ==SES_IN_SETUP ) - ses->ses_status =SES_GOOD ; +if (ses->status ==CIFS_STATUS_IN_SETUP ) + ses->status =CIFS_STATUS_GOOD ;spin_lock (&ses->chan_lock);cifs_chan_clear_in_reconnect (ses, server);cifs_chan_clear_need_reconnect (ses, server);@@ -4101,7 +4101,7 @@ cifs_set_vol_auth(struct smb3_fs_context *ctx, struct cifs_ses *ses) ctx->sectype = ses->sectype;/* krb5 is special, since we don't need username or pw */ -if (ctx->sectype == Kerberos) +if (ctx->sectype ==CIFS_SECTYPE_KERBEROS )return 0 ;return cifs_set_cifscreds (ctx, ses);@@ -4559,13 +4559,13 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru/* only send once per connect */ spin_lock (&g_servers_lock); -if (tcon->ses->ses_status !=SES_GOOD || - (tcon->status !=TID_NEW && - tcon->status !=TID_NEED_TCON )) { +if (tcon->ses->status !=CIFS_STATUS_GOOD || + (tcon->status !=CIFS_STATUS_NEW && + tcon->status !=CIFS_STATUS_NEED_TCON )) {spin_unlock (&g_servers_lock);return 0 ; } - tcon->status =TID_IN_TCON ; + tcon->status =CIFS_STATUS_IN_TCON ;spin_unlock (&g_servers_lock); tree =kzalloc (MAX_TREE_SIZE ,GFP_KERNEL );@@ -4606,13 +4606,13 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const struif (rc) {spin_lock (&g_servers_lock); -if (tcon->status ==TID_IN_TCON ) - tcon->status =TID_NEED_TCON ; +if (tcon->status ==CIFS_STATUS_IN_TCON ) + tcon->status =CIFS_STATUS_NEED_TCON ;spin_unlock (&g_servers_lock); }else {spin_lock (&g_servers_lock); -if (tcon->status ==TID_IN_TCON ) - tcon->status =TID_GOOD ; +if (tcon->status ==CIFS_STATUS_IN_TCON ) + tcon->status =CIFS_STATUS_GOOD ;spin_unlock (&g_servers_lock); tcon->need_reconnect = false; }@@ -4627,25 +4627,25 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru/* only send once per connect */ spin_lock (&g_servers_lock); -if (tcon->ses->ses_status !=SES_GOOD || - (tcon->status !=TID_NEW && - tcon->status !=TID_NEED_TCON )) { +if (tcon->ses->status !=CIFS_STATUS_GOOD || + (tcon->status !=CIFS_STATUS_NEW && + tcon->status !=CIFS_STATUS_NEED_TCON )) {spin_unlock (&g_servers_lock);return 0 ; } - tcon->status =TID_IN_TCON ; + tcon->status =CIFS_STATUS_IN_TCON ;spin_unlock (&g_servers_lock); rc = ops->tree_connect (xid, tcon->ses, tcon->treeName, tcon, nlsc);if (rc) {spin_lock (&g_servers_lock); -if (tcon->status ==TID_IN_TCON ) - tcon->status =TID_NEED_TCON ; +if (tcon->status ==CIFS_STATUS_IN_TCON ) + tcon->status =CIFS_STATUS_NEED_TCON ;spin_unlock (&g_servers_lock); }else {spin_lock (&g_servers_lock); -if (tcon->status ==TID_IN_TCON ) - tcon->status =TID_GOOD ; +if (tcon->status ==CIFS_STATUS_IN_TCON ) + tcon->status =CIFS_STATUS_GOOD ;spin_unlock (&g_servers_lock); tcon->need_reconnect = false; }fs/cifs/fs_context.c +4
-4@@ -203,7 +203,7 @@ cifs_parse_security_flavors(struct fs_context *fc, char *value, struct smb3_fs_c* With mount options, the last one should win. Reset any existing * settings back to default. */ - ctx->sectype = Unspecified; + ctx->sectype =CIFS_SECTYPE_UNSPEC ; ctx->sign = false;switch (match_token (value, cifs_secflavor_tokens, args)) {@@ -214,19 +214,19 @@ cifs_parse_security_flavors(struct fs_context *fc, char *value, struct smb3_fs_c ctx->sign = true; fallthrough;case Opt_sec_krb5: - ctx->sectype = Kerberos; + ctx->sectype =CIFS_SECTYPE_KERBEROS ;break ;case Opt_sec_ntlmsspi: ctx->sign = true; fallthrough;case Opt_sec_ntlmssp: - ctx->sectype = RawNTLMSSP; + ctx->sectype =CIFS_SECTYPE_RAW_NTLMSSP ;break ;case Opt_sec_ntlmv2i: ctx->sign = true; fallthrough;case Opt_sec_ntlmv2: - ctx->sectype = NTLMv2; + ctx->sectype =CIFS_SECTYPE_NTLMV2 ;break ;case Opt_sec_none: ctx->nullauth =1 ;fs/cifs/fs_context.h +1
-1@@ -182,7 +182,7 @@ struct smb3_fs_context {kgid_t backupgid;umode_t file_mode;umode_t dir_mode; -enum securityEnum sectype;/* sectype requested via mnt opts */ +int sectype;/* sectype requested via mnt opts */ bool sign;/* was signing requested via mnt opts? */ bool ignore_signature:1; bool retry:1;fs/cifs/misc.c +2
-2@@ -69,7 +69,7 @@ sesInfoAlloc(void) ret_buf =kzalloc (sizeof (struct cifs_ses ),GFP_KERNEL );if (ret_buf) {atomic_inc (&g_ses_alloc_count); - ret_buf->ses_status =SES_NEW ; + ret_buf->status =CIFS_STATUS_NEW ; ++ret_buf->ses_count;INIT_LIST_HEAD (&ret_buf->smb_ses_list);INIT_LIST_HEAD (&ret_buf->tcon_list);@@ -124,7 +124,7 @@ tconInfoAlloc(void)mutex_init (&ret_buf->crfid.dirents.de_mutex);atomic_inc (&g_tcon_alloc_count); - ret_buf->status =TID_NEW ; + ret_buf->status =CIFS_STATUS_NEW ; ++ret_buf->tc_count;INIT_LIST_HEAD (&ret_buf->openFileList);INIT_LIST_HEAD (&ret_buf->tcon_list);fs/cifs/sess.c +16
-16@@ -1114,40 +1114,40 @@ int build_ntlmssp_auth_blob(unsigned char **pbuffer,return rc; } -enum securityEnum -cifs_select_sectype (struct cifs_server_info *server,enum securityEnum requested) +int +cifs_select_sectype (struct cifs_server_info *server,int requested) {switch (server->negflavor) {case CIFS_NEGFLAVOR_EXTENDED :switch (requested) { -case Kerberos: -case RawNTLMSSP: +case CIFS_SECTYPE_KERBEROS : +case CIFS_SECTYPE_RAW_NTLMSSP :return requested; -case Unspecified: +case CIFS_SECTYPE_UNSPEC :if (server->sec_ntlmssp && (global_secflags &CIFSSEC_MAY_NTLMSSP )) -return RawNTLMSSP; +return CIFS_SECTYPE_RAW_NTLMSSP ;if ((server->sec_kerberos || server->sec_mskerberos) && (global_secflags &CIFSSEC_MAY_KRB5 )) -return Kerberos; +return CIFS_SECTYPE_KERBEROS ; fallthrough;default : -return Unspecified; +return CIFS_SECTYPE_UNSPEC ; }case CIFS_NEGFLAVOR_UNENCAP :switch (requested) { -case NTLMv2: +case CIFS_SECTYPE_NTLMV2 :return requested; -case Unspecified: +case CIFS_SECTYPE_UNSPEC :if (global_secflags &CIFSSEC_MAY_NTLMV2 ) -return NTLMv2; +return CIFS_SECTYPE_NTLMV2 ;break ;default :break ; } fallthrough;default : -return Unspecified; +return CIFS_SECTYPE_UNSPEC ; } }@@ -1782,16 +1782,16 @@ static int select_sec(struct sess_data *sess_data) type =cifs_select_sectype (server, ses->sectype);cifs_dbg (FYI ,"sess setup type %d\n" , type); -if (type == Unspecified) { +if (type ==CIFS_SECTYPE_UNSPEC ) {cifs_dbg (VFS ,"Unable to select appropriate authentication method!\n" );return -EINVAL ; }switch (type) { -case NTLMv2: +case CIFS_SECTYPE_NTLMV2 : sess_data->func = sess_auth_ntlmv2;break ; -case Kerberos: +case CIFS_SECTYPE_KERBEROS :#ifdef CONFIG_CIFS_UPCALL sess_data->func = sess_auth_kerberos;break ;@@ -1799,7 +1799,7 @@ static int select_sec(struct sess_data *sess_data)cifs_dbg (VFS ,"Kerberos negotiated but upcall support disabled!\n" );return -ENOSYS ;#endif /* CONFIG_CIFS_UPCALL */ -case RawNTLMSSP: +case CIFS_SECTYPE_RAW_NTLMSSP : sess_data->func = sess_auth_rawntlmssp_negotiate;break ;default :fs/cifs/smb1ops.c +1
-1@@ -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 ==CIFS_STATUS_GOOD )return true;return false;fs/cifs/smb2ops.c +4
-4@@ -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 ==CIFS_STATUS_NEED_RECONNECT + || server->status ==CIFS_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 ==CIFS_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 ==CIFS_STATUS_NEED_RECONNECT ) { mid->mid_state =MID_RETRY_NEEDED ;spin_unlock (&g_mid_lock);spin_unlock (&g_servers_lock);fs/cifs/smb2pdu.c +22
-22@@ -163,7 +163,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,return 0 ;spin_lock (&g_servers_lock); -if (tcon->status ==TID_EXITING ) { +if (tcon->status ==CIFS_STATUS_EXITING ) {/* * only tree disconnect, open, and write, * (and ulogoff which does not have tcon) @@ -179,7 +179,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon, } }spin_unlock (&g_servers_lock); -if ((!tcon->ses) || (tcon->ses->ses_status ==SES_EXITING ) || +if ((!tcon->ses) || (tcon->ses->status ==CIFS_STATUS_EXITING ) || (!tcon->ses->server) || !server)return -EIO ;@@ -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 ==CIFS_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 !=CIFS_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 !=CIFS_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 ==CIFS_STATUS_NEED_RECONNECT ) {spin_unlock (&g_servers_lock); rc = -EHOSTDOWN ; goto out;@@ -1056,7 +1056,7 @@ SMB2_negotiate(const unsigned int xid,/* * See MS-SMB2 section 2.2.4: if no blob, client picks default which * for us will be -* ses->sectype = RawNTLMSSP; +* ses->sectype = CIFS_SECTYPE_RAW_NTLMSSP; * but for time being this is our only auth choice so doesn't matter. * We just found a server which sets blob length to zero expecting raw. */ @@ -1227,25 +1227,25 @@ int smb3_validate_negotiate(const unsigned int xid, struct cifs_tcon *tcon)return rc; } -enum securityEnum -smb2_select_sectype (struct cifs_server_info *server,enum securityEnum requested) +int +smb2_select_sectype (struct cifs_server_info *server,int requested) {switch (requested) { -case Kerberos: -case RawNTLMSSP: +case CIFS_SECTYPE_KERBEROS : +case CIFS_SECTYPE_RAW_NTLMSSP :return requested; -case NTLMv2: -return RawNTLMSSP; -case Unspecified: +case CIFS_SECTYPE_NTLMV2 : +return CIFS_SECTYPE_RAW_NTLMSSP ; +case CIFS_SECTYPE_UNSPEC :if (server->sec_ntlmssp && (global_secflags &CIFSSEC_MAY_NTLMSSP )) -return RawNTLMSSP; +return CIFS_SECTYPE_RAW_NTLMSSP ;if ((server->sec_kerberos || server->sec_mskerberos) && (global_secflags &CIFSSEC_MAY_KRB5 )) -return Kerberos; +return CIFS_SECTYPE_KERBEROS ; fallthrough;default : -return Unspecified; +return CIFS_SECTYPE_UNSPEC ; } }@@ -1671,16 +1671,16 @@ SMB2_select_sec(struct SMB2_sess_data *sess_data) type =smb2_select_sectype (server, ses->sectype);cifs_dbg (FYI ,"sess setup type %d\n" , type); -if (type == Unspecified) { +if (type ==CIFS_SECTYPE_UNSPEC ) {cifs_dbg (VFS ,"Unable to select appropriate authentication method!\n" );return -EINVAL ; }switch (type) { -case Kerberos: +case CIFS_SECTYPE_KERBEROS : sess_data->func = SMB2_auth_kerberos;break ; -case RawNTLMSSP: +case CIFS_SECTYPE_RAW_NTLMSSP : sess_data->func = SMB2_sess_auth_rawntlmssp_negotiate;break ;default :@@ -1884,7 +1884,7 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree, !smb3_encryption_required (tcon) && !(ses->session_flags & (SMB2_SESSION_FLAG_IS_GUEST |SMB2_SESSION_FLAG_IS_NULL )) && - ((ses->user_name != NULL) || (ses->sectype == Kerberos))) + ((ses->user_name != NULL) || (ses->sectype == CIFS_SECTYPE_KERBEROS))) req->hdr.Flags |= SMB2_FLAGS_SIGNED;memset (&rqst,0 ,sizeof (struct smb_rqst ));@@ -3873,7 +3873,7 @@ void smb2_reconnect_server(struct work_struct *work) goto done; } - tcon->status =TID_GOOD ; + tcon->status =CIFS_STATUS_GOOD ; tcon->retry = false; tcon->need_reconnect = false;fs/cifs/smb2proto.h +2
-2@@ -260,8 +260,8 @@ extern int SMB2_lease_break(const unsigned int xid, struct cifs_tcon *tcon, __u8 *lease_key, const __le32 lease_state);extern int smb3_validate_negotiate (const unsigned int ,struct cifs_tcon *); -extern enum securityEnum smb2_select_sectype (struct cifs_server_info *, -enum securityEnum ); +extern int smb2_select_sectype (struct cifs_server_info *, +int ); extern void smb2_parse_contexts(struct cifs_server_info *server, struct smb2_create_rsp *rsp, unsigned int *epoch, char *lease_key,fs/cifs/smb2transport.c +6
-6@@ -763,24 +763,24 @@ 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 ==CIFS_STATUS_EXITING ) {spin_unlock (&g_servers_lock);return -ENOENT ; } -if (server->status == CifsNeedReconnect) { +if (server->status ==CIFS_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 ==CIFS_STATUS_NEED_NEGOTIATE && shdr->Command !=SMB2_NEGOTIATE ) {spin_unlock (&g_servers_lock);return -EAGAIN ; } -if (ses->ses_status ==SES_NEW ) { +if (ses->status ==CIFS_STATUS_NEW ) {if ((shdr->Command !=SMB2_SESSION_SETUP ) && (shdr->Command !=SMB2_NEGOTIATE )) {spin_unlock (&g_servers_lock);@@ -789,7 +789,7 @@ smb2_get_mid_entry(struct cifs_ses *ses, struct cifs_server_info *server,/* else ok - we are setting up session */ } -if (ses->ses_status ==SES_EXITING ) { +if (ses->status ==CIFS_STATUS_EXITING ) {if (shdr->Command !=SMB2_LOGOFF ) {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 ==CIFS_STATUS_NEED_NEGOTIATE && shdr->Command !=SMB2_NEGOTIATE ) {spin_unlock (&g_servers_lock);return ERR_PTR (-EAGAIN );fs/cifs/transport.c +12
-13@@ -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 ==CIFS_STATUS_EXITING ) {spin_unlock (&g_servers_lock);return -ENOENT ; }@@ -726,7 +726,7 @@ static int allocate_mid(struct cifs_ses *ses, struct smb_hdr *in_buf, struct mid_q_entry **ppmidQ) {spin_lock (&g_servers_lock); -if (ses->ses_status ==SES_NEW ) { +if (ses->status ==CIFS_STATUS_NEW ) {if ((in_buf->Command !=SMB_COM_SESSION_SETUP_ANDX ) && (in_buf->Command !=SMB_COM_NEGOTIATE )) {spin_unlock (&g_servers_lock);@@ -735,7 +735,7 @@ static int allocate_mid(struct cifs_ses *ses, struct smb_hdr *in_buf,/* else ok - we are setting up session */ } -if (ses->ses_status ==SES_EXITING ) { +if (ses->status ==CIFS_STATUS_EXITING ) {/* check if SMB session is bad because we are setting it up */ if (in_buf->Command !=SMB_COM_LOGOFF_ANDX ) {spin_unlock (&g_servers_lock);@@ -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 ==CIFS_STATUS_EXITING ) {spin_unlock (&g_servers_lock);return -ENOENT ; }@@ -1187,7 +1187,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,* Compounding is never used during session establish. */ spin_lock (&g_servers_lock); -if ((ses->ses_status ==SES_NEW ) || (optype &CIFS_NEG_OP ) || (optype &CIFS_SESS_OP )) { +if ((ses->status ==CIFS_STATUS_NEW ) || (optype &CIFS_NEG_OP ) || (optype &CIFS_SESS_OP )) {spin_unlock (&g_servers_lock);cifs_server_lock (server);@@ -1260,7 +1260,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,* Compounding is never used during session establish. */ spin_lock (&g_servers_lock); -if ((ses->ses_status ==SES_NEW ) || (optype &CIFS_NEG_OP ) || (optype &CIFS_SESS_OP )) { +if ((ses->status ==CIFS_STATUS_NEW ) || (optype &CIFS_NEG_OP ) || (optype &CIFS_SESS_OP )) {struct kvec iov = { .iov_base = resp_iov[0 ].iov_base, .iov_len = resp_iov[0 ].iov_len@@ -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 ==CIFS_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 ==CIFS_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 !=CIFS_STATUS_GOOD ) && + (server->status !=CIFS_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 ==CIFS_STATUS_GOOD ) || + (server->status ==CIFS_STATUS_NEW ))) {spin_unlock (&g_servers_lock);if (in_buf->Command ==SMB_COM_TRANSACTION2 ) { --2.35.3
Signature · 3 lines
Thanks, Steve
RFC PATCH v2 7/10 cifs: rename cifsFYI to debug_level
In reply to Enzo MatsumiyaRename "cifsFYI" to "debug_level" to add more meaning to it.
--- fs/cifs/Kconfig | 2 +- fs/cifs/cifs_debug.c | 26 +++++++++++++------------- fs/cifs/cifs_debug.h | 19 +++++++++---------- fs/cifs/cifs_spnego.c | 2 +- fs/cifs/cifsfs.c | 4 ++-- fs/cifs/netmisc.c | 2 +- fs/cifs/smb2maperror.c | 2 +- fs/cifs/smb2misc.c | 2 +- fs/cifs/transport.c | 2 +- 9 files changed, 30 insertions(+), 31 deletions(-)
fs/cifs/Kconfig +1 -1
@@ -61,7 +61,7 @@ config CIFS_STATS2 Enabling this option will allow more detailed statistics on SMB request timing to be displayed in /proc/fs/cifs/DebugData and also allow optional logging of slow responses to dmesg (depending on the - value of /proc/fs/cifs/cifsFYI). See Documentation/admin-guide/cifs/usage.rst + value of /proc/fs/cifs/debug_level). See Documentation/admin-guide/cifs/usage.rst for more details. These additional statistics may have a minor effect on performance and memory utilization.
fs/cifs/cifs_debug.c +13 -13
@@ -670,7 +670,7 @@ PROC_FILE_DEFINE(smbd_receive_credit_max);#endif static struct proc_dir_entry *proc_fs_cifs; -static const struct proc_ops cifsFYI_proc_ops; +static const struct proc_ops debug_level_proc_ops;static const struct proc_ops cifs_lookup_cache_proc_ops;static const struct proc_ops traceSMB_proc_ops;static const struct proc_ops cifs_security_flags_proc_ops;
@@ -691,7 +691,7 @@ cifs_proc_init(void) cifs_debug_files_proc_show);proc_create ("Stats" ,0644 , proc_fs_cifs, &cifs_stats_proc_ops); -proc_create ("cifsFYI" ,0644 , proc_fs_cifs, &cifsFYI_proc_ops); +proc_create ("debug_level" ,0644 , proc_fs_cifs, &debug_level_proc_ops);proc_create ("traceSMB" ,0644 , proc_fs_cifs, &traceSMB_proc_ops);proc_create ("LinuxExtensionsEnabled" ,0644 , proc_fs_cifs, &cifs_linux_ext_proc_ops);
@@ -734,7 +734,7 @@ cifs_proc_clean(void)remove_proc_entry ("DebugData" , proc_fs_cifs);remove_proc_entry ("open_files" , proc_fs_cifs); -remove_proc_entry ("cifsFYI" , proc_fs_cifs); +remove_proc_entry ("debug_level" , proc_fs_cifs);remove_proc_entry ("traceSMB" , proc_fs_cifs);remove_proc_entry ("Stats" , proc_fs_cifs);remove_proc_entry ("SecurityFlags" , proc_fs_cifs);
@@ -758,18 +758,18 @@ cifs_proc_clean(void)remove_proc_entry ("fs/cifs" ,NULL ); } -static int cifsFYI_proc_show (struct seq_file *m,void *v) +static int debug_level_proc_show (struct seq_file *m,void *v) { -seq_printf (m,"%d\n" , cifsFYI); +seq_printf (m,"%d\n" , debug_level);return 0 ; } -static int cifsFYI_proc_open (struct inode *inode,struct file *file) +static int debug_level_proc_open (struct inode *inode,struct file *file) { -return single_open (file, cifsFYI_proc_show,NULL ); +return single_open (file, debug_level_proc_show,NULL ); } -static ssize_t cifsFYI_proc_write (struct file *file,const char __user *buffer, +static ssize_t debug_level_proc_write (struct file *file,const char __user *buffer,size_t count,loff_t *ppos) {char c[2 ] = {'\0' };
@@ -780,21 +780,21 @@ static ssize_t cifsFYI_proc_write(struct file *file, const char __user *buffer,if (rc)return rc;if (strtobool (c, &bv) ==0 ) - cifsFYI = bv; + debug_level = bv;else if ((c[0 ] >'1' ) && (c[0 ] <='9' )) - cifsFYI = (int ) (c[0 ] -'0' );/* see cifs_debug.h for meanings */ + debug_level = (int ) (c[0 ] -'0' );/* see cifs_debug.h for meanings */ else return -EINVAL ;return count; } -static const struct proc_ops cifsFYI_proc_ops = { - .proc_open = cifsFYI_proc_open, +static const struct proc_ops debug_level_proc_ops = { + .proc_open = debug_level_proc_open, .proc_read = seq_read, .proc_lseek = seq_lseek, .proc_release = single_release, - .proc_write = cifsFYI_proc_write, + .proc_write = debug_level_proc_write, };static int cifs_linux_ext_proc_show (struct seq_file *m,void *v)
fs/cifs/cifs_debug.h +9 -10
@@ -5,13 +5,10 @@* Modified by Steve French ([email protected]) */ -#ifndef _H_CIFS_DEBUG -#define _H_CIFS_DEBUG +#ifndef _CIFS_DEBUG_H +#define _CIFS_DEBUG_H -#ifdef pr_fmt#undef pr_fmt -#endif -#define pr_fmt (fmt) "CIFS: " fmtvoid cifs_dump_mem (char *,void *,int );
@@ -19,13 +16,15 @@ void cifs_dump_detail(void *, struct cifs_server_info *);void cifs_dump_mids (struct cifs_server_info *);extern bool traceSMB;/* flag which enables the function below */ void dump_smb (void *,int ); +#define CIFS_INFO 0x01#define CIFS_RC 0x02#define CIFS_TIMER 0x04#define VFS 1#define FYI 2 -extern int cifsFYI; +extern int debug_level; +#ifdef CONFIG_CIFS_DEBUG2 #define NOISY 4#else
@@ -61,7 +60,7 @@ extern int cifsFYI;/* information message: e.g., configuration, major event */ #define cifs_dbg_func (ratefunc, type, fmt, ...) \ do { \ - if ((type) & FYI && cifsFYI & CIFS_INFO) { \ + if ((type) & FYI && debug_level & CIFS_INFO) { \ pr_debug_ ## ratefunc("%s: " fmt, \ __FILE__, ##__VA_ARGS__); \ } else if ((type) & VFS) { \
@@ -84,7 +83,7 @@ do { \const char *sn ="" ; \if (server && server->hostname) \ sn = server->hostname; \ -if ((type) &FYI && cifsFYI &CIFS_INFO ) { \ +if ((type) &FYI && debug_level &CIFS_INFO ) { \ pr_debug_ ## ratefunc("%s: \\\\%s " fmt, \ __FILE__, sn, ##__VA_ARGS__); \ } else if ((type) & VFS) { \
@@ -110,7 +109,7 @@ do { \const char *tn ="" ; \if (tcon && tcon->treeName) \ tn = tcon->treeName; \ -if ((type) &FYI && cifsFYI &CIFS_INFO ) { \ +if ((type) &FYI && debug_level &CIFS_INFO ) { \ pr_debug_ ## ratefunc("%s: %s " fmt, \ __FILE__, tn, ##__VA_ARGS__); \ } else if ((type) & VFS) { \
@@ -157,4 +156,4 @@ do { \ pr_info(fmt, ##__VA_ARGS__)#endif -#endif /* _H_CIFS_DEBUG */ +#endif /* _CIFS_DEBUG_H */
fs/cifs/cifs_spnego.c +1 -1
@@ -162,7 +162,7 @@ cifs_get_spnego_key(struct cifs_ses *sesInfo,revert_creds (saved_cred);#ifdef CONFIG_CIFS_DEBUG2 -if (cifsFYI && !IS_ERR (spnego_key)) { +if (debug_level && !IS_ERR (spnego_key)) {struct cifs_spnego_msg *msg = spnego_key->payload.data[0 ];cifs_dump_mem ("SPNEGO reply blob:" , msg->data,min (1024U , msg->secblob_len + msg->sesskey_len));
fs/cifs/cifsfs.c +2 -2
@@ -56,7 +56,7 @@#define SMB_DATE_MIN (0<<9 | 1<<5 | 1)#define SMB_TIME_MAX (23<<11 | 59<<5 | 29) -int cifsFYI =0 ; +int debug_level =0 ;bool traceSMB;bool enable_oplocks = true;bool linuxExtEnabled = true;
@@ -856,7 +856,7 @@ cifs_smb3_do_mount(struct file_system_type *fs_type,* Prints in Kernel / CIFS log the attempted mount operation * If CIFS_DEBUG && cifs_FYI */ -if (cifsFYI) +if (debug_level)cifs_dbg (FYI ,"Devname: %s flags: %d\n" , old_ctx->UNC, flags);else cifs_info ("Attempting to mount %s\n" , old_ctx->UNC);
fs/cifs/netmisc.c +1 -1
@@ -827,7 +827,7 @@ map_smb_to_linux_error(char *buf, bool logErr)__u32 err =le32_to_cpu (smb->Status.CifsError);if (logErr && (err != (NT_STATUS_MORE_PROCESSING_REQUIRED )))cifs_print_status (err); -else if (cifsFYI &CIFS_RC ) +else if (debug_level &CIFS_RC )cifs_print_status (err);ntstatus_to_dos (err, &smberrclass, &smberrcode); }else {
fs/cifs/smb2maperror.c +1 -1
@@ -2456,7 +2456,7 @@ map_smb2_to_linux_error(char *buf, bool log_err)if (log_err && (smb2err !=STATUS_MORE_PROCESSING_REQUIRED ) && (smb2err !=STATUS_END_OF_FILE ))smb2_print_status (smb2err); -else if (cifsFYI &CIFS_RC ) +else if (debug_level &CIFS_RC )smb2_print_status (smb2err); for (i = 0; i < sizeof(smb2_error_map_table) /
fs/cifs/smb2misc.c +1 -1
@@ -260,7 +260,7 @@ smb2_check_message(char *buf, unsigned int len, struct cifs_server_info *server)return 0 ;/* Only log a message if len was really miscalculated */ -if (unlikely (cifsFYI)) +if (unlikely (debug_level))cifs_dbg (FYI ,"Server response too short: calculated " "length %u doesn't match read length %u (cmd=%d, mid=%llu)\n" , calc_len, len, command, mid);
fs/cifs/transport.c +1 -1
@@ -137,7 +137,7 @@ static void _cifs_mid_q_entry_release(struct kref *refcount)trace_smb3_slow_rsp (smb_cmd, midEntry->mid, midEntry->pid, midEntry->when_sent, midEntry->when_received); -if (cifsFYI &CIFS_TIMER ) { +if (debug_level &CIFS_TIMER ) {pr_debug ("slow rsp: cmd %d mid %llu" , midEntry->command, midEntry->mid); cifs_info("A: 0x%lx S: 0x%lx R: 0x%lx\n",
Signature · 1 line
2.35.3
Re: [RFC PATCH v2 07/10] cifs: rename cifsFYI to debug_level
cifsFYI is user facing so changing from camel case is probably a bad idea for the name of the existing proc entry (internal changes in c code from camel case may be ok, though lower priority)
Quoted 271 lines · Enzo Matsumiya
Rename "cifsFYI" to "
debug_level" to add more meaning to it.Signed-off-by Enzo Matsumiya <[email protected]>--- fs/cifs/Kconfig | 2 +- fs/cifs/cifs_debug.c | 26 +++++++++++++------------- fs/cifs/cifs_debug.h | 19 +++++++++---------- fs/cifs/cifs_spnego.c | 2 +- fs/cifs/cifsfs.c | 4 ++-- fs/cifs/netmisc.c | 2 +- fs/cifs/smb2maperror.c | 2 +- fs/cifs/smb2misc.c | 2 +- fs/cifs/transport.c | 2 +- 9 files changed, 30 insertions(+), 31 deletions(-)fs/cifs/Kconfig +1
-1@@ -61,7 +61,7 @@ config CIFS_STATS2 Enabling this option will allow more detailed statistics on SMB request timing to be displayed in /proc/fs/cifs/DebugData and also allow optional logging of slow responses to dmesg (depending on the - value of /proc/fs/cifs/cifsFYI). See Documentation/admin-guide/cifs/usage.rst + value of /proc/fs/cifs/debug_level). See Documentation/admin-guide/cifs/usage.rst for more details. These additional statistics may have a minor effect on performance and memory utilization.fs/cifs/cifs_debug.c +13
-13@@ -670,7 +670,7 @@ PROC_FILE_DEFINE(smbd_receive_credit_max);#endif static struct proc_dir_entry *proc_fs_cifs; -static const struct proc_ops cifsFYI_proc_ops; +static const struct proc_ops debug_level_proc_ops;static const struct proc_ops cifs_lookup_cache_proc_ops;static const struct proc_ops traceSMB_proc_ops;static const struct proc_ops cifs_security_flags_proc_ops;@@ -691,7 +691,7 @@ cifs_proc_init(void) cifs_debug_files_proc_show);proc_create ("Stats" ,0644 , proc_fs_cifs, &cifs_stats_proc_ops); -proc_create ("cifsFYI" ,0644 , proc_fs_cifs, &cifsFYI_proc_ops); +proc_create ("debug_level" ,0644 , proc_fs_cifs, &debug_level_proc_ops);proc_create ("traceSMB" ,0644 , proc_fs_cifs, &traceSMB_proc_ops);proc_create ("LinuxExtensionsEnabled" ,0644 , proc_fs_cifs, &cifs_linux_ext_proc_ops);@@ -734,7 +734,7 @@ cifs_proc_clean(void)remove_proc_entry ("DebugData" , proc_fs_cifs);remove_proc_entry ("open_files" , proc_fs_cifs); -remove_proc_entry ("cifsFYI" , proc_fs_cifs); +remove_proc_entry ("debug_level" , proc_fs_cifs);remove_proc_entry ("traceSMB" , proc_fs_cifs);remove_proc_entry ("Stats" , proc_fs_cifs);remove_proc_entry ("SecurityFlags" , proc_fs_cifs);@@ -758,18 +758,18 @@ cifs_proc_clean(void)remove_proc_entry ("fs/cifs" ,NULL ); } -static int cifsFYI_proc_show (struct seq_file *m,void *v) +static int debug_level_proc_show (struct seq_file *m,void *v) { -seq_printf (m,"%d\n" , cifsFYI); +seq_printf (m,"%d\n" , debug_level);return 0 ; } -static int cifsFYI_proc_open (struct inode *inode,struct file *file) +static int debug_level_proc_open (struct inode *inode,struct file *file) { -return single_open (file, cifsFYI_proc_show,NULL ); +return single_open (file, debug_level_proc_show,NULL ); } -static ssize_t cifsFYI_proc_write (struct file *file,const char __user *buffer, +static ssize_t debug_level_proc_write (struct file *file,const char __user *buffer,size_t count,loff_t *ppos) {char c[2 ] = {'\0' };@@ -780,21 +780,21 @@ static ssize_t cifsFYI_proc_write(struct file *file, const char __user *buffer,if (rc)return rc;if (strtobool (c, &bv) ==0 ) - cifsFYI = bv; + debug_level = bv;else if ((c[0 ] >'1' ) && (c[0 ] <='9' )) - cifsFYI = (int ) (c[0 ] -'0' );/* see cifs_debug.h for meanings */ + debug_level = (int ) (c[0 ] -'0' );/* see cifs_debug.h for meanings */ else return -EINVAL ;return count; } -static const struct proc_ops cifsFYI_proc_ops = { - .proc_open = cifsFYI_proc_open, +static const struct proc_ops debug_level_proc_ops = { + .proc_open = debug_level_proc_open, .proc_read = seq_read, .proc_lseek = seq_lseek, .proc_release = single_release, - .proc_write = cifsFYI_proc_write, + .proc_write = debug_level_proc_write, };static int cifs_linux_ext_proc_show (struct seq_file *m,void *v)fs/cifs/cifs_debug.h +9
-10@@ -5,13 +5,10 @@* Modified by Steve French ([email protected]) */ -#ifndef _H_CIFS_DEBUG -#define _H_CIFS_DEBUG +#ifndef _CIFS_DEBUG_H +#define _CIFS_DEBUG_H -#ifdef pr_fmt#undef pr_fmt -#endif -#define pr_fmt (fmt) "CIFS: " fmtvoid cifs_dump_mem (char *,void *,int );@@ -19,13 +16,15 @@ void cifs_dump_detail(void *, struct cifs_server_info *);void cifs_dump_mids (struct cifs_server_info *);extern bool traceSMB;/* flag which enables the function below */ void dump_smb (void *,int ); +#define CIFS_INFO 0x01#define CIFS_RC 0x02#define CIFS_TIMER 0x04#define VFS 1#define FYI 2 -extern int cifsFYI; +extern int debug_level; +#ifdef CONFIG_CIFS_DEBUG2 #define NOISY 4#else @@ -61,7 +60,7 @@ extern int cifsFYI;/* information message: e.g., configuration, major event */ #define cifs_dbg_func (ratefunc, type, fmt, ...) \ do { \ - if ((type) & FYI && cifsFYI & CIFS_INFO) { \ + if ((type) & FYI && debug_level & CIFS_INFO) { \ pr_debug_ ## ratefunc("%s: " fmt, \ __FILE__, ##__VA_ARGS__); \ } else if ((type) & VFS) { \@@ -84,7 +83,7 @@ do { \const char *sn ="" ; \if (server && server->hostname) \ sn = server->hostname; \ -if ((type) &FYI && cifsFYI &CIFS_INFO ) { \ +if ((type) &FYI && debug_level &CIFS_INFO ) { \ pr_debug_ ## ratefunc("%s: \\\\%s " fmt, \ __FILE__, sn, ##__VA_ARGS__); \ } else if ((type) & VFS) { \@@ -110,7 +109,7 @@ do { \const char *tn ="" ; \if (tcon && tcon->treeName) \ tn = tcon->treeName; \ -if ((type) &FYI && cifsFYI &CIFS_INFO ) { \ +if ((type) &FYI && debug_level &CIFS_INFO ) { \ pr_debug_ ## ratefunc("%s: %s " fmt, \ __FILE__, tn, ##__VA_ARGS__); \ } else if ((type) & VFS) { \@@ -157,4 +156,4 @@ do { \ pr_info(fmt, ##__VA_ARGS__)#endif -#endif /* _H_CIFS_DEBUG */ +#endif /* _CIFS_DEBUG_H */ fs/cifs/cifs_spnego.c +1
-1@@ -162,7 +162,7 @@ cifs_get_spnego_key(struct cifs_ses *sesInfo,revert_creds (saved_cred);#ifdef CONFIG_CIFS_DEBUG2 -if (cifsFYI && !IS_ERR (spnego_key)) { +if (debug_level && !IS_ERR (spnego_key)) {struct cifs_spnego_msg *msg = spnego_key->payload.data[0 ];cifs_dump_mem ("SPNEGO reply blob:" , msg->data,min (1024U , msg->secblob_len + msg->sesskey_len));fs/cifs/cifsfs.c +2
-2@@ -56,7 +56,7 @@#define SMB_DATE_MIN (0<<9 | 1<<5 | 1)#define SMB_TIME_MAX (23<<11 | 59<<5 | 29) -int cifsFYI =0 ; +int debug_level =0 ;bool traceSMB;bool enable_oplocks = true;bool linuxExtEnabled = true;@@ -856,7 +856,7 @@ cifs_smb3_do_mount(struct file_system_type *fs_type,* Prints in Kernel / CIFS log the attempted mount operation * If CIFS_DEBUG && cifs_FYI */ -if (cifsFYI) +if (debug_level)cifs_dbg (FYI ,"Devname: %s flags: %d\n" , old_ctx->UNC, flags);else cifs_info ("Attempting to mount %s\n" , old_ctx->UNC);fs/cifs/netmisc.c +1
-1@@ -827,7 +827,7 @@ map_smb_to_linux_error(char *buf, bool logErr)__u32 err =le32_to_cpu (smb->Status.CifsError);if (logErr && (err != (NT_STATUS_MORE_PROCESSING_REQUIRED )))cifs_print_status (err); -else if (cifsFYI &CIFS_RC ) +else if (debug_level &CIFS_RC )cifs_print_status (err);ntstatus_to_dos (err, &smberrclass, &smberrcode); }else {fs/cifs/smb2maperror.c +1
-1@@ -2456,7 +2456,7 @@ map_smb2_to_linux_error(char *buf, bool log_err)if (log_err && (smb2err !=STATUS_MORE_PROCESSING_REQUIRED ) && (smb2err !=STATUS_END_OF_FILE ))smb2_print_status (smb2err); -else if (cifsFYI &CIFS_RC ) +else if (debug_level &CIFS_RC )smb2_print_status (smb2err); for (i = 0; i < sizeof(smb2_error_map_table) /fs/cifs/smb2misc.c +1
-1@@ -260,7 +260,7 @@ smb2_check_message(char *buf, unsigned int len, struct cifs_server_info *server)return 0 ;/* Only log a message if len was really miscalculated */ -if (unlikely (cifsFYI)) +if (unlikely (debug_level))cifs_dbg (FYI ,"Server response too short: calculated " "length %u doesn't match read length %u (cmd=%d, mid=%llu)\n" , calc_len, len, command, mid);fs/cifs/transport.c +1
-2@@ -137,7 +137,7 @@ static void _cifs_mid_q_entry_release(struct kref *refcount)trace_smb3_slow_rsp (smb_cmd, midEntry->mid, midEntry->pid, midEntry->when_sent, midEntry->when_received); -if (cifsFYI &CIFS_TIMER ) { +if (debug_level &CIFS_TIMER ) {pr_debug ("slow rsp: cmd %d mid %llu" , midEntry->command, midEntry->mid); cifs_info("A: 0x%lx S: 0x%lx R: 0x%lx\n", --2.35.3
Signature · 3 lines
Thanks, Steve
Re: [RFC PATCH v2 07/10] cifs: rename cifsFYI to debug_level
Quoted 3 lines · Steve French
cifsFYI is user facing so changing from camel case is probably a bad idea for the name of the existing proc entry (internal changes in c code from camel case may be ok, though lower priority)
I understand and agree.
This is part of my branch where the module was renamed "smbfs" and I took the chance to remove "cifs" naming from user-facing stuff.
Will we still keep it "cifsFYI" when SMB1 gets isolated? What about module renaming?
Quoted 278 lines · Enzo Matsumiya
Quoted 271 lines
Rename "cifsFYI" to "
debug_level" to add more meaning to it.Signed-off-by Enzo Matsumiya <[email protected]>--- fs/cifs/Kconfig | 2 +- fs/cifs/cifs_debug.c | 26 +++++++++++++------------- fs/cifs/cifs_debug.h | 19 +++++++++---------- fs/cifs/cifs_spnego.c | 2 +- fs/cifs/cifsfs.c | 4 ++-- fs/cifs/netmisc.c | 2 +- fs/cifs/smb2maperror.c | 2 +- fs/cifs/smb2misc.c | 2 +- fs/cifs/transport.c | 2 +- 9 files changed, 30 insertions(+), 31 deletions(-)fs/cifs/Kconfig +1
-1@@ -61,7 +61,7 @@ config CIFS_STATS2 Enabling this option will allow more detailed statistics on SMB request timing to be displayed in /proc/fs/cifs/DebugData and also allow optional logging of slow responses to dmesg (depending on the - value of /proc/fs/cifs/cifsFYI). See Documentation/admin-guide/cifs/usage.rst + value of /proc/fs/cifs/debug_level). See Documentation/admin-guide/cifs/usage.rst for more details. These additional statistics may have a minor effect on performance and memory utilization.fs/cifs/cifs_debug.c +13
-13@@ -670,7 +670,7 @@ PROC_FILE_DEFINE(smbd_receive_credit_max);#endif static struct proc_dir_entry *proc_fs_cifs; -static const struct proc_ops cifsFYI_proc_ops; +static const struct proc_ops debug_level_proc_ops;static const struct proc_ops cifs_lookup_cache_proc_ops;static const struct proc_ops traceSMB_proc_ops;static const struct proc_ops cifs_security_flags_proc_ops;@@ -691,7 +691,7 @@ cifs_proc_init(void) cifs_debug_files_proc_show);proc_create ("Stats" ,0644 , proc_fs_cifs, &cifs_stats_proc_ops); -proc_create ("cifsFYI" ,0644 , proc_fs_cifs, &cifsFYI_proc_ops); +proc_create ("debug_level" ,0644 , proc_fs_cifs, &debug_level_proc_ops);proc_create ("traceSMB" ,0644 , proc_fs_cifs, &traceSMB_proc_ops);proc_create ("LinuxExtensionsEnabled" ,0644 , proc_fs_cifs, &cifs_linux_ext_proc_ops);@@ -734,7 +734,7 @@ cifs_proc_clean(void)remove_proc_entry ("DebugData" , proc_fs_cifs);remove_proc_entry ("open_files" , proc_fs_cifs); -remove_proc_entry ("cifsFYI" , proc_fs_cifs); +remove_proc_entry ("debug_level" , proc_fs_cifs);remove_proc_entry ("traceSMB" , proc_fs_cifs);remove_proc_entry ("Stats" , proc_fs_cifs);remove_proc_entry ("SecurityFlags" , proc_fs_cifs);@@ -758,18 +758,18 @@ cifs_proc_clean(void)remove_proc_entry ("fs/cifs" ,NULL ); } -static int cifsFYI_proc_show (struct seq_file *m,void *v) +static int debug_level_proc_show (struct seq_file *m,void *v) { -seq_printf (m,"%d\n" , cifsFYI); +seq_printf (m,"%d\n" , debug_level);return 0 ; } -static int cifsFYI_proc_open (struct inode *inode,struct file *file) +static int debug_level_proc_open (struct inode *inode,struct file *file) { -return single_open (file, cifsFYI_proc_show,NULL ); +return single_open (file, debug_level_proc_show,NULL ); } -static ssize_t cifsFYI_proc_write (struct file *file,const char __user *buffer, +static ssize_t debug_level_proc_write (struct file *file,const char __user *buffer,size_t count,loff_t *ppos) {char c[2 ] = {'\0' };@@ -780,21 +780,21 @@ static ssize_t cifsFYI_proc_write(struct file *file, const char __user *buffer,if (rc)return rc;if (strtobool (c, &bv) ==0 ) - cifsFYI = bv; + debug_level = bv;else if ((c[0 ] >'1' ) && (c[0 ] <='9' )) - cifsFYI = (int ) (c[0 ] -'0' );/* see cifs_debug.h for meanings */ + debug_level = (int ) (c[0 ] -'0' );/* see cifs_debug.h for meanings */ else return -EINVAL ;return count; } -static const struct proc_ops cifsFYI_proc_ops = { - .proc_open = cifsFYI_proc_open, +static const struct proc_ops debug_level_proc_ops = { + .proc_open = debug_level_proc_open, .proc_read = seq_read, .proc_lseek = seq_lseek, .proc_release = single_release, - .proc_write = cifsFYI_proc_write, + .proc_write = debug_level_proc_write, };static int cifs_linux_ext_proc_show (struct seq_file *m,void *v)fs/cifs/cifs_debug.h +9
-10@@ -5,13 +5,10 @@* Modified by Steve French ([email protected]) */ -#ifndef _H_CIFS_DEBUG -#define _H_CIFS_DEBUG +#ifndef _CIFS_DEBUG_H +#define _CIFS_DEBUG_H -#ifdef pr_fmt#undef pr_fmt -#endif -#define pr_fmt (fmt) "CIFS: " fmtvoid cifs_dump_mem (char *,void *,int );@@ -19,13 +16,15 @@ void cifs_dump_detail(void *, struct cifs_server_info *);void cifs_dump_mids (struct cifs_server_info *);extern bool traceSMB;/* flag which enables the function below */ void dump_smb (void *,int ); +#define CIFS_INFO 0x01#define CIFS_RC 0x02#define CIFS_TIMER 0x04#define VFS 1#define FYI 2 -extern int cifsFYI; +extern int debug_level; +#ifdef CONFIG_CIFS_DEBUG2 #define NOISY 4#else @@ -61,7 +60,7 @@ extern int cifsFYI;/* information message: e.g., configuration, major event */ #define cifs_dbg_func (ratefunc, type, fmt, ...) \ do { \ - if ((type) & FYI && cifsFYI & CIFS_INFO) { \ + if ((type) & FYI && debug_level & CIFS_INFO) { \ pr_debug_ ## ratefunc("%s: " fmt, \ __FILE__, ##__VA_ARGS__); \ } else if ((type) & VFS) { \@@ -84,7 +83,7 @@ do { \const char *sn ="" ; \if (server && server->hostname) \ sn = server->hostname; \ -if ((type) &FYI && cifsFYI &CIFS_INFO ) { \ +if ((type) &FYI && debug_level &CIFS_INFO ) { \ pr_debug_ ## ratefunc("%s: \\\\%s " fmt, \ __FILE__, sn, ##__VA_ARGS__); \ } else if ((type) & VFS) { \@@ -110,7 +109,7 @@ do { \const char *tn ="" ; \if (tcon && tcon->treeName) \ tn = tcon->treeName; \ -if ((type) &FYI && cifsFYI &CIFS_INFO ) { \ +if ((type) &FYI && debug_level &CIFS_INFO ) { \ pr_debug_ ## ratefunc("%s: %s " fmt, \ __FILE__, tn, ##__VA_ARGS__); \ } else if ((type) & VFS) { \@@ -157,4 +156,4 @@ do { \ pr_info(fmt, ##__VA_ARGS__)#endif -#endif /* _H_CIFS_DEBUG */ +#endif /* _CIFS_DEBUG_H */ fs/cifs/cifs_spnego.c +1
-1@@ -162,7 +162,7 @@ cifs_get_spnego_key(struct cifs_ses *sesInfo,revert_creds (saved_cred);#ifdef CONFIG_CIFS_DEBUG2 -if (cifsFYI && !IS_ERR (spnego_key)) { +if (debug_level && !IS_ERR (spnego_key)) {struct cifs_spnego_msg *msg = spnego_key->payload.data[0 ];cifs_dump_mem ("SPNEGO reply blob:" , msg->data,min (1024U , msg->secblob_len + msg->sesskey_len));fs/cifs/cifsfs.c +2
-2@@ -56,7 +56,7 @@#define SMB_DATE_MIN (0<<9 | 1<<5 | 1)#define SMB_TIME_MAX (23<<11 | 59<<5 | 29) -int cifsFYI =0 ; +int debug_level =0 ;bool traceSMB;bool enable_oplocks = true;bool linuxExtEnabled = true;@@ -856,7 +856,7 @@ cifs_smb3_do_mount(struct file_system_type *fs_type,* Prints in Kernel / CIFS log the attempted mount operation * If CIFS_DEBUG && cifs_FYI */ -if (cifsFYI) +if (debug_level)cifs_dbg (FYI ,"Devname: %s flags: %d\n" , old_ctx->UNC, flags);else cifs_info ("Attempting to mount %s\n" , old_ctx->UNC);fs/cifs/netmisc.c +1
-1@@ -827,7 +827,7 @@ map_smb_to_linux_error(char *buf, bool logErr)__u32 err =le32_to_cpu (smb->Status.CifsError);if (logErr && (err != (NT_STATUS_MORE_PROCESSING_REQUIRED )))cifs_print_status (err); -else if (cifsFYI &CIFS_RC ) +else if (debug_level &CIFS_RC )cifs_print_status (err);ntstatus_to_dos (err, &smberrclass, &smberrcode); }else {fs/cifs/smb2maperror.c +1
-1@@ -2456,7 +2456,7 @@ map_smb2_to_linux_error(char *buf, bool log_err)if (log_err && (smb2err !=STATUS_MORE_PROCESSING_REQUIRED ) && (smb2err !=STATUS_END_OF_FILE ))smb2_print_status (smb2err); -else if (cifsFYI &CIFS_RC ) +else if (debug_level &CIFS_RC )smb2_print_status (smb2err); for (i = 0; i < sizeof(smb2_error_map_table) /fs/cifs/smb2misc.c +1
-1@@ -260,7 +260,7 @@ smb2_check_message(char *buf, unsigned int len, struct cifs_server_info *server)return 0 ;/* Only log a message if len was really miscalculated */ -if (unlikely (cifsFYI)) +if (unlikely (debug_level))cifs_dbg (FYI ,"Server response too short: calculated " "length %u doesn't match read length %u (cmd=%d, mid=%llu)\n" , calc_len, len, command, mid);fs/cifs/transport.c +1
-2@@ -137,7 +137,7 @@ static void _cifs_mid_q_entry_release(struct kref *refcount)trace_smb3_slow_rsp (smb_cmd, midEntry->mid, midEntry->pid, midEntry->when_sent, midEntry->when_received); -if (cifsFYI &CIFS_TIMER ) { +if (debug_level &CIFS_TIMER ) {pr_debug ("slow rsp: cmd %d mid %llu" , midEntry->command, midEntry->mid); cifs_info("A: 0x%lx S: 0x%lx R: 0x%lx\n", --2.35.3
Signature · 3 lines
Thanks, Steve
RFC PATCH v2 8/10 cifs: rename list_head fields
In reply to Enzo MatsumiyaRename list_head fields for several structs to give more meaning and/or set some standard for all cifs.ko structs.
--- fs/cifs/cifs_debug.c | 38 ++++---- fs/cifs/cifsfs.c | 6 +- fs/cifs/cifsglob.h | 68 +++++++-------- fs/cifs/cifssmb.c | 10 +-- fs/cifs/connect.c | 48 +++++----- fs/cifs/dfs_cache.c | 6 +- fs/cifs/file.c | 188 ++++++++++++++++++++-------------------- fs/cifs/ioctl.c | 4 +- fs/cifs/misc.c | 65 +++++++------- fs/cifs/readdir.c | 4 +- fs/cifs/sess.c | 8 +- fs/cifs/smb1ops.c | 4 +- fs/cifs/smb2file.c | 14 +-- fs/cifs/smb2misc.c | 32 +++---- fs/cifs/smb2ops.c | 31 ++++--- fs/cifs/smb2pdu.c | 4 +- fs/cifs/smb2transport.c | 10 +-- fs/cifs/transport.c | 8 +- 18 files changed, 273 insertions(+), 275 deletions(-)
fs/cifs/cifs_debug.c +19 -19
@@ -56,7 +56,7 @@ void cifs_dump_mids(struct cifs_server_info *server)cifs_dbg (VFS ,"Dump pending requests:\n" );spin_lock (&g_mid_lock); -list_for_each_entry (mid_entry, &server->pending_mid_q, qhead) { +list_for_each_entry (mid_entry, &server->pending_mid_q, head) { cifs_dbg(VFS, "State: %d Cmd: %d Pid: %d Cbdata: %p Mid %llu\n", mid_entry->mid_state, le16_to_cpu(mid_entry->command),
@@ -182,11 +182,12 @@ static int cifs_debug_files_proc_show(struct seq_file *m, void *v)seq_printf (m," <filename>\n" );#endif /* CIFS_DEBUG2 */ spin_lock (&g_servers_lock); -list_for_each_entry (server, &g_servers_list, server_head) { -list_for_each_entry (ses, &server->smb_ses_list, smb_ses_list) { -list_for_each_entry (tcon, &ses->tcon_list, tcon_list) { -spin_lock (&tcon->open_file_lock); -list_for_each_entry (cfile, &tcon->openFileList, tlist) { +list_for_each_entry (server, &g_servers_list, head) { +list_for_each_entry (ses, &server->ses_list, head) { +list_for_each_entry (tcon, &ses->tcon_list, head) { +spin_lock (&tcon->open_files_lock); +list_for_each_entry (cfile, &tcon->open_files_list, + tcon_head) { seq_printf(m, "0x%x 0x%llx 0x%x %d %d %d %pd", tcon->tid,
@@ -202,7 +203,7 @@ static int cifs_debug_files_proc_show(struct seq_file *m, void *v)seq_printf (m,"\n" );#endif /* CIFS_DEBUG2 */ } -spin_unlock (&tcon->open_file_lock); +spin_unlock (&tcon->open_files_lock); } } }
@@ -268,7 +269,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v) c =0 ;spin_lock (&g_servers_lock); -list_for_each_entry (server, &g_servers_list, server_head) { +list_for_each_entry (server, &g_servers_list, head) {/* channel info will be printed as a part of sessions below */ if (CIFS_SERVER_IS_CHAN (server))continue ;
@@ -375,7 +376,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)seq_printf (m,"\n\n\tSessions: " ); i =0 ; -list_for_each_entry (ses, &server->smb_ses_list, smb_ses_list) { +list_for_each_entry (ses, &server->ses_list, head) { i++; if ((ses->serverDomain == NULL) || (ses->serverOS == NULL) ||
@@ -439,7 +440,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)else seq_puts (m,"none\n" ); -list_for_each_entry (tcon, &ses->tcon_list, tcon_list) { +list_for_each_entry (tcon, &ses->tcon_list, head) { ++j;seq_printf (m,"\n\t%d) " , j);cifs_debug_tcon (m, tcon);
@@ -450,8 +451,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)seq_printf (m,"\n\n\tServer interfaces: %zu" , ses->iface_count); j =0 ; -list_for_each_entry (iface, &ses->iface_list, - iface_head) { +list_for_each_entry (iface, &ses->iface_list, head) {seq_printf (m,"\n\t%d)" , ++j);cifs_dump_iface (m, iface);if (is_ses_using_iface (ses, iface))
@@ -464,7 +464,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)seq_puts (m,"\n\n\tMIDs: " );spin_lock (&g_mid_lock); -list_for_each_entry (mid_entry, &server->pending_mid_q, qhead) { +list_for_each_entry (mid_entry, &server->pending_mid_q, head) { seq_printf(m, "\n\tState: %d com: %d pid:" " %d cbdata: %p mid %llu\n", mid_entry->mid_state,
@@ -512,7 +512,7 @@ static ssize_t cifs_stats_proc_write(struct file *file, g_current_xid =0 ;spin_unlock (&g_mid_lock);spin_lock (&g_servers_lock); -list_for_each_entry (server, &g_servers_list, server_head) { +list_for_each_entry (server, &g_servers_list, head) { server->max_in_flight =0 ;#ifdef CONFIG_CIFS_STATS2 for (i =0 ; i <NUMBER_OF_SMB2_COMMANDS ; i++) {
@@ -523,8 +523,8 @@ static ssize_t cifs_stats_proc_write(struct file *file, server->fastest_cmd[0] = 0; }#endif /* CONFIG_CIFS_STATS2 */ -list_for_each_entry (ses, &server->smb_ses_list, smb_ses_list) { -list_for_each_entry (tcon, &ses->tcon_list, tcon_list) { +list_for_each_entry (ses, &server->ses_list, head) { +list_for_each_entry (tcon, &ses->tcon_list, head) {atomic_set (&tcon->num_smbs_sent,0 );spin_lock (&tcon->stat_lock); tcon->bytes_read =0 ;
@@ -579,7 +579,7 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v) i =0 ;spin_lock (&g_servers_lock); -list_for_each_entry (server, &g_servers_list, server_head) { +list_for_each_entry (server, &g_servers_list, head) {seq_printf (m,"\nMax requests in flight: %d" , server->max_in_flight);#ifdef CONFIG_CIFS_STATS2 seq_puts (m,"\nTotal time spent processing by command. Time " );
@@ -598,8 +598,8 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)atomic_read (&server->smb2slowcmd[j]), server->hostname, j);#endif /* STATS2 */ -list_for_each_entry (ses, &server->smb_ses_list, smb_ses_list) { -list_for_each_entry (tcon, &ses->tcon_list, tcon_list) { +list_for_each_entry (ses, &server->ses_list, head) { +list_for_each_entry (tcon, &ses->tcon_list, head) { i++;seq_printf (m,"\n%d) %s" , i, tcon->treeName);if (tcon->need_reconnect)
fs/cifs/cifsfs.c +3 -3
@@ -391,7 +391,7 @@ cifs_alloc_inode(struct super_block *sb) cinode->uniqueid =0 ; cinode->createtime =0 ; cinode->epoch =0 ; -spin_lock_init (&cinode->open_file_lock); +spin_lock_init (&cinode->open_files_lock);generate_random_uuid (cinode->lease_key);/*
@@ -399,8 +399,8 @@ cifs_alloc_inode(struct super_block *sb)* by the VFS. */ /* cinode->netfs.inode.i_flags = S_NOATIME | S_NOCMTIME; */ -INIT_LIST_HEAD (&cinode->openFileList); -INIT_LIST_HEAD (&cinode->llist); +INIT_LIST_HEAD (&cinode->open_files_list); +INIT_LIST_HEAD (&cinode->fid_locks_list);INIT_LIST_HEAD (&cinode->deferred_closes);spin_lock_init (&cinode->deferred_lock);return &cinode->netfs.inode;
fs/cifs/cifsglob.h +34 -34
199 lines not on this page · raw message
fs/cifs/cifssmb.c +5 -5
@@ -83,13 +83,13 @@ cifs_mark_open_files_invalid(struct cifs_tcon *tcon)spin_unlock (&g_servers_lock);/* list all files open on tree connection and mark them invalid */ -spin_lock (&tcon->open_file_lock); -list_for_each_safe (tmp, tmp1, &tcon->openFileList) { - open_file = list_entry(tmp, struct cifs_file_info, tlist); +spin_lock (&tcon->open_files_lock); +list_for_each_safe (tmp, tmp1, &tcon->open_files_list) { + open_file = list_entry(tmp, struct cifs_file_info, tcon_head); open_file->invalidHandle = true; open_file->oplock_break_cancelled = true; } -spin_unlock (&tcon->open_file_lock); +spin_unlock (&tcon->open_files_lock);mutex_lock (&tcon->crfid.fid_mutex); tcon->crfid.is_valid = false;
@@ -2079,7 +2079,7 @@ cifs_writedata_direct_alloc(struct page **pages, work_func_t complete)if (wdata !=NULL ) { wdata->pages = pages;kref_init (&wdata->refcount); -INIT_LIST_HEAD (&wdata->list); +INIT_LIST_HEAD (&wdata->head);init_completion (&wdata->done);INIT_WORK (&wdata->work, complete); }
fs/cifs/connect.c +24 -24
169 lines not on this page · raw message
fs/cifs/dfs_cache.c +3 -3
@@ -1525,12 +1525,12 @@ static void refresh_mounts(struct cifs_ses **sessions)INIT_LIST_HEAD (&tcons);spin_lock (&g_servers_lock); -list_for_each_entry (server, &g_servers_list, server_head) { +list_for_each_entry (server, &g_servers_list, head) {if (!server->is_dfs_conn)continue ; -list_for_each_entry (ses, &server->smb_ses_list, smb_ses_list) { -list_for_each_entry (tcon, &ses->tcon_list, tcon_list) { +list_for_each_entry (ses, &server->ses_list, head) { +list_for_each_entry (tcon, &ses->tcon_list, head) {if (!tcon->ipc && !tcon->need_reconnect) { tcon->tc_count++;list_add_tail (&tcon->ulist, &tcons);
fs/cifs/file.c +94 -94
579 lines not on this page · raw message
fs/cifs/ioctl.c +2 -2
@@ -230,8 +230,8 @@ static int cifs_dump_full_key(struct cifs_tcon *tcon, struct smb3_full_key_debugstruct cifs_server_info *server_it =NULL ;spin_lock (&g_servers_lock); -list_for_each_entry (server_it, &g_servers_list, server_head) { -list_for_each_entry (ses_it, &server_it->smb_ses_list, smb_ses_list) { +list_for_each_entry (server_it, &g_servers_list, head) { +list_for_each_entry (ses_it, &server_it->ses_list, head) {if (ses_it->Suid == out.session_id) { ses = ses_it;/*
fs/cifs/misc.c +32 -33
193 lines not on this page · raw message
fs/cifs/readdir.c +2 -2
@@ -846,7 +846,7 @@ static bool emit_cached_dirents(struct cached_dirents *cde,struct cached_dirent *dirent;int rc; -list_for_each_entry (dirent, &cde->entries, entry) { +list_for_each_entry (dirent, &cde->entries, head) {if (ctx->pos >= dirent->pos)continue ; ctx->pos = dirent->pos;
@@ -914,7 +914,7 @@ static void add_cached_dirent(struct cached_dirents *cde,memcpy (&de->fattr, fattr,sizeof (struct cifs_fattr )); -list_add_tail (&de->entry, &cde->entries); +list_add_tail (&de->head, &cde->entries); } static bool cifs_dir_emit(struct dir_context *ctx,
fs/cifs/sess.c +4 -4
@@ -199,7 +199,7 @@ int cifs_try_adding_channels(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses)*/ spin_lock (&ses->iface_lock); iface = list_first_entry(&ses->iface_list, struct cifs_server_iface, - iface_head); + head);spin_unlock (&ses->iface_lock);while (left >0 ) {
@@ -218,7 +218,7 @@ int cifs_try_adding_channels(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses) }list_for_each_entry_safe_from (iface, niface, &ses->iface_list, - iface_head) { + head) {/* skip ifaces that are unusable */ if (!iface->is_active || (is_ses_using_iface(ses, iface) &&
@@ -285,7 +285,7 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct cifs_server_info *server)spin_lock (&ses->iface_lock);/* then look for a new one */ -list_for_each_entry (iface, &ses->iface_list, iface_head) { +list_for_each_entry (iface, &ses->iface_list, head) {if (!iface->is_active || (is_ses_using_iface (ses, iface) && !iface->rss_capable)) {
@@ -294,7 +294,7 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct cifs_server_info *server)kref_get (&iface->refcount); } -if (!list_entry_is_head (iface, &ses->iface_list, iface_head)) { +if (!list_entry_is_head (iface, &ses->iface_list, head)) { rc =1 ; iface =NULL ;cifs_dbg (FYI ,"unable to find a suitable iface\n" );
fs/cifs/smb1ops.c +2 -2
@@ -93,7 +93,7 @@ cifs_find_mid(struct cifs_server_info *server, char *buffer)struct mid_q_entry *mid;spin_lock (&g_mid_lock); -list_for_each_entry (mid, &server->pending_mid_q, qhead) { +list_for_each_entry (mid, &server->pending_mid_q, head) {if (compare_mid (mid->mid, buf) && mid->mid_state ==MID_REQUEST_SUBMITTED &&le16_to_cpu (mid->command) == buf->Command) {
@@ -195,7 +195,7 @@ cifs_get_next_mid(struct cifs_server_info *server) cur_mid++; num_mids =0 ; -list_for_each_entry (mid_entry, &server->pending_mid_q, qhead) { +list_for_each_entry (mid_entry, &server->pending_mid_q, head) { ++num_mids;if (mid_entry->mid == cur_mid && mid_entry->mid_state ==MID_REQUEST_SUBMITTED ) {
fs/cifs/smb2file.c +7 -7
@@ -133,7 +133,7 @@ smb2_unlock_range(struct cifs_file_info *cfile, struct file_lock *flock, cur = buf;cifs_down_write (&cinode->lock_sem); -list_for_each_entry_safe (li, tmp, &cfile->llist->locks, llist) { +list_for_each_entry_safe (li, tmp, &cfile->fid_locks->locks, head) {if (flock->fl_start > li->offset || (flock->fl_start + length) < (li->offset + li->length))
@@ -150,7 +150,7 @@ smb2_unlock_range(struct cifs_file_info *cfile, struct file_lock *flock,* We can cache brlock requests - simply remove a lock * from the file's list. */ -list_del (&li->llist); +list_del (&li->head);cifs_del_lock_waiters (li);kfree (li);continue ;
@@ -162,7 +162,7 @@ smb2_unlock_range(struct cifs_file_info *cfile, struct file_lock *flock,* We need to save a lock here to let us add it again to the * file's list if the unlock range request fails on the server. */ -list_move (&li->llist, &tmp_llist); +list_move (&li->head, &tmp_llist);if (++num == max_num) { stored_rc = smb2_lockv(xid, tcon, cfile->fid.persistent_fid,
@@ -175,7 +175,7 @@ smb2_unlock_range(struct cifs_file_info *cfile, struct file_lock *flock,* the file's list. */ cifs_move_llist (&tmp_llist, - &cfile->llist->locks); + &cfile->fid_locks->locks); rc = stored_rc; }else /*
@@ -193,7 +193,7 @@ smb2_unlock_range(struct cifs_file_info *cfile, struct file_lock *flock, cfile->fid.volatile_fid, current->tgid, num, buf);if (stored_rc) { -cifs_move_llist (&tmp_llist, &cfile->llist->locks); +cifs_move_llist (&tmp_llist, &cfile->fid_locks->locks); rc = stored_rc; }else cifs_free_llist (&tmp_llist);
@@ -215,7 +215,7 @@ smb2_push_mand_fdlocks(struct cifs_fid_locks *fdlocks, const unsigned int xid,struct smb2_lock_element *cur = buf;struct cifs_tcon *tcon =tlink_tcon (cfile->tlink); -list_for_each_entry (li, &fdlocks->locks, llist) { +list_for_each_entry (li, &fdlocks->locks, head) { cur->Length =cpu_to_le64 (li->length); cur->Offset =cpu_to_le64 (li->offset); cur->Flags = cpu_to_le32(li->type |
@@ -275,7 +275,7 @@ smb2_push_mandatory_locks(struct cifs_file_info *cfile)return -ENOMEM ; } -list_for_each_entry (fdlocks, &cinode->llist, llist) { +list_for_each_entry (fdlocks, &cinode->fid_locks_list, head) { stored_rc =smb2_push_mand_fdlocks (fdlocks, xid, buf, max_num);if (stored_rc) rc = stored_rc;
fs/cifs/smb2misc.c +16 -16
@@ -154,7 +154,7 @@ smb2_check_message(char *buf, unsigned int len, struct cifs_server_info *server)/* decrypt frame now that it is completely read in */ spin_lock (&g_servers_lock); -list_for_each_entry (iter, &server->smb_ses_list, smb_ses_list) { +list_for_each_entry (iter, &server->ses_list, head) {if (iter->Suid ==le64_to_cpu (thdr->SessionId)) { ses = iter;break ;
@@ -549,7 +549,7 @@ smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp) lease_state =le32_to_cpu (rsp->NewLeaseState); -list_for_each_entry (cfile, &tcon->openFileList, tlist) { +list_for_each_entry (cfile, &tcon->open_files_list, tcon_head) { cinode =CIFS_I (d_inode (cfile->dentry)); if (memcmp(cinode->lease_key, rsp->LeaseKey,
@@ -587,7 +587,7 @@ smb2_tcon_find_pending_open_lease(struct cifs_tcon *tcon,struct cifs_pending_open *open;struct cifs_pending_open *found =NULL ; -list_for_each_entry (open, &tcon->pending_opens, olist) { +list_for_each_entry (open, &tcon->pending_opens, head) {if (memcmp (open->lease_key, rsp->LeaseKey,SMB2_LEASE_KEY_SIZE ))continue ;
@@ -619,14 +619,14 @@ smb2_is_valid_lease_break(char *buffer)/* look up tcon based on tid & uid */ spin_lock (&g_servers_lock); -list_for_each_entry (server, &g_servers_list, server_head) { -list_for_each_entry (ses, &server->smb_ses_list, smb_ses_list) { -list_for_each_entry (tcon, &ses->tcon_list, tcon_list) { -spin_lock (&tcon->open_file_lock); +list_for_each_entry (server, &g_servers_list, head) { +list_for_each_entry (ses, &server->ses_list, head) { +list_for_each_entry (tcon, &ses->tcon_list, head) { +spin_lock (&tcon->open_files_lock);cifs_stats_inc ( &tcon->stats.cifs_stats.num_oplock_brks);if (smb2_tcon_has_lease (tcon, rsp)) { -spin_unlock (&tcon->open_file_lock); +spin_unlock (&tcon->open_files_lock);spin_unlock (&g_servers_lock);return true; }
@@ -639,14 +639,14 @@ smb2_is_valid_lease_break(char *buffer) tlink =cifs_get_tlink (open->tlink);memcpy (lease_key, open->lease_key,SMB2_LEASE_KEY_SIZE ); -spin_unlock (&tcon->open_file_lock); +spin_unlock (&tcon->open_files_lock);spin_unlock (&g_servers_lock);smb2_queue_pending_open_break (tlink, lease_key, rsp->NewLeaseState);return true; } -spin_unlock (&tcon->open_file_lock); +spin_unlock (&tcon->open_files_lock);if (tcon->crfid.is_valid && !memcmp(rsp->LeaseKey,
@@ -700,11 +700,11 @@ smb2_is_valid_oplock_break(char *buffer, struct cifs_server_info *server) /* look up tcon based on tid & uid */ spin_lock(&g_servers_lock); - list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) { - list_for_each_entry(tcon, &ses->tcon_list, tcon_list) { + list_for_each_entry(ses, &server->ses_list, head) { + list_for_each_entry(tcon, &ses->tcon_list, head) { - spin_lock(&tcon->open_file_lock); - list_for_each_entry(cfile, &tcon->openFileList, tlist) { + spin_lock(&tcon->open_files_lock); + list_for_each_entry(cfile, &tcon->open_files_list, tcon_head) { if (rsp->PersistentFid != cfile->fid.persistent_fid || rsp->VolatileFid !=
@@ -732,11 +732,11 @@ smb2_is_valid_oplock_break(char *buffer, struct cifs_server_info *server)cifs_queue_oplock_break (cfile); -spin_unlock (&tcon->open_file_lock); +spin_unlock (&tcon->open_files_lock);spin_unlock (&g_servers_lock);return true; } -spin_unlock (&tcon->open_file_lock); +spin_unlock (&tcon->open_files_lock); } }spin_unlock (&g_servers_lock);
fs/cifs/smb2ops.c +15 -16
@@ -347,13 +347,13 @@ __smb2_find_mid(struct cifs_server_info *server, char *buf, bool dequeue) }spin_lock (&g_mid_lock); -list_for_each_entry (mid, &server->pending_mid_q, qhead) { +list_for_each_entry (mid, &server->pending_mid_q, head) {if ((mid->mid == wire_mid) && (mid->mid_state ==MID_REQUEST_SUBMITTED ) && (mid->command == shdr->Command)) {kref_get (&mid->refcount);if (dequeue) { -list_del_init (&mid->qhead); +list_del_init (&mid->head); mid->mid_flags |=MID_DELETED ; }spin_unlock (&g_mid_lock);
@@ -536,7 +536,7 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf,* when the last user calls a kref_put on it */ list_for_each_entry_safe (iface, niface, &ses->iface_list, - iface_head) { + head) { iface->is_active =0 ;kref_put (&iface->refcount, release_iface); }
@@ -595,8 +595,7 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf,*/ spin_lock (&ses->iface_lock); iface = niface =NULL ; -list_for_each_entry_safe (iface, niface, &ses->iface_list, - iface_head) { +list_for_each_entry_safe (iface, niface, &ses->iface_list, head) { ret =iface_cmp (iface, &tmp_iface);if (!ret) {/* just get a ref so that it doesn't get picked/freed */
@@ -631,11 +630,11 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf, le32_to_cpu(p->Capability));spin_lock (&ses->iface_lock); -if (!list_entry_is_head (iface, &ses->iface_list, iface_head)) { -list_add_tail (&info->iface_head, &iface->iface_head); +if (!list_entry_is_head (iface, &ses->iface_list, head)) { +list_add_tail (&info->head, &iface->head);kref_put (&iface->refcount, release_iface); }else -list_add_tail (&info->iface_head, &ses->iface_list); +list_add_tail (&info->head, &ses->iface_list);spin_unlock (&ses->iface_lock); ses->iface_count++;
@@ -730,8 +729,8 @@ smb2_close_cached_fid(struct kref *ref)* Delete all cached dirent names */ mutex_lock (&cfid->dirents.de_mutex); -list_for_each_entry_safe (dirent, q, &cfid->dirents.entries, entry) { -list_del (&dirent->entry); +list_for_each_entry_safe (dirent, q, &cfid->dirents.entries, head) { +list_del (&dirent->head);kfree (dirent->name);kfree (dirent); }
@@ -2582,8 +2581,8 @@ smb2_is_network_name_deleted(char *buf, struct cifs_server_info *server)return ;spin_lock (&g_servers_lock); -list_for_each_entry (ses, &server->smb_ses_list, smb_ses_list) { -list_for_each_entry (tcon, &ses->tcon_list, tcon_list) { +list_for_each_entry (ses, &server->ses_list, head) { +list_for_each_entry (tcon, &ses->tcon_list, head) {if (tcon->tid ==le32_to_cpu (shdr->Id.SyncId.TreeId)) { tcon->need_reconnect = true;spin_unlock (&g_servers_lock);
@@ -2942,7 +2941,7 @@ smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses,spin_lock (&g_servers_lock); tcon =list_first_entry_or_null (&ses->tcon_list, struct cifs_tcon, - tcon_list); + head);if (tcon) tcon->tc_count++;spin_unlock (&g_servers_lock);
@@ -4558,8 +4557,8 @@ smb2_get_enc_key(struct cifs_server_info *server, __u64 ses_id, int enc, u8 *keyu8 *ses_enc_key;spin_lock (&g_servers_lock); -list_for_each_entry (server, &g_servers_list, server_head) { -list_for_each_entry (ses, &server->smb_ses_list, smb_ses_list) { +list_for_each_entry (server, &g_servers_list, head) { +list_for_each_entry (ses, &server->ses_list, head) {if (ses->Suid == ses_id) { ses_enc_key = enc ? ses->smb3encryptionkey : ses->smb3decryptionkey;
@@ -5088,7 +5087,7 @@ static void smb2_decrypt_offload(struct work_struct *work) }else { mid->mid_state =MID_REQUEST_SUBMITTED ; mid->mid_flags &= ~(MID_DELETED ); -list_add_tail (&mid->qhead, +list_add_tail (&mid->head, &dw->server->pending_mid_q);spin_unlock (&g_mid_lock);spin_unlock (&g_servers_lock);
fs/cifs/smb2pdu.c +2 -2
@@ -3804,11 +3804,11 @@ void smb2_reconnect_server(struct work_struct *work)cifs_dbg (FYI ,"Reconnecting tcons and channels\n" );spin_lock (&g_servers_lock); -list_for_each_entry (ses, &pserver->smb_ses_list, smb_ses_list) { +list_for_each_entry (ses, &pserver->ses_list, head) { tcon_selected = false; -list_for_each_entry (tcon, &ses->tcon_list, tcon_list) { +list_for_each_entry (tcon, &ses->tcon_list, head) {if (tcon->need_reconnect || tcon->need_reopen_files) { tcon->tc_count++;list_add_tail (&tcon->rlist, &tmp_list);
fs/cifs/smb2transport.c +5 -5
@@ -88,8 +88,8 @@ int smb2_get_sign_key(__u64 ses_id, struct cifs_server_info *server, u8 *key)spin_lock (&g_servers_lock); -list_for_each_entry (it, &g_servers_list, server_head) { -list_for_each_entry (ses, &it->smb_ses_list, smb_ses_list) { +list_for_each_entry (it, &g_servers_list, head) { +list_for_each_entry (ses, &it->ses_list, head) {if (ses->Suid == ses_id) goto found; }
@@ -142,7 +142,7 @@ smb2_find_smb_ses_unlocked(struct cifs_server_info *server, __u64 ses_id) {struct cifs_ses *ses; -list_for_each_entry (ses, &server->smb_ses_list, smb_ses_list) { +list_for_each_entry (ses, &server->ses_list, head) {if (ses->Suid != ses_id)continue ; ++ses->ses_count;
@@ -169,7 +169,7 @@ smb2_find_smb_sess_tcon_unlocked(struct cifs_ses *ses, __u32 tid) {struct cifs_tcon *tcon; -list_for_each_entry (tcon, &ses->tcon_list, tcon_list) { +list_for_each_entry (tcon, &ses->tcon_list, head) {if (tcon->tid != tid)continue ; ++tcon->tc_count;
@@ -802,7 +802,7 @@ smb2_get_mid_entry(struct cifs_ses *ses, struct cifs_server_info *server,if (*mid ==NULL )return -ENOMEM ;spin_lock (&g_mid_lock); -list_add_tail (&(*mid)->qhead, &server->pending_mid_q); +list_add_tail (&(*mid)->head, &server->pending_mid_q);spin_unlock (&g_mid_lock);return 0 ;
fs/cifs/transport.c +4 -4
@@ -169,7 +169,7 @@ cifs_delete_mid(struct mid_q_entry *mid) {spin_lock (&g_mid_lock);if (!(mid->mid_flags &MID_DELETED )) { -list_del_init (&mid->qhead); +list_del_init (&mid->head); mid->mid_flags |=MID_DELETED ; }spin_unlock (&g_mid_lock);
@@ -749,7 +749,7 @@ static int allocate_mid(struct cifs_ses *ses, struct smb_hdr *in_buf,if (*ppmidQ ==NULL )return -ENOMEM ;spin_lock (&g_mid_lock); -list_add_tail (&(*ppmidQ)->qhead, &ses->server->pending_mid_q); +list_add_tail (&(*ppmidQ)->head, &ses->server->pending_mid_q);spin_unlock (&g_mid_lock);return 0 ; }
@@ -850,7 +850,7 @@ cifs_call_async(struct cifs_server_info *server, struct smb_rqst *rqst,/* put it on the pending_mid_q */ spin_lock (&g_mid_lock); -list_add_tail (&mid->qhead, &server->pending_mid_q); +list_add_tail (&mid->head, &server->pending_mid_q);spin_unlock (&g_mid_lock);/*
@@ -928,7 +928,7 @@ cifs_sync_mid_result(struct mid_q_entry *mid, struct cifs_server_info *server)break ;default :if (!(mid->mid_flags &MID_DELETED )) { -list_del_init (&mid->qhead); +list_del_init (&mid->head); mid->mid_flags |=MID_DELETED ; } cifs_server_dbg(VFS, "%s: invalid mid state mid=%llu state=%d\n",
Signature · 1 line
2.35.3
RFC PATCH v2 10/10 cifs: rename more list_heads, remove redundant prefixes
In reply to Enzo MatsumiyaRename more list_heads to better represent whether they're a list entry or a "real" list.
Remove smb_rqst "rq_" field prefixes.
--- fs/cifs/cifsencrypt.c | 30 +++---- fs/cifs/cifsglob.h | 14 +-- fs/cifs/cifssmb.c | 36 ++++---- fs/cifs/connect.c | 8 +- fs/cifs/dfs_cache.c | 158 ++++++++++++++++---------------- fs/cifs/dfs_cache.h | 40 ++++----- fs/cifs/misc.c | 10 +-- fs/cifs/smb1ops.c | 2 +- fs/cifs/smb2inode.c | 52 +++++------ fs/cifs/smb2ops.c | 184 ++++++++++++++++++------------------- fs/cifs/smb2pdu.c | 194 ++++++++++++++++++++-------------------- fs/cifs/smb2transport.c | 28 +++--- fs/cifs/smbdirect.c | 18 ++-- fs/cifs/transport.c | 64 ++++++------- 14 files changed, 419 insertions(+), 419 deletions(-)
fs/cifs/cifsencrypt.c +15 -15
@@ -30,8 +30,8 @@ int __cifs_calc_signature(struct smb_rqst *rqst, {int i;int rc; -struct kvec *iov = rqst->rq_iov; -int n_vec = rqst->rq_nvec; +struct kvec *iov = rqst->iov; +int n_vec = rqst->nvec;int is_smb2 = server->vals->header_preamble_size ==0 ;/* iov[0] is actual data and not the rfc1002 length for SMB2+ */
@@ -63,23 +63,23 @@ int __cifs_calc_signature(struct smb_rqst *rqst, }/* now hash over the rq_pages array */ -for (i =0 ; i < rqst->rq_npages; i++) { +for (i =0 ; i < rqst->npages; i++) {void *kaddr;unsigned int len, offset;rqst_page_get_length (rqst, i, &len, &offset); - kaddr = (char *)kmap (rqst->rq_pages[i]) + offset; + kaddr = (char *)kmap (rqst->pages[i]) + offset; rc =crypto_shash_update (shash, kaddr, len);if (rc) {cifs_dbg (VFS ,"%s: Could not update with payload\n" , __func__); -kunmap (rqst->rq_pages[i]); +kunmap (rqst->pages[i]);return rc; } -kunmap (rqst->rq_pages[i]); +kunmap (rqst->pages[i]); } rc =crypto_shash_final (shash, signature);
@@ -101,7 +101,7 @@ static int cifs_calc_signature(struct smb_rqst *rqst, {int rc; -if (!rqst->rq_iov || !signature || !server) +if (!rqst->iov || !signature || !server)return -EINVAL ; rc = cifs_alloc_hash("md5", &server->secmech.md5,
@@ -132,10 +132,10 @@ int cifs_sign_rqst(struct smb_rqst *rqst, struct cifs_server_info *server, {int rc =0 ;char smb_signature[20 ]; -struct smb_hdr *cifs_pdu = (struct smb_hdr *)rqst->rq_iov[0 ].iov_base; +struct smb_hdr *cifs_pdu = (struct smb_hdr *)rqst->iov[0 ].iov_base; -if (rqst->rq_iov[0 ].iov_len !=4 || - rqst->rq_iov[0 ].iov_base +4 != rqst->rq_iov[1 ].iov_base) +if (rqst->iov[0 ].iov_len !=4 || + rqst->iov[0 ].iov_base +4 != rqst->iov[1 ].iov_base)return -EIO ;if ((cifs_pdu ==NULL ) || (server ==NULL ))
@@ -173,8 +173,8 @@ int cifs_sign_rqst(struct smb_rqst *rqst, struct cifs_server_info *server,int cifs_sign_smbv (struct kvec *iov,int n_vec,struct cifs_server_info *server,__u32 *pexpected_response_sequence) { -struct smb_rqst rqst = { .rq_iov = iov, - .rq_nvec = n_vec }; +struct smb_rqst rqst = { .iov = iov, + .nvec = n_vec };return cifs_sign_rqst (&rqst, server, pexpected_response_sequence); }
@@ -201,10 +201,10 @@ int cifs_verify_signature(struct smb_rqst *rqst,unsigned int rc;char server_response_sig[8 ];char what_we_think_sig_should_be[20 ]; -struct smb_hdr *cifs_pdu = (struct smb_hdr *)rqst->rq_iov[0 ].iov_base; +struct smb_hdr *cifs_pdu = (struct smb_hdr *)rqst->iov[0 ].iov_base; -if (rqst->rq_iov[0 ].iov_len !=4 || - rqst->rq_iov[0 ].iov_base +4 != rqst->rq_iov[1 ].iov_base) +if (rqst->iov[0 ].iov_len !=4 || + rqst->iov[0 ].iov_base +4 != rqst->iov[1 ].iov_base)return -EIO ;if (cifs_pdu ==NULL || server ==NULL )
fs/cifs/cifsglob.h +7 -7
@@ -190,13 +190,13 @@ struct cifs_cred {* to start at the beginning of the first page. */ struct smb_rqst { -struct kvec *rq_iov;/* array of kvecs */ -unsigned int rq_nvec;/* number of kvecs in array */ -struct page **rq_pages;/* pointer to array of page ptrs */ -unsigned int rq_offset;/* the offset to the 1st page */ -unsigned int rq_npages;/* number pages in array */ -unsigned int rq_pagesz;/* page size to use */ -unsigned int rq_tailsz;/* length of last page */ +struct kvec *iov;/* array of kvecs */ +unsigned int nvec;/* number of kvecs in array */ +struct page **pages;/* pointer to array of page ptrs */ +unsigned int offset;/* the offset to the 1st page */ +unsigned int npages;/* number pages in array */ +unsigned int pagesz;/* page size to use */ +unsigned int tailsz;/* length of last page */ };struct mid_q_entry ;
fs/cifs/cifssmb.c +18 -18
@@ -694,8 +694,8 @@ CIFSSMBEcho(struct cifs_server_info *server)ECHO_REQ *smb;int rc =0 ;struct kvec iov[2 ]; -struct smb_rqst rqst = { .rq_iov = iov, - .rq_nvec =2 }; +struct smb_rqst rqst = { .iov = iov, + .nvec =2 };cifs_dbg (FYI ,"In echo request\n" );
@@ -1563,13 +1563,13 @@ cifs_readv_callback(struct mid_q_entry *mid)struct cifs_readdata *rdata = mid->callback_data;struct cifs_tcon *tcon =tlink_tcon (rdata->cfile->tlink);struct cifs_server_info *server = tcon->ses->server; -struct smb_rqst rqst = { .rq_iov = rdata->iov, - .rq_nvec =2 , - .rq_pages = rdata->pages, - .rq_offset = rdata->page_offset, - .rq_npages = rdata->nr_pages, - .rq_pagesz = rdata->pagesz, - .rq_tailsz = rdata->tailsz }; +struct smb_rqst rqst = { .iov = rdata->iov, + .nvec =2 , + .pages = rdata->pages, + .offset = rdata->page_offset, + .npages = rdata->nr_pages, + .pagesz = rdata->pagesz, + .tailsz = rdata->tailsz };struct cifs_credits credits = { .value =1 , .instance =0 }; cifs_dbg(FYI, "%s: mid=%llu state=%d result=%d bytes=%u\n",
@@ -1619,8 +1619,8 @@ cifs_async_readv(struct cifs_readdata *rdata)READ_REQ *smb =NULL ;int wct;struct cifs_tcon *tcon =tlink_tcon (rdata->cfile->tlink); -struct smb_rqst rqst = { .rq_iov = rdata->iov, - .rq_nvec =2 }; +struct smb_rqst rqst = { .iov = rdata->iov, + .nvec =2 };cifs_dbg (FYI ,"%s: offset=%llu bytes=%u\n" , __func__, rdata->offset, rdata->bytes);
@@ -2183,13 +2183,13 @@ cifs_async_writev(struct cifs_writedata *wdata, iov[1 ].iov_len =get_rfc1002_length (smb) +1 ; iov[1 ].iov_base = (char *)smb +4 ; - rqst.rq_iov = iov; - rqst.rq_nvec =2 ; - rqst.rq_pages = wdata->pages; - rqst.rq_offset = wdata->page_offset; - rqst.rq_npages = wdata->nr_pages; - rqst.rq_pagesz = wdata->pagesz; - rqst.rq_tailsz = wdata->tailsz; + rqst.iov = iov; + rqst.nvec =2 ; + rqst.pages = wdata->pages; + rqst.offset = wdata->page_offset; + rqst.npages = wdata->nr_pages; + rqst.pagesz = wdata->pagesz; + rqst.tailsz = wdata->tailsz;cifs_dbg (FYI ,"async write at %llu %u bytes\n" , wdata->offset, wdata->bytes);
fs/cifs/connect.c +4 -4
@@ -551,7 +551,7 @@ static int reconnect_dfs_server(struct cifs_server_info *server) }while (server->status ==CIFS_STATUS_NEED_RECONNECT );if (target_hint) -dfs_cache_noreq_update_tgthint (refpath, target_hint); +dfs_cache_noreq_update_tgt_hint (refpath, target_hint);dfs_cache_free_tgts (&tl);
@@ -3580,7 +3580,7 @@ static int connect_dfs_target(struct mount_ctx *mnt_ctx, const char *full_path,if (!rc) {if (cifs_is_referral_server (mnt_ctx->tcon, &ref))set_root_ses (mnt_ctx); - rc =dfs_cache_update_tgthint (mnt_ctx->xid, mnt_ctx->root_ses, cifs_sb->local_nls, + rc =dfs_cache_update_tgt_hint (mnt_ctx->xid, mnt_ctx->root_ses, cifs_sb->local_nls,cifs_remap (cifs_sb), ref_path, tit); }
@@ -4496,7 +4496,7 @@ static int __tree_connect_dfs_target(const unsigned int xid, struct cifs_tcon *t rc = ops->tree_connect (xid, tcon->ses, tree, tcon, cifs_sb->local_nls);if (rc)continue ; - rc =dfs_cache_noreq_update_tgthint (server->current_fullpath +1 , tit); + rc =dfs_cache_noreq_update_tgt_hint (server->current_fullpath +1 , tit);if (!rc) rc =cifs_update_super_prepath (cifs_sb, prefix); }else {
@@ -4506,7 +4506,7 @@ static int __tree_connect_dfs_target(const unsigned int xid, struct cifs_tcon *tif (!rc) { rc = -EREMOTE ; -list_replace_init (&ntl.tl_list, &tl->tl_list); +list_replace_init (&ntl.list, &tl->list); }else dfs_cache_free_tgts (&ntl); }
fs/cifs/dfs_cache.c +79 -79
413 lines not on this page · raw message
fs/cifs/dfs_cache.h +20 -20
@@ -13,17 +13,17 @@#include <linux/uuid.h> #include "cifsglob.h" -#define DFS_CACHE_TGT_LIST_INIT (var) { .tl_numtgts = 0, .tl_list = LIST_HEAD_INIT((var).tl_list), } +#define DFS_CACHE_TGT_LIST_INIT (var) { .num_tgts = 0, .list = LIST_HEAD_INIT((var).list), }struct dfs_cache_tgt_list { -int tl_numtgts; -struct list_head tl_list; +int num_tgts; +struct list_head list; };struct dfs_cache_tgt_iterator { -char *it_name; -int it_path_consumed; -struct list_head it_list; +char *name; +int path_consumed; +struct list_head head; };int dfs_cache_init (void );
@@ -35,10 +35,10 @@ int dfs_cache_find(const unsigned int xid, struct cifs_ses *ses, const struct nl struct dfs_cache_tgt_list *tgt_list);int dfs_cache_noreq_find (const char *path,struct dfs_info3_param *ref,struct dfs_cache_tgt_list *tgt_list); -int dfs_cache_update_tgthint (const unsigned int xid,struct cifs_ses *ses, +int dfs_cache_update_tgt_hint (const unsigned int xid,struct cifs_ses *ses,const struct nls_table *cp,int remap,const char *path,const struct dfs_cache_tgt_iterator *it); -int dfs_cache_noreq_update_tgthint (const char *path,const struct dfs_cache_tgt_iterator *it); +int dfs_cache_noreq_update_tgt_hint (const char *path,const struct dfs_cache_tgt_iterator *it);int dfs_cache_get_tgt_referral (const char *path,const struct dfs_cache_tgt_iterator *it,struct dfs_info3_param *ref); int dfs_cache_get_tgt_share(char *path, const struct dfs_cache_tgt_iterator *it, char **share,
@@ -52,10 +52,10 @@ static inline struct dfs_cache_tgt_iterator * dfs_cache_get_next_tgt(struct dfs_cache_tgt_list *tl, struct dfs_cache_tgt_iterator *it) { -if (!tl ||list_empty (&tl->tl_list) || !it || -list_is_last (&it->it_list, &tl->tl_list)) +if (!tl ||list_empty (&tl->list) || !it || +list_is_last (&it->head, &tl->list))return NULL ; -return list_next_entry (it, it_list); +return list_next_entry (it, head); } static inline struct dfs_cache_tgt_iterator *
@@ -63,35 +63,35 @@ dfs_cache_get_tgt_iterator(struct dfs_cache_tgt_list *tl) {if (!tl)return NULL ; -return list_first_entry_or_null (&tl->tl_list, +return list_first_entry_or_null (&tl->list, struct dfs_cache_tgt_iterator, - it_list); + head); }static inline void dfs_cache_free_tgts (struct dfs_cache_tgt_list *tl) {struct dfs_cache_tgt_iterator *it, *nit; -if (!tl ||list_empty (&tl->tl_list)) +if (!tl ||list_empty (&tl->list))return ; -list_for_each_entry_safe (it, nit, &tl->tl_list, it_list) { -list_del (&it->it_list); -kfree (it->it_name); +list_for_each_entry_safe (it, nit, &tl->list, head) { +list_del (&it->head); +kfree (it->name);kfree (it); } - tl->tl_numtgts =0 ; + tl->num_tgts =0 ; }static inline const char *dfs_cache_get_tgt_name (const struct dfs_cache_tgt_iterator *it) { -return it ? it->it_name :NULL ; +return it ? it->name :NULL ; }static inline int dfs_cache_get_nr_tgts (const struct dfs_cache_tgt_list *tl) { -return tl ? tl->tl_numtgts :0 ; +return tl ? tl->num_tgts :0 ; }#endif /* _CIFS_DFS_CACHE_H */
fs/cifs/misc.c +5 -5
@@ -1130,13 +1130,13 @@ cifs_free_hash(struct crypto_shash **shash, struct sdesc **sdesc)void rqst_page_get_length (struct smb_rqst *rqst,unsigned int page,unsigned int *len,unsigned int *offset) { - *len = rqst->rq_pagesz; - *offset = (page ==0 ) ? rqst->rq_offset :0 ; + *len = rqst->pagesz; + *offset = (page ==0 ) ? rqst->offset :0 ; -if (rqst->rq_npages ==1 || page == rqst->rq_npages-1 ) - *len = rqst->rq_tailsz; +if (rqst->npages ==1 || page == rqst->npages-1 ) + *len = rqst->tailsz;else if (page ==0 ) - *len = rqst->rq_pagesz - rqst->rq_offset; + *len = rqst->pagesz - rqst->offset; }void extract_unc_hostname (const char *unc,const char **h,size_t *len)
fs/cifs/smb1ops.c +1 -1
@@ -30,7 +30,7 @@ send_nt_cancel(struct cifs_server_info *server, struct smb_rqst *rqst, struct mid_q_entry *mid) {int rc =0 ; -struct smb_hdr *in_buf = (struct smb_hdr *)rqst->rq_iov[0 ].iov_base; +struct smb_hdr *in_buf = (struct smb_hdr *)rqst->iov[0 ].iov_base;/* -4 for RFC1001 length and +2 for BCC field */ in_buf->smb_buf_length =cpu_to_be32 (sizeof (struct smb_hdr ) -4 +2 );
fs/cifs/smb2inode.c +26 -26
139 lines not on this page · raw message
fs/cifs/smb2ops.c +92 -92
421 lines not on this page · raw message
fs/cifs/smb2pdu.c +97 -97
471 lines not on this page · raw message
fs/cifs/smb2transport.c +14 -14
@@ -216,7 +216,7 @@ smb2_calc_signature(struct smb_rqst *rqst, struct cifs_server_info *server,int rc;unsigned char smb2_signature[SMB2_HMACSHA256_SIZE ];unsigned char *sigptr = smb2_signature; -struct kvec *iov = rqst->rq_iov; +struct kvec *iov = rqst->iov;struct smb2_hdr *shdr = (struct smb2_hdr *)iov[0 ].iov_base;struct cifs_ses *ses;struct shash_desc *shash;
@@ -269,7 +269,7 @@ smb2_calc_signature(struct smb_rqst *rqst, struct cifs_server_info *server,* __cifs_calc_signature(). */ drqst = *rqst; -if (drqst.rq_nvec >=2 && iov[0 ].iov_len ==4 ) { +if (drqst.nvec >=2 && iov[0 ].iov_len ==4 ) { rc =crypto_shash_update (shash, iov[0 ].iov_base, iov[0 ].iov_len);if (rc) {
@@ -278,8 +278,8 @@ smb2_calc_signature(struct smb_rqst *rqst, struct cifs_server_info *server, __func__); goto out; } - drqst.rq_iov++; - drqst.rq_nvec--; + drqst.iov++; + drqst.nvec--; } rc =__cifs_calc_signature (&drqst, server, sigptr, shash);
@@ -548,7 +548,7 @@ smb3_calc_signature(struct smb_rqst *rqst, struct cifs_server_info *server,int rc;unsigned char smb3_signature[SMB2_CMACAES_SIZE ];unsigned char *sigptr = smb3_signature; -struct kvec *iov = rqst->rq_iov; +struct kvec *iov = rqst->iov;struct smb2_hdr *shdr = (struct smb2_hdr *)iov[0 ].iov_base;struct shash_desc *shash;struct crypto_shash *hash;
@@ -599,7 +599,7 @@ smb3_calc_signature(struct smb_rqst *rqst, struct cifs_server_info *server,* __cifs_calc_signature(). */ drqst = *rqst; -if (drqst.rq_nvec >=2 && iov[0 ].iov_len ==4 ) { +if (drqst.nvec >=2 && iov[0 ].iov_len ==4 ) { rc =crypto_shash_update (shash, iov[0 ].iov_base, iov[0 ].iov_len);if (rc) {
@@ -607,8 +607,8 @@ smb3_calc_signature(struct smb_rqst *rqst, struct cifs_server_info *server, __func__); goto out; } - drqst.rq_iov++; - drqst.rq_nvec--; + drqst.iov++; + drqst.nvec--; } rc =__cifs_calc_signature (&drqst, server, sigptr, shash);
@@ -631,7 +631,7 @@ smb2_sign_rqst(struct smb_rqst *rqst, struct cifs_server_info *server)bool is_binding;bool is_signed; - shdr = (struct smb2_hdr *)rqst->rq_iov[0 ].iov_base; + shdr = (struct smb2_hdr *)rqst->iov[0 ].iov_base; ssr = (struct smb2_sess_setup_req *)shdr; is_binding = shdr->Command == SMB2_SESSION_SETUP &&
@@ -663,7 +663,7 @@ smb2_verify_signature(struct smb_rqst *rqst, struct cifs_server_info *server)unsigned int rc;char server_response_sig[SMB2_SIGNATURE_SIZE ];struct smb2_hdr *shdr = - (struct smb2_hdr *)rqst->rq_iov[0 ].iov_base; + (struct smb2_hdr *)rqst->iov[0 ].iov_base; if ((shdr->Command == SMB2_NEGOTIATE) || (shdr->Command == SMB2_SESSION_SETUP) ||
@@ -814,8 +814,8 @@ smb2_check_receive(struct mid_q_entry *mid, struct cifs_server_info *server, {unsigned int len = mid->resp_buf_size;struct kvec iov[1 ]; -struct smb_rqst rqst = { .rq_iov = iov, - .rq_nvec =1 }; +struct smb_rqst rqst = { .iov = iov, + .nvec =1 }; iov[0 ].iov_base = (char *)mid->resp_buf; iov[0 ].iov_len = len;
@@ -840,7 +840,7 @@ smb2_setup_request(struct cifs_ses *ses, struct cifs_server_info *server, {int rc;struct smb2_hdr *shdr = - (struct smb2_hdr *)rqst->rq_iov[0 ].iov_base; + (struct smb2_hdr *)rqst->iov[0 ].iov_base;struct mid_q_entry *mid;smb2_seq_num_into_buf (server, shdr);
@@ -866,7 +866,7 @@ smb2_setup_async_request(struct cifs_server_info *server, struct smb_rqst *rqst) {int rc;struct smb2_hdr *shdr = - (struct smb2_hdr *)rqst->rq_iov[0 ].iov_base; + (struct smb2_hdr *)rqst->iov[0 ].iov_base;struct mid_q_entry *mid;spin_lock (&g_servers_lock);
fs/cifs/smbdirect.c +9 -9
@@ -2025,17 +2025,17 @@ int smbd_send(struct cifs_server_info *server, rqst_idx =0 ; next_rqst: rqst = &rqst_array[rqst_idx]; - iov = rqst->rq_iov; + iov = rqst->iov;cifs_dbg (FYI ,"Sending smb (RDMA): idx=%d smb_len=%lu\n" , rqst_idx,smb_rqst_len (server, rqst)); -for (i =0 ; i < rqst->rq_nvec; i++) +for (i =0 ; i < rqst->nvec; i++)dump_smb (iov[i].iov_base, iov[i].iov_len); -log_write (INFO ,"rqst_idx=%d nvec=%d rqst->rq_npages=%d rq_pagesz=%d rq_tailsz=%d buflen=%lu\n" , - rqst_idx, rqst->rq_nvec, rqst->rq_npages, rqst->rq_pagesz, - rqst->rq_tailsz,smb_rqst_len (server, rqst)); +log_write (INFO ,"rqst_idx=%d nvec=%d rqst->npages=%d rq_pagesz=%d rq_tailsz=%d buflen=%lu\n" , + rqst_idx, rqst->nvec, rqst->npages, rqst->pagesz, + rqst->tailsz,smb_rqst_len (server, rqst)); start = i =0 ; buflen =0 ;
@@ -2080,14 +2080,14 @@ int smbd_send(struct cifs_server_info *server, goto done; } i++; -if (i == rqst->rq_nvec) +if (i == rqst->nvec)break ; } start = i; buflen =0 ; }else { i++; -if (i == rqst->rq_nvec) { +if (i == rqst->nvec) {/* send out all remaining vecs */ remaining_data_length -= buflen; log_write(INFO, "sending iov[] from start=%d i=%d nvecs=%d remaining_data_length=%d\n",
@@ -2104,7 +2104,7 @@ int smbd_send(struct cifs_server_info *server, }/* now sending pages if there are any */ -for (i =0 ; i < rqst->rq_npages; i++) { +for (i =0 ; i < rqst->npages; i++) {unsigned int offset;rqst_page_get_length (rqst, i, &buflen, &offset);
@@ -2120,7 +2120,7 @@ int smbd_send(struct cifs_server_info *server, i, j * max_iov_size + offset, size, remaining_data_length); rc =smbd_post_send_page ( - info, rqst->rq_pages[i], + info, rqst->pages[i], j*max_iov_size + offset, size, remaining_data_length);if (rc)
fs/cifs/transport.c +32 -32
154 lines not on this page · raw message
Signature · 1 line
2.35.3
Tom Talpey
reviewerQuoted 18 lines · Enzo Matsumiya
Hi all,
This patch set (v2) renames several cifs.ko data structures, variables, and functions with the goal to improve readability of the code.
In summary, what's been done:
- change from CamelCase tosnake_case
- try to give more meaning to globals and struct members
- rename status fields (server, ses, tcon), define constants for the various statuses (4/11 can be shared between those structs, others are specific to each)
- rename oflist_headvariables to better represent whether they'are used as a list element ("head") or a list per se. Also tried to give more meaning to these, as "rlist", "tlist", "llist" looked confusing and, sometimes, ambiguous.
- remove redundant prefixes from struct members name, e.g. tcon_tlink's tl_*, smb_rqst's rq_*, cifs_fattr's cf_*, etc
Quoted 6 lines
No functional changes has been made.
I know these touch some very old code that older devs are highly used to, but I see this as an improvement to reading the code for everyone.
I'll be waiting for your reviews and feedback.
Enzo, I think this effort is great. If you combine this modernization with refactoring SMB1 into separate files to make it easier to do away with entirely, I'll be even more supportive.
Tom.
Quoted 70 lines
Cheers,
Enzo
v2:
- remove status typedefs (suggested by Christoph Hellwig)
- define status constants instead, reuse some between different structs so we don't have to create a different set of statuses for each cifs structEnzo Matsumiya (10):
cifs: rename xid/mid globals
cifs: rename global counters
cifs: rename "TCP_Server_Info" struct to "cifs_server_info"
cifs: rename cifs{File,Lock,Inode}Info structs and more
cifs: convert server info vars tosnake_case
cifs: change status and security types enums to constants
cifs: rename cifsFYI todebug_level
cifs: renamelist_headfields
cifs: rename more CamelCase tosnake_case
cifs: rename morelist_heads, remove redundant prefixesfs/cifs/Kconfig | 2 +- fs/cifs/asn1.c | 4 +- fs/cifs/cifs_debug.c | 158 ++++----- fs/cifs/cifs_debug.h | 29 +- fs/cifs/cifs_spnego.c | 4 +- fs/cifs/cifs_spnego.h | 2 +- fs/cifs/cifs_swn.c | 24 +- fs/cifs/cifs_swn.h | 8 +- fs/cifs/cifs_unicode.c | 4 +- fs/cifs/cifs_unicode.h | 2 +- fs/cifs/cifsacl.c | 22 +- fs/cifs/cifsencrypt.c | 78 ++--- fs/cifs/cifsfs.c | 124 +++---- fs/cifs/cifsglob.h | 694 ++++++++++++++++++++-------------------- fs/cifs/cifsproto.h | 172 +++++----- fs/cifs/cifssmb.c | 356 ++++++++++----------- fs/cifs/connect.c | 574 ++++++++++++++++----------------- fs/cifs/dfs_cache.c | 178 +++++------ fs/cifs/dfs_cache.h | 40 +-- fs/cifs/dir.c | 16 +- fs/cifs/file.c | 636 ++++++++++++++++++------------------ fs/cifs/fs_context.c | 8 +- fs/cifs/fs_context.h | 2 +- fs/cifs/fscache.c | 18 +- fs/cifs/fscache.h | 10 +- fs/cifs/inode.c | 530 +++++++++++++++--------------- fs/cifs/ioctl.c | 18 +- fs/cifs/link.c | 26 +- fs/cifs/misc.c | 185 ++++++----- fs/cifs/netmisc.c | 4 +- fs/cifs/ntlmssp.h | 6 +- fs/cifs/readdir.c | 344 ++++++++++---------- fs/cifs/sess.c | 142 ++++---- fs/cifs/smb1ops.c | 182 +++++------ fs/cifs/smb2file.c | 36 +-- fs/cifs/smb2inode.c | 136 ++++---- fs/cifs/smb2maperror.c | 2 +- fs/cifs/smb2misc.c | 72 ++--- fs/cifs/smb2ops.c | 555 ++++++++++++++++---------------- fs/cifs/smb2pdu.c | 596 +++++++++++++++++----------------- fs/cifs/smb2proto.h | 68 ++-- fs/cifs/smb2transport.c | 112 +++---- fs/cifs/smbdirect.c | 28 +- fs/cifs/smbdirect.h | 16 +- fs/cifs/transport.c | 236 +++++++------- fs/cifs/xattr.c | 12 +- 46 files changed, 3230 insertions(+), 3241 deletions(-)
Quoted 21 lines · Tom Talpey
Quoted 20 lines · Enzo Matsumiya
Hi all,
This patch set (v2) renames several cifs.ko data structures, variables, and functions with the goal to improve readability of the code.
In summary, what's been done:
- change from CamelCase tosnake_case
- try to give more meaning to globals and struct members
- rename status fields (server, ses, tcon), define constants for the various statuses (4/11 can be shared between those structs, others are specific to each)
- rename oflist_headvariables to better represent whether they'are used as a list element ("head") or a list per se. Also tried to give more meaning to these, as "rlist", "tlist", "llist" looked confusing and, sometimes, ambiguous.
- remove redundant prefixes from struct members name, e.g. tcon_tlink's tl_*, smb_rqst's rq_*, cifs_fattr's cf_*, etcNo functional changes has been made.
Quoted 8 lines
Quoted 4 lines
I know these touch some very old code that older devs are highly used to, but I see this as an improvement to reading the code for everyone.
I'll be waiting for your reviews and feedback.
Enzo, I think this effort is great. If you combine this modernization with refactoring SMB1 into separate files to make it easier to do away with entirely, I'll be even more supportive.
Tom, thanks for your feedback!
As a matter of fact, I do have a branch with SMB1 code isolated [*] and the module renamed to "SMBFS" to modernize this module, while also keeping it SMB-version-agnostic.
I'm sending my changes gradually so I don't have to change a lot of things in case there's a lot of negative feedback.
[*] - current discussions:
- is "smbfs" the best module name? Steve suggested "smb3", but, again, this ties the module to a specific SMB version
- should SMB1 code be isolated as in source-code only or should it be a different object (i.e. only built through kernel config and "disable_legacy_dialects" wiped away)? Or even a separate module?
In any case, I'm keeping "cifs" as a module alias for SMB1 code for now, and I think we'll need it that way for some time, but at least the internal migration will be done by then.
Quoted 1 line
Tom.
Thanks again,
Enzo
Quoted 66 lines
Quoted 66 lines
v2:
- remove status typedefs (suggested by Christoph Hellwig)
- define status constants instead, reuse some between different structs so we don't have to create a different set of statuses for each cifs structEnzo Matsumiya (10):
cifs: rename xid/mid globals
cifs: rename global counters
cifs: rename "TCP_Server_Info" struct to "cifs_server_info"
cifs: rename cifs{File,Lock,Inode}Info structs and more
cifs: convert server info vars tosnake_case
cifs: change status and security types enums to constants
cifs: rename cifsFYI todebug_level
cifs: renamelist_headfields
cifs: rename more CamelCase tosnake_case
cifs: rename morelist_heads, remove redundant prefixesfs/cifs/Kconfig | 2 +- fs/cifs/asn1.c | 4 +- fs/cifs/cifs_debug.c | 158 ++++----- fs/cifs/cifs_debug.h | 29 +- fs/cifs/cifs_spnego.c | 4 +- fs/cifs/cifs_spnego.h | 2 +- fs/cifs/cifs_swn.c | 24 +- fs/cifs/cifs_swn.h | 8 +- fs/cifs/cifs_unicode.c | 4 +- fs/cifs/cifs_unicode.h | 2 +- fs/cifs/cifsacl.c | 22 +- fs/cifs/cifsencrypt.c | 78 ++--- fs/cifs/cifsfs.c | 124 +++---- fs/cifs/cifsglob.h | 694 ++++++++++++++++++++-------------------- fs/cifs/cifsproto.h | 172 +++++----- fs/cifs/cifssmb.c | 356 ++++++++++----------- fs/cifs/connect.c | 574 ++++++++++++++++----------------- fs/cifs/dfs_cache.c | 178 +++++------ fs/cifs/dfs_cache.h | 40 +-- fs/cifs/dir.c | 16 +- fs/cifs/file.c | 636 ++++++++++++++++++------------------ fs/cifs/fs_context.c | 8 +- fs/cifs/fs_context.h | 2 +- fs/cifs/fscache.c | 18 +- fs/cifs/fscache.h | 10 +- fs/cifs/inode.c | 530 +++++++++++++++--------------- fs/cifs/ioctl.c | 18 +- fs/cifs/link.c | 26 +- fs/cifs/misc.c | 185 ++++++----- fs/cifs/netmisc.c | 4 +- fs/cifs/ntlmssp.h | 6 +- fs/cifs/readdir.c | 344 ++++++++++---------- fs/cifs/sess.c | 142 ++++---- fs/cifs/smb1ops.c | 182 +++++------ fs/cifs/smb2file.c | 36 +-- fs/cifs/smb2inode.c | 136 ++++---- fs/cifs/smb2maperror.c | 2 +- fs/cifs/smb2misc.c | 72 ++--- fs/cifs/smb2ops.c | 555 ++++++++++++++++---------------- fs/cifs/smb2pdu.c | 596 +++++++++++++++++----------------- fs/cifs/smb2proto.h | 68 ++-- fs/cifs/smb2transport.c | 112 +++---- fs/cifs/smbdirect.c | 28 +- fs/cifs/smbdirect.h | 16 +- fs/cifs/transport.c | 236 +++++++------- fs/cifs/xattr.c | 12 +- 46 files changed, 3230 insertions(+), 3241 deletions(-)
Tom Talpey
reviewerQuoted 36 lines · Enzo Matsumiya
Quoted 21 lines · Tom Talpey
Quoted 20 lines · Enzo Matsumiya
Hi all,
This patch set (v2) renames several cifs.ko data structures, variables, and functions with the goal to improve readability of the code.
In summary, what's been done:
- change from CamelCase tosnake_case
- try to give more meaning to globals and struct members
- rename status fields (server, ses, tcon), define constants for the various statuses (4/11 can be shared between those structs, others are specific to each)
- rename oflist_headvariables to better represent whether they'are used as a list element ("head") or a list per se. Also tried to give more meaning to these, as "rlist", "tlist", "llist" looked confusing and, sometimes, ambiguous.
- remove redundant prefixes from struct members name, e.g. tcon_tlink's tl_*, smb_rqst's rq_*, cifs_fattr's cf_*, etcNo functional changes has been made.
Quoted 8 lines
Quoted 4 lines
I know these touch some very old code that older devs are highly used to, but I see this as an improvement to reading the code for everyone.
I'll be waiting for your reviews and feedback.
Enzo, I think this effort is great. If you combine this modernization with refactoring SMB1 into separate files to make it easier to do away with entirely, I'll be even more supportive.
Tom, thanks for your feedback!
As a matter of fact, I do have a branch with SMB1 code isolated [*] and the module renamed to "SMBFS" to modernize this module, while also keeping it SMB-version-agnostic.
Quoted 7 lines
I'm sending my changes gradually so I don't have to change a lot of things in case there's a lot of negative feedback.
[*] - current discussions:
- is "smbfs" the best module name? Steve suggested "smb3", but, again, this ties the module to a specific SMB version
I think "smbfs" is more consistent with other kmods. And I'd be careful about a specific version like "smb3", because that paints it into the corner if it also supports smb2, or future dialects.
Quoted 3 lines
- should SMB1 code be isolated as in source-code only or should it be a different object (i.e. only built through kernel config and "
disable_legacy_dialects" wiped away)? Or even a separate module?
There's no single answer here, but my personal view is that it should become a separate module. As a compile-time option, the distros are basically forced to turn it on. We don't want that. As a module, they can choose to leave it out. We do want that.
Quoted 3 lines
In any case, I'm keeping "cifs" as a module alias for SMB1 code for now, and I think we'll need it that way for some time, but at least the internal migration will be done by then.
Yes, it's definitely needed (for now) to maintain a "cifs" module alias, because user scripts might be using it to modload. In future if smb1 becomes a module, then drop "cifs" entirely.
Tom.
Quoted 71 lines
Thanks again,
Enzo
Quoted 66 lines
Quoted 66 lines
v2:
- remove status typedefs (suggested by Christoph Hellwig)
- define status constants instead, reuse some between different structs so we don't have to create a different set of statuses for each cifs structEnzo Matsumiya (10):
cifs: rename xid/mid globals
cifs: rename global counters
cifs: rename "TCP_Server_Info" struct to "cifs_server_info"
cifs: rename cifs{File,Lock,Inode}Info structs and more
cifs: convert server info vars tosnake_case
cifs: change status and security types enums to constants
cifs: rename cifsFYI todebug_level
cifs: renamelist_headfields
cifs: rename more CamelCase tosnake_case
cifs: rename morelist_heads, remove redundant prefixesfs/cifs/Kconfig | 2 +-
fs/cifs/asn1.c | 4 +-
fs/cifs/cifs_debug.c | 158 ++++----- fs/cifs/cifs_debug.h | 29 +-
fs/cifs/cifs_spnego.c | 4 +-
fs/cifs/cifs_spnego.h | 2 +-
fs/cifs/cifs_swn.c | 24 +-
fs/cifs/cifs_swn.h | 8 +-
fs/cifs/cifs_unicode.c | 4 +-
fs/cifs/cifs_unicode.h | 2 +-
fs/cifs/cifsacl.c | 22 +-
fs/cifs/cifsencrypt.c | 78 ++---
fs/cifs/cifsfs.c | 124 +++----
fs/cifs/cifsglob.h | 694 ++++++++++++++++++++-------------------- fs/cifs/cifsproto.h | 172 +++++-----
fs/cifs/cifssmb.c | 356 ++++++++++----------- fs/cifs/connect.c | 574 ++++++++++++++++----------------- fs/cifs/dfs_cache.c | 178 +++++------ fs/cifs/dfs_cache.h | 40 +--
fs/cifs/dir.c | 16 +-
fs/cifs/file.c | 636 ++++++++++++++++++------------------ fs/cifs/fs_context.c | 8 +-
fs/cifs/fs_context.h | 2 +-
fs/cifs/fscache.c | 18 +-
fs/cifs/fscache.h | 10 +-
fs/cifs/inode.c | 530 +++++++++++++++--------------- fs/cifs/ioctl.c | 18 +-
fs/cifs/link.c | 26 +-
fs/cifs/misc.c | 185 ++++++-----fs/cifs/netmisc.c | 4 +- fs/cifs/ntlmssp.h | 6 +- fs/cifs/readdir.c | 344 ++++++++++----------fs/cifs/sess.c | 142 ++++---- fs/cifs/smb1ops.c | 182 +++++------ fs/cifs/smb2file.c | 36 +--
fs/cifs/smb2inode.c | 136 ++++---- fs/cifs/smb2maperror.c | 2 +-
fs/cifs/smb2misc.c | 72 ++---
fs/cifs/smb2ops.c | 555 ++++++++++++++++---------------- fs/cifs/smb2pdu.c | 596 +++++++++++++++++----------------- fs/cifs/smb2proto.h | 68 ++--fs/cifs/smb2transport.c| 112 +++----fs/cifs/smbdirect.c | 28 +- fs/cifs/smbdirect.h | 16 +- fs/cifs/transport.c | 236 +++++++------- fs/cifs/xattr.c | 12 +- 46 files changed, 3230 insertions(+), 3241 deletions(-)
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): CAH2r5msHgxzC6HYhj70cMce+=t6Fz2p1C5X3HCM1WKFEq7rnhQ@mail.gmail.com
A message that is not in the archive (sent off-list or not yet received): 20220727153836.sllbblfagnstcza7@cyberdelia
Re: Fwd: [RFC PATCH v2 03/10] cifs: rename "TCP_Server_Info" struct to "cifs_server_info"
[ resending this as the other one bounced ]
Quoted 5 lines · Steve French
Of the first three patches, I think this one makes the most sense, but the rename should be "
TCP_Server_Info" to something like "tcp_server_info" (orTCP_server_info) or something that indicates it is for the transport level info, info related to the network connection, the socket etc.
Noted.
Quoted 2 lines
(and not using the word "cifs" unless
related to SMB1)
The "cifs" prefix is for the bigger picture (SMB1 isolation and/or module renaming) so I can later on do something like:
"sed -i 's/cifs_/<newname>_/g' *.c"
Quoted 53 lines
---------- Forwarded message ---------
From: Enzo Matsumiya <[email protected]>
Date: Mon, Jul 25, 2022 at 5:37 PM
Subject: [RFC PATCH v2 03/10] cifs: rename "TCP_Server_Info" struct to "cifs_server_info"
To: <[email protected]>
Cc: <[email protected]>, <[email protected]>, <[email protected]>, <[email protected]>Rename the
TCP_Server_Infostruct to "cifs_server_info", making it look more like a cifs.ko struct by using the standard "cifs_" prefix.Also upgrades from
Camel_Casetosnake_case.Signed-off-by Enzo Matsumiya <[email protected]>---
fs/cifs/asn1.c | 4 +- fs/cifs/cifs_debug.c | 14 ++-- fs/cifs/cifs_debug.h | 4 +- fs/cifs/cifs_spnego.c | 2 +- fs/cifs/cifs_spnego.h | 2 +- fs/cifs/cifs_swn.h | 8 +-- fs/cifs/cifsencrypt.c | 14 ++-- fs/cifs/cifsfs.c | 6 +- fs/cifs/cifsglob.h | 140 ++++++++++++++++++++-------------------- fs/cifs/cifsproto.h | 114 ++++++++++++++++---------------- fs/cifs/cifssmb.c | 24 +++---- fs/cifs/connect.c | 134 +++++++++++++++++++------------------- fs/cifs/dfs_cache.c | 10 +-- fs/cifs/dir.c | 6 +- fs/cifs/file.c | 60 ++++++++--------- fs/cifs/fscache.c | 2 +- fs/cifs/inode.c | 22 +++---- fs/cifs/ioctl.c | 2 +- fs/cifs/link.c | 4 +- fs/cifs/misc.c | 10 +-- fs/cifs/netmisc.c | 2 +- fs/cifs/ntlmssp.h | 6 +- fs/cifs/readdir.c | 4 +- fs/cifs/sess.c | 52 +++++++-------- fs/cifs/smb1ops.c | 26 ++++---- fs/cifs/smb2inode.c | 2 +- fs/cifs/smb2misc.c | 14 ++-- fs/cifs/smb2ops.c | 86 ++++++++++++------------ fs/cifs/smb2pdu.c | 122 +++++++++++++++++----------------- fs/cifs/smb2proto.h | 58 ++++++++--------- fs/cifs/smb2transport.c | 44 ++++++------- fs/cifs/smbdirect.c | 10 +-- fs/cifs/smbdirect.h | 16 ++--- fs/cifs/transport.c | 48 +++++++------- 34 files changed, 536 insertions(+), 536 deletions(-)