Skip to content

Commit 7a67118

Browse files
ikegami-tigaw
authored andcommitted
ocp: change hwcomp log size variable name to log_bytes
Since the size value calculated to bytes from dwords for version 1. Signed-off-by: Tokunori Ikegami <[email protected]>
1 parent b798c9d commit 7a67118

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

plugins/ocp/ocp-print-binary.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77

88
static void binary_hwcomp_log(struct hwcomp_log *log, __u32 id, bool list)
99
{
10-
long double desc_len = uint128_t_to_double(le128_to_cpu(log->size));
10+
long double log_bytes = uint128_t_to_double(le128_to_cpu(log->size));
11+
1112
if (log->ver == 1)
12-
desc_len *= sizeof(__le32);
13+
log_bytes *= sizeof(__le32);
1314

14-
d_raw((unsigned char *)log, desc_len);
15+
d_raw((unsigned char *)log, log_bytes);
1516
}
1617

1718
static void binary_c5_log(struct nvme_dev *dev, struct unsupported_requirement_log *log_data)

plugins/ocp/ocp-print-json.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,19 @@ static void print_hwcomp_descs_json(struct hwcomp_desc *desc, long double log_si
6565

6666
static void json_hwcomp_log(struct hwcomp_log *log, __u32 id, bool list)
6767
{
68+
long double log_bytes = uint128_t_to_double(le128_to_cpu(log->size));
6869
struct json_object *r = json_create_object();
6970

70-
long double log_size = uint128_t_to_double(le128_to_cpu(log->size));
7171
if (log->ver == 1)
72-
log_size *= sizeof(__le32);
72+
log_bytes *= sizeof(__le32);
7373

7474
json_object_add_uint_02x(r, "Log Identifier", OCP_LID_HWCOMP);
7575
json_object_add_uint_0x(r, "Log Page Version", le16_to_cpu(log->ver));
7676
json_object_add_byte_array(r, "Reserved2", log->rsvd2, ARRAY_SIZE(log->rsvd2));
7777
json_object_add_byte_array(r, "Log page GUID", log->guid, ARRAY_SIZE(log->guid));
78-
json_object_add_nprix64(r, "Hardware Component Log Size", (unsigned long long)log_size);
78+
json_object_add_nprix64(r, "Hardware Component Log Size", (unsigned long long)log_bytes);
7979
json_object_add_byte_array(r, "Reserved48", log->rsvd48, ARRAY_SIZE(log->rsvd48));
80-
print_hwcomp_descs_json(log->desc, log_size - offsetof(struct hwcomp_log, desc), id, list,
80+
print_hwcomp_descs_json(log->desc, log_bytes - offsetof(struct hwcomp_log, desc), id, list,
8181
obj_create_array_obj(r, "Component Descriptions"));
8282

8383
json_print(r);

plugins/ocp/ocp-print-stdout.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,21 @@ static void stdout_hwcomp_log(struct hwcomp_log *log, __u32 id, bool list)
3030
{
3131
size_t date_lot_code_offset = sizeof(struct hwcomp_desc);
3232
int num = 1;
33+
long double log_bytes = uint128_t_to_double(le128_to_cpu(log->size));
3334
struct hwcomp_desc_entry e = { log->desc };
3435

35-
long double log_size = uint128_t_to_double(le128_to_cpu(log->size));
3636
if (log->ver == 1)
37-
log_size *= sizeof(__le32);
37+
log_bytes *= sizeof(__le32);
3838

3939
printf("Log Identifier: 0x%02xh\n", OCP_LID_HWCOMP);
4040
printf("Log Page Version: 0x%x\n", le16_to_cpu(log->ver));
4141
print_array("Reserved2", log->rsvd2, ARRAY_SIZE(log->rsvd2));
4242
print_array("Log page GUID", log->guid, ARRAY_SIZE(log->guid));
43-
printf("Hardware Component Log Size: 0x%"PRIx64"\n", (uint64_t)log_size);
43+
printf("Hardware Component Log Size: 0x%"PRIx64"\n", (uint64_t)log_bytes);
4444
print_array("Reserved48", log->rsvd48, ARRAY_SIZE(log->rsvd48));
4545
printf("Component Descriptions\n");
46-
log_size -= offsetof(struct hwcomp_log, desc);
47-
while (log_size > 0) {
46+
log_bytes -= offsetof(struct hwcomp_log, desc);
47+
while (log_bytes > 0) {
4848
e.date_lot_size = le64_to_cpu(e.desc->date_lot_size) * sizeof(__le32);
4949
e.date_lot_code = e.date_lot_size ? (__u8 *)e.desc + date_lot_code_offset : NULL;
5050
e.add_info_size = le64_to_cpu(e.desc->add_info_size) * sizeof(__le32);
@@ -54,7 +54,7 @@ static void stdout_hwcomp_log(struct hwcomp_log *log, __u32 id, bool list)
5454
print_hwcomp_desc(&e, list, num++);
5555
e.desc_size = date_lot_code_offset + e.date_lot_size + e.add_info_size;
5656
e.desc = (struct hwcomp_desc *)((__u8 *)e.desc + e.desc_size);
57-
log_size -= e.desc_size;
57+
log_bytes -= e.desc_size;
5858
}
5959
}
6060

0 commit comments

Comments
 (0)