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.h98
1 files changed, 92 insertions, 6 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 81babab265e1..1ba08f8c5bc4 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -110,8 +110,9 @@ enum protocolEnum {
110 */ 110 */
111 111
112struct TCP_Server_Info { 112struct TCP_Server_Info {
113 char server_Name[SERVER_NAME_LEN_WITH_NULL]; /* 15 chars + X'20'in 16th */ 113 /* 15 character server name + 0x20 16th byte indicating type = srv */
114 char unicode_server_Name[SERVER_NAME_LEN_WITH_NULL * 2]; /* Unicode version of server_Name */ 114 char server_RFC1001_name[SERVER_NAME_LEN_WITH_NULL];
115 char unicode_server_Name[SERVER_NAME_LEN_WITH_NULL * 2];
115 struct socket *ssocket; 116 struct socket *ssocket;
116 union { 117 union {
117 struct sockaddr_in sockAddr; 118 struct sockaddr_in sockAddr;
@@ -122,13 +123,17 @@ struct TCP_Server_Info {
122 struct list_head pending_mid_q; 123 struct list_head pending_mid_q;
123 void *Server_NlsInfo; /* BB - placeholder for future NLS info */ 124 void *Server_NlsInfo; /* BB - placeholder for future NLS info */
124 unsigned short server_codepage; /* codepage for the server */ 125 unsigned short server_codepage; /* codepage for the server */
125 unsigned long ip_address; /* IP addr for the server if known */ 126 unsigned long ip_address; /* IP addr for the server if known */
126 enum protocolEnum protocolType; 127 enum protocolEnum protocolType;
127 char versionMajor; 128 char versionMajor;
128 char versionMinor; 129 char versionMinor;
129 unsigned svlocal:1; /* local server or remote */ 130 unsigned svlocal:1; /* local server or remote */
130 atomic_t socketUseCount; /* number of open cifs sessions on socket */ 131 atomic_t socketUseCount; /* number of open cifs sessions on socket */
131 atomic_t inFlight; /* number of requests on the wire to server */ 132 atomic_t inFlight; /* number of requests on the wire to server */
133#ifdef CONFIG_CIFS_STATS2
134 atomic_t inSend; /* requests trying to send */
135 atomic_t num_waiters; /* blocked waiting to get in sendrecv */
136#endif
132 enum statusEnum tcpStatus; /* what we think the status is */ 137 enum statusEnum tcpStatus; /* what we think the status is */
133 struct semaphore tcpSem; 138 struct semaphore tcpSem;
134 struct task_struct *tsk; 139 struct task_struct *tsk;
@@ -147,8 +152,10 @@ struct TCP_Server_Info {
147 /* (returned on Negotiate */ 152 /* (returned on Negotiate */
148 int capabilities; /* allow selective disabling of caps by smb sess */ 153 int capabilities; /* allow selective disabling of caps by smb sess */
149 __u16 timeZone; 154 __u16 timeZone;
155 __u16 CurrentMid; /* multiplex id - rotating counter */
150 char cryptKey[CIFS_CRYPTO_KEY_SIZE]; 156 char cryptKey[CIFS_CRYPTO_KEY_SIZE];
151 char workstation_RFC1001_name[16]; /* 16th byte is always zero */ 157 /* 16th byte of RFC1001 workstation name is always null */
158 char workstation_RFC1001_name[SERVER_NAME_LEN_WITH_NULL];
152 __u32 sequence_number; /* needed for CIFS PDU signature */ 159 __u32 sequence_number; /* needed for CIFS PDU signature */
153 char mac_signing_key[CIFS_SESSION_KEY_SIZE + 16]; 160 char mac_signing_key[CIFS_SESSION_KEY_SIZE + 16];
154}; 161};
@@ -214,19 +221,41 @@ struct cifsTconInfo {
214 atomic_t num_reads; 221 atomic_t num_reads;
215 atomic_t num_oplock_brks; 222 atomic_t num_oplock_brks;
216 atomic_t num_opens; 223 atomic_t num_opens;
224 atomic_t num_closes;
217 atomic_t num_deletes; 225 atomic_t num_deletes;
218 atomic_t num_mkdirs; 226 atomic_t num_mkdirs;
219 atomic_t num_rmdirs; 227 atomic_t num_rmdirs;
220 atomic_t num_renames; 228 atomic_t num_renames;
221 atomic_t num_t2renames; 229 atomic_t num_t2renames;
230 atomic_t num_ffirst;
231 atomic_t num_fnext;
232 atomic_t num_fclose;
233 atomic_t num_hardlinks;
234 atomic_t num_symlinks;
235 atomic_t num_locks;
236#ifdef CONFIG_CIFS_STATS2
237 unsigned long long time_writes;
238 unsigned long long time_reads;
239 unsigned long long time_opens;
240 unsigned long long time_deletes;
241 unsigned long long time_closes;
242 unsigned long long time_mkdirs;
243 unsigned long long time_rmdirs;
244 unsigned long long time_renames;
245 unsigned long long time_t2renames;
246 unsigned long long time_ffirst;
247 unsigned long long time_fnext;
248 unsigned long long time_fclose;
249#endif /* CONFIG_CIFS_STATS2 */
222 __u64 bytes_read; 250 __u64 bytes_read;
223 __u64 bytes_written; 251 __u64 bytes_written;
224 spinlock_t stat_lock; 252 spinlock_t stat_lock;
225#endif 253#endif /* CONFIG_CIFS_STATS */
226 FILE_SYSTEM_DEVICE_INFO fsDevInfo; 254 FILE_SYSTEM_DEVICE_INFO fsDevInfo;
227 FILE_SYSTEM_ATTRIBUTE_INFO fsAttrInfo; /* ok if file system name truncated */ 255 FILE_SYSTEM_ATTRIBUTE_INFO fsAttrInfo; /* ok if file system name truncated */
228 FILE_SYSTEM_UNIX_INFO fsUnixInfo; 256 FILE_SYSTEM_UNIX_INFO fsUnixInfo;
229 unsigned retry:1; 257 unsigned retry:1;
258 unsigned nocase:1;
230 /* BB add field for back pointer to sb struct? */ 259 /* BB add field for back pointer to sb struct? */
231}; 260};
232 261
@@ -270,6 +299,7 @@ struct cifsFileInfo {
270 struct inode * pInode; /* needed for oplock break */ 299 struct inode * pInode; /* needed for oplock break */
271 unsigned closePend:1; /* file is marked to close */ 300 unsigned closePend:1; /* file is marked to close */
272 unsigned invalidHandle:1; /* file closed via session abend */ 301 unsigned invalidHandle:1; /* file closed via session abend */
302 atomic_t wrtPending; /* handle in use - defer close */
273 struct semaphore fh_sem; /* prevents reopen race after dead ses*/ 303 struct semaphore fh_sem; /* prevents reopen race after dead ses*/
274 char * search_resume_name; /* BB removeme BB */ 304 char * search_resume_name; /* BB removeme BB */
275 unsigned int resume_name_length; /* BB removeme - field renamed and moved BB */ 305 unsigned int resume_name_length; /* BB removeme - field renamed and moved BB */
@@ -306,6 +336,41 @@ CIFS_SB(struct super_block *sb)
306 return sb->s_fs_info; 336 return sb->s_fs_info;
307} 337}
308 338
339static inline char CIFS_DIR_SEP(const struct cifs_sb_info *cifs_sb)
340{
341 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)
342 return '/';
343 else
344 return '\\';
345}
346
347#ifdef CONFIG_CIFS_STATS
348#define cifs_stats_inc atomic_inc
349
350static inline void cifs_stats_bytes_written(struct cifsTconInfo *tcon,
351 unsigned int bytes)
352{
353 if (bytes) {
354 spin_lock(&tcon->stat_lock);
355 tcon->bytes_written += bytes;
356 spin_unlock(&tcon->stat_lock);
357 }
358}
359
360static inline void cifs_stats_bytes_read(struct cifsTconInfo *tcon,
361 unsigned int bytes)
362{
363 spin_lock(&tcon->stat_lock);
364 tcon->bytes_read += bytes;
365 spin_unlock(&tcon->stat_lock);
366}
367#else
368
369#define cifs_stats_inc(field) do {} while(0)
370#define cifs_stats_bytes_written(tcon, bytes) do {} while(0)
371#define cifs_stats_bytes_read(tcon, bytes) do {} while(0)
372
373#endif
309 374
310/* one of these for every pending CIFS request to the server */ 375/* one of these for every pending CIFS request to the server */
311struct mid_q_entry { 376struct mid_q_entry {
@@ -313,7 +378,11 @@ struct mid_q_entry {
313 __u16 mid; /* multiplex id */ 378 __u16 mid; /* multiplex id */
314 __u16 pid; /* process id */ 379 __u16 pid; /* process id */
315 __u32 sequence_number; /* for CIFS signing */ 380 __u32 sequence_number; /* for CIFS signing */
316 struct timeval when_sent; /* time when smb sent */ 381 unsigned long when_alloc; /* when mid was created */
382#ifdef CONFIG_CIFS_STATS2
383 unsigned long when_sent; /* time when smb send finished */
384 unsigned long when_received; /* when demux complete (taken off wire) */
385#endif
317 struct cifsSesInfo *ses; /* smb was sent to this server */ 386 struct cifsSesInfo *ses; /* smb was sent to this server */
318 struct task_struct *tsk; /* task waiting for response */ 387 struct task_struct *tsk; /* task waiting for response */
319 struct smb_hdr *resp_buf; /* response buffer */ 388 struct smb_hdr *resp_buf; /* response buffer */
@@ -331,6 +400,20 @@ struct oplock_q_entry {
331 __u16 netfid; 400 __u16 netfid;
332}; 401};
333 402
403/* for pending dnotify requests */
404struct dir_notify_req {
405 struct list_head lhead;
406 __le16 Pid;
407 __le16 PidHigh;
408 __u16 Mid;
409 __u16 Tid;
410 __u16 Uid;
411 __u16 netfid;
412 __u32 filter; /* CompletionFilter (for multishot) */
413 int multishot;
414 struct file * pfile;
415};
416
334#define MID_FREE 0 417#define MID_FREE 0
335#define MID_REQUEST_ALLOCATED 1 418#define MID_REQUEST_ALLOCATED 1
336#define MID_REQUEST_SUBMITTED 2 419#define MID_REQUEST_SUBMITTED 2
@@ -399,6 +482,9 @@ GLOBAL_EXTERN rwlock_t GlobalSMBSeslock; /* protects list inserts on 3 above */
399 482
400GLOBAL_EXTERN struct list_head GlobalOplock_Q; 483GLOBAL_EXTERN struct list_head GlobalOplock_Q;
401 484
485GLOBAL_EXTERN struct list_head GlobalDnotifyReqList; /* Outstanding dir notify requests */
486GLOBAL_EXTERN struct list_head GlobalDnotifyRsp_Q; /* Dir notify response queue */
487
402/* 488/*
403 * Global transaction id (XID) information 489 * Global transaction id (XID) information
404 */ 490 */