1
0
Fork 0

Adding upstream version 2.7.1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-16 12:25:41 +01:00
parent 04338f02fe
commit d6e1a5d456
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
663 changed files with 15529 additions and 6994 deletions

View file

@ -24,6 +24,9 @@
#include <string.h>
#include <unistd.h>
#include <time.h>
#include "nvme.h"
#include "libnvme.h"
#include "nvme-print.h"
#include "wdc-utils.h"
int wdc_UtilsSnprintf(char *buffer, unsigned int sizeOfBuffer, const char *format, ...)
@ -133,8 +136,8 @@ end:
/**
* Compares the strings ignoring their cases.
*
* @param pcSrc Points to a null terminated string for comapring.
* @param pcDst Points to a null terminated string for comapring.
* @param pcSrc Points to a null terminated string for comparing.
* @param pcDst Points to a null terminated string for comparing.
*
* @returns zero if the string matches or
* 1 if the pcSrc string is lexically higher than pcDst or
@ -162,3 +165,42 @@ void wdc_StrFormat(char *formatter, size_t fmt_sz, char *tofmt, size_t tofmtsz)
}
}
bool wdc_CheckUuidListSupport(struct nvme_dev *dev, struct nvme_id_uuid_list *uuid_list)
{
int err;
struct nvme_id_ctrl ctrl;
memset(&ctrl, 0, sizeof(struct nvme_id_ctrl));
err = nvme_identify_ctrl(dev_fd(dev), &ctrl);
if (err) {
fprintf(stderr, "ERROR: WDC: nvme_identify_ctrl() failed 0x%x\n", err);
return false;
}
if ((ctrl.ctratt & NVME_CTRL_CTRATT_UUID_LIST) == NVME_CTRL_CTRATT_UUID_LIST) {
err = nvme_identify_uuid(dev_fd(dev), uuid_list);
if (!err)
return true;
else if (err > 0)
nvme_show_status(err);
else
nvme_show_error("identify UUID list: %s", nvme_strerror(errno));
}
return false;
}
bool wdc_UuidEqual(struct nvme_id_uuid_list_entry *entry1, struct nvme_id_uuid_list_entry *entry2)
{
int i;
for (i = 0; i < 16; i++) {
if (entry1->uuid[i] != entry2->uuid[i])
break;
}
if (i == 16)
return true;
else
return false;
}