[Xfce4-commits] r22650 - in thunar/trunk: . thunar-vfs

Benedikt Meurer benny at xfce.org
Fri Aug 4 13:02:55 UTC 2006


Author: benny
Date: 2006-08-04 13:02:53 +0000 (Fri, 04 Aug 2006)
New Revision: 22650

Modified:
   thunar/trunk/ChangeLog
   thunar/trunk/configure.in.in
   thunar/trunk/thunar-vfs/thunar-vfs-os-bsd.c
Log:
2006-08-04	Benedikt Meurer <benny at xfce.org>

	* configure.in.in, thunar-vfs/thunar-vfs-os-bsd.c: OpenBSD doesn't
	  support getdents() and whiteout inodes, instead getdirentries()
	  will be used on OpenBSD.




Modified: thunar/trunk/ChangeLog
===================================================================
--- thunar/trunk/ChangeLog	2006-08-04 12:11:26 UTC (rev 22649)
+++ thunar/trunk/ChangeLog	2006-08-04 13:02:53 UTC (rev 22650)
@@ -1,5 +1,11 @@
 2006-08-04	Benedikt Meurer <benny at xfce.org>
 
+	* configure.in.in, thunar-vfs/thunar-vfs-os-bsd.c: OpenBSD doesn't
+	  support getdents() and whiteout inodes, instead getdirentries()
+	  will be used on OpenBSD.
+
+2006-08-04	Benedikt Meurer <benny at xfce.org>
+
 	* thunar/thunar-util.c(thunar_util_time_from_rfc3339): Fix typo.
 
 2006-08-04	Benedikt Meurer <benny at xfce.org>

Modified: thunar/trunk/configure.in.in
===================================================================
--- thunar/trunk/configure.in.in	2006-08-04 12:11:26 UTC (rev 22649)
+++ thunar/trunk/configure.in.in	2006-08-04 13:02:53 UTC (rev 22650)
@@ -113,7 +113,7 @@
 dnl *** Check for standard functions ***
 dnl ************************************
 AC_FUNC_MMAP()
-AC_CHECK_FUNCS([attropen extattr_get_fd fgetxattr lchmod localeconv \
+AC_CHECK_FUNCS([attropen extattr_get_fd fgetxattr getdents lchmod localeconv \
                 localtime_r mbrtowc mkdtemp mkfifo posix_madvise pread \
                 pwrite readdir_r sched_yield setgroupent setpassent \
                 statfs statvfs statvfs1 strcoll strlcpy strptime symlink])

Modified: thunar/trunk/thunar-vfs/thunar-vfs-os-bsd.c
===================================================================
--- thunar/trunk/thunar-vfs/thunar-vfs-os-bsd.c	2006-08-04 12:11:26 UTC (rev 22649)
+++ thunar/trunk/thunar-vfs/thunar-vfs-os-bsd.c	2006-08-04 13:02:53 UTC (rev 22650)
@@ -65,6 +65,9 @@
 _thunar_vfs_os_is_dir_empty (const gchar *absolute_path)
 {
   struct dirent *dp;
+#ifndef HAVE_GETDENTS
+  glong          basep = 0;
+#endif
   gchar          dbuf[8 * DIRBLKSIZ];
   gint           size = 0;
   gint           loc = 0;
@@ -80,8 +83,15 @@
           /* check if we need to fill the buffer again */
           if (loc >= size)
             {
-              /* read the next chunk */
+#ifdef HAVE_GETDENTS
+              /* read the next chunk (no base pointer needed) */
               size = getdents (fd, dbuf, sizeof (dbuf));
+#else
+              /* read the next chunk (OpenBSD fallback) */
+              size = getdirentries (fd, dbuf, sizeof (dbuf), &basep);
+#endif
+
+              /* check for eof/error */
               if (size <= 0)
                 break;
               loc = 0;
@@ -103,10 +113,16 @@
           /* adjust the location pointer */
           loc += dp->d_reclen;
 
-          /* verify the inode and type */
-          if (G_UNLIKELY (dp->d_fileno == 0 || dp->d_type == DT_WHT))
+          /* verify the inode */
+          if (G_UNLIKELY (dp->d_fileno == 0))
             continue;
 
+#ifdef DT_WHT
+          /* verify the type (OpenBSD lacks whiteout) */
+          if (G_UNLIKELY (dp->d_type == DT_WHT))
+            continue;
+#endif
+
           /* ignore '.' and '..' entries */
           if (G_UNLIKELY (dp->d_name[0] == '.' && (dp->d_name[1] == '\0' || (dp->d_name[1] == '.' && dp->d_name[2] == '\0'))))
             continue;
@@ -163,6 +179,9 @@
 {
   struct dirent *dp;
   struct stat    statb;
+#ifndef HAVE_GETDENTS
+  glong          basep = 0;
+#endif
   GList         *path_list = NULL;
   gchar         *filename;
   gchar         *dbuf;
@@ -229,8 +248,15 @@
       /* check if we need to fill the buffer again */
       if (loc >= size)
         {
-          /* read the next chunk */
+#ifdef HAVE_GETDENTS
+          /* read the next chunk (no need for a base pointer) */
           size = getdents (fd, dbuf, dlen);
+#else
+          /* read the next chunk (OpenBSD fallback) */
+          size = getdirentries (fd, dbuf, dlen, &basep);
+#endif
+
+          /* check for eof/error */
           if (size <= 0)
             break;
           loc = 0;
@@ -248,10 +274,16 @@
       /* adjust the location pointer */
       loc += dp->d_reclen;
 
-      /* verify the inode and type */
-      if (G_UNLIKELY (dp->d_fileno == 0 || dp->d_type == DT_WHT))
+      /* verify the inode */
+      if (G_UNLIKELY (dp->d_fileno == 0))
         continue;
 
+#ifdef DT_WHT
+      /* verify the type (OpenBSD lacks whiteout) */
+      if (G_UNLIKELY (dp->d_type == DT_WHT))
+        continue;
+#endif
+
       /* ignore '.' and '..' entries */
       if (G_UNLIKELY (dp->d_name[0] == '.' && (dp->d_name[1] == '\0' || (dp->d_name[1] == '.' && dp->d_name[2] == '\0'))))
         continue;



More information about the Xfce4-commits mailing list