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/oem/ibm/file_io.c b/src/oem/ibm/file_io.c
index 10af817..01d3e43 100644
--- a/src/oem/ibm/file_io.c
+++ b/src/oem/ibm/file_io.c
@@ -1,8 +1,10 @@
+#include "config.h"
 #include "libpldm/file_io.h"
 #include "base.h"
 #include <endian.h>
 #include <string.h>
 
+LIBPLDM_ABI_STABLE
 int decode_rw_file_memory_req(const struct pldm_msg *msg, size_t payload_length,
 			      uint32_t *file_handle, uint32_t *offset,
 			      uint32_t *length, uint64_t *address)
@@ -27,6 +29,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_rw_file_memory_resp(uint8_t instance_id, uint8_t command,
 			       uint8_t completion_code, uint32_t length,
 			       struct pldm_msg *msg)
@@ -55,6 +58,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_rw_file_memory_req(uint8_t instance_id, uint8_t command,
 			      uint32_t file_handle, uint32_t offset,
 			      uint32_t length, uint64_t address,
@@ -83,6 +87,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_rw_file_memory_resp(const struct pldm_msg *msg,
 			       size_t payload_length, uint8_t *completion_code,
 			       uint32_t *length)
@@ -105,6 +110,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_get_file_table_req(const struct pldm_msg *msg, size_t payload_length,
 			      uint32_t *transfer_handle,
 			      uint8_t *transfer_opflag, uint8_t *table_type)
@@ -128,6 +134,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_get_file_table_resp(uint8_t instance_id, uint8_t completion_code,
 			       uint32_t next_transfer_handle,
 			       uint8_t transfer_flag, const uint8_t *table_data,
@@ -160,6 +167,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_get_file_table_req(uint8_t instance_id, uint32_t transfer_handle,
 			      uint8_t transfer_opflag, uint8_t table_type,
 			      struct pldm_msg *msg)
@@ -187,6 +195,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_get_file_table_resp(const struct pldm_msg *msg,
 			       size_t payload_length, uint8_t *completion_code,
 			       uint32_t *next_transfer_handle,
@@ -224,6 +233,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_read_file_req(const struct pldm_msg *msg, size_t payload_length,
 			 uint32_t *file_handle, uint32_t *offset,
 			 uint32_t *length)
@@ -247,6 +257,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_read_file_req(uint8_t instance_id, uint32_t file_handle,
 			 uint32_t offset, uint32_t length, struct pldm_msg *msg)
 {
@@ -278,6 +289,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_read_file_resp(const struct pldm_msg *msg, size_t payload_length,
 			  uint8_t *completion_code, uint32_t *length,
 			  size_t *file_data_offset)
@@ -305,6 +317,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_read_file_resp(uint8_t instance_id, uint8_t completion_code,
 			  uint32_t length, struct pldm_msg *msg)
 {
@@ -333,6 +346,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_write_file_req(const struct pldm_msg *msg, size_t payload_length,
 			  uint32_t *file_handle, uint32_t *offset,
 			  uint32_t *length, size_t *file_data_offset)
@@ -360,6 +374,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_write_file_req(uint8_t instance_id, uint32_t file_handle,
 			  uint32_t offset, uint32_t length,
 			  struct pldm_msg *msg)
@@ -392,6 +407,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_write_file_resp(const struct pldm_msg *msg, size_t payload_length,
 			   uint8_t *completion_code, uint32_t *length)
 {
@@ -414,6 +430,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_write_file_resp(uint8_t instance_id, uint8_t completion_code,
 			   uint32_t length, struct pldm_msg *msg)
 {
@@ -442,6 +459,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_rw_file_by_type_memory_req(const struct pldm_msg *msg,
 				      size_t payload_length,
 				      uint16_t *file_type,
@@ -468,6 +486,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_rw_file_by_type_memory_resp(uint8_t instance_id, uint8_t command,
 				       uint8_t completion_code, uint32_t length,
 				       struct pldm_msg *msg)
@@ -496,6 +515,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_rw_file_by_type_memory_req(uint8_t instance_id, uint8_t command,
 				      uint16_t file_type, uint32_t file_handle,
 				      uint32_t offset, uint32_t length,
@@ -526,6 +546,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_rw_file_by_type_memory_resp(const struct pldm_msg *msg,
 				       size_t payload_length,
 				       uint8_t *completion_code,
@@ -549,6 +570,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_new_file_req(const struct pldm_msg *msg, size_t payload_length,
 			uint16_t *file_type, uint32_t *file_handle,
 			uint64_t *length)
@@ -571,6 +593,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_new_file_resp(uint8_t instance_id, uint8_t completion_code,
 			 struct pldm_msg *msg)
 {
@@ -595,6 +618,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_new_file_req(uint8_t instance_id, uint16_t file_type,
 			uint32_t file_handle, uint64_t length,
 			struct pldm_msg *msg)
@@ -622,6 +646,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_new_file_resp(const struct pldm_msg *msg, size_t payload_length,
 			 uint8_t *completion_code)
 {
@@ -640,6 +665,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_rw_file_by_type_req(const struct pldm_msg *msg,
 			       size_t payload_length, uint16_t *file_type,
 			       uint32_t *file_handle, uint32_t *offset,
@@ -664,6 +690,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_rw_file_by_type_resp(uint8_t instance_id, uint8_t command,
 				uint8_t completion_code, uint32_t length,
 				struct pldm_msg *msg)
@@ -696,6 +723,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_rw_file_by_type_req(uint8_t instance_id, uint8_t command,
 			       uint16_t file_type, uint32_t file_handle,
 			       uint32_t offset, uint32_t length,
@@ -729,6 +757,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_rw_file_by_type_resp(const struct pldm_msg *msg,
 				size_t payload_length, uint8_t *completion_code,
 				uint32_t *length)
@@ -751,6 +780,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_file_ack_req(const struct pldm_msg *msg, size_t payload_length,
 			uint16_t *file_type, uint32_t *file_handle,
 			uint8_t *file_status)
@@ -772,6 +802,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_file_ack_resp(uint8_t instance_id, uint8_t completion_code,
 			 struct pldm_msg *msg)
 {
@@ -796,6 +827,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_file_ack_req(uint8_t instance_id, uint16_t file_type,
 			uint32_t file_handle, uint8_t file_status,
 			struct pldm_msg *msg)
@@ -823,6 +855,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_file_ack_resp(const struct pldm_msg *msg, size_t payload_length,
 			 uint8_t *completion_code)
 {
@@ -841,6 +874,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_file_ack_with_meta_data_req(
 	uint8_t instance_id, uint16_t file_type, uint32_t file_handle,
 	uint8_t file_status, uint32_t file_meta_data_1,
@@ -874,6 +908,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_file_ack_with_meta_data_resp(const struct pldm_msg *msg,
 					size_t payload_length,
 					uint8_t *completion_code)
@@ -893,6 +928,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_file_ack_with_meta_data_req(
 	const struct pldm_msg *msg, size_t payload_length, uint16_t *file_type,
 	uint32_t *file_handle, uint8_t *file_status, uint32_t *file_meta_data_1,
@@ -920,6 +956,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_file_ack_with_meta_data_resp(uint8_t instance_id,
 					uint8_t completion_code,
 					struct pldm_msg *msg)
@@ -945,6 +982,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_new_file_with_metadata_req(uint8_t instance_id, uint16_t file_type,
 				      uint32_t file_handle, uint64_t length,
 				      uint32_t file_meta_data_1,
@@ -980,6 +1018,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_new_file_with_metadata_resp(const struct pldm_msg *msg,
 				       size_t payload_length,
 				       uint8_t *completion_code)
@@ -1003,6 +1042,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int decode_new_file_with_metadata_req(
 	const struct pldm_msg *msg, size_t payload_length, uint16_t *file_type,
 	uint32_t *file_handle, uint64_t *length, uint32_t *file_meta_data_1,
@@ -1032,6 +1072,7 @@
 	return PLDM_SUCCESS;
 }
 
+LIBPLDM_ABI_STABLE
 int encode_new_file_with_metadata_resp(uint8_t instance_id,
 				       uint8_t completion_code,
 				       struct pldm_msg *msg)