commit | b705fb0a5f20119a5aebeabec1af93c9dd551443 | [log] [tgz] |
---|---|---|
author | Andrew Jeffery <andrew@aj.id.au> | Wed Apr 05 18:28:22 2023 +0930 |
committer | Andrew Jeffery <andrew@aj.id.au> | Wed Apr 05 22:01:41 2023 +0930 |
tree | cb790c125ae144a490aa1a3e475d0c394610c450 | |
parent | 0a05b128a6708dca476accfe82d76dda35927fb2 [diff] |
clang-tidy: Fix bugprone-narrowing-conversion diagnostic ``` /usr/bin/clang-tidy -checks=-*, bugprone-narrowing-conversions -export-fixes /tmp/tmp9pcdq4bf/tmpulhoe1tp.yaml -p=build /mnt/host/andrew/src/openbmc/libpldm/src/requester/pldm.c ../src/requester/pldm.c:32:7: error: narrowing conversion from 'ssize_t' (aka 'long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,-warnings-as-errors] rc = write(fd, &MCTP_MSG_TYPE_PLDM, sizeof(MCTP_MSG_TYPE_PLDM)); ^ ``` Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I95e70d4692dd57d87216e75adb9ac26ab4b96bb9
This is a library which deals with the encoding and decoding of PLDM messages. It should be possible to use this library by projects other than OpenBMC, and hence certain constraints apply to it:
Source files are named according to the PLDM Type, for eg base.[h/c], fru.[h/c], etc.
Given a PLDM command "foo", the library will provide the following API: For the Requester function:
encode_foo_req() - encode a foo request decode_foo_resp() - decode a response to foo
For the Responder function:
decode_foo_req() - decode a foo request encode_foo_resp() - encode a response to foo
The library also provides API to pack and unpack PLDM headers.
Need meson
and ninja
. Alternatively, source an OpenBMC ARM/x86 SDK.
meson setup builddir && ninja -C builddir
The simplest way of running the tests is as described by the meson man page:
meson setup builddir && meson test -C builddir
This will support OEM or vendor-specific functions and semantic information. Following directory structure has to be used:
libpldm |---- include/libpldm | |---- oem/<oem_name>/libpldm | |----<oem based .h files> |---- src | |---- oem/<oem_name> | |----<oem based .c files> |---- tests | |---- oem/<oem_name> | |----<oem based test files>
<oem_name> - This folder must be created with the name of the OEM/vendor in lower case.
Header files & source files having the oem functionality for the libpldm library should be placed under the respective folder hierarchy as mentioned in the above figure. They must be adhering to the rules mentioned under the libpldm section above.
Once the above is done a meson option has to be created in libpldm/meson_options.txt
with its mapped compiler flag to enable conditional compilation.
For consistency would recommend using "oem-<oem_name>".
The libpldm/meson.build
and the corresponding source file(s) will need to incorporate the logic of adding its mapped compiler flag to allow conditional compilation of the code.
The pldm requester API's are present in src/requester
folder and they are intended to provide API's to interact with the desired underlying transport layer to send/receive pldm messages.
NOTE : In the current state, the requester API's in the repository only works with specific transport mechanism & these are going to change in future & probably aren't appropriate to be writing code against.