diff options
Diffstat (limited to 'fs/cifs/cifsglob.h')
-rw-r--r-- | fs/cifs/cifsglob.h | 91 |
1 files changed, 63 insertions, 28 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 0cdfb8c32ac6..3365e77f6f24 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -97,7 +97,7 @@ enum protocolEnum { | |||
97 | /* Netbios frames protocol not supported at this time */ | 97 | /* Netbios frames protocol not supported at this time */ |
98 | }; | 98 | }; |
99 | 99 | ||
100 | struct mac_key { | 100 | struct session_key { |
101 | unsigned int len; | 101 | unsigned int len; |
102 | union { | 102 | union { |
103 | char ntlm[CIFS_SESS_KEY_SIZE + 16]; | 103 | char ntlm[CIFS_SESS_KEY_SIZE + 16]; |
@@ -139,6 +139,7 @@ struct TCP_Server_Info { | |||
139 | struct sockaddr_in sockAddr; | 139 | struct sockaddr_in sockAddr; |
140 | struct sockaddr_in6 sockAddr6; | 140 | struct sockaddr_in6 sockAddr6; |
141 | } addr; | 141 | } addr; |
142 | struct sockaddr_storage srcaddr; /* locally bind to this IP */ | ||
142 | wait_queue_head_t response_q; | 143 | wait_queue_head_t response_q; |
143 | wait_queue_head_t request_q; /* if more than maxmpx to srvr must block*/ | 144 | wait_queue_head_t request_q; /* if more than maxmpx to srvr must block*/ |
144 | struct list_head pending_mid_q; | 145 | struct list_head pending_mid_q; |
@@ -178,12 +179,10 @@ struct TCP_Server_Info { | |||
178 | int capabilities; /* allow selective disabling of caps by smb sess */ | 179 | int capabilities; /* allow selective disabling of caps by smb sess */ |
179 | int timeAdj; /* Adjust for difference in server time zone in sec */ | 180 | int timeAdj; /* Adjust for difference in server time zone in sec */ |
180 | __u16 CurrentMid; /* multiplex id - rotating counter */ | 181 | __u16 CurrentMid; /* multiplex id - rotating counter */ |
181 | char cryptKey[CIFS_CRYPTO_KEY_SIZE]; | ||
182 | /* 16th byte of RFC1001 workstation name is always null */ | 182 | /* 16th byte of RFC1001 workstation name is always null */ |
183 | char workstation_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL]; | 183 | char workstation_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL]; |
184 | __u32 sequence_number; /* needed for CIFS PDU signature */ | 184 | __u32 sequence_number; /* needed for CIFS PDU signature */ |
185 | struct mac_key mac_signing_key; | 185 | struct session_key session_key; |
186 | char ntlmv2_hash[16]; | ||
187 | unsigned long lstrp; /* when we got last response from this server */ | 186 | unsigned long lstrp; /* when we got last response from this server */ |
188 | u16 dialect; /* dialect index that server chose */ | 187 | u16 dialect; /* dialect index that server chose */ |
189 | /* extended security flavors that server supports */ | 188 | /* extended security flavors that server supports */ |
@@ -191,6 +190,7 @@ struct TCP_Server_Info { | |||
191 | bool sec_mskerberos; /* supports legacy MS Kerberos */ | 190 | bool sec_mskerberos; /* supports legacy MS Kerberos */ |
192 | bool sec_kerberosu2u; /* supports U2U Kerberos */ | 191 | bool sec_kerberosu2u; /* supports U2U Kerberos */ |
193 | bool sec_ntlmssp; /* supports NTLMSSP */ | 192 | bool sec_ntlmssp; /* supports NTLMSSP */ |
193 | bool session_estab; /* mark when very first sess is established */ | ||
194 | #ifdef CONFIG_CIFS_FSCACHE | 194 | #ifdef CONFIG_CIFS_FSCACHE |
195 | struct fscache_cookie *fscache; /* client index cache cookie */ | 195 | struct fscache_cookie *fscache; /* client index cache cookie */ |
196 | #endif | 196 | #endif |
@@ -222,6 +222,11 @@ struct cifsSesInfo { | |||
222 | char userName[MAX_USERNAME_SIZE + 1]; | 222 | char userName[MAX_USERNAME_SIZE + 1]; |
223 | char *domainName; | 223 | char *domainName; |
224 | char *password; | 224 | char *password; |
225 | char cryptKey[CIFS_CRYPTO_KEY_SIZE]; | ||
226 | struct session_key auth_key; | ||
227 | char ntlmv2_hash[16]; | ||
228 | unsigned int tilen; /* length of the target info blob */ | ||
229 | unsigned char *tiblob; /* target info blob in challenge response */ | ||
225 | bool need_reconnect:1; /* connection reset, uid now invalid */ | 230 | bool need_reconnect:1; /* connection reset, uid now invalid */ |
226 | }; | 231 | }; |
227 | /* no more than one of the following three session flags may be set */ | 232 | /* no more than one of the following three session flags may be set */ |
@@ -308,6 +313,44 @@ struct cifsTconInfo { | |||
308 | }; | 313 | }; |
309 | 314 | ||
310 | /* | 315 | /* |
316 | * This is a refcounted and timestamped container for a tcon pointer. The | ||
317 | * container holds a tcon reference. It is considered safe to free one of | ||
318 | * these when the tl_count goes to 0. The tl_time is the time of the last | ||
319 | * "get" on the container. | ||
320 | */ | ||
321 | struct tcon_link { | ||
322 | unsigned long tl_index; | ||
323 | unsigned long tl_flags; | ||
324 | #define TCON_LINK_MASTER 0 | ||
325 | #define TCON_LINK_PENDING 1 | ||
326 | #define TCON_LINK_IN_TREE 2 | ||
327 | unsigned long tl_time; | ||
328 | atomic_t tl_count; | ||
329 | struct cifsTconInfo *tl_tcon; | ||
330 | }; | ||
331 | |||
332 | extern struct tcon_link *cifs_sb_tlink(struct cifs_sb_info *cifs_sb); | ||
333 | |||
334 | static inline struct cifsTconInfo * | ||
335 | tlink_tcon(struct tcon_link *tlink) | ||
336 | { | ||
337 | return tlink->tl_tcon; | ||
338 | } | ||
339 | |||
340 | extern void cifs_put_tlink(struct tcon_link *tlink); | ||
341 | |||
342 | static inline struct tcon_link * | ||
343 | cifs_get_tlink(struct tcon_link *tlink) | ||
344 | { | ||
345 | if (tlink && !IS_ERR(tlink)) | ||
346 | atomic_inc(&tlink->tl_count); | ||
347 | return tlink; | ||
348 | } | ||
349 | |||
350 | /* This function is always expected to succeed */ | ||
351 | extern struct cifsTconInfo *cifs_sb_master_tcon(struct cifs_sb_info *cifs_sb); | ||
352 | |||
353 | /* | ||
311 | * This info hangs off the cifsFileInfo structure, pointed to by llist. | 354 | * This info hangs off the cifsFileInfo structure, pointed to by llist. |
312 | * This is used to track byte stream locks on the file | 355 | * This is used to track byte stream locks on the file |
313 | */ | 356 | */ |
@@ -345,12 +388,11 @@ struct cifsFileInfo { | |||
345 | __u16 netfid; /* file id from remote */ | 388 | __u16 netfid; /* file id from remote */ |
346 | /* BB add lock scope info here if needed */ ; | 389 | /* BB add lock scope info here if needed */ ; |
347 | /* lock scope id (0 if none) */ | 390 | /* lock scope id (0 if none) */ |
348 | struct file *pfile; /* needed for writepage */ | 391 | struct dentry *dentry; |
349 | struct inode *pInode; /* needed for oplock break */ | 392 | unsigned int f_flags; |
350 | struct vfsmount *mnt; | 393 | struct tcon_link *tlink; |
351 | struct mutex lock_mutex; | 394 | struct mutex lock_mutex; |
352 | struct list_head llist; /* list of byte range locks we have. */ | 395 | struct list_head llist; /* list of byte range locks we have. */ |
353 | bool closePend:1; /* file is marked to close */ | ||
354 | bool invalidHandle:1; /* file closed via session abend */ | 396 | bool invalidHandle:1; /* file closed via session abend */ |
355 | bool oplock_break_cancelled:1; | 397 | bool oplock_break_cancelled:1; |
356 | atomic_t count; /* reference count */ | 398 | atomic_t count; /* reference count */ |
@@ -365,14 +407,7 @@ static inline void cifsFileInfo_get(struct cifsFileInfo *cifs_file) | |||
365 | atomic_inc(&cifs_file->count); | 407 | atomic_inc(&cifs_file->count); |
366 | } | 408 | } |
367 | 409 | ||
368 | /* Release a reference on the file private data */ | 410 | void cifsFileInfo_put(struct cifsFileInfo *cifs_file); |
369 | static inline void cifsFileInfo_put(struct cifsFileInfo *cifs_file) | ||
370 | { | ||
371 | if (atomic_dec_and_test(&cifs_file->count)) { | ||
372 | iput(cifs_file->pInode); | ||
373 | kfree(cifs_file); | ||
374 | } | ||
375 | } | ||
376 | 411 | ||
377 | /* | 412 | /* |
378 | * One of these for each file inode | 413 | * One of these for each file inode |
@@ -474,16 +509,16 @@ struct oplock_q_entry { | |||
474 | 509 | ||
475 | /* for pending dnotify requests */ | 510 | /* for pending dnotify requests */ |
476 | struct dir_notify_req { | 511 | struct dir_notify_req { |
477 | struct list_head lhead; | 512 | struct list_head lhead; |
478 | __le16 Pid; | 513 | __le16 Pid; |
479 | __le16 PidHigh; | 514 | __le16 PidHigh; |
480 | __u16 Mid; | 515 | __u16 Mid; |
481 | __u16 Tid; | 516 | __u16 Tid; |
482 | __u16 Uid; | 517 | __u16 Uid; |
483 | __u16 netfid; | 518 | __u16 netfid; |
484 | __u32 filter; /* CompletionFilter (for multishot) */ | 519 | __u32 filter; /* CompletionFilter (for multishot) */ |
485 | int multishot; | 520 | int multishot; |
486 | struct file *pfile; | 521 | struct file *pfile; |
487 | }; | 522 | }; |
488 | 523 | ||
489 | struct dfs_info3_param { | 524 | struct dfs_info3_param { |
@@ -667,7 +702,7 @@ GLOBAL_EXTERN struct list_head cifs_tcp_ses_list; | |||
667 | * the reference counters for the server, smb session, and tcon. Finally, | 702 | * the reference counters for the server, smb session, and tcon. Finally, |
668 | * changes to the tcon->tidStatus should be done while holding this lock. | 703 | * changes to the tcon->tidStatus should be done while holding this lock. |
669 | */ | 704 | */ |
670 | GLOBAL_EXTERN rwlock_t cifs_tcp_ses_lock; | 705 | GLOBAL_EXTERN spinlock_t cifs_tcp_ses_lock; |
671 | 706 | ||
672 | /* | 707 | /* |
673 | * This lock protects the cifs_file->llist and cifs_file->flist | 708 | * This lock protects the cifs_file->llist and cifs_file->flist |
@@ -676,7 +711,7 @@ GLOBAL_EXTERN rwlock_t cifs_tcp_ses_lock; | |||
676 | * If cifs_tcp_ses_lock and the lock below are both needed to be held, then | 711 | * If cifs_tcp_ses_lock and the lock below are both needed to be held, then |
677 | * the cifs_tcp_ses_lock must be grabbed first and released last. | 712 | * the cifs_tcp_ses_lock must be grabbed first and released last. |
678 | */ | 713 | */ |
679 | GLOBAL_EXTERN rwlock_t GlobalSMBSeslock; | 714 | GLOBAL_EXTERN spinlock_t cifs_file_list_lock; |
680 | 715 | ||
681 | /* Outstanding dir notify requests */ | 716 | /* Outstanding dir notify requests */ |
682 | GLOBAL_EXTERN struct list_head GlobalDnotifyReqList; | 717 | GLOBAL_EXTERN struct list_head GlobalDnotifyReqList; |