Skip to content

Commit

Permalink
ocp-print: use int48_to_long() to print 48 bits values
Browse files Browse the repository at this point in the history
This is to reduce unnecessary mask with 0x0000FFFFFFFFFFFF.

Signed-off-by: Tokunori Ikegami <[email protected]>
  • Loading branch information
ikegami-t committed Dec 22, 2024
1 parent a75c965 commit 5887743
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions plugins/ocp/ocp-print-json.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,10 @@ static void json_smart_extended_log_v1(void *data)
obj_add_uint64(pmur, "hi", (uint64_t)le64_to_cpu(*(uint64_t *)&log_data[SCAO_PMUR + 8]));
obj_add_uint64(pmur, "lo", (uint64_t)le64_to_cpu(*(uint64_t *)&log_data[SCAO_PMUR]));
obj_add_obj(root, "Physical media units read", pmur);
obj_add_uint64(root, "Bad user nand blocks - Raw",
(uint64_t)le64_to_cpu(*(uint64_t *)&log_data[SCAO_BUNBR] & 0x0000FFFFFFFFFFFF));
obj_add_uint64(root, "Bad user nand blocks - Raw", int48_to_long(&log_data[SCAO_BUNBR]));
obj_add_uint(root, "Bad user nand blocks - Normalized",
(uint16_t)le16_to_cpu(*(uint16_t *)&log_data[SCAO_BUNBN]));
obj_add_uint64(root, "Bad system nand blocks - Raw",
(uint64_t)le64_to_cpu(*(uint64_t *)&log_data[SCAO_BSNBR] & 0x0000FFFFFFFFFFFF));
obj_add_uint64(root, "Bad system nand blocks - Raw", int48_to_long(&log_data[SCAO_BSNBR]));
obj_add_uint(root, "Bad system nand blocks - Normalized",
(uint16_t)le16_to_cpu(*(uint16_t *)&log_data[SCAO_BSNBN]));
obj_add_uint64(root, "XOR recovery count",
Expand Down
4 changes: 2 additions & 2 deletions plugins/ocp/ocp-print-stdout.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ static void stdout_smart_extended_log(void *data, unsigned int version)
(uint64_t)le64_to_cpu(*(uint64_t *)&log_data[SCAO_PMUR + 8]),
(uint64_t)le64_to_cpu(*(uint64_t *)&log_data[SCAO_PMUR]));
printf(" Bad user nand blocks - Raw %"PRIu64"\n",
(uint64_t)le64_to_cpu(*(uint64_t *)&log_data[SCAO_BUNBR] & 0x0000FFFFFFFFFFFF));
int48_to_long(&log_data[SCAO_BUNBR]));
printf(" Bad user nand blocks - Normalized %d\n",
(uint16_t)le16_to_cpu(*(uint16_t *)&log_data[SCAO_BUNBN]));
printf(" Bad system nand blocks - Raw %"PRIu64"\n",
(uint64_t)le64_to_cpu(*(uint64_t *)&log_data[SCAO_BSNBR] & 0x0000FFFFFFFFFFFF));
int48_to_long(&log_data[SCAO_BSNBR]));
printf(" Bad system nand blocks - Normalized %d\n",
(uint16_t)le16_to_cpu(*(uint16_t *)&log_data[SCAO_BSNBN]));
printf(" XOR recovery count %"PRIu64"\n",
Expand Down

0 comments on commit 5887743

Please sign in to comment.