Skip to content

Commit 4f82fd2

Browse files
ikegami-tigaw
authored andcommitted
ocp: set UUID index to get extended smart log
The index is required by the OCP specification. Signed-off-by: Tokunori Ikegami <[email protected]>
1 parent 457d182 commit 4f82fd2

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

plugins/ocp/ocp-smart-extended-log.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "common.h"
1515
#include "nvme-print.h"
1616
#include "ocp-print.h"
17+
#include "ocp-utils.h"
1718

1819
/* C0 SCAO Log Page */
1920
#define C0_SMART_CLOUD_ATTR_LEN 0x200
@@ -26,12 +27,20 @@ static __u8 scao_guid[GUID_LEN] = {
2627
0xC9, 0x14, 0xD5, 0xAF
2728
};
2829

29-
static int get_c0_log_page(int fd, char *format)
30+
static int get_c0_log_page(struct nvme_dev *dev, char *format)
3031
{
3132
nvme_print_flags_t fmt;
3233
__u8 *data;
3334
int i;
3435
int ret;
36+
int fd = dev_fd(dev);
37+
struct nvme_get_log_args args = {
38+
.args_size = sizeof(args),
39+
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
40+
.lid = C0_SMART_CLOUD_ATTR_OPCODE,
41+
.nsid = NVME_NSID_ALL,
42+
.len = C0_SMART_CLOUD_ATTR_LEN,
43+
};
3544

3645
ret = validate_output_format(format, &fmt);
3746
if (ret < 0) {
@@ -46,8 +55,9 @@ static int get_c0_log_page(int fd, char *format)
4655
}
4756
memset(data, 0, sizeof(__u8) * C0_SMART_CLOUD_ATTR_LEN);
4857

49-
ret = nvme_get_log_simple(fd, C0_SMART_CLOUD_ATTR_OPCODE,
50-
C0_SMART_CLOUD_ATTR_LEN, data);
58+
args.log = data;
59+
ocp_get_uuid_index(dev, &args.uuidx);
60+
ret = nvme_get_log_page(fd, NVME_LOG_PAGE_PDU_SIZE, &args);
5161

5262
if (strcmp(format, "json"))
5363
fprintf(stderr, "NVMe Status:%s(%x)\n",
@@ -110,7 +120,7 @@ int ocp_smart_add_log(int argc, char **argv, struct command *cmd,
110120
if (ret)
111121
return ret;
112122

113-
ret = get_c0_log_page(dev_fd(dev), cfg.output_format);
123+
ret = get_c0_log_page(dev, cfg.output_format);
114124
if (ret)
115125
fprintf(stderr, "ERROR : OCP : Failure reading the C0 Log Page, ret = %d\n",
116126
ret);

0 commit comments

Comments
 (0)