aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifssmb.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2005-08-23 23:26:03 -0400
committerSteve French <sfrench@us.ibm.com>2005-08-23 23:26:03 -0400
commit6b8edfe0f918e7585acb3bd63f62ff56e32dd3d2 (patch)
treeea9c6c9c85b0653aeac1abad87ad160114de28af /fs/cifs/cifssmb.c
parenta10faeb2a3e266385cc334fe9af76e08e5e4330f (diff)
[CIFS] Support for mounting to older servers part 2. Add support for
legacy getattr (lookup). Signed-off-by: Steve French (sfrench@us.ibm.com)
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r--fs/cifs/cifssmb.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 1292db50fe65..811ab3dffafa 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -2200,6 +2200,65 @@ GetExtAttrOut:
2200 2200
2201#endif /* CONFIG_POSIX */ 2201#endif /* CONFIG_POSIX */
2202 2202
2203/* Legacy Query Path Information call for lookup to old servers such
2204 as Win9x/WinME */
2205int SMBQueryInformation(const int xid, struct cifsTconInfo *tcon,
2206 const unsigned char *searchName,
2207 FILE_ALL_INFO * pFinfo,
2208 const struct nls_table *nls_codepage, int remap)
2209{
2210 QUERY_INFORMATION_REQ * pSMB;
2211 QUERY_INFORMATION_RSP * pSMBr;
2212 int rc = 0;
2213 int bytes_returned;
2214 int name_len;
2215
2216 cFYI(1, ("In SMBQPath path %s", searchName));
2217QInfRetry:
2218 rc = smb_init(SMB_COM_QUERY_INFORMATION, 0, tcon, (void **) &pSMB,
2219 (void **) &pSMBr);
2220 if (rc)
2221 return rc;
2222
2223 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2224 name_len =
2225 cifsConvertToUCS((__le16 *) pSMB->FileName, searchName,
2226 PATH_MAX, nls_codepage, remap);
2227 name_len++; /* trailing null */
2228 name_len *= 2;
2229 } else {
2230 name_len = strnlen(searchName, PATH_MAX);
2231 name_len++; /* trailing null */
2232 strncpy(pSMB->FileName, searchName, name_len);
2233 }
2234 pSMB->BufferFormat = 0x04;
2235 name_len++; /* account for buffer type byte */
2236 pSMB->hdr.smb_buf_length += (__u16) name_len;
2237 pSMB->ByteCount = cpu_to_le16(name_len);
2238
2239 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
2240 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
2241 if (rc) {
2242 cFYI(1, ("Send error in QueryInfo = %d", rc));
2243 } else if (pFinfo) { /* decode response */
2244 memset(pFinfo, 0, sizeof(FILE_ALL_INFO));
2245 pFinfo->AllocationSize = (__le64) pSMBr->size;
2246 pFinfo->EndOfFile = (__le64) pSMBr->size;
2247 pFinfo->Attributes = (__le32) pSMBr->attr;
2248 } else
2249 rc = -EIO; /* bad buffer passed in */
2250
2251 cifs_buf_release(pSMB);
2252
2253 if (rc == -EAGAIN)
2254 goto QInfRetry;
2255
2256 return rc;
2257}
2258
2259
2260
2261
2203int 2262int
2204CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon, 2263CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon,
2205 const unsigned char *searchName, 2264 const unsigned char *searchName,