fibmap: include f2fs_fs.h before other header files
authorSheng Yong <shengyong1@huawei.com>
Tue, 27 Feb 2018 08:39:33 +0000 (16:39 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 7 May 2018 21:49:38 +0000 (14:49 -0700)
GCC 7.2.0 is unhappy with the usage of major/minor:

fibmap.c: In function â€˜print_stat’:
fibmap.c:70:13: warning: In the GNU C Library, "major" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "major", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "major", you should undefine it after including <sys/types.h>.
  printf("dev       [%d:%d]\n", major(st->st_dev), minor(st->st_dev));
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is because config.h is not included first, as a result, macros
defined in config.h is not recognized. So let's include f2fs_fs.h
before other header files.

Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
tools/fibmap.c

index d17144a..9e96cb6 100644 (file)
@@ -15,6 +15,7 @@
 #ifndef O_LARGEFILE
 #define O_LARGEFILE 0
 #endif
+#include <f2fs_fs.h>
 #include <unistd.h>
 #include <string.h>
 #include <stdlib.h>
@@ -38,7 +39,6 @@
 #include <linux/fs.h>
 #endif
 #include <inttypes.h>
-#include <f2fs_fs.h>
 
 #ifndef FIBMAP
 #define FIBMAP          _IO(0x00, 1)    /* bmap access */