From: Čestmír Kalina <ckalina@xxxxxxxxxx> kabi: rename RH_KABI_SIZE_AND_EXTEND to AUX Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2024595 Upstream Status: RHEL only commit a0d01aefc5e6959a2c3fa0d35e87f3e6ea7dde0e Author: Jiri Benc <jbenc@xxxxxxxxxx> Date: Wed, 1 Apr 2020 13:04:14 -0400 The current RH_KABI_SIZE_AND_EXTEND and RH_KABI_SIZE_AND_EXTEND_PTR names have a few problems: they are similar to RH_KABI_EXTEND_WITH_SIZE, they are too long and they focuses on the implementation instead of the use. Since the parallely allocated structures in some subsystems are already called "auxiliary structures", adopt that name. The macro RH_KABI_SIZE_AND_EXTEND_PTR is thus renamed to RH_KABI_AUX_PTR. The macro RH_KABI_SIZE_AND_EXTEND is renamed to RH_KABI_AUX_EMBED to emphasize that the aux structure is embedded in the main structure. This frees up the RH_KABI_AUX name, which is used as a replacement for RH_KABI_CHECK_EXT. I realize that the name of the RH_KABI_AUX macro is not descriptive. However, this is going to be heavily used macro as any access to a field in an aux struct needs to be guarded by a condition using this macro. Its name thus should be as short as possible; we can't get shorter than RH_KABI_AUX. Lastly, the RH_KABI_SET_SIZE and RH_KABI_INIT_SIZE macros got a new _AUX_ infix to associate them with the other AUX macros. It makes them a bit longer but those are used only once for each struct, so it should be acceptable. RH-Signed-off-by: Jiri Benc <jbenc@xxxxxxxxxx> Signed-off-by: Čestmír Kalina <ckalina@xxxxxxxxxx> Signed-off-by: Prarit Bhargava <prarit@xxxxxxxxxx> diff --git a/include/linux/rh_kabi.h b/include/linux/rh_kabi.h index blahblah..blahblah 100644 --- a/include/linux/rh_kabi.h +++ b/include/linux/rh_kabi.h @@ -372,52 +372,52 @@ */ /* - * RH_KABI_SIZE_AND_EXTEND|_PTR() extends a struct by embedding or adding + * RH_KABI_AUX_EMBED|_PTR() extends a struct by embedding or adding * a pointer in a base struct. The name of the new struct is the name * of the base struct appended with _rh. */ -#define _RH_KABI_SIZE_AND_EXTEND_PTR(_struct) \ +#define _RH_KABI_AUX_PTR(_struct) \ size_t _struct##_size_rh; \ _RH_KABI_EXCLUDE(struct _struct##_rh *_rh) -#define RH_KABI_SIZE_AND_EXTEND_PTR(_struct) \ - _RH_KABI_SIZE_AND_EXTEND_PTR(_struct); +#define RH_KABI_AUX_PTR(_struct) \ + _RH_KABI_AUX_PTR(_struct); -#define _RH_KABI_SIZE_AND_EXTEND(_struct) \ +#define _RH_KABI_AUX_EMBED(_struct) \ size_t _struct##_size_rh; \ _RH_KABI_EXCLUDE(struct _struct##_rh _rh) -#define RH_KABI_SIZE_AND_EXTEND(_struct) \ - _RH_KABI_SIZE_AND_EXTEND(_struct); +#define RH_KABI_AUX_EMBED(_struct) \ + _RH_KABI_AUX_EMBED(_struct); /* - * RH_KABI_SET_SIZE calculates and sets the size of the extended struct and + * RH_KABI_AUX_SET_SIZE calculates and sets the size of the extended struct and * stores it in the size_rh field for structs that are dynamically allocated. * This macro MUST be called when expanding a base struct with - * RH_KABI_SIZE_AND_EXTEND, and it MUST be called from the allocation site + * RH_KABI_AUX, and it MUST be called from the allocation site * regardless of being allocated in the kernel or a module. * Note: since this macro is intended to be invoked outside of a struct, * a semicolon is necessary at the end of the line where it is invoked. */ -#define RH_KABI_SET_SIZE(_name, _struct) ({ \ +#define RH_KABI_AUX_SET_SIZE(_name, _struct) ({ \ (_name)->_struct##_size_rh = sizeof(struct _struct##_rh); \ }) /* - * RH_KABI_INIT_SIZE calculates and sets the size of the extended struct and + * RH_KABI_AUX_INIT_SIZE calculates and sets the size of the extended struct and * stores it in the size_rh field for structs that are statically allocated. * This macro MUST be called when expanding a base struct with - * RH_KABI_SIZE_AND_EXTEND, and it MUST be called from the declaration site + * RH_KABI_AUX, and it MUST be called from the declaration site * regardless of being allocated in the kernel or a module. */ -#define RH_KABI_INIT_SIZE(_struct) \ +#define RH_KABI_AUX_INIT_SIZE(_struct) \ ._struct##_size_rh = sizeof(struct _struct##_rh), /* - * RH_KABI_CHECK_EXT verifies allocated memory exists. This MUST be called to + * RH_KABI_AUX verifies allocated memory exists. This MUST be called to * verify that memory in the _rh struct is valid, and can be called - * regardless if RH_KABI_SIZE_AND_EXTEND or RH_KABI_SIZE_AND_EXTEND_PTR is + * regardless if RH_KABI_AUX_EMBED or RH_KABI_AUX_PTR is * used. */ -#define RH_KABI_CHECK_EXT(_ptr, _struct, _field) ({ \ +#define RH_KABI_AUX(_ptr, _struct, _field) ({ \ size_t __off = offsetof(struct _struct##_rh, _field); \ (_ptr)->_struct##_size_rh > __off ? true : false; \ }) -- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1530 _______________________________________________ kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure