]> 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)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Sun, 11 Mar 2012 05:07:40 +0000 (14:07 +0900)
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 a513a720ad540cc8078890fb6d788d41fef8968d..f154051787d9d670187972a58b499aed73b52556 100644 (file)
@@ -853,6 +853,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 35b6d214fbf8b3c980b3148d39269b2e51a93519..225c5344ec2b55381e56f27be7b5177372dba125 100644 (file)
@@ -364,6 +364,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 94c953aa9a5467acbe23ef5f6eff1627389286c6..27e869418ffe00c8b36d9c60cc194a59ef870a2e 100644 (file)
@@ -1384,8 +1384,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;