2 * SMB2 version specific operations
4 * Copyright (c) 2012, Jeff Layton <jlayton@redhat.com>
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.
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.
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
20 #include <linux/pagemap.h>
21 #include <linux/vfs.h>
24 #include "smb2proto.h"
25 #include "cifsproto.h"
26 #include "cifs_debug.h"
27 #include "smb2status.h"
31 change_conf(struct TCP_Server_Info *server)
33 server->credits += server->echo_credits + server->oplock_credits;
34 server->oplock_credits = server->echo_credits = 0;
35 switch (server->credits) {
39 server->echoes = false;
40 server->oplocks = false;
41 cifs_dbg(VFS, "disabling echoes and oplocks\n");
44 server->echoes = true;
45 server->oplocks = false;
46 server->echo_credits = 1;
47 cifs_dbg(FYI, "disabling oplocks\n");
50 server->echoes = true;
51 server->oplocks = true;
52 server->echo_credits = 1;
53 server->oplock_credits = 1;
55 server->credits -= server->echo_credits + server->oplock_credits;
60 smb2_add_credits(struct TCP_Server_Info *server, const unsigned int add,
64 spin_lock(&server->req_lock);
65 val = server->ops->get_credits_field(server, optype);
68 if (server->in_flight == 0 && (optype & CIFS_OP_MASK) != CIFS_NEG_OP)
69 rc = change_conf(server);
71 * Sometimes server returns 0 credits on oplock break ack - we need to
72 * rebalance credits in this case.
74 else if (server->in_flight > 0 && server->oplock_credits == 0 &&
76 if (server->credits > 1) {
78 server->oplock_credits++;
81 spin_unlock(&server->req_lock);
82 wake_up(&server->request_q);
84 cifs_reconnect(server);
88 smb2_set_credits(struct TCP_Server_Info *server, const int val)
90 spin_lock(&server->req_lock);
91 server->credits = val;
92 spin_unlock(&server->req_lock);
96 smb2_get_credits_field(struct TCP_Server_Info *server, const int optype)
100 return &server->echo_credits;
102 return &server->oplock_credits;
104 return &server->credits;
109 smb2_get_credits(struct mid_q_entry *mid)
111 return le16_to_cpu(((struct smb2_hdr *)mid->resp_buf)->CreditRequest);
115 smb2_get_next_mid(struct TCP_Server_Info *server)
118 /* for SMB2 we need the current value */
119 spin_lock(&GlobalMid_Lock);
120 mid = server->CurrentMid++;
121 spin_unlock(&GlobalMid_Lock);
125 static struct mid_q_entry *
126 smb2_find_mid(struct TCP_Server_Info *server, char *buf)
128 struct mid_q_entry *mid;
129 struct smb2_hdr *hdr = (struct smb2_hdr *)buf;
131 spin_lock(&GlobalMid_Lock);
132 list_for_each_entry(mid, &server->pending_mid_q, qhead) {
133 if ((mid->mid == hdr->MessageId) &&
134 (mid->mid_state == MID_REQUEST_SUBMITTED) &&
135 (mid->command == hdr->Command)) {
136 spin_unlock(&GlobalMid_Lock);
140 spin_unlock(&GlobalMid_Lock);
145 smb2_dump_detail(void *buf)
147 #ifdef CONFIG_CIFS_DEBUG2
148 struct smb2_hdr *smb = (struct smb2_hdr *)buf;
150 cifs_dbg(VFS, "Cmd: %d Err: 0x%x Flags: 0x%x Mid: %llu Pid: %d\n",
151 smb->Command, smb->Status, smb->Flags, smb->MessageId,
153 cifs_dbg(VFS, "smb buf %p len %u\n", smb, smb2_calc_size(smb));
158 smb2_need_neg(struct TCP_Server_Info *server)
160 return server->max_read == 0;
164 smb2_negotiate(const unsigned int xid, struct cifs_ses *ses)
167 ses->server->CurrentMid = 0;
168 rc = SMB2_negotiate(xid, ses);
169 /* BB we probably don't need to retry with modern servers */
176 smb2_negotiate_wsize(struct cifs_tcon *tcon, struct smb_vol *volume_info)
178 struct TCP_Server_Info *server = tcon->ses->server;
181 /* start with specified wsize, or default */
182 wsize = volume_info->wsize ? volume_info->wsize : CIFS_DEFAULT_IOSIZE;
183 wsize = min_t(unsigned int, wsize, server->max_write);
185 * limit write size to 2 ** 16, because we don't support multicredit
188 wsize = min_t(unsigned int, wsize, 2 << 15);
194 smb2_negotiate_rsize(struct cifs_tcon *tcon, struct smb_vol *volume_info)
196 struct TCP_Server_Info *server = tcon->ses->server;
199 /* start with specified rsize, or default */
200 rsize = volume_info->rsize ? volume_info->rsize : CIFS_DEFAULT_IOSIZE;
201 rsize = min_t(unsigned int, rsize, server->max_read);
203 * limit write size to 2 ** 16, because we don't support multicredit
206 rsize = min_t(unsigned int, rsize, 2 << 15);
212 smb2_is_path_accessible(const unsigned int xid, struct cifs_tcon *tcon,
213 struct cifs_sb_info *cifs_sb, const char *full_path)
216 __u64 persistent_fid, volatile_fid;
218 __u8 oplock = SMB2_OPLOCK_LEVEL_NONE;
220 utf16_path = cifs_convert_path_to_utf16(full_path, cifs_sb);
224 rc = SMB2_open(xid, tcon, utf16_path, &persistent_fid, &volatile_fid,
225 FILE_READ_ATTRIBUTES, FILE_OPEN, 0, 0, &oplock, NULL);
231 rc = SMB2_close(xid, tcon, persistent_fid, volatile_fid);
237 smb2_get_srv_inum(const unsigned int xid, struct cifs_tcon *tcon,
238 struct cifs_sb_info *cifs_sb, const char *full_path,
239 u64 *uniqueid, FILE_ALL_INFO *data)
241 *uniqueid = le64_to_cpu(data->IndexNumber);
246 smb2_query_file_info(const unsigned int xid, struct cifs_tcon *tcon,
247 struct cifs_fid *fid, FILE_ALL_INFO *data)
250 struct smb2_file_all_info *smb2_data;
252 smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + MAX_NAME * 2,
254 if (smb2_data == NULL)
257 rc = SMB2_query_info(xid, tcon, fid->persistent_fid, fid->volatile_fid,
260 move_smb2_info_to_cifs(data, smb2_data);
266 smb2_can_echo(struct TCP_Server_Info *server)
268 return server->echoes;
272 smb2_clear_stats(struct cifs_tcon *tcon)
274 #ifdef CONFIG_CIFS_STATS
276 for (i = 0; i < NUMBER_OF_SMB2_COMMANDS; i++) {
277 atomic_set(&tcon->stats.smb2_stats.smb2_com_sent[i], 0);
278 atomic_set(&tcon->stats.smb2_stats.smb2_com_failed[i], 0);
284 smb2_dump_share_caps(struct seq_file *m, struct cifs_tcon *tcon)
286 seq_puts(m, "\n\tShare Capabilities:");
287 if (tcon->capabilities & SMB2_SHARE_CAP_DFS)
288 seq_puts(m, " DFS,");
289 if (tcon->capabilities & SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY)
290 seq_puts(m, " CONTINUOUS AVAILABILITY,");
291 if (tcon->capabilities & SMB2_SHARE_CAP_SCALEOUT)
292 seq_puts(m, " SCALEOUT,");
293 if (tcon->capabilities & SMB2_SHARE_CAP_CLUSTER)
294 seq_puts(m, " CLUSTER,");
295 if (tcon->capabilities & SMB2_SHARE_CAP_ASYMMETRIC)
296 seq_puts(m, " ASYMMETRIC,");
297 if (tcon->capabilities == 0)
298 seq_puts(m, " None");
299 seq_printf(m, "\tShare Flags: 0x%x", tcon->share_flags);
303 smb2_print_stats(struct seq_file *m, struct cifs_tcon *tcon)
305 #ifdef CONFIG_CIFS_STATS
306 atomic_t *sent = tcon->stats.smb2_stats.smb2_com_sent;
307 atomic_t *failed = tcon->stats.smb2_stats.smb2_com_failed;
308 seq_printf(m, "\nNegotiates: %d sent %d failed",
309 atomic_read(&sent[SMB2_NEGOTIATE_HE]),
310 atomic_read(&failed[SMB2_NEGOTIATE_HE]));
311 seq_printf(m, "\nSessionSetups: %d sent %d failed",
312 atomic_read(&sent[SMB2_SESSION_SETUP_HE]),
313 atomic_read(&failed[SMB2_SESSION_SETUP_HE]));
314 #define SMB2LOGOFF 0x0002 /* trivial request/resp */
315 seq_printf(m, "\nLogoffs: %d sent %d failed",
316 atomic_read(&sent[SMB2_LOGOFF_HE]),
317 atomic_read(&failed[SMB2_LOGOFF_HE]));
318 seq_printf(m, "\nTreeConnects: %d sent %d failed",
319 atomic_read(&sent[SMB2_TREE_CONNECT_HE]),
320 atomic_read(&failed[SMB2_TREE_CONNECT_HE]));
321 seq_printf(m, "\nTreeDisconnects: %d sent %d failed",
322 atomic_read(&sent[SMB2_TREE_DISCONNECT_HE]),
323 atomic_read(&failed[SMB2_TREE_DISCONNECT_HE]));
324 seq_printf(m, "\nCreates: %d sent %d failed",
325 atomic_read(&sent[SMB2_CREATE_HE]),
326 atomic_read(&failed[SMB2_CREATE_HE]));
327 seq_printf(m, "\nCloses: %d sent %d failed",
328 atomic_read(&sent[SMB2_CLOSE_HE]),
329 atomic_read(&failed[SMB2_CLOSE_HE]));
330 seq_printf(m, "\nFlushes: %d sent %d failed",
331 atomic_read(&sent[SMB2_FLUSH_HE]),
332 atomic_read(&failed[SMB2_FLUSH_HE]));
333 seq_printf(m, "\nReads: %d sent %d failed",
334 atomic_read(&sent[SMB2_READ_HE]),
335 atomic_read(&failed[SMB2_READ_HE]));
336 seq_printf(m, "\nWrites: %d sent %d failed",
337 atomic_read(&sent[SMB2_WRITE_HE]),
338 atomic_read(&failed[SMB2_WRITE_HE]));
339 seq_printf(m, "\nLocks: %d sent %d failed",
340 atomic_read(&sent[SMB2_LOCK_HE]),
341 atomic_read(&failed[SMB2_LOCK_HE]));
342 seq_printf(m, "\nIOCTLs: %d sent %d failed",
343 atomic_read(&sent[SMB2_IOCTL_HE]),
344 atomic_read(&failed[SMB2_IOCTL_HE]));
345 seq_printf(m, "\nCancels: %d sent %d failed",
346 atomic_read(&sent[SMB2_CANCEL_HE]),
347 atomic_read(&failed[SMB2_CANCEL_HE]));
348 seq_printf(m, "\nEchos: %d sent %d failed",
349 atomic_read(&sent[SMB2_ECHO_HE]),
350 atomic_read(&failed[SMB2_ECHO_HE]));
351 seq_printf(m, "\nQueryDirectories: %d sent %d failed",
352 atomic_read(&sent[SMB2_QUERY_DIRECTORY_HE]),
353 atomic_read(&failed[SMB2_QUERY_DIRECTORY_HE]));
354 seq_printf(m, "\nChangeNotifies: %d sent %d failed",
355 atomic_read(&sent[SMB2_CHANGE_NOTIFY_HE]),
356 atomic_read(&failed[SMB2_CHANGE_NOTIFY_HE]));
357 seq_printf(m, "\nQueryInfos: %d sent %d failed",
358 atomic_read(&sent[SMB2_QUERY_INFO_HE]),
359 atomic_read(&failed[SMB2_QUERY_INFO_HE]));
360 seq_printf(m, "\nSetInfos: %d sent %d failed",
361 atomic_read(&sent[SMB2_SET_INFO_HE]),
362 atomic_read(&failed[SMB2_SET_INFO_HE]));
363 seq_printf(m, "\nOplockBreaks: %d sent %d failed",
364 atomic_read(&sent[SMB2_OPLOCK_BREAK_HE]),
365 atomic_read(&failed[SMB2_OPLOCK_BREAK_HE]));
370 smb2_set_fid(struct cifsFileInfo *cfile, struct cifs_fid *fid, __u32 oplock)
372 struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode);
373 cfile->fid.persistent_fid = fid->persistent_fid;
374 cfile->fid.volatile_fid = fid->volatile_fid;
375 smb2_set_oplock_level(cinode, oplock);
376 cinode->can_cache_brlcks = cinode->clientCanCacheAll;
380 smb2_close_file(const unsigned int xid, struct cifs_tcon *tcon,
381 struct cifs_fid *fid)
383 SMB2_close(xid, tcon, fid->persistent_fid, fid->volatile_fid);
387 smb2_flush_file(const unsigned int xid, struct cifs_tcon *tcon,
388 struct cifs_fid *fid)
390 return SMB2_flush(xid, tcon, fid->persistent_fid, fid->volatile_fid);
394 smb2_read_data_offset(char *buf)
396 struct smb2_read_rsp *rsp = (struct smb2_read_rsp *)buf;
397 return rsp->DataOffset;
401 smb2_read_data_length(char *buf)
403 struct smb2_read_rsp *rsp = (struct smb2_read_rsp *)buf;
404 return le32_to_cpu(rsp->DataLength);
409 smb2_sync_read(const unsigned int xid, struct cifsFileInfo *cfile,
410 struct cifs_io_parms *parms, unsigned int *bytes_read,
411 char **buf, int *buf_type)
413 parms->persistent_fid = cfile->fid.persistent_fid;
414 parms->volatile_fid = cfile->fid.volatile_fid;
415 return SMB2_read(xid, parms, bytes_read, buf, buf_type);
419 smb2_sync_write(const unsigned int xid, struct cifsFileInfo *cfile,
420 struct cifs_io_parms *parms, unsigned int *written,
421 struct kvec *iov, unsigned long nr_segs)
424 parms->persistent_fid = cfile->fid.persistent_fid;
425 parms->volatile_fid = cfile->fid.volatile_fid;
426 return SMB2_write(xid, parms, written, iov, nr_segs);
430 smb2_set_file_size(const unsigned int xid, struct cifs_tcon *tcon,
431 struct cifsFileInfo *cfile, __u64 size, bool set_alloc)
433 __le64 eof = cpu_to_le64(size);
434 return SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid,
435 cfile->fid.volatile_fid, cfile->pid, &eof);
439 smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon,
440 const char *path, struct cifs_sb_info *cifs_sb,
441 struct cifs_fid *fid, __u16 search_flags,
442 struct cifs_search_info *srch_inf)
446 __u8 oplock = SMB2_OPLOCK_LEVEL_NONE;
447 __u64 persistent_fid, volatile_fid;
449 utf16_path = cifs_convert_path_to_utf16(path, cifs_sb);
453 rc = SMB2_open(xid, tcon, utf16_path, &persistent_fid, &volatile_fid,
454 FILE_READ_ATTRIBUTES | FILE_READ_DATA, FILE_OPEN, 0, 0,
458 cifs_dbg(VFS, "open dir failed\n");
462 srch_inf->entries_in_buffer = 0;
463 srch_inf->index_of_last_entry = 0;
464 fid->persistent_fid = persistent_fid;
465 fid->volatile_fid = volatile_fid;
467 rc = SMB2_query_directory(xid, tcon, persistent_fid, volatile_fid, 0,
470 cifs_dbg(VFS, "query directory failed\n");
471 SMB2_close(xid, tcon, persistent_fid, volatile_fid);
477 smb2_query_dir_next(const unsigned int xid, struct cifs_tcon *tcon,
478 struct cifs_fid *fid, __u16 search_flags,
479 struct cifs_search_info *srch_inf)
481 return SMB2_query_directory(xid, tcon, fid->persistent_fid,
482 fid->volatile_fid, 0, srch_inf);
486 smb2_close_dir(const unsigned int xid, struct cifs_tcon *tcon,
487 struct cifs_fid *fid)
489 return SMB2_close(xid, tcon, fid->persistent_fid, fid->volatile_fid);
493 * If we negotiate SMB2 protocol and get STATUS_PENDING - update
494 * the number of credits and return true. Otherwise - return false.
497 smb2_is_status_pending(char *buf, struct TCP_Server_Info *server, int length)
499 struct smb2_hdr *hdr = (struct smb2_hdr *)buf;
501 if (hdr->Status != STATUS_PENDING)
505 spin_lock(&server->req_lock);
506 server->credits += le16_to_cpu(hdr->CreditRequest);
507 spin_unlock(&server->req_lock);
508 wake_up(&server->request_q);
515 smb2_oplock_response(struct cifs_tcon *tcon, struct cifs_fid *fid,
516 struct cifsInodeInfo *cinode)
518 if (tcon->ses->server->capabilities & SMB2_GLOBAL_CAP_LEASING)
519 return SMB2_lease_break(0, tcon, cinode->lease_key,
520 smb2_get_lease_state(cinode));
522 return SMB2_oplock_break(0, tcon, fid->persistent_fid,
524 cinode->clientCanCacheRead ? 1 : 0);
528 smb2_queryfs(const unsigned int xid, struct cifs_tcon *tcon,
532 u64 persistent_fid, volatile_fid;
533 __le16 srch_path = 0; /* Null - open root of share */
534 u8 oplock = SMB2_OPLOCK_LEVEL_NONE;
536 rc = SMB2_open(xid, tcon, &srch_path, &persistent_fid, &volatile_fid,
537 FILE_READ_ATTRIBUTES, FILE_OPEN, 0, 0, &oplock, NULL);
540 buf->f_type = SMB2_MAGIC_NUMBER;
541 rc = SMB2_QFS_info(xid, tcon, persistent_fid, volatile_fid, buf);
542 SMB2_close(xid, tcon, persistent_fid, volatile_fid);
547 smb2_compare_fids(struct cifsFileInfo *ob1, struct cifsFileInfo *ob2)
549 return ob1->fid.persistent_fid == ob2->fid.persistent_fid &&
550 ob1->fid.volatile_fid == ob2->fid.volatile_fid;
554 smb2_mand_lock(const unsigned int xid, struct cifsFileInfo *cfile, __u64 offset,
555 __u64 length, __u32 type, int lock, int unlock, bool wait)
558 type = SMB2_LOCKFLAG_UNLOCK;
559 return SMB2_lock(xid, tlink_tcon(cfile->tlink),
560 cfile->fid.persistent_fid, cfile->fid.volatile_fid,
561 current->tgid, length, offset, type, wait);
565 smb2_get_lease_key(struct inode *inode, struct cifs_fid *fid)
567 memcpy(fid->lease_key, CIFS_I(inode)->lease_key, SMB2_LEASE_KEY_SIZE);
571 smb2_set_lease_key(struct inode *inode, struct cifs_fid *fid)
573 memcpy(CIFS_I(inode)->lease_key, fid->lease_key, SMB2_LEASE_KEY_SIZE);
577 smb2_new_lease_key(struct cifs_fid *fid)
579 get_random_bytes(fid->lease_key, SMB2_LEASE_KEY_SIZE);
582 struct smb_version_operations smb21_operations = {
583 .compare_fids = smb2_compare_fids,
584 .setup_request = smb2_setup_request,
585 .setup_async_request = smb2_setup_async_request,
586 .check_receive = smb2_check_receive,
587 .add_credits = smb2_add_credits,
588 .set_credits = smb2_set_credits,
589 .get_credits_field = smb2_get_credits_field,
590 .get_credits = smb2_get_credits,
591 .get_next_mid = smb2_get_next_mid,
592 .read_data_offset = smb2_read_data_offset,
593 .read_data_length = smb2_read_data_length,
594 .map_error = map_smb2_to_linux_error,
595 .find_mid = smb2_find_mid,
596 .check_message = smb2_check_message,
597 .dump_detail = smb2_dump_detail,
598 .clear_stats = smb2_clear_stats,
599 .print_stats = smb2_print_stats,
600 .is_oplock_break = smb2_is_valid_oplock_break,
601 .need_neg = smb2_need_neg,
602 .negotiate = smb2_negotiate,
603 .negotiate_wsize = smb2_negotiate_wsize,
604 .negotiate_rsize = smb2_negotiate_rsize,
605 .sess_setup = SMB2_sess_setup,
606 .logoff = SMB2_logoff,
607 .tree_connect = SMB2_tcon,
608 .tree_disconnect = SMB2_tdis,
609 .is_path_accessible = smb2_is_path_accessible,
610 .can_echo = smb2_can_echo,
612 .query_path_info = smb2_query_path_info,
613 .get_srv_inum = smb2_get_srv_inum,
614 .query_file_info = smb2_query_file_info,
615 .set_path_size = smb2_set_path_size,
616 .set_file_size = smb2_set_file_size,
617 .set_file_info = smb2_set_file_info,
619 .mkdir_setinfo = smb2_mkdir_setinfo,
621 .unlink = smb2_unlink,
622 .rename = smb2_rename_path,
623 .create_hardlink = smb2_create_hardlink,
624 .open = smb2_open_file,
625 .set_fid = smb2_set_fid,
626 .close = smb2_close_file,
627 .flush = smb2_flush_file,
628 .async_readv = smb2_async_readv,
629 .async_writev = smb2_async_writev,
630 .sync_read = smb2_sync_read,
631 .sync_write = smb2_sync_write,
632 .query_dir_first = smb2_query_dir_first,
633 .query_dir_next = smb2_query_dir_next,
634 .close_dir = smb2_close_dir,
635 .calc_smb_size = smb2_calc_size,
636 .is_status_pending = smb2_is_status_pending,
637 .oplock_response = smb2_oplock_response,
638 .queryfs = smb2_queryfs,
639 .mand_lock = smb2_mand_lock,
640 .mand_unlock_range = smb2_unlock_range,
641 .push_mand_locks = smb2_push_mandatory_locks,
642 .get_lease_key = smb2_get_lease_key,
643 .set_lease_key = smb2_set_lease_key,
644 .new_lease_key = smb2_new_lease_key,
645 .calc_signature = smb2_calc_signature,
649 struct smb_version_operations smb30_operations = {
650 .compare_fids = smb2_compare_fids,
651 .setup_request = smb2_setup_request,
652 .setup_async_request = smb2_setup_async_request,
653 .check_receive = smb2_check_receive,
654 .add_credits = smb2_add_credits,
655 .set_credits = smb2_set_credits,
656 .get_credits_field = smb2_get_credits_field,
657 .get_credits = smb2_get_credits,
658 .get_next_mid = smb2_get_next_mid,
659 .read_data_offset = smb2_read_data_offset,
660 .read_data_length = smb2_read_data_length,
661 .map_error = map_smb2_to_linux_error,
662 .find_mid = smb2_find_mid,
663 .check_message = smb2_check_message,
664 .dump_detail = smb2_dump_detail,
665 .clear_stats = smb2_clear_stats,
666 .print_stats = smb2_print_stats,
667 .dump_share_caps = smb2_dump_share_caps,
668 .is_oplock_break = smb2_is_valid_oplock_break,
669 .need_neg = smb2_need_neg,
670 .negotiate = smb2_negotiate,
671 .negotiate_wsize = smb2_negotiate_wsize,
672 .negotiate_rsize = smb2_negotiate_rsize,
673 .sess_setup = SMB2_sess_setup,
674 .logoff = SMB2_logoff,
675 .tree_connect = SMB2_tcon,
676 .tree_disconnect = SMB2_tdis,
677 .is_path_accessible = smb2_is_path_accessible,
678 .can_echo = smb2_can_echo,
680 .query_path_info = smb2_query_path_info,
681 .get_srv_inum = smb2_get_srv_inum,
682 .query_file_info = smb2_query_file_info,
683 .set_path_size = smb2_set_path_size,
684 .set_file_size = smb2_set_file_size,
685 .set_file_info = smb2_set_file_info,
687 .mkdir_setinfo = smb2_mkdir_setinfo,
689 .unlink = smb2_unlink,
690 .rename = smb2_rename_path,
691 .create_hardlink = smb2_create_hardlink,
692 .open = smb2_open_file,
693 .set_fid = smb2_set_fid,
694 .close = smb2_close_file,
695 .flush = smb2_flush_file,
696 .async_readv = smb2_async_readv,
697 .async_writev = smb2_async_writev,
698 .sync_read = smb2_sync_read,
699 .sync_write = smb2_sync_write,
700 .query_dir_first = smb2_query_dir_first,
701 .query_dir_next = smb2_query_dir_next,
702 .close_dir = smb2_close_dir,
703 .calc_smb_size = smb2_calc_size,
704 .is_status_pending = smb2_is_status_pending,
705 .oplock_response = smb2_oplock_response,
706 .queryfs = smb2_queryfs,
707 .mand_lock = smb2_mand_lock,
708 .mand_unlock_range = smb2_unlock_range,
709 .push_mand_locks = smb2_push_mandatory_locks,
710 .get_lease_key = smb2_get_lease_key,
711 .set_lease_key = smb2_set_lease_key,
712 .new_lease_key = smb2_new_lease_key,
713 .calc_signature = smb3_calc_signature,
716 struct smb_version_values smb20_values = {
717 .version_string = SMB20_VERSION_STRING,
718 .protocol_id = SMB20_PROT_ID,
719 .req_capabilities = 0, /* MBZ */
720 .large_lock_type = 0,
721 .exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK,
722 .shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK,
723 .unlock_lock_type = SMB2_LOCKFLAG_UNLOCK,
724 .header_size = sizeof(struct smb2_hdr),
725 .max_header_size = MAX_SMB2_HDR_SIZE,
726 .read_rsp_size = sizeof(struct smb2_read_rsp) - 1,
727 .lock_cmd = SMB2_LOCK,
729 .cap_nt_find = SMB2_NT_FIND,
730 .cap_large_files = SMB2_LARGE_FILES,
731 .oplock_read = SMB2_OPLOCK_LEVEL_II,
734 struct smb_version_values smb21_values = {
735 .version_string = SMB21_VERSION_STRING,
736 .protocol_id = SMB21_PROT_ID,
737 .req_capabilities = 0, /* MBZ on negotiate req until SMB3 dialect */
738 .large_lock_type = 0,
739 .exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK,
740 .shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK,
741 .unlock_lock_type = SMB2_LOCKFLAG_UNLOCK,
742 .header_size = sizeof(struct smb2_hdr),
743 .max_header_size = MAX_SMB2_HDR_SIZE,
744 .read_rsp_size = sizeof(struct smb2_read_rsp) - 1,
745 .lock_cmd = SMB2_LOCK,
747 .cap_nt_find = SMB2_NT_FIND,
748 .cap_large_files = SMB2_LARGE_FILES,
749 .oplock_read = SMB2_OPLOCK_LEVEL_II,
752 struct smb_version_values smb30_values = {
753 .version_string = SMB30_VERSION_STRING,
754 .protocol_id = SMB30_PROT_ID,
755 .req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU,
756 .large_lock_type = 0,
757 .exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK,
758 .shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK,
759 .unlock_lock_type = SMB2_LOCKFLAG_UNLOCK,
760 .header_size = sizeof(struct smb2_hdr),
761 .max_header_size = MAX_SMB2_HDR_SIZE,
762 .read_rsp_size = sizeof(struct smb2_read_rsp) - 1,
763 .lock_cmd = SMB2_LOCK,
765 .cap_nt_find = SMB2_NT_FIND,
766 .cap_large_files = SMB2_LARGE_FILES,
767 .oplock_read = SMB2_OPLOCK_LEVEL_II,
770 struct smb_version_values smb302_values = {
771 .version_string = SMB302_VERSION_STRING,
772 .protocol_id = SMB302_PROT_ID,
773 .req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU,
774 .large_lock_type = 0,
775 .exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK,
776 .shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK,
777 .unlock_lock_type = SMB2_LOCKFLAG_UNLOCK,
778 .header_size = sizeof(struct smb2_hdr),
779 .max_header_size = MAX_SMB2_HDR_SIZE,
780 .read_rsp_size = sizeof(struct smb2_read_rsp) - 1,
781 .lock_cmd = SMB2_LOCK,
783 .cap_nt_find = SMB2_NT_FIND,
784 .cap_large_files = SMB2_LARGE_FILES,
785 .oplock_read = SMB2_OPLOCK_LEVEL_II,