libpldm: Explicit deprecated, stable and testing ABI classes

Experimenting with new APIs is important, but ABI stability of the
library is also important. We wish to have the freedom to add APIs
without being burdened by them being immediately set in stone.

We implement this wish by introducing three classes of ABI:

1. deprecated
2. stable
3. testing

These are enforced by corresponding function attributes:

1. LIBPLDM_ABI_DEPRECATED
2. LIBPLDM_ABI_STABLE
3. LIBPLDM_ABI_TESTING

Symbol visibility in the library is flipped to 'hidden' by default, so
one of these annotations must be used for the symbol to be exposed.

With these classes in place there are now clear points in time at which
we update the ABI dumps captured under the abi/ directory: When an API
is migrated from the 'testing' class to the 'stable' class, or when
removed from the 'deprecated' class.

Which classes of functions are exposed by the build is controlled by the
new 'abi' meson option. The option is of array type which contains the
list of ABI classes the build should consider. It defaults to enabling
all classes to provide test coverage in CI. The classes used should be
constrained to deprecated and stable (and not test) in any dependent
projects.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I25402e20c7be9c9f264f9ccd7ac36b384823734c
diff --git a/src/transport/af-mctp.c b/src/transport/af-mctp.c
index f499a72..5084f7d 100644
--- a/src/transport/af-mctp.c
+++ b/src/transport/af-mctp.c
@@ -1,4 +1,5 @@
-#include "../mctp-defines.h"
+#include "config.h"
+#include "mctp-defines.h"
 #include "base.h"
 #include "container-of.h"
 #include "libpldm/pldm.h"
@@ -25,12 +26,14 @@
 #define transport_to_af_mctp(ptr)                                              \
 	container_of(ptr, struct pldm_transport_af_mctp, transport)
 
+LIBPLDM_ABI_TESTING
 struct pldm_transport *
 pldm_transport_af_mctp_core(struct pldm_transport_af_mctp *ctx)
 {
 	return &ctx->transport;
 }
 
+LIBPLDM_ABI_TESTING
 int pldm_transport_af_mctp_init_pollfd(struct pldm_transport *t,
 				       struct pollfd *pollfd)
 {
@@ -54,6 +57,7 @@
 	return -1;
 }
 
+LIBPLDM_ABI_TESTING
 int pldm_transport_af_mctp_map_tid(struct pldm_transport_af_mctp *ctx,
 				   pldm_tid_t tid, mctp_eid_t eid)
 {
@@ -62,6 +66,7 @@
 	return 0;
 }
 
+LIBPLDM_ABI_TESTING
 int pldm_transport_af_mctp_unmap_tid(struct pldm_transport_af_mctp *ctx,
 				     __attribute__((unused)) pldm_tid_t tid,
 				     mctp_eid_t eid)
@@ -122,6 +127,7 @@
 	return PLDM_REQUESTER_SUCCESS;
 }
 
+LIBPLDM_ABI_TESTING
 int pldm_transport_af_mctp_init(struct pldm_transport_af_mctp **ctx)
 {
 	if (!ctx || *ctx) {
@@ -147,6 +153,7 @@
 	return 0;
 }
 
+LIBPLDM_ABI_TESTING
 void pldm_transport_af_mctp_destroy(struct pldm_transport_af_mctp *ctx)
 {
 	if (!ctx) {
diff --git a/src/transport/mctp-demux.c b/src/transport/mctp-demux.c
index 91946d2..466d33c 100644
--- a/src/transport/mctp-demux.c
+++ b/src/transport/mctp-demux.c
@@ -1,4 +1,5 @@
-#include "../mctp-defines.h"
+#include "config.h"
+#include "mctp-defines.h"
 #include "base.h"
 #include "container-of.h"
 #include "libpldm/pldm.h"
@@ -28,6 +29,7 @@
 #define transport_to_demux(ptr)                                                \
 	container_of(ptr, struct pldm_transport_mctp_demux, transport)
 
+LIBPLDM_ABI_TESTING
 struct pldm_transport *
 pldm_transport_mctp_demux_core(struct pldm_transport_mctp_demux *ctx)
 {
@@ -61,6 +63,7 @@
 	return fd;
 }
 
+LIBPLDM_ABI_TESTING
 int pldm_transport_mctp_demux_init_pollfd(struct pldm_transport *t,
 					  struct pollfd *pollfd)
 {
@@ -85,6 +88,7 @@
 	return -1;
 }
 
+LIBPLDM_ABI_TESTING
 int pldm_transport_mctp_demux_map_tid(struct pldm_transport_mctp_demux *ctx,
 				      pldm_tid_t tid, mctp_eid_t eid)
 {
@@ -93,6 +97,7 @@
 	return 0;
 }
 
+LIBPLDM_ABI_TESTING
 int pldm_transport_mctp_demux_unmap_tid(struct pldm_transport_mctp_demux *ctx,
 					__attribute__((unused)) pldm_tid_t tid,
 					mctp_eid_t eid)
@@ -183,6 +188,7 @@
 	return PLDM_REQUESTER_SUCCESS;
 }
 
+LIBPLDM_ABI_TESTING
 int pldm_transport_mctp_demux_init(struct pldm_transport_mctp_demux **ctx)
 {
 	if (!ctx || *ctx) {
@@ -209,6 +215,7 @@
 	return 0;
 }
 
+LIBPLDM_ABI_TESTING
 void pldm_transport_mctp_demux_destroy(struct pldm_transport_mctp_demux *ctx)
 {
 	if (!ctx) {
@@ -219,6 +226,7 @@
 }
 
 /* Temporary for old API */
+LIBPLDM_ABI_TESTING
 struct pldm_transport_mctp_demux *
 pldm_transport_mctp_demux_init_with_fd(int mctp_fd)
 {
@@ -244,6 +252,7 @@
 	return demux;
 }
 
+LIBPLDM_ABI_TESTING
 int pldm_transport_mctp_demux_get_socket_fd(
 	struct pldm_transport_mctp_demux *ctx)
 {
diff --git a/src/transport/transport.c b/src/transport/transport.c
index 77a33f8..0cbef29 100644
--- a/src/transport/transport.c
+++ b/src/transport/transport.c
@@ -1,3 +1,4 @@
+#include "config.h"
 #include "libpldm/transport.h"
 #include "base.h"
 #include "libpldm/requester/pldm.h"
@@ -29,6 +30,7 @@
 }
 #endif
 
+LIBPLDM_ABI_TESTING
 pldm_requester_rc_t pldm_transport_poll(struct pldm_transport *transport,
 					int timeout)
 {
@@ -50,6 +52,7 @@
 	return PLDM_REQUESTER_SUCCESS;
 }
 
+LIBPLDM_ABI_TESTING
 pldm_requester_rc_t pldm_transport_send_msg(struct pldm_transport *transport,
 					    pldm_tid_t tid,
 					    const void *pldm_req_msg,
@@ -71,6 +74,7 @@
 	return transport->send(transport, tid, pldm_req_msg, req_msg_len);
 }
 
+LIBPLDM_ABI_TESTING
 pldm_requester_rc_t pldm_transport_recv_msg(struct pldm_transport *transport,
 					    pldm_tid_t tid,
 					    void **pldm_resp_msg,
@@ -146,6 +150,7 @@
 	return 0;
 }
 
+LIBPLDM_ABI_TESTING
 pldm_requester_rc_t
 pldm_transport_send_recv_msg(struct pldm_transport *transport, pldm_tid_t tid,
 			     const void *pldm_req_msg, size_t req_msg_len,