aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifsproto.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/cifsproto.h')
-rw-r--r--fs/cifs/cifsproto.h136
1 files changed, 61 insertions, 75 deletions
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index f1bbf8305d3a..5144e9fbeb8c 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -24,6 +24,7 @@
24 24
25struct statfs; 25struct statfs;
26struct smb_vol; 26struct smb_vol;
27struct smb_rqst;
27 28
28/* 29/*
29 ***************************************************************** 30 *****************************************************************
@@ -35,6 +36,8 @@ extern struct smb_hdr *cifs_buf_get(void);
35extern void cifs_buf_release(void *); 36extern void cifs_buf_release(void *);
36extern struct smb_hdr *cifs_small_buf_get(void); 37extern struct smb_hdr *cifs_small_buf_get(void);
37extern void cifs_small_buf_release(void *); 38extern void cifs_small_buf_release(void *);
39extern void cifs_rqst_page_to_kvec(struct smb_rqst *rqst, unsigned int idx,
40 struct kvec *iov);
38extern int smb_send(struct TCP_Server_Info *, struct smb_hdr *, 41extern int smb_send(struct TCP_Server_Info *, struct smb_hdr *,
39 unsigned int /* length */); 42 unsigned int /* length */);
40extern unsigned int _get_xid(void); 43extern unsigned int _get_xid(void);
@@ -65,21 +68,22 @@ extern char *cifs_compose_mount_options(const char *sb_mountdata,
65extern struct mid_q_entry *AllocMidQEntry(const struct smb_hdr *smb_buffer, 68extern struct mid_q_entry *AllocMidQEntry(const struct smb_hdr *smb_buffer,
66 struct TCP_Server_Info *server); 69 struct TCP_Server_Info *server);
67extern void DeleteMidQEntry(struct mid_q_entry *midEntry); 70extern void DeleteMidQEntry(struct mid_q_entry *midEntry);
71extern void cifs_delete_mid(struct mid_q_entry *mid);
68extern void cifs_wake_up_task(struct mid_q_entry *mid); 72extern void cifs_wake_up_task(struct mid_q_entry *mid);
69extern int cifs_call_async(struct TCP_Server_Info *server, struct kvec *iov, 73extern int cifs_call_async(struct TCP_Server_Info *server,
70 unsigned int nvec, mid_receive_t *receive, 74 struct smb_rqst *rqst,
71 mid_callback_t *callback, void *cbdata, 75 mid_receive_t *receive, mid_callback_t *callback,
72 const int flags); 76 void *cbdata, const int flags);
73extern int SendReceive(const unsigned int /* xid */ , struct cifs_ses *, 77extern int SendReceive(const unsigned int /* xid */ , struct cifs_ses *,
74 struct smb_hdr * /* input */ , 78 struct smb_hdr * /* input */ ,
75 struct smb_hdr * /* out */ , 79 struct smb_hdr * /* out */ ,
76 int * /* bytes returned */ , const int); 80 int * /* bytes returned */ , const int);
77extern int SendReceiveNoRsp(const unsigned int xid, struct cifs_ses *ses, 81extern int SendReceiveNoRsp(const unsigned int xid, struct cifs_ses *ses,
78 char *in_buf, int flags); 82 char *in_buf, int flags);
79extern int cifs_setup_request(struct cifs_ses *, struct kvec *, unsigned int, 83extern struct mid_q_entry *cifs_setup_request(struct cifs_ses *,
80 struct mid_q_entry **); 84 struct smb_rqst *);
81extern int cifs_setup_async_request(struct TCP_Server_Info *, struct kvec *, 85extern struct mid_q_entry *cifs_setup_async_request(struct TCP_Server_Info *,
82 unsigned int, struct mid_q_entry **); 86 struct smb_rqst *);
83extern int cifs_check_receive(struct mid_q_entry *mid, 87extern int cifs_check_receive(struct mid_q_entry *mid,
84 struct TCP_Server_Info *server, bool log_error); 88 struct TCP_Server_Info *server, bool log_error);
85extern int SendReceive2(const unsigned int /* xid */ , struct cifs_ses *, 89extern int SendReceive2(const unsigned int /* xid */ , struct cifs_ses *,
@@ -99,7 +103,7 @@ extern void cifs_update_eof(struct cifsInodeInfo *cifsi, loff_t offset,
99 unsigned int bytes_written); 103 unsigned int bytes_written);
100extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *, bool); 104extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *, bool);
101extern struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *, bool); 105extern struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *, bool);
102extern unsigned int smbCalcSize(struct smb_hdr *ptr); 106extern unsigned int smbCalcSize(void *buf);
103extern int decode_negTokenInit(unsigned char *security_blob, int length, 107extern int decode_negTokenInit(unsigned char *security_blob, int length,
104 struct TCP_Server_Info *server); 108 struct TCP_Server_Info *server);
105extern int cifs_convert_address(struct sockaddr *dst, const char *src, int len); 109extern int cifs_convert_address(struct sockaddr *dst, const char *src, int len);
@@ -120,10 +124,14 @@ extern u64 cifs_UnixTimeToNT(struct timespec);
120extern struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time, 124extern struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time,
121 int offset); 125 int offset);
122extern void cifs_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock); 126extern void cifs_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock);
123 127extern int cifs_unlock_range(struct cifsFileInfo *cfile,
124extern struct cifsFileInfo *cifs_new_fileinfo(__u16 fileHandle, 128 struct file_lock *flock, const unsigned int xid);
125 struct file *file, struct tcon_link *tlink, 129extern int cifs_push_mandatory_locks(struct cifsFileInfo *cfile);
126 __u32 oplock); 130
131extern struct cifsFileInfo *cifs_new_fileinfo(struct cifs_fid *fid,
132 struct file *file,
133 struct tcon_link *tlink,
134 __u32 oplock);
127extern int cifs_posix_open(char *full_path, struct inode **inode, 135extern int cifs_posix_open(char *full_path, struct inode **inode,
128 struct super_block *sb, int mode, 136 struct super_block *sb, int mode,
129 unsigned int f_flags, __u32 *oplock, __u16 *netfid, 137 unsigned int f_flags, __u32 *oplock, __u16 *netfid,
@@ -132,18 +140,23 @@ void cifs_fill_uniqueid(struct super_block *sb, struct cifs_fattr *fattr);
132extern void cifs_unix_basic_to_fattr(struct cifs_fattr *fattr, 140extern void cifs_unix_basic_to_fattr(struct cifs_fattr *fattr,
133 FILE_UNIX_BASIC_INFO *info, 141 FILE_UNIX_BASIC_INFO *info,
134 struct cifs_sb_info *cifs_sb); 142 struct cifs_sb_info *cifs_sb);
143extern void cifs_dir_info_to_fattr(struct cifs_fattr *, FILE_DIRECTORY_INFO *,
144 struct cifs_sb_info *);
135extern void cifs_fattr_to_inode(struct inode *inode, struct cifs_fattr *fattr); 145extern void cifs_fattr_to_inode(struct inode *inode, struct cifs_fattr *fattr);
136extern struct inode *cifs_iget(struct super_block *sb, 146extern struct inode *cifs_iget(struct super_block *sb,
137 struct cifs_fattr *fattr); 147 struct cifs_fattr *fattr);
138 148
139extern int cifs_get_file_info(struct file *filp);
140extern int cifs_get_inode_info(struct inode **inode, const char *full_path, 149extern int cifs_get_inode_info(struct inode **inode, const char *full_path,
141 FILE_ALL_INFO *data, struct super_block *sb, 150 FILE_ALL_INFO *data, struct super_block *sb,
142 int xid, const __u16 *fid); 151 int xid, const __u16 *fid);
143extern int cifs_get_file_info_unix(struct file *filp);
144extern int cifs_get_inode_info_unix(struct inode **pinode, 152extern int cifs_get_inode_info_unix(struct inode **pinode,
145 const unsigned char *search_path, 153 const unsigned char *search_path,
146 struct super_block *sb, unsigned int xid); 154 struct super_block *sb, unsigned int xid);
155extern int cifs_set_file_info(struct inode *inode, struct iattr *attrs,
156 unsigned int xid, char *full_path, __u32 dosattr);
157extern int cifs_rename_pending_delete(const char *full_path,
158 struct dentry *dentry,
159 const unsigned int xid);
147extern int cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, 160extern int cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb,
148 struct cifs_fattr *fattr, struct inode *inode, 161 struct cifs_fattr *fattr, struct inode *inode,
149 const char *path, const __u16 *pfid); 162 const char *path, const __u16 *pfid);
@@ -169,6 +182,17 @@ extern struct smb_vol *cifs_get_volume_info(char *mount_data,
169extern int cifs_mount(struct cifs_sb_info *, struct smb_vol *); 182extern int cifs_mount(struct cifs_sb_info *, struct smb_vol *);
170extern void cifs_umount(struct cifs_sb_info *); 183extern void cifs_umount(struct cifs_sb_info *);
171extern void cifs_mark_open_files_invalid(struct cifs_tcon *tcon); 184extern void cifs_mark_open_files_invalid(struct cifs_tcon *tcon);
185extern bool cifs_find_lock_conflict(struct cifsFileInfo *cfile, __u64 offset,
186 __u64 length, __u8 type,
187 struct cifsLockInfo **conf_lock,
188 bool rw_check);
189extern void cifs_add_pending_open(struct cifs_fid *fid,
190 struct tcon_link *tlink,
191 struct cifs_pending_open *open);
192extern void cifs_add_pending_open_locked(struct cifs_fid *fid,
193 struct tcon_link *tlink,
194 struct cifs_pending_open *open);
195extern void cifs_del_pending_open(struct cifs_pending_open *open);
172 196
173#if IS_ENABLED(CONFIG_CIFS_DFS_UPCALL) 197#if IS_ENABLED(CONFIG_CIFS_DFS_UPCALL)
174extern void cifs_dfs_release_automount_timer(void); 198extern void cifs_dfs_release_automount_timer(void);
@@ -179,6 +203,10 @@ extern void cifs_dfs_release_automount_timer(void);
179void cifs_proc_init(void); 203void cifs_proc_init(void);
180void cifs_proc_clean(void); 204void cifs_proc_clean(void);
181 205
206extern void cifs_move_llist(struct list_head *source, struct list_head *dest);
207extern void cifs_free_llist(struct list_head *llist);
208extern void cifs_del_lock_waiters(struct cifsLockInfo *lock);
209
182extern int cifs_negotiate_protocol(const unsigned int xid, 210extern int cifs_negotiate_protocol(const unsigned int xid,
183 struct cifs_ses *ses); 211 struct cifs_ses *ses);
184extern int cifs_setup_session(const unsigned int xid, struct cifs_ses *ses, 212extern int cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,
@@ -190,10 +218,10 @@ extern int CIFSTCon(const unsigned int xid, struct cifs_ses *ses,
190 const struct nls_table *); 218 const struct nls_table *);
191 219
192extern int CIFSFindFirst(const unsigned int xid, struct cifs_tcon *tcon, 220extern int CIFSFindFirst(const unsigned int xid, struct cifs_tcon *tcon,
193 const char *searchName, const struct nls_table *nls_codepage, 221 const char *searchName, struct cifs_sb_info *cifs_sb,
194 __u16 *searchHandle, __u16 search_flags, 222 __u16 *searchHandle, __u16 search_flags,
195 struct cifs_search_info *psrch_inf, 223 struct cifs_search_info *psrch_inf,
196 int map, const char dirsep); 224 bool msearch);
197 225
198extern int CIFSFindNext(const unsigned int xid, struct cifs_tcon *tcon, 226extern int CIFSFindNext(const unsigned int xid, struct cifs_tcon *tcon,
199 __u16 searchHandle, __u16 search_flags, 227 __u16 searchHandle, __u16 search_flags,
@@ -265,13 +293,11 @@ extern int CIFSSMBSetAttrLegacy(unsigned int xid, struct cifs_tcon *tcon,
265 const struct nls_table *nls_codepage); 293 const struct nls_table *nls_codepage);
266#endif /* possibly unneeded function */ 294#endif /* possibly unneeded function */
267extern int CIFSSMBSetEOF(const unsigned int xid, struct cifs_tcon *tcon, 295extern int CIFSSMBSetEOF(const unsigned int xid, struct cifs_tcon *tcon,
268 const char *fileName, __u64 size, 296 const char *file_name, __u64 size,
269 bool setAllocationSizeFlag, 297 struct cifs_sb_info *cifs_sb, bool set_allocation);
270 const struct nls_table *nls_codepage,
271 int remap_special_chars);
272extern int CIFSSMBSetFileSize(const unsigned int xid, struct cifs_tcon *tcon, 298extern int CIFSSMBSetFileSize(const unsigned int xid, struct cifs_tcon *tcon,
273 __u64 size, __u16 fileHandle, __u32 opener_pid, 299 struct cifsFileInfo *cfile, __u64 size,
274 bool AllocSizeFlag); 300 bool set_allocation);
275 301
276struct cifs_unix_set_info_args { 302struct cifs_unix_set_info_args {
277 __u64 ctime; 303 __u64 ctime;
@@ -303,22 +329,17 @@ extern int CIFSPOSIXDelFile(const unsigned int xid, struct cifs_tcon *tcon,
303 const struct nls_table *nls_codepage, 329 const struct nls_table *nls_codepage,
304 int remap_special_chars); 330 int remap_special_chars);
305extern int CIFSSMBDelFile(const unsigned int xid, struct cifs_tcon *tcon, 331extern int CIFSSMBDelFile(const unsigned int xid, struct cifs_tcon *tcon,
306 const char *name, 332 const char *name, struct cifs_sb_info *cifs_sb);
307 const struct nls_table *nls_codepage,
308 int remap_special_chars);
309extern int CIFSSMBRename(const unsigned int xid, struct cifs_tcon *tcon, 333extern int CIFSSMBRename(const unsigned int xid, struct cifs_tcon *tcon,
310 const char *fromName, const char *toName, 334 const char *from_name, const char *to_name,
311 const struct nls_table *nls_codepage, 335 struct cifs_sb_info *cifs_sb);
312 int remap_special_chars);
313extern int CIFSSMBRenameOpenFile(const unsigned int xid, struct cifs_tcon *tcon, 336extern int CIFSSMBRenameOpenFile(const unsigned int xid, struct cifs_tcon *tcon,
314 int netfid, const char *target_name, 337 int netfid, const char *target_name,
315 const struct nls_table *nls_codepage, 338 const struct nls_table *nls_codepage,
316 int remap_special_chars); 339 int remap_special_chars);
317extern int CIFSCreateHardLink(const unsigned int xid, 340extern int CIFSCreateHardLink(const unsigned int xid, struct cifs_tcon *tcon,
318 struct cifs_tcon *tcon, 341 const char *from_name, const char *to_name,
319 const char *fromName, const char *toName, 342 struct cifs_sb_info *cifs_sb);
320 const struct nls_table *nls_codepage,
321 int remap_special_chars);
322extern int CIFSUnixCreateHardLink(const unsigned int xid, 343extern int CIFSUnixCreateHardLink(const unsigned int xid,
323 struct cifs_tcon *tcon, 344 struct cifs_tcon *tcon,
324 const char *fromName, const char *toName, 345 const char *fromName, const char *toName,
@@ -367,8 +388,7 @@ extern int CIFSSMBWrite(const unsigned int xid, struct cifs_io_parms *io_parms,
367 unsigned int *nbytes, const char *buf, 388 unsigned int *nbytes, const char *buf,
368 const char __user *ubuf, const int long_op); 389 const char __user *ubuf, const int long_op);
369extern int CIFSSMBWrite2(const unsigned int xid, struct cifs_io_parms *io_parms, 390extern int CIFSSMBWrite2(const unsigned int xid, struct cifs_io_parms *io_parms,
370 unsigned int *nbytes, struct kvec *iov, const int nvec, 391 unsigned int *nbytes, struct kvec *iov, const int nvec);
371 const int long_op);
372extern int CIFSGetSrvInodeNumber(const unsigned int xid, struct cifs_tcon *tcon, 392extern int CIFSGetSrvInodeNumber(const unsigned int xid, struct cifs_tcon *tcon,
373 const char *search_name, __u64 *inode_number, 393 const char *search_name, __u64 *inode_number,
374 const struct nls_table *nls_codepage, 394 const struct nls_table *nls_codepage,
@@ -397,10 +417,12 @@ extern void sesInfoFree(struct cifs_ses *);
397extern struct cifs_tcon *tconInfoAlloc(void); 417extern struct cifs_tcon *tconInfoAlloc(void);
398extern void tconInfoFree(struct cifs_tcon *); 418extern void tconInfoFree(struct cifs_tcon *);
399 419
400extern int cifs_sign_smb(struct smb_hdr *, struct TCP_Server_Info *, __u32 *); 420extern int cifs_sign_rqst(struct smb_rqst *rqst, struct TCP_Server_Info *server,
421 __u32 *pexpected_response_sequence_number);
401extern int cifs_sign_smbv(struct kvec *iov, int n_vec, struct TCP_Server_Info *, 422extern int cifs_sign_smbv(struct kvec *iov, int n_vec, struct TCP_Server_Info *,
402 __u32 *); 423 __u32 *);
403extern int cifs_verify_signature(struct kvec *iov, unsigned int nr_iov, 424extern int cifs_sign_smb(struct smb_hdr *, struct TCP_Server_Info *, __u32 *);
425extern int cifs_verify_signature(struct smb_rqst *rqst,
404 struct TCP_Server_Info *server, 426 struct TCP_Server_Info *server,
405 __u32 expected_sequence_number); 427 __u32 expected_sequence_number);
406extern int SMBNTencrypt(unsigned char *, unsigned char *, unsigned char *, 428extern int SMBNTencrypt(unsigned char *, unsigned char *, unsigned char *,
@@ -462,45 +484,9 @@ extern int E_md4hash(const unsigned char *passwd, unsigned char *p16,
462extern int SMBencrypt(unsigned char *passwd, const unsigned char *c8, 484extern int SMBencrypt(unsigned char *passwd, const unsigned char *c8,
463 unsigned char *p24); 485 unsigned char *p24);
464 486
465/* asynchronous read support */
466struct cifs_readdata {
467 struct kref refcount;
468 struct list_head list;
469 struct completion done;
470 struct cifsFileInfo *cfile;
471 struct address_space *mapping;
472 __u64 offset;
473 unsigned int bytes;
474 pid_t pid;
475 int result;
476 struct list_head pages;
477 struct work_struct work;
478 int (*marshal_iov) (struct cifs_readdata *rdata,
479 unsigned int remaining);
480 unsigned int nr_iov;
481 struct kvec iov[1];
482};
483
484void cifs_readdata_release(struct kref *refcount); 487void cifs_readdata_release(struct kref *refcount);
485int cifs_async_readv(struct cifs_readdata *rdata); 488int cifs_async_readv(struct cifs_readdata *rdata);
486 489int cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid);
487/* asynchronous write support */
488struct cifs_writedata {
489 struct kref refcount;
490 struct list_head list;
491 struct completion done;
492 enum writeback_sync_modes sync_mode;
493 struct work_struct work;
494 struct cifsFileInfo *cfile;
495 __u64 offset;
496 pid_t pid;
497 unsigned int bytes;
498 int result;
499 void (*marshal_iov) (struct kvec *iov,
500 struct cifs_writedata *wdata);
501 unsigned int nr_pages;
502 struct page *pages[1];
503};
504 490
505int cifs_async_writev(struct cifs_writedata *wdata); 491int cifs_async_writev(struct cifs_writedata *wdata);
506void cifs_writev_complete(struct work_struct *work); 492void cifs_writev_complete(struct work_struct *work);