59 cFYI(1,
"issued NT_CANCEL for mid %u, rc = %d",
68 return ob1->
fid.netfid == ob2->
fid.netfid;
72 cifs_read_data_offset(
char *buf)
74 READ_RSP *
rsp = (READ_RSP *)buf;
79 cifs_read_data_length(
char *buf)
81 READ_RSP *
rsp = (READ_RSP *)buf;
94 if (mid->
mid == buf->
Mid &&
126 cifs_get_credits_field(
struct TCP_Server_Info *server,
const int optype)
162 __u16 last_mid, cur_mid;
182 while (cur_mid != last_mid) {
184 unsigned int num_mids;
193 if (mid_entry->
mid == cur_mid &&
211 if (num_mids > 32768)
215 mid = (
__u64)cur_mid;
232 check2ndT2(
char *buf)
237 __u16 total_data_size, data_in_this_rsp;
245 cFYI(1,
"invalid transact2 word count");
251 total_data_size = get_unaligned_le16(&pSMBt->
t2_rsp.TotalDataCount);
252 data_in_this_rsp = get_unaligned_le16(&pSMBt->
t2_rsp.DataCount);
254 if (total_data_size == data_in_this_rsp)
256 else if (total_data_size < data_in_this_rsp) {
257 cFYI(1,
"total data %d smaller than data in frame %d",
258 total_data_size, data_in_this_rsp);
262 remaining = total_data_size - data_in_this_rsp;
264 cFYI(1,
"missing %d bytes from transact2, check next response",
267 cERROR(1,
"TotalDataSize %d is over maximum buffer %d",
275 coalesce_t2(
char *second_buf,
struct smb_hdr *target_hdr)
279 char *data_area_of_tgt;
280 char *data_area_of_src;
282 unsigned int byte_count, total_in_tgt;
283 __u16 tgt_total_cnt, src_total_cnt, total_in_src;
285 src_total_cnt = get_unaligned_le16(&pSMBs->
t2_rsp.TotalDataCount);
286 tgt_total_cnt = get_unaligned_le16(&pSMBt->
t2_rsp.TotalDataCount);
288 if (tgt_total_cnt != src_total_cnt)
289 cFYI(1,
"total data count of primary and secondary t2 differ "
290 "source=%hu target=%hu", src_total_cnt, tgt_total_cnt);
292 total_in_tgt = get_unaligned_le16(&pSMBt->
t2_rsp.DataCount);
294 remaining = tgt_total_cnt - total_in_tgt;
297 cFYI(1,
"Server sent too much data. tgt_total_cnt=%hu "
298 "total_in_tgt=%hu", tgt_total_cnt, total_in_tgt);
302 if (remaining == 0) {
304 cFYI(1,
"no more data remains");
308 total_in_src = get_unaligned_le16(&pSMBs->
t2_rsp.DataCount);
309 if (remaining < total_in_src)
310 cFYI(1,
"transact2 2nd response contains too much data");
313 data_area_of_tgt = (
char *)&pSMBt->
hdr.Protocol +
314 get_unaligned_le16(&pSMBt->
t2_rsp.DataOffset);
317 data_area_of_src = (
char *)&pSMBs->
hdr.Protocol +
318 get_unaligned_le16(&pSMBs->
t2_rsp.DataOffset);
320 data_area_of_tgt += total_in_tgt;
322 total_in_tgt += total_in_src;
325 cFYI(1,
"coalesced DataCount too large (%u)", total_in_tgt);
328 put_unaligned_le16(total_in_tgt, &pSMBt->
t2_rsp.DataCount);
331 byte_count = get_bcc(target_hdr);
332 byte_count += total_in_src;
335 cFYI(1,
"coalesced BCC too large (%u)", byte_count);
338 put_bcc(byte_count, target_hdr);
341 byte_count += total_in_src;
344 cFYI(1,
"coalesced BCC exceeds buffer size (%u)", byte_count);
350 memcpy(data_area_of_tgt, data_area_of_src, total_in_src);
352 if (remaining != total_in_src) {
354 cFYI(1,
"waiting for more secondary responses");
359 cFYI(1,
"found the last secondary response");
365 char *buf,
int malformed)
369 if (check2ndT2(buf) <= 0)
374 malformed = coalesce_t2(buf, mid->
resp_buf);
384 cERROR(1,
"1st trans2 resp needs bigbuf");
397 return server->
maxBuf == 0;
401 cifs_negotiate(
const unsigned int xid,
struct cifs_ses *ses)
407 set_credits(ses->
server, 1);
423 if (volume_info->
wsize)
424 wsize = volume_info->
wsize;
431 if (!tcon->
unix_ext || !(unix_cap & CIFS_UNIX_LARGE_WRITE_CAP))
442 wsize =
min_t(
unsigned int, wsize,
443 server->
maxBuf -
sizeof(WRITE_REQ) + 4);
456 unsigned int rsize, defsize;
475 defsize = server->
maxBuf -
sizeof(READ_RSP);
477 rsize = volume_info->
rsize ? volume_info->
rsize : defsize;
493 cifs_qfs_tcon(
const unsigned int xid,
struct cifs_tcon *tcon)
500 cifs_is_path_accessible(
const unsigned int xid,
struct cifs_tcon *tcon,
504 FILE_ALL_INFO *file_info;
507 if (file_info ==
NULL)
524 cifs_query_path_info(
const unsigned int xid,
struct cifs_tcon *tcon,
526 FILE_ALL_INFO *
data,
bool *adjustTZ)
550 cifs_get_srv_inum(
const unsigned int xid,
struct cifs_tcon *tcon,
552 u64 *uniqueid, FILE_ALL_INFO *data)
572 cifs_query_file_info(
const unsigned int xid,
struct cifs_tcon *tcon,
584 char *full_path =
NULL;
598 if (full_path ==
NULL)
604 convert_delimiter(full_path, CIFS_DIR_SEP(cifs_sb));
605 full_path[dfsplen + pplen] = 0;
612 #ifdef CONFIG_CIFS_STATS
613 atomic_set(&tcon->stats.cifs_stats.num_writes, 0);
614 atomic_set(&tcon->stats.cifs_stats.num_reads, 0);
615 atomic_set(&tcon->stats.cifs_stats.num_flushes, 0);
616 atomic_set(&tcon->stats.cifs_stats.num_oplock_brks, 0);
617 atomic_set(&tcon->stats.cifs_stats.num_opens, 0);
618 atomic_set(&tcon->stats.cifs_stats.num_posixopens, 0);
619 atomic_set(&tcon->stats.cifs_stats.num_posixmkdirs, 0);
620 atomic_set(&tcon->stats.cifs_stats.num_closes, 0);
621 atomic_set(&tcon->stats.cifs_stats.num_deletes, 0);
622 atomic_set(&tcon->stats.cifs_stats.num_mkdirs, 0);
623 atomic_set(&tcon->stats.cifs_stats.num_rmdirs, 0);
624 atomic_set(&tcon->stats.cifs_stats.num_renames, 0);
625 atomic_set(&tcon->stats.cifs_stats.num_t2renames, 0);
626 atomic_set(&tcon->stats.cifs_stats.num_ffirst, 0);
627 atomic_set(&tcon->stats.cifs_stats.num_fnext, 0);
628 atomic_set(&tcon->stats.cifs_stats.num_fclose, 0);
629 atomic_set(&tcon->stats.cifs_stats.num_hardlinks, 0);
630 atomic_set(&tcon->stats.cifs_stats.num_symlinks, 0);
631 atomic_set(&tcon->stats.cifs_stats.num_locks, 0);
632 atomic_set(&tcon->stats.cifs_stats.num_acl_get, 0);
633 atomic_set(&tcon->stats.cifs_stats.num_acl_set, 0);
640 #ifdef CONFIG_CIFS_STATS
642 atomic_read(&tcon->stats.cifs_stats.num_oplock_brks));
645 (
long long)(tcon->bytes_read));
648 (
long long)(tcon->bytes_written));
651 seq_printf(m,
"\nLocks: %d HardLinks: %d Symlinks: %d",
653 atomic_read(&tcon->stats.cifs_stats.num_hardlinks),
654 atomic_read(&tcon->stats.cifs_stats.num_symlinks));
655 seq_printf(m,
"\nOpens: %d Closes: %d Deletes: %d",
659 seq_printf(m,
"\nPosix Opens: %d Posix Mkdirs: %d",
660 atomic_read(&tcon->stats.cifs_stats.num_posixopens),
661 atomic_read(&tcon->stats.cifs_stats.num_posixmkdirs));
667 atomic_read(&tcon->stats.cifs_stats.num_t2renames));
668 seq_printf(m,
"\nFindFirst: %d FNext %d FClose %d",
676 cifs_mkdir_setinfo(
struct inode *
inode,
const char *full_path,
678 const unsigned int xid)
680 FILE_BASIC_INFO
info;
685 memset(&info, 0,
sizeof(info));
686 cifsInode = CIFS_I(inode);
697 cifs_open_file(
const unsigned int xid,
struct cifs_tcon *tcon,
const char *
path,
698 int disposition,
int desired_access,
int create_options,
704 desired_access, create_options,
705 &fid->
netfid, oplock, buf,
708 return CIFSSMBOpen(xid, tcon, path, disposition, desired_access,
709 create_options, &fid->
netfid, oplock, buf,
724 cifs_close_file(
const unsigned int xid,
struct cifs_tcon *tcon,
731 cifs_flush_file(
const unsigned int xid,
struct cifs_tcon *tcon,
738 cifs_sync_read(
const unsigned int xid,
struct cifsFileInfo *cfile,
740 char **buf,
int *buf_type)
743 return CIFSSMBRead(xid, parms, bytes_read, buf, buf_type);
747 cifs_sync_write(
const unsigned int xid,
struct cifsFileInfo *cfile,
749 struct kvec *iov,
unsigned long nr_segs)
757 smb_set_file_info(
struct inode *inode,
const char *full_path,
758 FILE_BASIC_INFO *buf,
const unsigned int xid)
773 netfid = open_file->
fid.netfid;
774 netpid = open_file->
pid;
775 tcon = tlink_tcon(open_file->
tlink);
776 goto set_via_filehandle;
785 tcon = tlink_tcon(tlink);
803 cFYI(1,
"calling SetFileInfo since SetPathInfo for times not supported "
823 if (open_file ==
NULL)
834 cifs_query_dir_first(
const unsigned int xid,
struct cifs_tcon *tcon,
840 &fid->
netfid, search_flags, srch_inf,
true);
844 cifs_query_dir_next(
const unsigned int xid,
struct cifs_tcon *tcon,
852 cifs_close_dir(
const unsigned int xid,
struct cifs_tcon *tcon,
868 cifs_queryfs(
const unsigned int xid,
struct cifs_tcon *tcon,
904 current->tgid, length, offset, unlock, lock,
905 (
__u8)type, wait, 0);
909 .send_cancel = send_nt_cancel,
910 .compare_fids = cifs_compare_fids,
914 .add_credits = cifs_add_credits,
915 .set_credits = cifs_set_credits,
916 .get_credits_field = cifs_get_credits_field,
917 .get_credits = cifs_get_credits,
918 .get_next_mid = cifs_get_next_mid,
919 .read_data_offset = cifs_read_data_offset,
920 .read_data_length = cifs_read_data_length,
922 .find_mid = cifs_find_mid,
925 .clear_stats = cifs_clear_stats,
926 .print_stats = cifs_print_stats,
928 .check_trans2 = cifs_check_trans2,
929 .need_neg = cifs_need_neg,
930 .negotiate = cifs_negotiate,
931 .negotiate_wsize = cifs_negotiate_wsize,
932 .negotiate_rsize = cifs_negotiate_rsize,
938 .qfs_tcon = cifs_qfs_tcon,
939 .is_path_accessible = cifs_is_path_accessible,
940 .query_path_info = cifs_query_path_info,
941 .query_file_info = cifs_query_file_info,
942 .get_srv_inum = cifs_get_srv_inum,
945 .set_file_info = smb_set_file_info,
946 .build_path_to_root = cifs_build_path_to_root,
949 .mkdir_setinfo = cifs_mkdir_setinfo,
955 .open = cifs_open_file,
956 .set_fid = cifs_set_fid,
957 .close = cifs_close_file,
958 .flush = cifs_flush_file,
961 .sync_read = cifs_sync_read,
962 .sync_write = cifs_sync_write,
963 .query_dir_first = cifs_query_dir_first,
964 .query_dir_next = cifs_query_dir_next,
965 .close_dir = cifs_close_dir,
967 .oplock_response = cifs_oplock_response,
968 .queryfs = cifs_queryfs,
969 .mand_lock = cifs_mand_lock,
977 .exclusive_lock_type = 0,
979 .unlock_lock_type = 0,
980 .header_size =
sizeof(
struct smb_hdr),
982 .read_rsp_size =
sizeof(READ_RSP),