aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifsglob.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/cifsglob.h')
-rw-r--r--fs/cifs/cifsglob.h110
1 files changed, 75 insertions, 35 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 7136c0c3e2f9..17afb0fbcaed 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -161,72 +161,97 @@ struct TCP_Server_Info {
161 int srv_count; /* reference counter */ 161 int srv_count; /* reference counter */
162 /* 15 character server name + 0x20 16th byte indicating type = srv */ 162 /* 15 character server name + 0x20 16th byte indicating type = srv */
163 char server_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL]; 163 char server_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL];
164 enum statusEnum tcpStatus; /* what we think the status is */
164 char *hostname; /* hostname portion of UNC string */ 165 char *hostname; /* hostname portion of UNC string */
165 struct socket *ssocket; 166 struct socket *ssocket;
166 union { 167 struct sockaddr_storage dstaddr;
167 struct sockaddr_in sockAddr;
168 struct sockaddr_in6 sockAddr6;
169 } addr;
170 struct sockaddr_storage srcaddr; /* locally bind to this IP */ 168 struct sockaddr_storage srcaddr; /* locally bind to this IP */
169#ifdef CONFIG_NET_NS
170 struct net *net;
171#endif
171 wait_queue_head_t response_q; 172 wait_queue_head_t response_q;
172 wait_queue_head_t request_q; /* if more than maxmpx to srvr must block*/ 173 wait_queue_head_t request_q; /* if more than maxmpx to srvr must block*/
173 struct list_head pending_mid_q; 174 struct list_head pending_mid_q;
174 void *Server_NlsInfo; /* BB - placeholder for future NLS info */
175 unsigned short server_codepage; /* codepage for the server */
176 enum protocolEnum protocolType;
177 char versionMajor;
178 char versionMinor;
179 bool svlocal:1; /* local server or remote */
180 bool noblocksnd; /* use blocking sendmsg */ 175 bool noblocksnd; /* use blocking sendmsg */
181 bool noautotune; /* do not autotune send buf sizes */ 176 bool noautotune; /* do not autotune send buf sizes */
182 bool tcp_nodelay; 177 bool tcp_nodelay;
183 atomic_t inFlight; /* number of requests on the wire to server */ 178 atomic_t inFlight; /* number of requests on the wire to server */
184#ifdef CONFIG_CIFS_STATS2
185 atomic_t inSend; /* requests trying to send */
186 atomic_t num_waiters; /* blocked waiting to get in sendrecv */
187#endif
188 enum statusEnum tcpStatus; /* what we think the status is */
189 struct mutex srv_mutex; 179 struct mutex srv_mutex;
190 struct task_struct *tsk; 180 struct task_struct *tsk;
191 char server_GUID[16]; 181 char server_GUID[16];
192 char secMode; 182 char secMode;
183 bool session_estab; /* mark when very first sess is established */
184 u16 dialect; /* dialect index that server chose */
193 enum securityEnum secType; 185 enum securityEnum secType;
194 unsigned int maxReq; /* Clients should submit no more */ 186 unsigned int maxReq; /* Clients should submit no more */
195 /* than maxReq distinct unanswered SMBs to the server when using */ 187 /* than maxReq distinct unanswered SMBs to the server when using */
196 /* multiplexed reads or writes */ 188 /* multiplexed reads or writes */
197 unsigned int maxBuf; /* maxBuf specifies the maximum */ 189 unsigned int maxBuf; /* maxBuf specifies the maximum */
198 /* message size the server can send or receive for non-raw SMBs */ 190 /* message size the server can send or receive for non-raw SMBs */
191 /* maxBuf is returned by SMB NegotiateProtocol so maxBuf is only 0 */
192 /* when socket is setup (and during reconnect) before NegProt sent */
199 unsigned int max_rw; /* maxRw specifies the maximum */ 193 unsigned int max_rw; /* maxRw specifies the maximum */
200 /* message size the server can send or receive for */ 194 /* message size the server can send or receive for */
201 /* SMB_COM_WRITE_RAW or SMB_COM_READ_RAW. */ 195 /* SMB_COM_WRITE_RAW or SMB_COM_READ_RAW. */
202 unsigned int max_vcs; /* maximum number of smb sessions, at least 196 unsigned int max_vcs; /* maximum number of smb sessions, at least
203 those that can be specified uniquely with 197 those that can be specified uniquely with
204 vcnumbers */ 198 vcnumbers */
205 char sessid[4]; /* unique token id for this session */
206 /* (returned on Negotiate */
207 int capabilities; /* allow selective disabling of caps by smb sess */ 199 int capabilities; /* allow selective disabling of caps by smb sess */
208 int timeAdj; /* Adjust for difference in server time zone in sec */ 200 int timeAdj; /* Adjust for difference in server time zone in sec */
209 __u16 CurrentMid; /* multiplex id - rotating counter */ 201 __u16 CurrentMid; /* multiplex id - rotating counter */
210 char cryptkey[CIFS_CRYPTO_KEY_SIZE]; /* used by ntlm, ntlmv2 etc */ 202 char cryptkey[CIFS_CRYPTO_KEY_SIZE]; /* used by ntlm, ntlmv2 etc */
211 /* 16th byte of RFC1001 workstation name is always null */ 203 /* 16th byte of RFC1001 workstation name is always null */
212 char workstation_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL]; 204 char workstation_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL];
213 __u32 sequence_number; /* needed for CIFS PDU signature */ 205 __u32 sequence_number; /* for signing, protected by srv_mutex */
214 struct session_key session_key; 206 struct session_key session_key;
215 unsigned long lstrp; /* when we got last response from this server */ 207 unsigned long lstrp; /* when we got last response from this server */
216 u16 dialect; /* dialect index that server chose */
217 struct cifs_secmech secmech; /* crypto sec mech functs, descriptors */ 208 struct cifs_secmech secmech; /* crypto sec mech functs, descriptors */
218 /* extended security flavors that server supports */ 209 /* extended security flavors that server supports */
210 bool sec_ntlmssp; /* supports NTLMSSP */
211 bool sec_kerberosu2u; /* supports U2U Kerberos */
219 bool sec_kerberos; /* supports plain Kerberos */ 212 bool sec_kerberos; /* supports plain Kerberos */
220 bool sec_mskerberos; /* supports legacy MS Kerberos */ 213 bool sec_mskerberos; /* supports legacy MS Kerberos */
221 bool sec_kerberosu2u; /* supports U2U Kerberos */ 214 struct delayed_work echo; /* echo ping workqueue job */
222 bool sec_ntlmssp; /* supports NTLMSSP */
223 bool session_estab; /* mark when very first sess is established */
224#ifdef CONFIG_CIFS_FSCACHE 215#ifdef CONFIG_CIFS_FSCACHE
225 struct fscache_cookie *fscache; /* client index cache cookie */ 216 struct fscache_cookie *fscache; /* client index cache cookie */
226#endif 217#endif
218#ifdef CONFIG_CIFS_STATS2
219 atomic_t inSend; /* requests trying to send */
220 atomic_t num_waiters; /* blocked waiting to get in sendrecv */
221#endif
227}; 222};
228 223
229/* 224/*
225 * Macros to allow the TCP_Server_Info->net field and related code to drop out
226 * when CONFIG_NET_NS isn't set.
227 */
228
229#ifdef CONFIG_NET_NS
230
231static inline struct net *cifs_net_ns(struct TCP_Server_Info *srv)
232{
233 return srv->net;
234}
235
236static inline void cifs_set_net_ns(struct TCP_Server_Info *srv, struct net *net)
237{
238 srv->net = net;
239}
240
241#else
242
243static inline struct net *cifs_net_ns(struct TCP_Server_Info *srv)
244{
245 return &init_net;
246}
247
248static inline void cifs_set_net_ns(struct TCP_Server_Info *srv, struct net *net)
249{
250}
251
252#endif
253
254/*
230 * Session structure. One of these for each uid session with a particular host 255 * Session structure. One of these for each uid session with a particular host
231 */ 256 */
232struct cifsSesInfo { 257struct cifsSesInfo {
@@ -449,13 +474,14 @@ struct cifsInodeInfo {
449 /* BB add in lists for dirty pages i.e. write caching info for oplock */ 474 /* BB add in lists for dirty pages i.e. write caching info for oplock */
450 struct list_head openFileList; 475 struct list_head openFileList;
451 __u32 cifsAttrs; /* e.g. DOS archive bit, sparse, compressed, system */ 476 __u32 cifsAttrs; /* e.g. DOS archive bit, sparse, compressed, system */
452 unsigned long time; /* jiffies of last update/check of inode */ 477 bool clientCanCacheRead; /* read oplock */
453 bool clientCanCacheRead:1; /* read oplock */ 478 bool clientCanCacheAll; /* read and writebehind oplock */
454 bool clientCanCacheAll:1; /* read and writebehind oplock */ 479 bool delete_pending; /* DELETE_ON_CLOSE is set */
455 bool delete_pending:1; /* DELETE_ON_CLOSE is set */ 480 bool invalid_mapping; /* pagecache is invalid */
456 bool invalid_mapping:1; /* pagecache is invalid */ 481 unsigned long time; /* jiffies of last update of inode */
457 u64 server_eof; /* current file size on server */ 482 u64 server_eof; /* current file size on server */
458 u64 uniqueid; /* server inode number */ 483 u64 uniqueid; /* server inode number */
484 u64 createtime; /* creation time on server */
459#ifdef CONFIG_CIFS_FSCACHE 485#ifdef CONFIG_CIFS_FSCACHE
460 struct fscache_cookie *fscache; 486 struct fscache_cookie *fscache;
461#endif 487#endif
@@ -510,6 +536,18 @@ static inline void cifs_stats_bytes_read(struct cifsTconInfo *tcon,
510 536
511#endif 537#endif
512 538
539struct mid_q_entry;
540
541/*
542 * This is the prototype for the mid callback function. When creating one,
543 * take special care to avoid deadlocks. Things to bear in mind:
544 *
545 * - it will be called by cifsd
546 * - the GlobalMid_Lock will be held
547 * - the mid will be removed from the pending_mid_q list
548 */
549typedef void (mid_callback_t)(struct mid_q_entry *mid);
550
513/* one of these for every pending CIFS request to the server */ 551/* one of these for every pending CIFS request to the server */
514struct mid_q_entry { 552struct mid_q_entry {
515 struct list_head qhead; /* mids waiting on reply from this server */ 553 struct list_head qhead; /* mids waiting on reply from this server */
@@ -521,7 +559,8 @@ struct mid_q_entry {
521 unsigned long when_sent; /* time when smb send finished */ 559 unsigned long when_sent; /* time when smb send finished */
522 unsigned long when_received; /* when demux complete (taken off wire) */ 560 unsigned long when_received; /* when demux complete (taken off wire) */
523#endif 561#endif
524 struct task_struct *tsk; /* task waiting for response */ 562 mid_callback_t *callback; /* call completion callback */
563 void *callback_data; /* general purpose pointer for callback */
525 struct smb_hdr *resp_buf; /* response buffer */ 564 struct smb_hdr *resp_buf; /* response buffer */
526 int midState; /* wish this were enum but can not pass to wait_event */ 565 int midState; /* wish this were enum but can not pass to wait_event */
527 __u8 command; /* smb command code */ 566 __u8 command; /* smb command code */
@@ -576,6 +615,7 @@ struct cifs_fattr {
576 u64 cf_uniqueid; 615 u64 cf_uniqueid;
577 u64 cf_eof; 616 u64 cf_eof;
578 u64 cf_bytes; 617 u64 cf_bytes;
618 u64 cf_createtime;
579 uid_t cf_uid; 619 uid_t cf_uid;
580 gid_t cf_gid; 620 gid_t cf_gid;
581 umode_t cf_mode; 621 umode_t cf_mode;
@@ -614,7 +654,7 @@ static inline void free_dfs_info_array(struct dfs_info3_param *param,
614#define MID_REQUEST_SUBMITTED 2 654#define MID_REQUEST_SUBMITTED 2
615#define MID_RESPONSE_RECEIVED 4 655#define MID_RESPONSE_RECEIVED 4
616#define MID_RETRY_NEEDED 8 /* session closed while this request out */ 656#define MID_RETRY_NEEDED 8 /* session closed while this request out */
617#define MID_NO_RESP_NEEDED 0x10 657#define MID_RESPONSE_MALFORMED 0x10
618 658
619/* Types of response buffer returned from SendReceive2 */ 659/* Types of response buffer returned from SendReceive2 */
620#define CIFS_NO_BUFFER 0 /* Response buffer not returned */ 660#define CIFS_NO_BUFFER 0 /* Response buffer not returned */
@@ -623,12 +663,9 @@ static inline void free_dfs_info_array(struct dfs_info3_param *param,
623#define CIFS_IOVEC 4 /* array of response buffers */ 663#define CIFS_IOVEC 4 /* array of response buffers */
624 664
625/* Type of Request to SendReceive2 */ 665/* Type of Request to SendReceive2 */
626#define CIFS_STD_OP 0 /* normal request timeout */ 666#define CIFS_BLOCKING_OP 1 /* operation can block */
627#define CIFS_LONG_OP 1 /* long op (up to 45 sec, oplock time) */ 667#define CIFS_ASYNC_OP 2 /* do not wait for response */
628#define CIFS_VLONG_OP 2 /* sloow op - can take up to 180 seconds */ 668#define CIFS_TIMEOUT_MASK 0x003 /* only one of above set in req */
629#define CIFS_BLOCKING_OP 4 /* operation can block */
630#define CIFS_ASYNC_OP 8 /* do not wait for response */
631#define CIFS_TIMEOUT_MASK 0x00F /* only one of 5 above set in req */
632#define CIFS_LOG_ERROR 0x010 /* log NT STATUS if non-zero */ 669#define CIFS_LOG_ERROR 0x010 /* log NT STATUS if non-zero */
633#define CIFS_LARGE_BUF_OP 0x020 /* large request buffer */ 670#define CIFS_LARGE_BUF_OP 0x020 /* large request buffer */
634#define CIFS_NO_RESP 0x040 /* no response buffer required */ 671#define CIFS_NO_RESP 0x040 /* no response buffer required */
@@ -791,6 +828,9 @@ GLOBAL_EXTERN unsigned int cifs_min_rcv; /* min size of big ntwrk buf pool */
791GLOBAL_EXTERN unsigned int cifs_min_small; /* min size of small buf pool */ 828GLOBAL_EXTERN unsigned int cifs_min_small; /* min size of small buf pool */
792GLOBAL_EXTERN unsigned int cifs_max_pending; /* MAX requests at once to server*/ 829GLOBAL_EXTERN unsigned int cifs_max_pending; /* MAX requests at once to server*/
793 830
831/* reconnect after this many failed echo attempts */
832GLOBAL_EXTERN unsigned short echo_retries;
833
794void cifs_oplock_break(struct work_struct *work); 834void cifs_oplock_break(struct work_struct *work);
795void cifs_oplock_break_get(struct cifsFileInfo *cfile); 835void cifs_oplock_break_get(struct cifsFileInfo *cfile);
796void cifs_oplock_break_put(struct cifsFileInfo *cfile); 836void cifs_oplock_break_put(struct cifsFileInfo *cfile);