From: Darrick J. Wong Date: Fri, 9 Mar 2018 02:35:23 +0000 (-0600) Subject: xfs_scrub: fix #include ordering to avoid build failure X-Git-Tag: v4.16.0-rc1~45 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a440f87737944bc2b4f1ce0b4dae7698703f0fdc;p=thirdparty%2Fxfsprogs-dev.git xfs_scrub: fix #include ordering to avoid build failure Fix the ordering of the header includes in all the scrub source. We put xfs.h first so that it will pull in include/linux.h which pulls in linux/fs.h + whatever overrides are necessary (currently limited to struct fsxattr) to make things work on this platform, and then we remove the #includes for anything that will get pulled (directly or indirectly) by xfs.h for cleanliness. Without this, a user compiling new xfsprogs on a system with a 4.7 kernel gets this: Building scrub [CC] disk.o In file included from ../include/xfs.h:37:0, from disk.c:40: ../include/xfs/linux.h:185:8: error: redefinition of 'struct fsxattr' struct fsxattr { ^~~~~~~ In file included from disk.c:31:0: /usr/include/linux/fs.h:155:8: note: originally defined here struct fsxattr { ^~~~~~~ gmake[2]: *** [../include/buildrules:60: disk.o] Error 1 gmake[1]: *** [include/buildrules:36: scrub] Error 2 make: *** [Makefile:77: default] Error 2 Reported-by: Mikael Magnusson Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen Signed-off-by: Eric Sandeen --- diff --git a/scrub/bitmap.c b/scrub/bitmap.c index a88fd0ef6..212c3b808 100644 --- a/scrub/bitmap.c +++ b/scrub/bitmap.c @@ -17,13 +17,10 @@ * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include +#include "xfs.h" #include #include -#include #include -#include #include #include "platform_defs.h" #include "avl64.h" diff --git a/scrub/common.c b/scrub/common.c index 4f26bf8d9..5a37a984b 100644 --- a/scrub/common.c +++ b/scrub/common.c @@ -17,14 +17,11 @@ * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include +#include "xfs.h" #include -#include #include #include #include "platform_defs.h" -#include "xfs.h" -#include "xfs_fs.h" #include "path.h" #include "xfs_scrub.h" #include "common.h" diff --git a/scrub/counter.c b/scrub/counter.c index ced3cf381..0e28f0f29 100644 --- a/scrub/counter.c +++ b/scrub/counter.c @@ -17,9 +17,9 @@ * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "xfs.h" #include #include -#include #include #include #include diff --git a/scrub/disk.c b/scrub/disk.c index e12175c86..798b4a06f 100644 --- a/scrub/disk.c +++ b/scrub/disk.c @@ -17,18 +17,13 @@ * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include +#include "xfs.h" #include #include -#include #include #include #include -#include -#include #include -#include -#include #ifdef HAVE_SG_IO # include #endif @@ -37,9 +32,7 @@ #endif #include "platform_defs.h" #include "libfrog.h" -#include "xfs.h" #include "path.h" -#include "xfs_fs.h" #include "xfs_scrub.h" #include "common.h" #include "disk.h" diff --git a/scrub/filemap.c b/scrub/filemap.c index f42a6ba51..056b3b006 100644 --- a/scrub/filemap.c +++ b/scrub/filemap.c @@ -17,17 +17,13 @@ * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include +#include "xfs.h" #include #include #include #include #include -#include #include -#include "xfs.h" -#include "xfs_fs.h" #include "path.h" #include "xfs_scrub.h" #include "common.h" diff --git a/scrub/fscounters.c b/scrub/fscounters.c index ecdf4c612..05bf95ef5 100644 --- a/scrub/fscounters.c +++ b/scrub/fscounters.c @@ -17,15 +17,12 @@ * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include +#include "xfs.h" #include #include #include #include "platform_defs.h" -#include "xfs.h" #include "xfs_arch.h" -#include "xfs_fs.h" #include "xfs_format.h" #include "path.h" #include "workqueue.h" diff --git a/scrub/inodes.c b/scrub/inodes.c index 744b003c3..ccfb9e05f 100644 --- a/scrub/inodes.c +++ b/scrub/inodes.c @@ -17,14 +17,12 @@ * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include +#include "xfs.h" #include #include #include #include #include "platform_defs.h" -#include "xfs.h" #include "xfs_arch.h" #include "xfs_format.h" #include "handle.h" diff --git a/scrub/phase1.c b/scrub/phase1.c index 002c6425f..992677097 100644 --- a/scrub/phase1.c +++ b/scrub/phase1.c @@ -17,30 +17,22 @@ * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include +#include "xfs.h" #include #include -#include #include #include #include -#include #include #include #include -#include #include -#include -#include #include "libfrog.h" #include "workqueue.h" #include "input.h" #include "path.h" #include "handle.h" #include "bitops.h" -#include "xfs_arch.h" -#include "xfs_format.h" #include "avl64.h" #include "list.h" #include "xfs_scrub.h" diff --git a/scrub/phase2.c b/scrub/phase2.c index edf66df6a..ad736bf50 100644 --- a/scrub/phase2.c +++ b/scrub/phase2.c @@ -17,13 +17,10 @@ * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include +#include "xfs.h" #include -#include #include -#include #include -#include "xfs.h" #include "list.h" #include "path.h" #include "workqueue.h" diff --git a/scrub/phase3.c b/scrub/phase3.c index a0ee5d9e3..68c95e67b 100644 --- a/scrub/phase3.c +++ b/scrub/phase3.c @@ -17,13 +17,10 @@ * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include +#include "xfs.h" #include -#include #include -#include #include -#include "xfs.h" #include "list.h" #include "path.h" #include "workqueue.h" diff --git a/scrub/phase4.c b/scrub/phase4.c index 1fb8da906..8573036a5 100644 --- a/scrub/phase4.c +++ b/scrub/phase4.c @@ -17,15 +17,11 @@ * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include +#include "xfs.h" #include -#include #include #include -#include #include -#include "xfs.h" -#include "xfs_fs.h" #include "list.h" #include "path.h" #include "workqueue.h" diff --git a/scrub/phase5.c b/scrub/phase5.c index 703b27981..0ef633978 100644 --- a/scrub/phase5.c +++ b/scrub/phase5.c @@ -17,17 +17,14 @@ * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include +#include "xfs.h" #include -#include #include #include -#include #include #ifdef HAVE_LIBATTR # include #endif -#include "xfs.h" #include "handle.h" #include "list.h" #include "path.h" diff --git a/scrub/phase6.c b/scrub/phase6.c index e255eef3f..b533cbbdd 100644 --- a/scrub/phase6.c +++ b/scrub/phase6.c @@ -17,13 +17,10 @@ * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include +#include "xfs.h" #include -#include #include #include -#include "xfs.h" -#include "xfs_fs.h" #include "handle.h" #include "path.h" #include "ptvar.h" diff --git a/scrub/phase7.c b/scrub/phase7.c index 460ca8af8..50d04ae67 100644 --- a/scrub/phase7.c +++ b/scrub/phase7.c @@ -17,13 +17,10 @@ * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include +#include "xfs.h" #include -#include #include #include -#include "xfs.h" -#include "xfs_fs.h" #include "path.h" #include "ptvar.h" #include "xfs_scrub.h" diff --git a/scrub/progress.c b/scrub/progress.c index 61b9c60a2..e9e720ba9 100644 --- a/scrub/progress.c +++ b/scrub/progress.c @@ -17,13 +17,11 @@ * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "libxfs.h" -#include +#include "xfs.h" #include #include #include #include -#include "../repair/threads.h" #include "path.h" #include "disk.h" #include "read_verify.h" diff --git a/scrub/read_verify.c b/scrub/read_verify.c index ae2e85fc8..d7bcc1778 100644 --- a/scrub/read_verify.c +++ b/scrub/read_verify.c @@ -17,15 +17,12 @@ * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include +#include "xfs.h" #include -#include #include #include #include "workqueue.h" #include "path.h" -#include "xfs.h" -#include "xfs_fs.h" #include "xfs_scrub.h" #include "common.h" #include "counter.h" diff --git a/scrub/scrub.c b/scrub/scrub.c index ff5357c65..9e8267524 100644 --- a/scrub/scrub.c +++ b/scrub/scrub.c @@ -17,17 +17,13 @@ * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include +#include "xfs.h" #include #include #include #include #include -#include #include -#include "xfs.h" -#include "xfs_fs.h" #include "list.h" #include "path.h" #include "xfs_scrub.h" diff --git a/scrub/spacemap.c b/scrub/spacemap.c index f63191300..36210355a 100644 --- a/scrub/spacemap.c +++ b/scrub/spacemap.c @@ -17,15 +17,12 @@ * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include +#include "xfs.h" #include #include #include #include #include "workqueue.h" -#include "xfs.h" -#include "xfs_fs.h" #include "path.h" #include "xfs_scrub.h" #include "common.h" diff --git a/scrub/unicrash.c b/scrub/unicrash.c index ce3e7f94e..0b5d1fac6 100644 --- a/scrub/unicrash.c +++ b/scrub/unicrash.c @@ -17,17 +17,14 @@ * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include +#include "xfs.h" #include -#include #include #include #include -#include #include #include #include -#include "xfs.h" #include "path.h" #include "xfs_scrub.h" #include "common.h" diff --git a/scrub/vfs.c b/scrub/vfs.c index 0c5b35351..cfb58782f 100644 --- a/scrub/vfs.c +++ b/scrub/vfs.c @@ -17,13 +17,11 @@ * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include +#include "xfs.h" #include -#include #include #include #include -#include "xfs.h" #include "handle.h" #include "path.h" #include "workqueue.h" diff --git a/scrub/xfs_scrub.c b/scrub/xfs_scrub.c index 7ee02b669..2d5528381 100644 --- a/scrub/xfs_scrub.c +++ b/scrub/xfs_scrub.c @@ -17,16 +17,13 @@ * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include +#include "xfs.h" #include -#include #include #include #include #include #include "platform_defs.h" -#include "xfs.h" -#include "xfs_fs.h" #include "input.h" #include "path.h" #include "xfs_scrub.h"