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 <robinlai@tencent.com>
Reviewed-by: Mengmeng Chen <bauerchen@tencent.com>
Reviewed-by: benbjiang <benbjiang@tencent.com>
This commit is contained in:
Bin Lai 2021-09-12 12:12:42 +08:00 committed by bauerchen
parent 58709f4446
commit 8979f4ffb9
1 changed files with 17 additions and 1 deletions

View File

@ -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 */