Merge with Linux 2.6.0-test1.
[linux-2.6/linux-mips.git] / fs / cifs / cifsproto.h
blob4179a651a3b2fc36fd0bcf83d24280cefbd6069f
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 int ntlmv2_flag, const struct nls_table *);
93 extern int CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
94 const char *tree, struct cifsTconInfo *tcon,
95 const struct nls_table *);
97 extern int CIFSFindFirst(const int xid, struct cifsTconInfo *tcon,
98 const char *searchName,
99 FILE_DIRECTORY_INFO * findData,
100 T2_FFIRST_RSP_PARMS * findParms,
101 const struct nls_table *nls_codepage,
102 int *pUnicodeFlag,
103 int *pUnixFlag /* if Unix extensions used */ );
104 extern int CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
105 FILE_DIRECTORY_INFO * findData,
106 T2_FNEXT_RSP_PARMS * findParms,
107 const __u16 searchHandle, char * resume_name,
108 int name_length, __u32 resume_key,
109 int *UnicodeFlag, int *pUnixFlag);
111 extern int CIFSFindClose(const int, struct cifsTconInfo *tcon,
112 const __u16 search_handle);
114 extern int CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon,
115 const unsigned char *searchName,
116 FILE_ALL_INFO * findData,
117 const struct nls_table *nls_codepage);
119 extern int CIFSSMBUnixQPathInfo(const int xid,
120 struct cifsTconInfo *tcon,
121 const unsigned char *searchName,
122 FILE_UNIX_BASIC_INFO * pFindData,
123 const struct nls_table *nls_codepage);
125 extern int CIFSGetDFSRefer(const int xid, struct cifsSesInfo *ses,
126 const unsigned char *searchName,
127 unsigned char **targetUNCs,
128 unsigned int *number_of_UNC_in_array,
129 const struct nls_table *nls_codepage);
131 extern int connect_to_dfs_path(int xid, struct cifsSesInfo *pSesInfo,
132 const char *old_path,
133 const struct nls_table *nls_codepage);
134 extern int get_dfs_path(int xid, struct cifsSesInfo *pSesInfo,
135 const char *old_path, const struct nls_table *nls_codepage,
136 unsigned int *pnum_referrals, unsigned char ** preferrals);
137 extern int CIFSSMBQFSInfo(const int xid, struct cifsTconInfo *tcon,
138 struct kstatfs *FSData,
139 const struct nls_table *nls_codepage);
140 extern int CIFSSMBQFSAttributeInfo(const int xid,
141 struct cifsTconInfo *tcon,
142 const struct nls_table *nls_codepage);
143 extern int CIFSSMBQFSDeviceInfo(const int xid, struct cifsTconInfo *tcon,
144 const struct nls_table *nls_codepage);
145 extern int CIFSSMBQFSUnixInfo(const int xid, struct cifsTconInfo *tcon,
146 const struct nls_table *nls_codepage);
148 extern int CIFSSMBSetTimes(const int xid, struct cifsTconInfo *tcon,
149 char *fileName, FILE_BASIC_INFO * data,
150 const struct nls_table *nls_codepage);
151 extern int CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon,
152 char *fileName, __u64 size,int setAllocationSizeFlag,
153 const struct nls_table *nls_codepage);
154 extern int CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon,
155 __u64 size, __u16 fileHandle,__u32 opener_pid, int AllocSizeFlag);
156 extern int CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *pTcon,
157 char *full_path, __u64 mode, __u64 uid,
158 __u64 gid, dev_t dev, const struct nls_table *nls_codepage);
160 extern int CIFSSMBMkDir(const int xid, struct cifsTconInfo *tcon,
161 const char *newName,
162 const struct nls_table *nls_codepage);
163 extern int CIFSSMBRmDir(const int xid, struct cifsTconInfo *tcon,
164 const char *name, const struct nls_table *nls_codepage);
166 extern int CIFSSMBDelFile(const int xid, struct cifsTconInfo *tcon,
167 const char *name,
168 const struct nls_table *nls_codepage);
169 extern int CIFSSMBRename(const int xid, struct cifsTconInfo *tcon,
170 const char *fromName, const char *toName,
171 const struct nls_table *nls_codepage);
172 extern int CIFSCreateHardLink(const int xid,
173 struct cifsTconInfo *tcon,
174 const char *fromName, const char *toName,
175 const struct nls_table *nls_codepage);
176 extern int CIFSUnixCreateHardLink(const int xid,
177 struct cifsTconInfo *tcon,
178 const char *fromName, const char *toName,
179 const struct nls_table *nls_codepage);
180 extern int CIFSUnixCreateSymLink(const int xid,
181 struct cifsTconInfo *tcon,
182 const char *fromName, const char *toName,
183 const struct nls_table *nls_codepage);
184 extern int CIFSSMBUnixQuerySymLink(const int xid,
185 struct cifsTconInfo *tcon,
186 const unsigned char *searchName,
187 char *syminfo, const int buflen,
188 const struct nls_table *nls_codepage);
189 extern int CIFSSMBQueryReparseLinkInfo(const int xid,
190 struct cifsTconInfo *tcon,
191 const unsigned char *searchName,
192 char *symlinkinfo, const int buflen, __u16 fid,
193 const struct nls_table *nls_codepage);
195 extern int CIFSSMBOpen(const int xid, struct cifsTconInfo *tcon,
196 const char *fileName, const int disposition,
197 const int access_flags, const int omode,
198 __u16 * netfid, int *pOplock,
199 const struct nls_table *nls_codepage);
200 extern int CIFSSMBClose(const int xid, struct cifsTconInfo *tcon,
201 const int smb_file_id);
203 extern int CIFSSMBRead(const int xid, struct cifsTconInfo *tcon,
204 const int netfid, unsigned int count,
205 const __u64 lseek, unsigned int *nbytes, char **buf);
206 extern int CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon,
207 const int netfid, const unsigned int count,
208 const __u64 lseek, unsigned int *nbytes,
209 const char *buf, const int long_op);
210 extern int CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
211 const __u16 netfid, const __u64 len,
212 const __u64 offset, const __u32 numUnlock,
213 const __u32 numLock, const __u8 lockType,
214 const int waitFlag);
216 extern int CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon);
217 extern int CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses);
219 extern struct cifsSesInfo *sesInfoAlloc(void);
220 extern void sesInfoFree(struct cifsSesInfo *);
221 extern struct cifsTconInfo *tconInfoAlloc(void);
222 extern void tconInfoFree(struct cifsTconInfo *);
224 extern int cifs_demultiplex_thread(struct TCP_Server_Info *);
225 extern int cifs_reconnect(struct TCP_Server_Info *server);
227 extern int cifs_sign_smb(struct smb_hdr *, struct cifsSesInfo *,__u32 *);
228 extern int cifs_verify_signature(const struct smb_hdr *, const char * mac_key,
229 __u32 expected_sequence_number);
230 extern int cifs_calculate_mac_key(char * key,const char * rn,const char * pass);
231 extern void CalcNTLMv2_partial_mac_key(struct cifsSesInfo *, struct nls_table *);
232 extern void CalcNTLMv2_response(const struct cifsSesInfo *,char * );
234 extern int CIFSBuildServerList(int xid, char *serverBufferList,
235 int recordlength, int *entries,
236 int *totalEntries, int *topoChangedFlag);
237 extern int CIFSSMBQueryShares(int xid, struct cifsTconInfo *tcon,
238 struct shareInfo *shareList, int bufferLen,
239 int *entries, int *totalEntries);
240 extern int CIFSSMBQueryAlias(int xid, struct cifsTconInfo *tcon,
241 struct aliasInfo *aliasList, int bufferLen,
242 int *entries, int *totalEntries);
243 extern int CIFSSMBAliasInfo(int xid, struct cifsTconInfo *tcon,
244 char *aliasName, char *serverName,
245 char *shareName, char *comment);
246 extern int CIFSSMBGetShareInfo(int xid, struct cifsTconInfo *tcon,
247 char *share, char *comment);
248 extern int CIFSSMBGetUserPerms(int xid, struct cifsTconInfo *tcon,
249 char *userName, char *searchName, int *perms);
250 extern int CIFSSMBSync(int xid, struct cifsTconInfo *tcon, int netfid, int pid);
252 extern int CIFSSMBSeek(int xid,
253 struct cifsTconInfo *tcon,
254 int netfid,
255 int pid,
256 int whence, unsigned long offset, long long *newoffset);
258 extern int CIFSSMBCopy(int xid,
259 struct cifsTconInfo *ftcon,
260 char *fromName,
261 struct cifsTconInfo *ttcon,
262 char *toName, int ofun, int flags);
263 #endif /* _CIFSPROTO_H */