Throughout, remove __d_u.__d_data fields from DIR structure.

* include/sys/dirent.h (dirent): Remvoe old_d_ino.
(DIR): Make __d_dirhash a 64 bit value.  Remove __d_data and __d_u.  Add
__flags.
* dir.cc (opendir_states): New enum.
(opendir): Clear new DIR __flags field.
(readdir): Fill in '.' and '..' entries if we hit EOF and we haven't seen them
already.  Nuke setting of old_d_ino.
(rewinddir): Reset DIR __flags field.
(seekdir64): Ditto.
* fhandler_disk_file.cc (fhandler_cygdrive::fhandler_cygdrive): Remove special
handling of "." and ".." since they are now handled automatically.
This commit is contained in:
Christopher Faylor
2003-09-08 04:04:19 +00:00
parent d31c5928dd
commit 0c7b55727a
6 changed files with 93 additions and 57 deletions

View File

@@ -1,6 +1,6 @@
/* Posix dirent.h for WIN32.
Copyright 2001 Red Hat, Inc.
Copyright 2001, 2002, 2003 Red Hat, Inc.
This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
@@ -23,7 +23,7 @@ struct dirent
__ino64_t d_ino; /* still junk but with more bits */
long d_fd; /* File descriptor of open directory.
Used since Cygwin 1.3.3. */
__ino32_t old_d_ino; /* Just for compatibility, it's junk */
unsigned __flags; /* Used internally. */
char d_name[256]; /* FIXME: use NAME_MAX? */
};
#else
@@ -33,7 +33,7 @@ struct dirent
long d_version;
ino_t d_ino;
long d_fd;
unsigned long old_d_ino;
unsigned long __unused;
char d_name[256];
};
#else
@@ -51,6 +51,7 @@ struct dirent
#define __DIRENT_COOKIE 0xdede4242
#pragma pack(push,4)
typedef struct __DIR
{
/* This is first to set alignment in non _COMPILING_NEWLIB case. */
@@ -58,20 +59,12 @@ typedef struct __DIR
struct dirent *__d_dirent;
char *__d_dirname; /* directory name with trailing '*' */
_off_t __d_position; /* used by telldir/seekdir */
unsigned long __d_dirhash; /* hash of directory name for use by
readdir */
union
{
#ifdef __INSIDE_CYGWIN__
struct
{
void *__handle;
void *__fh;
} __d_data;
#endif
char __d_filler[16];
} __d_u;
__ino64_t __d_dirhash; /* hash of directory name for use by readdir */
void *__handle;
void *__fh;
unsigned __flags;
} DIR;
#pragma pack(pop)
DIR *opendir (const char *);
struct dirent *readdir (DIR *);