]> sourceware.org Git - newlib-cygwin.git/commitdiff
* dir.cc: Rename opendir_* to dirent_* throughout.
authorChristopher Faylor <me@cgf.cx>
Wed, 16 Mar 2005 21:20:56 +0000 (21:20 +0000)
committerChristopher Faylor <me@cgf.cx>
Wed, 16 Mar 2005 21:20:56 +0000 (21:20 +0000)
(opendir_states): Move and rename.
* fhandler.h (dirent_states): to here.
* fhandler_disk_file.cc (fhandler_disk_file::readdir): Use raw readdir when
skipping through entries since it is keeping track of "." and "..".
(fhandler_cygdrive::seekdir): Use fhandler_disk_file::readdir to do everything.
* fhandler_virtual.cc (fhandler_virtual::opendir): Set flag indicating that we
provide .  and ..
(fhandler_virtual::seekdir): Ditto.
(fhandler_virtual::rewinddir): Ditto.
* fhandler_registry.cc (fhandler_registry::rewinddir): Ditto.

winsup/cygwin/ChangeLog
winsup/cygwin/dir.cc
winsup/cygwin/fhandler.h
winsup/cygwin/fhandler_registry.cc
winsup/cygwin/fhandler_virtual.cc

index 296b0f57e6db5f896d0b5065c736018a2fd73b67..b92fedb88b3a5c09d07417f641a7c59e66d200a8 100644 (file)
@@ -1,3 +1,19 @@
+2005-03-16  Christopher Faylor  <cgf@timesys.com>
+
+       * dir.cc: Rename opendir_* to dirent_* throughout.
+       (opendir_states): Move and rename.
+       * fhandler.h (dirent_states): to here.
+       * fhandler_disk_file.cc (fhandler_disk_file::readdir): Use raw readdir
+       when skipping through entries since it is keeping track of "." and
+       "..".
+       (fhandler_cygdrive::seekdir): Use fhandler_disk_file::readdir to do
+       everything.
+       * fhandler_virtual.cc (fhandler_virtual::opendir): Set flag indicating
+       that we provide .  and ..
+       (fhandler_virtual::seekdir): Ditto.
+       (fhandler_virtual::rewinddir): Ditto.
+       * fhandler_registry.cc (fhandler_registry::rewinddir): Ditto.
+
 2005-03-16  Christopher Faylor  <cgf@timesys.com>
 
        * cygtls.cc (free_local): New macro.
index e74498fb0509d386f98f2846539465f226975939..5aabcd3709a8fc5a7a222821193af32a61a2b7ce 100644 (file)
@@ -38,14 +38,6 @@ dirfd (DIR *dir)
   return dir->__d_dirent->d_fd;
 }
 
-enum opendir_states
-{
-  opendir_ok = 0,
-  opendir_saw_dot = 1,
-  opendir_saw_dot_dot = 2,
-  opendir_saw_eof = 4
-};
-
 /* opendir: POSIX 5.1.2.1 */
 extern "C" DIR *
 opendir (const char *name)
@@ -89,18 +81,18 @@ readdir (DIR *dir)
 
   if (!res)
     {
-      if (!(dir->__flags & opendir_saw_dot))
+      if (!(dir->__flags & dirent_saw_dot))
        {
          res = dir->__d_dirent;
          strcpy (res->d_name, ".");
-         dir->__flags |= opendir_saw_dot;
+         dir->__flags |= dirent_saw_dot;
          dir->__d_position++;
        }
-      else if (!(dir->__flags & opendir_saw_dot_dot))
+      else if (!(dir->__flags & dirent_saw_dot_dot))
        {
          res = dir->__d_dirent;
          strcpy (res->d_name, "..");
-         dir->__flags |= opendir_saw_dot_dot;
+         dir->__flags |= dirent_saw_dot_dot;
          dir->__d_position++;
        }
     }
@@ -114,13 +106,13 @@ readdir (DIR *dir)
          if (res->d_name[1] == '\0')
            {
              dir->__d_dirent->d_ino = dir->__d_dirhash;
-             dir->__flags |= opendir_saw_dot;
+             dir->__flags |= dirent_saw_dot;
            }
          else if (res->d_name[1] != '.' || res->d_name[2] != '\0')
            goto hashit;
          else
            {
-             dir->__flags |= opendir_saw_dot_dot;
+             dir->__flags |= dirent_saw_dot_dot;
              char *p, up[strlen (dir->__d_dirname) + 1];
              strcpy (up, dir->__d_dirname);
              if (!(p = strrchr (up, '\\')))
index bdc8d3b8aeae540ebf005a001979eaf3f78873d9..2d5998b3bdbf53a66912af0a9797ef94a1e372a2 100644 (file)
@@ -38,6 +38,14 @@ struct dirent;
 struct iovec;
 struct __acl32;
 
+enum dirent_states
+{
+  dirent_ok = 0,
+  dirent_saw_dot = 1,
+  dirent_saw_dot_dot = 2,
+  dirent_saw_eof = 4
+};
+
 enum conn_state
 {
   unconnected = 0,
index ad6d63867ff461931f5234bc33415cbe9f50e3db..383643b1e000db6a61d3e771615c5134873db832 100644 (file)
@@ -378,6 +378,7 @@ fhandler_registry::rewinddir (DIR * dir)
       dir->__handle = INVALID_HANDLE_VALUE;
     }
   dir->__d_position = 0;
+  dir->__flags = dirent_saw_dot | dirent_saw_dot_dot;
   return;
 }
 
index 21798994a6e05b97dd1382848a50725ba552d3f1..32d700a4da048bc4ca72a16cb0da7b5b0684c52c 100644 (file)
@@ -83,7 +83,7 @@ fhandler_virtual::opendir ()
          dir->__handle = INVALID_HANDLE_VALUE;
          dir->__d_position = 0;
          dir->__d_dirhash = get_namehash ();
-
+         dir->__flags = dirent_saw_dot | dirent_saw_dot_dot;
          res = dir;
        }
     }
@@ -100,6 +100,7 @@ _off64_t fhandler_virtual::telldir (DIR * dir)
 void
 fhandler_virtual::seekdir (DIR * dir, _off64_t loc)
 {
+  dir->__flags |= dirent_saw_dot | dirent_saw_dot_dot;
   dir->__d_position = loc;
   return;
 }
@@ -108,6 +109,7 @@ void
 fhandler_virtual::rewinddir (DIR * dir)
 {
   dir->__d_position = 0;
+  dir->__flags |= dirent_saw_dot | dirent_saw_dot_dot;
   return;
 }
 
This page took 0.041431 seconds and 5 git commands to generate.