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

kabi: change RH_KABI_REPLACE2 to RH_KABI_REPLACE_SPLIT

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

commit b78086cc13db60964530d11f1abc897ec769c213
Author: Jiri Benc <[email protected]>
Date: Wed, 1 Apr 2020 13:04:05 -0400

    Rename RH_KABI_REPLACE2 to RH_KABI_REPLACE_SPLIT and enhance it to accept
    any number of replacement fields.

    It would be possible to just enhance RH_KABI_REPLACE and not having
    a separate RH_KABI_REPLACE_SPLIT, however, I decided not to do that for two
    reasons:

    1. For consistency with RH_KABI_USE_SPLIT and generic RH_KABI_USE introduced
       later. RH_KABI_USE will accept variable number of arguments but those
       will denote the fields to be replaced. The distinction thus is that the
       _SPLIT version can have multiple new fields, while the non-SPLIT version
       can have multiple old fields.

    2. RH_KABI_REPLACE currently does not generate an anonymous struct around
       the new field, this preserves that behavior and does not require changes
       to kabidw.

    RH-Signed-off-by: Jiri Benc <[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
@@ -261,7 +261,21 @@
  * Macro for breaking up a random element into two smaller chunks using an
  * anonymous struct inside an anonymous union.
  */
-# define RH_KABI_REPLACE2(orig, _new1, _new2)  RH_KABI_REPLACE(orig, struct{ 
_new1; _new2;})
+#define _RH_KABI_REPLACE1(_new)                _new;
+#define _RH_KABI_REPLACE2(_new, ...)   _new; _RH_KABI_REPLACE1(__VA_ARGS__)
+#define _RH_KABI_REPLACE3(_new, ...)   _new; _RH_KABI_REPLACE2(__VA_ARGS__)
+#define _RH_KABI_REPLACE4(_new, ...)   _new; _RH_KABI_REPLACE3(__VA_ARGS__)
+#define _RH_KABI_REPLACE5(_new, ...)   _new; _RH_KABI_REPLACE4(__VA_ARGS__)
+#define _RH_KABI_REPLACE6(_new, ...)   _new; _RH_KABI_REPLACE5(__VA_ARGS__)
+#define _RH_KABI_REPLACE7(_new, ...)   _new; _RH_KABI_REPLACE6(__VA_ARGS__)
+#define _RH_KABI_REPLACE8(_new, ...)   _new; _RH_KABI_REPLACE7(__VA_ARGS__)
+#define _RH_KABI_REPLACE9(_new, ...)   _new; _RH_KABI_REPLACE8(__VA_ARGS__)
+#define _RH_KABI_REPLACE10(_new, ...)  _new; _RH_KABI_REPLACE9(__VA_ARGS__)
+#define _RH_KABI_REPLACE11(_new, ...)  _new; _RH_KABI_REPLACE10(__VA_ARGS__)
+#define _RH_KABI_REPLACE12(_new, ...)  _new; _RH_KABI_REPLACE11(__VA_ARGS__)
+
+#define RH_KABI_REPLACE_SPLIT(_orig, ...)      _RH_KABI_REPLACE(_orig, \
+               struct { __PASTE(_RH_KABI_REPLACE, 
COUNT_ARGS(__VA_ARGS__))(__VA_ARGS__) });
 
 # define RH_KABI_RESERVE(n)            _RH_KABI_RESERVE(n);
 /*

--
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