smb2ops.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  1. /*
  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. #include <linux/pagemap.h>
  20. #include "cifsglob.h"
  21. #include "smb2pdu.h"
  22. #include "smb2proto.h"
  23. #include "cifsproto.h"
  24. #include "cifs_debug.h"
  25. #include "smb2status.h"
  26. static int
  27. change_conf(struct TCP_Server_Info *server)
  28. {
  29. server->credits += server->echo_credits + server->oplock_credits;
  30. server->oplock_credits = server->echo_credits = 0;
  31. switch (server->credits) {
  32. case 0:
  33. return -1;
  34. case 1:
  35. server->echoes = false;
  36. server->oplocks = false;
  37. cERROR(1, "disabling echoes and oplocks");
  38. break;
  39. case 2:
  40. server->echoes = true;
  41. server->oplocks = false;
  42. server->echo_credits = 1;
  43. cFYI(1, "disabling oplocks");
  44. break;
  45. default:
  46. server->echoes = true;
  47. server->oplocks = true;
  48. server->echo_credits = 1;
  49. server->oplock_credits = 1;
  50. }
  51. server->credits -= server->echo_credits + server->oplock_credits;
  52. return 0;
  53. }
  54. static void
  55. smb2_add_credits(struct TCP_Server_Info *server, const unsigned int add,
  56. const int optype)
  57. {
  58. int *val, rc = 0;
  59. spin_lock(&server->req_lock);
  60. val = server->ops->get_credits_field(server, optype);
  61. *val += add;
  62. server->in_flight--;
  63. if (server->in_flight == 0 && (optype & CIFS_OP_MASK) != CIFS_NEG_OP)
  64. rc = change_conf(server);
  65. /*
  66. * Sometimes server returns 0 credits on oplock break ack - we need to
  67. * rebalance credits in this case.
  68. */
  69. else if (server->in_flight > 0 && server->oplock_credits == 0 &&
  70. server->oplocks) {
  71. if (server->credits > 1) {
  72. server->credits--;
  73. server->oplock_credits++;
  74. }
  75. }
  76. spin_unlock(&server->req_lock);
  77. wake_up(&server->request_q);
  78. if (rc)
  79. cifs_reconnect(server);
  80. }
  81. static void
  82. smb2_set_credits(struct TCP_Server_Info *server, const int val)
  83. {
  84. spin_lock(&server->req_lock);
  85. server->credits = val;
  86. spin_unlock(&server->req_lock);
  87. }
  88. static int *
  89. smb2_get_credits_field(struct TCP_Server_Info *server, const int optype)
  90. {
  91. switch (optype) {
  92. case CIFS_ECHO_OP:
  93. return &server->echo_credits;
  94. case CIFS_OBREAK_OP:
  95. return &server->oplock_credits;
  96. default:
  97. return &server->credits;
  98. }
  99. }
  100. static unsigned int
  101. smb2_get_credits(struct mid_q_entry *mid)
  102. {
  103. return le16_to_cpu(((struct smb2_hdr *)mid->resp_buf)->CreditRequest);
  104. }
  105. static __u64
  106. smb2_get_next_mid(struct TCP_Server_Info *server)
  107. {
  108. __u64 mid;
  109. /* for SMB2 we need the current value */
  110. spin_lock(&GlobalMid_Lock);
  111. mid = server->CurrentMid++;
  112. spin_unlock(&GlobalMid_Lock);
  113. return mid;
  114. }
  115. static struct mid_q_entry *
  116. smb2_find_mid(struct TCP_Server_Info *server, char *buf)
  117. {
  118. struct mid_q_entry *mid;
  119. struct smb2_hdr *hdr = (struct smb2_hdr *)buf;
  120. spin_lock(&GlobalMid_Lock);
  121. list_for_each_entry(mid, &server->pending_mid_q, qhead) {
  122. if ((mid->mid == hdr->MessageId) &&
  123. (mid->mid_state == MID_REQUEST_SUBMITTED) &&
  124. (mid->command == hdr->Command)) {
  125. spin_unlock(&GlobalMid_Lock);
  126. return mid;
  127. }
  128. }
  129. spin_unlock(&GlobalMid_Lock);
  130. return NULL;
  131. }
  132. static void
  133. smb2_dump_detail(void *buf)
  134. {
  135. #ifdef CONFIG_CIFS_DEBUG2
  136. struct smb2_hdr *smb = (struct smb2_hdr *)buf;
  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. static bool
  144. smb2_need_neg(struct TCP_Server_Info *server)
  145. {
  146. return server->max_read == 0;
  147. }
  148. static int
  149. smb2_negotiate(const unsigned int xid, struct cifs_ses *ses)
  150. {
  151. int rc;
  152. ses->server->CurrentMid = 0;
  153. rc = SMB2_negotiate(xid, ses);
  154. /* BB we probably don't need to retry with modern servers */
  155. if (rc == -EAGAIN)
  156. rc = -EHOSTDOWN;
  157. return rc;
  158. }
  159. static unsigned int
  160. smb2_negotiate_wsize(struct cifs_tcon *tcon, struct smb_vol *volume_info)
  161. {
  162. struct TCP_Server_Info *server = tcon->ses->server;
  163. unsigned int wsize;
  164. /* start with specified wsize, or default */
  165. wsize = volume_info->wsize ? volume_info->wsize : CIFS_DEFAULT_IOSIZE;
  166. wsize = min_t(unsigned int, wsize, server->max_write);
  167. /*
  168. * limit write size to 2 ** 16, because we don't support multicredit
  169. * requests now.
  170. */
  171. wsize = min_t(unsigned int, wsize, 2 << 15);
  172. /* limit to the amount that we can kmap at once */
  173. wsize = min_t(unsigned int, wsize, CIFS_KMAP_SIZE_LIMIT);
  174. return wsize;
  175. }
  176. static unsigned int
  177. smb2_negotiate_rsize(struct cifs_tcon *tcon, struct smb_vol *volume_info)
  178. {
  179. struct TCP_Server_Info *server = tcon->ses->server;
  180. unsigned int rsize;
  181. /* start with specified rsize, or default */
  182. rsize = volume_info->rsize ? volume_info->rsize : CIFS_DEFAULT_IOSIZE;
  183. rsize = min_t(unsigned int, rsize, server->max_read);
  184. /*
  185. * limit write size to 2 ** 16, because we don't support multicredit
  186. * requests now.
  187. */
  188. rsize = min_t(unsigned int, rsize, 2 << 15);
  189. /* limit to the amount that we can kmap at once */
  190. rsize = min_t(unsigned int, rsize, CIFS_KMAP_SIZE_LIMIT);
  191. return rsize;
  192. }
  193. static int
  194. smb2_is_path_accessible(const unsigned int xid, struct cifs_tcon *tcon,
  195. struct cifs_sb_info *cifs_sb, const char *full_path)
  196. {
  197. int rc;
  198. __u64 persistent_fid, volatile_fid;
  199. __le16 *utf16_path;
  200. __u8 oplock = SMB2_OPLOCK_LEVEL_NONE;
  201. utf16_path = cifs_convert_path_to_utf16(full_path, cifs_sb);
  202. if (!utf16_path)
  203. return -ENOMEM;
  204. rc = SMB2_open(xid, tcon, utf16_path, &persistent_fid, &volatile_fid,
  205. FILE_READ_ATTRIBUTES, FILE_OPEN, 0, 0, &oplock, NULL);
  206. if (rc) {
  207. kfree(utf16_path);
  208. return rc;
  209. }
  210. rc = SMB2_close(xid, tcon, persistent_fid, volatile_fid);
  211. kfree(utf16_path);
  212. return rc;
  213. }
  214. static int
  215. smb2_get_srv_inum(const unsigned int xid, struct cifs_tcon *tcon,
  216. struct cifs_sb_info *cifs_sb, const char *full_path,
  217. u64 *uniqueid, FILE_ALL_INFO *data)
  218. {
  219. *uniqueid = le64_to_cpu(data->IndexNumber);
  220. return 0;
  221. }
  222. static int
  223. smb2_query_file_info(const unsigned int xid, struct cifs_tcon *tcon,
  224. struct cifs_fid *fid, FILE_ALL_INFO *data)
  225. {
  226. int rc;
  227. struct smb2_file_all_info *smb2_data;
  228. smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + MAX_NAME * 2,
  229. GFP_KERNEL);
  230. if (smb2_data == NULL)
  231. return -ENOMEM;
  232. rc = SMB2_query_info(xid, tcon, fid->persistent_fid, fid->volatile_fid,
  233. smb2_data);
  234. if (!rc)
  235. move_smb2_info_to_cifs(data, smb2_data);
  236. kfree(smb2_data);
  237. return rc;
  238. }
  239. static char *
  240. smb2_build_path_to_root(struct smb_vol *vol, struct cifs_sb_info *cifs_sb,
  241. struct cifs_tcon *tcon)
  242. {
  243. int pplen = vol->prepath ? strlen(vol->prepath) : 0;
  244. char *full_path = NULL;
  245. /* if no prefix path, simply set path to the root of share to "" */
  246. if (pplen == 0) {
  247. full_path = kzalloc(2, GFP_KERNEL);
  248. return full_path;
  249. }
  250. cERROR(1, "prefixpath is not supported for SMB2 now");
  251. return NULL;
  252. }
  253. static bool
  254. smb2_can_echo(struct TCP_Server_Info *server)
  255. {
  256. return server->echoes;
  257. }
  258. static void
  259. smb2_clear_stats(struct cifs_tcon *tcon)
  260. {
  261. #ifdef CONFIG_CIFS_STATS
  262. int i;
  263. for (i = 0; i < NUMBER_OF_SMB2_COMMANDS; i++) {
  264. atomic_set(&tcon->stats.smb2_stats.smb2_com_sent[i], 0);
  265. atomic_set(&tcon->stats.smb2_stats.smb2_com_failed[i], 0);
  266. }
  267. #endif
  268. }
  269. static void
  270. smb2_print_stats(struct seq_file *m, struct cifs_tcon *tcon)
  271. {
  272. #ifdef CONFIG_CIFS_STATS
  273. atomic_t *sent = tcon->stats.smb2_stats.smb2_com_sent;
  274. atomic_t *failed = tcon->stats.smb2_stats.smb2_com_failed;
  275. seq_printf(m, "\nNegotiates: %d sent %d failed",
  276. atomic_read(&sent[SMB2_NEGOTIATE_HE]),
  277. atomic_read(&failed[SMB2_NEGOTIATE_HE]));
  278. seq_printf(m, "\nSessionSetups: %d sent %d failed",
  279. atomic_read(&sent[SMB2_SESSION_SETUP_HE]),
  280. atomic_read(&failed[SMB2_SESSION_SETUP_HE]));
  281. #define SMB2LOGOFF 0x0002 /* trivial request/resp */
  282. seq_printf(m, "\nLogoffs: %d sent %d failed",
  283. atomic_read(&sent[SMB2_LOGOFF_HE]),
  284. atomic_read(&failed[SMB2_LOGOFF_HE]));
  285. seq_printf(m, "\nTreeConnects: %d sent %d failed",
  286. atomic_read(&sent[SMB2_TREE_CONNECT_HE]),
  287. atomic_read(&failed[SMB2_TREE_CONNECT_HE]));
  288. seq_printf(m, "\nTreeDisconnects: %d sent %d failed",
  289. atomic_read(&sent[SMB2_TREE_DISCONNECT_HE]),
  290. atomic_read(&failed[SMB2_TREE_DISCONNECT_HE]));
  291. seq_printf(m, "\nCreates: %d sent %d failed",
  292. atomic_read(&sent[SMB2_CREATE_HE]),
  293. atomic_read(&failed[SMB2_CREATE_HE]));
  294. seq_printf(m, "\nCloses: %d sent %d failed",
  295. atomic_read(&sent[SMB2_CLOSE_HE]),
  296. atomic_read(&failed[SMB2_CLOSE_HE]));
  297. seq_printf(m, "\nFlushes: %d sent %d failed",
  298. atomic_read(&sent[SMB2_FLUSH_HE]),
  299. atomic_read(&failed[SMB2_FLUSH_HE]));
  300. seq_printf(m, "\nReads: %d sent %d failed",
  301. atomic_read(&sent[SMB2_READ_HE]),
  302. atomic_read(&failed[SMB2_READ_HE]));
  303. seq_printf(m, "\nWrites: %d sent %d failed",
  304. atomic_read(&sent[SMB2_WRITE_HE]),
  305. atomic_read(&failed[SMB2_WRITE_HE]));
  306. seq_printf(m, "\nLocks: %d sent %d failed",
  307. atomic_read(&sent[SMB2_LOCK_HE]),
  308. atomic_read(&failed[SMB2_LOCK_HE]));
  309. seq_printf(m, "\nIOCTLs: %d sent %d failed",
  310. atomic_read(&sent[SMB2_IOCTL_HE]),
  311. atomic_read(&failed[SMB2_IOCTL_HE]));
  312. seq_printf(m, "\nCancels: %d sent %d failed",
  313. atomic_read(&sent[SMB2_CANCEL_HE]),
  314. atomic_read(&failed[SMB2_CANCEL_HE]));
  315. seq_printf(m, "\nEchos: %d sent %d failed",
  316. atomic_read(&sent[SMB2_ECHO_HE]),
  317. atomic_read(&failed[SMB2_ECHO_HE]));
  318. seq_printf(m, "\nQueryDirectories: %d sent %d failed",
  319. atomic_read(&sent[SMB2_QUERY_DIRECTORY_HE]),
  320. atomic_read(&failed[SMB2_QUERY_DIRECTORY_HE]));
  321. seq_printf(m, "\nChangeNotifies: %d sent %d failed",
  322. atomic_read(&sent[SMB2_CHANGE_NOTIFY_HE]),
  323. atomic_read(&failed[SMB2_CHANGE_NOTIFY_HE]));
  324. seq_printf(m, "\nQueryInfos: %d sent %d failed",
  325. atomic_read(&sent[SMB2_QUERY_INFO_HE]),
  326. atomic_read(&failed[SMB2_QUERY_INFO_HE]));
  327. seq_printf(m, "\nSetInfos: %d sent %d failed",
  328. atomic_read(&sent[SMB2_SET_INFO_HE]),
  329. atomic_read(&failed[SMB2_SET_INFO_HE]));
  330. seq_printf(m, "\nOplockBreaks: %d sent %d failed",
  331. atomic_read(&sent[SMB2_OPLOCK_BREAK_HE]),
  332. atomic_read(&failed[SMB2_OPLOCK_BREAK_HE]));
  333. #endif
  334. }
  335. static void
  336. smb2_set_fid(struct cifsFileInfo *cfile, struct cifs_fid *fid, __u32 oplock)
  337. {
  338. struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode);
  339. cfile->fid.persistent_fid = fid->persistent_fid;
  340. cfile->fid.volatile_fid = fid->volatile_fid;
  341. smb2_set_oplock_level(cinode, oplock);
  342. /* cinode->can_cache_brlcks = cinode->clientCanCacheAll; */
  343. }
  344. static int
  345. smb2_close_file(const unsigned int xid, struct cifs_tcon *tcon,
  346. struct cifs_fid *fid)
  347. {
  348. return SMB2_close(xid, tcon, fid->persistent_fid, fid->volatile_fid);
  349. }
  350. static int
  351. smb2_flush_file(const unsigned int xid, struct cifs_tcon *tcon,
  352. struct cifs_fid *fid)
  353. {
  354. return SMB2_flush(xid, tcon, fid->persistent_fid, fid->volatile_fid);
  355. }
  356. static unsigned int
  357. smb2_read_data_offset(char *buf)
  358. {
  359. struct smb2_read_rsp *rsp = (struct smb2_read_rsp *)buf;
  360. return rsp->DataOffset;
  361. }
  362. static unsigned int
  363. smb2_read_data_length(char *buf)
  364. {
  365. struct smb2_read_rsp *rsp = (struct smb2_read_rsp *)buf;
  366. return le32_to_cpu(rsp->DataLength);
  367. }
  368. static int
  369. smb2_sync_read(const unsigned int xid, struct cifsFileInfo *cfile,
  370. struct cifs_io_parms *parms, unsigned int *bytes_read,
  371. char **buf, int *buf_type)
  372. {
  373. parms->persistent_fid = cfile->fid.persistent_fid;
  374. parms->volatile_fid = cfile->fid.volatile_fid;
  375. return SMB2_read(xid, parms, bytes_read, buf, buf_type);
  376. }
  377. static int
  378. smb2_sync_write(const unsigned int xid, struct cifsFileInfo *cfile,
  379. struct cifs_io_parms *parms, unsigned int *written,
  380. struct kvec *iov, unsigned long nr_segs)
  381. {
  382. parms->persistent_fid = cfile->fid.persistent_fid;
  383. parms->volatile_fid = cfile->fid.volatile_fid;
  384. return SMB2_write(xid, parms, written, iov, nr_segs);
  385. }
  386. static int
  387. smb2_set_file_size(const unsigned int xid, struct cifs_tcon *tcon,
  388. struct cifsFileInfo *cfile, __u64 size, bool set_alloc)
  389. {
  390. __le64 eof = cpu_to_le64(size);
  391. return SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid,
  392. cfile->fid.volatile_fid, cfile->pid, &eof);
  393. }
  394. static int
  395. smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon,
  396. const char *path, struct cifs_sb_info *cifs_sb,
  397. struct cifs_fid *fid, __u16 search_flags,
  398. struct cifs_search_info *srch_inf)
  399. {
  400. __le16 *utf16_path;
  401. int rc;
  402. __u8 oplock = SMB2_OPLOCK_LEVEL_NONE;
  403. __u64 persistent_fid, volatile_fid;
  404. utf16_path = cifs_convert_path_to_utf16(path, cifs_sb);
  405. if (!utf16_path)
  406. return -ENOMEM;
  407. rc = SMB2_open(xid, tcon, utf16_path, &persistent_fid, &volatile_fid,
  408. FILE_READ_ATTRIBUTES | FILE_READ_DATA, FILE_OPEN, 0, 0,
  409. &oplock, NULL);
  410. kfree(utf16_path);
  411. if (rc) {
  412. cERROR(1, "open dir failed");
  413. return rc;
  414. }
  415. srch_inf->entries_in_buffer = 0;
  416. srch_inf->index_of_last_entry = 0;
  417. fid->persistent_fid = persistent_fid;
  418. fid->volatile_fid = volatile_fid;
  419. rc = SMB2_query_directory(xid, tcon, persistent_fid, volatile_fid, 0,
  420. srch_inf);
  421. if (rc) {
  422. cERROR(1, "query directory failed");
  423. SMB2_close(xid, tcon, persistent_fid, volatile_fid);
  424. }
  425. return rc;
  426. }
  427. static int
  428. smb2_query_dir_next(const unsigned int xid, struct cifs_tcon *tcon,
  429. struct cifs_fid *fid, __u16 search_flags,
  430. struct cifs_search_info *srch_inf)
  431. {
  432. return SMB2_query_directory(xid, tcon, fid->persistent_fid,
  433. fid->volatile_fid, 0, srch_inf);
  434. }
  435. static int
  436. smb2_close_dir(const unsigned int xid, struct cifs_tcon *tcon,
  437. struct cifs_fid *fid)
  438. {
  439. return SMB2_close(xid, tcon, fid->persistent_fid, fid->volatile_fid);
  440. }
  441. /*
  442. * If we negotiate SMB2 protocol and get STATUS_PENDING - update
  443. * the number of credits and return true. Otherwise - return false.
  444. */
  445. static bool
  446. smb2_is_status_pending(char *buf, struct TCP_Server_Info *server, int length)
  447. {
  448. struct smb2_hdr *hdr = (struct smb2_hdr *)buf;
  449. if (le32_to_cpu(hdr->Status) != STATUS_PENDING)
  450. return false;
  451. if (!length) {
  452. spin_lock(&server->req_lock);
  453. server->credits += le16_to_cpu(hdr->CreditRequest);
  454. spin_unlock(&server->req_lock);
  455. wake_up(&server->request_q);
  456. }
  457. return true;
  458. }
  459. static int
  460. smb2_oplock_response(struct cifs_tcon *tcon, struct cifs_fid *fid,
  461. struct cifsInodeInfo *cinode)
  462. {
  463. return SMB2_oplock_break(0, tcon, fid->persistent_fid,
  464. fid->volatile_fid,
  465. cinode->clientCanCacheRead ? 1 : 0);
  466. }
  467. struct smb_version_operations smb21_operations = {
  468. .setup_request = smb2_setup_request,
  469. .setup_async_request = smb2_setup_async_request,
  470. .check_receive = smb2_check_receive,
  471. .add_credits = smb2_add_credits,
  472. .set_credits = smb2_set_credits,
  473. .get_credits_field = smb2_get_credits_field,
  474. .get_credits = smb2_get_credits,
  475. .get_next_mid = smb2_get_next_mid,
  476. .read_data_offset = smb2_read_data_offset,
  477. .read_data_length = smb2_read_data_length,
  478. .map_error = map_smb2_to_linux_error,
  479. .find_mid = smb2_find_mid,
  480. .check_message = smb2_check_message,
  481. .dump_detail = smb2_dump_detail,
  482. .clear_stats = smb2_clear_stats,
  483. .print_stats = smb2_print_stats,
  484. .is_oplock_break = smb2_is_valid_oplock_break,
  485. .need_neg = smb2_need_neg,
  486. .negotiate = smb2_negotiate,
  487. .negotiate_wsize = smb2_negotiate_wsize,
  488. .negotiate_rsize = smb2_negotiate_rsize,
  489. .sess_setup = SMB2_sess_setup,
  490. .logoff = SMB2_logoff,
  491. .tree_connect = SMB2_tcon,
  492. .tree_disconnect = SMB2_tdis,
  493. .is_path_accessible = smb2_is_path_accessible,
  494. .can_echo = smb2_can_echo,
  495. .echo = SMB2_echo,
  496. .query_path_info = smb2_query_path_info,
  497. .get_srv_inum = smb2_get_srv_inum,
  498. .query_file_info = smb2_query_file_info,
  499. .set_path_size = smb2_set_path_size,
  500. .set_file_size = smb2_set_file_size,
  501. .set_file_info = smb2_set_file_info,
  502. .build_path_to_root = smb2_build_path_to_root,
  503. .mkdir = smb2_mkdir,
  504. .mkdir_setinfo = smb2_mkdir_setinfo,
  505. .rmdir = smb2_rmdir,
  506. .unlink = smb2_unlink,
  507. .rename = smb2_rename_path,
  508. .create_hardlink = smb2_create_hardlink,
  509. .open = smb2_open_file,
  510. .set_fid = smb2_set_fid,
  511. .close = smb2_close_file,
  512. .flush = smb2_flush_file,
  513. .async_readv = smb2_async_readv,
  514. .async_writev = smb2_async_writev,
  515. .sync_read = smb2_sync_read,
  516. .sync_write = smb2_sync_write,
  517. .query_dir_first = smb2_query_dir_first,
  518. .query_dir_next = smb2_query_dir_next,
  519. .close_dir = smb2_close_dir,
  520. .calc_smb_size = smb2_calc_size,
  521. .is_status_pending = smb2_is_status_pending,
  522. .oplock_response = smb2_oplock_response,
  523. };
  524. struct smb_version_values smb21_values = {
  525. .version_string = SMB21_VERSION_STRING,
  526. .header_size = sizeof(struct smb2_hdr),
  527. .max_header_size = MAX_SMB2_HDR_SIZE,
  528. .read_rsp_size = sizeof(struct smb2_read_rsp) - 1,
  529. .lock_cmd = SMB2_LOCK,
  530. .cap_unix = 0,
  531. .cap_nt_find = SMB2_NT_FIND,
  532. .cap_large_files = SMB2_LARGE_FILES,
  533. };