diff options
author | Steve French <sfrench@us.ibm.com> | 2008-02-07 18:25:02 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2008-02-07 18:25:02 -0500 |
commit | ad7a2926b9e53cfb3020d15bdfacacc54e2b63da (patch) | |
tree | f4cf20d2bc3a13841ed81a8de25bd870a3b622e6 /fs/cifs/cifssmb.c | |
parent | f315ccb3e679f271583f2a4f463ad9b65665b751 (diff) |
[CIFS] reduce checkpatch warnings
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r-- | fs/cifs/cifssmb.c | 212 |
1 files changed, 61 insertions, 151 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 9409524e4bf8..4b69d1cea65e 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * fs/cifs/cifssmb.c | 2 | * fs/cifs/cifssmb.c |
3 | * | 3 | * |
4 | * Copyright (C) International Business Machines Corp., 2002,2007 | 4 | * Copyright (C) International Business Machines Corp., 2002,2008 |
5 | * Author(s): Steve French (sfrench@us.ibm.com) | 5 | * Author(s): Steve French (sfrench@us.ibm.com) |
6 | * | 6 | * |
7 | * Contains the routines for constructing the SMB PDUs themselves | 7 | * Contains the routines for constructing the SMB PDUs themselves |
@@ -102,10 +102,12 @@ static void mark_open_files_invalid(struct cifsTconInfo *pTcon) | |||
102 | to this tcon */ | 102 | to this tcon */ |
103 | } | 103 | } |
104 | 104 | ||
105 | /* If the return code is zero, this function must fill in request_buf pointer */ | 105 | /* Allocate and return pointer to an SMB request buffer, and set basic |
106 | SMB information in the SMB header. If the return code is zero, this | ||
107 | function must have filled in request_buf pointer */ | ||
106 | static int | 108 | static int |
107 | small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, | 109 | small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, |
108 | void **request_buf /* returned */) | 110 | void **request_buf) |
109 | { | 111 | { |
110 | int rc = 0; | 112 | int rc = 0; |
111 | 113 | ||
@@ -363,7 +365,7 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, | |||
363 | *response_buf = *request_buf; | 365 | *response_buf = *request_buf; |
364 | 366 | ||
365 | header_assemble((struct smb_hdr *) *request_buf, smb_command, tcon, | 367 | header_assemble((struct smb_hdr *) *request_buf, smb_command, tcon, |
366 | wct /*wct */ ); | 368 | wct); |
367 | 369 | ||
368 | if (tcon != NULL) | 370 | if (tcon != NULL) |
369 | cifs_stats_inc(&tcon->num_smbs_sent); | 371 | cifs_stats_inc(&tcon->num_smbs_sent); |
@@ -523,7 +525,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) | |||
523 | if (remain >= (MIN_TZ_ADJ / 2)) | 525 | if (remain >= (MIN_TZ_ADJ / 2)) |
524 | result += MIN_TZ_ADJ; | 526 | result += MIN_TZ_ADJ; |
525 | if (val < 0) | 527 | if (val < 0) |
526 | result = - result; | 528 | result = -result; |
527 | server->timeAdj = result; | 529 | server->timeAdj = result; |
528 | } else { | 530 | } else { |
529 | server->timeAdj = (int)tmp; | 531 | server->timeAdj = (int)tmp; |
@@ -868,9 +870,8 @@ PsxDelete: | |||
868 | pSMB->ByteCount = cpu_to_le16(byte_count); | 870 | pSMB->ByteCount = cpu_to_le16(byte_count); |
869 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 871 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
870 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 872 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
871 | if (rc) { | 873 | if (rc) |
872 | cFYI(1, ("Posix delete returned %d", rc)); | 874 | cFYI(1, ("Posix delete returned %d", rc)); |
873 | } | ||
874 | cifs_buf_release(pSMB); | 875 | cifs_buf_release(pSMB); |
875 | 876 | ||
876 | cifs_stats_inc(&tcon->num_deletes); | 877 | cifs_stats_inc(&tcon->num_deletes); |
@@ -916,9 +917,8 @@ DelFileRetry: | |||
916 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 917 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
917 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 918 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
918 | cifs_stats_inc(&tcon->num_deletes); | 919 | cifs_stats_inc(&tcon->num_deletes); |
919 | if (rc) { | 920 | if (rc) |
920 | cFYI(1, ("Error in RMFile = %d", rc)); | 921 | cFYI(1, ("Error in RMFile = %d", rc)); |
921 | } | ||
922 | 922 | ||
923 | cifs_buf_release(pSMB); | 923 | cifs_buf_release(pSMB); |
924 | if (rc == -EAGAIN) | 924 | if (rc == -EAGAIN) |
@@ -961,9 +961,8 @@ RmDirRetry: | |||
961 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 961 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
962 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 962 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
963 | cifs_stats_inc(&tcon->num_rmdirs); | 963 | cifs_stats_inc(&tcon->num_rmdirs); |
964 | if (rc) { | 964 | if (rc) |
965 | cFYI(1, ("Error in RMDir = %d", rc)); | 965 | cFYI(1, ("Error in RMDir = %d", rc)); |
966 | } | ||
967 | 966 | ||
968 | cifs_buf_release(pSMB); | 967 | cifs_buf_release(pSMB); |
969 | if (rc == -EAGAIN) | 968 | if (rc == -EAGAIN) |
@@ -1005,9 +1004,8 @@ MkDirRetry: | |||
1005 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 1004 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
1006 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 1005 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
1007 | cifs_stats_inc(&tcon->num_mkdirs); | 1006 | cifs_stats_inc(&tcon->num_mkdirs); |
1008 | if (rc) { | 1007 | if (rc) |
1009 | cFYI(1, ("Error in Mkdir = %d", rc)); | 1008 | cFYI(1, ("Error in Mkdir = %d", rc)); |
1010 | } | ||
1011 | 1009 | ||
1012 | cifs_buf_release(pSMB); | 1010 | cifs_buf_release(pSMB); |
1013 | if (rc == -EAGAIN) | 1011 | if (rc == -EAGAIN) |
@@ -1017,7 +1015,7 @@ MkDirRetry: | |||
1017 | 1015 | ||
1018 | int | 1016 | int |
1019 | CIFSPOSIXCreate(const int xid, struct cifsTconInfo *tcon, __u32 posix_flags, | 1017 | CIFSPOSIXCreate(const int xid, struct cifsTconInfo *tcon, __u32 posix_flags, |
1020 | __u64 mode, __u16 * netfid, FILE_UNIX_BASIC_INFO *pRetData, | 1018 | __u64 mode, __u16 *netfid, FILE_UNIX_BASIC_INFO *pRetData, |
1021 | __u32 *pOplock, const char *name, | 1019 | __u32 *pOplock, const char *name, |
1022 | const struct nls_table *nls_codepage, int remap) | 1020 | const struct nls_table *nls_codepage, int remap) |
1023 | { | 1021 | { |
@@ -1027,8 +1025,8 @@ CIFSPOSIXCreate(const int xid, struct cifsTconInfo *tcon, __u32 posix_flags, | |||
1027 | int rc = 0; | 1025 | int rc = 0; |
1028 | int bytes_returned = 0; | 1026 | int bytes_returned = 0; |
1029 | __u16 params, param_offset, offset, byte_count, count; | 1027 | __u16 params, param_offset, offset, byte_count, count; |
1030 | OPEN_PSX_REQ * pdata; | 1028 | OPEN_PSX_REQ *pdata; |
1031 | OPEN_PSX_RSP * psx_rsp; | 1029 | OPEN_PSX_RSP *psx_rsp; |
1032 | 1030 | ||
1033 | cFYI(1, ("In POSIX Create")); | 1031 | cFYI(1, ("In POSIX Create")); |
1034 | PsxCreat: | 1032 | PsxCreat: |
@@ -1169,8 +1167,8 @@ static __u16 convert_disposition(int disposition) | |||
1169 | int | 1167 | int |
1170 | SMBLegacyOpen(const int xid, struct cifsTconInfo *tcon, | 1168 | SMBLegacyOpen(const int xid, struct cifsTconInfo *tcon, |
1171 | const char *fileName, const int openDisposition, | 1169 | const char *fileName, const int openDisposition, |
1172 | const int access_flags, const int create_options, __u16 * netfid, | 1170 | const int access_flags, const int create_options, __u16 *netfid, |
1173 | int *pOplock, FILE_ALL_INFO * pfile_info, | 1171 | int *pOplock, FILE_ALL_INFO *pfile_info, |
1174 | const struct nls_table *nls_codepage, int remap) | 1172 | const struct nls_table *nls_codepage, int remap) |
1175 | { | 1173 | { |
1176 | int rc = -EACCES; | 1174 | int rc = -EACCES; |
@@ -1221,8 +1219,8 @@ OldOpenRetry: | |||
1221 | 1219 | ||
1222 | if (create_options & CREATE_OPTION_SPECIAL) | 1220 | if (create_options & CREATE_OPTION_SPECIAL) |
1223 | pSMB->FileAttributes = cpu_to_le16(ATTR_SYSTEM); | 1221 | pSMB->FileAttributes = cpu_to_le16(ATTR_SYSTEM); |
1224 | else | 1222 | else /* BB FIXME BB */ |
1225 | pSMB->FileAttributes = cpu_to_le16(0/*ATTR_NORMAL*/); /* BB FIXME */ | 1223 | pSMB->FileAttributes = cpu_to_le16(0/*ATTR_NORMAL*/); |
1226 | 1224 | ||
1227 | /* if ((omode & S_IWUGO) == 0) | 1225 | /* if ((omode & S_IWUGO) == 0) |
1228 | pSMB->FileAttributes |= cpu_to_le32(ATTR_READONLY);*/ | 1226 | pSMB->FileAttributes |= cpu_to_le32(ATTR_READONLY);*/ |
@@ -1284,8 +1282,8 @@ OldOpenRetry: | |||
1284 | int | 1282 | int |
1285 | CIFSSMBOpen(const int xid, struct cifsTconInfo *tcon, | 1283 | CIFSSMBOpen(const int xid, struct cifsTconInfo *tcon, |
1286 | const char *fileName, const int openDisposition, | 1284 | const char *fileName, const int openDisposition, |
1287 | const int access_flags, const int create_options, __u16 * netfid, | 1285 | const int access_flags, const int create_options, __u16 *netfid, |
1288 | int *pOplock, FILE_ALL_INFO * pfile_info, | 1286 | int *pOplock, FILE_ALL_INFO *pfile_info, |
1289 | const struct nls_table *nls_codepage, int remap) | 1287 | const struct nls_table *nls_codepage, int remap) |
1290 | { | 1288 | { |
1291 | int rc = -EACCES; | 1289 | int rc = -EACCES; |
@@ -1556,9 +1554,9 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon, | |||
1556 | } /* else setting file size with write of zero bytes */ | 1554 | } /* else setting file size with write of zero bytes */ |
1557 | if (wct == 14) | 1555 | if (wct == 14) |
1558 | byte_count = bytes_sent + 1; /* pad */ | 1556 | byte_count = bytes_sent + 1; /* pad */ |
1559 | else /* wct == 12 */ { | 1557 | else /* wct == 12 */ |
1560 | byte_count = bytes_sent + 5; /* bigger pad, smaller smb hdr */ | 1558 | byte_count = bytes_sent + 5; /* bigger pad, smaller smb hdr */ |
1561 | } | 1559 | |
1562 | pSMB->DataLengthLow = cpu_to_le16(bytes_sent & 0xFFFF); | 1560 | pSMB->DataLengthLow = cpu_to_le16(bytes_sent & 0xFFFF); |
1563 | pSMB->DataLengthHigh = cpu_to_le16(bytes_sent >> 16); | 1561 | pSMB->DataLengthHigh = cpu_to_le16(bytes_sent >> 16); |
1564 | pSMB->hdr.smb_buf_length += byte_count; | 1562 | pSMB->hdr.smb_buf_length += byte_count; |
@@ -1663,7 +1661,7 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon, | |||
1663 | rc = -EIO; | 1661 | rc = -EIO; |
1664 | *nbytes = 0; | 1662 | *nbytes = 0; |
1665 | } else { | 1663 | } else { |
1666 | WRITE_RSP * pSMBr = (WRITE_RSP *)iov[0].iov_base; | 1664 | WRITE_RSP *pSMBr = (WRITE_RSP *)iov[0].iov_base; |
1667 | *nbytes = le16_to_cpu(pSMBr->CountHigh); | 1665 | *nbytes = le16_to_cpu(pSMBr->CountHigh); |
1668 | *nbytes = (*nbytes) << 16; | 1666 | *nbytes = (*nbytes) << 16; |
1669 | *nbytes += le16_to_cpu(pSMBr->Count); | 1667 | *nbytes += le16_to_cpu(pSMBr->Count); |
@@ -1744,9 +1742,8 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, | |||
1744 | /* SMB buffer freed by function above */ | 1742 | /* SMB buffer freed by function above */ |
1745 | } | 1743 | } |
1746 | cifs_stats_inc(&tcon->num_locks); | 1744 | cifs_stats_inc(&tcon->num_locks); |
1747 | if (rc) { | 1745 | if (rc) |
1748 | cFYI(1, ("Send error in Lock = %d", rc)); | 1746 | cFYI(1, ("Send error in Lock = %d", rc)); |
1749 | } | ||
1750 | 1747 | ||
1751 | /* Note: On -EAGAIN error only caller can retry on handle based calls | 1748 | /* Note: On -EAGAIN error only caller can retry on handle based calls |
1752 | since file handle passed in no longer valid */ | 1749 | since file handle passed in no longer valid */ |
@@ -1791,7 +1788,7 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, | |||
1791 | 1788 | ||
1792 | count = sizeof(struct cifs_posix_lock); | 1789 | count = sizeof(struct cifs_posix_lock); |
1793 | pSMB->MaxParameterCount = cpu_to_le16(2); | 1790 | pSMB->MaxParameterCount = cpu_to_le16(2); |
1794 | pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB PDU from sess */ | 1791 | pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB from sess */ |
1795 | pSMB->SetupCount = 1; | 1792 | pSMB->SetupCount = 1; |
1796 | pSMB->Reserved3 = 0; | 1793 | pSMB->Reserved3 = 0; |
1797 | if (get_flag) | 1794 | if (get_flag) |
@@ -1972,9 +1969,8 @@ renameRetry: | |||
1972 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 1969 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
1973 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 1970 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
1974 | cifs_stats_inc(&tcon->num_renames); | 1971 | cifs_stats_inc(&tcon->num_renames); |
1975 | if (rc) { | 1972 | if (rc) |
1976 | cFYI(1, ("Send error in rename = %d", rc)); | 1973 | cFYI(1, ("Send error in rename = %d", rc)); |
1977 | } | ||
1978 | 1974 | ||
1979 | cifs_buf_release(pSMB); | 1975 | cifs_buf_release(pSMB); |
1980 | 1976 | ||
@@ -2016,7 +2012,7 @@ int CIFSSMBRenameOpenFile(const int xid, struct cifsTconInfo *pTcon, | |||
2016 | data_offset = (char *) (&pSMB->hdr.Protocol) + offset; | 2012 | data_offset = (char *) (&pSMB->hdr.Protocol) + offset; |
2017 | rename_info = (struct set_file_rename *) data_offset; | 2013 | rename_info = (struct set_file_rename *) data_offset; |
2018 | pSMB->MaxParameterCount = cpu_to_le16(2); | 2014 | pSMB->MaxParameterCount = cpu_to_le16(2); |
2019 | pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB PDU from sess */ | 2015 | pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB from sess */ |
2020 | pSMB->SetupCount = 1; | 2016 | pSMB->SetupCount = 1; |
2021 | pSMB->Reserved3 = 0; | 2017 | pSMB->Reserved3 = 0; |
2022 | pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION); | 2018 | pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION); |
@@ -2052,9 +2048,8 @@ int CIFSSMBRenameOpenFile(const int xid, struct cifsTconInfo *pTcon, | |||
2052 | rc = SendReceive(xid, pTcon->ses, (struct smb_hdr *) pSMB, | 2048 | rc = SendReceive(xid, pTcon->ses, (struct smb_hdr *) pSMB, |
2053 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 2049 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
2054 | cifs_stats_inc(&pTcon->num_t2renames); | 2050 | cifs_stats_inc(&pTcon->num_t2renames); |
2055 | if (rc) { | 2051 | if (rc) |
2056 | cFYI(1, ("Send error in Rename (by file handle) = %d", rc)); | 2052 | cFYI(1, ("Send error in Rename (by file handle) = %d", rc)); |
2057 | } | ||
2058 | 2053 | ||
2059 | cifs_buf_release(pSMB); | 2054 | cifs_buf_release(pSMB); |
2060 | 2055 | ||
@@ -2211,9 +2206,8 @@ createSymLinkRetry: | |||
2211 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 2206 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
2212 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 2207 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
2213 | cifs_stats_inc(&tcon->num_symlinks); | 2208 | cifs_stats_inc(&tcon->num_symlinks); |
2214 | if (rc) { | 2209 | if (rc) |
2215 | cFYI(1, ("Send error in SetPathInfo create symlink = %d", rc)); | 2210 | cFYI(1, ("Send error in SetPathInfo create symlink = %d", rc)); |
2216 | } | ||
2217 | 2211 | ||
2218 | if (pSMB) | 2212 | if (pSMB) |
2219 | cifs_buf_release(pSMB); | 2213 | cifs_buf_release(pSMB); |
@@ -2299,9 +2293,8 @@ createHardLinkRetry: | |||
2299 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 2293 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
2300 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 2294 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
2301 | cifs_stats_inc(&tcon->num_hardlinks); | 2295 | cifs_stats_inc(&tcon->num_hardlinks); |
2302 | if (rc) { | 2296 | if (rc) |
2303 | cFYI(1, ("Send error in SetPathInfo (hard link) = %d", rc)); | 2297 | cFYI(1, ("Send error in SetPathInfo (hard link) = %d", rc)); |
2304 | } | ||
2305 | 2298 | ||
2306 | cifs_buf_release(pSMB); | 2299 | cifs_buf_release(pSMB); |
2307 | if (rc == -EAGAIN) | 2300 | if (rc == -EAGAIN) |
@@ -2370,9 +2363,9 @@ winCreateHardLinkRetry: | |||
2370 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 2363 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
2371 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 2364 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
2372 | cifs_stats_inc(&tcon->num_hardlinks); | 2365 | cifs_stats_inc(&tcon->num_hardlinks); |
2373 | if (rc) { | 2366 | if (rc) |
2374 | cFYI(1, ("Send error in hard link (NT rename) = %d", rc)); | 2367 | cFYI(1, ("Send error in hard link (NT rename) = %d", rc)); |
2375 | } | 2368 | |
2376 | cifs_buf_release(pSMB); | 2369 | cifs_buf_release(pSMB); |
2377 | if (rc == -EAGAIN) | 2370 | if (rc == -EAGAIN) |
2378 | goto winCreateHardLinkRetry; | 2371 | goto winCreateHardLinkRetry; |
@@ -2968,9 +2961,8 @@ setAclRetry: | |||
2968 | pSMB->ByteCount = cpu_to_le16(byte_count); | 2961 | pSMB->ByteCount = cpu_to_le16(byte_count); |
2969 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 2962 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
2970 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 2963 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
2971 | if (rc) { | 2964 | if (rc) |
2972 | cFYI(1, ("Set POSIX ACL returned %d", rc)); | 2965 | cFYI(1, ("Set POSIX ACL returned %d", rc)); |
2973 | } | ||
2974 | 2966 | ||
2975 | setACLerrorExit: | 2967 | setACLerrorExit: |
2976 | cifs_buf_release(pSMB); | 2968 | cifs_buf_release(pSMB); |
@@ -2982,7 +2974,7 @@ setACLerrorExit: | |||
2982 | /* BB fix tabs in this function FIXME BB */ | 2974 | /* BB fix tabs in this function FIXME BB */ |
2983 | int | 2975 | int |
2984 | CIFSGetExtAttr(const int xid, struct cifsTconInfo *tcon, | 2976 | CIFSGetExtAttr(const int xid, struct cifsTconInfo *tcon, |
2985 | const int netfid, __u64 * pExtAttrBits, __u64 *pMask) | 2977 | const int netfid, __u64 *pExtAttrBits, __u64 *pMask) |
2986 | { | 2978 | { |
2987 | int rc = 0; | 2979 | int rc = 0; |
2988 | struct smb_t2_qfi_req *pSMB = NULL; | 2980 | struct smb_t2_qfi_req *pSMB = NULL; |
@@ -3000,7 +2992,7 @@ GetExtAttrRetry: | |||
3000 | if (rc) | 2992 | if (rc) |
3001 | return rc; | 2993 | return rc; |
3002 | 2994 | ||
3003 | params = 2 /* level */ +2 /* fid */; | 2995 | params = 2 /* level */ + 2 /* fid */; |
3004 | pSMB->t2.TotalDataCount = 0; | 2996 | pSMB->t2.TotalDataCount = 0; |
3005 | pSMB->t2.MaxParameterCount = cpu_to_le16(4); | 2997 | pSMB->t2.MaxParameterCount = cpu_to_le16(4); |
3006 | /* BB find exact max data count below from sess structure BB */ | 2998 | /* BB find exact max data count below from sess structure BB */ |
@@ -3071,7 +3063,7 @@ CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid, | |||
3071 | { | 3063 | { |
3072 | int rc = 0; | 3064 | int rc = 0; |
3073 | int buf_type = 0; | 3065 | int buf_type = 0; |
3074 | QUERY_SEC_DESC_REQ * pSMB; | 3066 | QUERY_SEC_DESC_REQ *pSMB; |
3075 | struct kvec iov[1]; | 3067 | struct kvec iov[1]; |
3076 | 3068 | ||
3077 | cFYI(1, ("GetCifsACL")); | 3069 | cFYI(1, ("GetCifsACL")); |
@@ -3101,7 +3093,7 @@ CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid, | |||
3101 | if (rc) { | 3093 | if (rc) { |
3102 | cFYI(1, ("Send error in QuerySecDesc = %d", rc)); | 3094 | cFYI(1, ("Send error in QuerySecDesc = %d", rc)); |
3103 | } else { /* decode response */ | 3095 | } else { /* decode response */ |
3104 | __le32 * parm; | 3096 | __le32 *parm; |
3105 | __u32 parm_len; | 3097 | __u32 parm_len; |
3106 | __u32 acl_len; | 3098 | __u32 acl_len; |
3107 | struct smb_com_ntransact_rsp *pSMBr; | 3099 | struct smb_com_ntransact_rsp *pSMBr; |
@@ -3230,8 +3222,8 @@ int SMBQueryInformation(const int xid, struct cifsTconInfo *tcon, | |||
3230 | FILE_ALL_INFO *pFinfo, | 3222 | FILE_ALL_INFO *pFinfo, |
3231 | const struct nls_table *nls_codepage, int remap) | 3223 | const struct nls_table *nls_codepage, int remap) |
3232 | { | 3224 | { |
3233 | QUERY_INFORMATION_REQ * pSMB; | 3225 | QUERY_INFORMATION_REQ *pSMB; |
3234 | QUERY_INFORMATION_RSP * pSMBr; | 3226 | QUERY_INFORMATION_RSP *pSMBr; |
3235 | int rc = 0; | 3227 | int rc = 0; |
3236 | int bytes_returned; | 3228 | int bytes_returned; |
3237 | int name_len; | 3229 | int name_len; |
@@ -3263,9 +3255,11 @@ QInfRetry: | |||
3263 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 3255 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
3264 | if (rc) { | 3256 | if (rc) { |
3265 | cFYI(1, ("Send error in QueryInfo = %d", rc)); | 3257 | cFYI(1, ("Send error in QueryInfo = %d", rc)); |
3266 | } else if (pFinfo) { /* decode response */ | 3258 | } else if (pFinfo) { |
3267 | struct timespec ts; | 3259 | struct timespec ts; |
3268 | __u32 time = le32_to_cpu(pSMBr->last_write_time); | 3260 | __u32 time = le32_to_cpu(pSMBr->last_write_time); |
3261 | |||
3262 | /* decode response */ | ||
3269 | /* BB FIXME - add time zone adjustment BB */ | 3263 | /* BB FIXME - add time zone adjustment BB */ |
3270 | memset(pFinfo, 0, sizeof(FILE_ALL_INFO)); | 3264 | memset(pFinfo, 0, sizeof(FILE_ALL_INFO)); |
3271 | ts.tv_nsec = 0; | 3265 | ts.tv_nsec = 0; |
@@ -3296,7 +3290,7 @@ QInfRetry: | |||
3296 | int | 3290 | int |
3297 | CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon, | 3291 | CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon, |
3298 | const unsigned char *searchName, | 3292 | const unsigned char *searchName, |
3299 | FILE_ALL_INFO * pFindData, | 3293 | FILE_ALL_INFO *pFindData, |
3300 | int legacy /* old style infolevel */, | 3294 | int legacy /* old style infolevel */, |
3301 | const struct nls_table *nls_codepage, int remap) | 3295 | const struct nls_table *nls_codepage, int remap) |
3302 | { | 3296 | { |
@@ -3371,10 +3365,12 @@ QPathInfoRetry: | |||
3371 | else if (pFindData) { | 3365 | else if (pFindData) { |
3372 | int size; | 3366 | int size; |
3373 | __u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset); | 3367 | __u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset); |
3374 | if (legacy) /* we do not read the last field, EAsize, | 3368 | |
3375 | fortunately since it varies by subdialect | 3369 | /* On legacy responses we do not read the last field, |
3376 | and on Set vs. Get, is two bytes or 4 | 3370 | EAsize, fortunately since it varies by subdialect and |
3377 | bytes depending but we don't care here */ | 3371 | also note it differs on Set vs. Get, ie two bytes or 4 |
3372 | bytes depending but we don't care here */ | ||
3373 | if (legacy) | ||
3378 | size = sizeof(FILE_INFO_STANDARD); | 3374 | size = sizeof(FILE_INFO_STANDARD); |
3379 | else | 3375 | else |
3380 | size = sizeof(FILE_ALL_INFO); | 3376 | size = sizeof(FILE_ALL_INFO); |
@@ -3476,85 +3472,6 @@ UnixQPathInfoRetry: | |||
3476 | return rc; | 3472 | return rc; |
3477 | } | 3473 | } |
3478 | 3474 | ||
3479 | #if 0 /* function unused at present */ | ||
3480 | int CIFSFindSingle(const int xid, struct cifsTconInfo *tcon, | ||
3481 | const char *searchName, FILE_ALL_INFO * findData, | ||
3482 | const struct nls_table *nls_codepage) | ||
3483 | { | ||
3484 | /* level 257 SMB_ */ | ||
3485 | TRANSACTION2_FFIRST_REQ *pSMB = NULL; | ||
3486 | TRANSACTION2_FFIRST_RSP *pSMBr = NULL; | ||
3487 | int rc = 0; | ||
3488 | int bytes_returned; | ||
3489 | int name_len; | ||
3490 | __u16 params, byte_count; | ||
3491 | |||
3492 | cFYI(1, ("In FindUnique")); | ||
3493 | findUniqueRetry: | ||
3494 | rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, | ||
3495 | (void **) &pSMBr); | ||
3496 | if (rc) | ||
3497 | return rc; | ||
3498 | |||
3499 | if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { | ||
3500 | name_len = | ||
3501 | cifsConvertToUCS((__le16 *) pSMB->FileName, searchName, | ||
3502 | PATH_MAX, nls_codepage); | ||
3503 | name_len++; /* trailing null */ | ||
3504 | name_len *= 2; | ||
3505 | } else { /* BB improve the check for buffer overruns BB */ | ||
3506 | name_len = strnlen(searchName, PATH_MAX); | ||
3507 | name_len++; /* trailing null */ | ||
3508 | strncpy(pSMB->FileName, searchName, name_len); | ||
3509 | } | ||
3510 | |||
3511 | params = 12 + name_len /* includes null */ ; | ||
3512 | pSMB->TotalDataCount = 0; /* no EAs */ | ||
3513 | pSMB->MaxParameterCount = cpu_to_le16(2); | ||
3514 | pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ | ||
3515 | pSMB->MaxSetupCount = 0; | ||
3516 | pSMB->Reserved = 0; | ||
3517 | pSMB->Flags = 0; | ||
3518 | pSMB->Timeout = 0; | ||
3519 | pSMB->Reserved2 = 0; | ||
3520 | pSMB->ParameterOffset = cpu_to_le16( | ||
3521 | offsetof(struct smb_com_transaction2_ffirst_req, InformationLevel)-4); | ||
3522 | pSMB->DataCount = 0; | ||
3523 | pSMB->DataOffset = 0; | ||
3524 | pSMB->SetupCount = 1; /* one byte, no need to le convert */ | ||
3525 | pSMB->Reserved3 = 0; | ||
3526 | pSMB->SubCommand = cpu_to_le16(TRANS2_FIND_FIRST); | ||
3527 | byte_count = params + 1 /* pad */ ; | ||
3528 | pSMB->TotalParameterCount = cpu_to_le16(params); | ||
3529 | pSMB->ParameterCount = pSMB->TotalParameterCount; | ||
3530 | pSMB->SearchAttributes = | ||
3531 | cpu_to_le16(ATTR_READONLY | ATTR_HIDDEN | ATTR_SYSTEM | | ||
3532 | ATTR_DIRECTORY); | ||
3533 | pSMB->SearchCount = cpu_to_le16(16); /* BB increase */ | ||
3534 | pSMB->SearchFlags = cpu_to_le16(1); | ||
3535 | pSMB->InformationLevel = cpu_to_le16(SMB_FIND_FILE_DIRECTORY_INFO); | ||
3536 | pSMB->SearchStorageType = 0; /* BB what should we set this to? BB */ | ||
3537 | pSMB->hdr.smb_buf_length += byte_count; | ||
3538 | pSMB->ByteCount = cpu_to_le16(byte_count); | ||
3539 | |||
3540 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | ||
3541 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | ||
3542 | |||
3543 | if (rc) { | ||
3544 | cFYI(1, ("Send error in FindFileDirInfo = %d", rc)); | ||
3545 | } else { /* decode response */ | ||
3546 | cifs_stats_inc(&tcon->num_ffirst); | ||
3547 | /* BB fill in */ | ||
3548 | } | ||
3549 | |||
3550 | cifs_buf_release(pSMB); | ||
3551 | if (rc == -EAGAIN) | ||
3552 | goto findUniqueRetry; | ||
3553 | |||
3554 | return rc; | ||
3555 | } | ||
3556 | #endif /* end unused (temporarily) function */ | ||
3557 | |||
3558 | /* xid, tcon, searchName and codepage are input parms, rest are returned */ | 3475 | /* xid, tcon, searchName and codepage are input parms, rest are returned */ |
3559 | int | 3476 | int |
3560 | CIFSFindFirst(const int xid, struct cifsTconInfo *tcon, | 3477 | CIFSFindFirst(const int xid, struct cifsTconInfo *tcon, |
@@ -3566,7 +3483,7 @@ CIFSFindFirst(const int xid, struct cifsTconInfo *tcon, | |||
3566 | /* level 257 SMB_ */ | 3483 | /* level 257 SMB_ */ |
3567 | TRANSACTION2_FFIRST_REQ *pSMB = NULL; | 3484 | TRANSACTION2_FFIRST_REQ *pSMB = NULL; |
3568 | TRANSACTION2_FFIRST_RSP *pSMBr = NULL; | 3485 | TRANSACTION2_FFIRST_RSP *pSMBr = NULL; |
3569 | T2_FFIRST_RSP_PARMS * parms; | 3486 | T2_FFIRST_RSP_PARMS *parms; |
3570 | int rc = 0; | 3487 | int rc = 0; |
3571 | int bytes_returned = 0; | 3488 | int bytes_returned = 0; |
3572 | int name_len; | 3489 | int name_len; |
@@ -3697,7 +3614,7 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon, | |||
3697 | { | 3614 | { |
3698 | TRANSACTION2_FNEXT_REQ *pSMB = NULL; | 3615 | TRANSACTION2_FNEXT_REQ *pSMB = NULL; |
3699 | TRANSACTION2_FNEXT_RSP *pSMBr = NULL; | 3616 | TRANSACTION2_FNEXT_RSP *pSMBr = NULL; |
3700 | T2_FNEXT_RSP_PARMS * parms; | 3617 | T2_FNEXT_RSP_PARMS *parms; |
3701 | char *response_data; | 3618 | char *response_data; |
3702 | int rc = 0; | 3619 | int rc = 0; |
3703 | int bytes_returned, name_len; | 3620 | int bytes_returned, name_len; |
@@ -3836,9 +3753,9 @@ CIFSFindClose(const int xid, struct cifsTconInfo *tcon, | |||
3836 | pSMB->FileID = searchHandle; | 3753 | pSMB->FileID = searchHandle; |
3837 | pSMB->ByteCount = 0; | 3754 | pSMB->ByteCount = 0; |
3838 | rc = SendReceiveNoRsp(xid, tcon->ses, (struct smb_hdr *) pSMB, 0); | 3755 | rc = SendReceiveNoRsp(xid, tcon->ses, (struct smb_hdr *) pSMB, 0); |
3839 | if (rc) { | 3756 | if (rc) |
3840 | cERROR(1, ("Send error in FindClose = %d", rc)); | 3757 | cERROR(1, ("Send error in FindClose = %d", rc)); |
3841 | } | 3758 | |
3842 | cifs_stats_inc(&tcon->num_fclose); | 3759 | cifs_stats_inc(&tcon->num_fclose); |
3843 | 3760 | ||
3844 | /* Since session is dead, search handle closed on server already */ | 3761 | /* Since session is dead, search handle closed on server already */ |
@@ -3851,7 +3768,7 @@ CIFSFindClose(const int xid, struct cifsTconInfo *tcon, | |||
3851 | int | 3768 | int |
3852 | CIFSGetSrvInodeNumber(const int xid, struct cifsTconInfo *tcon, | 3769 | CIFSGetSrvInodeNumber(const int xid, struct cifsTconInfo *tcon, |
3853 | const unsigned char *searchName, | 3770 | const unsigned char *searchName, |
3854 | __u64 * inode_number, | 3771 | __u64 *inode_number, |
3855 | const struct nls_table *nls_codepage, int remap) | 3772 | const struct nls_table *nls_codepage, int remap) |
3856 | { | 3773 | { |
3857 | int rc = 0; | 3774 | int rc = 0; |
@@ -4560,9 +4477,8 @@ SETFSUnixRetry: | |||
4560 | cERROR(1, ("Send error in SETFSUnixInfo = %d", rc)); | 4477 | cERROR(1, ("Send error in SETFSUnixInfo = %d", rc)); |
4561 | } else { /* decode response */ | 4478 | } else { /* decode response */ |
4562 | rc = validate_t2((struct smb_t2_rsp *)pSMBr); | 4479 | rc = validate_t2((struct smb_t2_rsp *)pSMBr); |
4563 | if (rc) { | 4480 | if (rc) |
4564 | rc = -EIO; /* bad smb */ | 4481 | rc = -EIO; /* bad smb */ |
4565 | } | ||
4566 | } | 4482 | } |
4567 | cifs_buf_release(pSMB); | 4483 | cifs_buf_release(pSMB); |
4568 | 4484 | ||
@@ -4744,9 +4660,8 @@ SetEOFRetry: | |||
4744 | pSMB->ByteCount = cpu_to_le16(byte_count); | 4660 | pSMB->ByteCount = cpu_to_le16(byte_count); |
4745 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 4661 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
4746 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 4662 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
4747 | if (rc) { | 4663 | if (rc) |
4748 | cFYI(1, ("SetPathInfo (file size) returned %d", rc)); | 4664 | cFYI(1, ("SetPathInfo (file size) returned %d", rc)); |
4749 | } | ||
4750 | 4665 | ||
4751 | cifs_buf_release(pSMB); | 4666 | cifs_buf_release(pSMB); |
4752 | 4667 | ||
@@ -4897,9 +4812,8 @@ CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon, | |||
4897 | pSMB->ByteCount = cpu_to_le16(byte_count); | 4812 | pSMB->ByteCount = cpu_to_le16(byte_count); |
4898 | memcpy(data_offset, data, sizeof(FILE_BASIC_INFO)); | 4813 | memcpy(data_offset, data, sizeof(FILE_BASIC_INFO)); |
4899 | rc = SendReceiveNoRsp(xid, tcon->ses, (struct smb_hdr *) pSMB, 0); | 4814 | rc = SendReceiveNoRsp(xid, tcon->ses, (struct smb_hdr *) pSMB, 0); |
4900 | if (rc) { | 4815 | if (rc) |
4901 | cFYI(1, ("Send error in Set Time (SetFileInfo) = %d", rc)); | 4816 | cFYI(1, ("Send error in Set Time (SetFileInfo) = %d", rc)); |
4902 | } | ||
4903 | 4817 | ||
4904 | /* Note: On -EAGAIN error only caller can retry on handle based calls | 4818 | /* Note: On -EAGAIN error only caller can retry on handle based calls |
4905 | since file handle passed in no longer valid */ | 4819 | since file handle passed in no longer valid */ |
@@ -4975,9 +4889,8 @@ SetTimesRetry: | |||
4975 | pSMB->ByteCount = cpu_to_le16(byte_count); | 4889 | pSMB->ByteCount = cpu_to_le16(byte_count); |
4976 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 4890 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
4977 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 4891 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
4978 | if (rc) { | 4892 | if (rc) |
4979 | cFYI(1, ("SetPathInfo (times) returned %d", rc)); | 4893 | cFYI(1, ("SetPathInfo (times) returned %d", rc)); |
4980 | } | ||
4981 | 4894 | ||
4982 | cifs_buf_release(pSMB); | 4895 | cifs_buf_release(pSMB); |
4983 | 4896 | ||
@@ -5027,9 +4940,8 @@ SetAttrLgcyRetry: | |||
5027 | pSMB->ByteCount = cpu_to_le16(name_len + 1); | 4940 | pSMB->ByteCount = cpu_to_le16(name_len + 1); |
5028 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 4941 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
5029 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 4942 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
5030 | if (rc) { | 4943 | if (rc) |
5031 | cFYI(1, ("Error in LegacySetAttr = %d", rc)); | 4944 | cFYI(1, ("Error in LegacySetAttr = %d", rc)); |
5032 | } | ||
5033 | 4945 | ||
5034 | cifs_buf_release(pSMB); | 4946 | cifs_buf_release(pSMB); |
5035 | 4947 | ||
@@ -5138,9 +5050,8 @@ setPermsRetry: | |||
5138 | pSMB->ByteCount = cpu_to_le16(byte_count); | 5050 | pSMB->ByteCount = cpu_to_le16(byte_count); |
5139 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 5051 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
5140 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 5052 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
5141 | if (rc) { | 5053 | if (rc) |
5142 | cFYI(1, ("SetPathInfo (perms) returned %d", rc)); | 5054 | cFYI(1, ("SetPathInfo (perms) returned %d", rc)); |
5143 | } | ||
5144 | 5055 | ||
5145 | if (pSMB) | 5056 | if (pSMB) |
5146 | cifs_buf_release(pSMB); | 5057 | cifs_buf_release(pSMB); |
@@ -5615,9 +5526,8 @@ SetEARetry: | |||
5615 | pSMB->ByteCount = cpu_to_le16(byte_count); | 5526 | pSMB->ByteCount = cpu_to_le16(byte_count); |
5616 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 5527 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
5617 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 5528 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
5618 | if (rc) { | 5529 | if (rc) |
5619 | cFYI(1, ("SetPathInfo (EA) returned %d", rc)); | 5530 | cFYI(1, ("SetPathInfo (EA) returned %d", rc)); |
5620 | } | ||
5621 | 5531 | ||
5622 | cifs_buf_release(pSMB); | 5532 | cifs_buf_release(pSMB); |
5623 | 5533 | ||