1
0
Fork 0

Merging upstream version 2.14.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-05-22 13:00:36 +02:00
parent 0d9181726f
commit f268303a51
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
572 changed files with 4636 additions and 1730 deletions

View file

@ -18,7 +18,9 @@
#include "libnvme.h"
#include "plugin.h"
#include "nvme-print.h"
#include "solidigm-util.h"
#define MARKET_LOG_LID 0xDD
#define MARKET_LOG_MAX_SIZE 512
int sldgm_get_market_log(int argc, char **argv, struct command *command,
@ -26,19 +28,15 @@ int sldgm_get_market_log(int argc, char **argv, struct command *command,
{
const char *desc = "Get Solidigm Marketing Name log and show it.";
const char *raw = "dump output in binary format";
struct nvme_dev *dev;
_cleanup_nvme_dev_ struct nvme_dev *dev = NULL;
char log[MARKET_LOG_MAX_SIZE];
int err;
struct config {
bool raw_binary;
};
struct config cfg = {
};
__u8 uuid_idx;
bool raw_binary = false;
OPT_ARGS(opts) = {
OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw),
OPT_FLAG("raw-binary", 'b', &raw_binary, raw),
OPT_INCR("verbose", 'v', &nvme_cfg.verbose, verbose),
OPT_END()
};
@ -46,17 +44,35 @@ int sldgm_get_market_log(int argc, char **argv, struct command *command,
if (err)
return err;
err = nvme_get_log_simple(dev_fd(dev), 0xdd, sizeof(log), log);
if (!err) {
if (!cfg.raw_binary)
printf("Solidigm Marketing Name Log:\n%s\n", log);
else
d_raw((unsigned char *)&log, sizeof(log));
} else if (err > 0)
sldgm_get_uuid_index(dev, &uuid_idx);
struct nvme_get_log_args args = {
.lpo = 0,
.result = NULL,
.log = log,
.args_size = sizeof(args),
.fd = dev_fd(dev),
.uuidx = uuid_idx,
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
.lid = MARKET_LOG_LID,
.len = sizeof(log),
.nsid = NVME_NSID_ALL,
.csi = NVME_CSI_NVM,
.lsi = NVME_LOG_LSI_NONE,
.lsp = NVME_LOG_LSP_NONE,
.rae = false,
.ot = false,
};
err = nvme_get_log(&args);
if (err) {
nvme_show_status(err);
return err;
}
if (!raw_binary)
printf("Solidigm Marketing Name Log:\n%s\n", log);
else
d_raw((unsigned char *)&log, sizeof(log));
nvme_show_status(err);
/* Redundant close() to make static code analysis happy */
close(dev->direct.fd);
dev_close(dev);
return err;
}