diff options
author | David Woodhouse <dwmw2@infradead.org> | 2007-07-23 05:20:10 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2007-07-23 05:20:10 -0400 |
commit | 39fe5434cb9de5da40510028b17b96bc4eb312b3 (patch) | |
tree | 7a02a317b9ad57da51ca99887c119e779ccf3f13 /fs/cifs/readdir.c | |
parent | 0fc72b81d3111d114ab378935b1cf07680ca1289 (diff) | |
parent | f695baf2df9e0413d3521661070103711545207a (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'fs/cifs/readdir.c')
-rw-r--r-- | fs/cifs/readdir.c | 375 |
1 files changed, 190 insertions, 185 deletions
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index c08bda9fcac6..916df9431336 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * fs/cifs/readdir.c | 2 | * fs/cifs/readdir.c |
3 | * | 3 | * |
4 | * Directory search handling | 4 | * Directory search handling |
5 | * | 5 | * |
6 | * Copyright (C) International Business Machines Corp., 2004, 2007 | 6 | * Copyright (C) International Business Machines Corp., 2004, 2007 |
7 | * Author(s): Steve French (sfrench@us.ibm.com) | 7 | * Author(s): Steve French (sfrench@us.ibm.com) |
8 | * | 8 | * |
@@ -34,24 +34,23 @@ | |||
34 | #ifdef CONFIG_CIFS_DEBUG2 | 34 | #ifdef CONFIG_CIFS_DEBUG2 |
35 | static void dump_cifs_file_struct(struct file *file, char *label) | 35 | static void dump_cifs_file_struct(struct file *file, char *label) |
36 | { | 36 | { |
37 | struct cifsFileInfo * cf; | 37 | struct cifsFileInfo *cf; |
38 | 38 | ||
39 | if (file) { | 39 | if (file) { |
40 | cf = file->private_data; | 40 | cf = file->private_data; |
41 | if (cf == NULL) { | 41 | if (cf == NULL) { |
42 | cFYI(1,("empty cifs private file data")); | 42 | cFYI(1, ("empty cifs private file data")); |
43 | return; | 43 | return; |
44 | } | 44 | } |
45 | if (cf->invalidHandle) { | 45 | if (cf->invalidHandle) { |
46 | cFYI(1,("invalid handle")); | 46 | cFYI(1, ("invalid handle")); |
47 | } | 47 | } |
48 | if (cf->srch_inf.endOfSearch) { | 48 | if (cf->srch_inf.endOfSearch) { |
49 | cFYI(1,("end of search")); | 49 | cFYI(1, ("end of search")); |
50 | } | 50 | } |
51 | if (cf->srch_inf.emptyDir) { | 51 | if (cf->srch_inf.emptyDir) { |
52 | cFYI(1,("empty dir")); | 52 | cFYI(1, ("empty dir")); |
53 | } | 53 | } |
54 | |||
55 | } | 54 | } |
56 | } | 55 | } |
57 | #endif /* DEBUG2 */ | 56 | #endif /* DEBUG2 */ |
@@ -73,7 +72,8 @@ static int construct_dentry(struct qstr *qstring, struct file *file, | |||
73 | qstring->hash = full_name_hash(qstring->name, qstring->len); | 72 | qstring->hash = full_name_hash(qstring->name, qstring->len); |
74 | tmp_dentry = d_lookup(file->f_path.dentry, qstring); | 73 | tmp_dentry = d_lookup(file->f_path.dentry, qstring); |
75 | if (tmp_dentry) { | 74 | if (tmp_dentry) { |
76 | cFYI(0, ("existing dentry with inode 0x%p", tmp_dentry->d_inode)); | 75 | cFYI(0, ("existing dentry with inode 0x%p", |
76 | tmp_dentry->d_inode)); | ||
77 | *ptmp_inode = tmp_dentry->d_inode; | 77 | *ptmp_inode = tmp_dentry->d_inode; |
78 | /* BB overwrite old name? i.e. tmp_dentry->d_name and tmp_dentry->d_name.len??*/ | 78 | /* BB overwrite old name? i.e. tmp_dentry->d_name and tmp_dentry->d_name.len??*/ |
79 | if (*ptmp_inode == NULL) { | 79 | if (*ptmp_inode == NULL) { |
@@ -87,7 +87,7 @@ static int construct_dentry(struct qstr *qstring, struct file *file, | |||
87 | } else { | 87 | } else { |
88 | tmp_dentry = d_alloc(file->f_path.dentry, qstring); | 88 | tmp_dentry = d_alloc(file->f_path.dentry, qstring); |
89 | if (tmp_dentry == NULL) { | 89 | if (tmp_dentry == NULL) { |
90 | cERROR(1,("Failed allocating dentry")); | 90 | cERROR(1, ("Failed allocating dentry")); |
91 | *ptmp_inode = NULL; | 91 | *ptmp_inode = NULL; |
92 | return rc; | 92 | return rc; |
93 | } | 93 | } |
@@ -100,7 +100,7 @@ static int construct_dentry(struct qstr *qstring, struct file *file, | |||
100 | if (*ptmp_inode == NULL) | 100 | if (*ptmp_inode == NULL) |
101 | return rc; | 101 | return rc; |
102 | if (file->f_path.dentry->d_sb->s_flags & MS_NOATIME) | 102 | if (file->f_path.dentry->d_sb->s_flags & MS_NOATIME) |
103 | (*ptmp_inode)->i_flags |= S_NOATIME | S_NOCMTIME; | 103 | (*ptmp_inode)->i_flags |= S_NOATIME | S_NOCMTIME; |
104 | rc = 2; | 104 | rc = 2; |
105 | } | 105 | } |
106 | 106 | ||
@@ -109,7 +109,7 @@ static int construct_dentry(struct qstr *qstring, struct file *file, | |||
109 | return rc; | 109 | return rc; |
110 | } | 110 | } |
111 | 111 | ||
112 | static void AdjustForTZ(struct cifsTconInfo * tcon, struct inode * inode) | 112 | static void AdjustForTZ(struct cifsTconInfo *tcon, struct inode *inode) |
113 | { | 113 | { |
114 | if ((tcon) && (tcon->ses) && (tcon->ses->server)) { | 114 | if ((tcon) && (tcon->ses) && (tcon->ses->server)) { |
115 | inode->i_ctime.tv_sec += tcon->ses->server->timeAdj; | 115 | inode->i_ctime.tv_sec += tcon->ses->server->timeAdj; |
@@ -121,7 +121,7 @@ static void AdjustForTZ(struct cifsTconInfo * tcon, struct inode * inode) | |||
121 | 121 | ||
122 | 122 | ||
123 | static void fill_in_inode(struct inode *tmp_inode, int new_buf_type, | 123 | static void fill_in_inode(struct inode *tmp_inode, int new_buf_type, |
124 | char * buf, int *pobject_type, int isNewInode) | 124 | char *buf, int *pobject_type, int isNewInode) |
125 | { | 125 | { |
126 | loff_t local_size; | 126 | loff_t local_size; |
127 | struct timespec local_mtime; | 127 | struct timespec local_mtime; |
@@ -150,7 +150,7 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type, | |||
150 | cifs_NTtimeToUnix(le64_to_cpu(pfindData->ChangeTime)); | 150 | cifs_NTtimeToUnix(le64_to_cpu(pfindData->ChangeTime)); |
151 | } else { /* legacy, OS2 and DOS style */ | 151 | } else { /* legacy, OS2 and DOS style */ |
152 | /* struct timespec ts;*/ | 152 | /* struct timespec ts;*/ |
153 | FIND_FILE_STANDARD_INFO * pfindData = | 153 | FIND_FILE_STANDARD_INFO * pfindData = |
154 | (FIND_FILE_STANDARD_INFO *)buf; | 154 | (FIND_FILE_STANDARD_INFO *)buf; |
155 | 155 | ||
156 | tmp_inode->i_mtime = cnvrtDosUnixTm( | 156 | tmp_inode->i_mtime = cnvrtDosUnixTm( |
@@ -175,7 +175,7 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type, | |||
175 | 175 | ||
176 | /* treat dos attribute of read-only as read-only mode bit e.g. 555? */ | 176 | /* treat dos attribute of read-only as read-only mode bit e.g. 555? */ |
177 | /* 2767 perms - indicate mandatory locking */ | 177 | /* 2767 perms - indicate mandatory locking */ |
178 | /* BB fill in uid and gid here? with help from winbind? | 178 | /* BB fill in uid and gid here? with help from winbind? |
179 | or retrieve from NTFS stream extended attribute */ | 179 | or retrieve from NTFS stream extended attribute */ |
180 | if (atomic_read(&cifsInfo->inUse) == 0) { | 180 | if (atomic_read(&cifsInfo->inUse) == 0) { |
181 | tmp_inode->i_uid = cifs_sb->mnt_uid; | 181 | tmp_inode->i_uid = cifs_sb->mnt_uid; |
@@ -196,7 +196,7 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type, | |||
196 | tmp_inode->i_mode = cifs_sb->mnt_dir_mode; | 196 | tmp_inode->i_mode = cifs_sb->mnt_dir_mode; |
197 | } | 197 | } |
198 | tmp_inode->i_mode |= S_IFDIR; | 198 | tmp_inode->i_mode |= S_IFDIR; |
199 | } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) && | 199 | } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) && |
200 | (attr & ATTR_SYSTEM)) { | 200 | (attr & ATTR_SYSTEM)) { |
201 | if (end_of_file == 0) { | 201 | if (end_of_file == 0) { |
202 | *pobject_type = DT_FIFO; | 202 | *pobject_type = DT_FIFO; |
@@ -206,13 +206,13 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type, | |||
206 | inode as needing revalidate and get the real type | 206 | inode as needing revalidate and get the real type |
207 | (blk vs chr vs. symlink) later ie in lookup */ | 207 | (blk vs chr vs. symlink) later ie in lookup */ |
208 | *pobject_type = DT_REG; | 208 | *pobject_type = DT_REG; |
209 | tmp_inode->i_mode |= S_IFREG; | 209 | tmp_inode->i_mode |= S_IFREG; |
210 | cifsInfo->time = 0; | 210 | cifsInfo->time = 0; |
211 | } | 211 | } |
212 | /* we no longer mark these because we could not follow them */ | 212 | /* we no longer mark these because we could not follow them */ |
213 | /* } else if (attr & ATTR_REPARSE) { | 213 | /* } else if (attr & ATTR_REPARSE) { |
214 | *pobject_type = DT_LNK; | 214 | *pobject_type = DT_LNK; |
215 | tmp_inode->i_mode |= S_IFLNK; */ | 215 | tmp_inode->i_mode |= S_IFLNK; */ |
216 | } else { | 216 | } else { |
217 | *pobject_type = DT_REG; | 217 | *pobject_type = DT_REG; |
218 | tmp_inode->i_mode |= S_IFREG; | 218 | tmp_inode->i_mode |= S_IFREG; |
@@ -220,7 +220,7 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type, | |||
220 | tmp_inode->i_mode &= ~(S_IWUGO); | 220 | tmp_inode->i_mode &= ~(S_IWUGO); |
221 | else if ((tmp_inode->i_mode & S_IWUGO) == 0) | 221 | else if ((tmp_inode->i_mode & S_IWUGO) == 0) |
222 | /* the ATTR_READONLY flag may have been changed on */ | 222 | /* the ATTR_READONLY flag may have been changed on */ |
223 | /* server -- set any w bits allowed by mnt_file_mode */ | 223 | /* server -- set any w bits allowed by mnt_file_mode */ |
224 | tmp_inode->i_mode |= (S_IWUGO & cifs_sb->mnt_file_mode); | 224 | tmp_inode->i_mode |= (S_IWUGO & cifs_sb->mnt_file_mode); |
225 | } /* could add code here - to validate if device or weird share type? */ | 225 | } /* could add code here - to validate if device or weird share type? */ |
226 | 226 | ||
@@ -231,7 +231,7 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type, | |||
231 | 231 | ||
232 | spin_lock(&tmp_inode->i_lock); | 232 | spin_lock(&tmp_inode->i_lock); |
233 | if (is_size_safe_to_change(cifsInfo, end_of_file)) { | 233 | if (is_size_safe_to_change(cifsInfo, end_of_file)) { |
234 | /* can not safely change the file size here if the | 234 | /* can not safely change the file size here if the |
235 | client is writing to it due to potential races */ | 235 | client is writing to it due to potential races */ |
236 | i_size_write(tmp_inode, end_of_file); | 236 | i_size_write(tmp_inode, end_of_file); |
237 | 237 | ||
@@ -254,7 +254,6 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type, | |||
254 | tmp_inode->i_fop = &cifs_file_direct_nobrl_ops; | 254 | tmp_inode->i_fop = &cifs_file_direct_nobrl_ops; |
255 | else | 255 | else |
256 | tmp_inode->i_fop = &cifs_file_direct_ops; | 256 | tmp_inode->i_fop = &cifs_file_direct_ops; |
257 | |||
258 | } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | 257 | } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) |
259 | tmp_inode->i_fop = &cifs_file_nobrl_ops; | 258 | tmp_inode->i_fop = &cifs_file_nobrl_ops; |
260 | else | 259 | else |
@@ -322,8 +321,8 @@ static void unix_fill_in_inode(struct inode *tmp_inode, | |||
322 | 321 | ||
323 | tmp_inode->i_mode = le64_to_cpu(pfindData->Permissions); | 322 | tmp_inode->i_mode = le64_to_cpu(pfindData->Permissions); |
324 | /* since we set the inode type below we need to mask off type | 323 | /* since we set the inode type below we need to mask off type |
325 | to avoid strange results if bits above were corrupt */ | 324 | to avoid strange results if bits above were corrupt */ |
326 | tmp_inode->i_mode &= ~S_IFMT; | 325 | tmp_inode->i_mode &= ~S_IFMT; |
327 | if (type == UNIX_FILE) { | 326 | if (type == UNIX_FILE) { |
328 | *pobject_type = DT_REG; | 327 | *pobject_type = DT_REG; |
329 | tmp_inode->i_mode |= S_IFREG; | 328 | tmp_inode->i_mode |= S_IFREG; |
@@ -353,7 +352,7 @@ static void unix_fill_in_inode(struct inode *tmp_inode, | |||
353 | /* safest to just call it a file */ | 352 | /* safest to just call it a file */ |
354 | *pobject_type = DT_REG; | 353 | *pobject_type = DT_REG; |
355 | tmp_inode->i_mode |= S_IFREG; | 354 | tmp_inode->i_mode |= S_IFREG; |
356 | cFYI(1,("unknown inode type %d",type)); | 355 | cFYI(1, ("unknown inode type %d", type)); |
357 | } | 356 | } |
358 | 357 | ||
359 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID) | 358 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID) |
@@ -368,7 +367,7 @@ static void unix_fill_in_inode(struct inode *tmp_inode, | |||
368 | 367 | ||
369 | spin_lock(&tmp_inode->i_lock); | 368 | spin_lock(&tmp_inode->i_lock); |
370 | if (is_size_safe_to_change(cifsInfo, end_of_file)) { | 369 | if (is_size_safe_to_change(cifsInfo, end_of_file)) { |
371 | /* can not safely change the file size here if the | 370 | /* can not safely change the file size here if the |
372 | client is writing to it due to potential races */ | 371 | client is writing to it due to potential races */ |
373 | i_size_write(tmp_inode, end_of_file); | 372 | i_size_write(tmp_inode, end_of_file); |
374 | 373 | ||
@@ -393,15 +392,16 @@ static void unix_fill_in_inode(struct inode *tmp_inode, | |||
393 | tmp_inode->i_fop = &cifs_file_ops; | 392 | tmp_inode->i_fop = &cifs_file_ops; |
394 | 393 | ||
395 | if ((cifs_sb->tcon) && (cifs_sb->tcon->ses) && | 394 | if ((cifs_sb->tcon) && (cifs_sb->tcon->ses) && |
396 | (cifs_sb->tcon->ses->server->maxBuf < | 395 | (cifs_sb->tcon->ses->server->maxBuf < |
397 | PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE)) | 396 | PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE)) |
398 | tmp_inode->i_data.a_ops = &cifs_addr_ops_smallbuf; | 397 | tmp_inode->i_data.a_ops = &cifs_addr_ops_smallbuf; |
399 | else | 398 | else |
400 | tmp_inode->i_data.a_ops = &cifs_addr_ops; | 399 | tmp_inode->i_data.a_ops = &cifs_addr_ops; |
401 | 400 | ||
402 | if (isNewInode) | 401 | if (isNewInode) |
403 | return; /* No sense invalidating pages for new inode since we | 402 | return; /* No sense invalidating pages for new inode |
404 | have not started caching readahead file data yet */ | 403 | since we have not started caching readahead |
404 | file data for it yet */ | ||
405 | 405 | ||
406 | if (timespec_equal(&tmp_inode->i_mtime, &local_mtime) && | 406 | if (timespec_equal(&tmp_inode->i_mtime, &local_mtime) && |
407 | (local_size == tmp_inode->i_size)) { | 407 | (local_size == tmp_inode->i_size)) { |
@@ -420,7 +420,7 @@ static void unix_fill_in_inode(struct inode *tmp_inode, | |||
420 | tmp_inode->i_op = &cifs_symlink_inode_ops; | 420 | tmp_inode->i_op = &cifs_symlink_inode_ops; |
421 | /* tmp_inode->i_fop = *//* do not need to set to anything */ | 421 | /* tmp_inode->i_fop = *//* do not need to set to anything */ |
422 | } else { | 422 | } else { |
423 | cFYI(1, ("Special inode")); | 423 | cFYI(1, ("Special inode")); |
424 | init_special_inode(tmp_inode, tmp_inode->i_mode, | 424 | init_special_inode(tmp_inode, tmp_inode->i_mode, |
425 | tmp_inode->i_rdev); | 425 | tmp_inode->i_rdev); |
426 | } | 426 | } |
@@ -429,14 +429,14 @@ static void unix_fill_in_inode(struct inode *tmp_inode, | |||
429 | static int initiate_cifs_search(const int xid, struct file *file) | 429 | static int initiate_cifs_search(const int xid, struct file *file) |
430 | { | 430 | { |
431 | int rc = 0; | 431 | int rc = 0; |
432 | char * full_path; | 432 | char *full_path; |
433 | struct cifsFileInfo * cifsFile; | 433 | struct cifsFileInfo *cifsFile; |
434 | struct cifs_sb_info *cifs_sb; | 434 | struct cifs_sb_info *cifs_sb; |
435 | struct cifsTconInfo *pTcon; | 435 | struct cifsTconInfo *pTcon; |
436 | 436 | ||
437 | if (file->private_data == NULL) { | 437 | if (file->private_data == NULL) { |
438 | file->private_data = | 438 | file->private_data = |
439 | kzalloc(sizeof(struct cifsFileInfo),GFP_KERNEL); | 439 | kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); |
440 | } | 440 | } |
441 | 441 | ||
442 | if (file->private_data == NULL) | 442 | if (file->private_data == NULL) |
@@ -463,9 +463,11 @@ static int initiate_cifs_search(const int xid, struct file *file) | |||
463 | 463 | ||
464 | ffirst_retry: | 464 | ffirst_retry: |
465 | /* test for Unix extensions */ | 465 | /* test for Unix extensions */ |
466 | if (pTcon->ses->capabilities & CAP_UNIX) { | 466 | /* but now check for them on the share/mount not on the SMB session */ |
467 | /* if (pTcon->ses->capabilities & CAP_UNIX) { */ | ||
468 | if (pTcon->unix_ext) { | ||
467 | cifsFile->srch_inf.info_level = SMB_FIND_FILE_UNIX; | 469 | cifsFile->srch_inf.info_level = SMB_FIND_FILE_UNIX; |
468 | } else if ((pTcon->ses->capabilities & | 470 | } else if ((pTcon->ses->capabilities & |
469 | (CAP_NT_SMBS | CAP_NT_FIND)) == 0) { | 471 | (CAP_NT_SMBS | CAP_NT_FIND)) == 0) { |
470 | cifsFile->srch_inf.info_level = SMB_FIND_FILE_INFO_STANDARD; | 472 | cifsFile->srch_inf.info_level = SMB_FIND_FILE_INFO_STANDARD; |
471 | } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { | 473 | } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { |
@@ -474,13 +476,13 @@ ffirst_retry: | |||
474 | cifsFile->srch_inf.info_level = SMB_FIND_FILE_DIRECTORY_INFO; | 476 | cifsFile->srch_inf.info_level = SMB_FIND_FILE_DIRECTORY_INFO; |
475 | } | 477 | } |
476 | 478 | ||
477 | rc = CIFSFindFirst(xid, pTcon,full_path,cifs_sb->local_nls, | 479 | rc = CIFSFindFirst(xid, pTcon, full_path, cifs_sb->local_nls, |
478 | &cifsFile->netfid, &cifsFile->srch_inf, | 480 | &cifsFile->netfid, &cifsFile->srch_inf, |
479 | cifs_sb->mnt_cifs_flags & | 481 | cifs_sb->mnt_cifs_flags & |
480 | CIFS_MOUNT_MAP_SPECIAL_CHR, CIFS_DIR_SEP(cifs_sb)); | 482 | CIFS_MOUNT_MAP_SPECIAL_CHR, CIFS_DIR_SEP(cifs_sb)); |
481 | if (rc == 0) | 483 | if (rc == 0) |
482 | cifsFile->invalidHandle = FALSE; | 484 | cifsFile->invalidHandle = FALSE; |
483 | if ((rc == -EOPNOTSUPP) && | 485 | if ((rc == -EOPNOTSUPP) && |
484 | (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)) { | 486 | (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)) { |
485 | cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM; | 487 | cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM; |
486 | goto ffirst_retry; | 488 | goto ffirst_retry; |
@@ -495,17 +497,17 @@ static int cifs_unicode_bytelen(char *str) | |||
495 | int len; | 497 | int len; |
496 | __le16 * ustr = (__le16 *)str; | 498 | __le16 * ustr = (__le16 *)str; |
497 | 499 | ||
498 | for(len=0;len <= PATH_MAX;len++) { | 500 | for (len = 0; len <= PATH_MAX; len++) { |
499 | if (ustr[len] == 0) | 501 | if (ustr[len] == 0) |
500 | return len << 1; | 502 | return len << 1; |
501 | } | 503 | } |
502 | cFYI(1,("Unicode string longer than PATH_MAX found")); | 504 | cFYI(1, ("Unicode string longer than PATH_MAX found")); |
503 | return len << 1; | 505 | return len << 1; |
504 | } | 506 | } |
505 | 507 | ||
506 | static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level) | 508 | static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level) |
507 | { | 509 | { |
508 | char * new_entry; | 510 | char *new_entry; |
509 | FILE_DIRECTORY_INFO * pDirInfo = (FILE_DIRECTORY_INFO *)old_entry; | 511 | FILE_DIRECTORY_INFO * pDirInfo = (FILE_DIRECTORY_INFO *)old_entry; |
510 | 512 | ||
511 | if (level == SMB_FIND_FILE_INFO_STANDARD) { | 513 | if (level == SMB_FIND_FILE_INFO_STANDARD) { |
@@ -516,21 +518,21 @@ static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level) | |||
516 | pfData->FileNameLength; | 518 | pfData->FileNameLength; |
517 | } else | 519 | } else |
518 | new_entry = old_entry + le32_to_cpu(pDirInfo->NextEntryOffset); | 520 | new_entry = old_entry + le32_to_cpu(pDirInfo->NextEntryOffset); |
519 | cFYI(1,("new entry %p old entry %p",new_entry,old_entry)); | 521 | cFYI(1, ("new entry %p old entry %p", new_entry, old_entry)); |
520 | /* validate that new_entry is not past end of SMB */ | 522 | /* validate that new_entry is not past end of SMB */ |
521 | if (new_entry >= end_of_smb) { | 523 | if (new_entry >= end_of_smb) { |
522 | cERROR(1, | 524 | cERROR(1, |
523 | ("search entry %p began after end of SMB %p old entry %p", | 525 | ("search entry %p began after end of SMB %p old entry %p", |
524 | new_entry, end_of_smb, old_entry)); | 526 | new_entry, end_of_smb, old_entry)); |
525 | return NULL; | 527 | return NULL; |
526 | } else if (((level == SMB_FIND_FILE_INFO_STANDARD) && | 528 | } else if (((level == SMB_FIND_FILE_INFO_STANDARD) && |
527 | (new_entry + sizeof(FIND_FILE_STANDARD_INFO) > end_of_smb)) || | 529 | (new_entry + sizeof(FIND_FILE_STANDARD_INFO) > end_of_smb)) |
528 | ((level != SMB_FIND_FILE_INFO_STANDARD) && | 530 | || ((level != SMB_FIND_FILE_INFO_STANDARD) && |
529 | (new_entry + sizeof(FILE_DIRECTORY_INFO) > end_of_smb))) { | 531 | (new_entry + sizeof(FILE_DIRECTORY_INFO) > end_of_smb))) { |
530 | cERROR(1,("search entry %p extends after end of SMB %p", | 532 | cERROR(1, ("search entry %p extends after end of SMB %p", |
531 | new_entry, end_of_smb)); | 533 | new_entry, end_of_smb)); |
532 | return NULL; | 534 | return NULL; |
533 | } else | 535 | } else |
534 | return new_entry; | 536 | return new_entry; |
535 | 537 | ||
536 | } | 538 | } |
@@ -541,8 +543,8 @@ static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level) | |||
541 | static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile) | 543 | static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile) |
542 | { | 544 | { |
543 | int rc = 0; | 545 | int rc = 0; |
544 | char * filename = NULL; | 546 | char *filename = NULL; |
545 | int len = 0; | 547 | int len = 0; |
546 | 548 | ||
547 | if (cfile->srch_inf.info_level == SMB_FIND_FILE_UNIX) { | 549 | if (cfile->srch_inf.info_level == SMB_FIND_FILE_UNIX) { |
548 | FILE_UNIX_INFO * pFindData = (FILE_UNIX_INFO *)current_entry; | 550 | FILE_UNIX_INFO * pFindData = (FILE_UNIX_INFO *)current_entry; |
@@ -554,25 +556,25 @@ static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile) | |||
554 | len = strnlen(filename, 5); | 556 | len = strnlen(filename, 5); |
555 | } | 557 | } |
556 | } else if (cfile->srch_inf.info_level == SMB_FIND_FILE_DIRECTORY_INFO) { | 558 | } else if (cfile->srch_inf.info_level == SMB_FIND_FILE_DIRECTORY_INFO) { |
557 | FILE_DIRECTORY_INFO * pFindData = | 559 | FILE_DIRECTORY_INFO * pFindData = |
558 | (FILE_DIRECTORY_INFO *)current_entry; | 560 | (FILE_DIRECTORY_INFO *)current_entry; |
559 | filename = &pFindData->FileName[0]; | 561 | filename = &pFindData->FileName[0]; |
560 | len = le32_to_cpu(pFindData->FileNameLength); | 562 | len = le32_to_cpu(pFindData->FileNameLength); |
561 | } else if (cfile->srch_inf.info_level == | 563 | } else if (cfile->srch_inf.info_level == |
562 | SMB_FIND_FILE_FULL_DIRECTORY_INFO) { | 564 | SMB_FIND_FILE_FULL_DIRECTORY_INFO) { |
563 | FILE_FULL_DIRECTORY_INFO * pFindData = | 565 | FILE_FULL_DIRECTORY_INFO * pFindData = |
564 | (FILE_FULL_DIRECTORY_INFO *)current_entry; | 566 | (FILE_FULL_DIRECTORY_INFO *)current_entry; |
565 | filename = &pFindData->FileName[0]; | 567 | filename = &pFindData->FileName[0]; |
566 | len = le32_to_cpu(pFindData->FileNameLength); | 568 | len = le32_to_cpu(pFindData->FileNameLength); |
567 | } else if (cfile->srch_inf.info_level == | 569 | } else if (cfile->srch_inf.info_level == |
568 | SMB_FIND_FILE_ID_FULL_DIR_INFO) { | 570 | SMB_FIND_FILE_ID_FULL_DIR_INFO) { |
569 | SEARCH_ID_FULL_DIR_INFO * pFindData = | 571 | SEARCH_ID_FULL_DIR_INFO * pFindData = |
570 | (SEARCH_ID_FULL_DIR_INFO *)current_entry; | 572 | (SEARCH_ID_FULL_DIR_INFO *)current_entry; |
571 | filename = &pFindData->FileName[0]; | 573 | filename = &pFindData->FileName[0]; |
572 | len = le32_to_cpu(pFindData->FileNameLength); | 574 | len = le32_to_cpu(pFindData->FileNameLength); |
573 | } else if (cfile->srch_inf.info_level == | 575 | } else if (cfile->srch_inf.info_level == |
574 | SMB_FIND_FILE_BOTH_DIRECTORY_INFO) { | 576 | SMB_FIND_FILE_BOTH_DIRECTORY_INFO) { |
575 | FILE_BOTH_DIRECTORY_INFO * pFindData = | 577 | FILE_BOTH_DIRECTORY_INFO * pFindData = |
576 | (FILE_BOTH_DIRECTORY_INFO *)current_entry; | 578 | (FILE_BOTH_DIRECTORY_INFO *)current_entry; |
577 | filename = &pFindData->FileName[0]; | 579 | filename = &pFindData->FileName[0]; |
578 | len = le32_to_cpu(pFindData->FileNameLength); | 580 | len = le32_to_cpu(pFindData->FileNameLength); |
@@ -582,7 +584,8 @@ static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile) | |||
582 | filename = &pFindData->FileName[0]; | 584 | filename = &pFindData->FileName[0]; |
583 | len = pFindData->FileNameLength; | 585 | len = pFindData->FileNameLength; |
584 | } else { | 586 | } else { |
585 | cFYI(1,("Unknown findfirst level %d",cfile->srch_inf.info_level)); | 587 | cFYI(1, ("Unknown findfirst level %d", |
588 | cfile->srch_inf.info_level)); | ||
586 | } | 589 | } |
587 | 590 | ||
588 | if (filename) { | 591 | if (filename) { |
@@ -595,15 +598,15 @@ static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile) | |||
595 | } else if (len == 4) { | 598 | } else if (len == 4) { |
596 | /* check for .. */ | 599 | /* check for .. */ |
597 | if ((ufilename[0] == UNICODE_DOT) | 600 | if ((ufilename[0] == UNICODE_DOT) |
598 | &&(ufilename[1] == UNICODE_DOT)) | 601 | && (ufilename[1] == UNICODE_DOT)) |
599 | rc = 2; | 602 | rc = 2; |
600 | } | 603 | } |
601 | } else /* ASCII */ { | 604 | } else /* ASCII */ { |
602 | if (len == 1) { | 605 | if (len == 1) { |
603 | if (filename[0] == '.') | 606 | if (filename[0] == '.') |
604 | rc = 1; | 607 | rc = 1; |
605 | } else if (len == 2) { | 608 | } else if (len == 2) { |
606 | if((filename[0] == '.') && (filename[1] == '.')) | 609 | if ((filename[0] == '.') && (filename[1] == '.')) |
607 | rc = 2; | 610 | rc = 2; |
608 | } | 611 | } |
609 | } | 612 | } |
@@ -614,7 +617,7 @@ static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile) | |||
614 | 617 | ||
615 | /* Check if directory that we are searching has changed so we can decide | 618 | /* Check if directory that we are searching has changed so we can decide |
616 | whether we can use the cached search results from the previous search */ | 619 | whether we can use the cached search results from the previous search */ |
617 | static int is_dir_changed(struct file * file) | 620 | static int is_dir_changed(struct file *file) |
618 | { | 621 | { |
619 | struct inode *inode = file->f_path.dentry->d_inode; | 622 | struct inode *inode = file->f_path.dentry->d_inode; |
620 | struct cifsInodeInfo *cifsInfo = CIFS_I(inode); | 623 | struct cifsInodeInfo *cifsInfo = CIFS_I(inode); |
@@ -633,22 +636,22 @@ static int is_dir_changed(struct file * file) | |||
633 | /* We start counting in the buffer with entry 2 and increment for every | 636 | /* We start counting in the buffer with entry 2 and increment for every |
634 | entry (do not increment for . or .. entry) */ | 637 | entry (do not increment for . or .. entry) */ |
635 | static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, | 638 | static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, |
636 | struct file *file, char **ppCurrentEntry, int *num_to_ret) | 639 | struct file *file, char **ppCurrentEntry, int *num_to_ret) |
637 | { | 640 | { |
638 | int rc = 0; | 641 | int rc = 0; |
639 | int pos_in_buf = 0; | 642 | int pos_in_buf = 0; |
640 | loff_t first_entry_in_buffer; | 643 | loff_t first_entry_in_buffer; |
641 | loff_t index_to_find = file->f_pos; | 644 | loff_t index_to_find = file->f_pos; |
642 | struct cifsFileInfo * cifsFile = file->private_data; | 645 | struct cifsFileInfo *cifsFile = file->private_data; |
643 | /* check if index in the buffer */ | 646 | /* check if index in the buffer */ |
644 | 647 | ||
645 | if ((cifsFile == NULL) || (ppCurrentEntry == NULL) || | 648 | if ((cifsFile == NULL) || (ppCurrentEntry == NULL) || |
646 | (num_to_ret == NULL)) | 649 | (num_to_ret == NULL)) |
647 | return -ENOENT; | 650 | return -ENOENT; |
648 | 651 | ||
649 | *ppCurrentEntry = NULL; | 652 | *ppCurrentEntry = NULL; |
650 | first_entry_in_buffer = | 653 | first_entry_in_buffer = |
651 | cifsFile->srch_inf.index_of_last_entry - | 654 | cifsFile->srch_inf.index_of_last_entry - |
652 | cifsFile->srch_inf.entries_in_buffer; | 655 | cifsFile->srch_inf.entries_in_buffer; |
653 | 656 | ||
654 | /* if first entry in buf is zero then is first buffer | 657 | /* if first entry in buf is zero then is first buffer |
@@ -660,17 +663,17 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, | |||
660 | #ifdef CONFIG_CIFS_DEBUG2 | 663 | #ifdef CONFIG_CIFS_DEBUG2 |
661 | dump_cifs_file_struct(file, "In fce "); | 664 | dump_cifs_file_struct(file, "In fce "); |
662 | #endif | 665 | #endif |
663 | if (((index_to_find < cifsFile->srch_inf.index_of_last_entry) && | 666 | if (((index_to_find < cifsFile->srch_inf.index_of_last_entry) && |
664 | is_dir_changed(file)) || | 667 | is_dir_changed(file)) || |
665 | (index_to_find < first_entry_in_buffer)) { | 668 | (index_to_find < first_entry_in_buffer)) { |
666 | /* close and restart search */ | 669 | /* close and restart search */ |
667 | cFYI(1,("search backing up - close and restart search")); | 670 | cFYI(1, ("search backing up - close and restart search")); |
668 | cifsFile->invalidHandle = TRUE; | 671 | cifsFile->invalidHandle = TRUE; |
669 | CIFSFindClose(xid, pTcon, cifsFile->netfid); | 672 | CIFSFindClose(xid, pTcon, cifsFile->netfid); |
670 | kfree(cifsFile->search_resume_name); | 673 | kfree(cifsFile->search_resume_name); |
671 | cifsFile->search_resume_name = NULL; | 674 | cifsFile->search_resume_name = NULL; |
672 | if (cifsFile->srch_inf.ntwrk_buf_start) { | 675 | if (cifsFile->srch_inf.ntwrk_buf_start) { |
673 | cFYI(1,("freeing SMB ff cache buf on search rewind")); | 676 | cFYI(1, ("freeing SMB ff cache buf on search rewind")); |
674 | if (cifsFile->srch_inf.smallBuf) | 677 | if (cifsFile->srch_inf.smallBuf) |
675 | cifs_small_buf_release(cifsFile->srch_inf. | 678 | cifs_small_buf_release(cifsFile->srch_inf. |
676 | ntwrk_buf_start); | 679 | ntwrk_buf_start); |
@@ -678,17 +681,18 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, | |||
678 | cifs_buf_release(cifsFile->srch_inf. | 681 | cifs_buf_release(cifsFile->srch_inf. |
679 | ntwrk_buf_start); | 682 | ntwrk_buf_start); |
680 | } | 683 | } |
681 | rc = initiate_cifs_search(xid,file); | 684 | rc = initiate_cifs_search(xid, file); |
682 | if (rc) { | 685 | if (rc) { |
683 | cFYI(1,("error %d reinitiating a search on rewind",rc)); | 686 | cFYI(1, ("error %d reinitiating a search on rewind", |
687 | rc)); | ||
684 | return rc; | 688 | return rc; |
685 | } | 689 | } |
686 | } | 690 | } |
687 | 691 | ||
688 | while((index_to_find >= cifsFile->srch_inf.index_of_last_entry) && | 692 | while ((index_to_find >= cifsFile->srch_inf.index_of_last_entry) && |
689 | (rc == 0) && (cifsFile->srch_inf.endOfSearch == FALSE)){ | 693 | (rc == 0) && (cifsFile->srch_inf.endOfSearch == FALSE)) { |
690 | cFYI(1,("calling findnext2")); | 694 | cFYI(1, ("calling findnext2")); |
691 | rc = CIFSFindNext(xid,pTcon,cifsFile->netfid, | 695 | rc = CIFSFindNext(xid, pTcon, cifsFile->netfid, |
692 | &cifsFile->srch_inf); | 696 | &cifsFile->srch_inf); |
693 | if (rc) | 697 | if (rc) |
694 | return -ENOENT; | 698 | return -ENOENT; |
@@ -697,8 +701,8 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, | |||
697 | /* we found the buffer that contains the entry */ | 701 | /* we found the buffer that contains the entry */ |
698 | /* scan and find it */ | 702 | /* scan and find it */ |
699 | int i; | 703 | int i; |
700 | char * current_entry; | 704 | char *current_entry; |
701 | char * end_of_smb = cifsFile->srch_inf.ntwrk_buf_start + | 705 | char *end_of_smb = cifsFile->srch_inf.ntwrk_buf_start + |
702 | smbCalcSize((struct smb_hdr *) | 706 | smbCalcSize((struct smb_hdr *) |
703 | cifsFile->srch_inf.ntwrk_buf_start); | 707 | cifsFile->srch_inf.ntwrk_buf_start); |
704 | 708 | ||
@@ -706,28 +710,28 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, | |||
706 | first_entry_in_buffer = cifsFile->srch_inf.index_of_last_entry | 710 | first_entry_in_buffer = cifsFile->srch_inf.index_of_last_entry |
707 | - cifsFile->srch_inf.entries_in_buffer; | 711 | - cifsFile->srch_inf.entries_in_buffer; |
708 | pos_in_buf = index_to_find - first_entry_in_buffer; | 712 | pos_in_buf = index_to_find - first_entry_in_buffer; |
709 | cFYI(1,("found entry - pos_in_buf %d",pos_in_buf)); | 713 | cFYI(1, ("found entry - pos_in_buf %d", pos_in_buf)); |
710 | 714 | ||
711 | for(i=0;(i<(pos_in_buf)) && (current_entry != NULL);i++) { | 715 | for (i=0; (i < (pos_in_buf)) && (current_entry != NULL); i++) { |
712 | /* go entry by entry figuring out which is first */ | 716 | /* go entry by entry figuring out which is first */ |
713 | current_entry = nxt_dir_entry(current_entry,end_of_smb, | 717 | current_entry = nxt_dir_entry(current_entry, end_of_smb, |
714 | cifsFile->srch_inf.info_level); | 718 | cifsFile->srch_inf.info_level); |
715 | } | 719 | } |
716 | if((current_entry == NULL) && (i < pos_in_buf)) { | 720 | if ((current_entry == NULL) && (i < pos_in_buf)) { |
717 | /* BB fixme - check if we should flag this error */ | 721 | /* BB fixme - check if we should flag this error */ |
718 | cERROR(1,("reached end of buf searching for pos in buf" | 722 | cERROR(1, ("reached end of buf searching for pos in buf" |
719 | " %d index to find %lld rc %d", | 723 | " %d index to find %lld rc %d", |
720 | pos_in_buf,index_to_find,rc)); | 724 | pos_in_buf, index_to_find, rc)); |
721 | } | 725 | } |
722 | rc = 0; | 726 | rc = 0; |
723 | *ppCurrentEntry = current_entry; | 727 | *ppCurrentEntry = current_entry; |
724 | } else { | 728 | } else { |
725 | cFYI(1,("index not in buffer - could not findnext into it")); | 729 | cFYI(1, ("index not in buffer - could not findnext into it")); |
726 | return 0; | 730 | return 0; |
727 | } | 731 | } |
728 | 732 | ||
729 | if(pos_in_buf >= cifsFile->srch_inf.entries_in_buffer) { | 733 | if (pos_in_buf >= cifsFile->srch_inf.entries_in_buffer) { |
730 | cFYI(1,("can not return entries pos_in_buf beyond last entry")); | 734 | cFYI(1, ("can not return entries pos_in_buf beyond last")); |
731 | *num_to_ret = 0; | 735 | *num_to_ret = 0; |
732 | } else | 736 | } else |
733 | *num_to_ret = cifsFile->srch_inf.entries_in_buffer - pos_in_buf; | 737 | *num_to_ret = cifsFile->srch_inf.entries_in_buffer - pos_in_buf; |
@@ -738,81 +742,81 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, | |||
738 | /* inode num, inode type and filename returned */ | 742 | /* inode num, inode type and filename returned */ |
739 | static int cifs_get_name_from_search_buf(struct qstr *pqst, | 743 | static int cifs_get_name_from_search_buf(struct qstr *pqst, |
740 | char *current_entry, __u16 level, unsigned int unicode, | 744 | char *current_entry, __u16 level, unsigned int unicode, |
741 | struct cifs_sb_info * cifs_sb, int max_len, ino_t *pinum) | 745 | struct cifs_sb_info *cifs_sb, int max_len, ino_t *pinum) |
742 | { | 746 | { |
743 | int rc = 0; | 747 | int rc = 0; |
744 | unsigned int len = 0; | 748 | unsigned int len = 0; |
745 | char * filename; | 749 | char *filename; |
746 | struct nls_table * nlt = cifs_sb->local_nls; | 750 | struct nls_table *nlt = cifs_sb->local_nls; |
747 | 751 | ||
748 | *pinum = 0; | 752 | *pinum = 0; |
749 | 753 | ||
750 | if(level == SMB_FIND_FILE_UNIX) { | 754 | if (level == SMB_FIND_FILE_UNIX) { |
751 | FILE_UNIX_INFO * pFindData = (FILE_UNIX_INFO *)current_entry; | 755 | FILE_UNIX_INFO *pFindData = (FILE_UNIX_INFO *)current_entry; |
752 | 756 | ||
753 | filename = &pFindData->FileName[0]; | 757 | filename = &pFindData->FileName[0]; |
754 | if(unicode) { | 758 | if (unicode) { |
755 | len = cifs_unicode_bytelen(filename); | 759 | len = cifs_unicode_bytelen(filename); |
756 | } else { | 760 | } else { |
757 | /* BB should we make this strnlen of PATH_MAX? */ | 761 | /* BB should we make this strnlen of PATH_MAX? */ |
758 | len = strnlen(filename, PATH_MAX); | 762 | len = strnlen(filename, PATH_MAX); |
759 | } | 763 | } |
760 | 764 | ||
761 | /* BB fixme - hash low and high 32 bits if not 64 bit arch BB fixme */ | 765 | /* BB fixme - hash low and high 32 bits if not 64 bit arch BB */ |
762 | if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) | 766 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) |
763 | *pinum = pFindData->UniqueId; | 767 | *pinum = pFindData->UniqueId; |
764 | } else if(level == SMB_FIND_FILE_DIRECTORY_INFO) { | 768 | } else if (level == SMB_FIND_FILE_DIRECTORY_INFO) { |
765 | FILE_DIRECTORY_INFO * pFindData = | 769 | FILE_DIRECTORY_INFO *pFindData = |
766 | (FILE_DIRECTORY_INFO *)current_entry; | 770 | (FILE_DIRECTORY_INFO *)current_entry; |
767 | filename = &pFindData->FileName[0]; | 771 | filename = &pFindData->FileName[0]; |
768 | len = le32_to_cpu(pFindData->FileNameLength); | 772 | len = le32_to_cpu(pFindData->FileNameLength); |
769 | } else if(level == SMB_FIND_FILE_FULL_DIRECTORY_INFO) { | 773 | } else if (level == SMB_FIND_FILE_FULL_DIRECTORY_INFO) { |
770 | FILE_FULL_DIRECTORY_INFO * pFindData = | 774 | FILE_FULL_DIRECTORY_INFO *pFindData = |
771 | (FILE_FULL_DIRECTORY_INFO *)current_entry; | 775 | (FILE_FULL_DIRECTORY_INFO *)current_entry; |
772 | filename = &pFindData->FileName[0]; | 776 | filename = &pFindData->FileName[0]; |
773 | len = le32_to_cpu(pFindData->FileNameLength); | 777 | len = le32_to_cpu(pFindData->FileNameLength); |
774 | } else if(level == SMB_FIND_FILE_ID_FULL_DIR_INFO) { | 778 | } else if (level == SMB_FIND_FILE_ID_FULL_DIR_INFO) { |
775 | SEARCH_ID_FULL_DIR_INFO * pFindData = | 779 | SEARCH_ID_FULL_DIR_INFO *pFindData = |
776 | (SEARCH_ID_FULL_DIR_INFO *)current_entry; | 780 | (SEARCH_ID_FULL_DIR_INFO *)current_entry; |
777 | filename = &pFindData->FileName[0]; | 781 | filename = &pFindData->FileName[0]; |
778 | len = le32_to_cpu(pFindData->FileNameLength); | 782 | len = le32_to_cpu(pFindData->FileNameLength); |
779 | *pinum = pFindData->UniqueId; | 783 | *pinum = pFindData->UniqueId; |
780 | } else if(level == SMB_FIND_FILE_BOTH_DIRECTORY_INFO) { | 784 | } else if (level == SMB_FIND_FILE_BOTH_DIRECTORY_INFO) { |
781 | FILE_BOTH_DIRECTORY_INFO * pFindData = | 785 | FILE_BOTH_DIRECTORY_INFO *pFindData = |
782 | (FILE_BOTH_DIRECTORY_INFO *)current_entry; | 786 | (FILE_BOTH_DIRECTORY_INFO *)current_entry; |
783 | filename = &pFindData->FileName[0]; | 787 | filename = &pFindData->FileName[0]; |
784 | len = le32_to_cpu(pFindData->FileNameLength); | 788 | len = le32_to_cpu(pFindData->FileNameLength); |
785 | } else if(level == SMB_FIND_FILE_INFO_STANDARD) { | 789 | } else if (level == SMB_FIND_FILE_INFO_STANDARD) { |
786 | FIND_FILE_STANDARD_INFO * pFindData = | 790 | FIND_FILE_STANDARD_INFO * pFindData = |
787 | (FIND_FILE_STANDARD_INFO *)current_entry; | 791 | (FIND_FILE_STANDARD_INFO *)current_entry; |
788 | filename = &pFindData->FileName[0]; | 792 | filename = &pFindData->FileName[0]; |
789 | /* one byte length, no name conversion */ | 793 | /* one byte length, no name conversion */ |
790 | len = (unsigned int)pFindData->FileNameLength; | 794 | len = (unsigned int)pFindData->FileNameLength; |
791 | } else { | 795 | } else { |
792 | cFYI(1,("Unknown findfirst level %d",level)); | 796 | cFYI(1, ("Unknown findfirst level %d", level)); |
793 | return -EINVAL; | 797 | return -EINVAL; |
794 | } | 798 | } |
795 | 799 | ||
796 | if(len > max_len) { | 800 | if (len > max_len) { |
797 | cERROR(1,("bad search response length %d past smb end", len)); | 801 | cERROR(1, ("bad search response length %d past smb end", len)); |
798 | return -EINVAL; | 802 | return -EINVAL; |
799 | } | 803 | } |
800 | 804 | ||
801 | if(unicode) { | 805 | if (unicode) { |
802 | /* BB fixme - test with long names */ | 806 | /* BB fixme - test with long names */ |
803 | /* Note converted filename can be longer than in unicode */ | 807 | /* Note converted filename can be longer than in unicode */ |
804 | if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR) | 808 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR) |
805 | pqst->len = cifs_convertUCSpath((char *)pqst->name, | 809 | pqst->len = cifs_convertUCSpath((char *)pqst->name, |
806 | (__le16 *)filename, len/2, nlt); | 810 | (__le16 *)filename, len/2, nlt); |
807 | else | 811 | else |
808 | pqst->len = cifs_strfromUCS_le((char *)pqst->name, | 812 | pqst->len = cifs_strfromUCS_le((char *)pqst->name, |
809 | (__le16 *)filename,len/2,nlt); | 813 | (__le16 *)filename, len/2, nlt); |
810 | } else { | 814 | } else { |
811 | pqst->name = filename; | 815 | pqst->name = filename; |
812 | pqst->len = len; | 816 | pqst->len = len; |
813 | } | 817 | } |
814 | pqst->hash = full_name_hash(pqst->name,pqst->len); | 818 | pqst->hash = full_name_hash(pqst->name, pqst->len); |
815 | /* cFYI(1,("filldir on %s",pqst->name)); */ | 819 | /* cFYI(1, ("filldir on %s",pqst->name)); */ |
816 | return rc; | 820 | return rc; |
817 | } | 821 | } |
818 | 822 | ||
@@ -821,49 +825,50 @@ static int cifs_filldir(char *pfindEntry, struct file *file, | |||
821 | { | 825 | { |
822 | int rc = 0; | 826 | int rc = 0; |
823 | struct qstr qstring; | 827 | struct qstr qstring; |
824 | struct cifsFileInfo * pCifsF; | 828 | struct cifsFileInfo *pCifsF; |
825 | unsigned obj_type; | 829 | unsigned obj_type; |
826 | ino_t inum; | 830 | ino_t inum; |
827 | struct cifs_sb_info * cifs_sb; | 831 | struct cifs_sb_info *cifs_sb; |
828 | struct inode *tmp_inode; | 832 | struct inode *tmp_inode; |
829 | struct dentry *tmp_dentry; | 833 | struct dentry *tmp_dentry; |
830 | 834 | ||
831 | /* get filename and len into qstring */ | 835 | /* get filename and len into qstring */ |
832 | /* get dentry */ | 836 | /* get dentry */ |
833 | /* decide whether to create and populate ionde */ | 837 | /* decide whether to create and populate ionde */ |
834 | if((direntry == NULL) || (file == NULL)) | 838 | if ((direntry == NULL) || (file == NULL)) |
835 | return -EINVAL; | 839 | return -EINVAL; |
836 | 840 | ||
837 | pCifsF = file->private_data; | 841 | pCifsF = file->private_data; |
838 | 842 | ||
839 | if((scratch_buf == NULL) || (pfindEntry == NULL) || (pCifsF == NULL)) | 843 | if ((scratch_buf == NULL) || (pfindEntry == NULL) || (pCifsF == NULL)) |
840 | return -ENOENT; | 844 | return -ENOENT; |
841 | 845 | ||
842 | rc = cifs_entry_is_dot(pfindEntry,pCifsF); | 846 | rc = cifs_entry_is_dot(pfindEntry, pCifsF); |
843 | /* skip . and .. since we added them first */ | 847 | /* skip . and .. since we added them first */ |
844 | if(rc != 0) | 848 | if (rc != 0) |
845 | return 0; | 849 | return 0; |
846 | 850 | ||
847 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); | 851 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); |
848 | 852 | ||
849 | qstring.name = scratch_buf; | 853 | qstring.name = scratch_buf; |
850 | rc = cifs_get_name_from_search_buf(&qstring,pfindEntry, | 854 | rc = cifs_get_name_from_search_buf(&qstring, pfindEntry, |
851 | pCifsF->srch_inf.info_level, | 855 | pCifsF->srch_inf.info_level, |
852 | pCifsF->srch_inf.unicode,cifs_sb, | 856 | pCifsF->srch_inf.unicode, cifs_sb, |
853 | max_len, | 857 | max_len, |
854 | &inum /* returned */); | 858 | &inum /* returned */); |
855 | 859 | ||
856 | if(rc) | 860 | if (rc) |
857 | return rc; | 861 | return rc; |
858 | 862 | ||
859 | rc = construct_dentry(&qstring,file,&tmp_inode, &tmp_dentry); | 863 | rc = construct_dentry(&qstring, file, &tmp_inode, &tmp_dentry); |
860 | if((tmp_inode == NULL) || (tmp_dentry == NULL)) | 864 | if ((tmp_inode == NULL) || (tmp_dentry == NULL)) |
861 | return -ENOMEM; | 865 | return -ENOMEM; |
862 | 866 | ||
863 | if(rc) { | 867 | if (rc) { |
864 | /* inode created, we need to hash it with right inode number */ | 868 | /* inode created, we need to hash it with right inode number */ |
865 | if(inum != 0) { | 869 | if (inum != 0) { |
866 | /* BB fixme - hash the 2 32 quantities bits together if necessary BB */ | 870 | /* BB fixme - hash the 2 32 quantities bits together if |
871 | * necessary BB */ | ||
867 | tmp_inode->i_ino = inum; | 872 | tmp_inode->i_ino = inum; |
868 | } | 873 | } |
869 | insert_inode_hash(tmp_inode); | 874 | insert_inode_hash(tmp_inode); |
@@ -872,27 +877,27 @@ static int cifs_filldir(char *pfindEntry, struct file *file, | |||
872 | /* we pass in rc below, indicating whether it is a new inode, | 877 | /* we pass in rc below, indicating whether it is a new inode, |
873 | so we can figure out whether to invalidate the inode cached | 878 | so we can figure out whether to invalidate the inode cached |
874 | data if the file has changed */ | 879 | data if the file has changed */ |
875 | if(pCifsF->srch_inf.info_level == SMB_FIND_FILE_UNIX) | 880 | if (pCifsF->srch_inf.info_level == SMB_FIND_FILE_UNIX) |
876 | unix_fill_in_inode(tmp_inode, | 881 | unix_fill_in_inode(tmp_inode, |
877 | (FILE_UNIX_INFO *)pfindEntry, | 882 | (FILE_UNIX_INFO *)pfindEntry, |
878 | &obj_type, rc); | 883 | &obj_type, rc); |
879 | else if(pCifsF->srch_inf.info_level == SMB_FIND_FILE_INFO_STANDARD) | 884 | else if (pCifsF->srch_inf.info_level == SMB_FIND_FILE_INFO_STANDARD) |
880 | fill_in_inode(tmp_inode, 0 /* old level 1 buffer type */, | 885 | fill_in_inode(tmp_inode, 0 /* old level 1 buffer type */, |
881 | pfindEntry, &obj_type, rc); | 886 | pfindEntry, &obj_type, rc); |
882 | else | 887 | else |
883 | fill_in_inode(tmp_inode, 1 /* NT */, pfindEntry, &obj_type, rc); | 888 | fill_in_inode(tmp_inode, 1 /* NT */, pfindEntry, &obj_type, rc); |
884 | 889 | ||
885 | if(rc) /* new inode - needs to be tied to dentry */ { | 890 | if (rc) /* new inode - needs to be tied to dentry */ { |
886 | d_instantiate(tmp_dentry, tmp_inode); | 891 | d_instantiate(tmp_dentry, tmp_inode); |
887 | if(rc == 2) | 892 | if (rc == 2) |
888 | d_rehash(tmp_dentry); | 893 | d_rehash(tmp_dentry); |
889 | } | 894 | } |
890 | 895 | ||
891 | 896 | ||
892 | rc = filldir(direntry,qstring.name,qstring.len,file->f_pos, | 897 | rc = filldir(direntry, qstring.name, qstring.len, file->f_pos, |
893 | tmp_inode->i_ino,obj_type); | 898 | tmp_inode->i_ino, obj_type); |
894 | if(rc) { | 899 | if (rc) { |
895 | cFYI(1,("filldir rc = %d",rc)); | 900 | cFYI(1, ("filldir rc = %d", rc)); |
896 | /* we can not return filldir errors to the caller | 901 | /* we can not return filldir errors to the caller |
897 | since they are "normal" when the stat blocksize | 902 | since they are "normal" when the stat blocksize |
898 | is too small - we return remapped error instead */ | 903 | is too small - we return remapped error instead */ |
@@ -909,57 +914,57 @@ static int cifs_save_resume_key(const char *current_entry, | |||
909 | int rc = 0; | 914 | int rc = 0; |
910 | unsigned int len = 0; | 915 | unsigned int len = 0; |
911 | __u16 level; | 916 | __u16 level; |
912 | char * filename; | 917 | char *filename; |
913 | 918 | ||
914 | if((cifsFile == NULL) || (current_entry == NULL)) | 919 | if ((cifsFile == NULL) || (current_entry == NULL)) |
915 | return -EINVAL; | 920 | return -EINVAL; |
916 | 921 | ||
917 | level = cifsFile->srch_inf.info_level; | 922 | level = cifsFile->srch_inf.info_level; |
918 | 923 | ||
919 | if(level == SMB_FIND_FILE_UNIX) { | 924 | if (level == SMB_FIND_FILE_UNIX) { |
920 | FILE_UNIX_INFO * pFindData = (FILE_UNIX_INFO *)current_entry; | 925 | FILE_UNIX_INFO * pFindData = (FILE_UNIX_INFO *)current_entry; |
921 | 926 | ||
922 | filename = &pFindData->FileName[0]; | 927 | filename = &pFindData->FileName[0]; |
923 | if(cifsFile->srch_inf.unicode) { | 928 | if (cifsFile->srch_inf.unicode) { |
924 | len = cifs_unicode_bytelen(filename); | 929 | len = cifs_unicode_bytelen(filename); |
925 | } else { | 930 | } else { |
926 | /* BB should we make this strnlen of PATH_MAX? */ | 931 | /* BB should we make this strnlen of PATH_MAX? */ |
927 | len = strnlen(filename, PATH_MAX); | 932 | len = strnlen(filename, PATH_MAX); |
928 | } | 933 | } |
929 | cifsFile->srch_inf.resume_key = pFindData->ResumeKey; | 934 | cifsFile->srch_inf.resume_key = pFindData->ResumeKey; |
930 | } else if(level == SMB_FIND_FILE_DIRECTORY_INFO) { | 935 | } else if (level == SMB_FIND_FILE_DIRECTORY_INFO) { |
931 | FILE_DIRECTORY_INFO * pFindData = | 936 | FILE_DIRECTORY_INFO *pFindData = |
932 | (FILE_DIRECTORY_INFO *)current_entry; | 937 | (FILE_DIRECTORY_INFO *)current_entry; |
933 | filename = &pFindData->FileName[0]; | 938 | filename = &pFindData->FileName[0]; |
934 | len = le32_to_cpu(pFindData->FileNameLength); | 939 | len = le32_to_cpu(pFindData->FileNameLength); |
935 | cifsFile->srch_inf.resume_key = pFindData->FileIndex; | 940 | cifsFile->srch_inf.resume_key = pFindData->FileIndex; |
936 | } else if(level == SMB_FIND_FILE_FULL_DIRECTORY_INFO) { | 941 | } else if (level == SMB_FIND_FILE_FULL_DIRECTORY_INFO) { |
937 | FILE_FULL_DIRECTORY_INFO * pFindData = | 942 | FILE_FULL_DIRECTORY_INFO *pFindData = |
938 | (FILE_FULL_DIRECTORY_INFO *)current_entry; | 943 | (FILE_FULL_DIRECTORY_INFO *)current_entry; |
939 | filename = &pFindData->FileName[0]; | 944 | filename = &pFindData->FileName[0]; |
940 | len = le32_to_cpu(pFindData->FileNameLength); | 945 | len = le32_to_cpu(pFindData->FileNameLength); |
941 | cifsFile->srch_inf.resume_key = pFindData->FileIndex; | 946 | cifsFile->srch_inf.resume_key = pFindData->FileIndex; |
942 | } else if(level == SMB_FIND_FILE_ID_FULL_DIR_INFO) { | 947 | } else if (level == SMB_FIND_FILE_ID_FULL_DIR_INFO) { |
943 | SEARCH_ID_FULL_DIR_INFO * pFindData = | 948 | SEARCH_ID_FULL_DIR_INFO *pFindData = |
944 | (SEARCH_ID_FULL_DIR_INFO *)current_entry; | 949 | (SEARCH_ID_FULL_DIR_INFO *)current_entry; |
945 | filename = &pFindData->FileName[0]; | 950 | filename = &pFindData->FileName[0]; |
946 | len = le32_to_cpu(pFindData->FileNameLength); | 951 | len = le32_to_cpu(pFindData->FileNameLength); |
947 | cifsFile->srch_inf.resume_key = pFindData->FileIndex; | 952 | cifsFile->srch_inf.resume_key = pFindData->FileIndex; |
948 | } else if(level == SMB_FIND_FILE_BOTH_DIRECTORY_INFO) { | 953 | } else if (level == SMB_FIND_FILE_BOTH_DIRECTORY_INFO) { |
949 | FILE_BOTH_DIRECTORY_INFO * pFindData = | 954 | FILE_BOTH_DIRECTORY_INFO *pFindData = |
950 | (FILE_BOTH_DIRECTORY_INFO *)current_entry; | 955 | (FILE_BOTH_DIRECTORY_INFO *)current_entry; |
951 | filename = &pFindData->FileName[0]; | 956 | filename = &pFindData->FileName[0]; |
952 | len = le32_to_cpu(pFindData->FileNameLength); | 957 | len = le32_to_cpu(pFindData->FileNameLength); |
953 | cifsFile->srch_inf.resume_key = pFindData->FileIndex; | 958 | cifsFile->srch_inf.resume_key = pFindData->FileIndex; |
954 | } else if(level == SMB_FIND_FILE_INFO_STANDARD) { | 959 | } else if (level == SMB_FIND_FILE_INFO_STANDARD) { |
955 | FIND_FILE_STANDARD_INFO * pFindData = | 960 | FIND_FILE_STANDARD_INFO *pFindData = |
956 | (FIND_FILE_STANDARD_INFO *)current_entry; | 961 | (FIND_FILE_STANDARD_INFO *)current_entry; |
957 | filename = &pFindData->FileName[0]; | 962 | filename = &pFindData->FileName[0]; |
958 | /* one byte length, no name conversion */ | 963 | /* one byte length, no name conversion */ |
959 | len = (unsigned int)pFindData->FileNameLength; | 964 | len = (unsigned int)pFindData->FileNameLength; |
960 | cifsFile->srch_inf.resume_key = pFindData->ResumeKey; | 965 | cifsFile->srch_inf.resume_key = pFindData->ResumeKey; |
961 | } else { | 966 | } else { |
962 | cFYI(1,("Unknown findfirst level %d",level)); | 967 | cFYI(1, ("Unknown findfirst level %d", level)); |
963 | return -EINVAL; | 968 | return -EINVAL; |
964 | } | 969 | } |
965 | cifsFile->srch_inf.resume_name_len = len; | 970 | cifsFile->srch_inf.resume_name_len = len; |
@@ -970,21 +975,21 @@ static int cifs_save_resume_key(const char *current_entry, | |||
970 | int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) | 975 | int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) |
971 | { | 976 | { |
972 | int rc = 0; | 977 | int rc = 0; |
973 | int xid,i; | 978 | int xid, i; |
974 | struct cifs_sb_info *cifs_sb; | 979 | struct cifs_sb_info *cifs_sb; |
975 | struct cifsTconInfo *pTcon; | 980 | struct cifsTconInfo *pTcon; |
976 | struct cifsFileInfo *cifsFile = NULL; | 981 | struct cifsFileInfo *cifsFile = NULL; |
977 | char * current_entry; | 982 | char *current_entry; |
978 | int num_to_fill = 0; | 983 | int num_to_fill = 0; |
979 | char * tmp_buf = NULL; | 984 | char *tmp_buf = NULL; |
980 | char * end_of_smb; | 985 | char *end_of_smb; |
981 | int max_len; | 986 | int max_len; |
982 | 987 | ||
983 | xid = GetXid(); | 988 | xid = GetXid(); |
984 | 989 | ||
985 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); | 990 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); |
986 | pTcon = cifs_sb->tcon; | 991 | pTcon = cifs_sb->tcon; |
987 | if(pTcon == NULL) | 992 | if (pTcon == NULL) |
988 | return -EINVAL; | 993 | return -EINVAL; |
989 | 994 | ||
990 | switch ((int) file->f_pos) { | 995 | switch ((int) file->f_pos) { |
@@ -1005,27 +1010,27 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) | |||
1005 | } | 1010 | } |
1006 | file->f_pos++; | 1011 | file->f_pos++; |
1007 | default: | 1012 | default: |
1008 | /* 1) If search is active, | 1013 | /* 1) If search is active, |
1009 | is in current search buffer? | 1014 | is in current search buffer? |
1010 | if it before then restart search | 1015 | if it before then restart search |
1011 | if after then keep searching till find it */ | 1016 | if after then keep searching till find it */ |
1012 | 1017 | ||
1013 | if(file->private_data == NULL) { | 1018 | if (file->private_data == NULL) { |
1014 | rc = initiate_cifs_search(xid,file); | 1019 | rc = initiate_cifs_search(xid, file); |
1015 | cFYI(1,("initiate cifs search rc %d",rc)); | 1020 | cFYI(1, ("initiate cifs search rc %d", rc)); |
1016 | if(rc) { | 1021 | if (rc) { |
1017 | FreeXid(xid); | 1022 | FreeXid(xid); |
1018 | return rc; | 1023 | return rc; |
1019 | } | 1024 | } |
1020 | } | 1025 | } |
1021 | if(file->private_data == NULL) { | 1026 | if (file->private_data == NULL) { |
1022 | rc = -EINVAL; | 1027 | rc = -EINVAL; |
1023 | FreeXid(xid); | 1028 | FreeXid(xid); |
1024 | return rc; | 1029 | return rc; |
1025 | } | 1030 | } |
1026 | cifsFile = file->private_data; | 1031 | cifsFile = file->private_data; |
1027 | if (cifsFile->srch_inf.endOfSearch) { | 1032 | if (cifsFile->srch_inf.endOfSearch) { |
1028 | if(cifsFile->srch_inf.emptyDir) { | 1033 | if (cifsFile->srch_inf.emptyDir) { |
1029 | cFYI(1, ("End of search, empty dir")); | 1034 | cFYI(1, ("End of search, empty dir")); |
1030 | rc = 0; | 1035 | rc = 0; |
1031 | break; | 1036 | break; |
@@ -1033,23 +1038,23 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) | |||
1033 | } /* else { | 1038 | } /* else { |
1034 | cifsFile->invalidHandle = TRUE; | 1039 | cifsFile->invalidHandle = TRUE; |
1035 | CIFSFindClose(xid, pTcon, cifsFile->netfid); | 1040 | CIFSFindClose(xid, pTcon, cifsFile->netfid); |
1036 | } | 1041 | } |
1037 | kfree(cifsFile->search_resume_name); | 1042 | kfree(cifsFile->search_resume_name); |
1038 | cifsFile->search_resume_name = NULL; */ | 1043 | cifsFile->search_resume_name = NULL; */ |
1039 | 1044 | ||
1040 | rc = find_cifs_entry(xid,pTcon, file, | 1045 | rc = find_cifs_entry(xid, pTcon, file, |
1041 | ¤t_entry,&num_to_fill); | 1046 | ¤t_entry, &num_to_fill); |
1042 | if(rc) { | 1047 | if (rc) { |
1043 | cFYI(1,("fce error %d",rc)); | 1048 | cFYI(1, ("fce error %d", rc)); |
1044 | goto rddir2_exit; | 1049 | goto rddir2_exit; |
1045 | } else if (current_entry != NULL) { | 1050 | } else if (current_entry != NULL) { |
1046 | cFYI(1,("entry %lld found",file->f_pos)); | 1051 | cFYI(1, ("entry %lld found", file->f_pos)); |
1047 | } else { | 1052 | } else { |
1048 | cFYI(1,("could not find entry")); | 1053 | cFYI(1, ("could not find entry")); |
1049 | goto rddir2_exit; | 1054 | goto rddir2_exit; |
1050 | } | 1055 | } |
1051 | cFYI(1,("loop through %d times filling dir for net buf %p", | 1056 | cFYI(1, ("loop through %d times filling dir for net buf %p", |
1052 | num_to_fill,cifsFile->srch_inf.ntwrk_buf_start)); | 1057 | num_to_fill, cifsFile->srch_inf.ntwrk_buf_start)); |
1053 | max_len = smbCalcSize((struct smb_hdr *) | 1058 | max_len = smbCalcSize((struct smb_hdr *) |
1054 | cifsFile->srch_inf.ntwrk_buf_start); | 1059 | cifsFile->srch_inf.ntwrk_buf_start); |
1055 | end_of_smb = cifsFile->srch_inf.ntwrk_buf_start + max_len; | 1060 | end_of_smb = cifsFile->srch_inf.ntwrk_buf_start + max_len; |
@@ -1059,8 +1064,8 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) | |||
1059 | such multibyte target UTF-8 characters. cifs_unicode.c, | 1064 | such multibyte target UTF-8 characters. cifs_unicode.c, |
1060 | which actually does the conversion, has the same limit */ | 1065 | which actually does the conversion, has the same limit */ |
1061 | tmp_buf = kmalloc((2 * NAME_MAX) + 4, GFP_KERNEL); | 1066 | tmp_buf = kmalloc((2 * NAME_MAX) + 4, GFP_KERNEL); |
1062 | for(i=0;(i<num_to_fill) && (rc == 0);i++) { | 1067 | for (i = 0; (i < num_to_fill) && (rc == 0); i++) { |
1063 | if(current_entry == NULL) { | 1068 | if (current_entry == NULL) { |
1064 | /* evaluate whether this case is an error */ | 1069 | /* evaluate whether this case is an error */ |
1065 | cERROR(1,("past end of SMB num to fill %d i %d", | 1070 | cERROR(1,("past end of SMB num to fill %d i %d", |
1066 | num_to_fill, i)); | 1071 | num_to_fill, i)); |
@@ -1070,20 +1075,20 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) | |||
1070 | we want to check for that here? */ | 1075 | we want to check for that here? */ |
1071 | rc = cifs_filldir(current_entry, file, | 1076 | rc = cifs_filldir(current_entry, file, |
1072 | filldir, direntry, tmp_buf, max_len); | 1077 | filldir, direntry, tmp_buf, max_len); |
1073 | if(rc == -EOVERFLOW) { | 1078 | if (rc == -EOVERFLOW) { |
1074 | rc = 0; | 1079 | rc = 0; |
1075 | break; | 1080 | break; |
1076 | } | 1081 | } |
1077 | 1082 | ||
1078 | file->f_pos++; | 1083 | file->f_pos++; |
1079 | if(file->f_pos == | 1084 | if (file->f_pos == |
1080 | cifsFile->srch_inf.index_of_last_entry) { | 1085 | cifsFile->srch_inf.index_of_last_entry) { |
1081 | cFYI(1,("last entry in buf at pos %lld %s", | 1086 | cFYI(1, ("last entry in buf at pos %lld %s", |
1082 | file->f_pos,tmp_buf)); | 1087 | file->f_pos, tmp_buf)); |
1083 | cifs_save_resume_key(current_entry,cifsFile); | 1088 | cifs_save_resume_key(current_entry, cifsFile); |
1084 | break; | 1089 | break; |
1085 | } else | 1090 | } else |
1086 | current_entry = | 1091 | current_entry = |
1087 | nxt_dir_entry(current_entry, end_of_smb, | 1092 | nxt_dir_entry(current_entry, end_of_smb, |
1088 | cifsFile->srch_inf.info_level); | 1093 | cifsFile->srch_inf.info_level); |
1089 | } | 1094 | } |