* include/cygwin/version.h: Bump API minor number to 151.

* dir.cc (__opendir_with_d_ino): New function.
(opendir): Set flag if we should be calculating inodes.
(readdir_worker): Calculate d_ino by calling stat if the user has asked for it.
(seekdir64): Maintain all persistent flag settings.
* fhandler.h (dirent_states): Add dirent_set_d_ino.
* fhandler_disk_file.cc (fhandler_disk_file::opendir): Reflect changes to
dirent structure.
* fhandler_virtual.cc (fhandler_virtual::opendir): Ditto.
* include/sys/dirent.h (struct dirent): Coalesce two similar structures.
Remove all threads of the apparently highly confusing references to inodes.
Add support for calculating a real inode if __USE_EXPENSIVE_CYGWIN_D_INO is
defined.
This commit is contained in:
Christopher Faylor
2006-01-21 02:24:17 +00:00
parent 54abc854d0
commit 868fb2ff69
8 changed files with 77 additions and 76 deletions

View File

@@ -16,27 +16,16 @@
#define __DIRENT_VERSION 2
#pragma pack(push,4)
#ifdef __INSIDE_CYGWIN__
#if defined(__INSIDE_CYGWIN__) || defined (__CYGWIN_USE_BIG_TYPES__)
struct dirent
{
long d_version; /* Used since Cygwin 1.3.3. */
__ino64_t __invalid_d_ino; /* DO NOT USE: No longer available since cygwin 1.5.19 */
long d_fd; /* File descriptor of open directory.
Used since Cygwin 1.3.3. */
unsigned __invalid_ino32; /* DO NOT USE: No longer available since cygwin 1.5.19 */
long __d_version; /* Used internally */
__ino64_t __dirent_internal;
__uint32_t __dirent_unused1;
__uint32_t __dirent_internal1;
char d_name[256]; /* FIXME: use NAME_MAX? */
};
#else
#ifdef __CYGWIN_USE_BIG_TYPES__
struct dirent
{
long d_version;
ino_t __invalid_d_ino; /* DO NOT USE: No longer available since cygwin 1.5.19 */
long d_fd;
unsigned long __invalid_ino32; /* DO NOT USE: No longer available since cygwin 1.5.19 */
char d_name[256];
};
#else
struct dirent
{
long d_version;
@@ -46,7 +35,6 @@ struct dirent
char d_name[256];
};
#endif
#endif
#pragma pack(pop)
#define __DIRENT_COOKIE 0xdede4242
@@ -59,14 +47,22 @@ typedef struct __DIR
struct dirent *__d_dirent;
char *__d_dirname; /* directory name with trailing '*' */
_off_t __d_position; /* used by telldir/seekdir */
__ino64_t __d_dirhash; /* hash of directory name for use by readdir */
int __d_fd;
unsigned __d_unused;
void *__handle;
void *__fh;
unsigned __flags;
} DIR;
#pragma pack(pop)
#ifndef __USE_EXPENSIVE_CYGWIN_D_INO
DIR *opendir (const char *);
#else
#define d_ino __dirent_internal
DIR *__opendir_with_d_ino (const char *);
#define opendir __opendir_with_d_ino
#endif
struct dirent *readdir (DIR *);
int readdir_r (DIR *, struct dirent *, struct dirent **);
void rewinddir (DIR *);