Skip to content

Commit c0ba284

Browse files
committed
Merge branch '4664_use_statvfs'
* 4664_use_statvfs: buildsys: move conditions to `m4` file for easier syncronization Ticket #4664: clarify USE_STATVFS definition.
2 parents 7be7b0d + df89c2c commit c0ba284

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

m4.include/mc-get-fs-info.m4

+7-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ AC_INCLUDES_DEFAULT
5858
# include <fs_info.h>
5959
#endif
6060
"
61+
dnl Keep this long conditional in sync with the USE_STATVFS conditional below
6162
if case "$fu_cv_sys_stat_statvfs$fu_cv_sys_stat_statvfs64" in
6263
*yes*) ;; *) false;; esac &&
6364
{ AC_CHECK_MEMBERS([struct statvfs.f_basetype],,, [$statvfs_includes])
@@ -68,7 +69,6 @@ AC_INCLUDES_DEFAULT
6869
{ AC_CHECK_MEMBERS([struct statvfs.f_type],,, [$statvfs_includes])
6970
test $ac_cv_member_struct_statvfs_f_type = yes; }; }; }; }
7071
then
71-
AC_CHECK_MEMBERS([struct statvfs.f_namemax],,, [$statvfs_includes])
7272
AC_COMPILE_IFELSE(
7373
[AC_LANG_PROGRAM(
7474
[$statvfs_includes],
@@ -89,6 +89,12 @@ AC_INCLUDES_DEFAULT
8989
[Define to 1 if the f_fsid member of struct statfs is an integer.])])
9090
fi
9191
fi
92+
if test x"$fu_cv_sys_stat_statvfs" = xyes -o x"$fu_cv_sys_stat_statvfs64" = xyes && \
93+
test x"$ac_cv_member_struct_statvfs_f_basetype" = xyes || \
94+
test x"$ac_cv_member_struct_statvfs_f_fstypename" = xyes || \
95+
test x"$ac_cv_member_struct_statvfs_f_fstypename" != xyes -a x"$ac_cv_member_struct_statvfs_f_type" = xyes ; then
96+
AC_DEFINE([USE_STATVFS], [1], [Define to 1 if header <sys/statvfs.h> is usable])
97+
fi
9298
])
9399

94100

src/filemanager/filegui.c

+6-14
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,6 @@
5252

5353
#include <config.h>
5454

55-
#if ((defined STAT_STATVFS || defined STAT_STATVFS64) \
56-
&& (defined HAVE_STRUCT_STATVFS_F_BASETYPE || defined HAVE_STRUCT_STATVFS_F_FSTYPENAME \
57-
|| (!defined HAVE_STRUCT_STATFS_F_FSTYPENAME)))
58-
#define USE_STATVFS 1
59-
#else
60-
#define USE_STATVFS 0
61-
#endif
62-
6355
#include <errno.h>
6456
#include <ctype.h>
6557
#include <limits.h> // INT_MAX
@@ -68,7 +60,7 @@
6860
#include <sys/types.h>
6961
#include <sys/stat.h>
7062

71-
#if USE_STATVFS
63+
#if defined(USE_STATVFS)
7264
#include <sys/statvfs.h>
7365
#elif defined HAVE_SYS_VFS_H
7466
#include <sys/vfs.h>
@@ -83,7 +75,7 @@
8375
#include <fs_info.h>
8476
#endif
8577

86-
#if USE_STATVFS
78+
#if defined(USE_STATVFS)
8779
#if !defined STAT_STATVFS && defined STAT_STATVFS64
8880
#define STRUCT_STATVFS struct statvfs64
8981
#define STATFS statvfs64
@@ -261,7 +253,7 @@ static struct
261253
preceding entries in /proc/mounts; that makes df hang if even one
262254
of the corresponding file systems is hard-mounted but not available. */
263255

264-
#if USE_STATVFS && !(!defined STAT_STATVFS && defined STAT_STATVFS64)
256+
#if defined(USE_STATVFS) && !(!defined STAT_STATVFS && defined STAT_STATVFS64)
265257
static int
266258
statvfs_works (void)
267259
{
@@ -285,16 +277,16 @@ filegui__check_attrs_on_fs (const char *fs_path)
285277
{
286278
STRUCT_STATVFS stfs;
287279

288-
#if USE_STATVFS && defined(STAT_STATVFS)
280+
#if defined(USE_STATVFS) && defined(STAT_STATVFS)
289281
if (statvfs_works () && statvfs (fs_path, &stfs) != 0)
290282
return TRUE;
291283
#else
292284
if (STATFS (fs_path, &stfs) != 0)
293285
return TRUE;
294286
#endif
295287

296-
#if (USE_STATVFS && defined(HAVE_STRUCT_STATVFS_F_TYPE)) \
297-
|| (!USE_STATVFS && defined(HAVE_STRUCT_STATFS_F_TYPE))
288+
#if (defined(USE_STATVFS) && defined(HAVE_STRUCT_STATVFS_F_TYPE)) \
289+
|| (!defined(USE_STATVFS) && defined(HAVE_STRUCT_STATFS_F_TYPE))
298290
switch ((filegui_nonattrs_fs_t) stfs.f_type)
299291
{
300292
case MSDOS_SUPER_MAGIC:

0 commit comments

Comments
 (0)