[OS-BUILD PATCH 16/18] kabi: introduce RH_KABI_USE_AUX_PTR

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Čestmír Kalina <ckalina@xxxxxxxxxx>

kabi: introduce RH_KABI_USE_AUX_PTR

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

commit 194de3042cda2e21a14b504965b4c463b47de73c
Author: Jiri Benc <jbenc@xxxxxxxxxx>
Date: Wed, 1 Apr 2020 13:04:15 -0400

    It's hard to predict the number of changes required in a struct. We do our
    best by reserving fields by RH_KABI_RESERVE but sometimes they run out. If
    that's going to happen, the last two reserved fields can be changed into
    an aux struct mechanism. Introduce a macro that does that.

    Example: there's this struct:

    struct foo {
            ...
            RH_KABI_USE(1, int a)
            RH_KABI_USE(2, int b)
            RH_KABI_RESERVE(3)
            RH_KABI_RESERVE(4)
    };

    and a need to add field 'int c', while we expect further additions. It can
    be now done in this way:

    struct foo_rh {
            int c;
    };

    struct foo {
            ...
            RH_KABI_USE(1, int a)
            RH_KABI_USE(2, int b)
            RH_KABI_USE_AUX_PTR(3, 4, foo)
    };

    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
@@ -388,6 +388,15 @@
 #define RH_KABI_AUX_EMBED(_struct)					\
 	_RH_KABI_AUX_EMBED(_struct);
 
+/*
+ * If there is a post-kABI freeze need of RH_KABI_AUX_PTR and there are
+ * still two reserved fields available, they can be converted by
+ * RH_KABI_USE_AUX_PTR.
+ */
+#define RH_KABI_USE_AUX_PTR(n1, n2, _struct)				\
+	RH_KABI_USE(n1, n2,						\
+		     struct { RH_KABI_AUX_PTR(_struct) })
+
 /*
  * 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.

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




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux