Skip to content

Commit 145aeee

Browse files
committed
nvme-print-stdout: fix to use le64_to_cpu for host id feature print
Since hardcoded to change only big endian byte order for 64-bit hostid. Signed-off-by: Tokunori Ikegami <[email protected]>
1 parent 54e9fc6 commit 145aeee

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

nvme-print-stdout.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5135,25 +5135,19 @@ static void stdout_host_metadata(enum nvme_features_id fid,
51355135

51365136
static void stdout_feat_host_id(unsigned int result, unsigned char *hostid)
51375137
{
5138-
uint64_t ull;
51395138
bool exhid;
51405139

51415140
if (!hostid)
51425141
return;
51435142

51445143
nvme_feature_decode_host_id(result, &exhid);
51455144

5146-
if (exhid) {
5145+
if (exhid)
51475146
printf("\tHost Identifier (HOSTID): %s\n",
51485147
uint128_t_to_l10n_string(le128_to_cpu(hostid)));
5149-
return;
5150-
}
5151-
5152-
ull = hostid[7]; ull <<= 8; ull |= hostid[6]; ull <<= 8;
5153-
ull |= hostid[5]; ull <<= 8; ull |= hostid[4]; ull <<= 8;
5154-
ull |= hostid[3]; ull <<= 8; ull |= hostid[2]; ull <<= 8;
5155-
ull |= hostid[1]; ull <<= 8; ull |= hostid[0];
5156-
printf("\tHost Identifier (HOSTID): %" PRIu64 "\n", ull);
5148+
else
5149+
printf("\tHost Identifier (HOSTID): %" PRIu64 "\n",
5150+
le64_to_cpu(*(__le64 *)hostid));
51575151
}
51585152

51595153
static void stdout_feature_show(enum nvme_features_id fid, int sel, unsigned int result)

0 commit comments

Comments
 (0)