Skip to content
Snippets Groups Projects
Commit 8b591f59 authored by chrfranke's avatar chrfranke
Browse files

nvmecmds.cpp, nvmprint.cpp: Also suppress NVMe Namespace IEEE EUI-64 info

if '-q noserial' is specified.
smartctl.8.in: Update '-q noserial' documentation.

git-svn-id: https://svn.code.sf.net/p/smartmontools/code/trunk@5473 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent fe7f819b
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,10 @@ $Id$
2023-05-30 Christian Franke <franke@computer.org>
nvmecmds.cpp, nvmprint.cpp: Also suppress NVMe Namespace IEEE EUI-64
info if '-q noserial' is specified.
smartctl.8.in: Update '-q noserial' documentation.
smartd.cpp: Don't report new non-device related errors as critical
(#1222).
smartd.conf.5.in: Document new functionality.
......
......@@ -72,12 +72,18 @@ static bool nvme_pass_through(nvme_device * device, const nvme_cmd_in & in,
pout(" [Duration: %.6fs]\n", duration_usec / 1000000.0);
}
if ( dont_print_serial_number && ok
&& in.opcode == nvme_admin_identify && in.cdw10 == 0x01) {
// Invalidate serial number
if (dont_print_serial_number && ok && in.opcode == nvme_admin_identify) {
if (in.cdw10 == 0x01 && in.size >= sizeof(nvme_id_ctrl)) {
// Identify controller: Invalidate serial number
nvme_id_ctrl & id_ctrl = *reinterpret_cast<nvme_id_ctrl *>(in.buffer);
memset(id_ctrl.sn, 'X', sizeof(id_ctrl.sn));
}
else if (in.cdw10 == 0x00 && in.size >= sizeof(nvme_id_ns)) {
// Identify namespace: Invalidate IEEE EUI-64
nvme_id_ns & id_ns = *reinterpret_cast<nvme_id_ns *>(in.buffer);
memset(id_ns.eui64, 0x00, sizeof(id_ns.eui64));
}
}
if (nvme_debugmode) {
if (!ok) {
......
......@@ -192,7 +192,7 @@ static void print_drive_info(const nvme_id_ctrl & id_ctrl, const nvme_id_ns & id
jrns["formatted_lba_size"] = (1U << fmt_lba_bits);
jglb["logical_block_size"] = (1U << fmt_lba_bits);
if (show_all || nonempty(id_ns.eui64, sizeof(id_ns.eui64))) {
if (!dont_print_serial_number && (show_all || nonempty(id_ns.eui64, sizeof(id_ns.eui64)))) {
jout("Namespace %u IEEE EUI-64: %s%02x%02x%02x %02x%02x%02x%02x%02x\n",
nsid, align, id_ns.eui64[0], id_ns.eui64[1], id_ns.eui64[2], id_ns.eui64[3],
id_ns.eui64[4], id_ns.eui64[5], id_ns.eui64[6], id_ns.eui64[7]);
......
......@@ -382,6 +382,13 @@ use the exit status of \fBsmartctl\fP (see EXIT STATUS below).
.Sp
.I noserial
\- Do not print the serial number of the device.
This also suppresses the LU WWN Device Id (ATA) and the SAS addresses (SCSI).
The related fields are also invalidated in the ATA and NVMe debug outputs.
.br
Note: This is not the case in SCSI debug output.
.br
[NEW EXPERIMENTAL SMARTCTL FEATURE]
The Namespace IEEE EUI-64 (NVMe) is also suppressed.
.TP
.B \-d TYPE, \-\-device=TYPE
Specifies the type of the device.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment