From: Čestmír Kalina <[email protected]>

kabi: use fixed field name for extended part

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2024595
Upstream Status: RHEL only

commit 620b222e839dc20ce33b86ed7657903335cfbad1
Author: Jiri Benc <[email protected]>
Author: Ivan Vecera <[email protected]>
Date: Wed, 1 Apr 2020 13:04:12 -0400

    The current RH_KABI_SIZE_AND_EXTEND* macros uses passed structure name
    as a prefix for the field used for access to the extended area.

    Example:

    struct napi_struct_extend {
        int ex_field;
    };
    struct napi_struct {
        ...
        RH_KABI_SIZE_AND_EXTEND(napi_struct_extend)
    };

    Unfortunately the generated field name is very long and when you need to
    access any field in extended part of napi_struct you need to use this
    horrible construct:

    napi->napi_struct_extend.ex_field;

    As RH_KABI_SIZE_AND_EXTEND* should not be used more than once in
    a structure we can use a short fixed name to access an extended area.
    The patch modifies the affected macros so '._rh' is used as a name
    for this field so the field from the previous example will be referenced
    as:

    napi->_rh.ex_field;

    RH-Signed-off-by: Ivan Vecera <[email protected]>

Signed-off-by: Čestmír Kalina <[email protected]>
Signed-off-by: Prarit Bhargava <[email protected]>

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
@@ -378,13 +378,13 @@
  */
 #define _RH_KABI_SIZE_AND_EXTEND_PTR(_struct)                          \
        size_t _struct##_size_rh;                                       \
-       RH_KABI_EXCLUDE(struct _struct##_rh *_struct##_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_SIZE_AND_EXTEND(_struct)                              \
        size_t _struct##_size_rh;                                       \
-       RH_KABI_EXCLUDE(struct _struct##_rh _struct##_rh)
+       RH_KABI_EXCLUDE(struct _struct##_rh _rh)
 #define RH_KABI_SIZE_AND_EXTEND(_struct)                               \
        _RH_KABI_SIZE_AND_EXTEND(_struct)
 

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1530
_______________________________________________
kernel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
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/[email protected]
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to