summaryrefslogtreecommitdiffstats
path: root/plugins/solidigm/solidigm-util.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 11:11:05 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 11:11:05 +0000
commit81d6a5ded50a26338e1b36462b3e0a6e45beb9a6 (patch)
tree364371981040c3dc6e97bb289bda0d33933ebfac /plugins/solidigm/solidigm-util.c
parentAdding upstream version 2.8. (diff)
downloadnvme-cli-81d6a5ded50a26338e1b36462b3e0a6e45beb9a6.tar.xz
nvme-cli-81d6a5ded50a26338e1b36462b3e0a6e45beb9a6.zip
Adding upstream version 2.9.1.upstream/2.9.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'plugins/solidigm/solidigm-util.c')
-rw-r--r--plugins/solidigm/solidigm-util.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/plugins/solidigm/solidigm-util.c b/plugins/solidigm/solidigm-util.c
index 0171a49..05d1537 100644
--- a/plugins/solidigm/solidigm-util.c
+++ b/plugins/solidigm/solidigm-util.c
@@ -1,20 +1,39 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) 2023 Solidigm.
+ * Copyright (c) 2023-2024 Solidigm.
*
* Author: leonardo.da.cunha@solidigm.com
*/
-#include "plugins/ocp/ocp-utils.h"
+#include <errno.h>
#include "solidigm-util.h"
-__u8 solidigm_get_vu_uuid_index(struct nvme_dev *dev)
+const unsigned char solidigm_uuid[NVME_UUID_LEN] = {
+ 0x96, 0x19, 0x58, 0x6e, 0xc1, 0x1b, 0x43, 0xad,
+ 0xaa, 0xaa, 0x65, 0x41, 0x87, 0xf6, 0xbb, 0xb2
+};
+
+int sldgm_find_uuid_index(struct nvme_id_uuid_list *uuid_list, __u8 *index)
{
- int ocp_uuid_index = 0;
+ int i = nvme_uuid_find(uuid_list, solidigm_uuid);
- if (ocp_get_uuid_index(dev, &ocp_uuid_index) == 0)
- if (ocp_uuid_index == 2)
- return 1;
+ *index = 0;
+ if (i > 0)
+ *index = i;
+ else
+ return -errno;
return 0;
}
+
+int sldgm_get_uuid_index(struct nvme_dev *dev, __u8 *index)
+{
+ struct nvme_id_uuid_list uuid_list;
+ int err = nvme_identify_uuid(dev_fd(dev), &uuid_list);
+
+ *index = 0;
+ if (err)
+ return err;
+
+ return sldgm_find_uuid_index(&uuid_list, index);
+}