Merge branch '1642_fstype'

* 1642_fstype:
  Ticket #1642: filegui.c contains Linux-specific things
This commit is contained in:
Slava Zanko 2009-10-28 10:38:38 +02:00
commit 720eca3fa3
2 changed files with 43 additions and 13 deletions

View File

@ -628,6 +628,11 @@ AC_DEFUN([gl_FSTYPENAME],
#include <sys/param.h> #include <sys/param.h>
#include <sys/mount.h> #include <sys/mount.h>
]) ])
AC_CHECK_MEMBERS([struct statvfs.f_fstypename, struct statvfs.f_basetype],,,
[
AC_INCLUDES_DEFAULT
#include <sys/statvfs.h>
])
]) ])
dnl dnl

View File

@ -55,19 +55,23 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#if defined (__FreeBSD__) #if defined(STAT_STATVFS) \
# include <sys/param.h> && (defined(HAVE_STRUCT_STATVFS_F_BASETYPE) \
#endif || defined(HAVE_STRUCT_STATVFS_F_FSTYPENAME))
#if defined(__APPLE__) || defined (__FreeBSD__) # include <sys/statvfs.h>
# include <sys/mount.h> # define STRUCT_STATFS struct statvfs
#elif defined (__NetBSD__) # define STATFS statvfs
# include <sys/param.h> #elif defined(HAVE_STATFS) && !defined(STAT_STATFS4)
#else # ifdef HAVE_SYS_VFS_H
# ifdef HAVE_VFS
# include <sys/vfs.h> # include <sys/vfs.h>
# else # elif defined(HAVE_SYS_MOUNT_H) && defined(HAVE_SYS_PARAM_H)
# include <sys/param.h>
# include <sys/mount.h>
# elif defined(HAVE_SYS_STATFS_H)
# include <sys/statfs.h> # include <sys/statfs.h>
# endif # endif
# define STRUCT_STATFS struct statfs
# define STATFS statfs
#endif #endif
#include <unistd.h> #include <unistd.h>
@ -164,14 +168,16 @@ enum {
static int static int
filegui__check_attrs_on_fs(const char *fs_path) filegui__check_attrs_on_fs(const char *fs_path)
{ {
struct statfs stfs; #ifdef STATFS
STRUCT_STATFS stfs;
if (!setup_copymove_persistent_attr) if (!setup_copymove_persistent_attr)
return 0; return 0;
if (statfs(fs_path, &stfs)!=0) if (STATFS(fs_path, &stfs)!=0)
return 1; return 1;
# ifdef __linux__
switch ((filegui_nonattrs_fs_t) stfs.f_type) switch ((filegui_nonattrs_fs_t) stfs.f_type)
{ {
case MSDOS_SUPER_MAGIC: case MSDOS_SUPER_MAGIC:
@ -184,6 +190,25 @@ filegui__check_attrs_on_fs(const char *fs_path)
return 0; return 0;
break; break;
} }
# elif defined(HAVE_STRUCT_STATFS_F_FSTYPENAME) \
|| defined(HAVE_STRUCT_STATVFS_F_FSTYPENAME)
if (!strcmp(stfs.f_fstypename, "msdos")
|| !strcmp(stfs.f_fstypename, "msdosfs")
|| !strcmp(stfs.f_fstypename, "ntfs")
|| !strcmp(stfs.f_fstypename, "procfs")
|| !strcmp(stfs.f_fstypename, "smbfs")
|| strstr(stfs.f_fstypename, "fusefs"))
return 0;
# elif defined(HAVE_STRUCT_STATVFS_F_BASETYPE)
if (!strcmp(stfs.f_basetype, "pcfs")
|| !strcmp(stfs.f_basetype, "ntfs")
|| !strcmp(stfs.f_basetype, "proc")
|| !strcmp(stfs.f_basetype, "smbfs")
|| !strcmp(stfs.f_basetype, "fuse"))
return 0;
# endif
#endif /* STATFS */
return 1; return 1;
} }