]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Check for 'struct statvfs' member 'f_iosize'
authorBrad King <brad.king@kitware.com>
Wed, 11 Jan 2012 13:15:42 +0000 (08:15 -0500)
committerBrad King <brad.king@kitware.com>
Wed, 11 Jan 2012 13:15:42 +0000 (08:15 -0500)
Configure the result as definition HAVE_STRUCT_STATVFS_F_IOSIZE and use
the member only if it exists.  At least one platform (IRIX) provides
struct statvfs without this member.

SVN-Revision: 4132

CMakeLists.txt
build/cmake/config.h.in
configure.ac
libarchive/archive_read_disk_posix.c

index 207d72f0c3544878c03f5c27f5811f8864654845..2a313ff08ff8b76697718b13ae514319c7843b95 100644 (file)
@@ -799,6 +799,12 @@ CHECK_STRUCT_MEMBER("struct stat" st_blksize
 # Check for st_flags in struct stat (BSD fflags)
 CHECK_STRUCT_MEMBER("struct stat" st_flags
     "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_FLAGS)
+
+IF(HAVE_SYS_STATVFS_H)
+  CHECK_STRUCT_MEMBER("struct statvfs" f_iosize
+    "sys/types.h;sys/statvfs.h" HAVE_STRUCT_STATVFS_F_IOSIZE)
+ENDIF()
+
 #
 #
 CHECK_STRUCT_MEMBER("struct tm" tm_sec
index b1690515d7a8f47eaee301269e304b5c53b1add7..d690a8dfbfacb99ab6446f1afc20c23a2f9ec68f 100644 (file)
@@ -782,6 +782,9 @@ typedef uint64_t uintmax_t;
 /* Define to 1 if `f_namemax' is a member of `struct statfs'. */
 #cmakedefine HAVE_STRUCT_STATFS_F_NAMEMAX 1
 
+/* Define to 1 if `f_iosize' is a member of `struct statvfs'. */
+#cmakedefine HAVE_STRUCT_STATVFS_F_IOSIZE 1
+
 /* Define to 1 if `st_birthtime' is a member of `struct stat'. */
 #cmakedefine HAVE_STRUCT_STAT_ST_BIRTHTIME 1
 
index 58879543d957f6e420206d2543539464a345bce6..b397f2879ed9ae78756d56670c6f60b8846d2e59 100644 (file)
@@ -355,6 +355,12 @@ AC_CHECK_MEMBERS([struct statfs.f_namemax],,,
 #include <sys/mount.h>
 ])
 
+# Check for f_iosize in struct statvfs
+AC_CHECK_MEMBERS([struct statvfs.f_iosize],,,
+[
+#include <sys/statvfs.h>
+])
+
 # Check for birthtime in struct stat
 AC_CHECK_MEMBERS([struct stat.st_birthtime])
 
index 0a57f3abb4bf779818e8062844b0f996088011f7..b1264c9caffb8eb9c12c099385b8ba5adc0ad8f2 100644 (file)
@@ -1525,8 +1525,13 @@ setup_current_filesystem(struct archive_read_disk *a)
                 * for pathconf() function. */
                t->current_filesystem->xfer_align = sfs.f_frsize;
                t->current_filesystem->max_xfer_size = -1;
+#if defined(HAVE_STRUCT_STATVFS_F_IOSIZE)
                t->current_filesystem->min_xfer_size = sfs.f_iosize;
                t->current_filesystem->incr_xfer_size = sfs.f_iosize;
+#else
+               t->current_filesystem->min_xfer_size = sfs.f_bsize;
+               t->current_filesystem->incr_xfer_size = sfs.f_bsize;
+#endif
        }
        if (sfs.f_flag & ST_LOCAL)
                t->current_filesystem->remote = 0;