blob: 2d88c90ded0c93b0a8b6b84329eddba3c66ce432 [file] [log] [blame]
Steve French1080ef72011-02-24 18:07:19 +00001/*
2 * SMB2 version specific operations
3 *
4 * Copyright (c) 2012, Jeff Layton <jlayton@redhat.com>
5 *
6 * This library is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License v2 as published
8 * by the Free Software Foundation.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
13 * the GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
Pavel Shilovsky3a3bab52012-09-18 16:20:28 -070020#include <linux/pagemap.h>
Steve French1080ef72011-02-24 18:07:19 +000021#include "cifsglob.h"
Pavel Shilovsky2dc7e1c2011-12-26 22:53:34 +040022#include "smb2pdu.h"
23#include "smb2proto.h"
Pavel Shilovsky28ea5292012-05-23 16:18:00 +040024#include "cifsproto.h"
25#include "cifs_debug.h"
Pavel Shilovsky2e44b282012-09-18 16:20:33 -070026#include "smb2status.h"
Pavel Shilovsky28ea5292012-05-23 16:18:00 +040027
28static int
29change_conf(struct TCP_Server_Info *server)
30{
31 server->credits += server->echo_credits + server->oplock_credits;
32 server->oplock_credits = server->echo_credits = 0;
33 switch (server->credits) {
34 case 0:
35 return -1;
36 case 1:
37 server->echoes = false;
38 server->oplocks = false;
39 cERROR(1, "disabling echoes and oplocks");
40 break;
41 case 2:
42 server->echoes = true;
43 server->oplocks = false;
44 server->echo_credits = 1;
45 cFYI(1, "disabling oplocks");
46 break;
47 default:
48 server->echoes = true;
49 server->oplocks = true;
50 server->echo_credits = 1;
51 server->oplock_credits = 1;
52 }
53 server->credits -= server->echo_credits + server->oplock_credits;
54 return 0;
55}
56
57static void
58smb2_add_credits(struct TCP_Server_Info *server, const unsigned int add,
59 const int optype)
60{
61 int *val, rc = 0;
62 spin_lock(&server->req_lock);
63 val = server->ops->get_credits_field(server, optype);
64 *val += add;
65 server->in_flight--;
Pavel Shilovskyec2e4522011-12-27 16:12:43 +040066 if (server->in_flight == 0 && (optype & CIFS_OP_MASK) != CIFS_NEG_OP)
Pavel Shilovsky28ea5292012-05-23 16:18:00 +040067 rc = change_conf(server);
68 spin_unlock(&server->req_lock);
69 wake_up(&server->request_q);
70 if (rc)
71 cifs_reconnect(server);
72}
73
74static void
75smb2_set_credits(struct TCP_Server_Info *server, const int val)
76{
77 spin_lock(&server->req_lock);
78 server->credits = val;
79 spin_unlock(&server->req_lock);
80}
81
82static int *
83smb2_get_credits_field(struct TCP_Server_Info *server, const int optype)
84{
85 switch (optype) {
86 case CIFS_ECHO_OP:
87 return &server->echo_credits;
88 case CIFS_OBREAK_OP:
89 return &server->oplock_credits;
90 default:
91 return &server->credits;
92 }
93}
94
95static unsigned int
96smb2_get_credits(struct mid_q_entry *mid)
97{
98 return le16_to_cpu(((struct smb2_hdr *)mid->resp_buf)->CreditRequest);
99}
Pavel Shilovsky2dc7e1c2011-12-26 22:53:34 +0400100
101static __u64
102smb2_get_next_mid(struct TCP_Server_Info *server)
103{
104 __u64 mid;
105 /* for SMB2 we need the current value */
106 spin_lock(&GlobalMid_Lock);
107 mid = server->CurrentMid++;
108 spin_unlock(&GlobalMid_Lock);
109 return mid;
110}
Steve French1080ef72011-02-24 18:07:19 +0000111
Pavel Shilovsky093b2bd2011-06-08 15:51:07 +0400112static struct mid_q_entry *
113smb2_find_mid(struct TCP_Server_Info *server, char *buf)
114{
115 struct mid_q_entry *mid;
116 struct smb2_hdr *hdr = (struct smb2_hdr *)buf;
117
118 spin_lock(&GlobalMid_Lock);
119 list_for_each_entry(mid, &server->pending_mid_q, qhead) {
120 if ((mid->mid == hdr->MessageId) &&
121 (mid->mid_state == MID_REQUEST_SUBMITTED) &&
122 (mid->command == hdr->Command)) {
123 spin_unlock(&GlobalMid_Lock);
124 return mid;
125 }
126 }
127 spin_unlock(&GlobalMid_Lock);
128 return NULL;
129}
130
131static void
132smb2_dump_detail(void *buf)
133{
134#ifdef CONFIG_CIFS_DEBUG2
135 struct smb2_hdr *smb = (struct smb2_hdr *)buf;
136
137 cERROR(1, "Cmd: %d Err: 0x%x Flags: 0x%x Mid: %llu Pid: %d",
138 smb->Command, smb->Status, smb->Flags, smb->MessageId,
139 smb->ProcessId);
140 cERROR(1, "smb buf %p len %u", smb, smb2_calc_size(smb));
141#endif
142}
143
Pavel Shilovskyec2e4522011-12-27 16:12:43 +0400144static bool
145smb2_need_neg(struct TCP_Server_Info *server)
146{
147 return server->max_read == 0;
148}
149
150static int
151smb2_negotiate(const unsigned int xid, struct cifs_ses *ses)
152{
153 int rc;
154 ses->server->CurrentMid = 0;
155 rc = SMB2_negotiate(xid, ses);
156 /* BB we probably don't need to retry with modern servers */
157 if (rc == -EAGAIN)
158 rc = -EHOSTDOWN;
159 return rc;
160}
161
Pavel Shilovsky3a3bab52012-09-18 16:20:28 -0700162static unsigned int
163smb2_negotiate_wsize(struct cifs_tcon *tcon, struct smb_vol *volume_info)
164{
165 struct TCP_Server_Info *server = tcon->ses->server;
166 unsigned int wsize;
167
168 /* start with specified wsize, or default */
169 wsize = volume_info->wsize ? volume_info->wsize : CIFS_DEFAULT_IOSIZE;
170 wsize = min_t(unsigned int, wsize, server->max_write);
171 /*
172 * limit write size to 2 ** 16, because we don't support multicredit
173 * requests now.
174 */
175 wsize = min_t(unsigned int, wsize, 2 << 15);
176
177 /* limit to the amount that we can kmap at once */
178 wsize = min_t(unsigned int, wsize, CIFS_KMAP_SIZE_LIMIT);
179
180 return wsize;
181}
182
183static unsigned int
184smb2_negotiate_rsize(struct cifs_tcon *tcon, struct smb_vol *volume_info)
185{
186 struct TCP_Server_Info *server = tcon->ses->server;
187 unsigned int rsize;
188
189 /* start with specified rsize, or default */
190 rsize = volume_info->rsize ? volume_info->rsize : CIFS_DEFAULT_IOSIZE;
191 rsize = min_t(unsigned int, rsize, server->max_read);
192 /*
193 * limit write size to 2 ** 16, because we don't support multicredit
194 * requests now.
195 */
196 rsize = min_t(unsigned int, rsize, 2 << 15);
197
198 /* limit to the amount that we can kmap at once */
199 rsize = min_t(unsigned int, rsize, CIFS_KMAP_SIZE_LIMIT);
200
201 return rsize;
202}
203
Pavel Shilovsky2503a0d2011-12-26 22:58:46 +0400204static int
205smb2_is_path_accessible(const unsigned int xid, struct cifs_tcon *tcon,
206 struct cifs_sb_info *cifs_sb, const char *full_path)
207{
208 int rc;
209 __u64 persistent_fid, volatile_fid;
210 __le16 *utf16_path;
Pavel Shilovsky2e44b282012-09-18 16:20:33 -0700211 __u8 oplock = SMB2_OPLOCK_LEVEL_NONE;
Pavel Shilovsky2503a0d2011-12-26 22:58:46 +0400212
213 utf16_path = cifs_convert_path_to_utf16(full_path, cifs_sb);
214 if (!utf16_path)
215 return -ENOMEM;
216
217 rc = SMB2_open(xid, tcon, utf16_path, &persistent_fid, &volatile_fid,
Pavel Shilovsky2e44b282012-09-18 16:20:33 -0700218 FILE_READ_ATTRIBUTES, FILE_OPEN, 0, 0, &oplock, NULL);
Pavel Shilovsky2503a0d2011-12-26 22:58:46 +0400219 if (rc) {
220 kfree(utf16_path);
221 return rc;
222 }
223
224 rc = SMB2_close(xid, tcon, persistent_fid, volatile_fid);
225 kfree(utf16_path);
226 return rc;
227}
228
Pavel Shilovskybe4cb9e2011-12-29 17:06:33 +0400229static int
230smb2_get_srv_inum(const unsigned int xid, struct cifs_tcon *tcon,
231 struct cifs_sb_info *cifs_sb, const char *full_path,
232 u64 *uniqueid, FILE_ALL_INFO *data)
233{
234 *uniqueid = le64_to_cpu(data->IndexNumber);
235 return 0;
236}
237
Pavel Shilovskyb7546bc2012-09-18 16:20:27 -0700238static int
239smb2_query_file_info(const unsigned int xid, struct cifs_tcon *tcon,
240 struct cifs_fid *fid, FILE_ALL_INFO *data)
241{
242 int rc;
243 struct smb2_file_all_info *smb2_data;
244
245 smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + MAX_NAME * 2,
246 GFP_KERNEL);
247 if (smb2_data == NULL)
248 return -ENOMEM;
249
250 rc = SMB2_query_info(xid, tcon, fid->persistent_fid, fid->volatile_fid,
251 smb2_data);
252 if (!rc)
253 move_smb2_info_to_cifs(data, smb2_data);
254 kfree(smb2_data);
255 return rc;
256}
257
Pavel Shilovsky25e26632012-05-27 20:44:23 +0400258static char *
259smb2_build_path_to_root(struct smb_vol *vol, struct cifs_sb_info *cifs_sb,
260 struct cifs_tcon *tcon)
261{
262 int pplen = vol->prepath ? strlen(vol->prepath) : 0;
263 char *full_path = NULL;
264
265 /* if no prefix path, simply set path to the root of share to "" */
266 if (pplen == 0) {
267 full_path = kzalloc(2, GFP_KERNEL);
268 return full_path;
269 }
270
271 cERROR(1, "prefixpath is not supported for SMB2 now");
272 return NULL;
273}
274
Pavel Shilovsky9094fad2012-07-12 18:30:44 +0400275static bool
276smb2_can_echo(struct TCP_Server_Info *server)
277{
278 return server->echoes;
279}
280
Pavel Shilovskyd60622e2012-05-28 15:19:39 +0400281static void
282smb2_clear_stats(struct cifs_tcon *tcon)
283{
284#ifdef CONFIG_CIFS_STATS
285 int i;
286 for (i = 0; i < NUMBER_OF_SMB2_COMMANDS; i++) {
287 atomic_set(&tcon->stats.smb2_stats.smb2_com_sent[i], 0);
288 atomic_set(&tcon->stats.smb2_stats.smb2_com_failed[i], 0);
289 }
290#endif
291}
292
293static void
294smb2_print_stats(struct seq_file *m, struct cifs_tcon *tcon)
295{
296#ifdef CONFIG_CIFS_STATS
297 atomic_t *sent = tcon->stats.smb2_stats.smb2_com_sent;
298 atomic_t *failed = tcon->stats.smb2_stats.smb2_com_failed;
299 seq_printf(m, "\nNegotiates: %d sent %d failed",
300 atomic_read(&sent[SMB2_NEGOTIATE_HE]),
301 atomic_read(&failed[SMB2_NEGOTIATE_HE]));
302 seq_printf(m, "\nSessionSetups: %d sent %d failed",
303 atomic_read(&sent[SMB2_SESSION_SETUP_HE]),
304 atomic_read(&failed[SMB2_SESSION_SETUP_HE]));
305#define SMB2LOGOFF 0x0002 /* trivial request/resp */
306 seq_printf(m, "\nLogoffs: %d sent %d failed",
307 atomic_read(&sent[SMB2_LOGOFF_HE]),
308 atomic_read(&failed[SMB2_LOGOFF_HE]));
309 seq_printf(m, "\nTreeConnects: %d sent %d failed",
310 atomic_read(&sent[SMB2_TREE_CONNECT_HE]),
311 atomic_read(&failed[SMB2_TREE_CONNECT_HE]));
312 seq_printf(m, "\nTreeDisconnects: %d sent %d failed",
313 atomic_read(&sent[SMB2_TREE_DISCONNECT_HE]),
314 atomic_read(&failed[SMB2_TREE_DISCONNECT_HE]));
315 seq_printf(m, "\nCreates: %d sent %d failed",
316 atomic_read(&sent[SMB2_CREATE_HE]),
317 atomic_read(&failed[SMB2_CREATE_HE]));
318 seq_printf(m, "\nCloses: %d sent %d failed",
319 atomic_read(&sent[SMB2_CLOSE_HE]),
320 atomic_read(&failed[SMB2_CLOSE_HE]));
321 seq_printf(m, "\nFlushes: %d sent %d failed",
322 atomic_read(&sent[SMB2_FLUSH_HE]),
323 atomic_read(&failed[SMB2_FLUSH_HE]));
324 seq_printf(m, "\nReads: %d sent %d failed",
325 atomic_read(&sent[SMB2_READ_HE]),
326 atomic_read(&failed[SMB2_READ_HE]));
327 seq_printf(m, "\nWrites: %d sent %d failed",
328 atomic_read(&sent[SMB2_WRITE_HE]),
329 atomic_read(&failed[SMB2_WRITE_HE]));
330 seq_printf(m, "\nLocks: %d sent %d failed",
331 atomic_read(&sent[SMB2_LOCK_HE]),
332 atomic_read(&failed[SMB2_LOCK_HE]));
333 seq_printf(m, "\nIOCTLs: %d sent %d failed",
334 atomic_read(&sent[SMB2_IOCTL_HE]),
335 atomic_read(&failed[SMB2_IOCTL_HE]));
336 seq_printf(m, "\nCancels: %d sent %d failed",
337 atomic_read(&sent[SMB2_CANCEL_HE]),
338 atomic_read(&failed[SMB2_CANCEL_HE]));
339 seq_printf(m, "\nEchos: %d sent %d failed",
340 atomic_read(&sent[SMB2_ECHO_HE]),
341 atomic_read(&failed[SMB2_ECHO_HE]));
342 seq_printf(m, "\nQueryDirectories: %d sent %d failed",
343 atomic_read(&sent[SMB2_QUERY_DIRECTORY_HE]),
344 atomic_read(&failed[SMB2_QUERY_DIRECTORY_HE]));
345 seq_printf(m, "\nChangeNotifies: %d sent %d failed",
346 atomic_read(&sent[SMB2_CHANGE_NOTIFY_HE]),
347 atomic_read(&failed[SMB2_CHANGE_NOTIFY_HE]));
348 seq_printf(m, "\nQueryInfos: %d sent %d failed",
349 atomic_read(&sent[SMB2_QUERY_INFO_HE]),
350 atomic_read(&failed[SMB2_QUERY_INFO_HE]));
351 seq_printf(m, "\nSetInfos: %d sent %d failed",
352 atomic_read(&sent[SMB2_SET_INFO_HE]),
353 atomic_read(&failed[SMB2_SET_INFO_HE]));
354 seq_printf(m, "\nOplockBreaks: %d sent %d failed",
355 atomic_read(&sent[SMB2_OPLOCK_BREAK_HE]),
356 atomic_read(&failed[SMB2_OPLOCK_BREAK_HE]));
357#endif
358}
359
Pavel Shilovskyf0df7372012-09-18 16:20:26 -0700360static void
361smb2_set_fid(struct cifsFileInfo *cfile, struct cifs_fid *fid, __u32 oplock)
362{
Pavel Shilovsky2e44b282012-09-18 16:20:33 -0700363 struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode);
Pavel Shilovskyf0df7372012-09-18 16:20:26 -0700364 cfile->fid.persistent_fid = fid->persistent_fid;
365 cfile->fid.volatile_fid = fid->volatile_fid;
Pavel Shilovsky2e44b282012-09-18 16:20:33 -0700366 smb2_set_oplock_level(cinode, oplock);
Pavel Shilovskyf0df7372012-09-18 16:20:26 -0700367 /* cinode->can_cache_brlcks = cinode->clientCanCacheAll; */
368}
369
370static int
371smb2_close_file(const unsigned int xid, struct cifs_tcon *tcon,
372 struct cifs_fid *fid)
373{
374 return SMB2_close(xid, tcon, fid->persistent_fid, fid->volatile_fid);
375}
376
Pavel Shilovsky7a5cfb12012-09-18 16:20:28 -0700377static int
378smb2_flush_file(const unsigned int xid, struct cifs_tcon *tcon,
379 struct cifs_fid *fid)
380{
381 return SMB2_flush(xid, tcon, fid->persistent_fid, fid->volatile_fid);
382}
383
Pavel Shilovsky09a47072012-09-18 16:20:29 -0700384static unsigned int
385smb2_read_data_offset(char *buf)
386{
387 struct smb2_read_rsp *rsp = (struct smb2_read_rsp *)buf;
388 return rsp->DataOffset;
389}
390
391static unsigned int
392smb2_read_data_length(char *buf)
393{
394 struct smb2_read_rsp *rsp = (struct smb2_read_rsp *)buf;
395 return le32_to_cpu(rsp->DataLength);
396}
397
Pavel Shilovskyd8e05032012-09-18 16:20:30 -0700398
399static int
400smb2_sync_read(const unsigned int xid, struct cifsFileInfo *cfile,
401 struct cifs_io_parms *parms, unsigned int *bytes_read,
402 char **buf, int *buf_type)
403{
404 parms->persistent_fid = cfile->fid.persistent_fid;
405 parms->volatile_fid = cfile->fid.volatile_fid;
406 return SMB2_read(xid, parms, bytes_read, buf, buf_type);
407}
408
Pavel Shilovsky009d3442012-09-18 16:20:30 -0700409static int
410smb2_sync_write(const unsigned int xid, struct cifsFileInfo *cfile,
411 struct cifs_io_parms *parms, unsigned int *written,
412 struct kvec *iov, unsigned long nr_segs)
413{
414
415 parms->persistent_fid = cfile->fid.persistent_fid;
416 parms->volatile_fid = cfile->fid.volatile_fid;
417 return SMB2_write(xid, parms, written, iov, nr_segs);
418}
419
Pavel Shilovskyc839ff22012-09-18 16:20:32 -0700420static int
421smb2_set_file_size(const unsigned int xid, struct cifs_tcon *tcon,
422 struct cifsFileInfo *cfile, __u64 size, bool set_alloc)
423{
424 __le64 eof = cpu_to_le64(size);
425 return SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid,
426 cfile->fid.volatile_fid, cfile->pid, &eof);
427}
428
Pavel Shilovskyd324f08d2012-09-18 16:20:33 -0700429static int
430smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon,
431 const char *path, struct cifs_sb_info *cifs_sb,
432 struct cifs_fid *fid, __u16 search_flags,
433 struct cifs_search_info *srch_inf)
434{
435 __le16 *utf16_path;
436 int rc;
Pavel Shilovsky2e44b282012-09-18 16:20:33 -0700437 __u8 oplock = SMB2_OPLOCK_LEVEL_NONE;
Pavel Shilovskyd324f08d2012-09-18 16:20:33 -0700438 __u64 persistent_fid, volatile_fid;
439
440 utf16_path = cifs_convert_path_to_utf16(path, cifs_sb);
441 if (!utf16_path)
442 return -ENOMEM;
443
444 rc = SMB2_open(xid, tcon, utf16_path, &persistent_fid, &volatile_fid,
445 FILE_READ_ATTRIBUTES | FILE_READ_DATA, FILE_OPEN, 0, 0,
Pavel Shilovsky2e44b282012-09-18 16:20:33 -0700446 &oplock, NULL);
Pavel Shilovskyd324f08d2012-09-18 16:20:33 -0700447 kfree(utf16_path);
448 if (rc) {
449 cERROR(1, "open dir failed");
450 return rc;
451 }
452
453 srch_inf->entries_in_buffer = 0;
454 srch_inf->index_of_last_entry = 0;
455 fid->persistent_fid = persistent_fid;
456 fid->volatile_fid = volatile_fid;
457
458 rc = SMB2_query_directory(xid, tcon, persistent_fid, volatile_fid, 0,
459 srch_inf);
460 if (rc) {
461 cERROR(1, "query directory failed");
462 SMB2_close(xid, tcon, persistent_fid, volatile_fid);
463 }
464 return rc;
465}
466
467static int
468smb2_query_dir_next(const unsigned int xid, struct cifs_tcon *tcon,
469 struct cifs_fid *fid, __u16 search_flags,
470 struct cifs_search_info *srch_inf)
471{
472 return SMB2_query_directory(xid, tcon, fid->persistent_fid,
473 fid->volatile_fid, 0, srch_inf);
474}
475
476static int
477smb2_close_dir(const unsigned int xid, struct cifs_tcon *tcon,
478 struct cifs_fid *fid)
479{
480 return SMB2_close(xid, tcon, fid->persistent_fid, fid->volatile_fid);
481}
482
Pavel Shilovsky2e44b282012-09-18 16:20:33 -0700483/*
484* If we negotiate SMB2 protocol and get STATUS_PENDING - update
485* the number of credits and return true. Otherwise - return false.
486*/
487static bool
488smb2_is_status_pending(char *buf, struct TCP_Server_Info *server, int length)
489{
490 struct smb2_hdr *hdr = (struct smb2_hdr *)buf;
491
492 if (le32_to_cpu(hdr->Status) != STATUS_PENDING)
493 return false;
494
495 if (!length) {
496 spin_lock(&server->req_lock);
497 server->credits += le16_to_cpu(hdr->CreditRequest);
498 spin_unlock(&server->req_lock);
499 wake_up(&server->request_q);
500 }
501
502 return true;
503}
504
Steve French1080ef72011-02-24 18:07:19 +0000505struct smb_version_operations smb21_operations = {
Pavel Shilovsky2dc7e1c2011-12-26 22:53:34 +0400506 .setup_request = smb2_setup_request,
Pavel Shilovskyc95b8ee2012-07-11 14:45:28 +0400507 .setup_async_request = smb2_setup_async_request,
Pavel Shilovsky2dc7e1c2011-12-26 22:53:34 +0400508 .check_receive = smb2_check_receive,
Pavel Shilovsky28ea5292012-05-23 16:18:00 +0400509 .add_credits = smb2_add_credits,
510 .set_credits = smb2_set_credits,
511 .get_credits_field = smb2_get_credits_field,
512 .get_credits = smb2_get_credits,
Pavel Shilovsky2dc7e1c2011-12-26 22:53:34 +0400513 .get_next_mid = smb2_get_next_mid,
Pavel Shilovsky09a47072012-09-18 16:20:29 -0700514 .read_data_offset = smb2_read_data_offset,
515 .read_data_length = smb2_read_data_length,
516 .map_error = map_smb2_to_linux_error,
Pavel Shilovsky093b2bd2011-06-08 15:51:07 +0400517 .find_mid = smb2_find_mid,
518 .check_message = smb2_check_message,
519 .dump_detail = smb2_dump_detail,
Pavel Shilovskyd60622e2012-05-28 15:19:39 +0400520 .clear_stats = smb2_clear_stats,
521 .print_stats = smb2_print_stats,
Pavel Shilovskyec2e4522011-12-27 16:12:43 +0400522 .need_neg = smb2_need_neg,
523 .negotiate = smb2_negotiate,
Pavel Shilovsky3a3bab52012-09-18 16:20:28 -0700524 .negotiate_wsize = smb2_negotiate_wsize,
525 .negotiate_rsize = smb2_negotiate_rsize,
Pavel Shilovsky5478f9b2011-12-27 16:22:00 +0400526 .sess_setup = SMB2_sess_setup,
527 .logoff = SMB2_logoff,
Pavel Shilovskyfaaf9462011-12-27 16:04:00 +0400528 .tree_connect = SMB2_tcon,
529 .tree_disconnect = SMB2_tdis,
Pavel Shilovsky2503a0d2011-12-26 22:58:46 +0400530 .is_path_accessible = smb2_is_path_accessible,
Pavel Shilovsky9094fad2012-07-12 18:30:44 +0400531 .can_echo = smb2_can_echo,
532 .echo = SMB2_echo,
Pavel Shilovskybe4cb9e2011-12-29 17:06:33 +0400533 .query_path_info = smb2_query_path_info,
534 .get_srv_inum = smb2_get_srv_inum,
Pavel Shilovskyb7546bc2012-09-18 16:20:27 -0700535 .query_file_info = smb2_query_file_info,
Pavel Shilovskyc839ff22012-09-18 16:20:32 -0700536 .set_path_size = smb2_set_path_size,
537 .set_file_size = smb2_set_file_size,
Pavel Shilovsky1feeaac2012-09-18 16:20:32 -0700538 .set_file_info = smb2_set_file_info,
Pavel Shilovsky25e26632012-05-27 20:44:23 +0400539 .build_path_to_root = smb2_build_path_to_root,
Pavel Shilovskya0e73182011-07-19 12:56:37 +0400540 .mkdir = smb2_mkdir,
541 .mkdir_setinfo = smb2_mkdir_setinfo,
Pavel Shilovsky1a500f02012-07-10 16:14:38 +0400542 .rmdir = smb2_rmdir,
Pavel Shilovskycbe6f432012-09-18 16:20:25 -0700543 .unlink = smb2_unlink,
Pavel Shilovsky35143eb2012-09-18 16:20:31 -0700544 .rename = smb2_rename_path,
Pavel Shilovsky568798c2012-09-18 16:20:31 -0700545 .create_hardlink = smb2_create_hardlink,
Pavel Shilovskyf0df7372012-09-18 16:20:26 -0700546 .open = smb2_open_file,
547 .set_fid = smb2_set_fid,
548 .close = smb2_close_file,
Pavel Shilovsky7a5cfb12012-09-18 16:20:28 -0700549 .flush = smb2_flush_file,
Pavel Shilovsky09a47072012-09-18 16:20:29 -0700550 .async_readv = smb2_async_readv,
Pavel Shilovsky33319142012-09-18 16:20:29 -0700551 .async_writev = smb2_async_writev,
Pavel Shilovskyd8e05032012-09-18 16:20:30 -0700552 .sync_read = smb2_sync_read,
Pavel Shilovsky009d3442012-09-18 16:20:30 -0700553 .sync_write = smb2_sync_write,
Pavel Shilovskyd324f08d2012-09-18 16:20:33 -0700554 .query_dir_first = smb2_query_dir_first,
555 .query_dir_next = smb2_query_dir_next,
556 .close_dir = smb2_close_dir,
557 .calc_smb_size = smb2_calc_size,
Pavel Shilovsky2e44b282012-09-18 16:20:33 -0700558 .is_status_pending = smb2_is_status_pending,
Steve French1080ef72011-02-24 18:07:19 +0000559};
560
561struct smb_version_values smb21_values = {
562 .version_string = SMB21_VERSION_STRING,
Pavel Shilovsky093b2bd2011-06-08 15:51:07 +0400563 .header_size = sizeof(struct smb2_hdr),
564 .max_header_size = MAX_SMB2_HDR_SIZE,
Pavel Shilovsky09a47072012-09-18 16:20:29 -0700565 .read_rsp_size = sizeof(struct smb2_read_rsp) - 1,
Pavel Shilovsky2dc7e1c2011-12-26 22:53:34 +0400566 .lock_cmd = SMB2_LOCK,
Pavel Shilovsky29e20f92012-07-13 13:58:14 +0400567 .cap_unix = 0,
568 .cap_nt_find = SMB2_NT_FIND,
569 .cap_large_files = SMB2_LARGE_FILES,
Steve French1080ef72011-02-24 18:07:19 +0000570};