* fhandler_disk_file.cc (d_cachepos): Rename from d_pos to distinct

clearly from __d_position.  Change throughout.
	(fhandler_disk_file::rewinddir): Reset readdir cache on NT.
This commit is contained in:
Corinna Vinschen 2006-01-30 10:30:58 +00:00
parent 2d8319b7e1
commit 5c25715276
2 changed files with 15 additions and 7 deletions

View File

@ -1,3 +1,9 @@
2006-01-30 Corinna Vinschen <corinna@vinschen.de>
* fhandler_disk_file.cc (d_cachepos): Rename from d_pos to distinct
clearly from __d_position. Change throughout.
(fhandler_disk_file::rewinddir): Reset readdir cache on NT.
2006-01-29 Corinna Vinschen <corinna@vinschen.de> 2006-01-29 Corinna Vinschen <corinna@vinschen.de>
* fhandler_disk_file.cc (readdir_get_ino): Don't follow symlinks. * fhandler_disk_file.cc (readdir_get_ino): Don't follow symlinks.

View File

@ -1362,7 +1362,7 @@ typedef struct __DIR_cache
}; };
#define d_dirname(d) (((struct __DIR_cache *) (d)->__d_dirname)->__name) #define d_dirname(d) (((struct __DIR_cache *) (d)->__d_dirname)->__name)
#define d_pos(d) (((struct __DIR_cache *) (d)->__d_dirname)->__pos) #define d_cachepos(d) (((struct __DIR_cache *) (d)->__d_dirname)->__pos)
#define d_cache(d) (((struct __DIR_cache *) (d)->__d_dirname)->__cache) #define d_cache(d) (((struct __DIR_cache *) (d)->__d_dirname)->__cache)
DIR * DIR *
@ -1397,7 +1397,7 @@ fhandler_disk_file::opendir ()
else else
{ {
strcpy (d_dirname (dir), get_win32_name ()); strcpy (d_dirname (dir), get_win32_name ());
d_pos (dir) = 0; d_cachepos (dir) = 0;
dir->__d_dirent->__d_version = __DIRENT_VERSION; dir->__d_dirent->__d_version = __DIRENT_VERSION;
cygheap_fdnew fd; cygheap_fdnew fd;
@ -1602,9 +1602,9 @@ fhandler_disk_file::readdir (DIR *dir, dirent *de)
if (!wincap.is_winnt ()) if (!wincap.is_winnt ())
return readdir_9x (dir, de); return readdir_9x (dir, de);
/* d_pos always refers to the next cache entry to use. If it's 0, this means /* d_cachepos always refers to the next cache entry to use. If it's 0
we must reload the cache. */ we must reload the cache. */
if (d_pos (dir) == 0) if (d_cachepos (dir) == 0)
{ {
if ((dir->__flags & dirent_get_d_ino)) if ((dir->__flags & dirent_get_d_ino))
{ {
@ -1630,11 +1630,11 @@ fhandler_disk_file::readdir (DIR *dir, dirent *de)
if (!status) if (!status)
{ {
buf = (PFILE_ID_BOTH_DIR_INFORMATION) (d_cache (dir) + d_pos (dir)); buf = (PFILE_ID_BOTH_DIR_INFORMATION) (d_cache (dir) + d_cachepos (dir));
if (buf->NextEntryOffset == 0) if (buf->NextEntryOffset == 0)
d_pos (dir) = 0; d_cachepos (dir) = 0;
else else
d_pos (dir) += buf->NextEntryOffset; d_cachepos (dir) += buf->NextEntryOffset;
if ((dir->__flags & dirent_get_d_ino)) if ((dir->__flags & dirent_get_d_ino))
{ {
FileName = buf->FileName; FileName = buf->FileName;
@ -1765,6 +1765,8 @@ fhandler_disk_file::seekdir (DIR *dir, _off64_t loc)
void void
fhandler_disk_file::rewinddir (DIR *dir) fhandler_disk_file::rewinddir (DIR *dir)
{ {
if (wincap.is_winnt ())
d_cachepos (dir) = 0;
if (!wincap.is_winnt () && dir->__handle != INVALID_HANDLE_VALUE) if (!wincap.is_winnt () && dir->__handle != INVALID_HANDLE_VALUE)
{ {
if (dir->__handle) if (dir->__handle)