clang-tidy: Fix readability-identifier-naming diagnostic
For example:
```
/usr/bin/clang-tidy -checks=-*, readability-identifier-naming -export-fixes /tmp/tmpsjbxtnss/tmpbj5pbywt.yaml -p=build /mnt/host/andrew/src/openbmc/libpldm/src/platform.c
/mnt/host/andrew/src/openbmc/libpldm/build/../include/libpldm/pdr.h:166:6: error: invalid case style for function 'pldm_pdr_update_TL_pdr' [readability-identifier-naming,-warnings-as-errors]
void pldm_pdr_update_TL_pdr(const pldm_pdr *repo, uint16_t terminusHandle,
^~~~~~~~~~~~~~~~~~~~~~
pldm_pdr_update_tl_pdr
/mnt/host/andrew/src/openbmc/libpldm/build/../include/libpldm/pdr.h:166:60: error: invalid case style for parameter 'terminusHandle' [readability-identifier-naming,-warnings-as-errors]
void pldm_pdr_update_TL_pdr(const pldm_pdr *repo, uint16_t terminusHandle,
^~~~~~~~~~~~~~
terminus_handle
/mnt/host/andrew/src/openbmc/libpldm/build/../include/libpldm/pdr.h:167:29: error: invalid case style for parameter 'tlEid' [readability-identifier-naming,-warnings-as-errors]
uint8_t tid, uint8_t tlEid, bool valid);
^~~~~
tl_eid
```
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I6419dade685ee656fe773451148f15aefb20becd
diff --git a/include/libpldm/pdr.h b/include/libpldm/pdr.h
index 09b376a..3c0d4dd 100644
--- a/include/libpldm/pdr.h
+++ b/include/libpldm/pdr.h
@@ -158,13 +158,14 @@
* whether the valid bit is set or not as per the spec DSP0248
*
* @param[in] repo - opaque pointer acting as a PDR repo handle
- * @param[in] terminusHandle - PLDM terminus handle
+ * @param[in] terminus_handle - PLDM terminus handle
* @param[in] tid - Terminus ID
* @param[in] tlEid - MCTP endpoint EID
* @param[in] valid - validity bit of TLPDR
*/
-void pldm_pdr_update_TL_pdr(const pldm_pdr *repo, uint16_t terminusHandle,
- uint8_t tid, uint8_t tlEid, bool valid);
+/* NOLINTNEXTLINE(readability-identifier-naming) */
+void pldm_pdr_update_TL_pdr(const pldm_pdr *repo, uint16_t terminus_handle,
+ uint8_t tid, uint8_t tl_eid, bool valid);
/* ======================= */
/* FRU Record Set PDR APIs */
diff --git a/src/pdr.c b/src/pdr.c
index b53f491..2fe9e7b 100644
--- a/src/pdr.c
+++ b/src/pdr.c
@@ -320,30 +320,31 @@
return NULL;
}
-void pldm_pdr_update_TL_pdr(const pldm_pdr *repo, uint16_t terminusHandle,
- uint8_t tid, uint8_t tlEid, bool validBit)
+/* NOLINTNEXTLINE(readability-identifier-naming) */
+void pldm_pdr_update_TL_pdr(const pldm_pdr *repo, uint16_t terminus_handle,
+ uint8_t tid, uint8_t tl_eid, bool valid_bit)
{
- uint8_t *outData = NULL;
+ uint8_t *out_data = NULL;
uint32_t size = 0;
const pldm_pdr_record *record;
record = pldm_pdr_find_record_by_type(repo, PLDM_TERMINUS_LOCATOR_PDR,
- NULL, &outData, &size);
+ NULL, &out_data, &size);
do {
if (record != NULL) {
struct pldm_terminus_locator_pdr *pdr =
- (struct pldm_terminus_locator_pdr *)outData;
+ (struct pldm_terminus_locator_pdr *)out_data;
struct pldm_terminus_locator_type_mctp_eid *value =
(struct pldm_terminus_locator_type_mctp_eid *)
pdr->terminus_locator_value;
- if (pdr->terminus_handle == terminusHandle &&
- pdr->tid == tid && value->eid == tlEid) {
- pdr->validity = validBit;
+ if (pdr->terminus_handle == terminus_handle &&
+ pdr->tid == tid && value->eid == tl_eid) {
+ pdr->validity = valid_bit;
break;
}
}
record = pldm_pdr_find_record_by_type(
- repo, PLDM_TERMINUS_LOCATOR_PDR, record, &outData, &size);
+ repo, PLDM_TERMINUS_LOCATOR_PDR, record, &out_data, &size);
} while (record);
}
diff --git a/src/requester/pldm.c b/src/requester/pldm.c
index 4ec6d51..b1916de 100644
--- a/src/requester/pldm.c
+++ b/src/requester/pldm.c
@@ -8,7 +8,7 @@
#include <sys/un.h>
#include <unistd.h>
-const uint8_t MCTP_MSG_TYPE_PLDM = 1;
+const uint8_t mctp_msg_type_pldm = 1;
pldm_requester_rc_t pldm_open(void)
{
@@ -29,7 +29,7 @@
if (-1 == rc) {
return PLDM_REQUESTER_OPEN_FAIL;
}
- rc = write(fd, &MCTP_MSG_TYPE_PLDM, sizeof(MCTP_MSG_TYPE_PLDM));
+ rc = write(fd, &mctp_msg_type_pldm, sizeof(mctp_msg_type_pldm));
if (-1 == rc) {
return PLDM_REQUESTER_OPEN_FAIL;
}
@@ -56,7 +56,7 @@
uint8_t **pldm_resp_msg,
size_t *resp_msg_len)
{
- ssize_t min_len = sizeof(eid) + sizeof(MCTP_MSG_TYPE_PLDM) +
+ ssize_t min_len = sizeof(eid) + sizeof(mctp_msg_type_pldm) +
sizeof(struct pldm_msg_hdr);
ssize_t length = recv(mctp_fd, NULL, 0, MSG_PEEK | MSG_TRUNC);
if (length <= 0) {
@@ -69,7 +69,7 @@
return PLDM_REQUESTER_INVALID_RECV_LEN;
}
struct iovec iov[2];
- size_t mctp_prefix_len = sizeof(eid) + sizeof(MCTP_MSG_TYPE_PLDM);
+ size_t mctp_prefix_len = sizeof(eid) + sizeof(mctp_msg_type_pldm);
uint8_t mctp_prefix[mctp_prefix_len];
size_t pldm_len = length - mctp_prefix_len;
iov[0].iov_len = mctp_prefix_len;
@@ -85,7 +85,7 @@
free(*pldm_resp_msg);
return PLDM_REQUESTER_INVALID_RECV_LEN;
}
- if ((mctp_prefix[0] != eid) || (mctp_prefix[1] != MCTP_MSG_TYPE_PLDM)) {
+ if ((mctp_prefix[0] != eid) || (mctp_prefix[1] != mctp_msg_type_pldm)) {
free(*pldm_resp_msg);
return PLDM_REQUESTER_NOT_PLDM_MSG;
}
@@ -166,7 +166,7 @@
pldm_requester_rc_t pldm_send(mctp_eid_t eid, int mctp_fd,
const uint8_t *pldm_req_msg, size_t req_msg_len)
{
- uint8_t hdr[2] = {eid, MCTP_MSG_TYPE_PLDM};
+ uint8_t hdr[2] = {eid, mctp_msg_type_pldm};
struct iovec iov[2];
iov[0].iov_base = hdr;