From 8979f4ffb9b3ca4f5bca36a61b97275ccf342efb Mon Sep 17 00:00:00 2001 From: Bin Lai Date: Sun, 12 Sep 2021 12:12:42 +0800 Subject: [PATCH] kabi: introduce more kabi-related macro Currently, there is only KABI_RESERVE macro in the kabi.h. So we introduce more kabi-related macros, then we could use the reserved space more easily by the macros. Signed-off-by: Bin Lai Reviewed-by: Mengmeng Chen Reviewed-by: benbjiang --- include/linux/kabi.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/include/linux/kabi.h b/include/linux/kabi.h index 24f31b35a..de79d54ef 100644 --- a/include/linux/kabi.h +++ b/include/linux/kabi.h @@ -7,6 +7,22 @@ #ifndef _LINUX_KABI_H #define _LINUX_KABI_H -#define KABI_RESERVE(n) unsigned long kabi_reserved##n +# define _KABI_REPLACE(_orig, _new) \ + union { \ + _new; \ + struct { \ + _orig; \ + } __UNIQUE_ID(kabi_hide); \ + } + +#define KABI_REPLACE(_orig, _new) _KABI_REPLACE(_orig, _new) + +#define _KABI_RESERVE(n) unsigned long kabi_reserved##n +#define _KABI_RESERVE_P(n) void (*kabi_reserved##n)(void) +#define KABI_RESERVE(n) _KABI_RESERVE(n) +#define KABI_RESERVE_P(n) _KABI_RESERVE_P(n) + +#define KABI_USE(n, _new) KABI_REPLACE(_KABI_RESERVE(n), _new) +#define KABI_USE_P(n, _new) KABI_REPLACE(_KABI_RESERVE_P(n), _new) #endif /* _LINUX_KABI_H */