Commit e9ca855f authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] cifs: annotate TRANSACTION2_QFSI_{REQ,RESP}

Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent e4feee94
......@@ -1354,38 +1354,38 @@ typedef struct smb_com_transaction2_fnext_rsp_parms {
typedef struct smb_com_transaction2_qfsi_req {
struct smb_hdr hdr; /* wct = 14+ */
__u16 TotalParameterCount;
__u16 TotalDataCount;
__u16 MaxParameterCount;
__u16 MaxDataCount;
__le16 TotalParameterCount;
__le16 TotalDataCount;
__le16 MaxParameterCount;
__le16 MaxDataCount;
__u8 MaxSetupCount;
__u8 Reserved;
__u16 Flags;
__u32 Timeout;
__le16 Flags;
__le32 Timeout;
__u16 Reserved2;
__u16 ParameterCount;
__u16 ParameterOffset;
__u16 DataCount;
__u16 DataOffset;
__le16 ParameterCount;
__le16 ParameterOffset;
__le16 DataCount;
__le16 DataOffset;
__u8 SetupCount;
__u8 Reserved3;
__u16 SubCommand; /* one setup word */
__u16 ByteCount;
__le16 SubCommand; /* one setup word */
__le16 ByteCount;
__u8 Pad;
__u16 InformationLevel;
__le16 InformationLevel;
} TRANSACTION2_QFSI_REQ;
typedef struct smb_com_transaction_qfsi_rsp {
struct smb_hdr hdr; /* wct = 10 + SetupCount */
__u16 TotalParameterCount;
__u16 TotalDataCount;
__le16 TotalParameterCount;
__le16 TotalDataCount;
__u16 Reserved;
__u16 ParameterCount;
__u16 ParameterOffset;
__u16 ParameterDisplacement;
__u16 DataCount;
__u16 DataOffset;
__u16 DataDisplacement;
__le16 ParameterCount;
__le16 ParameterOffset;
__le16 ParameterDisplacement;
__le16 DataCount;
__le16 DataOffset;
__le16 DataDisplacement;
__u8 SetupCount;
__u8 Reserved1; /* should be zero setup words following */
__u16 ByteCount;
......@@ -1531,16 +1531,16 @@ struct aliasInfo92 {
};
typedef struct {
__u64 TotalAllocationUnits;
__u64 FreeAllocationUnits;
__u32 SectorsPerAllocationUnit;
__u32 BytesPerSector;
__le64 TotalAllocationUnits;
__le64 FreeAllocationUnits;
__le32 SectorsPerAllocationUnit;
__le32 BytesPerSector;
} FILE_SYSTEM_INFO; /* size info, level 0x103 */
typedef struct {
__u16 MajorVersionNumber;
__u16 MinorVersionNumber;
__u64 Capability;
__le16 MajorVersionNumber;
__le16 MinorVersionNumber;
__le64 Capability;
} FILE_SYSTEM_UNIX_INFO; /* Unix extensions info, level 0x200 */
/* Linux/Unix extensions capability flags */
#define CIFS_UNIX_FCNTL_CAP 0x00000001 /* support for fcntl locks */
......
......@@ -2229,6 +2229,7 @@ CIFSSMBQFSInfo(const int xid, struct cifsTconInfo *tcon,
FILE_SYSTEM_INFO *response_data;
int rc = 0;
int bytes_returned = 0;
__u16 params, byte_count;
cFYI(1, ("In QFSInfo"));
QFSInfoRetry:
......@@ -2237,7 +2238,7 @@ CIFSSMBQFSInfo(const int xid, struct cifsTconInfo *tcon,
if (rc)
return rc;
pSMB->TotalParameterCount = 2; /* level */
params = 2; /* level */
pSMB->TotalDataCount = 0;
pSMB->MaxParameterCount = cpu_to_le16(2);
pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */
......@@ -2246,8 +2247,8 @@ CIFSSMBQFSInfo(const int xid, struct cifsTconInfo *tcon,
pSMB->Flags = 0;
pSMB->Timeout = 0;
pSMB->Reserved2 = 0;
pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ;
pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount);
byte_count = params + 1 /* pad */ ;
pSMB->TotalParameterCount = cpu_to_le16(params);
pSMB->ParameterCount = pSMB->TotalParameterCount;
pSMB->ParameterOffset = cpu_to_le16(offsetof(
struct smb_com_transaction2_qfsi_req, InformationLevel) - 4);
......@@ -2257,25 +2258,25 @@ CIFSSMBQFSInfo(const int xid, struct cifsTconInfo *tcon,
pSMB->Reserved3 = 0;
pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION);
pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FS_SIZE_INFO);
pSMB->hdr.smb_buf_length += pSMB->ByteCount;
pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount);
pSMB->hdr.smb_buf_length += byte_count;
pSMB->ByteCount = cpu_to_le16(byte_count);
rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
(struct smb_hdr *) pSMBr, &bytes_returned, 0);
if (rc) {
cERROR(1, ("Send error in QFSInfo = %d", rc));
} else { /* decode response */
pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset);
__u16 data_offset = le16_to_cpu(pSMBr->DataOffset);
cFYI(1,
("Decoding qfsinfo response. BCC: %d Offset %d",
pSMBr->ByteCount, pSMBr->DataOffset));
if ((pSMBr->ByteCount < 24) || (pSMBr->DataOffset > 512)) /* BB also check enough total bytes returned */
pSMBr->ByteCount, data_offset));
if ((pSMBr->ByteCount < 24) || (data_offset > 512)) /* BB also check enough total bytes returned */
rc = -EIO; /* bad smb */
else {
response_data =
(FILE_SYSTEM_INFO
*) (((char *) &pSMBr->hdr.Protocol) +
pSMBr->DataOffset);
data_offset);
FSData->f_bsize =
le32_to_cpu(response_data->BytesPerSector) *
le32_to_cpu(response_data->
......@@ -2310,6 +2311,7 @@ CIFSSMBQFSAttributeInfo(const int xid, struct cifsTconInfo *tcon,
FILE_SYSTEM_ATTRIBUTE_INFO *response_data;
int rc = 0;
int bytes_returned = 0;
__u16 params, byte_count;
cFYI(1, ("In QFSAttributeInfo"));
QFSAttributeRetry:
......@@ -2318,7 +2320,7 @@ CIFSSMBQFSAttributeInfo(const int xid, struct cifsTconInfo *tcon,
if (rc)
return rc;
pSMB->TotalParameterCount = 2; /* level */
params = 2; /* level */
pSMB->TotalDataCount = 0;
pSMB->MaxParameterCount = cpu_to_le16(2);
pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */
......@@ -2327,8 +2329,8 @@ CIFSSMBQFSAttributeInfo(const int xid, struct cifsTconInfo *tcon,
pSMB->Flags = 0;
pSMB->Timeout = 0;
pSMB->Reserved2 = 0;
pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ;
pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount);
byte_count = params + 1 /* pad */ ;
pSMB->TotalParameterCount = cpu_to_le16(params);
pSMB->ParameterCount = pSMB->TotalParameterCount;
pSMB->ParameterOffset = cpu_to_le16(offsetof(
struct smb_com_transaction2_qfsi_req, InformationLevel) - 4);
......@@ -2338,22 +2340,22 @@ CIFSSMBQFSAttributeInfo(const int xid, struct cifsTconInfo *tcon,
pSMB->Reserved3 = 0;
pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION);
pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FS_ATTRIBUTE_INFO);
pSMB->hdr.smb_buf_length += pSMB->ByteCount;
pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount);
pSMB->hdr.smb_buf_length += byte_count;
pSMB->ByteCount = cpu_to_le16(byte_count);
rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
(struct smb_hdr *) pSMBr, &bytes_returned, 0);
if (rc) {
cERROR(1, ("Send error in QFSAttributeInfo = %d", rc));
} else { /* decode response */
pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset);
if ((pSMBr->ByteCount < 13) || (pSMBr->DataOffset > 512)) { /* BB also check enough bytes returned */
__u16 data_offset = le16_to_cpu(pSMBr->DataOffset);
if ((pSMBr->ByteCount < 13) || (data_offset > 512)) { /* BB also check enough bytes returned */
rc = -EIO; /* bad smb */
} else {
response_data =
(FILE_SYSTEM_ATTRIBUTE_INFO
*) (((char *) &pSMBr->hdr.Protocol) +
pSMBr->DataOffset);
data_offset);
response_data->Attributes = le32_to_cpu(response_data->Attributes);
response_data->MaxPathNameComponentLength =
le32_to_cpu(response_data->MaxPathNameComponentLength);
......@@ -2382,6 +2384,7 @@ CIFSSMBQFSDeviceInfo(const int xid, struct cifsTconInfo *tcon,
FILE_SYSTEM_DEVICE_INFO *response_data;
int rc = 0;
int bytes_returned = 0;
__u16 params, byte_count;
cFYI(1, ("In QFSDeviceInfo"));
QFSDeviceRetry:
......@@ -2390,7 +2393,7 @@ CIFSSMBQFSDeviceInfo(const int xid, struct cifsTconInfo *tcon,
if (rc)
return rc;
pSMB->TotalParameterCount = 2; /* level */
params = 2; /* level */
pSMB->TotalDataCount = 0;
pSMB->MaxParameterCount = cpu_to_le16(2);
pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */
......@@ -2399,8 +2402,8 @@ CIFSSMBQFSDeviceInfo(const int xid, struct cifsTconInfo *tcon,
pSMB->Flags = 0;
pSMB->Timeout = 0;
pSMB->Reserved2 = 0;
pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ;
pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount);
byte_count = params + 1 /* pad */ ;
pSMB->TotalParameterCount = cpu_to_le16(params);
pSMB->ParameterCount = pSMB->TotalParameterCount;
pSMB->ParameterOffset = cpu_to_le16(offsetof(
struct smb_com_transaction2_qfsi_req, InformationLevel) - 4);
......@@ -2411,23 +2414,23 @@ CIFSSMBQFSDeviceInfo(const int xid, struct cifsTconInfo *tcon,
pSMB->Reserved3 = 0;
pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION);
pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_FS_DEVICE_INFO);
pSMB->hdr.smb_buf_length += pSMB->ByteCount;
pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount);
pSMB->hdr.smb_buf_length += byte_count;
pSMB->ByteCount = cpu_to_le16(byte_count);
rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
(struct smb_hdr *) pSMBr, &bytes_returned, 0);
if (rc) {
cFYI(1, ("Send error in QFSDeviceInfo = %d", rc));
} else { /* decode response */
pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset);
__u16 data_offset = le16_to_cpu(pSMBr->DataOffset);
if ((pSMBr->ByteCount < sizeof (FILE_SYSTEM_DEVICE_INFO))
|| (pSMBr->DataOffset > 512))
|| (data_offset > 512))
rc = -EIO; /* bad smb */
else {
response_data =
(FILE_SYSTEM_DEVICE_INFO
*) (((char *) &pSMBr->hdr.Protocol) +
pSMBr->DataOffset);
data_offset);
response_data->DeviceType =
le32_to_cpu(response_data->DeviceType);
response_data->DeviceCharacteristics =
......@@ -2455,6 +2458,7 @@ CIFSSMBQFSUnixInfo(const int xid, struct cifsTconInfo *tcon,
FILE_SYSTEM_UNIX_INFO *response_data;
int rc = 0;
int bytes_returned = 0;
__u16 params, byte_count;
cFYI(1, ("In QFSUnixInfo"));
QFSUnixRetry:
......@@ -2463,7 +2467,7 @@ CIFSSMBQFSUnixInfo(const int xid, struct cifsTconInfo *tcon,
if (rc)
return rc;
pSMB->ParameterCount = 2; /* level */
params = 2; /* level */
pSMB->TotalDataCount = 0;
pSMB->DataCount = 0;
pSMB->DataOffset = 0;
......@@ -2474,8 +2478,8 @@ CIFSSMBQFSUnixInfo(const int xid, struct cifsTconInfo *tcon,
pSMB->Flags = 0;
pSMB->Timeout = 0;
pSMB->Reserved2 = 0;
pSMB->ByteCount = pSMB->ParameterCount + 1 /* pad */ ;
pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount);
byte_count = params + 1 /* pad */ ;
pSMB->ParameterCount = cpu_to_le16(params);
pSMB->TotalParameterCount = pSMB->ParameterCount;
pSMB->ParameterOffset = cpu_to_le16(offsetof(struct
smb_com_transaction2_qfsi_req, InformationLevel) - 4);
......@@ -2483,22 +2487,22 @@ CIFSSMBQFSUnixInfo(const int xid, struct cifsTconInfo *tcon,
pSMB->Reserved3 = 0;
pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION);
pSMB->InformationLevel = cpu_to_le16(SMB_QUERY_CIFS_UNIX_INFO);
pSMB->hdr.smb_buf_length += pSMB->ByteCount;
pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount);
pSMB->hdr.smb_buf_length += byte_count;
pSMB->ByteCount = cpu_to_le16(byte_count);
rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
(struct smb_hdr *) pSMBr, &bytes_returned, 0);
if (rc) {
cERROR(1, ("Send error in QFSUnixInfo = %d", rc));
} else { /* decode response */
pSMBr->DataOffset = cpu_to_le16(pSMBr->DataOffset);
if ((pSMBr->ByteCount < 13) || (pSMBr->DataOffset > 512)) {
__u16 data_offset = le16_to_cpu(pSMBr->DataOffset);
if ((pSMBr->ByteCount < 13) || (data_offset > 512)) {
rc = -EIO; /* bad smb */
} else {
response_data =
(FILE_SYSTEM_UNIX_INFO
*) (((char *) &pSMBr->hdr.Protocol) +
pSMBr->DataOffset);
data_offset);
response_data->MajorVersionNumber =
le16_to_cpu(response_data->MajorVersionNumber);
response_data->MinorVersionNumber =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment