Lines Matching refs:pSMB
315 static int validate_t2(struct smb_t2_rsp *pSMB)
320 if (pSMB->hdr.WordCount < 10)
324 if (get_unaligned_le16(&pSMB->t2_rsp.ParameterOffset) > 1024 ||
325 get_unaligned_le16(&pSMB->t2_rsp.DataOffset) > 1024)
328 total_size = get_unaligned_le16(&pSMB->t2_rsp.ParameterCount);
335 total_size += get_unaligned_le16(&pSMB->t2_rsp.DataCount);
336 if (total_size > get_bcc(&pSMB->hdr) ||
342 cifs_dump_mem("Invalid transact2 SMB: ", (char *)pSMB,
406 NEGOTIATE_REQ *pSMB;
419 (void **) &pSMB, (void **) &pSMBr);
423 pSMB->hdr.Mid = get_next_mid(server);
424 pSMB->hdr.Flags2 |= (SMBFLG2_UNICODE | SMBFLG2_ERR_STATUS);
428 pSMB->hdr.Flags2 |= SMBFLG2_EXT_SEC;
439 memcpy(&pSMB->DialectsArray[count], protocols[i].name, len);
442 inc_rfc1001_len(pSMB, count);
443 pSMB->ByteCount = cpu_to_le16(count);
445 rc = SendReceive(xid, ses, (struct smb_hdr *) pSMB,
503 cifs_buf_release(pSMB);
613 LOGOFF_ANDX_REQ *pSMB;
635 rc = small_smb_init(SMB_COM_LOGOFF_ANDX, 2, NULL, (void **)&pSMB);
641 pSMB->hdr.Mid = get_next_mid(ses->server);
644 pSMB->hdr.Flags2 |= SMBFLG2_SECURITY_SIGNATURE;
646 pSMB->hdr.Uid = ses->Suid;
648 pSMB->AndXCommand = 0xFF;
649 rc = SendReceiveNoRsp(xid, ses, (char *) pSMB, 0);
650 cifs_small_buf_release(pSMB);
667 TRANSACTION2_SPI_REQ *pSMB = NULL;
677 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
682 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
684 cifsConvertToUTF16((__le16 *) pSMB->FileName, fileName,
689 name_len = copy_path_name(pSMB->FileName, fileName);
693 pSMB->MaxParameterCount = cpu_to_le16(2);
694 pSMB->MaxDataCount = 0; /* BB double check this with jra */
695 pSMB->MaxSetupCount = 0;
696 pSMB->Reserved = 0;
697 pSMB->Flags = 0;
698 pSMB->Timeout = 0;
699 pSMB->Reserved2 = 0;
708 pRqD = (struct unlink_psx_rq *)((char *)(pSMB) + offset + 4);
710 pSMB->ParameterOffset = cpu_to_le16(param_offset);
711 pSMB->DataOffset = cpu_to_le16(offset);
712 pSMB->SetupCount = 1;
713 pSMB->Reserved3 = 0;
714 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION);
717 pSMB->DataCount = cpu_to_le16(sizeof(struct unlink_psx_rq));
718 pSMB->TotalDataCount = cpu_to_le16(sizeof(struct unlink_psx_rq));
719 pSMB->ParameterCount = cpu_to_le16(params);
720 pSMB->TotalParameterCount = pSMB->ParameterCount;
721 pSMB->InformationLevel = cpu_to_le16(SMB_POSIX_UNLINK);
722 pSMB->Reserved4 = 0;
723 inc_rfc1001_len(pSMB, byte_count);
724 pSMB->ByteCount = cpu_to_le16(byte_count);
725 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
729 cifs_buf_release(pSMB);
743 DELETE_FILE_REQ *pSMB = NULL;
751 rc = smb_init(SMB_COM_DELETE, 1, tcon, (void **) &pSMB,
756 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
757 name_len = cifsConvertToUTF16((__le16 *) pSMB->fileName, name,
763 name_len = copy_path_name(pSMB->fileName, name);
765 pSMB->SearchAttributes =
767 pSMB->BufferFormat = 0x04;
768 inc_rfc1001_len(pSMB, name_len + 1);
769 pSMB->ByteCount = cpu_to_le16(name_len + 1);
770 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
776 cifs_buf_release(pSMB);
787 DELETE_DIRECTORY_REQ *pSMB = NULL;
796 rc = smb_init(SMB_COM_DELETE_DIRECTORY, 0, tcon, (void **) &pSMB,
801 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
802 name_len = cifsConvertToUTF16((__le16 *) pSMB->DirName, name,
808 name_len = copy_path_name(pSMB->DirName, name);
811 pSMB->BufferFormat = 0x04;
812 inc_rfc1001_len(pSMB, name_len + 1);
813 pSMB->ByteCount = cpu_to_le16(name_len + 1);
814 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
820 cifs_buf_release(pSMB);
832 CREATE_DIRECTORY_REQ *pSMB = NULL;
840 rc = smb_init(SMB_COM_CREATE_DIRECTORY, 0, tcon, (void **) &pSMB,
845 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
846 name_len = cifsConvertToUTF16((__le16 *) pSMB->DirName, name,
852 name_len = copy_path_name(pSMB->DirName, name);
855 pSMB->BufferFormat = 0x04;
856 inc_rfc1001_len(pSMB, name_len + 1);
857 pSMB->ByteCount = cpu_to_le16(name_len + 1);
858 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
864 cifs_buf_release(pSMB);
877 TRANSACTION2_SPI_REQ *pSMB = NULL;
888 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
893 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
895 cifsConvertToUTF16((__le16 *) pSMB->FileName, name,
900 name_len = copy_path_name(pSMB->FileName, name);
905 pSMB->MaxParameterCount = cpu_to_le16(2);
906 pSMB->MaxDataCount = cpu_to_le16(1000); /* large enough */
907 pSMB->MaxSetupCount = 0;
908 pSMB->Reserved = 0;
909 pSMB->Flags = 0;
910 pSMB->Timeout = 0;
911 pSMB->Reserved2 = 0;
916 pdata = (OPEN_PSX_REQ *)((char *)(pSMB) + offset + 4);
921 pSMB->ParameterOffset = cpu_to_le16(param_offset);
922 pSMB->DataOffset = cpu_to_le16(offset);
923 pSMB->SetupCount = 1;
924 pSMB->Reserved3 = 0;
925 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION);
928 pSMB->DataCount = cpu_to_le16(count);
929 pSMB->ParameterCount = cpu_to_le16(params);
930 pSMB->TotalDataCount = pSMB->DataCount;
931 pSMB->TotalParameterCount = pSMB->ParameterCount;
932 pSMB->InformationLevel = cpu_to_le16(SMB_POSIX_OPEN);
933 pSMB->Reserved4 = 0;
934 inc_rfc1001_len(pSMB, byte_count);
935 pSMB->ByteCount = cpu_to_le16(byte_count);
936 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
979 cifs_buf_release(pSMB);
1044 OPENX_REQ *pSMB = NULL;
1051 rc = smb_init(SMB_COM_OPEN_ANDX, 15, tcon, (void **) &pSMB,
1056 pSMB->AndXCommand = 0xFF; /* none */
1058 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1061 cifsConvertToUTF16((__le16 *) (pSMB->fileName + 1),
1067 name_len = copy_path_name(pSMB->fileName, fileName);
1070 pSMB->OpenFlags = cpu_to_le16(REQ_OPLOCK);
1072 pSMB->OpenFlags = cpu_to_le16(REQ_BATCHOPLOCK);
1074 pSMB->OpenFlags |= cpu_to_le16(REQ_MORE_INFO);
1075 pSMB->Mode = cpu_to_le16(access_flags_to_smbopen_mode(access_flags));
1076 pSMB->Mode |= cpu_to_le16(0x40); /* deny none */
1082 pSMB->FileAttributes = cpu_to_le16(ATTR_SYSTEM);
1084 pSMB->FileAttributes = cpu_to_le16(0/*ATTR_NORMAL*/);
1087 pSMB->FileAttributes |= cpu_to_le16(ATTR_READONLY);
1090 /* pSMB->CreateOptions = cpu_to_le32(create_options &
1094 pSMB->Sattr = cpu_to_le16(ATTR_HIDDEN | ATTR_SYSTEM | ATTR_DIRECTORY);
1095 pSMB->OpenFunction = cpu_to_le16(convert_disposition(openDisposition));
1097 inc_rfc1001_len(pSMB, count);
1099 pSMB->ByteCount = cpu_to_le16(count);
1100 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
1134 cifs_buf_release(pSMB);
1385 READ_REQ *pSMB = NULL;
1410 rc = small_smb_init(SMB_COM_READ_ANDX, wct, tcon, (void **) &pSMB);
1414 pSMB->hdr.Pid = cpu_to_le16((__u16)pid);
1415 pSMB->hdr.PidHigh = cpu_to_le16((__u16)(pid >> 16));
1421 pSMB->AndXCommand = 0xFF; /* none */
1422 pSMB->Fid = netfid;
1423 pSMB->OffsetLow = cpu_to_le32(offset & 0xFFFFFFFF);
1425 pSMB->OffsetHigh = cpu_to_le32(offset >> 32);
1427 pSMB->Remaining = 0;
1428 pSMB->MaxCount = cpu_to_le16(count & 0xFFFF);
1429 pSMB->MaxCountHigh = cpu_to_le32(count >> 16);
1431 pSMB->ByteCount = 0; /* no need to do le conversion since 0 */
1435 (struct smb_com_readx_req *)pSMB;
1439 iov[0].iov_base = (char *)pSMB;
1440 iov[0].iov_len = be32_to_cpu(pSMB->hdr.smb_buf_length) + 4;
1443 cifs_small_buf_release(pSMB);
1495 WRITE_REQ *pSMB = NULL;
1522 rc = smb_init(SMB_COM_WRITE_ANDX, wct, tcon, (void **) &pSMB,
1527 pSMB->hdr.Pid = cpu_to_le16((__u16)pid);
1528 pSMB->hdr.PidHigh = cpu_to_le16((__u16)(pid >> 16));
1534 pSMB->AndXCommand = 0xFF; /* none */
1535 pSMB->Fid = netfid;
1536 pSMB->OffsetLow = cpu_to_le32(offset & 0xFFFFFFFF);
1538 pSMB->OffsetHigh = cpu_to_le32(offset >> 32);
1540 pSMB->Reserved = 0xFFFFFFFF;
1541 pSMB->WriteMode = 0;
1542 pSMB->Remaining = 0;
1557 pSMB->DataOffset =
1560 memcpy(pSMB->Data, buf, bytes_sent);
1563 cifs_buf_release(pSMB);
1571 pSMB->DataLengthLow = cpu_to_le16(bytes_sent & 0xFFFF);
1572 pSMB->DataLengthHigh = cpu_to_le16(bytes_sent >> 16);
1573 inc_rfc1001_len(pSMB, byte_count);
1576 pSMB->ByteCount = cpu_to_le16(byte_count);
1580 (struct smb_com_writex_req *)pSMB;
1584 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
1603 cifs_buf_release(pSMB);
1750 WRITE_REQ *pSMB = NULL;
1774 rc = small_smb_init(SMB_COM_WRITE_ANDX, wct, tcon, (void **) &pSMB);
1778 pSMB->hdr.Pid = cpu_to_le16((__u16)pid);
1779 pSMB->hdr.PidHigh = cpu_to_le16((__u16)(pid >> 16));
1785 pSMB->AndXCommand = 0xFF; /* none */
1786 pSMB->Fid = netfid;
1787 pSMB->OffsetLow = cpu_to_le32(offset & 0xFFFFFFFF);
1789 pSMB->OffsetHigh = cpu_to_le32(offset >> 32);
1790 pSMB->Reserved = 0xFFFFFFFF;
1791 pSMB->WriteMode = 0;
1792 pSMB->Remaining = 0;
1794 pSMB->DataOffset =
1797 pSMB->DataLengthLow = cpu_to_le16(count & 0xFFFF);
1798 pSMB->DataLengthHigh = cpu_to_le16(count >> 16);
1800 smb_hdr_len = be32_to_cpu(pSMB->hdr.smb_buf_length) + 1;
1802 inc_rfc1001_len(pSMB, count + 1);
1804 inc_rfc1001_len(pSMB, count + 5); /* smb data starts later */
1806 pSMB->ByteCount = cpu_to_le16(count + 1);
1809 (struct smb_com_writex_req *)pSMB;
1812 iov[0].iov_base = pSMB;
1820 cifs_small_buf_release(pSMB);
1855 LOCK_REQ *pSMB = NULL;
1864 rc = small_smb_init(SMB_COM_LOCKING_ANDX, 8, tcon, (void **) &pSMB);
1868 pSMB->Timeout = 0;
1869 pSMB->NumberOfLocks = cpu_to_le16(num_lock);
1870 pSMB->NumberOfUnlocks = cpu_to_le16(num_unlock);
1871 pSMB->LockType = lock_type;
1872 pSMB->AndXCommand = 0xFF; /* none */
1873 pSMB->Fid = netfid; /* netfid stays le */
1876 inc_rfc1001_len(pSMB, count);
1877 pSMB->ByteCount = cpu_to_le16(count);
1879 iov[0].iov_base = (char *)pSMB;
1880 iov[0].iov_len = be32_to_cpu(pSMB->hdr.smb_buf_length) + 4 -
1888 cifs_small_buf_release(pSMB);
1903 LOCK_REQ *pSMB = NULL;
1911 rc = small_smb_init(SMB_COM_LOCKING_ANDX, 8, tcon, (void **) &pSMB);
1919 pSMB->Timeout = 0;
1922 pSMB->Timeout = cpu_to_le32(-1);/* blocking - do not time out */
1924 pSMB->Timeout = 0;
1927 pSMB->NumberOfLocks = cpu_to_le16(numLock);
1928 pSMB->NumberOfUnlocks = cpu_to_le16(numUnlock);
1929 pSMB->LockType = lockType;
1930 pSMB->OplockLevel = oplock_level;
1931 pSMB->AndXCommand = 0xFF; /* none */
1932 pSMB->Fid = smb_file_id; /* netfid stays le */
1935 pSMB->Locks[0].Pid = cpu_to_le16(netpid);
1937 pSMB->Locks[0].LengthLow = cpu_to_le32((u32)len);
1938 pSMB->Locks[0].LengthHigh = cpu_to_le32((u32)(len>>32));
1939 pSMB->Locks[0].OffsetLow = cpu_to_le32((u32)offset);
1940 pSMB->Locks[0].OffsetHigh = cpu_to_le32((u32)(offset>>32));
1946 inc_rfc1001_len(pSMB, count);
1947 pSMB->ByteCount = cpu_to_le16(count);
1950 rc = SendReceiveBlockingLock(xid, tcon, (struct smb_hdr *) pSMB,
1951 (struct smb_hdr *) pSMB, &bytes_returned);
1953 rc = SendReceiveNoRsp(xid, tcon->ses, (char *)pSMB, flags);
1954 cifs_small_buf_release(pSMB);
1971 struct smb_com_transaction2_sfi_req *pSMB = NULL;
1984 rc = small_smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB);
1989 pSMBr = (struct smb_com_transaction2_sfi_rsp *)pSMB;
1992 pSMB->MaxSetupCount = 0;
1993 pSMB->Reserved = 0;
1994 pSMB->Flags = 0;
1995 pSMB->Reserved2 = 0;
2000 pSMB->MaxParameterCount = cpu_to_le16(2);
2001 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB from sess */
2002 pSMB->SetupCount = 1;
2003 pSMB->Reserved3 = 0;
2005 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FILE_INFORMATION);
2007 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION);
2009 pSMB->DataCount = cpu_to_le16(count);
2010 pSMB->ParameterCount = cpu_to_le16(params);
2011 pSMB->TotalDataCount = pSMB->DataCount;
2012 pSMB->TotalParameterCount = pSMB->ParameterCount;
2013 pSMB->ParameterOffset = cpu_to_le16(param_offset);
2016 (((char *)pSMB) + offset + 4);
2022 pSMB->Timeout = cpu_to_le32(-1);
2024 pSMB->Timeout = 0;
2030 pSMB->DataOffset = cpu_to_le16(offset);
2031 pSMB->Fid = smb_file_id;
2032 pSMB->InformationLevel = cpu_to_le16(SMB_SET_POSIX_LOCK);
2033 pSMB->Reserved4 = 0;
2034 inc_rfc1001_len(pSMB, byte_count);
2035 pSMB->ByteCount = cpu_to_le16(byte_count);
2037 rc = SendReceiveBlockingLock(xid, tcon, (struct smb_hdr *) pSMB,
2040 iov[0].iov_base = (char *)pSMB;
2041 iov[0].iov_len = be32_to_cpu(pSMB->hdr.smb_buf_length) + 4;
2046 cifs_small_buf_release(pSMB);
2100 CLOSE_REQ *pSMB = NULL;
2104 rc = small_smb_init(SMB_COM_CLOSE, 3, tcon, (void **) &pSMB);
2110 pSMB->FileID = (__u16) smb_file_id;
2111 pSMB->LastWriteTime = 0xFFFFFFFF;
2112 pSMB->ByteCount = 0;
2113 rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0);
2114 cifs_small_buf_release(pSMB);
2134 FLUSH_REQ *pSMB = NULL;
2137 rc = small_smb_init(SMB_COM_FLUSH, 1, tcon, (void **) &pSMB);
2141 pSMB->FileID = (__u16) smb_file_id;
2142 pSMB->ByteCount = 0;
2143 rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0);
2144 cifs_small_buf_release(pSMB);
2158 RENAME_REQ *pSMB = NULL;
2167 rc = smb_init(SMB_COM_RENAME, 1, tcon, (void **) &pSMB,
2172 pSMB->BufferFormat = 0x04;
2173 pSMB->SearchAttributes =
2177 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2178 name_len = cifsConvertToUTF16((__le16 *) pSMB->OldFileName,
2183 pSMB->OldFileName[name_len] = 0x04; /* pad */
2185 pSMB->OldFileName[name_len + 1] = 0x00;
2187 cifsConvertToUTF16((__le16 *)&pSMB->OldFileName[name_len+2],
2193 name_len = copy_path_name(pSMB->OldFileName, from_name);
2194 name_len2 = copy_path_name(pSMB->OldFileName+name_len+1, to_name);
2195 pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */
2200 inc_rfc1001_len(pSMB, count);
2201 pSMB->ByteCount = cpu_to_le16(count);
2203 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
2209 cifs_buf_release(pSMB);
2221 struct smb_com_transaction2_sfi_req *pSMB = NULL;
2232 rc = smb_init(SMB_COM_TRANSACTION2, 15, pTcon, (void **) &pSMB,
2238 pSMB->MaxSetupCount = 0;
2239 pSMB->Reserved = 0;
2240 pSMB->Flags = 0;
2241 pSMB->Timeout = 0;
2242 pSMB->Reserved2 = 0;
2247 data_offset = (char *)(pSMB) + offset + 4;
2249 pSMB->MaxParameterCount = cpu_to_le16(2);
2250 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB from sess */
2251 pSMB->SetupCount = 1;
2252 pSMB->Reserved3 = 0;
2253 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION);
2255 pSMB->ParameterCount = cpu_to_le16(params);
2256 pSMB->TotalParameterCount = pSMB->ParameterCount;
2257 pSMB->ParameterOffset = cpu_to_le16(param_offset);
2258 pSMB->DataOffset = cpu_to_le16(offset);
2264 sprintf(dummy_string, "cifs%x", pSMB->hdr.Mid);
2277 pSMB->DataCount = cpu_to_le16(count);
2278 pSMB->TotalDataCount = pSMB->DataCount;
2279 pSMB->Fid = netfid;
2280 pSMB->InformationLevel =
2282 pSMB->Reserved4 = 0;
2283 inc_rfc1001_len(pSMB, byte_count);
2284 pSMB->ByteCount = cpu_to_le16(byte_count);
2285 rc = SendReceive(xid, pTcon->ses, (struct smb_hdr *) pSMB,
2292 cifs_buf_release(pSMB);
2306 COPY_REQ *pSMB = NULL;
2314 rc = smb_init(SMB_COM_COPY, 1, tcon, (void **) &pSMB,
2319 pSMB->BufferFormat = 0x04;
2320 pSMB->Tid2 = target_tid;
2322 pSMB->Flags = cpu_to_le16(flags & COPY_TREE);
2324 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2325 name_len = cifsConvertToUTF16((__le16 *) pSMB->OldFileName,
2330 pSMB->OldFileName[name_len] = 0x04; /* pad */
2332 pSMB->OldFileName[name_len + 1] = 0x00;
2334 cifsConvertToUTF16((__le16 *)&pSMB->OldFileName[name_len+2],
2339 name_len = copy_path_name(pSMB->OldFileName, fromName);
2340 pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */
2341 name_len2 = copy_path_name(pSMB->OldFileName+name_len+1, toName);
2346 inc_rfc1001_len(pSMB, count);
2347 pSMB->ByteCount = cpu_to_le16(count);
2349 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
2355 cifs_buf_release(pSMB);
2368 TRANSACTION2_SPI_REQ *pSMB = NULL;
2379 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
2384 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2386 cifsConvertToUTF16((__le16 *) pSMB->FileName, fromName,
2393 name_len = copy_path_name(pSMB->FileName, fromName);
2396 pSMB->MaxSetupCount = 0;
2397 pSMB->Reserved = 0;
2398 pSMB->Flags = 0;
2399 pSMB->Timeout = 0;
2400 pSMB->Reserved2 = 0;
2406 data_offset = (char *)pSMB + offset + 4;
2407 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2418 pSMB->MaxParameterCount = cpu_to_le16(2);
2420 pSMB->MaxDataCount = cpu_to_le16(1000);
2421 pSMB->SetupCount = 1;
2422 pSMB->Reserved3 = 0;
2423 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION);
2425 pSMB->DataCount = cpu_to_le16(name_len_target);
2426 pSMB->ParameterCount = cpu_to_le16(params);
2427 pSMB->TotalDataCount = pSMB->DataCount;
2428 pSMB->TotalParameterCount = pSMB->ParameterCount;
2429 pSMB->ParameterOffset = cpu_to_le16(param_offset);
2430 pSMB->DataOffset = cpu_to_le16(offset);
2431 pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_UNIX_LINK);
2432 pSMB->Reserved4 = 0;
2433 inc_rfc1001_len(pSMB, byte_count);
2434 pSMB->ByteCount = cpu_to_le16(byte_count);
2435 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
2442 cifs_buf_release(pSMB);
2455 TRANSACTION2_SPI_REQ *pSMB = NULL;
2466 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
2471 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2472 name_len = cifsConvertToUTF16((__le16 *) pSMB->FileName, toName,
2478 name_len = copy_path_name(pSMB->FileName, toName);
2481 pSMB->MaxSetupCount = 0;
2482 pSMB->Reserved = 0;
2483 pSMB->Flags = 0;
2484 pSMB->Timeout = 0;
2485 pSMB->Reserved2 = 0;
2491 data_offset = (char *)pSMB + offset + 4;
2492 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2502 pSMB->MaxParameterCount = cpu_to_le16(2);
2504 pSMB->MaxDataCount = cpu_to_le16(1000);
2505 pSMB->SetupCount = 1;
2506 pSMB->Reserved3 = 0;
2507 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION);
2509 pSMB->ParameterCount = cpu_to_le16(params);
2510 pSMB->TotalParameterCount = pSMB->ParameterCount;
2511 pSMB->DataCount = cpu_to_le16(name_len_target);
2512 pSMB->TotalDataCount = pSMB->DataCount;
2513 pSMB->ParameterOffset = cpu_to_le16(param_offset);
2514 pSMB->DataOffset = cpu_to_le16(offset);
2515 pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_UNIX_HLINK);
2516 pSMB->Reserved4 = 0;
2517 inc_rfc1001_len(pSMB, byte_count);
2518 pSMB->ByteCount = cpu_to_le16(byte_count);
2519 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
2526 cifs_buf_release(pSMB);
2540 NT_RENAME_REQ *pSMB = NULL;
2550 rc = smb_init(SMB_COM_NT_RENAME, 4, tcon, (void **) &pSMB,
2555 pSMB->SearchAttributes =
2558 pSMB->Flags = cpu_to_le16(CREATE_HARD_LINK);
2559 pSMB->ClusterCount = 0;
2561 pSMB->BufferFormat = 0x04;
2563 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2565 cifsConvertToUTF16((__le16 *) pSMB->OldFileName, from_name,
2571 pSMB->OldFileName[name_len] = 0x04;
2572 pSMB->OldFileName[name_len + 1] = 0x00; /* pad */
2574 cifsConvertToUTF16((__le16 *)&pSMB->OldFileName[name_len+2],
2580 name_len = copy_path_name(pSMB->OldFileName, from_name);
2581 pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */
2582 name_len2 = copy_path_name(pSMB->OldFileName+name_len+1, to_name);
2587 inc_rfc1001_len(pSMB, count);
2588 pSMB->ByteCount = cpu_to_le16(count);
2590 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
2596 cifs_buf_release(pSMB);
2609 TRANSACTION2_QPI_REQ *pSMB = NULL;
2620 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
2625 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2627 cifsConvertToUTF16((__le16 *) pSMB->FileName,
2633 name_len = copy_path_name(pSMB->FileName, searchName);
2637 pSMB->TotalDataCount = 0;
2638 pSMB->MaxParameterCount = cpu_to_le16(2);
2639 pSMB->MaxDataCount = cpu_to_le16(CIFSMaxBufSize);
2640 pSMB->MaxSetupCount = 0;
2641 pSMB->Reserved = 0;
2642 pSMB->Flags = 0;
2643 pSMB->Timeout = 0;
2644 pSMB->Reserved2 = 0;
2645 pSMB->ParameterOffset = cpu_to_le16(offsetof(
2647 pSMB->DataCount = 0;
2648 pSMB->DataOffset = 0;
2649 pSMB->SetupCount = 1;
2650 pSMB->Reserved3 = 0;
2651 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION);
2653 pSMB->TotalParameterCount = cpu_to_le16(params);
2654 pSMB->ParameterCount = pSMB->TotalParameterCount;
2655 pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_UNIX_LINK);
2656 pSMB->Reserved4 = 0;
2657 inc_rfc1001_len(pSMB, byte_count);
2658 pSMB->ByteCount = cpu_to_le16(byte_count);
2660 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
2690 cifs_buf_release(pSMB);
2796 struct smb_com_transaction_compr_ioctl_req *pSMB;
2800 rc = smb_init(SMB_COM_NT_TRANSACT, 23, tcon, (void **) &pSMB,
2805 pSMB->compression_state = cpu_to_le16(COMPRESSION_FORMAT_DEFAULT);
2807 pSMB->TotalParameterCount = 0;
2808 pSMB->TotalDataCount = cpu_to_le32(2);
2809 pSMB->MaxParameterCount = 0;
2810 pSMB->MaxDataCount = 0;
2811 pSMB->MaxSetupCount = 4;
2812 pSMB->Reserved = 0;
2813 pSMB->ParameterOffset = 0;
2814 pSMB->DataCount = cpu_to_le32(2);
2815 pSMB->DataOffset =
2818 pSMB->SetupCount = 4;
2819 pSMB->SubCommand = cpu_to_le16(NT_TRANSACT_IOCTL);
2820 pSMB->ParameterCount = 0;
2821 pSMB->FunctionCode = cpu_to_le32(FSCTL_SET_COMPRESSION);
2822 pSMB->IsFsctl = 1; /* FSCTL */
2823 pSMB->IsRootFlag = 0;
2824 pSMB->Fid = fid; /* file handle always le */
2826 pSMB->ByteCount = cpu_to_le16(5);
2827 inc_rfc1001_len(pSMB, 5);
2829 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
2834 cifs_buf_release(pSMB);
3025 TRANSACTION2_QPI_REQ *pSMB = NULL;
3035 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
3040 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3042 cifsConvertToUTF16((__le16 *) pSMB->FileName,
3047 pSMB->FileName[name_len] = 0;
3048 pSMB->FileName[name_len+1] = 0;
3050 name_len = copy_path_name(pSMB->FileName, searchName);
3054 pSMB->TotalDataCount = 0;
3055 pSMB->MaxParameterCount = cpu_to_le16(2);
3057 pSMB->MaxDataCount = cpu_to_le16(4000);
3058 pSMB->MaxSetupCount = 0;
3059 pSMB->Reserved = 0;
3060 pSMB->Flags = 0;
3061 pSMB->Timeout = 0;
3062 pSMB->Reserved2 = 0;
3063 pSMB->ParameterOffset = cpu_to_le16(
3066 pSMB->DataCount = 0;
3067 pSMB->DataOffset = 0;
3068 pSMB->SetupCount = 1;
3069 pSMB->Reserved3 = 0;
3070 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION);
3072 pSMB->TotalParameterCount = cpu_to_le16(params);
3073 pSMB->ParameterCount = pSMB->TotalParameterCount;
3074 pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_POSIX_ACL);
3075 pSMB->Reserved4 = 0;
3076 inc_rfc1001_len(pSMB, byte_count);
3077 pSMB->ByteCount = cpu_to_le16(byte_count);
3079 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
3099 cifs_buf_release(pSMB);
3115 struct smb_com_transaction2_spi_req *pSMB = NULL;
3125 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
3129 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3131 cifsConvertToUTF16((__le16 *) pSMB->FileName, fileName,
3136 name_len = copy_path_name(pSMB->FileName, fileName);
3139 pSMB->MaxParameterCount = cpu_to_le16(2);
3141 pSMB->MaxDataCount = cpu_to_le16(1000);
3142 pSMB->MaxSetupCount = 0;
3143 pSMB->Reserved = 0;
3144 pSMB->Flags = 0;
3145 pSMB->Timeout = 0;
3146 pSMB->Reserved2 = 0;
3150 parm_data = ((char *)pSMB) + sizeof(pSMB->hdr.smb_buf_length) + offset;
3151 pSMB->ParameterOffset = cpu_to_le16(param_offset);
3160 pSMB->DataOffset = cpu_to_le16(offset);
3161 pSMB->SetupCount = 1;
3162 pSMB->Reserved3 = 0;
3163 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION);
3164 pSMB->InformationLevel = cpu_to_le16(SMB_SET_POSIX_ACL);
3166 pSMB->DataCount = cpu_to_le16(data_count);
3167 pSMB->TotalDataCount = pSMB->DataCount;
3168 pSMB->ParameterCount = cpu_to_le16(params);
3169 pSMB->TotalParameterCount = pSMB->ParameterCount;
3170 pSMB->Reserved4 = 0;
3171 inc_rfc1001_len(pSMB, byte_count);
3172 pSMB->ByteCount = cpu_to_le16(byte_count);
3173 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
3179 cifs_buf_release(pSMB);
3207 struct smb_t2_qfi_req *pSMB = NULL;
3217 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
3223 pSMB->t2.TotalDataCount = 0;
3224 pSMB->t2.MaxParameterCount = cpu_to_le16(4);
3226 pSMB->t2.MaxDataCount = cpu_to_le16(4000);
3227 pSMB->t2.MaxSetupCount = 0;
3228 pSMB->t2.Reserved = 0;
3229 pSMB->t2.Flags = 0;
3230 pSMB->t2.Timeout = 0;
3231 pSMB->t2.Reserved2 = 0;
3232 pSMB->t2.ParameterOffset = cpu_to_le16(offsetof(struct smb_t2_qfi_req,
3234 pSMB->t2.DataCount = 0;
3235 pSMB->t2.DataOffset = 0;
3236 pSMB->t2.SetupCount = 1;
3237 pSMB->t2.Reserved3 = 0;
3238 pSMB->t2.SubCommand = cpu_to_le16(TRANS2_QUERY_FILE_INFORMATION);
3240 pSMB->t2.TotalParameterCount = cpu_to_le16(params);
3241 pSMB->t2.ParameterCount = pSMB->t2.TotalParameterCount;
3242 pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_ATTR_FLAGS);
3243 pSMB->Pad = 0;
3244 pSMB->Fid = netfid;
3245 inc_rfc1001_len(pSMB, byte_count);
3246 pSMB->t2.ByteCount = cpu_to_le16(byte_count);
3248 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
3277 cifs_buf_release(pSMB);
3300 struct smb_com_ntransact_req *pSMB;
3303 (void **)&pSMB);
3306 *ret_buf = (void *)pSMB;
3307 pSMB->Reserved = 0;
3308 pSMB->TotalParameterCount = cpu_to_le32(parm_len);
3309 pSMB->TotalDataCount = 0;
3310 pSMB->MaxDataCount = cpu_to_le32(CIFSMaxBufSize & 0xFFFFFF00);
3311 pSMB->ParameterCount = pSMB->TotalParameterCount;
3312 pSMB->DataCount = pSMB->TotalDataCount;
3315 pSMB->ParameterOffset = cpu_to_le32(temp_offset);
3316 pSMB->DataOffset = cpu_to_le32(temp_offset + parm_len);
3317 pSMB->SetupCount = setup_count; /* no need to le convert byte fields */
3318 pSMB->SubCommand = cpu_to_le16(sub_command);
3382 QUERY_SEC_DESC_REQ *pSMB;
3392 8 /* parm len */, tcon, (void **) &pSMB);
3396 pSMB->MaxParameterCount = cpu_to_le32(4);
3398 pSMB->MaxSetupCount = 0;
3399 pSMB->Fid = fid; /* file handle always le */
3400 pSMB->AclFlags = cpu_to_le32(CIFS_ACL_OWNER | CIFS_ACL_GROUP |
3402 pSMB->ByteCount = cpu_to_le16(11); /* 3 bytes pad + 8 bytes parm */
3403 inc_rfc1001_len(pSMB, 11);
3404 iov[0].iov_base = (char *)pSMB;
3405 iov[0].iov_len = be32_to_cpu(pSMB->hdr.smb_buf_length) + 4;
3409 cifs_small_buf_release(pSMB);
3473 SET_SEC_DESC_REQ *pSMB = NULL;
3477 rc = smb_init(SMB_COM_NT_TRANSACT, 19, tcon, (void **) &pSMB, &pSMBr);
3481 pSMB->MaxSetupCount = 0;
3482 pSMB->Reserved = 0;
3490 pSMB->DataCount = cpu_to_le32(data_count);
3491 pSMB->TotalDataCount = pSMB->DataCount;
3492 pSMB->MaxParameterCount = cpu_to_le32(4);
3493 pSMB->MaxDataCount = cpu_to_le32(16384);
3494 pSMB->ParameterCount = cpu_to_le32(param_count);
3495 pSMB->ParameterOffset = cpu_to_le32(param_offset);
3496 pSMB->TotalParameterCount = pSMB->ParameterCount;
3497 pSMB->DataOffset = cpu_to_le32(data_offset);
3498 pSMB->SetupCount = 0;
3499 pSMB->SubCommand = cpu_to_le16(NT_TRANSACT_SET_SECURITY_DESC);
3500 pSMB->ByteCount = cpu_to_le16(byte_count+data_count);
3502 pSMB->Fid = fid; /* file handle always le */
3503 pSMB->Reserved2 = 0;
3504 pSMB->AclFlags = cpu_to_le32(aclflag);
3509 inc_rfc1001_len(pSMB, byte_count + data_count);
3511 inc_rfc1001_len(pSMB, byte_count);
3513 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
3520 cifs_buf_release(pSMB);
3536 QUERY_INFORMATION_REQ *pSMB;
3544 rc = smb_init(SMB_COM_QUERY_INFORMATION, 0, tcon, (void **) &pSMB,
3549 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3551 cifsConvertToUTF16((__le16 *) pSMB->FileName,
3557 name_len = copy_path_name(pSMB->FileName, search_name);
3559 pSMB->BufferFormat = 0x04;
3561 inc_rfc1001_len(pSMB, (__u16)name_len);
3562 pSMB->ByteCount = cpu_to_le16(name_len);
3564 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
3589 cifs_buf_release(pSMB);
3601 struct smb_t2_qfi_req *pSMB = NULL;
3608 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
3614 pSMB->t2.TotalDataCount = 0;
3615 pSMB->t2.MaxParameterCount = cpu_to_le16(4);
3617 pSMB->t2.MaxDataCount = cpu_to_le16(CIFSMaxBufSize);
3618 pSMB->t2.MaxSetupCount = 0;
3619 pSMB->t2.Reserved = 0;
3620 pSMB->t2.Flags = 0;
3621 pSMB->t2.Timeout = 0;
3622 pSMB->t2.Reserved2 = 0;
3623 pSMB->t2.ParameterOffset = cpu_to_le16(offsetof(struct smb_t2_qfi_req,
3625 pSMB->t2.DataCount = 0;
3626 pSMB->t2.DataOffset = 0;
3627 pSMB->t2.SetupCount = 1;
3628 pSMB->t2.Reserved3 = 0;
3629 pSMB->t2.SubCommand = cpu_to_le16(TRANS2_QUERY_FILE_INFORMATION);
3631 pSMB->t2.TotalParameterCount = cpu_to_le16(params);
3632 pSMB->t2.ParameterCount = pSMB->t2.TotalParameterCount;
3633 pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_ALL_INFO);
3634 pSMB->Pad = 0;
3635 pSMB->Fid = netfid;
3636 inc_rfc1001_len(pSMB, byte_count);
3637 pSMB->t2.ByteCount = cpu_to_le16(byte_count);
3639 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
3658 cifs_buf_release(pSMB);
3672 TRANSACTION2_QPI_REQ *pSMB = NULL;
3681 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
3686 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3688 cifsConvertToUTF16((__le16 *) pSMB->FileName, search_name,
3693 name_len = copy_path_name(pSMB->FileName, search_name);
3697 pSMB->TotalDataCount = 0;
3698 pSMB->MaxParameterCount = cpu_to_le16(2);
3700 pSMB->MaxDataCount = cpu_to_le16(4000);
3701 pSMB->MaxSetupCount = 0;
3702 pSMB->Reserved = 0;
3703 pSMB->Flags = 0;
3704 pSMB->Timeout = 0;
3705 pSMB->Reserved2 = 0;
3706 pSMB->ParameterOffset = cpu_to_le16(offsetof(
3708 pSMB->DataCount = 0;
3709 pSMB->DataOffset = 0;
3710 pSMB->SetupCount = 1;
3711 pSMB->Reserved3 = 0;
3712 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION);
3714 pSMB->TotalParameterCount = cpu_to_le16(params);
3715 pSMB->ParameterCount = pSMB->TotalParameterCount;
3717 pSMB->InformationLevel = cpu_to_le16(SMB_INFO_STANDARD);
3719 pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_ALL_INFO);
3720 pSMB->Reserved4 = 0;
3721 inc_rfc1001_len(pSMB, byte_count);
3722 pSMB->ByteCount = cpu_to_le16(byte_count);
3724 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
3757 cifs_buf_release(pSMB);
3768 struct smb_t2_qfi_req *pSMB = NULL;
3775 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
3781 pSMB->t2.TotalDataCount = 0;
3782 pSMB->t2.MaxParameterCount = cpu_to_le16(4);
3784 pSMB->t2.MaxDataCount = cpu_to_le16(CIFSMaxBufSize);
3785 pSMB->t2.MaxSetupCount = 0;
3786 pSMB->t2.Reserved = 0;
3787 pSMB->t2.Flags = 0;
3788 pSMB->t2.Timeout = 0;
3789 pSMB->t2.Reserved2 = 0;
3790 pSMB->t2.ParameterOffset = cpu_to_le16(offsetof(struct smb_t2_qfi_req,
3792 pSMB->t2.DataCount = 0;
3793 pSMB->t2.DataOffset = 0;
3794 pSMB->t2.SetupCount = 1;
3795 pSMB->t2.Reserved3 = 0;
3796 pSMB->t2.SubCommand = cpu_to_le16(TRANS2_QUERY_FILE_INFORMATION);
3798 pSMB->t2.TotalParameterCount = cpu_to_le16(params);
3799 pSMB->t2.ParameterCount = pSMB->t2.TotalParameterCount;
3800 pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_UNIX_BASIC);
3801 pSMB->Pad = 0;
3802 pSMB->Fid = netfid;
3803 inc_rfc1001_len(pSMB, byte_count);
3804 pSMB->t2.ByteCount = cpu_to_le16(byte_count);
3806 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
3825 cifs_buf_release(pSMB);
3839 TRANSACTION2_QPI_REQ *pSMB = NULL;
3848 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
3853 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3855 cifsConvertToUTF16((__le16 *) pSMB->FileName, searchName,
3860 name_len = copy_path_name(pSMB->FileName, searchName);
3864 pSMB->TotalDataCount = 0;
3865 pSMB->MaxParameterCount = cpu_to_le16(2);
3867 pSMB->MaxDataCount = cpu_to_le16(4000);
3868 pSMB->MaxSetupCount = 0;
3869 pSMB->Reserved = 0;
3870 pSMB->Flags = 0;
3871 pSMB->Timeout = 0;
3872 pSMB->Reserved2 = 0;
3873 pSMB->ParameterOffset = cpu_to_le16(offsetof(
3875 pSMB->DataCount = 0;
3876 pSMB->DataOffset = 0;
3877 pSMB->SetupCount = 1;
3878 pSMB->Reserved3 = 0;
3879 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION);
3881 pSMB->TotalParameterCount = cpu_to_le16(params);
3882 pSMB->ParameterCount = pSMB->TotalParameterCount;
3883 pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_UNIX_BASIC);
3884 pSMB->Reserved4 = 0;
3885 inc_rfc1001_len(pSMB, byte_count);
3886 pSMB->ByteCount = cpu_to_le16(byte_count);
3888 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
3906 cifs_buf_release(pSMB);
3921 TRANSACTION2_FFIRST_REQ *pSMB = NULL;
3934 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
3942 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3944 cifsConvertToUTF16((__le16 *) pSMB->FileName, searchName,
3951 pSMB->FileName[name_len] = CIFS_DIR_SEP(cifs_sb);
3952 pSMB->FileName[name_len+1] = 0;
3953 pSMB->FileName[name_len+2] = '*';
3954 pSMB->FileName[name_len+3] = 0;
3957 pSMB->FileName[name_len] = 0;
3958 pSMB->FileName[name_len+1] = 0;
3962 name_len = copy_path_name(pSMB->FileName, searchName);
3967 pSMB->FileName[name_len-1] = CIFS_DIR_SEP(cifs_sb);
3968 pSMB->FileName[name_len] = '*';
3969 pSMB->FileName[name_len+1] = 0;
3975 pSMB->TotalDataCount = 0; /* no EAs */
3976 pSMB->MaxParameterCount = cpu_to_le16(10);
3977 pSMB->MaxDataCount = cpu_to_le16(CIFSMaxBufSize & 0xFFFFFF00);
3978 pSMB->MaxSetupCount = 0;
3979 pSMB->Reserved = 0;
3980 pSMB->Flags = 0;
3981 pSMB->Timeout = 0;
3982 pSMB->Reserved2 = 0;
3984 pSMB->TotalParameterCount = cpu_to_le16(params);
3985 pSMB->ParameterCount = pSMB->TotalParameterCount;
3986 pSMB->ParameterOffset = cpu_to_le16(
3989 pSMB->DataCount = 0;
3990 pSMB->DataOffset = 0;
3991 pSMB->SetupCount = 1; /* one byte, no need to make endian neutral */
3992 pSMB->Reserved3 = 0;
3993 pSMB->SubCommand = cpu_to_le16(TRANS2_FIND_FIRST);
3994 pSMB->SearchAttributes =
3997 pSMB->SearchCount = cpu_to_le16(CIFSMaxBufSize/sizeof(FILE_UNIX_INFO));
3998 pSMB->SearchFlags = cpu_to_le16(search_flags);
3999 pSMB->InformationLevel = cpu_to_le16(psrch_inf->info_level);
4002 pSMB->SearchStorageType = 0;
4003 inc_rfc1001_len(pSMB, byte_count);
4004 pSMB->ByteCount = cpu_to_le16(byte_count);
4006 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
4017 cifs_buf_release(pSMB);
4029 cifs_buf_release(pSMB);
4062 TRANSACTION2_FNEXT_REQ *pSMB = NULL;
4077 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
4084 pSMB->TotalDataCount = 0; /* no EAs */
4085 pSMB->MaxParameterCount = cpu_to_le16(8);
4086 pSMB->MaxDataCount = cpu_to_le16(CIFSMaxBufSize & 0xFFFFFF00);
4087 pSMB->MaxSetupCount = 0;
4088 pSMB->Reserved = 0;
4089 pSMB->Flags = 0;
4090 pSMB->Timeout = 0;
4091 pSMB->Reserved2 = 0;
4092 pSMB->ParameterOffset = cpu_to_le16(
4094 pSMB->DataCount = 0;
4095 pSMB->DataOffset = 0;
4096 pSMB->SetupCount = 1;
4097 pSMB->Reserved3 = 0;
4098 pSMB->SubCommand = cpu_to_le16(TRANS2_FIND_NEXT);
4099 pSMB->SearchHandle = searchHandle; /* always kept as le */
4100 pSMB->SearchCount =
4102 pSMB->InformationLevel = cpu_to_le16(psrch_inf->info_level);
4103 pSMB->ResumeKey = psrch_inf->resume_key;
4104 pSMB->SearchFlags = cpu_to_le16(search_flags);
4109 memcpy(pSMB->ResumeFileName, psrch_inf->presume_name, name_len);
4112 pSMB->ResumeFileName[name_len] = 0;
4113 pSMB->ResumeFileName[name_len+1] = 0;
4115 cifs_buf_release(pSMB);
4119 pSMB->TotalParameterCount = cpu_to_le16(params);
4120 pSMB->ParameterCount = pSMB->TotalParameterCount;
4121 inc_rfc1001_len(pSMB, byte_count);
4122 pSMB->ByteCount = cpu_to_le16(byte_count);
4124 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
4129 cifs_buf_release(pSMB);
4142 cifs_buf_release(pSMB);
4159 psrch_inf->ntwrk_buf_start = (char *)pSMB;
4189 FINDCLOSE_REQ *pSMB = NULL;
4192 rc = small_smb_init(SMB_COM_FIND_CLOSE2, 1, tcon, (void **)&pSMB);
4201 pSMB->FileID = searchHandle;
4202 pSMB->ByteCount = 0;
4203 rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0);
4204 cifs_small_buf_release(pSMB);
4223 TRANSACTION2_QPI_REQ *pSMB = NULL;
4233 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
4238 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
4240 cifsConvertToUTF16((__le16 *) pSMB->FileName,
4246 name_len = copy_path_name(pSMB->FileName, search_name);
4250 pSMB->TotalDataCount = 0;
4251 pSMB->MaxParameterCount = cpu_to_le16(2);
4253 pSMB->MaxDataCount = cpu_to_le16(4000);
4254 pSMB->MaxSetupCount = 0;
4255 pSMB->Reserved = 0;
4256 pSMB->Flags = 0;
4257 pSMB->Timeout = 0;
4258 pSMB->Reserved2 = 0;
4259 pSMB->ParameterOffset = cpu_to_le16(offsetof(
4261 pSMB->DataCount = 0;
4262 pSMB->DataOffset = 0;
4263 pSMB->SetupCount = 1;
4264 pSMB->Reserved3 = 0;
4265 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION);
4267 pSMB->TotalParameterCount = cpu_to_le16(params);
4268 pSMB->ParameterCount = pSMB->TotalParameterCount;
4269 pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FILE_INTERNAL_INFO);
4270 pSMB->Reserved4 = 0;
4271 inc_rfc1001_len(pSMB, byte_count);
4272 pSMB->ByteCount = cpu_to_le16(byte_count);
4274 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
4302 cifs_buf_release(pSMB);
4315 TRANSACTION2_GET_DFS_REFER_REQ *pSMB = NULL;
4335 (void **)&pSMB, (void **)&pSMBr);
4341 pSMB->hdr.Mid = get_next_mid(ses->server);
4342 pSMB->hdr.Tid = ses->tcon_ipc->tid;
4343 pSMB->hdr.Uid = ses->Suid;
4345 pSMB->hdr.Flags2 |= SMBFLG2_ERR_STATUS;
4347 pSMB->hdr.Flags2 |= SMBFLG2_DFS;
4350 pSMB->hdr.Flags2 |= SMBFLG2_UNICODE;
4352 cifsConvertToUTF16((__le16 *) pSMB->RequestFileName,
4358 name_len = copy_path_name(pSMB->RequestFileName, search_name);
4362 pSMB->hdr.Flags2 |= SMBFLG2_SECURITY_SIGNATURE;
4364 pSMB->hdr.Uid = ses->Suid;
4367 pSMB->TotalDataCount = 0;
4368 pSMB->DataCount = 0;
4369 pSMB->DataOffset = 0;
4370 pSMB->MaxParameterCount = 0;
4372 pSMB->MaxDataCount = cpu_to_le16(4000);
4373 pSMB->MaxSetupCount = 0;
4374 pSMB->Reserved = 0;
4375 pSMB->Flags = 0;
4376 pSMB->Timeout = 0;
4377 pSMB->Reserved2 = 0;
4378 pSMB->ParameterOffset = cpu_to_le16(offsetof(
4380 pSMB->SetupCount = 1;
4381 pSMB->Reserved3 = 0;
4382 pSMB->SubCommand = cpu_to_le16(TRANS2_GET_DFS_REFERRAL);
4384 pSMB->ParameterCount = cpu_to_le16(params);
4385 pSMB->TotalParameterCount = pSMB->ParameterCount;
4386 pSMB->MaxReferralLevel = cpu_to_le16(3);
4387 inc_rfc1001_len(pSMB, byte_count);
4388 pSMB->ByteCount = cpu_to_le16(byte_count);
4390 rc = SendReceive(xid, ses, (struct smb_hdr *) pSMB,
4415 cifs_buf_release(pSMB);
4429 TRANSACTION2_QFSI_REQ *pSMB = NULL;
4438 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
4444 pSMB->TotalDataCount = 0;
4445 pSMB->MaxParameterCount = cpu_to_le16(2);
4446 pSMB->MaxDataCount = cpu_to_le16(1000);
4447 pSMB->MaxSetupCount = 0;
4448 pSMB->Reserved = 0;
4449 pSMB->Flags = 0;
4450 pSMB->Timeout = 0;
4451 pSMB->Reserved2 = 0;
4453 pSMB->TotalParameterCount = cpu_to_le16(params);
4454 pSMB->ParameterCount = pSMB->TotalParameterCount;
4455 pSMB->ParameterOffset = cpu_to_le16(offsetof(
4457 pSMB->DataCount = 0;
4458 pSMB->DataOffset = 0;
4459 pSMB->SetupCount = 1;
4460 pSMB->Reserved3 = 0;
4461 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION);
4462 pSMB->InformationLevel = cpu_to_le16(SMB_INFO_ALLOCATION);
4463 inc_rfc1001_len(pSMB, byte_count);
4464 pSMB->ByteCount = cpu_to_le16(byte_count);
4466 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
4503 cifs_buf_release(pSMB);
4516 TRANSACTION2_QFSI_REQ *pSMB = NULL;
4525 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
4531 pSMB->TotalDataCount = 0;
4532 pSMB->MaxParameterCount = cpu_to_le16(2);
4533 pSMB->MaxDataCount = cpu_to_le16(1000);
4534 pSMB->MaxSetupCount = 0;
4535 pSMB->Reserved = 0;
4536 pSMB->Flags = 0;
4537 pSMB->Timeout = 0;
4538 pSMB->Reserved2 = 0;
4540 pSMB->TotalParameterCount = cpu_to_le16(params);
4541 pSMB->ParameterCount = pSMB->TotalParameterCount;
4542 pSMB->ParameterOffset = cpu_to_le16(offsetof(
4544 pSMB->DataCount = 0;
4545 pSMB->DataOffset = 0;
4546 pSMB->SetupCount = 1;
4547 pSMB->Reserved3 = 0;
4548 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION);
4549 pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FS_SIZE_INFO);
4550 inc_rfc1001_len(pSMB, byte_count);
4551 pSMB->ByteCount = cpu_to_le16(byte_count);
4553 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
4590 cifs_buf_release(pSMB);
4602 TRANSACTION2_QFSI_REQ *pSMB = NULL;
4611 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
4617 pSMB->TotalDataCount = 0;
4618 pSMB->MaxParameterCount = cpu_to_le16(2);
4620 pSMB->MaxDataCount = cpu_to_le16(1000);
4621 pSMB->MaxSetupCount = 0;
4622 pSMB->Reserved = 0;
4623 pSMB->Flags = 0;
4624 pSMB->Timeout = 0;
4625 pSMB->Reserved2 = 0;
4627 pSMB->TotalParameterCount = cpu_to_le16(params);
4628 pSMB->ParameterCount = pSMB->TotalParameterCount;
4629 pSMB->ParameterOffset = cpu_to_le16(offsetof(
4631 pSMB->DataCount = 0;
4632 pSMB->DataOffset = 0;
4633 pSMB->SetupCount = 1;
4634 pSMB->Reserved3 = 0;
4635 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION);
4636 pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FS_ATTRIBUTE_INFO);
4637 inc_rfc1001_len(pSMB, byte_count);
4638 pSMB->ByteCount = cpu_to_le16(byte_count);
4640 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
4660 cifs_buf_release(pSMB);
4672 TRANSACTION2_QFSI_REQ *pSMB = NULL;
4681 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
4687 pSMB->TotalDataCount = 0;
4688 pSMB->MaxParameterCount = cpu_to_le16(2);
4690 pSMB->MaxDataCount = cpu_to_le16(1000);
4691 pSMB->MaxSetupCount = 0;
4692 pSMB->Reserved = 0;
4693 pSMB->Flags = 0;
4694 pSMB->Timeout = 0;
4695 pSMB->Reserved2 = 0;
4697 pSMB->TotalParameterCount = cpu_to_le16(params);
4698 pSMB->ParameterCount = pSMB->TotalParameterCount;
4699 pSMB->ParameterOffset = cpu_to_le16(offsetof(
4702 pSMB->DataCount = 0;
4703 pSMB->DataOffset = 0;
4704 pSMB->SetupCount = 1;
4705 pSMB->Reserved3 = 0;
4706 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION);
4707 pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FS_DEVICE_INFO);
4708 inc_rfc1001_len(pSMB, byte_count);
4709 pSMB->ByteCount = cpu_to_le16(byte_count);
4711 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
4731 cifs_buf_release(pSMB);
4743 TRANSACTION2_QFSI_REQ *pSMB = NULL;
4753 (void **) &pSMB, (void **) &pSMBr);
4758 pSMB->TotalDataCount = 0;
4759 pSMB->DataCount = 0;
4760 pSMB->DataOffset = 0;
4761 pSMB->MaxParameterCount = cpu_to_le16(2);
4763 pSMB->MaxDataCount = cpu_to_le16(100);
4764 pSMB->MaxSetupCount = 0;
4765 pSMB->Reserved = 0;
4766 pSMB->Flags = 0;
4767 pSMB->Timeout = 0;
4768 pSMB->Reserved2 = 0;
4770 pSMB->ParameterCount = cpu_to_le16(params);
4771 pSMB->TotalParameterCount = pSMB->ParameterCount;
4772 pSMB->ParameterOffset = cpu_to_le16(offsetof(struct
4774 pSMB->SetupCount = 1;
4775 pSMB->Reserved3 = 0;
4776 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION);
4777 pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_CIFS_UNIX_INFO);
4778 inc_rfc1001_len(pSMB, byte_count);
4779 pSMB->ByteCount = cpu_to_le16(byte_count);
4781 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
4800 cifs_buf_release(pSMB);
4813 TRANSACTION2_SETFSI_REQ *pSMB = NULL;
4823 (void **) &pSMB, (void **) &pSMBr);
4828 pSMB->MaxSetupCount = 0;
4829 pSMB->Reserved = 0;
4830 pSMB->Flags = 0;
4831 pSMB->Timeout = 0;
4832 pSMB->Reserved2 = 0;
4837 pSMB->MaxParameterCount = cpu_to_le16(4);
4839 pSMB->MaxDataCount = cpu_to_le16(100);
4840 pSMB->SetupCount = 1;
4841 pSMB->Reserved3 = 0;
4842 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FS_INFORMATION);
4845 pSMB->DataCount = cpu_to_le16(12);
4846 pSMB->ParameterCount = cpu_to_le16(params);
4847 pSMB->TotalDataCount = pSMB->DataCount;
4848 pSMB->TotalParameterCount = pSMB->ParameterCount;
4849 pSMB->ParameterOffset = cpu_to_le16(param_offset);
4850 pSMB->DataOffset = cpu_to_le16(offset);
4853 pSMB->FileNum = 0;
4854 pSMB->InformationLevel = cpu_to_le16(SMB_SET_CIFS_UNIX_INFO);
4857 pSMB->ClientUnixMajor = cpu_to_le16(CIFS_UNIX_MAJOR_VERSION);
4858 pSMB->ClientUnixMinor = cpu_to_le16(CIFS_UNIX_MINOR_VERSION);
4859 pSMB->ClientUnixCap = cpu_to_le64(cap);
4861 inc_rfc1001_len(pSMB, byte_count);
4862 pSMB->ByteCount = cpu_to_le16(byte_count);
4864 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
4873 cifs_buf_release(pSMB);
4888 TRANSACTION2_QFSI_REQ *pSMB = NULL;
4897 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
4903 pSMB->TotalDataCount = 0;
4904 pSMB->DataCount = 0;
4905 pSMB->DataOffset = 0;
4906 pSMB->MaxParameterCount = cpu_to_le16(2);
4908 pSMB->MaxDataCount = cpu_to_le16(100);
4909 pSMB->MaxSetupCount = 0;
4910 pSMB->Reserved = 0;
4911 pSMB->Flags = 0;
4912 pSMB->Timeout = 0;
4913 pSMB->Reserved2 = 0;
4915 pSMB->ParameterCount = cpu_to_le16(params);
4916 pSMB->TotalParameterCount = pSMB->ParameterCount;
4917 pSMB->ParameterOffset = cpu_to_le16(offsetof(struct
4919 pSMB->SetupCount = 1;
4920 pSMB->Reserved3 = 0;
4921 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION);
4922 pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_POSIX_FS_INFO);
4923 inc_rfc1001_len(pSMB, byte_count);
4924 pSMB->ByteCount = cpu_to_le16(byte_count);
4926 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
4968 cifs_buf_release(pSMB);
4988 struct smb_com_transaction2_spi_req *pSMB = NULL;
5000 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
5005 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
5007 cifsConvertToUTF16((__le16 *) pSMB->FileName, file_name,
5012 name_len = copy_path_name(pSMB->FileName, file_name);
5016 pSMB->MaxParameterCount = cpu_to_le16(2);
5017 pSMB->MaxDataCount = cpu_to_le16(4100);
5018 pSMB->MaxSetupCount = 0;
5019 pSMB->Reserved = 0;
5020 pSMB->Flags = 0;
5021 pSMB->Timeout = 0;
5022 pSMB->Reserved2 = 0;
5028 pSMB->InformationLevel =
5031 pSMB->InformationLevel =
5035 pSMB->InformationLevel =
5038 pSMB->InformationLevel =
5043 (struct file_end_of_file_info *) (((char *) &pSMB->hdr.Protocol) +
5045 pSMB->ParameterOffset = cpu_to_le16(param_offset);
5046 pSMB->DataOffset = cpu_to_le16(offset);
5047 pSMB->SetupCount = 1;
5048 pSMB->Reserved3 = 0;
5049 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION);
5051 pSMB->DataCount = cpu_to_le16(data_count);
5052 pSMB->TotalDataCount = pSMB->DataCount;
5053 pSMB->ParameterCount = cpu_to_le16(params);
5054 pSMB->TotalParameterCount = pSMB->ParameterCount;
5055 pSMB->Reserved4 = 0;
5056 inc_rfc1001_len(pSMB, byte_count);
5058 pSMB->ByteCount = cpu_to_le16(byte_count);
5059 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
5064 cifs_buf_release(pSMB);
5076 struct smb_com_transaction2_sfi_req *pSMB = NULL;
5083 rc = small_smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB);
5088 pSMB->hdr.Pid = cpu_to_le16((__u16)cfile->pid);
5089 pSMB->hdr.PidHigh = cpu_to_le16((__u16)(cfile->pid >> 16));
5092 pSMB->MaxSetupCount = 0;
5093 pSMB->Reserved = 0;
5094 pSMB->Flags = 0;
5095 pSMB->Timeout = 0;
5096 pSMB->Reserved2 = 0;
5101 pSMB->MaxParameterCount = cpu_to_le16(2);
5103 pSMB->MaxDataCount = cpu_to_le16(1000);
5104 pSMB->SetupCount = 1;
5105 pSMB->Reserved3 = 0;
5106 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION);
5108 pSMB->DataCount = cpu_to_le16(count);
5109 pSMB->ParameterCount = cpu_to_le16(params);
5110 pSMB->TotalDataCount = pSMB->DataCount;
5111 pSMB->TotalParameterCount = pSMB->ParameterCount;
5112 pSMB->ParameterOffset = cpu_to_le16(param_offset);
5115 (struct file_end_of_file_info *)(((char *)pSMB) + offset + 4);
5116 pSMB->DataOffset = cpu_to_le16(offset);
5118 pSMB->Fid = cfile->fid.netfid;
5121 pSMB->InformationLevel =
5124 pSMB->InformationLevel =
5128 pSMB->InformationLevel =
5131 pSMB->InformationLevel =
5134 pSMB->Reserved4 = 0;
5135 inc_rfc1001_len(pSMB, byte_count);
5136 pSMB->ByteCount = cpu_to_le16(byte_count);
5137 rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0);
5138 cifs_small_buf_release(pSMB);
5160 struct smb_com_transaction2_sfi_req *pSMB = NULL;
5166 rc = small_smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB);
5171 pSMB->hdr.Pid = cpu_to_le16((__u16)pid_of_opener);
5172 pSMB->hdr.PidHigh = cpu_to_le16((__u16)(pid_of_opener >> 16));
5175 pSMB->MaxSetupCount = 0;
5176 pSMB->Reserved = 0;
5177 pSMB->Flags = 0;
5178 pSMB->Timeout = 0;
5179 pSMB->Reserved2 = 0;
5183 data_offset = (char *)pSMB +
5187 pSMB->MaxParameterCount = cpu_to_le16(2);
5189 pSMB->MaxDataCount = cpu_to_le16(1000);
5190 pSMB->SetupCount = 1;
5191 pSMB->Reserved3 = 0;
5192 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION);
5194 pSMB->DataCount = cpu_to_le16(count);
5195 pSMB->ParameterCount = cpu_to_le16(params);
5196 pSMB->TotalDataCount = pSMB->DataCount;
5197 pSMB->TotalParameterCount = pSMB->ParameterCount;
5198 pSMB->ParameterOffset = cpu_to_le16(param_offset);
5199 pSMB->DataOffset = cpu_to_le16(offset);
5200 pSMB->Fid = fid;
5202 pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_BASIC_INFO2);
5204 pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_BASIC_INFO);
5205 pSMB->Reserved4 = 0;
5206 inc_rfc1001_len(pSMB, byte_count);
5207 pSMB->ByteCount = cpu_to_le16(byte_count);
5209 rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0);
5210 cifs_small_buf_release(pSMB);
5225 struct smb_com_transaction2_sfi_req *pSMB = NULL;
5231 rc = small_smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB);
5236 pSMB->hdr.Pid = cpu_to_le16((__u16)pid_of_opener);
5237 pSMB->hdr.PidHigh = cpu_to_le16((__u16)(pid_of_opener >> 16));
5240 pSMB->MaxSetupCount = 0;
5241 pSMB->Reserved = 0;
5242 pSMB->Flags = 0;
5243 pSMB->Timeout = 0;
5244 pSMB->Reserved2 = 0;
5249 data_offset = (char *)(pSMB) + offset + 4;
5252 pSMB->MaxParameterCount = cpu_to_le16(2);
5254 pSMB->MaxDataCount = cpu_to_le16(1000);
5255 pSMB->SetupCount = 1;
5256 pSMB->Reserved3 = 0;
5257 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION);
5259 pSMB->DataCount = cpu_to_le16(count);
5260 pSMB->ParameterCount = cpu_to_le16(params);
5261 pSMB->TotalDataCount = pSMB->DataCount;
5262 pSMB->TotalParameterCount = pSMB->ParameterCount;
5263 pSMB->ParameterOffset = cpu_to_le16(param_offset);
5264 pSMB->DataOffset = cpu_to_le16(offset);
5265 pSMB->Fid = fid;
5266 pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_DISPOSITION_INFO);
5267 pSMB->Reserved4 = 0;
5268 inc_rfc1001_len(pSMB, byte_count);
5269 pSMB->ByteCount = cpu_to_le16(byte_count);
5271 rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0);
5272 cifs_small_buf_release(pSMB);
5317 TRANSACTION2_SPI_REQ *pSMB = NULL;
5329 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
5334 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
5336 cifsConvertToUTF16((__le16 *) pSMB->FileName, fileName,
5341 name_len = copy_path_name(pSMB->FileName, fileName);
5346 pSMB->MaxParameterCount = cpu_to_le16(2);
5348 pSMB->MaxDataCount = cpu_to_le16(1000);
5349 pSMB->MaxSetupCount = 0;
5350 pSMB->Reserved = 0;
5351 pSMB->Flags = 0;
5352 pSMB->Timeout = 0;
5353 pSMB->Reserved2 = 0;
5357 data_offset = (char *) (&pSMB->hdr.Protocol) + offset;
5358 pSMB->ParameterOffset = cpu_to_le16(param_offset);
5359 pSMB->DataOffset = cpu_to_le16(offset);
5360 pSMB->SetupCount = 1;
5361 pSMB->Reserved3 = 0;
5362 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION);
5365 pSMB->DataCount = cpu_to_le16(count);
5366 pSMB->ParameterCount = cpu_to_le16(params);
5367 pSMB->TotalDataCount = pSMB->DataCount;
5368 pSMB->TotalParameterCount = pSMB->ParameterCount;
5370 pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_BASIC_INFO2);
5372 pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_BASIC_INFO);
5373 pSMB->Reserved4 = 0;
5374 inc_rfc1001_len(pSMB, byte_count);
5376 pSMB->ByteCount = cpu_to_le16(byte_count);
5377 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
5382 cifs_buf_release(pSMB);
5446 struct smb_com_transaction2_sfi_req *pSMB = NULL;
5452 rc = small_smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB);
5457 pSMB->hdr.Pid = cpu_to_le16((__u16)pid_of_opener);
5458 pSMB->hdr.PidHigh = cpu_to_le16((__u16)(pid_of_opener >> 16));
5461 pSMB->MaxSetupCount = 0;
5462 pSMB->Reserved = 0;
5463 pSMB->Flags = 0;
5464 pSMB->Timeout = 0;
5465 pSMB->Reserved2 = 0;
5469 data_offset = (char *)pSMB +
5474 pSMB->MaxParameterCount = cpu_to_le16(2);
5476 pSMB->MaxDataCount = cpu_to_le16(1000);
5477 pSMB->SetupCount = 1;
5478 pSMB->Reserved3 = 0;
5479 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION);
5481 pSMB->DataCount = cpu_to_le16(count);
5482 pSMB->ParameterCount = cpu_to_le16(params);
5483 pSMB->TotalDataCount = pSMB->DataCount;
5484 pSMB->TotalParameterCount = pSMB->ParameterCount;
5485 pSMB->ParameterOffset = cpu_to_le16(param_offset);
5486 pSMB->DataOffset = cpu_to_le16(offset);
5487 pSMB->Fid = fid;
5488 pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_UNIX_BASIC);
5489 pSMB->Reserved4 = 0;
5490 inc_rfc1001_len(pSMB, byte_count);
5491 pSMB->ByteCount = cpu_to_le16(byte_count);
5495 rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0);
5496 cifs_small_buf_release(pSMB);
5513 TRANSACTION2_SPI_REQ *pSMB = NULL;
5523 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
5528 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
5530 cifsConvertToUTF16((__le16 *) pSMB->FileName, file_name,
5535 name_len = copy_path_name(pSMB->FileName, file_name);
5540 pSMB->MaxParameterCount = cpu_to_le16(2);
5542 pSMB->MaxDataCount = cpu_to_le16(1000);
5543 pSMB->MaxSetupCount = 0;
5544 pSMB->Reserved = 0;
5545 pSMB->Flags = 0;
5546 pSMB->Timeout = 0;
5547 pSMB->Reserved2 = 0;
5552 data_offset = (FILE_UNIX_BASIC_INFO *)((char *) pSMB + offset + 4);
5554 pSMB->DataOffset = cpu_to_le16(offset);
5555 pSMB->ParameterOffset = cpu_to_le16(param_offset);
5556 pSMB->SetupCount = 1;
5557 pSMB->Reserved3 = 0;
5558 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION);
5560 pSMB->ParameterCount = cpu_to_le16(params);
5561 pSMB->DataCount = cpu_to_le16(count);
5562 pSMB->TotalParameterCount = pSMB->ParameterCount;
5563 pSMB->TotalDataCount = pSMB->DataCount;
5564 pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_UNIX_BASIC);
5565 pSMB->Reserved4 = 0;
5566 inc_rfc1001_len(pSMB, byte_count);
5570 pSMB->ByteCount = cpu_to_le16(byte_count);
5571 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
5576 cifs_buf_release(pSMB);
5599 TRANSACTION2_QPI_REQ *pSMB = NULL;
5615 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
5620 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
5622 cifsConvertToUTF16((__le16 *) pSMB->FileName, searchName,
5627 list_len = copy_path_name(pSMB->FileName, searchName);
5631 pSMB->TotalDataCount = 0;
5632 pSMB->MaxParameterCount = cpu_to_le16(2);
5634 pSMB->MaxDataCount = cpu_to_le16(CIFSMaxBufSize);
5635 pSMB->MaxSetupCount = 0;
5636 pSMB->Reserved = 0;
5637 pSMB->Flags = 0;
5638 pSMB->Timeout = 0;
5639 pSMB->Reserved2 = 0;
5640 pSMB->ParameterOffset = cpu_to_le16(offsetof(
5642 pSMB->DataCount = 0;
5643 pSMB->DataOffset = 0;
5644 pSMB->SetupCount = 1;
5645 pSMB->Reserved3 = 0;
5646 pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION);
5648 pSMB->TotalParameterCount = cpu_to_le16(params);
5649 pSMB->ParameterCount = pSMB->TotalParameterCount;
5650 pSMB->InformationLevel = cpu_to_le16(SMB_INFO_QUERY_ALL_EAS);
5651 pSMB->Reserved4 = 0;
5652 inc_rfc1001_len(pSMB, byte_count);
5653 pSMB->ByteCount = cpu_to_le16(byte_count);
5655 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
5771 cifs_buf_release(pSMB);
5784 struct smb_com_transaction2_spi_req *pSMB = NULL;
5795 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
5800 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
5802 cifsConvertToUTF16((__le16 *) pSMB->FileName, fileName,
5807 name_len = copy_path_name(pSMB->FileName, fileName);
5821 pSMB->MaxParameterCount = cpu_to_le16(2);
5823 pSMB->MaxDataCount = cpu_to_le16(1000);
5824 pSMB->MaxSetupCount = 0;
5825 pSMB->Reserved = 0;
5826 pSMB->Flags = 0;
5827 pSMB->Timeout = 0;
5828 pSMB->Reserved2 = 0;
5832 pSMB->InformationLevel =
5835 parm_data = (void *)pSMB + offsetof(struct smb_hdr, Protocol) + offset;
5836 pSMB->ParameterOffset = cpu_to_le16(param_offset);
5837 pSMB->DataOffset = cpu_to_le16(offset);
5838 pSMB->SetupCount = 1;
5839 pSMB->Reserved3 = 0;
5840 pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION);
5842 pSMB->DataCount = cpu_to_le16(count);
5862 pSMB->TotalDataCount = pSMB->DataCount;
5863 pSMB->ParameterCount = cpu_to_le16(params);
5864 pSMB->TotalParameterCount = pSMB->ParameterCount;
5865 pSMB->Reserved4 = 0;
5866 inc_rfc1001_len(pSMB, byte_count);
5867 pSMB->ByteCount = cpu_to_le16(byte_count);
5868 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
5873 cifs_buf_release(pSMB);