]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Add support for archive_read_disk_current_filesystem_is_remote on NetBSD and OpenBSD.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Fri, 11 Jun 2010 07:07:53 +0000 (03:07 -0400)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Fri, 11 Jun 2010 07:07:53 +0000 (03:07 -0400)
SVN-Revision: 2464

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

index 6edd1b9039d18b909e5d559819878a345466ba22..72cb5f0121141979ed77c85ff7193733dde26c3e 100644 (file)
@@ -247,6 +247,7 @@ LA_CHECK_INCLUDE_FILE("sys/param.h" HAVE_SYS_PARAM_H)
 LA_CHECK_INCLUDE_FILE("sys/poll.h" HAVE_SYS_POLL_H)
 LA_CHECK_INCLUDE_FILE("sys/select.h" HAVE_SYS_SELECT_H)
 LA_CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
+LA_CHECK_INCLUDE_FILE("sys/statvfs.h" HAVE_SYS_STATVFS_H)
 LA_CHECK_INCLUDE_FILE("sys/time.h" HAVE_SYS_TIME_H)
 LA_CHECK_INCLUDE_FILE("sys/utime.h" HAVE_SYS_UTIME_H)
 LA_CHECK_INCLUDE_FILE("sys/utsname.h" HAVE_SYS_UTSNAME_H)
@@ -516,6 +517,7 @@ CHECK_FUNCTION_EXISTS_GLIBC(setenv HAVE_SETENV)
 CHECK_FUNCTION_EXISTS_GLIBC(setlocale HAVE_SETLOCALE)
 CHECK_FUNCTION_EXISTS_GLIBC(sigaction HAVE_SIGACTION)
 CHECK_FUNCTION_EXISTS_GLIBC(statfs HAVE_STATFS)
+CHECK_FUNCTION_EXISTS_GLIBC(statvfs HAVE_STATVFS)
 CHECK_FUNCTION_EXISTS_GLIBC(strchr HAVE_STRCHR)
 CHECK_FUNCTION_EXISTS_GLIBC(strdup HAVE_STRDUP)
 CHECK_FUNCTION_EXISTS_GLIBC(strerror HAVE_STRERROR)
index 3f64b3a63bd72c7821e85738a00971b445a7b7b3..fc17ddc29e5ad177047a543be7bc7ef8b5ad1570 100644 (file)
 /* Define to 1 if you have the `statfs' function. */
 #cmakedefine HAVE_STATFS 1
 
+/* Define to 1 if you have the `statvfs' function. */ 
+#cmakedefine HAVE_STATVFS 1
+
 /* Define to 1 if `stat' has the bug that it succeeds when given the
    zero-length file name argument. */
 #cmakedefine HAVE_STAT_EMPTY_STRING_BUG 1
 /* Define to 1 if you have the <sys/select.h> header file. */
 #cmakedefine HAVE_SYS_SELECT_H 1
 
+/* Define to 1 if you have the <sys/statvfs.h> header file. */
+#cmakedefine HAVE_SYS_STATVFS_H 1
+
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #cmakedefine HAVE_SYS_STAT_H 1
 
index da462acdff2c6f7c0d64c00647f1dbf31ce21f93..2ae97470f9e0fc80890e059e92a1d024ecd423b5 100644 (file)
@@ -200,7 +200,8 @@ AC_CHECK_HEADERS([locale.h paths.h poll.h pwd.h regex.h signal.h stdarg.h])
 AC_CHECK_HEADERS([stdint.h stdlib.h string.h])
 AC_CHECK_HEADERS([sys/acl.h sys/cdefs.h sys/extattr.h sys/ioctl.h])
 AC_CHECK_HEADERS([sys/mkdev.h sys/mount.h])
-AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/select.h sys/time.h sys/utime.h])
+AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/select.h sys/statvfs.h])
+AC_CHECK_HEADERS([sys/time.h sys/utime.h])
 AC_CHECK_HEADERS([sys/utsname.h time.h unistd.h utime.h wchar.h wctype.h])
 AC_CHECK_HEADERS([windows.h winioctl])
 
@@ -419,7 +420,7 @@ AC_CHECK_FUNCS([getgrnam_r getpwnam_r getvfsbyname gmtime_r])
 AC_CHECK_FUNCS([lchflags lchmod lchown link localtime_r lstat])
 AC_CHECK_FUNCS([lutimes mbrtowc memmove memset mkdir mkfifo mknod mkstemp])
 AC_CHECK_FUNCS([nl_langinfo pipe poll readlink])
-AC_CHECK_FUNCS([select setenv setlocale sigaction statfs])
+AC_CHECK_FUNCS([select setenv setlocale sigaction statfs statvfs])
 AC_CHECK_FUNCS([strchr strdup strerror strncpy_s strrchr symlink timegm])
 AC_CHECK_FUNCS([tzset unsetenv utime utimensat utimes vfork])
 AC_CHECK_FUNCS([wcrtomb wcscpy wcslen wctomb wmemcmp wmemcpy])
index d34cb0b8f5c3c185faa83a9375c932854b216a92..67e58b36e452bd832101752ec412a02284ff152b 100644 (file)
 #include "archive_platform.h"
 __FBSDID("$FreeBSD: head/lib/libarchive/archive_read_disk.c 189429 2009-03-06 04:35:31Z kientzle $");
 
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
 #ifdef HAVE_SYS_PARAM_H
 #include <sys/param.h>
 #endif
 #ifdef HAVE_SYS_MOUNT_H
 #include <sys/mount.h>
 #endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
 #ifdef HAVE_DIRECT_H
 #include <direct.h>
 #endif
@@ -920,6 +923,32 @@ filesystem_information(struct archive_read_disk *a, const char *path,
        return (ARCHIVE_OK);
 }
 
+#elif defined(HAVE_STATVFS) && defined(MNT_LOCAL)
+
+/*
+ * Get conditions of synthetic and remote on NetBSD and OpenBSD
+ */
+static int
+filesystem_information(struct archive_read_disk *a, const char *path,
+    struct filesystem *fs)
+{
+       struct statvfs sfs;
+       int r;
+
+       fs->synthetic = -1;
+       r = statvfs(path, &sfs);
+       if (r == -1) {
+               fs->remote = -1;
+               archive_set_error(&a->archive, errno, "statfs failed");
+               return (ARCHIVE_FAILED);
+       }
+       if (sfs.f_flag & MNT_LOCAL)
+               fs->remote = 0;
+       else
+               fs->remote = 1;
+       return (ARCHIVE_OK);
+}
+
 #else
 
 /*