[PATCH] tools: Split <linux/gfp_types.h> out of <linux/gfp.h>

From: Wei Yang
Date: Fri Sep 09 2022 - 12:08:53 EST


Commit 9f162193d6e4 ("radix-tree: replace gfp.h inclusion with
gfp_types.h") change the include file, which is introduced in
commit cb5a065b4ea9c ("headers/deps: mm: Split <linux/gfp_types.h> out
of <linux/gfp.h>"). Since we don't do the split for test, current build
for radix-tree would fail.

Let's do the same as in commit cb5a065b4ea9c ("headers/deps: mm:
Split <linux/gfp_types.h> out of <linux/gfp.h>").

Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxx>
CC: Yury Norov <yury.norov@xxxxxxxxx>
CC: Mike Rapoport <rppt@xxxxxxxxxx>
CC: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
---
tools/include/linux/gfp.h | 21 +--------------------
tools/include/linux/gfp_types.h | 27 +++++++++++++++++++++++++++
2 files changed, 28 insertions(+), 20 deletions(-)
create mode 100644 tools/include/linux/gfp_types.h

diff --git a/tools/include/linux/gfp.h b/tools/include/linux/gfp.h
index b238dbc9eb85..6a10ff5f5be9 100644
--- a/tools/include/linux/gfp.h
+++ b/tools/include/linux/gfp.h
@@ -3,26 +3,7 @@
#define _TOOLS_INCLUDE_LINUX_GFP_H

#include <linux/types.h>
-
-#define __GFP_BITS_SHIFT 26
-#define __GFP_BITS_MASK ((gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
-
-#define __GFP_HIGH 0x20u
-#define __GFP_IO 0x40u
-#define __GFP_FS 0x80u
-#define __GFP_NOWARN 0x200u
-#define __GFP_ZERO 0x8000u
-#define __GFP_ATOMIC 0x80000u
-#define __GFP_ACCOUNT 0x100000u
-#define __GFP_DIRECT_RECLAIM 0x400000u
-#define __GFP_KSWAPD_RECLAIM 0x2000000u
-
-#define __GFP_RECLAIM (__GFP_DIRECT_RECLAIM | __GFP_KSWAPD_RECLAIM)
-
-#define GFP_ZONEMASK 0x0fu
-#define GFP_ATOMIC (__GFP_HIGH | __GFP_ATOMIC | __GFP_KSWAPD_RECLAIM)
-#define GFP_KERNEL (__GFP_RECLAIM | __GFP_IO | __GFP_FS)
-#define GFP_NOWAIT (__GFP_KSWAPD_RECLAIM)
+#include <linux/gfp_types.h>

static inline bool gfpflags_allow_blocking(const gfp_t gfp_flags)
{
diff --git a/tools/include/linux/gfp_types.h b/tools/include/linux/gfp_types.h
new file mode 100644
index 000000000000..cfeea788f273
--- /dev/null
+++ b/tools/include/linux/gfp_types.h
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _TOOLS_INCLUDE_LINUX_GFP_TYPES_H
+#define _TOOLS_INCLUDE_LINUX_GFP_TYPES_H
+
+#include <linux/types.h>
+
+#define __GFP_BITS_SHIFT 26
+#define __GFP_BITS_MASK ((gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
+
+#define __GFP_HIGH 0x20u
+#define __GFP_IO 0x40u
+#define __GFP_FS 0x80u
+#define __GFP_NOWARN 0x200u
+#define __GFP_ZERO 0x8000u
+#define __GFP_ATOMIC 0x80000u
+#define __GFP_ACCOUNT 0x100000u
+#define __GFP_DIRECT_RECLAIM 0x400000u
+#define __GFP_KSWAPD_RECLAIM 0x2000000u
+
+#define __GFP_RECLAIM (__GFP_DIRECT_RECLAIM | __GFP_KSWAPD_RECLAIM)
+
+#define GFP_ZONEMASK 0x0fu
+#define GFP_ATOMIC (__GFP_HIGH | __GFP_ATOMIC | __GFP_KSWAPD_RECLAIM)
+#define GFP_KERNEL (__GFP_RECLAIM | __GFP_IO | __GFP_FS)
+#define GFP_NOWAIT (__GFP_KSWAPD_RECLAIM)
+
+#endif /* _TOOLS_INCLUDE_LINUX_GFP_TYPES_H */
--
2.33.1