📄 cifsglob.h
字号:
__u32 resume_key; char *ntwrk_buf_start; char *srch_entries_start; char *presume_name; unsigned int resume_name_len; unsigned endOfSearch:1; unsigned emptyDir:1; unsigned unicode:1; unsigned smallBuf:1; /* so we know which buf_release function to call */};struct cifsFileInfo { struct list_head tlist; /* pointer to next fid owned by tcon */ struct list_head flist; /* next fid (file instance) for this inode */ unsigned int uid; /* allows finding which FileInfo structure */ __u32 pid; /* process id who opened file */ __u16 netfid; /* file id from remote */ /* BB add lock scope info here if needed */ ; /* lock scope id (0 if none) */ struct file *pfile; /* needed for writepage */ struct inode *pInode; /* needed for oplock break */#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17) struct mutex lock_mutex;#else struct semaphore lock_mutex;#endif struct list_head llist; /* list of byte range locks we have. */ unsigned closePend:1; /* file is marked to close */ unsigned invalidHandle:1; /* file closed via session abend */ atomic_t wrtPending; /* handle in use - defer close */ struct semaphore fh_sem; /* prevents reopen race after dead ses*/ char *search_resume_name; /* BB removeme BB */ struct cifs_search_info srch_inf;};/* * One of these for each file inode */struct cifsInodeInfo { struct list_head lockList; /* BB add in lists for dirty pages i.e. write caching info for oplock */ struct list_head openFileList; int write_behind_rc; __u32 cifsAttrs; /* e.g. DOS archive bit, sparse, compressed, system */ atomic_t inUse; /* num concurrent users (local openers cifs) of file*/ unsigned long time; /* jiffies of last update/check of inode */ unsigned clientCanCacheRead:1; /* read oplock */ unsigned clientCanCacheAll:1; /* read and writebehind oplock */ unsigned oplockPending:1;#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0) struct inode vfs_inode;#endif};#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)static inline struct cifsInodeInfo *CIFS_I(struct inode *inode){ return container_of(inode, struct cifsInodeInfo, vfs_inode);}static inline struct cifs_sb_info *CIFS_SB(struct super_block *sb){ return sb->s_fs_info;}#else /* 2.4 kernel case */static inline struct cifsInodeInfo *CIFS_I(struct inode *inode){ return (struct cifsInodeInfo *)&(inode->u);}static inline struct cifs_sb_info *CIFS_SB(struct super_block *sb){ return (struct cifs_sb_info *) &(sb->u);}extern struct inode * get_cifs_inode(struct super_block * sb);#endifstatic inline char CIFS_DIR_SEP(const struct cifs_sb_info *cifs_sb){ if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) return '/'; else return '\\';}#ifdef CONFIG_CIFS_STATS#define cifs_stats_inc atomic_incstatic inline void cifs_stats_bytes_written(struct cifsTconInfo *tcon, unsigned int bytes){ if (bytes) { spin_lock(&tcon->stat_lock); tcon->bytes_written += bytes; spin_unlock(&tcon->stat_lock); }}static inline void cifs_stats_bytes_read(struct cifsTconInfo *tcon, unsigned int bytes){ spin_lock(&tcon->stat_lock); tcon->bytes_read += bytes; spin_unlock(&tcon->stat_lock);}#else#define cifs_stats_inc(field) do {} while (0)#define cifs_stats_bytes_written(tcon, bytes) do {} while (0)#define cifs_stats_bytes_read(tcon, bytes) do {} while (0)#endif/* one of these for every pending CIFS request to the server */struct mid_q_entry { struct list_head qhead; /* mids waiting on reply from this server */ __u16 mid; /* multiplex id */ __u16 pid; /* process id */ __u32 sequence_number; /* for CIFS signing */ unsigned long when_alloc; /* when mid was created */#ifdef CONFIG_CIFS_STATS2 unsigned long when_sent; /* time when smb send finished */ unsigned long when_received; /* when demux complete (taken off wire) */#endif struct cifsSesInfo *ses; /* smb was sent to this server */ struct task_struct *tsk; /* task waiting for response */ struct smb_hdr *resp_buf; /* response buffer */ int midState; /* wish this were enum but can not pass to wait_event */ __u8 command; /* smb command code */ unsigned largeBuf:1; /* if valid response, is pointer to large buf */ unsigned multiRsp:1; /* multiple trans2 responses for one request */ unsigned multiEnd:1; /* both received */};struct oplock_q_entry { struct list_head qhead; struct inode *pinode; struct cifsTconInfo *tcon; __u16 netfid;};/* for pending dnotify requests */struct dir_notify_req { struct list_head lhead; __le16 Pid; __le16 PidHigh; __u16 Mid; __u16 Tid; __u16 Uid; __u16 netfid; __u32 filter; /* CompletionFilter (for multishot) */ int multishot; struct file *pfile;};#define MID_FREE 0#define MID_REQUEST_ALLOCATED 1#define MID_REQUEST_SUBMITTED 2#define MID_RESPONSE_RECEIVED 4#define MID_RETRY_NEEDED 8 /* session closed while this request out */#define MID_NO_RESP_NEEDED 0x10/* Types of response buffer returned from SendReceive2 */#define CIFS_NO_BUFFER 0 /* Response buffer not returned */#define CIFS_SMALL_BUFFER 1#define CIFS_LARGE_BUFFER 2#define CIFS_IOVEC 4 /* array of response buffers *//* Security Flags: indicate type of session setup needed */#define CIFSSEC_MAY_SIGN 0x00001#define CIFSSEC_MAY_NTLM 0x00002#define CIFSSEC_MAY_NTLMV2 0x00004#define CIFSSEC_MAY_KRB5 0x00008#ifdef CONFIG_CIFS_WEAK_PW_HASH#define CIFSSEC_MAY_LANMAN 0x00010#define CIFSSEC_MAY_PLNTXT 0x00020#endif /* weak passwords */#define CIFSSEC_MAY_SEAL 0x00040 /* not supported yet */#define CIFSSEC_MUST_SIGN 0x01001/* note that only one of the following can be set so theresult of setting MUST flags more than once will be torequire use of the stronger protocol */#define CIFSSEC_MUST_NTLM 0x02002#define CIFSSEC_MUST_NTLMV2 0x04004#define CIFSSEC_MUST_KRB5 0x08008#ifdef CONFIG_CIFS_WEAK_PW_HASH#define CIFSSEC_MUST_LANMAN 0x10010#define CIFSSEC_MUST_PLNTXT 0x20020#define CIFSSEC_MASK 0x37037 /* current flags supported if weak */#else#define CIFSSEC_MASK 0x07007 /* flags supported if no weak config */#endif /* WEAK_PW_HASH */#define CIFSSEC_MUST_SEAL 0x40040 /* not supported yet */#define CIFSSEC_DEF CIFSSEC_MAY_SIGN | CIFSSEC_MAY_NTLM | CIFSSEC_MAY_NTLMV2#define CIFSSEC_MAX CIFSSEC_MUST_SIGN | CIFSSEC_MUST_NTLMV2/* ***************************************************************** * All constants go here ***************************************************************** */#define UID_HASH (16)/* * Note that ONE module should define _DECLARE_GLOBALS_HERE to cause the * following to be declared. *//**************************************************************************** * Locking notes. All updates to global variables and lists should be * protected by spinlocks or semaphores. * * Spinlocks * --------- * GlobalMid_Lock protects: * list operations on pending_mid_q and oplockQ * updates to XID counters, multiplex id and SMB sequence numbers * GlobalSMBSesLock protects: * list operations on tcp and SMB session lists and tCon lists * f_owner.lock protects certain per file struct operations * mapping->page_lock protects certain per page operations * * Semaphores * ---------- * sesSem operations on smb session * tconSem operations on tree connection * fh_sem file handle reconnection operations * ****************************************************************************/#ifdef DECLARE_GLOBALS_HERE#define GLOBAL_EXTERN#else#define GLOBAL_EXTERN extern#endif/* * The list of servers that did not respond with NT LM 0.12. * This list helps improve performance and eliminate the messages indicating * that we had a communications error talking to the server in this list. *//* Feature not supported *//* GLOBAL_EXTERN struct servers_not_supported *NotSuppList; *//* * The following is a hash table of all the users we know about. */GLOBAL_EXTERN struct smbUidInfo *GlobalUidList[UID_HASH];/* GLOBAL_EXTERN struct list_head GlobalServerList; BB not implemented yet */GLOBAL_EXTERN struct list_head GlobalSMBSessionList;GLOBAL_EXTERN struct list_head GlobalTreeConnectionList;GLOBAL_EXTERN rwlock_t GlobalSMBSeslock; /* protects list inserts on 3 above */GLOBAL_EXTERN struct list_head GlobalOplock_Q;/* Outstanding dir notify requests */GLOBAL_EXTERN struct list_head GlobalDnotifyReqList;/* DirNotify response queue */GLOBAL_EXTERN struct list_head GlobalDnotifyRsp_Q;/* * 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 */ /* on midQ entries */GLOBAL_EXTERN char Local_System_Name[15];/* * Global counters, updated atomically */GLOBAL_EXTERN atomic_t sesInfoAllocCount;GLOBAL_EXTERN atomic_t tconInfoAllocCount;GLOBAL_EXTERN atomic_t tcpSesAllocCount;GLOBAL_EXTERN atomic_t tcpSesReconnectCount;GLOBAL_EXTERN atomic_t tconInfoReconnectCount;/* Various Debug counters to remove someday (BB) */GLOBAL_EXTERN atomic_t bufAllocCount; /* current number allocated */#ifdef CONFIG_CIFS_STATS2GLOBAL_EXTERN atomic_t totBufAllocCount; /* total allocated over all time */GLOBAL_EXTERN atomic_t totSmBufAllocCount;#endifGLOBAL_EXTERN atomic_t smBufAllocCount;GLOBAL_EXTERN atomic_t midCount;/* Misc globals */GLOBAL_EXTERN unsigned int multiuser_mount; /* if enabled allows new sessions to be established on existing mount if we have the uid/password or Kerberos credential or equivalent for current user */GLOBAL_EXTERN unsigned int oplockEnabled;GLOBAL_EXTERN unsigned int experimEnabled;GLOBAL_EXTERN unsigned int lookupCacheEnabled;GLOBAL_EXTERN unsigned int extended_security; /* if on, session setup sent with more secure ntlmssp2 challenge/resp */GLOBAL_EXTERN unsigned int sign_CIFS_PDUs; /* enable smb packet signing */GLOBAL_EXTERN unsigned int linuxExtEnabled;/*enable Linux/Unix CIFS extensions*/GLOBAL_EXTERN unsigned int CIFSMaxBufSize; /* max size not including hdr */GLOBAL_EXTERN unsigned int cifs_min_rcv; /* min size of big ntwrk buf pool */GLOBAL_EXTERN unsigned int cifs_min_small; /* min size of small buf pool */GLOBAL_EXTERN unsigned int cifs_max_pending; /* MAX requests at once to server*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -