Lines Matching refs:pSMB

375 static int validate_t2(struct smb_t2_rsp *pSMB)
380 if (pSMB->hdr.WordCount < 10)
384 if (get_unaligned_le16(&pSMB->t2_rsp.ParameterOffset) > 1024 ||
385 get_unaligned_le16(&pSMB->t2_rsp.DataOffset) > 1024)
388 total_size = get_unaligned_le16(&pSMB->t2_rsp.ParameterCount);
395 total_size += get_unaligned_le16(&pSMB->t2_rsp.DataCount);
396 if (total_size > get_bcc(&pSMB->hdr) ||
402 cifs_dump_mem("Invalid transact2 SMB: ", (char *)pSMB,
593 NEGOTIATE_REQ *pSMB;
607 (void **) &pSMB, (void **) &pSMBr);
611 pSMB->hdr.Mid = get_next_mid(server);
612 pSMB->hdr.Flags2 |= (SMBFLG2_UNICODE | SMBFLG2_ERR_STATUS);
616 pSMB->hdr.Flags2 |= SMBFLG2_EXT_SEC;
627 memcpy(pSMB->DialectsArray+count, protocols[i].name, len);
630 inc_rfc1001_len(pSMB, count);
631 pSMB->ByteCount = cpu_to_le16(count);
633 rc = SendReceive(xid, ses, (struct smb_hdr *) pSMB,
696 cifs_buf_release(pSMB);
802 LOGOFF_ANDX_REQ *pSMB;
819 rc = small_smb_init(SMB_COM_LOGOFF_ANDX, 2, NULL, (void **)&pSMB);
825 pSMB->hdr.Mid = get_next_mid(ses->server);
828 pSMB->hdr.Flags2 |= SMBFLG2_SECURITY_SIGNATURE;
830 pSMB->hdr.Uid = ses->Suid;
832 pSMB->AndXCommand = 0xFF;
833 rc = SendReceiveNoRsp(xid, ses, (char *) pSMB, 0);
834 cifs_small_buf_release(pSMB);
851 TRANSACTION2_SPI_REQ *pSMB = NULL;
861 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
866 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
868 cifsConvertToUTF16((__le16 *) pSMB->FileName, fileName,
873 name_len = copy_path_name(pSMB->FileName, fileName);
877 pSMB->MaxParameterCount = cpu_to_le16(2);
878 pSMB->MaxDataCount = 0; /* BB double check this with jra */
879 pSMB->MaxSetupCount = 0;
880 pSMB->Reserved = 0;
881 pSMB->Flags = 0;
882 pSMB->Timeout = 0;
883 pSMB->Reserved2 = 0;
889 pRqD = (struct unlink_psx_rq *)(((char *)&pSMB->hdr.Protocol) + offset);
891 pSMB->ParameterOffset = cpu_to_le16(param_offset);
892 pSMB->DataOffset = cpu_to_le16(offset);
893 pSMB->SetupCount = 1;
894 pSMB->Reserved3 = 0;
895 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION);
898 pSMB->DataCount = cpu_to_le16(sizeof(struct unlink_psx_rq));
899 pSMB->TotalDataCount = cpu_to_le16(sizeof(struct unlink_psx_rq));
900 pSMB->ParameterCount = cpu_to_le16(params);
901 pSMB->TotalParameterCount = pSMB->ParameterCount;
902 pSMB->InformationLevel = cpu_to_le16(SMB_POSIX_UNLINK);
903 pSMB->Reserved4 = 0;
904 inc_rfc1001_len(pSMB, byte_count);
905 pSMB->ByteCount = cpu_to_le16(byte_count);
906 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
910 cifs_buf_release(pSMB);
924 DELETE_FILE_REQ *pSMB = NULL;
932 rc = smb_init(SMB_COM_DELETE, 1, tcon, (void **) &pSMB,
937 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
938 name_len = cifsConvertToUTF16((__le16 *) pSMB->fileName, name,
944 name_len = copy_path_name(pSMB->fileName, name);
946 pSMB->SearchAttributes =
948 pSMB->BufferFormat = 0x04;
949 inc_rfc1001_len(pSMB, name_len + 1);
950 pSMB->ByteCount = cpu_to_le16(name_len + 1);
951 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
957 cifs_buf_release(pSMB);
968 DELETE_DIRECTORY_REQ *pSMB = NULL;
977 rc = smb_init(SMB_COM_DELETE_DIRECTORY, 0, tcon, (void **) &pSMB,
982 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
983 name_len = cifsConvertToUTF16((__le16 *) pSMB->DirName, name,
989 name_len = copy_path_name(pSMB->DirName, name);
992 pSMB->BufferFormat = 0x04;
993 inc_rfc1001_len(pSMB, name_len + 1);
994 pSMB->ByteCount = cpu_to_le16(name_len + 1);
995 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
1001 cifs_buf_release(pSMB);
1013 CREATE_DIRECTORY_REQ *pSMB = NULL;
1021 rc = smb_init(SMB_COM_CREATE_DIRECTORY, 0, tcon, (void **) &pSMB,
1026 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1027 name_len = cifsConvertToUTF16((__le16 *) pSMB->DirName, name,
1033 name_len = copy_path_name(pSMB->DirName, name);
1036 pSMB->BufferFormat = 0x04;
1037 inc_rfc1001_len(pSMB, name_len + 1);
1038 pSMB->ByteCount = cpu_to_le16(name_len + 1);
1039 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
1045 cifs_buf_release(pSMB);
1058 TRANSACTION2_SPI_REQ *pSMB = NULL;
1069 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
1074 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1076 cifsConvertToUTF16((__le16 *) pSMB->FileName, name,
1081 name_len = copy_path_name(pSMB->FileName, name);
1086 pSMB->MaxParameterCount = cpu_to_le16(2);
1087 pSMB->MaxDataCount = cpu_to_le16(1000); /* large enough */
1088 pSMB->MaxSetupCount = 0;
1089 pSMB->Reserved = 0;
1090 pSMB->Flags = 0;
1091 pSMB->Timeout = 0;
1092 pSMB->Reserved2 = 0;
1096 pdata = (OPEN_PSX_REQ *)(((char *)&pSMB->hdr.Protocol) + offset);
1101 pSMB->ParameterOffset = cpu_to_le16(param_offset);
1102 pSMB->DataOffset = cpu_to_le16(offset);
1103 pSMB->SetupCount = 1;
1104 pSMB->Reserved3 = 0;
1105 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION);
1108 pSMB->DataCount = cpu_to_le16(count);
1109 pSMB->ParameterCount = cpu_to_le16(params);
1110 pSMB->TotalDataCount = pSMB->DataCount;
1111 pSMB->TotalParameterCount = pSMB->ParameterCount;
1112 pSMB->InformationLevel = cpu_to_le16(SMB_POSIX_OPEN);
1113 pSMB->Reserved4 = 0;
1114 inc_rfc1001_len(pSMB, byte_count);
1115 pSMB->ByteCount = cpu_to_le16(byte_count);
1116 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
1159 cifs_buf_release(pSMB);
1224 OPENX_REQ *pSMB = NULL;
1231 rc = smb_init(SMB_COM_OPEN_ANDX, 15, tcon, (void **) &pSMB,
1236 pSMB->AndXCommand = 0xFF; /* none */
1238 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1241 cifsConvertToUTF16((__le16 *) (pSMB->fileName + 1),
1247 name_len = copy_path_name(pSMB->fileName, fileName);
1250 pSMB->OpenFlags = cpu_to_le16(REQ_OPLOCK);
1252 pSMB->OpenFlags = cpu_to_le16(REQ_BATCHOPLOCK);
1254 pSMB->OpenFlags |= cpu_to_le16(REQ_MORE_INFO);
1255 pSMB->Mode = cpu_to_le16(access_flags_to_smbopen_mode(access_flags));
1256 pSMB->Mode |= cpu_to_le16(0x40); /* deny none */
1262 pSMB->FileAttributes = cpu_to_le16(ATTR_SYSTEM);
1264 pSMB->FileAttributes = cpu_to_le16(0/*ATTR_NORMAL*/);
1267 pSMB->FileAttributes |= cpu_to_le16(ATTR_READONLY);
1270 /* pSMB->CreateOptions = cpu_to_le32(create_options &
1274 pSMB->Sattr = cpu_to_le16(ATTR_HIDDEN | ATTR_SYSTEM | ATTR_DIRECTORY);
1275 pSMB->OpenFunction = cpu_to_le16(convert_disposition(openDisposition));
1277 inc_rfc1001_len(pSMB, count);
1279 pSMB->ByteCount = cpu_to_le16(count);
1280 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
1314 cifs_buf_release(pSMB);
1744 READ_REQ *pSMB = NULL;
1769 rc = small_smb_init(SMB_COM_READ_ANDX, wct, tcon, (void **) &pSMB);
1773 pSMB->hdr.Pid = cpu_to_le16((__u16)pid);
1774 pSMB->hdr.PidHigh = cpu_to_le16((__u16)(pid >> 16));
1780 pSMB->AndXCommand = 0xFF; /* none */
1781 pSMB->Fid = netfid;
1782 pSMB->OffsetLow = cpu_to_le32(offset & 0xFFFFFFFF);
1784 pSMB->OffsetHigh = cpu_to_le32(offset >> 32);
1786 pSMB->Remaining = 0;
1787 pSMB->MaxCount = cpu_to_le16(count & 0xFFFF);
1788 pSMB->MaxCountHigh = cpu_to_le32(count >> 16);
1790 pSMB->ByteCount = 0; /* no need to do le conversion since 0 */
1794 (struct smb_com_readx_req *)pSMB;
1798 iov[0].iov_base = (char *)pSMB;
1799 iov[0].iov_len = be32_to_cpu(pSMB->hdr.smb_buf_length) + 4;
1802 cifs_small_buf_release(pSMB);
1854 WRITE_REQ *pSMB = NULL;
1881 rc = smb_init(SMB_COM_WRITE_ANDX, wct, tcon, (void **) &pSMB,
1886 pSMB->hdr.Pid = cpu_to_le16((__u16)pid);
1887 pSMB->hdr.PidHigh = cpu_to_le16((__u16)(pid >> 16));
1893 pSMB->AndXCommand = 0xFF; /* none */
1894 pSMB->Fid = netfid;
1895 pSMB->OffsetLow = cpu_to_le32(offset & 0xFFFFFFFF);
1897 pSMB->OffsetHigh = cpu_to_le32(offset >> 32);
1899 pSMB->Reserved = 0xFFFFFFFF;
1900 pSMB->WriteMode = 0;
1901 pSMB->Remaining = 0;
1916 pSMB->DataOffset =
1919 memcpy(pSMB->Data, buf, bytes_sent);
1922 cifs_buf_release(pSMB);
1930 pSMB->DataLengthLow = cpu_to_le16(bytes_sent & 0xFFFF);
1931 pSMB->DataLengthHigh = cpu_to_le16(bytes_sent >> 16);
1932 inc_rfc1001_len(pSMB, byte_count);
1935 pSMB->ByteCount = cpu_to_le16(byte_count);
1939 (struct smb_com_writex_req *)pSMB;
1943 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
1962 cifs_buf_release(pSMB);
2288 WRITE_REQ *pSMB = NULL;
2312 rc = small_smb_init(SMB_COM_WRITE_ANDX, wct, tcon, (void **) &pSMB);
2316 pSMB->hdr.Pid = cpu_to_le16((__u16)pid);
2317 pSMB->hdr.PidHigh = cpu_to_le16((__u16)(pid >> 16));
2323 pSMB->AndXCommand = 0xFF; /* none */
2324 pSMB->Fid = netfid;
2325 pSMB->OffsetLow = cpu_to_le32(offset & 0xFFFFFFFF);
2327 pSMB->OffsetHigh = cpu_to_le32(offset >> 32);
2328 pSMB->Reserved = 0xFFFFFFFF;
2329 pSMB->WriteMode = 0;
2330 pSMB->Remaining = 0;
2332 pSMB->DataOffset =
2335 pSMB->DataLengthLow = cpu_to_le16(count & 0xFFFF);
2336 pSMB->DataLengthHigh = cpu_to_le16(count >> 16);
2338 smb_hdr_len = be32_to_cpu(pSMB->hdr.smb_buf_length) + 1;
2340 inc_rfc1001_len(pSMB, count + 1);
2342 inc_rfc1001_len(pSMB, count + 5); /* smb data starts later */
2344 pSMB->ByteCount = cpu_to_le16(count + 1);
2347 (struct smb_com_writex_req *)pSMB;
2350 iov[0].iov_base = pSMB;
2358 cifs_small_buf_release(pSMB);
2393 LOCK_REQ *pSMB = NULL;
2402 rc = small_smb_init(SMB_COM_LOCKING_ANDX, 8, tcon, (void **) &pSMB);
2406 pSMB->Timeout = 0;
2407 pSMB->NumberOfLocks = cpu_to_le16(num_lock);
2408 pSMB->NumberOfUnlocks = cpu_to_le16(num_unlock);
2409 pSMB->LockType = lock_type;
2410 pSMB->AndXCommand = 0xFF; /* none */
2411 pSMB->Fid = netfid; /* netfid stays le */
2414 inc_rfc1001_len(pSMB, count);
2415 pSMB->ByteCount = cpu_to_le16(count);
2417 iov[0].iov_base = (char *)pSMB;
2418 iov[0].iov_len = be32_to_cpu(pSMB->hdr.smb_buf_length) + 4 -
2426 cifs_small_buf_release(pSMB);
2441 LOCK_REQ *pSMB = NULL;
2449 rc = small_smb_init(SMB_COM_LOCKING_ANDX, 8, tcon, (void **) &pSMB);
2457 pSMB->Timeout = 0;
2460 pSMB->Timeout = cpu_to_le32(-1);/* blocking - do not time out */
2462 pSMB->Timeout = 0;
2465 pSMB->NumberOfLocks = cpu_to_le16(numLock);
2466 pSMB->NumberOfUnlocks = cpu_to_le16(numUnlock);
2467 pSMB->LockType = lockType;
2468 pSMB->OplockLevel = oplock_level;
2469 pSMB->AndXCommand = 0xFF; /* none */
2470 pSMB->Fid = smb_file_id; /* netfid stays le */
2473 pSMB->Locks[0].Pid = cpu_to_le16(netpid);
2475 pSMB->Locks[0].LengthLow = cpu_to_le32((u32)len);
2476 pSMB->Locks[0].LengthHigh = cpu_to_le32((u32)(len>>32));
2477 pSMB->Locks[0].OffsetLow = cpu_to_le32((u32)offset);
2478 pSMB->Locks[0].OffsetHigh = cpu_to_le32((u32)(offset>>32));
2484 inc_rfc1001_len(pSMB, count);
2485 pSMB->ByteCount = cpu_to_le16(count);
2488 rc = SendReceiveBlockingLock(xid, tcon, (struct smb_hdr *) pSMB,
2489 (struct smb_hdr *) pSMB, &bytes_returned);
2491 rc = SendReceiveNoRsp(xid, tcon->ses, (char *)pSMB, flags);
2492 cifs_small_buf_release(pSMB);
2509 struct smb_com_transaction2_sfi_req *pSMB = NULL;
2522 rc = small_smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB);
2527 pSMBr = (struct smb_com_transaction2_sfi_rsp *)pSMB;
2530 pSMB->MaxSetupCount = 0;
2531 pSMB->Reserved = 0;
2532 pSMB->Flags = 0;
2533 pSMB->Reserved2 = 0;
2538 pSMB->MaxParameterCount = cpu_to_le16(2);
2539 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB from sess */
2540 pSMB->SetupCount = 1;
2541 pSMB->Reserved3 = 0;
2543 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FILE_INFORMATION);
2545 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION);
2547 pSMB->DataCount = cpu_to_le16(count);
2548 pSMB->ParameterCount = cpu_to_le16(params);
2549 pSMB->TotalDataCount = pSMB->DataCount;
2550 pSMB->TotalParameterCount = pSMB->ParameterCount;
2551 pSMB->ParameterOffset = cpu_to_le16(param_offset);
2553 (((char *) &pSMB->hdr.Protocol) + offset);
2559 pSMB->Timeout = cpu_to_le32(-1);
2561 pSMB->Timeout = 0;
2567 pSMB->DataOffset = cpu_to_le16(offset);
2568 pSMB->Fid = smb_file_id;
2569 pSMB->InformationLevel = cpu_to_le16(SMB_SET_POSIX_LOCK);
2570 pSMB->Reserved4 = 0;
2571 inc_rfc1001_len(pSMB, byte_count);
2572 pSMB->ByteCount = cpu_to_le16(byte_count);
2574 rc = SendReceiveBlockingLock(xid, tcon, (struct smb_hdr *) pSMB,
2577 iov[0].iov_base = (char *)pSMB;
2578 iov[0].iov_len = be32_to_cpu(pSMB->hdr.smb_buf_length) + 4;
2583 cifs_small_buf_release(pSMB);
2636 CLOSE_REQ *pSMB = NULL;
2640 rc = small_smb_init(SMB_COM_CLOSE, 3, tcon, (void **) &pSMB);
2646 pSMB->FileID = (__u16) smb_file_id;
2647 pSMB->LastWriteTime = 0xFFFFFFFF;
2648 pSMB->ByteCount = 0;
2649 rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0);
2650 cifs_small_buf_release(pSMB);
2670 FLUSH_REQ *pSMB = NULL;
2673 rc = small_smb_init(SMB_COM_FLUSH, 1, tcon, (void **) &pSMB);
2677 pSMB->FileID = (__u16) smb_file_id;
2678 pSMB->ByteCount = 0;
2679 rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0);
2680 cifs_small_buf_release(pSMB);
2694 RENAME_REQ *pSMB = NULL;
2703 rc = smb_init(SMB_COM_RENAME, 1, tcon, (void **) &pSMB,
2708 pSMB->BufferFormat = 0x04;
2709 pSMB->SearchAttributes =
2713 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2714 name_len = cifsConvertToUTF16((__le16 *) pSMB->OldFileName,
2719 pSMB->OldFileName[name_len] = 0x04; /* pad */
2721 pSMB->OldFileName[name_len + 1] = 0x00;
2723 cifsConvertToUTF16((__le16 *)&pSMB->OldFileName[name_len+2],
2729 name_len = copy_path_name(pSMB->OldFileName, from_name);
2730 name_len2 = copy_path_name(pSMB->OldFileName+name_len+1, to_name);
2731 pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */
2736 inc_rfc1001_len(pSMB, count);
2737 pSMB->ByteCount = cpu_to_le16(count);
2739 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
2745 cifs_buf_release(pSMB);
2757 struct smb_com_transaction2_sfi_req *pSMB = NULL;
2768 rc = smb_init(SMB_COM_TRANSACTION2, 15, pTcon, (void **) &pSMB,
2774 pSMB->MaxSetupCount = 0;
2775 pSMB->Reserved = 0;
2776 pSMB->Flags = 0;
2777 pSMB->Timeout = 0;
2778 pSMB->Reserved2 = 0;
2782 data_offset = (char *) (&pSMB->hdr.Protocol) + offset;
2784 pSMB->MaxParameterCount = cpu_to_le16(2);
2785 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB from sess */
2786 pSMB->SetupCount = 1;
2787 pSMB->Reserved3 = 0;
2788 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION);
2790 pSMB->ParameterCount = cpu_to_le16(params);
2791 pSMB->TotalParameterCount = pSMB->ParameterCount;
2792 pSMB->ParameterOffset = cpu_to_le16(param_offset);
2793 pSMB->DataOffset = cpu_to_le16(offset);
2799 sprintf(dummy_string, "cifs%x", pSMB->hdr.Mid);
2812 pSMB->DataCount = cpu_to_le16(count);
2813 pSMB->TotalDataCount = pSMB->DataCount;
2814 pSMB->Fid = netfid;
2815 pSMB->InformationLevel =
2817 pSMB->Reserved4 = 0;
2818 inc_rfc1001_len(pSMB, byte_count);
2819 pSMB->ByteCount = cpu_to_le16(byte_count);
2820 rc = SendReceive(xid, pTcon->ses, (struct smb_hdr *) pSMB,
2827 cifs_buf_release(pSMB);
2841 COPY_REQ *pSMB = NULL;
2849 rc = smb_init(SMB_COM_COPY, 1, tcon, (void **) &pSMB,
2854 pSMB->BufferFormat = 0x04;
2855 pSMB->Tid2 = target_tid;
2857 pSMB->Flags = cpu_to_le16(flags & COPY_TREE);
2859 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2860 name_len = cifsConvertToUTF16((__le16 *) pSMB->OldFileName,
2865 pSMB->OldFileName[name_len] = 0x04; /* pad */
2867 pSMB->OldFileName[name_len + 1] = 0x00;
2869 cifsConvertToUTF16((__le16 *)&pSMB->OldFileName[name_len+2],
2874 name_len = copy_path_name(pSMB->OldFileName, fromName);
2875 pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */
2876 name_len2 = copy_path_name(pSMB->OldFileName+name_len+1, toName);
2881 inc_rfc1001_len(pSMB, count);
2882 pSMB->ByteCount = cpu_to_le16(count);
2884 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
2890 cifs_buf_release(pSMB);
2903 TRANSACTION2_SPI_REQ *pSMB = NULL;
2914 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
2919 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2921 cifsConvertToUTF16((__le16 *) pSMB->FileName, fromName,
2928 name_len = copy_path_name(pSMB->FileName, fromName);
2931 pSMB->MaxSetupCount = 0;
2932 pSMB->Reserved = 0;
2933 pSMB->Flags = 0;
2934 pSMB->Timeout = 0;
2935 pSMB->Reserved2 = 0;
2940 data_offset = (char *) (&pSMB->hdr.Protocol) + offset;
2941 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2952 pSMB->MaxParameterCount = cpu_to_le16(2);
2954 pSMB->MaxDataCount = cpu_to_le16(1000);
2955 pSMB->SetupCount = 1;
2956 pSMB->Reserved3 = 0;
2957 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION);
2959 pSMB->DataCount = cpu_to_le16(name_len_target);
2960 pSMB->ParameterCount = cpu_to_le16(params);
2961 pSMB->TotalDataCount = pSMB->DataCount;
2962 pSMB->TotalParameterCount = pSMB->ParameterCount;
2963 pSMB->ParameterOffset = cpu_to_le16(param_offset);
2964 pSMB->DataOffset = cpu_to_le16(offset);
2965 pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_UNIX_LINK);
2966 pSMB->Reserved4 = 0;
2967 inc_rfc1001_len(pSMB, byte_count);
2968 pSMB->ByteCount = cpu_to_le16(byte_count);
2969 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
2976 cifs_buf_release(pSMB);
2989 TRANSACTION2_SPI_REQ *pSMB = NULL;
3000 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
3005 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3006 name_len = cifsConvertToUTF16((__le16 *) pSMB->FileName, toName,
3012 name_len = copy_path_name(pSMB->FileName, toName);
3015 pSMB->MaxSetupCount = 0;
3016 pSMB->Reserved = 0;
3017 pSMB->Flags = 0;
3018 pSMB->Timeout = 0;
3019 pSMB->Reserved2 = 0;
3024 data_offset = (char *) (&pSMB->hdr.Protocol) + offset;
3025 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3035 pSMB->MaxParameterCount = cpu_to_le16(2);
3037 pSMB->MaxDataCount = cpu_to_le16(1000);
3038 pSMB->SetupCount = 1;
3039 pSMB->Reserved3 = 0;
3040 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION);
3042 pSMB->ParameterCount = cpu_to_le16(params);
3043 pSMB->TotalParameterCount = pSMB->ParameterCount;
3044 pSMB->DataCount = cpu_to_le16(name_len_target);
3045 pSMB->TotalDataCount = pSMB->DataCount;
3046 pSMB->ParameterOffset = cpu_to_le16(param_offset);
3047 pSMB->DataOffset = cpu_to_le16(offset);
3048 pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_UNIX_HLINK);
3049 pSMB->Reserved4 = 0;
3050 inc_rfc1001_len(pSMB, byte_count);
3051 pSMB->ByteCount = cpu_to_le16(byte_count);
3052 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
3059 cifs_buf_release(pSMB);
3072 NT_RENAME_REQ *pSMB = NULL;
3082 rc = smb_init(SMB_COM_NT_RENAME, 4, tcon, (void **) &pSMB,
3087 pSMB->SearchAttributes =
3090 pSMB->Flags = cpu_to_le16(CREATE_HARD_LINK);
3091 pSMB->ClusterCount = 0;
3093 pSMB->BufferFormat = 0x04;
3095 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3097 cifsConvertToUTF16((__le16 *) pSMB->OldFileName, from_name,
3103 pSMB->OldFileName[name_len] = 0x04;
3104 pSMB->OldFileName[name_len + 1] = 0x00; /* pad */
3106 cifsConvertToUTF16((__le16 *)&pSMB->OldFileName[name_len+2],
3112 name_len = copy_path_name(pSMB->OldFileName, from_name);
3113 pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */
3114 name_len2 = copy_path_name(pSMB->OldFileName+name_len+1, to_name);
3119 inc_rfc1001_len(pSMB, count);
3120 pSMB->ByteCount = cpu_to_le16(count);
3122 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
3128 cifs_buf_release(pSMB);
3141 TRANSACTION2_QPI_REQ *pSMB = NULL;
3152 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
3157 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3159 cifsConvertToUTF16((__le16 *) pSMB->FileName,
3165 name_len = copy_path_name(pSMB->FileName, searchName);
3169 pSMB->TotalDataCount = 0;
3170 pSMB->MaxParameterCount = cpu_to_le16(2);
3171 pSMB->MaxDataCount = cpu_to_le16(CIFSMaxBufSize);
3172 pSMB->MaxSetupCount = 0;
3173 pSMB->Reserved = 0;
3174 pSMB->Flags = 0;
3175 pSMB->Timeout = 0;
3176 pSMB->Reserved2 = 0;
3177 pSMB->ParameterOffset = cpu_to_le16(offsetof(
3179 pSMB->DataCount = 0;
3180 pSMB->DataOffset = 0;
3181 pSMB->SetupCount = 1;
3182 pSMB->Reserved3 = 0;
3183 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION);
3185 pSMB->TotalParameterCount = cpu_to_le16(params);
3186 pSMB->ParameterCount = pSMB->TotalParameterCount;
3187 pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_UNIX_LINK);
3188 pSMB->Reserved4 = 0;
3189 inc_rfc1001_len(pSMB, byte_count);
3190 pSMB->ByteCount = cpu_to_le16(byte_count);
3192 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
3222 cifs_buf_release(pSMB);
3245 struct smb_com_transaction_ioctl_req *pSMB;
3256 rc = smb_init(SMB_COM_NT_TRANSACT, 23, tcon, (void **) &pSMB,
3261 pSMB->TotalParameterCount = 0 ;
3262 pSMB->TotalDataCount = 0;
3263 pSMB->MaxParameterCount = cpu_to_le32(2);
3265 pSMB->MaxDataCount = cpu_to_le32(CIFSMaxBufSize & 0xFFFFFF00);
3266 pSMB->MaxSetupCount = 4;
3267 pSMB->Reserved = 0;
3268 pSMB->ParameterOffset = 0;
3269 pSMB->DataCount = 0;
3270 pSMB->DataOffset = 0;
3271 pSMB->SetupCount = 4;
3272 pSMB->SubCommand = cpu_to_le16(NT_TRANSACT_IOCTL);
3273 pSMB->ParameterCount = pSMB->TotalParameterCount;
3274 pSMB->FunctionCode = cpu_to_le32(FSCTL_GET_REPARSE_POINT);
3275 pSMB->IsFsctl = 1; /* FSCTL */
3276 pSMB->IsRootFlag = 0;
3277 pSMB->Fid = fid; /* file handle always le */
3278 pSMB->ByteCount = 0;
3280 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
3352 cifs_buf_release(pSMB);
3367 struct smb_com_transaction_compr_ioctl_req *pSMB;
3371 rc = smb_init(SMB_COM_NT_TRANSACT, 23, tcon, (void **) &pSMB,
3376 pSMB->compression_state = cpu_to_le16(COMPRESSION_FORMAT_DEFAULT);
3378 pSMB->TotalParameterCount = 0;
3379 pSMB->TotalDataCount = cpu_to_le32(2);
3380 pSMB->MaxParameterCount = 0;
3381 pSMB->MaxDataCount = 0;
3382 pSMB->MaxSetupCount = 4;
3383 pSMB->Reserved = 0;
3384 pSMB->ParameterOffset = 0;
3385 pSMB->DataCount = cpu_to_le32(2);
3386 pSMB->DataOffset =
3389 pSMB->SetupCount = 4;
3390 pSMB->SubCommand = cpu_to_le16(NT_TRANSACT_IOCTL);
3391 pSMB->ParameterCount = 0;
3392 pSMB->FunctionCode = cpu_to_le32(FSCTL_SET_COMPRESSION);
3393 pSMB->IsFsctl = 1; /* FSCTL */
3394 pSMB->IsRootFlag = 0;
3395 pSMB->Fid = fid; /* file handle always le */
3397 pSMB->ByteCount = cpu_to_le16(5);
3398 inc_rfc1001_len(pSMB, 5);
3400 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
3405 cifs_buf_release(pSMB);
3558 TRANSACTION2_QPI_REQ *pSMB = NULL;
3568 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
3573 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3575 cifsConvertToUTF16((__le16 *) pSMB->FileName,
3580 pSMB->FileName[name_len] = 0;
3581 pSMB->FileName[name_len+1] = 0;
3583 name_len = copy_path_name(pSMB->FileName, searchName);
3587 pSMB->TotalDataCount = 0;
3588 pSMB->MaxParameterCount = cpu_to_le16(2);
3590 pSMB->MaxDataCount = cpu_to_le16(4000);
3591 pSMB->MaxSetupCount = 0;
3592 pSMB->Reserved = 0;
3593 pSMB->Flags = 0;
3594 pSMB->Timeout = 0;
3595 pSMB->Reserved2 = 0;
3596 pSMB->ParameterOffset = cpu_to_le16(
3599 pSMB->DataCount = 0;
3600 pSMB->DataOffset = 0;
3601 pSMB->SetupCount = 1;
3602 pSMB->Reserved3 = 0;
3603 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION);
3605 pSMB->TotalParameterCount = cpu_to_le16(params);
3606 pSMB->ParameterCount = pSMB->TotalParameterCount;
3607 pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_POSIX_ACL);
3608 pSMB->Reserved4 = 0;
3609 inc_rfc1001_len(pSMB, byte_count);
3610 pSMB->ByteCount = cpu_to_le16(byte_count);
3612 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
3632 cifs_buf_release(pSMB);
3645 struct smb_com_transaction2_spi_req *pSMB = NULL;
3655 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
3659 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3661 cifsConvertToUTF16((__le16 *) pSMB->FileName, fileName,
3666 name_len = copy_path_name(pSMB->FileName, fileName);
3669 pSMB->MaxParameterCount = cpu_to_le16(2);
3671 pSMB->MaxDataCount = cpu_to_le16(1000);
3672 pSMB->MaxSetupCount = 0;
3673 pSMB->Reserved = 0;
3674 pSMB->Flags = 0;
3675 pSMB->Timeout = 0;
3676 pSMB->Reserved2 = 0;
3680 parm_data = ((char *) &pSMB->hdr.Protocol) + offset;
3681 pSMB->ParameterOffset = cpu_to_le16(param_offset);
3690 pSMB->DataOffset = cpu_to_le16(offset);
3691 pSMB->SetupCount = 1;
3692 pSMB->Reserved3 = 0;
3693 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION);
3694 pSMB->InformationLevel = cpu_to_le16(SMB_SET_POSIX_ACL);
3696 pSMB->DataCount = cpu_to_le16(data_count);
3697 pSMB->TotalDataCount = pSMB->DataCount;
3698 pSMB->ParameterCount = cpu_to_le16(params);
3699 pSMB->TotalParameterCount = pSMB->ParameterCount;
3700 pSMB->Reserved4 = 0;
3701 inc_rfc1001_len(pSMB, byte_count);
3702 pSMB->ByteCount = cpu_to_le16(byte_count);
3703 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
3709 cifs_buf_release(pSMB);
3721 struct smb_t2_qfi_req *pSMB = NULL;
3731 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
3737 pSMB->t2.TotalDataCount = 0;
3738 pSMB->t2.MaxParameterCount = cpu_to_le16(4);
3740 pSMB->t2.MaxDataCount = cpu_to_le16(4000);
3741 pSMB->t2.MaxSetupCount = 0;
3742 pSMB->t2.Reserved = 0;
3743 pSMB->t2.Flags = 0;
3744 pSMB->t2.Timeout = 0;
3745 pSMB->t2.Reserved2 = 0;
3746 pSMB->t2.ParameterOffset = cpu_to_le16(offsetof(struct smb_t2_qfi_req,
3748 pSMB->t2.DataCount = 0;
3749 pSMB->t2.DataOffset = 0;
3750 pSMB->t2.SetupCount = 1;
3751 pSMB->t2.Reserved3 = 0;
3752 pSMB->t2.SubCommand = cpu_to_le16(TRANS2_QUERY_FILE_INFORMATION);
3754 pSMB->t2.TotalParameterCount = cpu_to_le16(params);
3755 pSMB->t2.ParameterCount = pSMB->t2.TotalParameterCount;
3756 pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_ATTR_FLAGS);
3757 pSMB->Pad = 0;
3758 pSMB->Fid = netfid;
3759 inc_rfc1001_len(pSMB, byte_count);
3760 pSMB->t2.ByteCount = cpu_to_le16(byte_count);
3762 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
3791 cifs_buf_release(pSMB);
3814 struct smb_com_ntransact_req *pSMB;
3817 (void **)&pSMB);
3820 *ret_buf = (void *)pSMB;
3821 pSMB->Reserved = 0;
3822 pSMB->TotalParameterCount = cpu_to_le32(parm_len);
3823 pSMB->TotalDataCount = 0;
3824 pSMB->MaxDataCount = cpu_to_le32(CIFSMaxBufSize & 0xFFFFFF00);
3825 pSMB->ParameterCount = pSMB->TotalParameterCount;
3826 pSMB->DataCount = pSMB->TotalDataCount;
3829 pSMB->ParameterOffset = cpu_to_le32(temp_offset);
3830 pSMB->DataOffset = cpu_to_le32(temp_offset + parm_len);
3831 pSMB->SetupCount = setup_count; /* no need to le convert byte fields */
3832 pSMB->SubCommand = cpu_to_le16(sub_command);
3896 QUERY_SEC_DESC_REQ *pSMB;
3906 8 /* parm len */, tcon, (void **) &pSMB);
3910 pSMB->MaxParameterCount = cpu_to_le32(4);
3912 pSMB->MaxSetupCount = 0;
3913 pSMB->Fid = fid; /* file handle always le */
3914 pSMB->AclFlags = cpu_to_le32(CIFS_ACL_OWNER | CIFS_ACL_GROUP |
3916 pSMB->ByteCount = cpu_to_le16(11); /* 3 bytes pad + 8 bytes parm */
3917 inc_rfc1001_len(pSMB, 11);
3918 iov[0].iov_base = (char *)pSMB;
3919 iov[0].iov_len = be32_to_cpu(pSMB->hdr.smb_buf_length) + 4;
3923 cifs_small_buf_release(pSMB);
3987 SET_SEC_DESC_REQ *pSMB = NULL;
3991 rc = smb_init(SMB_COM_NT_TRANSACT, 19, tcon, (void **) &pSMB, &pSMBr);
3995 pSMB->MaxSetupCount = 0;
3996 pSMB->Reserved = 0;
4004 pSMB->DataCount = cpu_to_le32(data_count);
4005 pSMB->TotalDataCount = pSMB->DataCount;
4006 pSMB->MaxParameterCount = cpu_to_le32(4);
4007 pSMB->MaxDataCount = cpu_to_le32(16384);
4008 pSMB->ParameterCount = cpu_to_le32(param_count);
4009 pSMB->ParameterOffset = cpu_to_le32(param_offset);
4010 pSMB->TotalParameterCount = pSMB->ParameterCount;
4011 pSMB->DataOffset = cpu_to_le32(data_offset);
4012 pSMB->SetupCount = 0;
4013 pSMB->SubCommand = cpu_to_le16(NT_TRANSACT_SET_SECURITY_DESC);
4014 pSMB->ByteCount = cpu_to_le16(byte_count+data_count);
4016 pSMB->Fid = fid; /* file handle always le */
4017 pSMB->Reserved2 = 0;
4018 pSMB->AclFlags = cpu_to_le32(aclflag);
4023 inc_rfc1001_len(pSMB, byte_count + data_count);
4025 inc_rfc1001_len(pSMB, byte_count);
4027 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
4034 cifs_buf_release(pSMB);
4050 QUERY_INFORMATION_REQ *pSMB;
4058 rc = smb_init(SMB_COM_QUERY_INFORMATION, 0, tcon, (void **) &pSMB,
4063 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
4065 cifsConvertToUTF16((__le16 *) pSMB->FileName,
4071 name_len = copy_path_name(pSMB->FileName, search_name);
4073 pSMB->BufferFormat = 0x04;
4075 inc_rfc1001_len(pSMB, (__u16)name_len);
4076 pSMB->ByteCount = cpu_to_le16(name_len);
4078 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
4103 cifs_buf_release(pSMB);
4115 struct smb_t2_qfi_req *pSMB = NULL;
4122 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
4128 pSMB->t2.TotalDataCount = 0;
4129 pSMB->t2.MaxParameterCount = cpu_to_le16(4);
4131 pSMB->t2.MaxDataCount = cpu_to_le16(CIFSMaxBufSize);
4132 pSMB->t2.MaxSetupCount = 0;
4133 pSMB->t2.Reserved = 0;
4134 pSMB->t2.Flags = 0;
4135 pSMB->t2.Timeout = 0;
4136 pSMB->t2.Reserved2 = 0;
4137 pSMB->t2.ParameterOffset = cpu_to_le16(offsetof(struct smb_t2_qfi_req,
4139 pSMB->t2.DataCount = 0;
4140 pSMB->t2.DataOffset = 0;
4141 pSMB->t2.SetupCount = 1;
4142 pSMB->t2.Reserved3 = 0;
4143 pSMB->t2.SubCommand = cpu_to_le16(TRANS2_QUERY_FILE_INFORMATION);
4145 pSMB->t2.TotalParameterCount = cpu_to_le16(params);
4146 pSMB->t2.ParameterCount = pSMB->t2.TotalParameterCount;
4147 pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_ALL_INFO);
4148 pSMB->Pad = 0;
4149 pSMB->Fid = netfid;
4150 inc_rfc1001_len(pSMB, byte_count);
4151 pSMB->t2.ByteCount = cpu_to_le16(byte_count);
4153 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
4172 cifs_buf_release(pSMB);
4186 TRANSACTION2_QPI_REQ *pSMB = NULL;
4195 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
4200 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
4202 cifsConvertToUTF16((__le16 *) pSMB->FileName, search_name,
4207 name_len = copy_path_name(pSMB->FileName, search_name);
4211 pSMB->TotalDataCount = 0;
4212 pSMB->MaxParameterCount = cpu_to_le16(2);
4214 pSMB->MaxDataCount = cpu_to_le16(4000);
4215 pSMB->MaxSetupCount = 0;
4216 pSMB->Reserved = 0;
4217 pSMB->Flags = 0;
4218 pSMB->Timeout = 0;
4219 pSMB->Reserved2 = 0;
4220 pSMB->ParameterOffset = cpu_to_le16(offsetof(
4222 pSMB->DataCount = 0;
4223 pSMB->DataOffset = 0;
4224 pSMB->SetupCount = 1;
4225 pSMB->Reserved3 = 0;
4226 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION);
4228 pSMB->TotalParameterCount = cpu_to_le16(params);
4229 pSMB->ParameterCount = pSMB->TotalParameterCount;
4231 pSMB->InformationLevel = cpu_to_le16(SMB_INFO_STANDARD);
4233 pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_ALL_INFO);
4234 pSMB->Reserved4 = 0;
4235 inc_rfc1001_len(pSMB, byte_count);
4236 pSMB->ByteCount = cpu_to_le16(byte_count);
4238 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
4271 cifs_buf_release(pSMB);
4282 struct smb_t2_qfi_req *pSMB = NULL;
4289 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
4295 pSMB->t2.TotalDataCount = 0;
4296 pSMB->t2.MaxParameterCount = cpu_to_le16(4);
4298 pSMB->t2.MaxDataCount = cpu_to_le16(CIFSMaxBufSize);
4299 pSMB->t2.MaxSetupCount = 0;
4300 pSMB->t2.Reserved = 0;
4301 pSMB->t2.Flags = 0;
4302 pSMB->t2.Timeout = 0;
4303 pSMB->t2.Reserved2 = 0;
4304 pSMB->t2.ParameterOffset = cpu_to_le16(offsetof(struct smb_t2_qfi_req,
4306 pSMB->t2.DataCount = 0;
4307 pSMB->t2.DataOffset = 0;
4308 pSMB->t2.SetupCount = 1;
4309 pSMB->t2.Reserved3 = 0;
4310 pSMB->t2.SubCommand = cpu_to_le16(TRANS2_QUERY_FILE_INFORMATION);
4312 pSMB->t2.TotalParameterCount = cpu_to_le16(params);
4313 pSMB->t2.ParameterCount = pSMB->t2.TotalParameterCount;
4314 pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_UNIX_BASIC);
4315 pSMB->Pad = 0;
4316 pSMB->Fid = netfid;
4317 inc_rfc1001_len(pSMB, byte_count);
4318 pSMB->t2.ByteCount = cpu_to_le16(byte_count);
4320 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
4339 cifs_buf_release(pSMB);
4353 TRANSACTION2_QPI_REQ *pSMB = NULL;
4362 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
4367 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
4369 cifsConvertToUTF16((__le16 *) pSMB->FileName, searchName,
4374 name_len = copy_path_name(pSMB->FileName, searchName);
4378 pSMB->TotalDataCount = 0;
4379 pSMB->MaxParameterCount = cpu_to_le16(2);
4381 pSMB->MaxDataCount = cpu_to_le16(4000);
4382 pSMB->MaxSetupCount = 0;
4383 pSMB->Reserved = 0;
4384 pSMB->Flags = 0;
4385 pSMB->Timeout = 0;
4386 pSMB->Reserved2 = 0;
4387 pSMB->ParameterOffset = cpu_to_le16(offsetof(
4389 pSMB->DataCount = 0;
4390 pSMB->DataOffset = 0;
4391 pSMB->SetupCount = 1;
4392 pSMB->Reserved3 = 0;
4393 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION);
4395 pSMB->TotalParameterCount = cpu_to_le16(params);
4396 pSMB->ParameterCount = pSMB->TotalParameterCount;
4397 pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_UNIX_BASIC);
4398 pSMB->Reserved4 = 0;
4399 inc_rfc1001_len(pSMB, byte_count);
4400 pSMB->ByteCount = cpu_to_le16(byte_count);
4402 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
4420 cifs_buf_release(pSMB);
4435 TRANSACTION2_FFIRST_REQ *pSMB = NULL;
4447 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
4455 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
4457 cifsConvertToUTF16((__le16 *) pSMB->FileName, searchName,
4464 pSMB->FileName[name_len] = CIFS_DIR_SEP(cifs_sb);
4465 pSMB->FileName[name_len+1] = 0;
4466 pSMB->FileName[name_len+2] = '*';
4467 pSMB->FileName[name_len+3] = 0;
4470 pSMB->FileName[name_len] = 0;
4471 pSMB->FileName[name_len+1] = 0;
4475 name_len = copy_path_name(pSMB->FileName, searchName);
4480 pSMB->FileName[name_len-1] = CIFS_DIR_SEP(cifs_sb);
4481 pSMB->FileName[name_len] = '*';
4482 pSMB->FileName[name_len+1] = 0;
4488 pSMB->TotalDataCount = 0; /* no EAs */
4489 pSMB->MaxParameterCount = cpu_to_le16(10);
4490 pSMB->MaxDataCount = cpu_to_le16(CIFSMaxBufSize & 0xFFFFFF00);
4491 pSMB->MaxSetupCount = 0;
4492 pSMB->Reserved = 0;
4493 pSMB->Flags = 0;
4494 pSMB->Timeout = 0;
4495 pSMB->Reserved2 = 0;
4497 pSMB->TotalParameterCount = cpu_to_le16(params);
4498 pSMB->ParameterCount = pSMB->TotalParameterCount;
4499 pSMB->ParameterOffset = cpu_to_le16(
4502 pSMB->DataCount = 0;
4503 pSMB->DataOffset = 0;
4504 pSMB->SetupCount = 1; /* one byte, no need to make endian neutral */
4505 pSMB->Reserved3 = 0;
4506 pSMB->SubCommand = cpu_to_le16(TRANS2_FIND_FIRST);
4507 pSMB->SearchAttributes =
4510 pSMB->SearchCount = cpu_to_le16(CIFSMaxBufSize/sizeof(FILE_UNIX_INFO));
4511 pSMB->SearchFlags = cpu_to_le16(search_flags);
4512 pSMB->InformationLevel = cpu_to_le16(psrch_inf->info_level);
4515 pSMB->SearchStorageType = 0;
4516 inc_rfc1001_len(pSMB, byte_count);
4517 pSMB->ByteCount = cpu_to_le16(byte_count);
4519 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
4528 cifs_buf_release(pSMB);
4575 cifs_buf_release(pSMB);
4586 TRANSACTION2_FNEXT_REQ *pSMB = NULL;
4600 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
4607 pSMB->TotalDataCount = 0; /* no EAs */
4608 pSMB->MaxParameterCount = cpu_to_le16(8);
4609 pSMB->MaxDataCount = cpu_to_le16(CIFSMaxBufSize & 0xFFFFFF00);
4610 pSMB->MaxSetupCount = 0;
4611 pSMB->Reserved = 0;
4612 pSMB->Flags = 0;
4613 pSMB->Timeout = 0;
4614 pSMB->Reserved2 = 0;
4615 pSMB->ParameterOffset = cpu_to_le16(
4617 pSMB->DataCount = 0;
4618 pSMB->DataOffset = 0;
4619 pSMB->SetupCount = 1;
4620 pSMB->Reserved3 = 0;
4621 pSMB->SubCommand = cpu_to_le16(TRANS2_FIND_NEXT);
4622 pSMB->SearchHandle = searchHandle; /* always kept as le */
4623 pSMB->SearchCount =
4625 pSMB->InformationLevel = cpu_to_le16(psrch_inf->info_level);
4626 pSMB->ResumeKey = psrch_inf->resume_key;
4627 pSMB->SearchFlags = cpu_to_le16(search_flags);
4632 memcpy(pSMB->ResumeFileName, psrch_inf->presume_name, name_len);
4635 pSMB->ResumeFileName[name_len] = 0;
4636 pSMB->ResumeFileName[name_len+1] = 0;
4642 pSMB->TotalParameterCount = cpu_to_le16(params);
4643 pSMB->ParameterCount = pSMB->TotalParameterCount;
4644 inc_rfc1001_len(pSMB, byte_count);
4645 pSMB->ByteCount = cpu_to_le16(byte_count);
4647 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
4653 cifs_buf_release(pSMB);
4679 psrch_inf->ntwrk_buf_start = (char *)pSMB;
4713 cifs_buf_release(pSMB);
4722 FINDCLOSE_REQ *pSMB = NULL;
4725 rc = small_smb_init(SMB_COM_FIND_CLOSE2, 1, tcon, (void **)&pSMB);
4734 pSMB->FileID = searchHandle;
4735 pSMB->ByteCount = 0;
4736 rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0);
4737 cifs_small_buf_release(pSMB);
4756 TRANSACTION2_QPI_REQ *pSMB = NULL;
4766 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
4771 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
4773 cifsConvertToUTF16((__le16 *) pSMB->FileName,
4779 name_len = copy_path_name(pSMB->FileName, search_name);
4783 pSMB->TotalDataCount = 0;
4784 pSMB->MaxParameterCount = cpu_to_le16(2);
4786 pSMB->MaxDataCount = cpu_to_le16(4000);
4787 pSMB->MaxSetupCount = 0;
4788 pSMB->Reserved = 0;
4789 pSMB->Flags = 0;
4790 pSMB->Timeout = 0;
4791 pSMB->Reserved2 = 0;
4792 pSMB->ParameterOffset = cpu_to_le16(offsetof(
4794 pSMB->DataCount = 0;
4795 pSMB->DataOffset = 0;
4796 pSMB->SetupCount = 1;
4797 pSMB->Reserved3 = 0;
4798 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION);
4800 pSMB->TotalParameterCount = cpu_to_le16(params);
4801 pSMB->ParameterCount = pSMB->TotalParameterCount;
4802 pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_INTERNAL_INFO);
4803 pSMB->Reserved4 = 0;
4804 inc_rfc1001_len(pSMB, byte_count);
4805 pSMB->ByteCount = cpu_to_le16(byte_count);
4807 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
4835 cifs_buf_release(pSMB);
4848 TRANSACTION2_GET_DFS_REFER_REQ *pSMB = NULL;
4868 (void **)&pSMB, (void **)&pSMBr);
4874 pSMB->hdr.Mid = get_next_mid(ses->server);
4875 pSMB->hdr.Tid = ses->tcon_ipc->tid;
4876 pSMB->hdr.Uid = ses->Suid;
4878 pSMB->hdr.Flags2 |= SMBFLG2_ERR_STATUS;
4880 pSMB->hdr.Flags2 |= SMBFLG2_DFS;
4883 pSMB->hdr.Flags2 |= SMBFLG2_UNICODE;
4885 cifsConvertToUTF16((__le16 *) pSMB->RequestFileName,
4891 name_len = copy_path_name(pSMB->RequestFileName, search_name);
4895 pSMB->hdr.Flags2 |= SMBFLG2_SECURITY_SIGNATURE;
4897 pSMB->hdr.Uid = ses->Suid;
4900 pSMB->TotalDataCount = 0;
4901 pSMB->DataCount = 0;
4902 pSMB->DataOffset = 0;
4903 pSMB->MaxParameterCount = 0;
4905 pSMB->MaxDataCount = cpu_to_le16(4000);
4906 pSMB->MaxSetupCount = 0;
4907 pSMB->Reserved = 0;
4908 pSMB->Flags = 0;
4909 pSMB->Timeout = 0;
4910 pSMB->Reserved2 = 0;
4911 pSMB->ParameterOffset = cpu_to_le16(offsetof(
4913 pSMB->SetupCount = 1;
4914 pSMB->Reserved3 = 0;
4915 pSMB->SubCommand = cpu_to_le16(TRANS2_GET_DFS_REFERRAL);
4917 pSMB->ParameterCount = cpu_to_le16(params);
4918 pSMB->TotalParameterCount = pSMB->ParameterCount;
4919 pSMB->MaxReferralLevel = cpu_to_le16(3);
4920 inc_rfc1001_len(pSMB, byte_count);
4921 pSMB->ByteCount = cpu_to_le16(byte_count);
4923 rc = SendReceive(xid, ses, (struct smb_hdr *) pSMB,
4948 cifs_buf_release(pSMB);
4962 TRANSACTION2_QFSI_REQ *pSMB = NULL;
4971 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
4977 pSMB->TotalDataCount = 0;
4978 pSMB->MaxParameterCount = cpu_to_le16(2);
4979 pSMB->MaxDataCount = cpu_to_le16(1000);
4980 pSMB->MaxSetupCount = 0;
4981 pSMB->Reserved = 0;
4982 pSMB->Flags = 0;
4983 pSMB->Timeout = 0;
4984 pSMB->Reserved2 = 0;
4986 pSMB->TotalParameterCount = cpu_to_le16(params);
4987 pSMB->ParameterCount = pSMB->TotalParameterCount;
4988 pSMB->ParameterOffset = cpu_to_le16(offsetof(
4990 pSMB->DataCount = 0;
4991 pSMB->DataOffset = 0;
4992 pSMB->SetupCount = 1;
4993 pSMB->Reserved3 = 0;
4994 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION);
4995 pSMB->InformationLevel = cpu_to_le16(SMB_INFO_ALLOCATION);
4996 inc_rfc1001_len(pSMB, byte_count);
4997 pSMB->ByteCount = cpu_to_le16(byte_count);
4999 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
5036 cifs_buf_release(pSMB);
5049 TRANSACTION2_QFSI_REQ *pSMB = NULL;
5058 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
5064 pSMB->TotalDataCount = 0;
5065 pSMB->MaxParameterCount = cpu_to_le16(2);
5066 pSMB->MaxDataCount = cpu_to_le16(1000);
5067 pSMB->MaxSetupCount = 0;
5068 pSMB->Reserved = 0;
5069 pSMB->Flags = 0;
5070 pSMB->Timeout = 0;
5071 pSMB->Reserved2 = 0;
5073 pSMB->TotalParameterCount = cpu_to_le16(params);
5074 pSMB->ParameterCount = pSMB->TotalParameterCount;
5075 pSMB->ParameterOffset = cpu_to_le16(offsetof(
5077 pSMB->DataCount = 0;
5078 pSMB->DataOffset = 0;
5079 pSMB->SetupCount = 1;
5080 pSMB->Reserved3 = 0;
5081 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION);
5082 pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FS_SIZE_INFO);
5083 inc_rfc1001_len(pSMB, byte_count);
5084 pSMB->ByteCount = cpu_to_le16(byte_count);
5086 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
5123 cifs_buf_release(pSMB);
5135 TRANSACTION2_QFSI_REQ *pSMB = NULL;
5144 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
5150 pSMB->TotalDataCount = 0;
5151 pSMB->MaxParameterCount = cpu_to_le16(2);
5153 pSMB->MaxDataCount = cpu_to_le16(1000);
5154 pSMB->MaxSetupCount = 0;
5155 pSMB->Reserved = 0;
5156 pSMB->Flags = 0;
5157 pSMB->Timeout = 0;
5158 pSMB->Reserved2 = 0;
5160 pSMB->TotalParameterCount = cpu_to_le16(params);
5161 pSMB->ParameterCount = pSMB->TotalParameterCount;
5162 pSMB->ParameterOffset = cpu_to_le16(offsetof(
5164 pSMB->DataCount = 0;
5165 pSMB->DataOffset = 0;
5166 pSMB->SetupCount = 1;
5167 pSMB->Reserved3 = 0;
5168 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION);
5169 pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FS_ATTRIBUTE_INFO);
5170 inc_rfc1001_len(pSMB, byte_count);
5171 pSMB->ByteCount = cpu_to_le16(byte_count);
5173 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
5193 cifs_buf_release(pSMB);
5205 TRANSACTION2_QFSI_REQ *pSMB = NULL;
5214 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
5220 pSMB->TotalDataCount = 0;
5221 pSMB->MaxParameterCount = cpu_to_le16(2);
5223 pSMB->MaxDataCount = cpu_to_le16(1000);
5224 pSMB->MaxSetupCount = 0;
5225 pSMB->Reserved = 0;
5226 pSMB->Flags = 0;
5227 pSMB->Timeout = 0;
5228 pSMB->Reserved2 = 0;
5230 pSMB->TotalParameterCount = cpu_to_le16(params);
5231 pSMB->ParameterCount = pSMB->TotalParameterCount;
5232 pSMB->ParameterOffset = cpu_to_le16(offsetof(
5235 pSMB->DataCount = 0;
5236 pSMB->DataOffset = 0;
5237 pSMB->SetupCount = 1;
5238 pSMB->Reserved3 = 0;
5239 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION);
5240 pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FS_DEVICE_INFO);
5241 inc_rfc1001_len(pSMB, byte_count);
5242 pSMB->ByteCount = cpu_to_le16(byte_count);
5244 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
5264 cifs_buf_release(pSMB);
5276 TRANSACTION2_QFSI_REQ *pSMB = NULL;
5286 (void **) &pSMB, (void **) &pSMBr);
5291 pSMB->TotalDataCount = 0;
5292 pSMB->DataCount = 0;
5293 pSMB->DataOffset = 0;
5294 pSMB->MaxParameterCount = cpu_to_le16(2);
5296 pSMB->MaxDataCount = cpu_to_le16(100);
5297 pSMB->MaxSetupCount = 0;
5298 pSMB->Reserved = 0;
5299 pSMB->Flags = 0;
5300 pSMB->Timeout = 0;
5301 pSMB->Reserved2 = 0;
5303 pSMB->ParameterCount = cpu_to_le16(params);
5304 pSMB->TotalParameterCount = pSMB->ParameterCount;
5305 pSMB->ParameterOffset = cpu_to_le16(offsetof(struct
5307 pSMB->SetupCount = 1;
5308 pSMB->Reserved3 = 0;
5309 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION);
5310 pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_CIFS_UNIX_INFO);
5311 inc_rfc1001_len(pSMB, byte_count);
5312 pSMB->ByteCount = cpu_to_le16(byte_count);
5314 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
5333 cifs_buf_release(pSMB);
5346 TRANSACTION2_SETFSI_REQ *pSMB = NULL;
5356 (void **) &pSMB, (void **) &pSMBr);
5361 pSMB->MaxSetupCount = 0;
5362 pSMB->Reserved = 0;
5363 pSMB->Flags = 0;
5364 pSMB->Timeout = 0;
5365 pSMB->Reserved2 = 0;
5370 pSMB->MaxParameterCount = cpu_to_le16(4);
5372 pSMB->MaxDataCount = cpu_to_le16(100);
5373 pSMB->SetupCount = 1;
5374 pSMB->Reserved3 = 0;
5375 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FS_INFORMATION);
5378 pSMB->DataCount = cpu_to_le16(12);
5379 pSMB->ParameterCount = cpu_to_le16(params);
5380 pSMB->TotalDataCount = pSMB->DataCount;
5381 pSMB->TotalParameterCount = pSMB->ParameterCount;
5382 pSMB->ParameterOffset = cpu_to_le16(param_offset);
5383 pSMB->DataOffset = cpu_to_le16(offset);
5386 pSMB->FileNum = 0;
5387 pSMB->InformationLevel = cpu_to_le16(SMB_SET_CIFS_UNIX_INFO);
5390 pSMB->ClientUnixMajor = cpu_to_le16(CIFS_UNIX_MAJOR_VERSION);
5391 pSMB->ClientUnixMinor = cpu_to_le16(CIFS_UNIX_MINOR_VERSION);
5392 pSMB->ClientUnixCap = cpu_to_le64(cap);
5394 inc_rfc1001_len(pSMB, byte_count);
5395 pSMB->ByteCount = cpu_to_le16(byte_count);
5397 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
5406 cifs_buf_release(pSMB);
5421 TRANSACTION2_QFSI_REQ *pSMB = NULL;
5430 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
5436 pSMB->TotalDataCount = 0;
5437 pSMB->DataCount = 0;
5438 pSMB->DataOffset = 0;
5439 pSMB->MaxParameterCount = cpu_to_le16(2);
5441 pSMB->MaxDataCount = cpu_to_le16(100);
5442 pSMB->MaxSetupCount = 0;
5443 pSMB->Reserved = 0;
5444 pSMB->Flags = 0;
5445 pSMB->Timeout = 0;
5446 pSMB->Reserved2 = 0;
5448 pSMB->ParameterCount = cpu_to_le16(params);
5449 pSMB->TotalParameterCount = pSMB->ParameterCount;
5450 pSMB->ParameterOffset = cpu_to_le16(offsetof(struct
5452 pSMB->SetupCount = 1;
5453 pSMB->Reserved3 = 0;
5454 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION);
5455 pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_POSIX_FS_INFO);
5456 inc_rfc1001_len(pSMB, byte_count);
5457 pSMB->ByteCount = cpu_to_le16(byte_count);
5459 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
5501 cifs_buf_release(pSMB);
5521 struct smb_com_transaction2_spi_req *pSMB = NULL;
5533 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
5538 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
5540 cifsConvertToUTF16((__le16 *) pSMB->FileName, file_name,
5545 name_len = copy_path_name(pSMB->FileName, file_name);
5549 pSMB->MaxParameterCount = cpu_to_le16(2);
5550 pSMB->MaxDataCount = cpu_to_le16(4100);
5551 pSMB->MaxSetupCount = 0;
5552 pSMB->Reserved = 0;
5553 pSMB->Flags = 0;
5554 pSMB->Timeout = 0;
5555 pSMB->Reserved2 = 0;
5561 pSMB->InformationLevel =
5564 pSMB->InformationLevel =
5568 pSMB->InformationLevel =
5571 pSMB->InformationLevel =
5576 (struct file_end_of_file_info *) (((char *) &pSMB->hdr.Protocol) +
5578 pSMB->ParameterOffset = cpu_to_le16(param_offset);
5579 pSMB->DataOffset = cpu_to_le16(offset);
5580 pSMB->SetupCount = 1;
5581 pSMB->Reserved3 = 0;
5582 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION);
5584 pSMB->DataCount = cpu_to_le16(data_count);
5585 pSMB->TotalDataCount = pSMB->DataCount;
5586 pSMB->ParameterCount = cpu_to_le16(params);
5587 pSMB->TotalParameterCount = pSMB->ParameterCount;
5588 pSMB->Reserved4 = 0;
5589 inc_rfc1001_len(pSMB, byte_count);
5591 pSMB->ByteCount = cpu_to_le16(byte_count);
5592 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
5597 cifs_buf_release(pSMB);
5609 struct smb_com_transaction2_sfi_req *pSMB = NULL;
5616 rc = small_smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB);
5621 pSMB->hdr.Pid = cpu_to_le16((__u16)cfile->pid);
5622 pSMB->hdr.PidHigh = cpu_to_le16((__u16)(cfile->pid >> 16));
5625 pSMB->MaxSetupCount = 0;
5626 pSMB->Reserved = 0;
5627 pSMB->Flags = 0;
5628 pSMB->Timeout = 0;
5629 pSMB->Reserved2 = 0;
5634 pSMB->MaxParameterCount = cpu_to_le16(2);
5636 pSMB->MaxDataCount = cpu_to_le16(1000);
5637 pSMB->SetupCount = 1;
5638 pSMB->Reserved3 = 0;
5639 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION);
5641 pSMB->DataCount = cpu_to_le16(count);
5642 pSMB->ParameterCount = cpu_to_le16(params);
5643 pSMB->TotalDataCount = pSMB->DataCount;
5644 pSMB->TotalParameterCount = pSMB->ParameterCount;
5645 pSMB->ParameterOffset = cpu_to_le16(param_offset);
5647 (struct file_end_of_file_info *) (((char *) &pSMB->hdr.Protocol)
5649 pSMB->DataOffset = cpu_to_le16(offset);
5651 pSMB->Fid = cfile->fid.netfid;
5654 pSMB->InformationLevel =
5657 pSMB->InformationLevel =
5661 pSMB->InformationLevel =
5664 pSMB->InformationLevel =
5667 pSMB->Reserved4 = 0;
5668 inc_rfc1001_len(pSMB, byte_count);
5669 pSMB->ByteCount = cpu_to_le16(byte_count);
5670 rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0);
5671 cifs_small_buf_release(pSMB);
5693 struct smb_com_transaction2_sfi_req *pSMB = NULL;
5699 rc = small_smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB);
5704 pSMB->hdr.Pid = cpu_to_le16((__u16)pid_of_opener);
5705 pSMB->hdr.PidHigh = cpu_to_le16((__u16)(pid_of_opener >> 16));
5708 pSMB->MaxSetupCount = 0;
5709 pSMB->Reserved = 0;
5710 pSMB->Flags = 0;
5711 pSMB->Timeout = 0;
5712 pSMB->Reserved2 = 0;
5716 data_offset = (char *)pSMB +
5720 pSMB->MaxParameterCount = cpu_to_le16(2);
5722 pSMB->MaxDataCount = cpu_to_le16(1000);
5723 pSMB->SetupCount = 1;
5724 pSMB->Reserved3 = 0;
5725 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION);
5727 pSMB->DataCount = cpu_to_le16(count);
5728 pSMB->ParameterCount = cpu_to_le16(params);
5729 pSMB->TotalDataCount = pSMB->DataCount;
5730 pSMB->TotalParameterCount = pSMB->ParameterCount;
5731 pSMB->ParameterOffset = cpu_to_le16(param_offset);
5732 pSMB->DataOffset = cpu_to_le16(offset);
5733 pSMB->Fid = fid;
5735 pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_BASIC_INFO2);
5737 pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_BASIC_INFO);
5738 pSMB->Reserved4 = 0;
5739 inc_rfc1001_len(pSMB, byte_count);
5740 pSMB->ByteCount = cpu_to_le16(byte_count);
5742 rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0);
5743 cifs_small_buf_release(pSMB);
5758 struct smb_com_transaction2_sfi_req *pSMB = NULL;
5764 rc = small_smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB);
5769 pSMB->hdr.Pid = cpu_to_le16((__u16)pid_of_opener);
5770 pSMB->hdr.PidHigh = cpu_to_le16((__u16)(pid_of_opener >> 16));
5773 pSMB->MaxSetupCount = 0;
5774 pSMB->Reserved = 0;
5775 pSMB->Flags = 0;
5776 pSMB->Timeout = 0;
5777 pSMB->Reserved2 = 0;
5781 data_offset = (char *) (&pSMB->hdr.Protocol) + offset;
5784 pSMB->MaxParameterCount = cpu_to_le16(2);
5786 pSMB->MaxDataCount = cpu_to_le16(1000);
5787 pSMB->SetupCount = 1;
5788 pSMB->Reserved3 = 0;
5789 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION);
5791 pSMB->DataCount = cpu_to_le16(count);
5792 pSMB->ParameterCount = cpu_to_le16(params);
5793 pSMB->TotalDataCount = pSMB->DataCount;
5794 pSMB->TotalParameterCount = pSMB->ParameterCount;
5795 pSMB->ParameterOffset = cpu_to_le16(param_offset);
5796 pSMB->DataOffset = cpu_to_le16(offset);
5797 pSMB->Fid = fid;
5798 pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_DISPOSITION_INFO);
5799 pSMB->Reserved4 = 0;
5800 inc_rfc1001_len(pSMB, byte_count);
5801 pSMB->ByteCount = cpu_to_le16(byte_count);
5803 rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0);
5804 cifs_small_buf_release(pSMB);
5848 TRANSACTION2_SPI_REQ *pSMB = NULL;
5860 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
5865 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
5867 cifsConvertToUTF16((__le16 *) pSMB->FileName, fileName,
5872 name_len = copy_path_name(pSMB->FileName, fileName);
5877 pSMB->MaxParameterCount = cpu_to_le16(2);
5879 pSMB->MaxDataCount = cpu_to_le16(1000);
5880 pSMB->MaxSetupCount = 0;
5881 pSMB->Reserved = 0;
5882 pSMB->Flags = 0;
5883 pSMB->Timeout = 0;
5884 pSMB->Reserved2 = 0;
5888 data_offset = (char *) (&pSMB->hdr.Protocol) + offset;
5889 pSMB->ParameterOffset = cpu_to_le16(param_offset);
5890 pSMB->DataOffset = cpu_to_le16(offset);
5891 pSMB->SetupCount = 1;
5892 pSMB->Reserved3 = 0;
5893 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION);
5896 pSMB->DataCount = cpu_to_le16(count);
5897 pSMB->ParameterCount = cpu_to_le16(params);
5898 pSMB->TotalDataCount = pSMB->DataCount;
5899 pSMB->TotalParameterCount = pSMB->ParameterCount;
5901 pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_BASIC_INFO2);
5903 pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_BASIC_INFO);
5904 pSMB->Reserved4 = 0;
5905 inc_rfc1001_len(pSMB, byte_count);
5907 pSMB->ByteCount = cpu_to_le16(byte_count);
5908 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
5913 cifs_buf_release(pSMB);
5934 SETATTR_REQ *pSMB = NULL;
5943 rc = smb_init(SMB_COM_SETATTR, 8, tcon, (void **) &pSMB,
5948 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
5950 ConvertToUTF16((__le16 *) pSMB->fileName, fileName,
5955 name_len = copy_path_name(pSMB->fileName, fileName);
5957 pSMB->attr = cpu_to_le16(dos_attrs);
5958 pSMB->BufferFormat = 0x04;
5959 inc_rfc1001_len(pSMB, name_len + 1);
5960 pSMB->ByteCount = cpu_to_le16(name_len + 1);
5961 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
5966 cifs_buf_release(pSMB);
6027 struct smb_com_transaction2_sfi_req *pSMB = NULL;
6033 rc = small_smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB);
6038 pSMB->hdr.Pid = cpu_to_le16((__u16)pid_of_opener);
6039 pSMB->hdr.PidHigh = cpu_to_le16((__u16)(pid_of_opener >> 16));
6042 pSMB->MaxSetupCount = 0;
6043 pSMB->Reserved = 0;
6044 pSMB->Flags = 0;
6045 pSMB->Timeout = 0;
6046 pSMB->Reserved2 = 0;
6050 data_offset = (char *)pSMB +
6055 pSMB->MaxParameterCount = cpu_to_le16(2);
6057 pSMB->MaxDataCount = cpu_to_le16(1000);
6058 pSMB->SetupCount = 1;
6059 pSMB->Reserved3 = 0;
6060 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION);
6062 pSMB->DataCount = cpu_to_le16(count);
6063 pSMB->ParameterCount = cpu_to_le16(params);
6064 pSMB->TotalDataCount = pSMB->DataCount;
6065 pSMB->TotalParameterCount = pSMB->ParameterCount;
6066 pSMB->ParameterOffset = cpu_to_le16(param_offset);
6067 pSMB->DataOffset = cpu_to_le16(offset);
6068 pSMB->Fid = fid;
6069 pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_UNIX_BASIC);
6070 pSMB->Reserved4 = 0;
6071 inc_rfc1001_len(pSMB, byte_count);
6072 pSMB->ByteCount = cpu_to_le16(byte_count);
6076 rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0);
6077 cifs_small_buf_release(pSMB);
6094 TRANSACTION2_SPI_REQ *pSMB = NULL;
6104 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
6109 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
6111 cifsConvertToUTF16((__le16 *) pSMB->FileName, file_name,
6116 name_len = copy_path_name(pSMB->FileName, file_name);
6121 pSMB->MaxParameterCount = cpu_to_le16(2);
6123 pSMB->MaxDataCount = cpu_to_le16(1000);
6124 pSMB->MaxSetupCount = 0;
6125 pSMB->Reserved = 0;
6126 pSMB->Flags = 0;
6127 pSMB->Timeout = 0;
6128 pSMB->Reserved2 = 0;
6133 (FILE_UNIX_BASIC_INFO *) ((char *) &pSMB->hdr.Protocol +
6136 pSMB->DataOffset = cpu_to_le16(offset);
6137 pSMB->ParameterOffset = cpu_to_le16(param_offset);
6138 pSMB->SetupCount = 1;
6139 pSMB->Reserved3 = 0;
6140 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION);
6142 pSMB->ParameterCount = cpu_to_le16(params);
6143 pSMB->DataCount = cpu_to_le16(count);
6144 pSMB->TotalParameterCount = pSMB->ParameterCount;
6145 pSMB->TotalDataCount = pSMB->DataCount;
6146 pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_UNIX_BASIC);
6147 pSMB->Reserved4 = 0;
6148 inc_rfc1001_len(pSMB, byte_count);
6152 pSMB->ByteCount = cpu_to_le16(byte_count);
6153 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
6158 cifs_buf_release(pSMB);
6181 TRANSACTION2_QPI_REQ *pSMB = NULL;
6197 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
6202 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
6204 cifsConvertToUTF16((__le16 *) pSMB->FileName, searchName,
6209 list_len = copy_path_name(pSMB->FileName, searchName);
6213 pSMB->TotalDataCount = 0;
6214 pSMB->MaxParameterCount = cpu_to_le16(2);
6216 pSMB->MaxDataCount = cpu_to_le16(CIFSMaxBufSize);
6217 pSMB->MaxSetupCount = 0;
6218 pSMB->Reserved = 0;
6219 pSMB->Flags = 0;
6220 pSMB->Timeout = 0;
6221 pSMB->Reserved2 = 0;
6222 pSMB->ParameterOffset = cpu_to_le16(offsetof(
6224 pSMB->DataCount = 0;
6225 pSMB->DataOffset = 0;
6226 pSMB->SetupCount = 1;
6227 pSMB->Reserved3 = 0;
6228 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION);
6230 pSMB->TotalParameterCount = cpu_to_le16(params);
6231 pSMB->ParameterCount = pSMB->TotalParameterCount;
6232 pSMB->InformationLevel = cpu_to_le16(SMB_INFO_QUERY_ALL_EAS);
6233 pSMB->Reserved4 = 0;
6234 inc_rfc1001_len(pSMB, byte_count);
6235 pSMB->ByteCount = cpu_to_le16(byte_count);
6237 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
6353 cifs_buf_release(pSMB);
6366 struct smb_com_transaction2_spi_req *pSMB = NULL;
6377 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
6382 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
6384 cifsConvertToUTF16((__le16 *) pSMB->FileName, fileName,
6389 name_len = copy_path_name(pSMB->FileName, fileName);
6403 pSMB->MaxParameterCount = cpu_to_le16(2);
6405 pSMB->MaxDataCount = cpu_to_le16(1000);
6406 pSMB->MaxSetupCount = 0;
6407 pSMB->Reserved = 0;
6408 pSMB->Flags = 0;
6409 pSMB->Timeout = 0;
6410 pSMB->Reserved2 = 0;
6414 pSMB->InformationLevel =
6417 parm_data = (void *)pSMB + offsetof(struct smb_hdr, Protocol) + offset;
6418 pSMB->ParameterOffset = cpu_to_le16(param_offset);
6419 pSMB->DataOffset = cpu_to_le16(offset);
6420 pSMB->SetupCount = 1;
6421 pSMB->Reserved3 = 0;
6422 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION);
6424 pSMB->DataCount = cpu_to_le16(count);
6444 pSMB->TotalDataCount = pSMB->DataCount;
6445 pSMB->ParameterCount = cpu_to_le16(params);
6446 pSMB->TotalParameterCount = pSMB->ParameterCount;
6447 pSMB->Reserved4 = 0;
6448 inc_rfc1001_len(pSMB, byte_count);
6449 pSMB->ByteCount = cpu_to_le16(byte_count);
6450 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
6455 cifs_buf_release(pSMB);