From: Brad King Date: Wed, 11 Jan 2012 13:15:42 +0000 (-0500) Subject: Check for 'struct statvfs' member 'f_iosize' X-Git-Tag: v3.0.4~2^2~194 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19c22e92c1442e107577dc2f5f260397e04dae73;p=thirdparty%2Flibarchive.git Check for 'struct statvfs' member 'f_iosize' 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 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 207d72f0c..2a313ff08 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/build/cmake/config.h.in b/build/cmake/config.h.in index b1690515d..d690a8dfb 100644 --- a/build/cmake/config.h.in +++ b/build/cmake/config.h.in @@ -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 diff --git a/configure.ac b/configure.ac index 58879543d..b397f2879 100644 --- a/configure.ac +++ b/configure.ac @@ -355,6 +355,12 @@ AC_CHECK_MEMBERS([struct statfs.f_namemax],,, #include ]) +# Check for f_iosize in struct statvfs +AC_CHECK_MEMBERS([struct statvfs.f_iosize],,, +[ +#include +]) + # Check for birthtime in struct stat AC_CHECK_MEMBERS([struct stat.st_birthtime]) diff --git a/libarchive/archive_read_disk_posix.c b/libarchive/archive_read_disk_posix.c index 0a57f3abb..b1264c9ca 100644 --- a/libarchive/archive_read_disk_posix.c +++ b/libarchive/archive_read_disk_posix.c @@ -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;