Merge with 2.5.75.
[linux-2.6/linux-mips.git] / fs / cifs / cifsproto.h
blob5b9dded835ecb892116d6c71cfd4c9d36eff956d
1 /*
2 * fs/cifs/cifsproto.h
4 * Copyright (c) International Business Machines Corp., 2002
5 * Author(s): Steve French (sfrench@us.ibm.com)
7 * This library is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published
9 * by the Free Software Foundation; either version 2.1 of the License, or
10 * (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
15 * the GNU Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef _CIFSPROTO_H
22 #define _CIFSPROTO_H
23 #include <linux/nls.h>
25 struct statfs;
28 *****************************************************************
29 * All Prototypes
30 *****************************************************************
33 extern struct smb_hdr *buf_get(void);
34 extern void buf_release(void *);
35 extern int smb_send(struct socket *, struct smb_hdr *,
36 unsigned int /* length */ , struct sockaddr *);
37 extern unsigned int _GetXid(void);
38 extern void _FreeXid(unsigned int);
39 #define GetXid() (int)_GetXid(); cFYI(1,("CIFS VFS: in %s as Xid: %d with uid: %d",__FUNCTION__, xid,current->fsuid));
40 #define FreeXid(curr_xid) {_FreeXid(curr_xid); cFYI(1,("CIFS VFS: leaving %s (xid = %d) rc = %d",__FUNCTION__,curr_xid,rc));}
41 extern char *build_path_from_dentry(struct dentry *);
42 extern char *build_wildcard_path_from_dentry(struct dentry *direntry);
43 extern void renew_parental_timestamps(struct dentry *direntry);
44 extern void *kcalloc(size_t mem, int type);
45 extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *,
46 struct smb_hdr * /* input */ ,
47 struct smb_hdr * /* out */ ,
48 int * /* bytes returned */ , const int long_op);
49 extern int checkSMBhdr(struct smb_hdr *smb, __u16 mid);
50 extern int checkSMB(struct smb_hdr *smb, __u16 mid, int length);
51 extern int is_valid_oplock_break(struct smb_hdr *smb);
52 extern unsigned int smbCalcSize(struct smb_hdr *ptr);
53 extern int decode_negTokenInit(unsigned char *security_blob, int length,
54 enum securityEnum *secType);
55 extern int map_smb_to_linux_error(struct smb_hdr *smb);
56 extern void header_assemble(struct smb_hdr *, char /* command */ ,
57 const struct cifsTconInfo *, int
58 /* length of fixed section (word count) in two byte units */
60 struct oplock_q_entry * AllocOplockQEntry(struct file *,struct cifsTconInfo *);
61 void DeleteOplockQEntry(struct oplock_q_entry *);
62 extern struct timespec cifs_NTtimeToUnix(u64 /* utc nanoseconds since 1601 */ );
63 extern u64 cifs_UnixTimeToNT(struct timespec);
64 extern void RevUcode_to_Ucode(char *revUnicode, char *UnicodeName);
65 extern void Ucode_to_RevUcode(char *Unicode, char *revUnicodeName);
66 extern void RevUcode_to_Ucode_with_Len(char *revUnicode, char *UnicodeName,
67 int Len);
68 extern void Ucode_to_RevUcode_with_Len(char *Unicode, char *revUnicodeName,
69 int Len);
70 extern int cifs_get_inode_info(struct inode **pinode,
71 const unsigned char *search_path,
72 struct super_block *sb);
73 extern int cifs_get_inode_info_unix(struct inode **pinode,
74 const unsigned char *search_path,
75 struct super_block *sb);
77 extern int reopen_files(struct cifsTconInfo *, struct nls_table *);
78 extern int setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo,
79 struct nls_table * nls_info);
80 extern int CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses);
81 extern int CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
82 char *ntlm_session_key, const struct nls_table *);
83 extern int CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses,
84 char *SecurityBlob,int SecurityBlobLength,
85 const struct nls_table *);
86 extern int CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
87 struct cifsSesInfo *ses, int *ntlmv2_flag,
88 const struct nls_table *);
89 extern int CIFSNTLMSSPAuthSessSetup(unsigned int xid,
90 struct cifsSesInfo *ses, char *ntlm_session_key,
91 char *lanman_session_key,int ntlmv2_flag,
92 const struct nls_table *);
94 extern int CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
95 const char *tree, struct cifsTconInfo *tcon,
96 const struct nls_table *);
98 extern int CIFSFindFirst(const int xid, struct cifsTconInfo *tcon,
99 const char *searchName,
100 FILE_DIRECTORY_INFO * findData,
101 T2_FFIRST_RSP_PARMS * findParms,
102 const struct nls_table *nls_codepage,
103 int *pUnicodeFlag,
104 int *pUnixFlag /* if Unix extensions used */ );
105 extern int CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
106 FILE_DIRECTORY_INFO * findData,
107 T2_FNEXT_RSP_PARMS * findParms,
108 const __u16 searchHandle, char * resume_name,
109 int name_length, __u32 resume_key,
110 int *UnicodeFlag, int *pUnixFlag);
112 extern int CIFSFindClose(const int, struct cifsTconInfo *tcon,
113 const __u16 search_handle);
115 extern int CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon,
116 const unsigned char *searchName,
117 FILE_ALL_INFO * findData,
118 const struct nls_table *nls_codepage);
120 extern int CIFSSMBUnixQPathInfo(const int xid,
121 struct cifsTconInfo *tcon,
122 const unsigned char *searchName,
123 FILE_UNIX_BASIC_INFO * pFindData,
124 const struct nls_table *nls_codepage);
126 extern int CIFSGetDFSRefer(const int xid, struct cifsSesInfo *ses,
127 const unsigned char *searchName,
128 unsigned char **targetUNCs,
129 unsigned int *number_of_UNC_in_array,
130 const struct nls_table *nls_codepage);
132 extern int connect_to_dfs_path(int xid, struct cifsSesInfo *pSesInfo,
133 const char *old_path,
134 const struct nls_table *nls_codepage);
135 extern int get_dfs_path(int xid, struct cifsSesInfo *pSesInfo,
136 const char *old_path, const struct nls_table *nls_codepage,
137 unsigned int *pnum_referrals, unsigned char ** preferrals);
138 extern int CIFSSMBQFSInfo(const int xid, struct cifsTconInfo *tcon,
139 struct kstatfs *FSData,
140 const struct nls_table *nls_codepage);
141 extern int CIFSSMBQFSAttributeInfo(const int xid,
142 struct cifsTconInfo *tcon,
143 const struct nls_table *nls_codepage);
144 extern int CIFSSMBQFSDeviceInfo(const int xid, struct cifsTconInfo *tcon,
145 const struct nls_table *nls_codepage);
146 extern int CIFSSMBQFSUnixInfo(const int xid, struct cifsTconInfo *tcon,
147 const struct nls_table *nls_codepage);
149 extern int CIFSSMBSetTimes(const int xid, struct cifsTconInfo *tcon,
150 char *fileName, FILE_BASIC_INFO * data,
151 const struct nls_table *nls_codepage);
152 extern int CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon,
153 char *fileName, __u64 size,int setAllocationSizeFlag,
154 const struct nls_table *nls_codepage);
155 extern int CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon,
156 __u64 size, __u16 fileHandle,__u32 opener_pid, int AllocSizeFlag);
157 extern int CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *pTcon,
158 char *full_path, __u64 mode, __u64 uid,
159 __u64 gid, const struct nls_table *nls_codepage);
161 extern int CIFSSMBMkDir(const int xid, struct cifsTconInfo *tcon,
162 const char *newName,
163 const struct nls_table *nls_codepage);
164 extern int CIFSSMBRmDir(const int xid, struct cifsTconInfo *tcon,
165 const char *name, const struct nls_table *nls_codepage);
167 extern int CIFSSMBDelFile(const int xid, struct cifsTconInfo *tcon,
168 const char *name,
169 const struct nls_table *nls_codepage);
170 extern int CIFSSMBRename(const int xid, struct cifsTconInfo *tcon,
171 const char *fromName, const char *toName,
172 const struct nls_table *nls_codepage);
173 extern int CIFSCreateHardLink(const int xid,
174 struct cifsTconInfo *tcon,
175 const char *fromName, const char *toName,
176 const struct nls_table *nls_codepage);
177 extern int CIFSUnixCreateHardLink(const int xid,
178 struct cifsTconInfo *tcon,
179 const char *fromName, const char *toName,
180 const struct nls_table *nls_codepage);
181 extern int CIFSUnixCreateSymLink(const int xid,
182 struct cifsTconInfo *tcon,
183 const char *fromName, const char *toName,
184 const struct nls_table *nls_codepage);
185 extern int CIFSSMBUnixQuerySymLink(const int xid,
186 struct cifsTconInfo *tcon,
187 const unsigned char *searchName,
188 char *syminfo, const int buflen,
189 const struct nls_table *nls_codepage);
190 extern int CIFSSMBQueryReparseLinkInfo(const int xid,
191 struct cifsTconInfo *tcon,
192 const unsigned char *searchName,
193 char *symlinkinfo, const int buflen, __u16 fid,
194 const struct nls_table *nls_codepage);
196 extern int CIFSSMBOpen(const int xid, struct cifsTconInfo *tcon,
197 const char *fileName, const int disposition,
198 const int access_flags, const int omode,
199 __u16 * netfid, int *pOplock,
200 const struct nls_table *nls_codepage);
201 extern int CIFSSMBClose(const int xid, struct cifsTconInfo *tcon,
202 const int smb_file_id);
204 extern int CIFSSMBRead(const int xid, struct cifsTconInfo *tcon,
205 const int netfid, unsigned int count,
206 const __u64 lseek, unsigned int *nbytes, char **buf);
207 extern int CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon,
208 const int netfid, const unsigned int count,
209 const __u64 lseek, unsigned int *nbytes,
210 const char *buf, const int long_op);
211 extern int CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
212 const __u16 netfid, const __u64 len,
213 const __u64 offset, const __u32 numUnlock,
214 const __u32 numLock, const __u8 lockType,
215 const int waitFlag);
217 extern int CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon);
218 extern int CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses);
220 extern struct cifsSesInfo *sesInfoAlloc(void);
221 extern void sesInfoFree(struct cifsSesInfo *);
222 extern struct cifsTconInfo *tconInfoAlloc(void);
223 extern void tconInfoFree(struct cifsTconInfo *);
225 extern int cifs_demultiplex_thread(struct TCP_Server_Info *);
226 extern int cifs_reconnect(struct TCP_Server_Info *server);
228 extern int cifs_sign_smb(struct smb_hdr *, struct cifsSesInfo *,__u32 *);
229 extern int cifs_verify_signature(const struct smb_hdr *, const char * mac_key,
230 __u32 expected_sequence_number);
231 extern int cifs_calculate_mac_key(char * key,const char * rn,const char * pass);
233 /* BB routines below not implemented yet BB */
235 extern int CIFSBuildServerList(int xid, char *serverBufferList,
236 int recordlength, int *entries,
237 int *totalEntries, int *topoChangedFlag);
238 extern int CIFSSMBQueryShares(int xid, struct cifsTconInfo *tcon,
239 struct shareInfo *shareList, int bufferLen,
240 int *entries, int *totalEntries);
241 extern int CIFSSMBQueryAlias(int xid, struct cifsTconInfo *tcon,
242 struct aliasInfo *aliasList, int bufferLen,
243 int *entries, int *totalEntries);
244 extern int CIFSSMBAliasInfo(int xid, struct cifsTconInfo *tcon,
245 char *aliasName, char *serverName,
246 char *shareName, char *comment);
247 extern int CIFSSMBGetShareInfo(int xid, struct cifsTconInfo *tcon,
248 char *share, char *comment);
249 extern int CIFSSMBGetUserPerms(int xid, struct cifsTconInfo *tcon,
250 char *userName, char *searchName, int *perms);
251 extern int CIFSSMBSync(int xid, struct cifsTconInfo *tcon, int netfid, int pid);
253 extern int CIFSSMBSeek(int xid,
254 struct cifsTconInfo *tcon,
255 int netfid,
256 int pid,
257 int whence, unsigned long offset, long long *newoffset);
259 extern int CIFSSMBCopy(int xid,
260 struct cifsTconInfo *ftcon,
261 char *fromName,
262 struct cifsTconInfo *ttcon,
263 char *toName, int ofun, int flags);
264 #endif /* _CIFSPROTO_H */