Skip to content

Commit

Permalink
undelfs simplifications.
Browse files Browse the repository at this point in the history
m4.include/vfs/mc-vfs-undelfs.m4: simplify test of required libraries.
Don't test Linux kernel specific header.

src/vfs/undelfs/undelfs.c: don't include Linux kernel specific header.
Use headers from ext2fs library only.

Signed-off-by: Andrew Borodin <[email protected]>
  • Loading branch information
aborodin committed Mar 14, 2021
1 parent 5a4d1dd commit f5b813a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 42 deletions.
48 changes: 14 additions & 34 deletions m4.include/vfs/mc-vfs-undelfs.m4
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,21 @@ dnl "no" otherwise. May define ENABLE_VFS_UNDELFS for cpp.
dnl Will set EXT2FS_UNDEL_LIBS to required libraries.

AC_DEFUN([mc_UNDELFS_CHECKS], [
ext2fs_undel=no
EXT2FS_UNDEL_LIBS=
AC_CHECK_HEADERS([ext2fs/ext2_fs.h linux/ext2_fs.h], [ext2_fs_h=yes; break])
if test x"$ext2_fs_h" = xyes; then
AC_CHECK_HEADERS([ext2fs/ext2fs.h], [ext2fs_ext2fs_h=yes], ,
[
#include <stdio.h>
#ifdef HAVE_EXT2FS_EXT2_FS_H
#include <ext2fs/ext2_fs.h>
#else
#undef umode_t
#include <linux/ext2_fs.h>
#endif
])
if test x"$ext2fs_ext2fs_h" = xyes; then
ext2fs_undel=yes
EXT2FS_UNDEL_LIBS="-lext2fs -lcom_err"
AC_CHECK_TYPE([ext2_ino_t], ,
[AC_DEFINE_UNQUOTED([ext2_ino_t], [ino_t],
[Define to ino_t if undefined.])],
[
#include <errno.h>
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#ifdef HAVE_EXT2FS_EXT2_FS_H
#include <ext2fs/ext2_fs.h>
#else
#undef umode_t
#include <linux/ext2_fs.h>
#endif
#include <ext2fs/ext2fs.h>
])
ext2fs_undel=no
EXT2FS_UNDEL_LIBS=
dnl Use result of mc_EXT2FS_ATTR that was called earlier
if test "x$ext2fs_attr_msg" = "xyes"; then
com_err=no
PKG_CHECK_MODULES(COM_ERR, [com_err >= 1.42.4], [com_err=yes], [:])
if test x"$com_err" = "xyes"; then
EXT2FS_UNDEL_LIBS="$EXT2FS_LIBS $COM_ERR_LIBS"
ext2fs_undel=yes
fi
fi
fi
])

dnl
Expand Down
8 changes: 0 additions & 8 deletions src/vfs/undelfs/undelfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* memset() */

#ifdef HAVE_EXT2FS_EXT2_FS_H
#include <ext2fs/ext2_fs.h>
#else
/* asm/types.h defines its own umode_t */
#undef umode_t
#include <linux/ext2_fs.h>
#endif

#include <ext2fs/ext2fs.h>
#include <ctype.h>

Expand Down

0 comments on commit f5b813a

Please sign in to comment.