fru: Stabilise get_fru_record_by_option_check()
get_fru_record_by_option_check() is a replacement for
get_fru_record_by_option(). The latter sanitized its arguments using
assert() while the former instead returns a value indicating success or
failure.
Use of get_fru_record_by_option_check() is demonstrated in the following
patch:
https://gerrit.openbmc.org/c/openbmc/pldm/+/64628
Additionally, deprecate get_fru_record_by_option() now that there's a
stable replacement.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I80c77b12606ffe6aa5c38086fc162bbe34f2dd2f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 29fd452..ec06bff 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -109,6 +109,11 @@
pldm_bios_table_append_pad_checksum() should migrate to
pldm_bios_table_append_pad_checksum_check()
+9. fru: Stabilise get_fru_record_by_option_check()
+
+ get_fru_record_by_option() is deprecated by this change. Users of
+ get_fru_record_by_option() should migrate to get_fru_record_by_option_check()
+
### Removed
1. bios_table: Remove deprecated APIs sanitized by assert():
diff --git a/abi/aarch64/gcc.dump b/abi/aarch64/gcc.dump
index 608b450..660f9cf 100644
--- a/abi/aarch64/gcc.dump
+++ b/abi/aarch64/gcc.dump
@@ -5970,6 +5970,41 @@
'Return' => '74',
'ShortName' => 'encode_get_fru_record_by_option_req'
},
+ '75596' => {
+ 'Header' => 'fru.h',
+ 'Param' => {
+ '0' => {
+ 'name' => 'table',
+ 'type' => '6087'
+ },
+ '1' => {
+ 'name' => 'table_size',
+ 'type' => '123'
+ },
+ '2' => {
+ 'name' => 'record_table',
+ 'type' => '2034'
+ },
+ '3' => {
+ 'name' => 'record_size',
+ 'type' => '8822'
+ },
+ '4' => {
+ 'name' => 'rsi',
+ 'type' => '4895'
+ },
+ '5' => {
+ 'name' => 'rt',
+ 'type' => '168'
+ },
+ '6' => {
+ 'name' => 'ft',
+ 'type' => '168'
+ }
+ },
+ 'Return' => '74',
+ 'ShortName' => 'get_fru_record_by_option_check'
+ },
'7577' => {
'Header' => 'bios.h',
'Param' => {
@@ -7589,6 +7624,7 @@
'entity_association_tree_find' => 1,
'find_entity_ref_in_tree' => 1,
'get_fru_record_by_option' => 1,
+ 'get_fru_record_by_option_check' => 1,
'is_present' => 1,
'is_time_legal' => 1,
'is_transfer_flag_valid' => 1,
diff --git a/abi/x86_64/gcc.dump b/abi/x86_64/gcc.dump
index 33df348..945039c 100644
--- a/abi/x86_64/gcc.dump
+++ b/abi/x86_64/gcc.dump
@@ -6540,6 +6540,42 @@
'Return' => '74',
'ShortName' => 'decode_set_bios_attribute_current_value_resp'
},
+ '76776' => {
+ 'Header' => 'fru.h',
+ 'Param' => {
+ '0' => {
+ 'name' => 'table',
+ 'type' => '6245'
+ },
+ '1' => {
+ 'name' => 'table_size',
+ 'type' => '123'
+ },
+ '2' => {
+ 'name' => 'record_table',
+ 'type' => '2082'
+ },
+ '3' => {
+ 'name' => 'record_size',
+ 'type' => '9084'
+ },
+ '4' => {
+ 'name' => 'rsi',
+ 'type' => '5053'
+ },
+ '5' => {
+ 'name' => 'rt',
+ 'type' => '168'
+ },
+ '6' => {
+ 'name' => 'ft',
+ 'offset' => '0',
+ 'type' => '168'
+ }
+ },
+ 'Return' => '74',
+ 'ShortName' => 'get_fru_record_by_option_check'
+ },
'77367' => {
'Header' => 'fru.h',
'Param' => {
@@ -8084,6 +8120,7 @@
'entity_association_tree_find' => 1,
'find_entity_ref_in_tree' => 1,
'get_fru_record_by_option' => 1,
+ 'get_fru_record_by_option_check' => 1,
'is_present' => 1,
'is_time_legal' => 1,
'is_transfer_flag_valid' => 1,
diff --git a/src/fru.c b/src/fru.c
index 39d8576..9d6f575 100644
--- a/src/fru.c
+++ b/src/fru.c
@@ -211,7 +211,7 @@
table_size);
}
-LIBPLDM_ABI_STABLE
+LIBPLDM_ABI_DEPRECATED
void get_fru_record_by_option(const uint8_t *table, size_t table_size,
uint8_t *record_table, size_t *record_size,
uint16_t rsi, uint8_t rt, uint8_t ft)
@@ -222,7 +222,7 @@
assert(rc == PLDM_SUCCESS);
}
-LIBPLDM_ABI_TESTING
+LIBPLDM_ABI_STABLE
int get_fru_record_by_option_check(const uint8_t *table, size_t table_size,
uint8_t *record_table, size_t *record_size,
uint16_t rsi, uint8_t rt, uint8_t ft)