diff options
Diffstat (limited to 'fs/cifs/cifsglob.h')
| -rw-r--r-- | fs/cifs/cifsglob.h | 97 |
1 files changed, 68 insertions, 29 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 606ca8bb710..edd5b29b53c 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
| @@ -161,32 +161,27 @@ 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 | struct sockaddr_storage dstaddr; | 167 | struct sockaddr_storage dstaddr; |
| 167 | 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 | ||
| 168 | wait_queue_head_t response_q; | 172 | wait_queue_head_t response_q; |
| 169 | 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*/ |
| 170 | struct list_head pending_mid_q; | 174 | struct list_head pending_mid_q; |
| 171 | void *Server_NlsInfo; /* BB - placeholder for future NLS info */ | ||
| 172 | unsigned short server_codepage; /* codepage for the server */ | ||
| 173 | enum protocolEnum protocolType; | ||
| 174 | char versionMajor; | ||
| 175 | char versionMinor; | ||
| 176 | bool svlocal:1; /* local server or remote */ | ||
| 177 | bool noblocksnd; /* use blocking sendmsg */ | 175 | bool noblocksnd; /* use blocking sendmsg */ |
| 178 | bool noautotune; /* do not autotune send buf sizes */ | 176 | bool noautotune; /* do not autotune send buf sizes */ |
| 179 | bool tcp_nodelay; | 177 | bool tcp_nodelay; |
| 180 | atomic_t inFlight; /* number of requests on the wire to server */ | 178 | atomic_t inFlight; /* number of requests on the wire to server */ |
| 181 | #ifdef CONFIG_CIFS_STATS2 | ||
| 182 | atomic_t inSend; /* requests trying to send */ | ||
| 183 | atomic_t num_waiters; /* blocked waiting to get in sendrecv */ | ||
| 184 | #endif | ||
| 185 | enum statusEnum tcpStatus; /* what we think the status is */ | ||
| 186 | struct mutex srv_mutex; | 179 | struct mutex srv_mutex; |
| 187 | struct task_struct *tsk; | 180 | struct task_struct *tsk; |
| 188 | char server_GUID[16]; | 181 | char server_GUID[16]; |
| 189 | char secMode; | 182 | char secMode; |
| 183 | bool session_estab; /* mark when very first sess is established */ | ||
| 184 | u16 dialect; /* dialect index that server chose */ | ||
| 190 | enum securityEnum secType; | 185 | enum securityEnum secType; |
| 191 | unsigned int maxReq; /* Clients should submit no more */ | 186 | unsigned int maxReq; /* Clients should submit no more */ |
| 192 | /* than maxReq distinct unanswered SMBs to the server when using */ | 187 | /* than maxReq distinct unanswered SMBs to the server when using */ |
| @@ -199,8 +194,6 @@ struct TCP_Server_Info { | |||
| 199 | unsigned int max_vcs; /* maximum number of smb sessions, at least | 194 | unsigned int max_vcs; /* maximum number of smb sessions, at least |
| 200 | those that can be specified uniquely with | 195 | those that can be specified uniquely with |
| 201 | vcnumbers */ | 196 | vcnumbers */ |
| 202 | char sessid[4]; /* unique token id for this session */ | ||
| 203 | /* (returned on Negotiate */ | ||
| 204 | int capabilities; /* allow selective disabling of caps by smb sess */ | 197 | int capabilities; /* allow selective disabling of caps by smb sess */ |
| 205 | int timeAdj; /* Adjust for difference in server time zone in sec */ | 198 | int timeAdj; /* Adjust for difference in server time zone in sec */ |
| 206 | __u16 CurrentMid; /* multiplex id - rotating counter */ | 199 | __u16 CurrentMid; /* multiplex id - rotating counter */ |
| @@ -210,20 +203,53 @@ struct TCP_Server_Info { | |||
| 210 | __u32 sequence_number; /* for signing, protected by srv_mutex */ | 203 | __u32 sequence_number; /* for signing, protected by srv_mutex */ |
| 211 | struct session_key session_key; | 204 | struct session_key session_key; |
| 212 | unsigned long lstrp; /* when we got last response from this server */ | 205 | unsigned long lstrp; /* when we got last response from this server */ |
| 213 | u16 dialect; /* dialect index that server chose */ | ||
| 214 | struct cifs_secmech secmech; /* crypto sec mech functs, descriptors */ | 206 | struct cifs_secmech secmech; /* crypto sec mech functs, descriptors */ |
| 215 | /* extended security flavors that server supports */ | 207 | /* extended security flavors that server supports */ |
| 208 | bool sec_ntlmssp; /* supports NTLMSSP */ | ||
| 209 | bool sec_kerberosu2u; /* supports U2U Kerberos */ | ||
| 216 | bool sec_kerberos; /* supports plain Kerberos */ | 210 | bool sec_kerberos; /* supports plain Kerberos */ |
| 217 | bool sec_mskerberos; /* supports legacy MS Kerberos */ | 211 | bool sec_mskerberos; /* supports legacy MS Kerberos */ |
| 218 | bool sec_kerberosu2u; /* supports U2U Kerberos */ | 212 | struct delayed_work echo; /* echo ping workqueue job */ |
| 219 | bool sec_ntlmssp; /* supports NTLMSSP */ | ||
| 220 | bool session_estab; /* mark when very first sess is established */ | ||
| 221 | #ifdef CONFIG_CIFS_FSCACHE | 213 | #ifdef CONFIG_CIFS_FSCACHE |
| 222 | struct fscache_cookie *fscache; /* client index cache cookie */ | 214 | struct fscache_cookie *fscache; /* client index cache cookie */ |
| 223 | #endif | 215 | #endif |
| 216 | #ifdef CONFIG_CIFS_STATS2 | ||
| 217 | atomic_t inSend; /* requests trying to send */ | ||
| 218 | atomic_t num_waiters; /* blocked waiting to get in sendrecv */ | ||
| 219 | #endif | ||
| 224 | }; | 220 | }; |
| 225 | 221 | ||
| 226 | /* | 222 | /* |
| 223 | * Macros to allow the TCP_Server_Info->net field and related code to drop out | ||
| 224 | * when CONFIG_NET_NS isn't set. | ||
| 225 | */ | ||
| 226 | |||
| 227 | #ifdef CONFIG_NET_NS | ||
| 228 | |||
| 229 | static inline struct net *cifs_net_ns(struct TCP_Server_Info *srv) | ||
| 230 | { | ||
| 231 | return srv->net; | ||
| 232 | } | ||
| 233 | |||
| 234 | static inline void cifs_set_net_ns(struct TCP_Server_Info *srv, struct net *net) | ||
| 235 | { | ||
| 236 | srv->net = net; | ||
| 237 | } | ||
| 238 | |||
| 239 | #else | ||
| 240 | |||
| 241 | static inline struct net *cifs_net_ns(struct TCP_Server_Info *srv) | ||
| 242 | { | ||
| 243 | return &init_net; | ||
| 244 | } | ||
| 245 | |||
| 246 | static inline void cifs_set_net_ns(struct TCP_Server_Info *srv, struct net *net) | ||
| 247 | { | ||
| 248 | } | ||
| 249 | |||
| 250 | #endif | ||
| 251 | |||
| 252 | /* | ||
| 227 | * Session structure. One of these for each uid session with a particular host | 253 | * Session structure. One of these for each uid session with a particular host |
| 228 | */ | 254 | */ |
| 229 | struct cifsSesInfo { | 255 | struct cifsSesInfo { |
| @@ -446,11 +472,11 @@ struct cifsInodeInfo { | |||
| 446 | /* BB add in lists for dirty pages i.e. write caching info for oplock */ | 472 | /* BB add in lists for dirty pages i.e. write caching info for oplock */ |
| 447 | struct list_head openFileList; | 473 | struct list_head openFileList; |
| 448 | __u32 cifsAttrs; /* e.g. DOS archive bit, sparse, compressed, system */ | 474 | __u32 cifsAttrs; /* e.g. DOS archive bit, sparse, compressed, system */ |
| 449 | unsigned long time; /* jiffies of last update/check of inode */ | 475 | bool clientCanCacheRead; /* read oplock */ |
| 450 | bool clientCanCacheRead:1; /* read oplock */ | 476 | bool clientCanCacheAll; /* read and writebehind oplock */ |
| 451 | bool clientCanCacheAll:1; /* read and writebehind oplock */ | 477 | bool delete_pending; /* DELETE_ON_CLOSE is set */ |
| 452 | bool delete_pending:1; /* DELETE_ON_CLOSE is set */ | 478 | bool invalid_mapping; /* pagecache is invalid */ |
| 453 | bool invalid_mapping:1; /* pagecache is invalid */ | 479 | unsigned long time; /* jiffies of last update of inode */ |
| 454 | u64 server_eof; /* current file size on server */ | 480 | u64 server_eof; /* current file size on server */ |
| 455 | u64 uniqueid; /* server inode number */ | 481 | u64 uniqueid; /* server inode number */ |
| 456 | u64 createtime; /* creation time on server */ | 482 | u64 createtime; /* creation time on server */ |
| @@ -508,6 +534,18 @@ static inline void cifs_stats_bytes_read(struct cifsTconInfo *tcon, | |||
| 508 | 534 | ||
| 509 | #endif | 535 | #endif |
| 510 | 536 | ||
| 537 | struct mid_q_entry; | ||
| 538 | |||
| 539 | /* | ||
| 540 | * This is the prototype for the mid callback function. When creating one, | ||
| 541 | * take special care to avoid deadlocks. Things to bear in mind: | ||
| 542 | * | ||
| 543 | * - it will be called by cifsd | ||
| 544 | * - the GlobalMid_Lock will be held | ||
| 545 | * - the mid will be removed from the pending_mid_q list | ||
| 546 | */ | ||
| 547 | typedef void (mid_callback_t)(struct mid_q_entry *mid); | ||
| 548 | |||
| 511 | /* one of these for every pending CIFS request to the server */ | 549 | /* one of these for every pending CIFS request to the server */ |
| 512 | struct mid_q_entry { | 550 | struct mid_q_entry { |
| 513 | struct list_head qhead; /* mids waiting on reply from this server */ | 551 | struct list_head qhead; /* mids waiting on reply from this server */ |
| @@ -519,7 +557,8 @@ struct mid_q_entry { | |||
| 519 | unsigned long when_sent; /* time when smb send finished */ | 557 | unsigned long when_sent; /* time when smb send finished */ |
| 520 | unsigned long when_received; /* when demux complete (taken off wire) */ | 558 | unsigned long when_received; /* when demux complete (taken off wire) */ |
| 521 | #endif | 559 | #endif |
| 522 | struct task_struct *tsk; /* task waiting for response */ | 560 | mid_callback_t *callback; /* call completion callback */ |
| 561 | void *callback_data; /* general purpose pointer for callback */ | ||
| 523 | struct smb_hdr *resp_buf; /* response buffer */ | 562 | struct smb_hdr *resp_buf; /* response buffer */ |
| 524 | int midState; /* wish this were enum but can not pass to wait_event */ | 563 | int midState; /* wish this were enum but can not pass to wait_event */ |
| 525 | __u8 command; /* smb command code */ | 564 | __u8 command; /* smb command code */ |
| @@ -622,12 +661,9 @@ static inline void free_dfs_info_array(struct dfs_info3_param *param, | |||
| 622 | #define CIFS_IOVEC 4 /* array of response buffers */ | 661 | #define CIFS_IOVEC 4 /* array of response buffers */ |
| 623 | 662 | ||
| 624 | /* Type of Request to SendReceive2 */ | 663 | /* Type of Request to SendReceive2 */ |
| 625 | #define CIFS_STD_OP 0 /* normal request timeout */ | 664 | #define CIFS_BLOCKING_OP 1 /* operation can block */ |
| 626 | #define CIFS_LONG_OP 1 /* long op (up to 45 sec, oplock time) */ | 665 | #define CIFS_ASYNC_OP 2 /* do not wait for response */ |
| 627 | #define CIFS_VLONG_OP 2 /* sloow op - can take up to 180 seconds */ | 666 | #define CIFS_TIMEOUT_MASK 0x003 /* only one of above set in req */ |
| 628 | #define CIFS_BLOCKING_OP 4 /* operation can block */ | ||
| 629 | #define CIFS_ASYNC_OP 8 /* do not wait for response */ | ||
| 630 | #define CIFS_TIMEOUT_MASK 0x00F /* only one of 5 above set in req */ | ||
| 631 | #define CIFS_LOG_ERROR 0x010 /* log NT STATUS if non-zero */ | 667 | #define CIFS_LOG_ERROR 0x010 /* log NT STATUS if non-zero */ |
| 632 | #define CIFS_LARGE_BUF_OP 0x020 /* large request buffer */ | 668 | #define CIFS_LARGE_BUF_OP 0x020 /* large request buffer */ |
| 633 | #define CIFS_NO_RESP 0x040 /* no response buffer required */ | 669 | #define CIFS_NO_RESP 0x040 /* no response buffer required */ |
| @@ -790,6 +826,9 @@ GLOBAL_EXTERN unsigned int cifs_min_rcv; /* min size of big ntwrk buf pool */ | |||
| 790 | GLOBAL_EXTERN unsigned int cifs_min_small; /* min size of small buf pool */ | 826 | GLOBAL_EXTERN unsigned int cifs_min_small; /* min size of small buf pool */ |
| 791 | GLOBAL_EXTERN unsigned int cifs_max_pending; /* MAX requests at once to server*/ | 827 | GLOBAL_EXTERN unsigned int cifs_max_pending; /* MAX requests at once to server*/ |
| 792 | 828 | ||
| 829 | /* reconnect after this many failed echo attempts */ | ||
| 830 | GLOBAL_EXTERN unsigned short echo_retries; | ||
| 831 | |||
| 793 | void cifs_oplock_break(struct work_struct *work); | 832 | void cifs_oplock_break(struct work_struct *work); |
| 794 | void cifs_oplock_break_get(struct cifsFileInfo *cfile); | 833 | void cifs_oplock_break_get(struct cifsFileInfo *cfile); |
| 795 | void cifs_oplock_break_put(struct cifsFileInfo *cfile); | 834 | void cifs_oplock_break_put(struct cifsFileInfo *cfile); |
