[OS-BUILD PATCH 18/18] kabi: Add kABI macros for enum type

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

 



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

kabi: Add kABI macros for enum type

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

commit 258dac2f73c852bc4f3b401a58228a1333e2b002
Author: Waiman Long <longman@xxxxxxxxxx>
Date: Wed, 16 Dec 2020 00:14:58 -0500

    Currently, there is no kABI macro to safely handle the addition and
    removal of enum fields in an enum type. Add the following macros to
    do that:
     - RH_KABI_BROKEN_INSERT_ENUM()
     - RH_KABI_BROKEN_REMOVE_ENUM()
     - RH_KABI_EXTEND_ENUM()

    RH-Signed-off-by: Waiman Long <longman@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
@@ -334,6 +334,20 @@
  *   Replace a field by a different one without doing any checking.  This
  *   allows replacing a field by another with a different size.  Similarly
  *   to other RH_KABI_BROKEN macros, use of this indicates a kABI breakage.
+ *
+ * RH_KABI_BROKEN_INSERT_ENUM
+ * RH_KABI_BROKEN_REMOVE_ENUM
+ *   Insert a field to the middle of an enumaration type / delete a field from
+ *   an enumaration type. Note that this can break kABI especially if the
+ *   number of enum fields is used in an array within a structure. It can be
+ *   done only when it is certain that no 3rd party driver will use the
+ *   enumeration type or a structure that embeds an array with size determined
+ *   by an enumeration type.
+ *
+ * RH_KABI_EXTEND_ENUM
+ *   Adds a new field to an enumeration type.  This must always be added to
+ *   the end of the enum.  Before using this macro, make sure this is actually
+ *   safe to do.
  */
 
 #undef linux
@@ -354,6 +368,9 @@
 # define RH_KABI_BROKEN_INSERT_BLOCK(_new)
 # define RH_KABI_BROKEN_REMOVE_BLOCK(_orig)	_orig
 # define RH_KABI_BROKEN_REPLACE(_orig, _new)	_orig;
+# define RH_KABI_BROKEN_INSERT_ENUM(_new)
+# define RH_KABI_BROKEN_REMOVE_ENUM(_orig)	_orig,
+# define RH_KABI_EXTEND_ENUM(_new)
 
 # define _RH_KABI_DEPRECATE(_type, _orig)	_type _orig
 # define _RH_KABI_DEPRECATE_FN(_type, _orig, _args...)	_type (*_orig)(_args)
@@ -377,7 +394,9 @@
 # define RH_KABI_BROKEN_INSERT_BLOCK(_new)	_new
 # define RH_KABI_BROKEN_REMOVE_BLOCK(_orig)
 # define RH_KABI_BROKEN_REPLACE(_orig, _new)	_new;
-
+# define RH_KABI_BROKEN_INSERT_ENUM(_new)	_new,
+# define RH_KABI_BROKEN_REMOVE_ENUM(_orig)
+# define RH_KABI_EXTEND_ENUM(_new)		_new,
 
 #if IS_BUILTIN(CONFIG_RH_KABI_SIZE_ALIGN_CHECKS)
 # define __RH_KABI_CHECK_SIZE_ALIGN(_orig, _new)			\

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