Skip to content

Commit bbc5dc5

Browse files
authored
Merge pull request #9001 from douzzer/20250714-linuxkm-fix-page-flags-h
20250714-linuxkm-fix-page-flags-h
2 parents 99d26f0 + ee3b459 commit bbc5dc5

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

linuxkm/linuxkm_wc_port.h

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,20 @@
113113

114114
#ifdef BUILDING_WOLFSSL
115115

116+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) && defined(CONFIG_X86)
117+
/* linux/slab.h recursively brings in linux/page-flags.h, bringing in
118+
* non-inline implementations of functions folio_flags() and
119+
* const_folio_flags(). but we can retrofit the attribute.
120+
*/
121+
struct folio;
122+
static __always_inline unsigned long *folio_flags(
123+
struct folio *folio, unsigned n);
124+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 9, 0)
125+
static __always_inline const unsigned long *const_folio_flags(
126+
const struct folio *folio, unsigned n);
127+
#endif
128+
#endif
129+
116130
#if defined(CONFIG_MIPS) && defined(HAVE_LINUXKM_PIE_SUPPORT)
117131
/* __ZBOOT__ disables some unhelpful macros around the mem*() funcs in
118132
* legacy arch/mips/include/asm/string.h
@@ -288,15 +302,6 @@
288302

289303
#endif /* !CONFIG_FORTIFY_SOURCE */
290304

291-
#if defined(__PIE__) && (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) && \
292-
defined(CONFIG_X86)
293-
/* linux/slab.h will recursively bring in linux/page-flags.h, polluting the
294-
* wolfCrypt container objects with static functions const_folio_flags() and
295-
* folio_flags(), unless we kludge it off thusly.
296-
*/
297-
#define PAGE_FLAGS_H
298-
#endif
299-
300305
#include <linux/init.h>
301306
#include <linux/module.h>
302307
#include <linux/delay.h>

0 commit comments

Comments
 (0)