aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSankalp Bose <sankalp@tuxera.com>2014-07-23 03:28:14 +0300
committerJaegeuk Kim <jaegeuk@kernel.org>2014-07-25 08:11:16 -0700
commit92a65a44e5637b1f86f5d6e10cb058b6aa21db41 (patch)
treebb6d54ed08bd60786925845bc638bfe4178aab2b
parent092e3d9da37796daf439e94141c57886d6fc6e50 (diff)
downloadandroid_external_f2fs-tools-92a65a44e5637b1f86f5d6e10cb058b6aa21db41.tar.gz
android_external_f2fs-tools-92a65a44e5637b1f86f5d6e10cb058b6aa21db41.tar.bz2
android_external_f2fs-tools-92a65a44e5637b1f86f5d6e10cb058b6aa21db41.zip
mkfs.f2fs: fix name conflict for BLKDISCARD
The compile time option BLKDISCARD conflicts with ioctl code for discard. This causes discard to fail with "Info: This device doesn't support TRIM". Rename compile time option to WITH_BLKDISCARD. Signed-off-by: Sankalp Bose <sankalp@tuxera.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--configure.ac2
-rw-r--r--mkfs/Makefile.am2
-rw-r--r--mkfs/f2fs_format_utils.c6
3 files changed, 7 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index c2dafb0..0111e72 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,7 +56,7 @@ AC_PATH_PROG([LDCONFIG], [ldconfig],
PKG_CHECK_MODULES([libuuid], [uuid])
# Checks for header files.
-AC_CHECK_HEADERS([fcntl.h mntent.h stdlib.h string.h \
+AC_CHECK_HEADERS([linux/fs.h fcntl.h mntent.h stdlib.h string.h \
sys/ioctl.h sys/mount.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
diff --git a/mkfs/Makefile.am b/mkfs/Makefile.am
index ff136a7..fa48699 100644
--- a/mkfs/Makefile.am
+++ b/mkfs/Makefile.am
@@ -1,7 +1,7 @@
## Makefile.am
AM_CPPFLAGS = ${libuuid_CFLAGS} -I$(top_srcdir)/include
-AM_CFLAGS = -Wall -DBLKDISCARD
+AM_CFLAGS = -Wall -DWITH_BLKDISCARD
sbin_PROGRAMS = mkfs.f2fs
mkfs_f2fs_SOURCES = f2fs_format_main.c f2fs_format.c f2fs_format_utils.c
mkfs_f2fs_LDADD = ${libuuid_LIBS} $(top_builddir)/lib/libf2fs.la
diff --git a/mkfs/f2fs_format_utils.c b/mkfs/f2fs_format_utils.c
index 8f7e094..9892a8f 100644
--- a/mkfs/f2fs_format_utils.c
+++ b/mkfs/f2fs_format_utils.c
@@ -15,6 +15,10 @@
#include "f2fs_fs.h"
+#ifdef HAVE_LINUX_FS_H
+#include <linux/fs.h>
+#endif
+
int f2fs_trim_device()
{
unsigned long long range[2];
@@ -31,7 +35,7 @@ int f2fs_trim_device()
return -1;
}
-#if defined(BLKDISCARD)
+#if defined(WITH_BLKDISCARD) && defined(BLKDISCARD)
MSG(0, "Info: Discarding device\n");
if (S_ISREG(stat_buf.st_mode))
return 0;