mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-28 14:44:10 +08:00
UUID/GUID updates:
- introduce the new uuid_t/guid_t types that are going to replace the somewhat confusing uuid_be/uuid_le types and make the terminology fit the various specs, as well as the userspace libuuid library. (me, based on a previous version from Amir) - consolidated generic uuid/guid helper functions lifted from XFS and libnvdimm (Amir and me) - conversions to the new types and helpers (Amir, Andy and me) -----BEGIN PGP SIGNATURE----- iQI/BAABCAApFiEEgdbnc3r/njty3Iq9D55TZVIEUYMFAllZfmILHGhjaEBsc3Qu ZGUACgkQD55TZVIEUYMvyg/9EvWHOOsSdeDykCK3KdH2uIqnxwpl+m7ljccaGJIc MmaH0KnsP9p/Cuw5hESh2tYlmCYN7pmYziNXpf/LRS65/HpEYbs4oMqo8UQsN0UM 2IXHfXY0HnCoG5OixH8RNbFTkxuGphsTY8meaiDr6aAmqChDQI2yGgQLo3WM2/Qe R9N1KoBWH/bqY6dHv+urlFwtsREm2fBH+8ovVma3TO73uZCzJGLJBWy3anmZN+08 uYfdbLSyRN0T8rqemVdzsZ2SrpHYkIsYGUZV43F581vp8e/3OKMoMxpWRRd9fEsa MXmoaHcLJoBsyVSFR9lcx3axKrhAgBPZljASbbA0h49JneWXrzghnKBQZG2SnEdA ktHQ2sE4Yb5TZSvvWEKMQa3kXhEfIbTwgvbHpcDr5BUZX8WvEw2Zq8e7+Mi4+KJw QkvFC1S96tRYO2bxdJX638uSesGUhSidb+hJ/edaOCB/GK+sLhUdDTJgwDpUGmyA xVXTF51ramRS2vhlbzN79x9g33igIoNnG4/PV0FPvpCTSqxkHmPc5mK6Vals1lqt cW6XfUjSQECq5nmTBtYDTbA/T+8HhBgSQnrrvmferjJzZUFGr/7MXl+Evz2x4CjX OBQoAMu241w6Vp3zoXqxzv+muZ/NLar52M/zbi9TUjE0GvvRNkHvgCC4NmpIlWYJ Sxg= =J/4P -----END PGP SIGNATURE----- Merge tag 'uuid-for-4.13' of git://git.infradead.org/users/hch/uuid Pull uuid subsystem from Christoph Hellwig: "This is the new uuid subsystem, in which Amir, Andy and I have started consolidating our uuid/guid helpers and improving the types used for them. Note that various other subsystems have pulled in this tree, so I'd like it to go in early. UUID/GUID summary: - introduce the new uuid_t/guid_t types that are going to replace the somewhat confusing uuid_be/uuid_le types and make the terminology fit the various specs, as well as the userspace libuuid library. (me, based on a previous version from Amir) - consolidated generic uuid/guid helper functions lifted from XFS and libnvdimm (Amir and me) - conversions to the new types and helpers (Amir, Andy and me)" * tag 'uuid-for-4.13' of git://git.infradead.org/users/hch/uuid: (34 commits) ACPI: hns_dsaf_acpi_dsm_guid can be static mmc: sdhci-pci: make guid intel_dsm_guid static uuid: Take const on input of uuid_is_null() and guid_is_null() thermal: int340x_thermal: fix compile after the UUID API switch thermal: int340x_thermal: Switch to use new generic UUID API acpi: always include uuid.h ACPI: Switch to use generic guid_t in acpi_evaluate_dsm() ACPI / extlog: Switch to use new generic UUID API ACPI / bus: Switch to use new generic UUID API ACPI / APEI: Switch to use new generic UUID API acpi, nfit: Switch to use new generic UUID API MAINTAINERS: add uuid entry tmpfs: generate random sb->s_uuid scsi_debug: switch to uuid_t nvme: switch to uuid_t sysctl: switch to use uuid_t partitions/ldm: switch to use uuid_t overlayfs: use uuid_t instead of uuid_be fs: switch ->s_uuid to uuid_t ima/policy: switch to use uuid_t ...
This commit is contained in:
commit
81e3e04489
11
MAINTAINERS
11
MAINTAINERS
@ -13462,6 +13462,17 @@ W: http://en.wikipedia.org/wiki/Util-linux
|
|||||||
T: git git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git
|
T: git git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git
|
||||||
S: Maintained
|
S: Maintained
|
||||||
|
|
||||||
|
UUID HELPERS
|
||||||
|
M: Christoph Hellwig <hch@lst.de>
|
||||||
|
R: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
|
||||||
|
L: linux-kernel@vger.kernel.org
|
||||||
|
T: git git://git.infradead.org/users/hch/uuid.git
|
||||||
|
F: lib/uuid.c
|
||||||
|
F: lib/test_uuid.c
|
||||||
|
F: include/linux/uuid.h
|
||||||
|
F: include/uapi/linux/uuid.h
|
||||||
|
S: Maintained
|
||||||
|
|
||||||
UVESAFB DRIVER
|
UVESAFB DRIVER
|
||||||
M: Michal Januszewski <spock@gentoo.org>
|
M: Michal Januszewski <spock@gentoo.org>
|
||||||
L: linux-fbdev@vger.kernel.org
|
L: linux-fbdev@vger.kernel.org
|
||||||
|
@ -109,7 +109,7 @@ struct sysinfo_2_2_2 {
|
|||||||
unsigned short cpus_shared;
|
unsigned short cpus_shared;
|
||||||
char reserved_4[3];
|
char reserved_4[3];
|
||||||
unsigned char vsne;
|
unsigned char vsne;
|
||||||
uuid_be uuid;
|
uuid_t uuid;
|
||||||
char reserved_5[160];
|
char reserved_5[160];
|
||||||
char ext_name[256];
|
char ext_name[256];
|
||||||
};
|
};
|
||||||
@ -134,7 +134,7 @@ struct sysinfo_3_2_2 {
|
|||||||
char reserved_1[3];
|
char reserved_1[3];
|
||||||
unsigned char evmne;
|
unsigned char evmne;
|
||||||
unsigned int reserved_2;
|
unsigned int reserved_2;
|
||||||
uuid_be uuid;
|
uuid_t uuid;
|
||||||
} vm[8];
|
} vm[8];
|
||||||
char reserved_3[1504];
|
char reserved_3[1504];
|
||||||
char ext_names[8][256];
|
char ext_names[8][256];
|
||||||
|
@ -242,7 +242,7 @@ static void print_ext_name(struct seq_file *m, int lvl,
|
|||||||
|
|
||||||
static void print_uuid(struct seq_file *m, int i, struct sysinfo_3_2_2 *info)
|
static void print_uuid(struct seq_file *m, int i, struct sysinfo_3_2_2 *info)
|
||||||
{
|
{
|
||||||
if (!memcmp(&info->vm[i].uuid, &NULL_UUID_BE, sizeof(uuid_be)))
|
if (uuid_is_null(&info->vm[i].uuid))
|
||||||
return;
|
return;
|
||||||
seq_printf(m, "VM%02d UUID: %pUb\n", i, &info->vm[i].uuid);
|
seq_printf(m, "VM%02d UUID: %pUb\n", i, &info->vm[i].uuid);
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ static bool ldm_parse_privhead(const u8 *data, struct privhead *ph)
|
|||||||
ldm_error("PRIVHEAD disk size doesn't match real disk size");
|
ldm_error("PRIVHEAD disk size doesn't match real disk size");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (uuid_be_to_bin(data + 0x0030, (uuid_be *)ph->disk_id)) {
|
if (uuid_parse(data + 0x0030, &ph->disk_id)) {
|
||||||
ldm_error("PRIVHEAD contains an invalid GUID.");
|
ldm_error("PRIVHEAD contains an invalid GUID.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -234,7 +234,7 @@ static bool ldm_compare_privheads (const struct privhead *ph1,
|
|||||||
(ph1->logical_disk_size == ph2->logical_disk_size) &&
|
(ph1->logical_disk_size == ph2->logical_disk_size) &&
|
||||||
(ph1->config_start == ph2->config_start) &&
|
(ph1->config_start == ph2->config_start) &&
|
||||||
(ph1->config_size == ph2->config_size) &&
|
(ph1->config_size == ph2->config_size) &&
|
||||||
!memcmp (ph1->disk_id, ph2->disk_id, GUID_SIZE));
|
uuid_equal(&ph1->disk_id, &ph2->disk_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -557,7 +557,7 @@ static struct vblk * ldm_get_disk_objid (const struct ldmdb *ldb)
|
|||||||
|
|
||||||
list_for_each (item, &ldb->v_disk) {
|
list_for_each (item, &ldb->v_disk) {
|
||||||
struct vblk *v = list_entry (item, struct vblk, list);
|
struct vblk *v = list_entry (item, struct vblk, list);
|
||||||
if (!memcmp (v->vblk.disk.disk_id, ldb->ph.disk_id, GUID_SIZE))
|
if (uuid_equal(&v->vblk.disk.disk_id, &ldb->ph.disk_id))
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -892,7 +892,7 @@ static bool ldm_parse_dsk3 (const u8 *buffer, int buflen, struct vblk *vb)
|
|||||||
disk = &vb->vblk.disk;
|
disk = &vb->vblk.disk;
|
||||||
ldm_get_vstr (buffer + 0x18 + r_diskid, disk->alt_name,
|
ldm_get_vstr (buffer + 0x18 + r_diskid, disk->alt_name,
|
||||||
sizeof (disk->alt_name));
|
sizeof (disk->alt_name));
|
||||||
if (uuid_be_to_bin(buffer + 0x19 + r_name, (uuid_be *)disk->disk_id))
|
if (uuid_parse(buffer + 0x19 + r_name, &disk->disk_id))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -927,7 +927,7 @@ static bool ldm_parse_dsk4 (const u8 *buffer, int buflen, struct vblk *vb)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
disk = &vb->vblk.disk;
|
disk = &vb->vblk.disk;
|
||||||
memcpy (disk->disk_id, buffer + 0x18 + r_name, GUID_SIZE);
|
uuid_copy(&disk->disk_id, (uuid_t *)(buffer + 0x18 + r_name));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,8 +112,6 @@ struct frag { /* VBLK Fragment handling */
|
|||||||
|
|
||||||
/* In memory LDM database structures. */
|
/* In memory LDM database structures. */
|
||||||
|
|
||||||
#define GUID_SIZE 16
|
|
||||||
|
|
||||||
struct privhead { /* Offsets and sizes are in sectors. */
|
struct privhead { /* Offsets and sizes are in sectors. */
|
||||||
u16 ver_major;
|
u16 ver_major;
|
||||||
u16 ver_minor;
|
u16 ver_minor;
|
||||||
@ -121,7 +119,7 @@ struct privhead { /* Offsets and sizes are in sectors. */
|
|||||||
u64 logical_disk_size;
|
u64 logical_disk_size;
|
||||||
u64 config_start;
|
u64 config_start;
|
||||||
u64 config_size;
|
u64 config_size;
|
||||||
u8 disk_id[GUID_SIZE];
|
uuid_t disk_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct tocblock { /* We have exactly two bitmaps. */
|
struct tocblock { /* We have exactly two bitmaps. */
|
||||||
@ -154,7 +152,7 @@ struct vblk_dgrp { /* VBLK Disk Group */
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct vblk_disk { /* VBLK Disk */
|
struct vblk_disk { /* VBLK Disk */
|
||||||
u8 disk_id[GUID_SIZE];
|
uuid_t disk_id;
|
||||||
u8 alt_name[128];
|
u8 alt_name[128];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -141,9 +141,9 @@ static int extlog_print(struct notifier_block *nb, unsigned long val,
|
|||||||
int cpu = mce->extcpu;
|
int cpu = mce->extcpu;
|
||||||
struct acpi_hest_generic_status *estatus, *tmp;
|
struct acpi_hest_generic_status *estatus, *tmp;
|
||||||
struct acpi_hest_generic_data *gdata;
|
struct acpi_hest_generic_data *gdata;
|
||||||
const uuid_le *fru_id = &NULL_UUID_LE;
|
const guid_t *fru_id = &guid_null;
|
||||||
char *fru_text = "";
|
char *fru_text = "";
|
||||||
uuid_le *sec_type;
|
guid_t *sec_type;
|
||||||
static u32 err_seq;
|
static u32 err_seq;
|
||||||
|
|
||||||
estatus = extlog_elog_entry_check(cpu, bank);
|
estatus = extlog_elog_entry_check(cpu, bank);
|
||||||
@ -165,11 +165,11 @@ static int extlog_print(struct notifier_block *nb, unsigned long val,
|
|||||||
err_seq++;
|
err_seq++;
|
||||||
gdata = (struct acpi_hest_generic_data *)(tmp + 1);
|
gdata = (struct acpi_hest_generic_data *)(tmp + 1);
|
||||||
if (gdata->validation_bits & CPER_SEC_VALID_FRU_ID)
|
if (gdata->validation_bits & CPER_SEC_VALID_FRU_ID)
|
||||||
fru_id = (uuid_le *)gdata->fru_id;
|
fru_id = (guid_t *)gdata->fru_id;
|
||||||
if (gdata->validation_bits & CPER_SEC_VALID_FRU_TEXT)
|
if (gdata->validation_bits & CPER_SEC_VALID_FRU_TEXT)
|
||||||
fru_text = gdata->fru_text;
|
fru_text = gdata->fru_text;
|
||||||
sec_type = (uuid_le *)gdata->section_type;
|
sec_type = (guid_t *)gdata->section_type;
|
||||||
if (!uuid_le_cmp(*sec_type, CPER_SEC_PLATFORM_MEM)) {
|
if (guid_equal(sec_type, &CPER_SEC_PLATFORM_MEM)) {
|
||||||
struct cper_sec_mem_err *mem = (void *)(gdata + 1);
|
struct cper_sec_mem_err *mem = (void *)(gdata + 1);
|
||||||
if (gdata->error_data_length >= sizeof(*mem))
|
if (gdata->error_data_length >= sizeof(*mem))
|
||||||
trace_extlog_mem_event(mem, err_seq, fru_id, fru_text,
|
trace_extlog_mem_event(mem, err_seq, fru_id, fru_text,
|
||||||
@ -182,17 +182,17 @@ out:
|
|||||||
|
|
||||||
static bool __init extlog_get_l1addr(void)
|
static bool __init extlog_get_l1addr(void)
|
||||||
{
|
{
|
||||||
u8 uuid[16];
|
guid_t guid;
|
||||||
acpi_handle handle;
|
acpi_handle handle;
|
||||||
union acpi_object *obj;
|
union acpi_object *obj;
|
||||||
|
|
||||||
acpi_str_to_uuid(extlog_dsm_uuid, uuid);
|
if (guid_parse(extlog_dsm_uuid, &guid))
|
||||||
|
return false;
|
||||||
if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle)))
|
if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle)))
|
||||||
return false;
|
return false;
|
||||||
if (!acpi_check_dsm(handle, uuid, EXTLOG_DSM_REV, 1 << EXTLOG_FN_ADDR))
|
if (!acpi_check_dsm(handle, &guid, EXTLOG_DSM_REV, 1 << EXTLOG_FN_ADDR))
|
||||||
return false;
|
return false;
|
||||||
obj = acpi_evaluate_dsm_typed(handle, uuid, EXTLOG_DSM_REV,
|
obj = acpi_evaluate_dsm_typed(handle, &guid, EXTLOG_DSM_REV,
|
||||||
EXTLOG_FN_ADDR, NULL, ACPI_TYPE_INTEGER);
|
EXTLOG_FN_ADDR, NULL, ACPI_TYPE_INTEGER);
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -431,12 +431,13 @@ static void ghes_do_proc(struct ghes *ghes,
|
|||||||
{
|
{
|
||||||
int sev, sec_sev;
|
int sev, sec_sev;
|
||||||
struct acpi_hest_generic_data *gdata;
|
struct acpi_hest_generic_data *gdata;
|
||||||
|
guid_t *sec_type;
|
||||||
|
|
||||||
sev = ghes_severity(estatus->error_severity);
|
sev = ghes_severity(estatus->error_severity);
|
||||||
apei_estatus_for_each_section(estatus, gdata) {
|
apei_estatus_for_each_section(estatus, gdata) {
|
||||||
|
sec_type = (guid_t *)gdata->section_type;
|
||||||
sec_sev = ghes_severity(gdata->error_severity);
|
sec_sev = ghes_severity(gdata->error_severity);
|
||||||
if (!uuid_le_cmp(*(uuid_le *)gdata->section_type,
|
if (guid_equal(sec_type, &CPER_SEC_PLATFORM_MEM)) {
|
||||||
CPER_SEC_PLATFORM_MEM)) {
|
|
||||||
struct cper_sec_mem_err *mem_err;
|
struct cper_sec_mem_err *mem_err;
|
||||||
mem_err = (struct cper_sec_mem_err *)(gdata+1);
|
mem_err = (struct cper_sec_mem_err *)(gdata+1);
|
||||||
ghes_edac_report_mem_error(ghes, sev, mem_err);
|
ghes_edac_report_mem_error(ghes, sev, mem_err);
|
||||||
@ -445,8 +446,7 @@ static void ghes_do_proc(struct ghes *ghes,
|
|||||||
ghes_handle_memory_failure(gdata, sev);
|
ghes_handle_memory_failure(gdata, sev);
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_ACPI_APEI_PCIEAER
|
#ifdef CONFIG_ACPI_APEI_PCIEAER
|
||||||
else if (!uuid_le_cmp(*(uuid_le *)gdata->section_type,
|
else if (guid_equal(sec_type, &CPER_SEC_PCIE)) {
|
||||||
CPER_SEC_PCIE)) {
|
|
||||||
struct cper_sec_pcie *pcie_err;
|
struct cper_sec_pcie *pcie_err;
|
||||||
pcie_err = (struct cper_sec_pcie *)(gdata+1);
|
pcie_err = (struct cper_sec_pcie *)(gdata+1);
|
||||||
if (sev == GHES_SEV_RECOVERABLE &&
|
if (sev == GHES_SEV_RECOVERABLE &&
|
||||||
|
@ -196,42 +196,19 @@ static void acpi_print_osc_error(acpi_handle handle,
|
|||||||
pr_debug("\n");
|
pr_debug("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
acpi_status acpi_str_to_uuid(char *str, u8 *uuid)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
static int opc_map_to_uuid[16] = {6, 4, 2, 0, 11, 9, 16, 14, 19, 21,
|
|
||||||
24, 26, 28, 30, 32, 34};
|
|
||||||
|
|
||||||
if (strlen(str) != 36)
|
|
||||||
return AE_BAD_PARAMETER;
|
|
||||||
for (i = 0; i < 36; i++) {
|
|
||||||
if (i == 8 || i == 13 || i == 18 || i == 23) {
|
|
||||||
if (str[i] != '-')
|
|
||||||
return AE_BAD_PARAMETER;
|
|
||||||
} else if (!isxdigit(str[i]))
|
|
||||||
return AE_BAD_PARAMETER;
|
|
||||||
}
|
|
||||||
for (i = 0; i < 16; i++) {
|
|
||||||
uuid[i] = hex_to_bin(str[opc_map_to_uuid[i]]) << 4;
|
|
||||||
uuid[i] |= hex_to_bin(str[opc_map_to_uuid[i] + 1]);
|
|
||||||
}
|
|
||||||
return AE_OK;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL_GPL(acpi_str_to_uuid);
|
|
||||||
|
|
||||||
acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context)
|
acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context)
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_object_list input;
|
struct acpi_object_list input;
|
||||||
union acpi_object in_params[4];
|
union acpi_object in_params[4];
|
||||||
union acpi_object *out_obj;
|
union acpi_object *out_obj;
|
||||||
u8 uuid[16];
|
guid_t guid;
|
||||||
u32 errors;
|
u32 errors;
|
||||||
struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
|
struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
|
||||||
|
|
||||||
if (!context)
|
if (!context)
|
||||||
return AE_ERROR;
|
return AE_ERROR;
|
||||||
if (ACPI_FAILURE(acpi_str_to_uuid(context->uuid_str, uuid)))
|
if (guid_parse(context->uuid_str, &guid))
|
||||||
return AE_ERROR;
|
return AE_ERROR;
|
||||||
context->ret.length = ACPI_ALLOCATE_BUFFER;
|
context->ret.length = ACPI_ALLOCATE_BUFFER;
|
||||||
context->ret.pointer = NULL;
|
context->ret.pointer = NULL;
|
||||||
@ -241,7 +218,7 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context)
|
|||||||
input.pointer = in_params;
|
input.pointer = in_params;
|
||||||
in_params[0].type = ACPI_TYPE_BUFFER;
|
in_params[0].type = ACPI_TYPE_BUFFER;
|
||||||
in_params[0].buffer.length = 16;
|
in_params[0].buffer.length = 16;
|
||||||
in_params[0].buffer.pointer = uuid;
|
in_params[0].buffer.pointer = (u8 *)&guid;
|
||||||
in_params[1].type = ACPI_TYPE_INTEGER;
|
in_params[1].type = ACPI_TYPE_INTEGER;
|
||||||
in_params[1].integer.value = context->rev;
|
in_params[1].integer.value = context->rev;
|
||||||
in_params[2].type = ACPI_TYPE_INTEGER;
|
in_params[2].type = ACPI_TYPE_INTEGER;
|
||||||
|
@ -74,11 +74,11 @@ struct nfit_table_prev {
|
|||||||
struct list_head flushes;
|
struct list_head flushes;
|
||||||
};
|
};
|
||||||
|
|
||||||
static u8 nfit_uuid[NFIT_UUID_MAX][16];
|
static guid_t nfit_uuid[NFIT_UUID_MAX];
|
||||||
|
|
||||||
const u8 *to_nfit_uuid(enum nfit_uuids id)
|
const guid_t *to_nfit_uuid(enum nfit_uuids id)
|
||||||
{
|
{
|
||||||
return nfit_uuid[id];
|
return &nfit_uuid[id];
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(to_nfit_uuid);
|
EXPORT_SYMBOL(to_nfit_uuid);
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
|
|||||||
u32 offset, fw_status = 0;
|
u32 offset, fw_status = 0;
|
||||||
acpi_handle handle;
|
acpi_handle handle;
|
||||||
unsigned int func;
|
unsigned int func;
|
||||||
const u8 *uuid;
|
const guid_t *guid;
|
||||||
int rc, i;
|
int rc, i;
|
||||||
|
|
||||||
func = cmd;
|
func = cmd;
|
||||||
@ -245,7 +245,7 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
|
|||||||
cmd_mask = nvdimm_cmd_mask(nvdimm);
|
cmd_mask = nvdimm_cmd_mask(nvdimm);
|
||||||
dsm_mask = nfit_mem->dsm_mask;
|
dsm_mask = nfit_mem->dsm_mask;
|
||||||
desc = nd_cmd_dimm_desc(cmd);
|
desc = nd_cmd_dimm_desc(cmd);
|
||||||
uuid = to_nfit_uuid(nfit_mem->family);
|
guid = to_nfit_uuid(nfit_mem->family);
|
||||||
handle = adev->handle;
|
handle = adev->handle;
|
||||||
} else {
|
} else {
|
||||||
struct acpi_device *adev = to_acpi_dev(acpi_desc);
|
struct acpi_device *adev = to_acpi_dev(acpi_desc);
|
||||||
@ -254,7 +254,7 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
|
|||||||
cmd_mask = nd_desc->cmd_mask;
|
cmd_mask = nd_desc->cmd_mask;
|
||||||
dsm_mask = cmd_mask;
|
dsm_mask = cmd_mask;
|
||||||
desc = nd_cmd_bus_desc(cmd);
|
desc = nd_cmd_bus_desc(cmd);
|
||||||
uuid = to_nfit_uuid(NFIT_DEV_BUS);
|
guid = to_nfit_uuid(NFIT_DEV_BUS);
|
||||||
handle = adev->handle;
|
handle = adev->handle;
|
||||||
dimm_name = "bus";
|
dimm_name = "bus";
|
||||||
}
|
}
|
||||||
@ -289,7 +289,7 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
|
|||||||
in_buf.buffer.pointer,
|
in_buf.buffer.pointer,
|
||||||
min_t(u32, 256, in_buf.buffer.length), true);
|
min_t(u32, 256, in_buf.buffer.length), true);
|
||||||
|
|
||||||
out_obj = acpi_evaluate_dsm(handle, uuid, 1, func, &in_obj);
|
out_obj = acpi_evaluate_dsm(handle, guid, 1, func, &in_obj);
|
||||||
if (!out_obj) {
|
if (!out_obj) {
|
||||||
dev_dbg(dev, "%s:%s _DSM failed cmd: %s\n", __func__, dimm_name,
|
dev_dbg(dev, "%s:%s _DSM failed cmd: %s\n", __func__, dimm_name,
|
||||||
cmd_name);
|
cmd_name);
|
||||||
@ -409,7 +409,7 @@ int nfit_spa_type(struct acpi_nfit_system_address *spa)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < NFIT_UUID_MAX; i++)
|
for (i = 0; i < NFIT_UUID_MAX; i++)
|
||||||
if (memcmp(to_nfit_uuid(i), spa->range_guid, 16) == 0)
|
if (guid_equal(to_nfit_uuid(i), (guid_t *)&spa->range_guid))
|
||||||
return i;
|
return i;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1415,7 +1415,7 @@ static int acpi_nfit_add_dimm(struct acpi_nfit_desc *acpi_desc,
|
|||||||
struct acpi_device *adev, *adev_dimm;
|
struct acpi_device *adev, *adev_dimm;
|
||||||
struct device *dev = acpi_desc->dev;
|
struct device *dev = acpi_desc->dev;
|
||||||
unsigned long dsm_mask;
|
unsigned long dsm_mask;
|
||||||
const u8 *uuid;
|
const guid_t *guid;
|
||||||
int i;
|
int i;
|
||||||
int family = -1;
|
int family = -1;
|
||||||
|
|
||||||
@ -1444,7 +1444,7 @@ static int acpi_nfit_add_dimm(struct acpi_nfit_desc *acpi_desc,
|
|||||||
/*
|
/*
|
||||||
* Until standardization materializes we need to consider 4
|
* Until standardization materializes we need to consider 4
|
||||||
* different command sets. Note, that checking for function0 (bit0)
|
* different command sets. Note, that checking for function0 (bit0)
|
||||||
* tells us if any commands are reachable through this uuid.
|
* tells us if any commands are reachable through this GUID.
|
||||||
*/
|
*/
|
||||||
for (i = NVDIMM_FAMILY_INTEL; i <= NVDIMM_FAMILY_MSFT; i++)
|
for (i = NVDIMM_FAMILY_INTEL; i <= NVDIMM_FAMILY_MSFT; i++)
|
||||||
if (acpi_check_dsm(adev_dimm->handle, to_nfit_uuid(i), 1, 1))
|
if (acpi_check_dsm(adev_dimm->handle, to_nfit_uuid(i), 1, 1))
|
||||||
@ -1474,9 +1474,9 @@ static int acpi_nfit_add_dimm(struct acpi_nfit_desc *acpi_desc,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uuid = to_nfit_uuid(nfit_mem->family);
|
guid = to_nfit_uuid(nfit_mem->family);
|
||||||
for_each_set_bit(i, &dsm_mask, BITS_PER_LONG)
|
for_each_set_bit(i, &dsm_mask, BITS_PER_LONG)
|
||||||
if (acpi_check_dsm(adev_dimm->handle, uuid, 1, 1ULL << i))
|
if (acpi_check_dsm(adev_dimm->handle, guid, 1, 1ULL << i))
|
||||||
set_bit(i, &nfit_mem->dsm_mask);
|
set_bit(i, &nfit_mem->dsm_mask);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -1611,7 +1611,7 @@ static int acpi_nfit_register_dimms(struct acpi_nfit_desc *acpi_desc)
|
|||||||
static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc)
|
static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc)
|
||||||
{
|
{
|
||||||
struct nvdimm_bus_descriptor *nd_desc = &acpi_desc->nd_desc;
|
struct nvdimm_bus_descriptor *nd_desc = &acpi_desc->nd_desc;
|
||||||
const u8 *uuid = to_nfit_uuid(NFIT_DEV_BUS);
|
const guid_t *guid = to_nfit_uuid(NFIT_DEV_BUS);
|
||||||
struct acpi_device *adev;
|
struct acpi_device *adev;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -1621,7 +1621,7 @@ static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = ND_CMD_ARS_CAP; i <= ND_CMD_CLEAR_ERROR; i++)
|
for (i = ND_CMD_ARS_CAP; i <= ND_CMD_CLEAR_ERROR; i++)
|
||||||
if (acpi_check_dsm(adev->handle, uuid, 1, 1ULL << i))
|
if (acpi_check_dsm(adev->handle, guid, 1, 1ULL << i))
|
||||||
set_bit(i, &nd_desc->cmd_mask);
|
set_bit(i, &nd_desc->cmd_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3051,19 +3051,19 @@ static __init int nfit_init(void)
|
|||||||
BUILD_BUG_ON(sizeof(struct acpi_nfit_control_region) != 80);
|
BUILD_BUG_ON(sizeof(struct acpi_nfit_control_region) != 80);
|
||||||
BUILD_BUG_ON(sizeof(struct acpi_nfit_data_region) != 40);
|
BUILD_BUG_ON(sizeof(struct acpi_nfit_data_region) != 40);
|
||||||
|
|
||||||
acpi_str_to_uuid(UUID_VOLATILE_MEMORY, nfit_uuid[NFIT_SPA_VOLATILE]);
|
guid_parse(UUID_VOLATILE_MEMORY, &nfit_uuid[NFIT_SPA_VOLATILE]);
|
||||||
acpi_str_to_uuid(UUID_PERSISTENT_MEMORY, nfit_uuid[NFIT_SPA_PM]);
|
guid_parse(UUID_PERSISTENT_MEMORY, &nfit_uuid[NFIT_SPA_PM]);
|
||||||
acpi_str_to_uuid(UUID_CONTROL_REGION, nfit_uuid[NFIT_SPA_DCR]);
|
guid_parse(UUID_CONTROL_REGION, &nfit_uuid[NFIT_SPA_DCR]);
|
||||||
acpi_str_to_uuid(UUID_DATA_REGION, nfit_uuid[NFIT_SPA_BDW]);
|
guid_parse(UUID_DATA_REGION, &nfit_uuid[NFIT_SPA_BDW]);
|
||||||
acpi_str_to_uuid(UUID_VOLATILE_VIRTUAL_DISK, nfit_uuid[NFIT_SPA_VDISK]);
|
guid_parse(UUID_VOLATILE_VIRTUAL_DISK, &nfit_uuid[NFIT_SPA_VDISK]);
|
||||||
acpi_str_to_uuid(UUID_VOLATILE_VIRTUAL_CD, nfit_uuid[NFIT_SPA_VCD]);
|
guid_parse(UUID_VOLATILE_VIRTUAL_CD, &nfit_uuid[NFIT_SPA_VCD]);
|
||||||
acpi_str_to_uuid(UUID_PERSISTENT_VIRTUAL_DISK, nfit_uuid[NFIT_SPA_PDISK]);
|
guid_parse(UUID_PERSISTENT_VIRTUAL_DISK, &nfit_uuid[NFIT_SPA_PDISK]);
|
||||||
acpi_str_to_uuid(UUID_PERSISTENT_VIRTUAL_CD, nfit_uuid[NFIT_SPA_PCD]);
|
guid_parse(UUID_PERSISTENT_VIRTUAL_CD, &nfit_uuid[NFIT_SPA_PCD]);
|
||||||
acpi_str_to_uuid(UUID_NFIT_BUS, nfit_uuid[NFIT_DEV_BUS]);
|
guid_parse(UUID_NFIT_BUS, &nfit_uuid[NFIT_DEV_BUS]);
|
||||||
acpi_str_to_uuid(UUID_NFIT_DIMM, nfit_uuid[NFIT_DEV_DIMM]);
|
guid_parse(UUID_NFIT_DIMM, &nfit_uuid[NFIT_DEV_DIMM]);
|
||||||
acpi_str_to_uuid(UUID_NFIT_DIMM_N_HPE1, nfit_uuid[NFIT_DEV_DIMM_N_HPE1]);
|
guid_parse(UUID_NFIT_DIMM_N_HPE1, &nfit_uuid[NFIT_DEV_DIMM_N_HPE1]);
|
||||||
acpi_str_to_uuid(UUID_NFIT_DIMM_N_HPE2, nfit_uuid[NFIT_DEV_DIMM_N_HPE2]);
|
guid_parse(UUID_NFIT_DIMM_N_HPE2, &nfit_uuid[NFIT_DEV_DIMM_N_HPE2]);
|
||||||
acpi_str_to_uuid(UUID_NFIT_DIMM_N_MSFT, nfit_uuid[NFIT_DEV_DIMM_N_MSFT]);
|
guid_parse(UUID_NFIT_DIMM_N_MSFT, &nfit_uuid[NFIT_DEV_DIMM_N_MSFT]);
|
||||||
|
|
||||||
nfit_wq = create_singlethread_workqueue("nfit");
|
nfit_wq = create_singlethread_workqueue("nfit");
|
||||||
if (!nfit_wq)
|
if (!nfit_wq)
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#include <linux/libnvdimm.h>
|
#include <linux/libnvdimm.h>
|
||||||
#include <linux/ndctl.h>
|
#include <linux/ndctl.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/uuid.h>
|
|
||||||
#include <linux/acpi.h>
|
#include <linux/acpi.h>
|
||||||
#include <acpi/acuuid.h>
|
#include <acpi/acuuid.h>
|
||||||
|
|
||||||
@ -237,7 +236,7 @@ static inline struct acpi_nfit_desc *to_acpi_desc(
|
|||||||
return container_of(nd_desc, struct acpi_nfit_desc, nd_desc);
|
return container_of(nd_desc, struct acpi_nfit_desc, nd_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8 *to_nfit_uuid(enum nfit_uuids id);
|
const guid_t *to_nfit_uuid(enum nfit_uuids id);
|
||||||
int acpi_nfit_init(struct acpi_nfit_desc *acpi_desc, void *nfit, acpi_size sz);
|
int acpi_nfit_init(struct acpi_nfit_desc *acpi_desc, void *nfit, acpi_size sz);
|
||||||
void acpi_nfit_shutdown(void *data);
|
void acpi_nfit_shutdown(void *data);
|
||||||
void __acpi_nfit_notify(struct device *dev, acpi_handle handle, u32 event);
|
void __acpi_nfit_notify(struct device *dev, acpi_handle handle, u32 event);
|
||||||
|
@ -613,19 +613,19 @@ acpi_status acpi_evaluate_lck(acpi_handle handle, int lock)
|
|||||||
/**
|
/**
|
||||||
* acpi_evaluate_dsm - evaluate device's _DSM method
|
* acpi_evaluate_dsm - evaluate device's _DSM method
|
||||||
* @handle: ACPI device handle
|
* @handle: ACPI device handle
|
||||||
* @uuid: UUID of requested functions, should be 16 bytes
|
* @guid: GUID of requested functions, should be 16 bytes
|
||||||
* @rev: revision number of requested function
|
* @rev: revision number of requested function
|
||||||
* @func: requested function number
|
* @func: requested function number
|
||||||
* @argv4: the function specific parameter
|
* @argv4: the function specific parameter
|
||||||
*
|
*
|
||||||
* Evaluate device's _DSM method with specified UUID, revision id and
|
* Evaluate device's _DSM method with specified GUID, revision id and
|
||||||
* function number. Caller needs to free the returned object.
|
* function number. Caller needs to free the returned object.
|
||||||
*
|
*
|
||||||
* Though ACPI defines the fourth parameter for _DSM should be a package,
|
* Though ACPI defines the fourth parameter for _DSM should be a package,
|
||||||
* some old BIOSes do expect a buffer or an integer etc.
|
* some old BIOSes do expect a buffer or an integer etc.
|
||||||
*/
|
*/
|
||||||
union acpi_object *
|
union acpi_object *
|
||||||
acpi_evaluate_dsm(acpi_handle handle, const u8 *uuid, u64 rev, u64 func,
|
acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 func,
|
||||||
union acpi_object *argv4)
|
union acpi_object *argv4)
|
||||||
{
|
{
|
||||||
acpi_status ret;
|
acpi_status ret;
|
||||||
@ -638,7 +638,7 @@ acpi_evaluate_dsm(acpi_handle handle, const u8 *uuid, u64 rev, u64 func,
|
|||||||
|
|
||||||
params[0].type = ACPI_TYPE_BUFFER;
|
params[0].type = ACPI_TYPE_BUFFER;
|
||||||
params[0].buffer.length = 16;
|
params[0].buffer.length = 16;
|
||||||
params[0].buffer.pointer = (char *)uuid;
|
params[0].buffer.pointer = (u8 *)guid;
|
||||||
params[1].type = ACPI_TYPE_INTEGER;
|
params[1].type = ACPI_TYPE_INTEGER;
|
||||||
params[1].integer.value = rev;
|
params[1].integer.value = rev;
|
||||||
params[2].type = ACPI_TYPE_INTEGER;
|
params[2].type = ACPI_TYPE_INTEGER;
|
||||||
@ -666,7 +666,7 @@ EXPORT_SYMBOL(acpi_evaluate_dsm);
|
|||||||
/**
|
/**
|
||||||
* acpi_check_dsm - check if _DSM method supports requested functions.
|
* acpi_check_dsm - check if _DSM method supports requested functions.
|
||||||
* @handle: ACPI device handle
|
* @handle: ACPI device handle
|
||||||
* @uuid: UUID of requested functions, should be 16 bytes at least
|
* @guid: GUID of requested functions, should be 16 bytes at least
|
||||||
* @rev: revision number of requested functions
|
* @rev: revision number of requested functions
|
||||||
* @funcs: bitmap of requested functions
|
* @funcs: bitmap of requested functions
|
||||||
*
|
*
|
||||||
@ -674,7 +674,7 @@ EXPORT_SYMBOL(acpi_evaluate_dsm);
|
|||||||
* functions. Currently only support 64 functions at maximum, should be
|
* functions. Currently only support 64 functions at maximum, should be
|
||||||
* enough for now.
|
* enough for now.
|
||||||
*/
|
*/
|
||||||
bool acpi_check_dsm(acpi_handle handle, const u8 *uuid, u64 rev, u64 funcs)
|
bool acpi_check_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 funcs)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
u64 mask = 0;
|
u64 mask = 0;
|
||||||
@ -683,7 +683,7 @@ bool acpi_check_dsm(acpi_handle handle, const u8 *uuid, u64 rev, u64 funcs)
|
|||||||
if (funcs == 0)
|
if (funcs == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
obj = acpi_evaluate_dsm(handle, uuid, rev, 0, NULL);
|
obj = acpi_evaluate_dsm(handle, guid, rev, 0, NULL);
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -697,7 +697,7 @@ bool acpi_check_dsm(acpi_handle handle, const u8 *uuid, u64 rev, u64 funcs)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Bit 0 indicates whether there's support for any functions other than
|
* Bit 0 indicates whether there's support for any functions other than
|
||||||
* function 0 for the specified UUID and revision.
|
* function 0 for the specified GUID and revision.
|
||||||
*/
|
*/
|
||||||
if ((mask & 0x1) && (mask & funcs) == funcs)
|
if ((mask & 0x1) && (mask & funcs) == funcs)
|
||||||
return true;
|
return true;
|
||||||
|
@ -27,10 +27,9 @@
|
|||||||
|
|
||||||
#define ACPI_SIG_TPM2 "TPM2"
|
#define ACPI_SIG_TPM2 "TPM2"
|
||||||
|
|
||||||
static const u8 CRB_ACPI_START_UUID[] = {
|
static const guid_t crb_acpi_start_guid =
|
||||||
/* 0000 */ 0xAB, 0x6C, 0xBF, 0x6B, 0x63, 0x54, 0x14, 0x47,
|
GUID_INIT(0x6BBF6CAB, 0x5463, 0x4714,
|
||||||
/* 0008 */ 0xB7, 0xCD, 0xF0, 0x20, 0x3C, 0x03, 0x68, 0xD4
|
0xB7, 0xCD, 0xF0, 0x20, 0x3C, 0x03, 0x68, 0xD4);
|
||||||
};
|
|
||||||
|
|
||||||
enum crb_defaults {
|
enum crb_defaults {
|
||||||
CRB_ACPI_START_REVISION_ID = 1,
|
CRB_ACPI_START_REVISION_ID = 1,
|
||||||
@ -266,7 +265,7 @@ static int crb_do_acpi_start(struct tpm_chip *chip)
|
|||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
obj = acpi_evaluate_dsm(chip->acpi_dev_handle,
|
obj = acpi_evaluate_dsm(chip->acpi_dev_handle,
|
||||||
CRB_ACPI_START_UUID,
|
&crb_acpi_start_guid,
|
||||||
CRB_ACPI_START_REVISION_ID,
|
CRB_ACPI_START_REVISION_ID,
|
||||||
CRB_ACPI_START_INDEX,
|
CRB_ACPI_START_INDEX,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -32,20 +32,16 @@
|
|||||||
#define PPI_VS_REQ_START 128
|
#define PPI_VS_REQ_START 128
|
||||||
#define PPI_VS_REQ_END 255
|
#define PPI_VS_REQ_END 255
|
||||||
|
|
||||||
static const u8 tpm_ppi_uuid[] = {
|
static const guid_t tpm_ppi_guid =
|
||||||
0xA6, 0xFA, 0xDD, 0x3D,
|
GUID_INIT(0x3DDDFAA6, 0x361B, 0x4EB4,
|
||||||
0x1B, 0x36,
|
0xA4, 0x24, 0x8D, 0x10, 0x08, 0x9D, 0x16, 0x53);
|
||||||
0xB4, 0x4E,
|
|
||||||
0xA4, 0x24,
|
|
||||||
0x8D, 0x10, 0x08, 0x9D, 0x16, 0x53
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline union acpi_object *
|
static inline union acpi_object *
|
||||||
tpm_eval_dsm(acpi_handle ppi_handle, int func, acpi_object_type type,
|
tpm_eval_dsm(acpi_handle ppi_handle, int func, acpi_object_type type,
|
||||||
union acpi_object *argv4)
|
union acpi_object *argv4)
|
||||||
{
|
{
|
||||||
BUG_ON(!ppi_handle);
|
BUG_ON(!ppi_handle);
|
||||||
return acpi_evaluate_dsm_typed(ppi_handle, tpm_ppi_uuid,
|
return acpi_evaluate_dsm_typed(ppi_handle, &tpm_ppi_guid,
|
||||||
TPM_PPI_REVISION_ID,
|
TPM_PPI_REVISION_ID,
|
||||||
func, argv4, type);
|
func, argv4, type);
|
||||||
}
|
}
|
||||||
@ -107,7 +103,7 @@ static ssize_t tpm_store_ppi_request(struct device *dev,
|
|||||||
* is updated with function index from SUBREQ to SUBREQ2 since PPI
|
* is updated with function index from SUBREQ to SUBREQ2 since PPI
|
||||||
* version 1.1
|
* version 1.1
|
||||||
*/
|
*/
|
||||||
if (acpi_check_dsm(chip->acpi_dev_handle, tpm_ppi_uuid,
|
if (acpi_check_dsm(chip->acpi_dev_handle, &tpm_ppi_guid,
|
||||||
TPM_PPI_REVISION_ID, 1 << TPM_PPI_FN_SUBREQ2))
|
TPM_PPI_REVISION_ID, 1 << TPM_PPI_FN_SUBREQ2))
|
||||||
func = TPM_PPI_FN_SUBREQ2;
|
func = TPM_PPI_FN_SUBREQ2;
|
||||||
|
|
||||||
@ -268,7 +264,7 @@ static ssize_t show_ppi_operations(acpi_handle dev_handle, char *buf, u32 start,
|
|||||||
"User not required",
|
"User not required",
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!acpi_check_dsm(dev_handle, tpm_ppi_uuid, TPM_PPI_REVISION_ID,
|
if (!acpi_check_dsm(dev_handle, &tpm_ppi_guid, TPM_PPI_REVISION_ID,
|
||||||
1 << TPM_PPI_FN_GETOPR))
|
1 << TPM_PPI_FN_GETOPR))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
@ -341,12 +337,12 @@ void tpm_add_ppi(struct tpm_chip *chip)
|
|||||||
if (!chip->acpi_dev_handle)
|
if (!chip->acpi_dev_handle)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!acpi_check_dsm(chip->acpi_dev_handle, tpm_ppi_uuid,
|
if (!acpi_check_dsm(chip->acpi_dev_handle, &tpm_ppi_guid,
|
||||||
TPM_PPI_REVISION_ID, 1 << TPM_PPI_FN_VERSION))
|
TPM_PPI_REVISION_ID, 1 << TPM_PPI_FN_VERSION))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Cache PPI version string. */
|
/* Cache PPI version string. */
|
||||||
obj = acpi_evaluate_dsm_typed(chip->acpi_dev_handle, tpm_ppi_uuid,
|
obj = acpi_evaluate_dsm_typed(chip->acpi_dev_handle, &tpm_ppi_guid,
|
||||||
TPM_PPI_REVISION_ID, TPM_PPI_FN_VERSION,
|
TPM_PPI_REVISION_ID, TPM_PPI_FN_VERSION,
|
||||||
NULL, ACPI_TYPE_STRING);
|
NULL, ACPI_TYPE_STRING);
|
||||||
if (obj) {
|
if (obj) {
|
||||||
|
@ -15,13 +15,9 @@ static struct intel_dsm_priv {
|
|||||||
acpi_handle dhandle;
|
acpi_handle dhandle;
|
||||||
} intel_dsm_priv;
|
} intel_dsm_priv;
|
||||||
|
|
||||||
static const u8 intel_dsm_guid[] = {
|
static const guid_t intel_dsm_guid =
|
||||||
0xd3, 0x73, 0xd8, 0x7e,
|
GUID_INIT(0x7ed873d3, 0xc2d0, 0x4e4f,
|
||||||
0xd0, 0xc2,
|
0xa8, 0x54, 0x0f, 0x13, 0x17, 0xb0, 0x1c, 0x2c);
|
||||||
0x4f, 0x4e,
|
|
||||||
0xa8, 0x54,
|
|
||||||
0x0f, 0x13, 0x17, 0xb0, 0x1c, 0x2c
|
|
||||||
};
|
|
||||||
|
|
||||||
static char *intel_dsm_port_name(u8 id)
|
static char *intel_dsm_port_name(u8 id)
|
||||||
{
|
{
|
||||||
@ -80,7 +76,7 @@ static void intel_dsm_platform_mux_info(void)
|
|||||||
int i;
|
int i;
|
||||||
union acpi_object *pkg, *connector_count;
|
union acpi_object *pkg, *connector_count;
|
||||||
|
|
||||||
pkg = acpi_evaluate_dsm_typed(intel_dsm_priv.dhandle, intel_dsm_guid,
|
pkg = acpi_evaluate_dsm_typed(intel_dsm_priv.dhandle, &intel_dsm_guid,
|
||||||
INTEL_DSM_REVISION_ID, INTEL_DSM_FN_PLATFORM_MUX_INFO,
|
INTEL_DSM_REVISION_ID, INTEL_DSM_FN_PLATFORM_MUX_INFO,
|
||||||
NULL, ACPI_TYPE_PACKAGE);
|
NULL, ACPI_TYPE_PACKAGE);
|
||||||
if (!pkg) {
|
if (!pkg) {
|
||||||
@ -118,7 +114,7 @@ static bool intel_dsm_pci_probe(struct pci_dev *pdev)
|
|||||||
if (!dhandle)
|
if (!dhandle)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!acpi_check_dsm(dhandle, intel_dsm_guid, INTEL_DSM_REVISION_ID,
|
if (!acpi_check_dsm(dhandle, &intel_dsm_guid, INTEL_DSM_REVISION_ID,
|
||||||
1 << INTEL_DSM_FN_PLATFORM_MUX_INFO)) {
|
1 << INTEL_DSM_FN_PLATFORM_MUX_INFO)) {
|
||||||
DRM_DEBUG_KMS("no _DSM method for intel device\n");
|
DRM_DEBUG_KMS("no _DSM method for intel device\n");
|
||||||
return false;
|
return false;
|
||||||
|
@ -60,15 +60,13 @@ bool nouveau_is_v1_dsm(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_VGA_SWITCHEROO
|
#ifdef CONFIG_VGA_SWITCHEROO
|
||||||
static const char nouveau_dsm_muid[] = {
|
static const guid_t nouveau_dsm_muid =
|
||||||
0xA0, 0xA0, 0x95, 0x9D, 0x60, 0x00, 0x48, 0x4D,
|
GUID_INIT(0x9D95A0A0, 0x0060, 0x4D48,
|
||||||
0xB3, 0x4D, 0x7E, 0x5F, 0xEA, 0x12, 0x9F, 0xD4,
|
0xB3, 0x4D, 0x7E, 0x5F, 0xEA, 0x12, 0x9F, 0xD4);
|
||||||
};
|
|
||||||
|
|
||||||
static const char nouveau_op_dsm_muid[] = {
|
static const guid_t nouveau_op_dsm_muid =
|
||||||
0xF8, 0xD8, 0x86, 0xA4, 0xDA, 0x0B, 0x1B, 0x47,
|
GUID_INIT(0xA486D8F8, 0x0BDA, 0x471B,
|
||||||
0xA7, 0x2B, 0x60, 0x42, 0xA6, 0xB5, 0xBE, 0xE0,
|
0xA7, 0x2B, 0x60, 0x42, 0xA6, 0xB5, 0xBE, 0xE0);
|
||||||
};
|
|
||||||
|
|
||||||
static int nouveau_optimus_dsm(acpi_handle handle, int func, int arg, uint32_t *result)
|
static int nouveau_optimus_dsm(acpi_handle handle, int func, int arg, uint32_t *result)
|
||||||
{
|
{
|
||||||
@ -86,7 +84,7 @@ static int nouveau_optimus_dsm(acpi_handle handle, int func, int arg, uint32_t *
|
|||||||
args_buff[i] = (arg >> i * 8) & 0xFF;
|
args_buff[i] = (arg >> i * 8) & 0xFF;
|
||||||
|
|
||||||
*result = 0;
|
*result = 0;
|
||||||
obj = acpi_evaluate_dsm_typed(handle, nouveau_op_dsm_muid, 0x00000100,
|
obj = acpi_evaluate_dsm_typed(handle, &nouveau_op_dsm_muid, 0x00000100,
|
||||||
func, &argv4, ACPI_TYPE_BUFFER);
|
func, &argv4, ACPI_TYPE_BUFFER);
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
acpi_handle_info(handle, "failed to evaluate _DSM\n");
|
acpi_handle_info(handle, "failed to evaluate _DSM\n");
|
||||||
@ -138,7 +136,7 @@ static int nouveau_dsm(acpi_handle handle, int func, int arg)
|
|||||||
.integer.value = arg,
|
.integer.value = arg,
|
||||||
};
|
};
|
||||||
|
|
||||||
obj = acpi_evaluate_dsm_typed(handle, nouveau_dsm_muid, 0x00000102,
|
obj = acpi_evaluate_dsm_typed(handle, &nouveau_dsm_muid, 0x00000102,
|
||||||
func, &argv4, ACPI_TYPE_INTEGER);
|
func, &argv4, ACPI_TYPE_INTEGER);
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
acpi_handle_info(handle, "failed to evaluate _DSM\n");
|
acpi_handle_info(handle, "failed to evaluate _DSM\n");
|
||||||
@ -259,7 +257,7 @@ static void nouveau_dsm_pci_probe(struct pci_dev *pdev, acpi_handle *dhandle_out
|
|||||||
if (!acpi_has_method(dhandle, "_DSM"))
|
if (!acpi_has_method(dhandle, "_DSM"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
supports_mux = acpi_check_dsm(dhandle, nouveau_dsm_muid, 0x00000102,
|
supports_mux = acpi_check_dsm(dhandle, &nouveau_dsm_muid, 0x00000102,
|
||||||
1 << NOUVEAU_DSM_POWER);
|
1 << NOUVEAU_DSM_POWER);
|
||||||
optimus_funcs = nouveau_dsm_get_optimus_functions(dhandle);
|
optimus_funcs = nouveau_dsm_get_optimus_functions(dhandle);
|
||||||
|
|
||||||
|
@ -81,10 +81,9 @@ mxm_shadow_dsm(struct nvkm_mxm *mxm, u8 version)
|
|||||||
{
|
{
|
||||||
struct nvkm_subdev *subdev = &mxm->subdev;
|
struct nvkm_subdev *subdev = &mxm->subdev;
|
||||||
struct nvkm_device *device = subdev->device;
|
struct nvkm_device *device = subdev->device;
|
||||||
static char muid[] = {
|
static guid_t muid =
|
||||||
0x00, 0xA4, 0x04, 0x40, 0x7D, 0x91, 0xF2, 0x4C,
|
GUID_INIT(0x4004A400, 0x917D, 0x4CF2,
|
||||||
0xB8, 0x9C, 0x79, 0xB6, 0x2F, 0xD5, 0x56, 0x65
|
0xB8, 0x9C, 0x79, 0xB6, 0x2F, 0xD5, 0x56, 0x65);
|
||||||
};
|
|
||||||
u32 mxms_args[] = { 0x00000000 };
|
u32 mxms_args[] = { 0x00000000 };
|
||||||
union acpi_object argv4 = {
|
union acpi_object argv4 = {
|
||||||
.buffer.type = ACPI_TYPE_BUFFER,
|
.buffer.type = ACPI_TYPE_BUFFER,
|
||||||
@ -105,7 +104,7 @@ mxm_shadow_dsm(struct nvkm_mxm *mxm, u8 version)
|
|||||||
* unless you pass in exactly the version it supports..
|
* unless you pass in exactly the version it supports..
|
||||||
*/
|
*/
|
||||||
rev = (version & 0xf0) << 4 | (version & 0x0f);
|
rev = (version & 0xf0) << 4 | (version & 0x0f);
|
||||||
obj = acpi_evaluate_dsm(handle, muid, rev, 0x00000010, &argv4);
|
obj = acpi_evaluate_dsm(handle, &muid, rev, 0x00000010, &argv4);
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
nvkm_debug(subdev, "DSM MXMS failed\n");
|
nvkm_debug(subdev, "DSM MXMS failed\n");
|
||||||
return false;
|
return false;
|
||||||
|
@ -872,10 +872,9 @@ static int i2c_hid_fetch_hid_descriptor(struct i2c_hid *ihid)
|
|||||||
static int i2c_hid_acpi_pdata(struct i2c_client *client,
|
static int i2c_hid_acpi_pdata(struct i2c_client *client,
|
||||||
struct i2c_hid_platform_data *pdata)
|
struct i2c_hid_platform_data *pdata)
|
||||||
{
|
{
|
||||||
static u8 i2c_hid_guid[] = {
|
static guid_t i2c_hid_guid =
|
||||||
0xF7, 0xF6, 0xDF, 0x3C, 0x67, 0x42, 0x55, 0x45,
|
GUID_INIT(0x3CDFF6F7, 0x4267, 0x4555,
|
||||||
0xAD, 0x05, 0xB3, 0x0A, 0x3D, 0x89, 0x38, 0xDE,
|
0xAD, 0x05, 0xB3, 0x0A, 0x3D, 0x89, 0x38, 0xDE);
|
||||||
};
|
|
||||||
union acpi_object *obj;
|
union acpi_object *obj;
|
||||||
struct acpi_device *adev;
|
struct acpi_device *adev;
|
||||||
acpi_handle handle;
|
acpi_handle handle;
|
||||||
@ -884,7 +883,7 @@ static int i2c_hid_acpi_pdata(struct i2c_client *client,
|
|||||||
if (!handle || acpi_bus_get_device(handle, &adev))
|
if (!handle || acpi_bus_get_device(handle, &adev))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
obj = acpi_evaluate_dsm_typed(handle, i2c_hid_guid, 1, 1, NULL,
|
obj = acpi_evaluate_dsm_typed(handle, &i2c_hid_guid, 1, 1, NULL,
|
||||||
ACPI_TYPE_INTEGER);
|
ACPI_TYPE_INTEGER);
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
dev_err(&client->dev, "device _DSM execution failed\n");
|
dev_err(&client->dev, "device _DSM execution failed\n");
|
||||||
|
@ -1808,10 +1808,9 @@ IOMMU_INIT_POST(detect_intel_iommu);
|
|||||||
* for Directed-IO Architecture Specifiction, Rev 2.2, Section 8.8
|
* for Directed-IO Architecture Specifiction, Rev 2.2, Section 8.8
|
||||||
* "Remapping Hardware Unit Hot Plug".
|
* "Remapping Hardware Unit Hot Plug".
|
||||||
*/
|
*/
|
||||||
static u8 dmar_hp_uuid[] = {
|
static guid_t dmar_hp_guid =
|
||||||
/* 0000 */ 0xA6, 0xA3, 0xC1, 0xD8, 0x9B, 0xBE, 0x9B, 0x4C,
|
GUID_INIT(0xD8C1A3A6, 0xBE9B, 0x4C9B,
|
||||||
/* 0008 */ 0x91, 0xBF, 0xC3, 0xCB, 0x81, 0xFC, 0x5D, 0xAF
|
0x91, 0xBF, 0xC3, 0xCB, 0x81, 0xFC, 0x5D, 0xAF);
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Currently there's only one revision and BIOS will not check the revision id,
|
* Currently there's only one revision and BIOS will not check the revision id,
|
||||||
@ -1824,7 +1823,7 @@ static u8 dmar_hp_uuid[] = {
|
|||||||
|
|
||||||
static inline bool dmar_detect_dsm(acpi_handle handle, int func)
|
static inline bool dmar_detect_dsm(acpi_handle handle, int func)
|
||||||
{
|
{
|
||||||
return acpi_check_dsm(handle, dmar_hp_uuid, DMAR_DSM_REV_ID, 1 << func);
|
return acpi_check_dsm(handle, &dmar_hp_guid, DMAR_DSM_REV_ID, 1 << func);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dmar_walk_dsm_resource(acpi_handle handle, int func,
|
static int dmar_walk_dsm_resource(acpi_handle handle, int func,
|
||||||
@ -1843,7 +1842,7 @@ static int dmar_walk_dsm_resource(acpi_handle handle, int func,
|
|||||||
if (!dmar_detect_dsm(handle, func))
|
if (!dmar_detect_dsm(handle, func))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
obj = acpi_evaluate_dsm_typed(handle, dmar_hp_uuid, DMAR_DSM_REV_ID,
|
obj = acpi_evaluate_dsm_typed(handle, &dmar_hp_guid, DMAR_DSM_REV_ID,
|
||||||
func, NULL, ACPI_TYPE_BUFFER);
|
func, NULL, ACPI_TYPE_BUFFER);
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
@ -825,7 +825,7 @@ fail:
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int uuid_equal(mdp_super_t *sb1, mdp_super_t *sb2)
|
static int md_uuid_equal(mdp_super_t *sb1, mdp_super_t *sb2)
|
||||||
{
|
{
|
||||||
return sb1->set_uuid0 == sb2->set_uuid0 &&
|
return sb1->set_uuid0 == sb2->set_uuid0 &&
|
||||||
sb1->set_uuid1 == sb2->set_uuid1 &&
|
sb1->set_uuid1 == sb2->set_uuid1 &&
|
||||||
@ -833,7 +833,7 @@ static int uuid_equal(mdp_super_t *sb1, mdp_super_t *sb2)
|
|||||||
sb1->set_uuid3 == sb2->set_uuid3;
|
sb1->set_uuid3 == sb2->set_uuid3;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sb_equal(mdp_super_t *sb1, mdp_super_t *sb2)
|
static int md_sb_equal(mdp_super_t *sb1, mdp_super_t *sb2)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
mdp_super_t *tmp1, *tmp2;
|
mdp_super_t *tmp1, *tmp2;
|
||||||
@ -1025,12 +1025,12 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor
|
|||||||
} else {
|
} else {
|
||||||
__u64 ev1, ev2;
|
__u64 ev1, ev2;
|
||||||
mdp_super_t *refsb = page_address(refdev->sb_page);
|
mdp_super_t *refsb = page_address(refdev->sb_page);
|
||||||
if (!uuid_equal(refsb, sb)) {
|
if (!md_uuid_equal(refsb, sb)) {
|
||||||
pr_warn("md: %s has different UUID to %s\n",
|
pr_warn("md: %s has different UUID to %s\n",
|
||||||
b, bdevname(refdev->bdev,b2));
|
b, bdevname(refdev->bdev,b2));
|
||||||
goto abort;
|
goto abort;
|
||||||
}
|
}
|
||||||
if (!sb_equal(refsb, sb)) {
|
if (!md_sb_equal(refsb, sb)) {
|
||||||
pr_warn("md: %s has same UUID but different superblock to %s\n",
|
pr_warn("md: %s has same UUID but different superblock to %s\n",
|
||||||
b, bdevname(refdev->bdev, b2));
|
b, bdevname(refdev->bdev, b2));
|
||||||
goto abort;
|
goto abort;
|
||||||
|
@ -404,10 +404,9 @@ struct intel_host {
|
|||||||
bool d3_retune;
|
bool d3_retune;
|
||||||
};
|
};
|
||||||
|
|
||||||
const u8 intel_dsm_uuid[] = {
|
static const guid_t intel_dsm_guid =
|
||||||
0xA5, 0x3E, 0xC1, 0xF6, 0xCD, 0x65, 0x1F, 0x46,
|
GUID_INIT(0xF6C13EA5, 0x65CD, 0x461F,
|
||||||
0xAB, 0x7A, 0x29, 0xF7, 0xE8, 0xD5, 0xBD, 0x61,
|
0xAB, 0x7A, 0x29, 0xF7, 0xE8, 0xD5, 0xBD, 0x61);
|
||||||
};
|
|
||||||
|
|
||||||
static int __intel_dsm(struct intel_host *intel_host, struct device *dev,
|
static int __intel_dsm(struct intel_host *intel_host, struct device *dev,
|
||||||
unsigned int fn, u32 *result)
|
unsigned int fn, u32 *result)
|
||||||
@ -416,7 +415,7 @@ static int __intel_dsm(struct intel_host *intel_host, struct device *dev,
|
|||||||
int err = 0;
|
int err = 0;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
obj = acpi_evaluate_dsm(ACPI_HANDLE(dev), intel_dsm_uuid, 0, fn, NULL);
|
obj = acpi_evaluate_dsm(ACPI_HANDLE(dev), &intel_dsm_guid, 0, fn, NULL);
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
|
@ -29,10 +29,9 @@ enum _dsm_rst_type {
|
|||||||
HNS_ROCE_RESET_FUNC = 0x7,
|
HNS_ROCE_RESET_FUNC = 0x7,
|
||||||
};
|
};
|
||||||
|
|
||||||
const u8 hns_dsaf_acpi_dsm_uuid[] = {
|
static const guid_t hns_dsaf_acpi_dsm_guid =
|
||||||
0x1A, 0xAA, 0x85, 0x1A, 0x93, 0xE2, 0x5E, 0x41,
|
GUID_INIT(0x1A85AA1A, 0xE293, 0x415E,
|
||||||
0x8E, 0x28, 0x8D, 0x69, 0x0A, 0x0F, 0x82, 0x0A
|
0x8E, 0x28, 0x8D, 0x69, 0x0A, 0x0F, 0x82, 0x0A);
|
||||||
};
|
|
||||||
|
|
||||||
static void dsaf_write_sub(struct dsaf_device *dsaf_dev, u32 reg, u32 val)
|
static void dsaf_write_sub(struct dsaf_device *dsaf_dev, u32 reg, u32 val)
|
||||||
{
|
{
|
||||||
@ -151,7 +150,7 @@ static void hns_dsaf_acpi_srst_by_port(struct dsaf_device *dsaf_dev, u8 op_type,
|
|||||||
argv4.package.elements = obj_args;
|
argv4.package.elements = obj_args;
|
||||||
|
|
||||||
obj = acpi_evaluate_dsm(ACPI_HANDLE(dsaf_dev->dev),
|
obj = acpi_evaluate_dsm(ACPI_HANDLE(dsaf_dev->dev),
|
||||||
hns_dsaf_acpi_dsm_uuid, 0, op_type, &argv4);
|
&hns_dsaf_acpi_dsm_guid, 0, op_type, &argv4);
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
dev_warn(dsaf_dev->dev, "reset port_type%d port%d fail!",
|
dev_warn(dsaf_dev->dev, "reset port_type%d port%d fail!",
|
||||||
port_type, port);
|
port_type, port);
|
||||||
@ -434,7 +433,7 @@ static phy_interface_t hns_mac_get_phy_if_acpi(struct hns_mac_cb *mac_cb)
|
|||||||
argv4.package.elements = &obj_args,
|
argv4.package.elements = &obj_args,
|
||||||
|
|
||||||
obj = acpi_evaluate_dsm(ACPI_HANDLE(mac_cb->dev),
|
obj = acpi_evaluate_dsm(ACPI_HANDLE(mac_cb->dev),
|
||||||
hns_dsaf_acpi_dsm_uuid, 0,
|
&hns_dsaf_acpi_dsm_guid, 0,
|
||||||
HNS_OP_GET_PORT_TYPE_FUNC, &argv4);
|
HNS_OP_GET_PORT_TYPE_FUNC, &argv4);
|
||||||
|
|
||||||
if (!obj || obj->type != ACPI_TYPE_INTEGER)
|
if (!obj || obj->type != ACPI_TYPE_INTEGER)
|
||||||
@ -474,7 +473,7 @@ int hns_mac_get_sfp_prsnt_acpi(struct hns_mac_cb *mac_cb, int *sfp_prsnt)
|
|||||||
argv4.package.elements = &obj_args,
|
argv4.package.elements = &obj_args,
|
||||||
|
|
||||||
obj = acpi_evaluate_dsm(ACPI_HANDLE(mac_cb->dev),
|
obj = acpi_evaluate_dsm(ACPI_HANDLE(mac_cb->dev),
|
||||||
hns_dsaf_acpi_dsm_uuid, 0,
|
&hns_dsaf_acpi_dsm_guid, 0,
|
||||||
HNS_OP_GET_SFP_STAT_FUNC, &argv4);
|
HNS_OP_GET_SFP_STAT_FUNC, &argv4);
|
||||||
|
|
||||||
if (!obj || obj->type != ACPI_TYPE_INTEGER)
|
if (!obj || obj->type != ACPI_TYPE_INTEGER)
|
||||||
@ -565,7 +564,7 @@ hns_mac_config_sds_loopback_acpi(struct hns_mac_cb *mac_cb, bool en)
|
|||||||
argv4.package.elements = obj_args;
|
argv4.package.elements = obj_args;
|
||||||
|
|
||||||
obj = acpi_evaluate_dsm(ACPI_HANDLE(mac_cb->dsaf_dev->dev),
|
obj = acpi_evaluate_dsm(ACPI_HANDLE(mac_cb->dsaf_dev->dev),
|
||||||
hns_dsaf_acpi_dsm_uuid, 0,
|
&hns_dsaf_acpi_dsm_guid, 0,
|
||||||
HNS_OP_SERDES_LP_FUNC, &argv4);
|
HNS_OP_SERDES_LP_FUNC, &argv4);
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
dev_warn(mac_cb->dsaf_dev->dev, "set port%d serdes lp fail!",
|
dev_warn(mac_cb->dsaf_dev->dev, "set port%d serdes lp fail!",
|
||||||
|
@ -222,13 +222,6 @@ struct device *nd_btt_create(struct nd_region *nd_region)
|
|||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool uuid_is_null(u8 *uuid)
|
|
||||||
{
|
|
||||||
static const u8 null_uuid[16];
|
|
||||||
|
|
||||||
return (memcmp(uuid, null_uuid, 16) == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nd_btt_arena_is_valid - check if the metadata layout is valid
|
* nd_btt_arena_is_valid - check if the metadata layout is valid
|
||||||
* @nd_btt: device with BTT geometry and backing device info
|
* @nd_btt: device with BTT geometry and backing device info
|
||||||
@ -249,7 +242,7 @@ bool nd_btt_arena_is_valid(struct nd_btt *nd_btt, struct btt_sb *super)
|
|||||||
if (memcmp(super->signature, BTT_SIG, BTT_SIG_LEN) != 0)
|
if (memcmp(super->signature, BTT_SIG, BTT_SIG_LEN) != 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!uuid_is_null(super->parent_uuid))
|
if (!guid_is_null((guid_t *)&super->parent_uuid))
|
||||||
if (memcmp(super->parent_uuid, parent_uuid, 16) != 0)
|
if (memcmp(super->parent_uuid, parent_uuid, 16) != 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ static struct nvmf_host *nvmf_host_add(const char *hostnqn)
|
|||||||
|
|
||||||
kref_init(&host->ref);
|
kref_init(&host->ref);
|
||||||
memcpy(host->nqn, hostnqn, NVMF_NQN_SIZE);
|
memcpy(host->nqn, hostnqn, NVMF_NQN_SIZE);
|
||||||
uuid_be_gen(&host->id);
|
uuid_gen(&host->id);
|
||||||
|
|
||||||
list_add_tail(&host->list, &nvmf_hosts);
|
list_add_tail(&host->list, &nvmf_hosts);
|
||||||
out_unlock:
|
out_unlock:
|
||||||
@ -75,7 +75,7 @@ static struct nvmf_host *nvmf_host_default(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
kref_init(&host->ref);
|
kref_init(&host->ref);
|
||||||
uuid_be_gen(&host->id);
|
uuid_gen(&host->id);
|
||||||
snprintf(host->nqn, NVMF_NQN_SIZE,
|
snprintf(host->nqn, NVMF_NQN_SIZE,
|
||||||
"nqn.2014-08.org.nvmexpress:NVMf:uuid:%pUb", &host->id);
|
"nqn.2014-08.org.nvmexpress:NVMf:uuid:%pUb", &host->id);
|
||||||
|
|
||||||
@ -395,7 +395,7 @@ int nvmf_connect_admin_queue(struct nvme_ctrl *ctrl)
|
|||||||
if (!data)
|
if (!data)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
memcpy(&data->hostid, &ctrl->opts->host->id, sizeof(uuid_be));
|
uuid_copy(&data->hostid, &ctrl->opts->host->id);
|
||||||
data->cntlid = cpu_to_le16(0xffff);
|
data->cntlid = cpu_to_le16(0xffff);
|
||||||
strncpy(data->subsysnqn, ctrl->opts->subsysnqn, NVMF_NQN_SIZE);
|
strncpy(data->subsysnqn, ctrl->opts->subsysnqn, NVMF_NQN_SIZE);
|
||||||
strncpy(data->hostnqn, ctrl->opts->host->nqn, NVMF_NQN_SIZE);
|
strncpy(data->hostnqn, ctrl->opts->host->nqn, NVMF_NQN_SIZE);
|
||||||
@ -454,7 +454,7 @@ int nvmf_connect_io_queue(struct nvme_ctrl *ctrl, u16 qid)
|
|||||||
if (!data)
|
if (!data)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
memcpy(&data->hostid, &ctrl->opts->host->id, sizeof(uuid_be));
|
uuid_copy(&data->hostid, &ctrl->opts->host->id);
|
||||||
data->cntlid = cpu_to_le16(ctrl->cntlid);
|
data->cntlid = cpu_to_le16(ctrl->cntlid);
|
||||||
strncpy(data->subsysnqn, ctrl->opts->subsysnqn, NVMF_NQN_SIZE);
|
strncpy(data->subsysnqn, ctrl->opts->subsysnqn, NVMF_NQN_SIZE);
|
||||||
strncpy(data->hostnqn, ctrl->opts->host->nqn, NVMF_NQN_SIZE);
|
strncpy(data->hostnqn, ctrl->opts->host->nqn, NVMF_NQN_SIZE);
|
||||||
|
@ -36,7 +36,7 @@ struct nvmf_host {
|
|||||||
struct kref ref;
|
struct kref ref;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
char nqn[NVMF_NQN_SIZE];
|
char nqn[NVMF_NQN_SIZE];
|
||||||
uuid_be id;
|
uuid_t id;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -878,8 +878,7 @@ nvme_fc_connect_admin_queue(struct nvme_fc_ctrl *ctrl,
|
|||||||
assoc_rqst->assoc_cmd.sqsize = cpu_to_be16(qsize);
|
assoc_rqst->assoc_cmd.sqsize = cpu_to_be16(qsize);
|
||||||
/* Linux supports only Dynamic controllers */
|
/* Linux supports only Dynamic controllers */
|
||||||
assoc_rqst->assoc_cmd.cntlid = cpu_to_be16(0xffff);
|
assoc_rqst->assoc_cmd.cntlid = cpu_to_be16(0xffff);
|
||||||
memcpy(&assoc_rqst->assoc_cmd.hostid, &ctrl->ctrl.opts->host->id,
|
uuid_copy(&assoc_rqst->assoc_cmd.hostid, &ctrl->ctrl.opts->host->id);
|
||||||
min_t(size_t, FCNVME_ASSOC_HOSTID_LEN, sizeof(uuid_be)));
|
|
||||||
strncpy(assoc_rqst->assoc_cmd.hostnqn, ctrl->ctrl.opts->host->nqn,
|
strncpy(assoc_rqst->assoc_cmd.hostnqn, ctrl->ctrl.opts->host->nqn,
|
||||||
min(FCNVME_ASSOC_HOSTNQN_LEN, NVMF_NQN_SIZE));
|
min(FCNVME_ASSOC_HOSTNQN_LEN, NVMF_NQN_SIZE));
|
||||||
strncpy(assoc_rqst->assoc_cmd.subnqn, ctrl->ctrl.opts->subsysnqn,
|
strncpy(assoc_rqst->assoc_cmd.subnqn, ctrl->ctrl.opts->subsysnqn,
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <linux/percpu-refcount.h>
|
#include <linux/percpu-refcount.h>
|
||||||
#include <linux/list.h>
|
#include <linux/list.h>
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
|
#include <linux/uuid.h>
|
||||||
#include <linux/nvme.h>
|
#include <linux/nvme.h>
|
||||||
#include <linux/configfs.h>
|
#include <linux/configfs.h>
|
||||||
#include <linux/rcupdate.h>
|
#include <linux/rcupdate.h>
|
||||||
|
@ -21,13 +21,12 @@
|
|||||||
#include "pci.h"
|
#include "pci.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The UUID is defined in the PCI Firmware Specification available here:
|
* The GUID is defined in the PCI Firmware Specification available here:
|
||||||
* https://www.pcisig.com/members/downloads/pcifw_r3_1_13Dec10.pdf
|
* https://www.pcisig.com/members/downloads/pcifw_r3_1_13Dec10.pdf
|
||||||
*/
|
*/
|
||||||
const u8 pci_acpi_dsm_uuid[] = {
|
const guid_t pci_acpi_dsm_guid =
|
||||||
0xd0, 0x37, 0xc9, 0xe5, 0x53, 0x35, 0x7a, 0x4d,
|
GUID_INIT(0xe5c937d0, 0x3553, 0x4d7a,
|
||||||
0x91, 0x17, 0xea, 0x4d, 0x19, 0xc3, 0x43, 0x4d
|
0x91, 0x17, 0xea, 0x4d, 0x19, 0xc3, 0x43, 0x4d);
|
||||||
};
|
|
||||||
|
|
||||||
#if defined(CONFIG_PCI_QUIRKS) && defined(CONFIG_ARM64)
|
#if defined(CONFIG_PCI_QUIRKS) && defined(CONFIG_ARM64)
|
||||||
static int acpi_get_rc_addr(struct acpi_device *adev, struct resource *res)
|
static int acpi_get_rc_addr(struct acpi_device *adev, struct resource *res)
|
||||||
@ -680,7 +679,7 @@ void acpi_pci_add_bus(struct pci_bus *bus)
|
|||||||
if (!pci_is_root_bus(bus))
|
if (!pci_is_root_bus(bus))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
obj = acpi_evaluate_dsm(ACPI_HANDLE(bus->bridge), pci_acpi_dsm_uuid, 3,
|
obj = acpi_evaluate_dsm(ACPI_HANDLE(bus->bridge), &pci_acpi_dsm_guid, 3,
|
||||||
RESET_DELAY_DSM, NULL);
|
RESET_DELAY_DSM, NULL);
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return;
|
return;
|
||||||
@ -745,7 +744,7 @@ static void pci_acpi_optimize_delay(struct pci_dev *pdev,
|
|||||||
if (bridge->ignore_reset_delay)
|
if (bridge->ignore_reset_delay)
|
||||||
pdev->d3cold_delay = 0;
|
pdev->d3cold_delay = 0;
|
||||||
|
|
||||||
obj = acpi_evaluate_dsm(handle, pci_acpi_dsm_uuid, 3,
|
obj = acpi_evaluate_dsm(handle, &pci_acpi_dsm_guid, 3,
|
||||||
FUNCTION_DELAY_DSM, NULL);
|
FUNCTION_DELAY_DSM, NULL);
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return;
|
return;
|
||||||
|
@ -172,7 +172,7 @@ static int dsm_get_label(struct device *dev, char *buf,
|
|||||||
if (!handle)
|
if (!handle)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
obj = acpi_evaluate_dsm(handle, pci_acpi_dsm_uuid, 0x2,
|
obj = acpi_evaluate_dsm(handle, &pci_acpi_dsm_guid, 0x2,
|
||||||
DEVICE_LABEL_DSM, NULL);
|
DEVICE_LABEL_DSM, NULL);
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return -1;
|
return -1;
|
||||||
@ -212,7 +212,7 @@ static bool device_has_dsm(struct device *dev)
|
|||||||
if (!handle)
|
if (!handle)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return !!acpi_check_dsm(handle, pci_acpi_dsm_uuid, 0x2,
|
return !!acpi_check_dsm(handle, &pci_acpi_dsm_guid, 0x2,
|
||||||
1 << DEVICE_LABEL_DSM);
|
1 << DEVICE_LABEL_DSM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ struct sdebug_dev_info {
|
|||||||
unsigned int channel;
|
unsigned int channel;
|
||||||
unsigned int target;
|
unsigned int target;
|
||||||
u64 lun;
|
u64 lun;
|
||||||
uuid_be lu_name;
|
uuid_t lu_name;
|
||||||
struct sdebug_host_info *sdbg_host;
|
struct sdebug_host_info *sdbg_host;
|
||||||
unsigned long uas_bm[1];
|
unsigned long uas_bm[1];
|
||||||
atomic_t num_in_q;
|
atomic_t num_in_q;
|
||||||
@ -965,7 +965,7 @@ static const u64 naa3_comp_c = 0x3111111000000000ULL;
|
|||||||
static int inquiry_vpd_83(unsigned char *arr, int port_group_id,
|
static int inquiry_vpd_83(unsigned char *arr, int port_group_id,
|
||||||
int target_dev_id, int dev_id_num,
|
int target_dev_id, int dev_id_num,
|
||||||
const char *dev_id_str, int dev_id_str_len,
|
const char *dev_id_str, int dev_id_str_len,
|
||||||
const uuid_be *lu_name)
|
const uuid_t *lu_name)
|
||||||
{
|
{
|
||||||
int num, port_a;
|
int num, port_a;
|
||||||
char b[32];
|
char b[32];
|
||||||
@ -3568,7 +3568,7 @@ static void sdebug_q_cmd_wq_complete(struct work_struct *work)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool got_shared_uuid;
|
static bool got_shared_uuid;
|
||||||
static uuid_be shared_uuid;
|
static uuid_t shared_uuid;
|
||||||
|
|
||||||
static struct sdebug_dev_info *sdebug_device_create(
|
static struct sdebug_dev_info *sdebug_device_create(
|
||||||
struct sdebug_host_info *sdbg_host, gfp_t flags)
|
struct sdebug_host_info *sdbg_host, gfp_t flags)
|
||||||
@ -3578,12 +3578,12 @@ static struct sdebug_dev_info *sdebug_device_create(
|
|||||||
devip = kzalloc(sizeof(*devip), flags);
|
devip = kzalloc(sizeof(*devip), flags);
|
||||||
if (devip) {
|
if (devip) {
|
||||||
if (sdebug_uuid_ctl == 1)
|
if (sdebug_uuid_ctl == 1)
|
||||||
uuid_be_gen(&devip->lu_name);
|
uuid_gen(&devip->lu_name);
|
||||||
else if (sdebug_uuid_ctl == 2) {
|
else if (sdebug_uuid_ctl == 2) {
|
||||||
if (got_shared_uuid)
|
if (got_shared_uuid)
|
||||||
devip->lu_name = shared_uuid;
|
devip->lu_name = shared_uuid;
|
||||||
else {
|
else {
|
||||||
uuid_be_gen(&shared_uuid);
|
uuid_gen(&shared_uuid);
|
||||||
got_shared_uuid = true;
|
got_shared_uuid = true;
|
||||||
devip->lu_name = shared_uuid;
|
devip->lu_name = shared_uuid;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ enum int3400_thermal_uuid {
|
|||||||
INT3400_THERMAL_MAXIMUM_UUID,
|
INT3400_THERMAL_MAXIMUM_UUID,
|
||||||
};
|
};
|
||||||
|
|
||||||
static u8 *int3400_thermal_uuids[INT3400_THERMAL_MAXIMUM_UUID] = {
|
static char *int3400_thermal_uuids[INT3400_THERMAL_MAXIMUM_UUID] = {
|
||||||
"42A441D6-AE6A-462b-A84B-4A8CE79027D3",
|
"42A441D6-AE6A-462b-A84B-4A8CE79027D3",
|
||||||
"3A95C389-E4B8-4629-A526-C52C88626BAE",
|
"3A95C389-E4B8-4629-A526-C52C88626BAE",
|
||||||
"97C68AE7-15FA-499c-B8C9-5DA81D606E0A",
|
"97C68AE7-15FA-499c-B8C9-5DA81D606E0A",
|
||||||
@ -141,10 +141,10 @@ static int int3400_thermal_get_uuids(struct int3400_thermal_priv *priv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0; j < INT3400_THERMAL_MAXIMUM_UUID; j++) {
|
for (j = 0; j < INT3400_THERMAL_MAXIMUM_UUID; j++) {
|
||||||
u8 uuid[16];
|
guid_t guid;
|
||||||
|
|
||||||
acpi_str_to_uuid(int3400_thermal_uuids[j], uuid);
|
guid_parse(int3400_thermal_uuids[j], &guid);
|
||||||
if (!strncmp(uuid, objb->buffer.pointer, 16)) {
|
if (guid_equal((guid_t *)objb->buffer.pointer, &guid)) {
|
||||||
priv->uuid_bitmap |= (1 << j);
|
priv->uuid_bitmap |= (1 << j);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
#define PCI_DEVICE_ID_INTEL_CNPLP 0x9dee
|
#define PCI_DEVICE_ID_INTEL_CNPLP 0x9dee
|
||||||
#define PCI_DEVICE_ID_INTEL_CNPH 0xa36e
|
#define PCI_DEVICE_ID_INTEL_CNPH 0xa36e
|
||||||
|
|
||||||
#define PCI_INTEL_BXT_DSM_UUID "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511"
|
#define PCI_INTEL_BXT_DSM_GUID "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511"
|
||||||
#define PCI_INTEL_BXT_FUNC_PMU_PWR 4
|
#define PCI_INTEL_BXT_FUNC_PMU_PWR 4
|
||||||
#define PCI_INTEL_BXT_STATE_D0 0
|
#define PCI_INTEL_BXT_STATE_D0 0
|
||||||
#define PCI_INTEL_BXT_STATE_D3 3
|
#define PCI_INTEL_BXT_STATE_D3 3
|
||||||
@ -51,14 +51,14 @@
|
|||||||
* struct dwc3_pci - Driver private structure
|
* struct dwc3_pci - Driver private structure
|
||||||
* @dwc3: child dwc3 platform_device
|
* @dwc3: child dwc3 platform_device
|
||||||
* @pci: our link to PCI bus
|
* @pci: our link to PCI bus
|
||||||
* @uuid: _DSM UUID
|
* @guid: _DSM GUID
|
||||||
* @has_dsm_for_pm: true for devices which need to run _DSM on runtime PM
|
* @has_dsm_for_pm: true for devices which need to run _DSM on runtime PM
|
||||||
*/
|
*/
|
||||||
struct dwc3_pci {
|
struct dwc3_pci {
|
||||||
struct platform_device *dwc3;
|
struct platform_device *dwc3;
|
||||||
struct pci_dev *pci;
|
struct pci_dev *pci;
|
||||||
|
|
||||||
u8 uuid[16];
|
guid_t guid;
|
||||||
|
|
||||||
unsigned int has_dsm_for_pm:1;
|
unsigned int has_dsm_for_pm:1;
|
||||||
};
|
};
|
||||||
@ -120,7 +120,7 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc)
|
|||||||
|
|
||||||
if (pdev->device == PCI_DEVICE_ID_INTEL_BXT ||
|
if (pdev->device == PCI_DEVICE_ID_INTEL_BXT ||
|
||||||
pdev->device == PCI_DEVICE_ID_INTEL_BXT_M) {
|
pdev->device == PCI_DEVICE_ID_INTEL_BXT_M) {
|
||||||
acpi_str_to_uuid(PCI_INTEL_BXT_DSM_UUID, dwc->uuid);
|
guid_parse(PCI_INTEL_BXT_DSM_GUID, &dwc->guid);
|
||||||
dwc->has_dsm_for_pm = true;
|
dwc->has_dsm_for_pm = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,7 +292,7 @@ static int dwc3_pci_dsm(struct dwc3_pci *dwc, int param)
|
|||||||
tmp.type = ACPI_TYPE_INTEGER;
|
tmp.type = ACPI_TYPE_INTEGER;
|
||||||
tmp.integer.value = param;
|
tmp.integer.value = param;
|
||||||
|
|
||||||
obj = acpi_evaluate_dsm(ACPI_HANDLE(&dwc->pci->dev), dwc->uuid,
|
obj = acpi_evaluate_dsm(ACPI_HANDLE(&dwc->pci->dev), &dwc->guid,
|
||||||
1, PCI_INTEL_BXT_FUNC_PMU_PWR, &argv4);
|
1, PCI_INTEL_BXT_FUNC_PMU_PWR, &argv4);
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
dev_err(&dwc->pci->dev, "failed to evaluate _DSM\n");
|
dev_err(&dwc->pci->dev, "failed to evaluate _DSM\n");
|
||||||
|
@ -216,13 +216,12 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
|
|||||||
#ifdef CONFIG_ACPI
|
#ifdef CONFIG_ACPI
|
||||||
static void xhci_pme_acpi_rtd3_enable(struct pci_dev *dev)
|
static void xhci_pme_acpi_rtd3_enable(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
static const u8 intel_dsm_uuid[] = {
|
static const guid_t intel_dsm_guid =
|
||||||
0xb7, 0x0c, 0x34, 0xac, 0x01, 0xe9, 0xbf, 0x45,
|
GUID_INIT(0xac340cb7, 0xe901, 0x45bf,
|
||||||
0xb7, 0xe6, 0x2b, 0x34, 0xec, 0x93, 0x1e, 0x23,
|
0xb7, 0xe6, 0x2b, 0x34, 0xec, 0x93, 0x1e, 0x23);
|
||||||
};
|
|
||||||
union acpi_object *obj;
|
union acpi_object *obj;
|
||||||
|
|
||||||
obj = acpi_evaluate_dsm(ACPI_HANDLE(&dev->dev), intel_dsm_uuid, 3, 1,
|
obj = acpi_evaluate_dsm(ACPI_HANDLE(&dev->dev), &intel_dsm_guid, 3, 1,
|
||||||
NULL);
|
NULL);
|
||||||
ACPI_FREE(obj);
|
ACPI_FREE(obj);
|
||||||
}
|
}
|
||||||
|
@ -55,13 +55,13 @@ struct ucsi {
|
|||||||
|
|
||||||
static int ucsi_acpi_cmd(struct ucsi *ucsi, struct ucsi_control *ctrl)
|
static int ucsi_acpi_cmd(struct ucsi *ucsi, struct ucsi_control *ctrl)
|
||||||
{
|
{
|
||||||
uuid_le uuid = UUID_LE(0x6f8398c2, 0x7ca4, 0x11e4,
|
guid_t guid = GUID_INIT(0x6f8398c2, 0x7ca4, 0x11e4,
|
||||||
0xad, 0x36, 0x63, 0x10, 0x42, 0xb5, 0x00, 0x8f);
|
0xad, 0x36, 0x63, 0x10, 0x42, 0xb5, 0x00, 0x8f);
|
||||||
union acpi_object *obj;
|
union acpi_object *obj;
|
||||||
|
|
||||||
ucsi->data->ctrl.raw_cmd = ctrl->raw_cmd;
|
ucsi->data->ctrl.raw_cmd = ctrl->raw_cmd;
|
||||||
|
|
||||||
obj = acpi_evaluate_dsm(ACPI_HANDLE(ucsi->dev), uuid.b, 1, 1, NULL);
|
obj = acpi_evaluate_dsm(ACPI_HANDLE(ucsi->dev), &guid, 1, 1, NULL);
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
dev_err(ucsi->dev, "%s: failed to evaluate _DSM\n", __func__);
|
dev_err(ucsi->dev, "%s: failed to evaluate _DSM\n", __func__);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
@ -105,7 +105,7 @@ enum wcove_typec_role {
|
|||||||
WCOVE_ROLE_DEVICE,
|
WCOVE_ROLE_DEVICE,
|
||||||
};
|
};
|
||||||
|
|
||||||
static uuid_le uuid = UUID_LE(0x482383f0, 0x2876, 0x4e49,
|
static guid_t guid = GUID_INIT(0x482383f0, 0x2876, 0x4e49,
|
||||||
0x86, 0x85, 0xdb, 0x66, 0x21, 0x1a, 0xf0, 0x37);
|
0x86, 0x85, 0xdb, 0x66, 0x21, 0x1a, 0xf0, 0x37);
|
||||||
|
|
||||||
static int wcove_typec_func(struct wcove_typec *wcove,
|
static int wcove_typec_func(struct wcove_typec *wcove,
|
||||||
@ -118,7 +118,7 @@ static int wcove_typec_func(struct wcove_typec *wcove,
|
|||||||
tmp.type = ACPI_TYPE_INTEGER;
|
tmp.type = ACPI_TYPE_INTEGER;
|
||||||
tmp.integer.value = param;
|
tmp.integer.value = param;
|
||||||
|
|
||||||
obj = acpi_evaluate_dsm(ACPI_HANDLE(wcove->dev), uuid.b, 1, func,
|
obj = acpi_evaluate_dsm(ACPI_HANDLE(wcove->dev), &guid, 1, func,
|
||||||
&argv4);
|
&argv4);
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
dev_err(wcove->dev, "%s: failed to evaluate _DSM\n", __func__);
|
dev_err(wcove->dev, "%s: failed to evaluate _DSM\n", __func__);
|
||||||
@ -314,7 +314,7 @@ static int wcove_typec_probe(struct platform_device *pdev)
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (!acpi_check_dsm(ACPI_HANDLE(&pdev->dev), uuid.b, 0, 0x1f)) {
|
if (!acpi_check_dsm(ACPI_HANDLE(&pdev->dev), &guid, 0, 0x1f)) {
|
||||||
dev_err(&pdev->dev, "Missing _DSM functions\n");
|
dev_err(&pdev->dev, "Missing _DSM functions\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
@ -233,12 +233,12 @@ static int tmem_cleancache_init_fs(size_t pagesize)
|
|||||||
return xen_tmem_new_pool(uuid_private, 0, pagesize);
|
return xen_tmem_new_pool(uuid_private, 0, pagesize);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tmem_cleancache_init_shared_fs(char *uuid, size_t pagesize)
|
static int tmem_cleancache_init_shared_fs(uuid_t *uuid, size_t pagesize)
|
||||||
{
|
{
|
||||||
struct tmem_pool_uuid shared_uuid;
|
struct tmem_pool_uuid shared_uuid;
|
||||||
|
|
||||||
shared_uuid.uuid_lo = *(u64 *)uuid;
|
shared_uuid.uuid_lo = *(u64 *)&uuid->b[0];
|
||||||
shared_uuid.uuid_hi = *(u64 *)(&uuid[8]);
|
shared_uuid.uuid_hi = *(u64 *)&uuid->b[8];
|
||||||
return xen_tmem_new_pool(shared_uuid, TMEM_POOL_SHARED, pagesize);
|
return xen_tmem_new_pool(shared_uuid, TMEM_POOL_SHARED, pagesize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ static int afs_deliver_cb_init_call_back_state3(struct afs_call *call)
|
|||||||
{
|
{
|
||||||
struct sockaddr_rxrpc srx;
|
struct sockaddr_rxrpc srx;
|
||||||
struct afs_server *server;
|
struct afs_server *server;
|
||||||
struct uuid_v1 *r;
|
struct afs_uuid *r;
|
||||||
unsigned loop;
|
unsigned loop;
|
||||||
__be32 *b;
|
__be32 *b;
|
||||||
int ret;
|
int ret;
|
||||||
@ -380,7 +380,7 @@ static int afs_deliver_cb_init_call_back_state3(struct afs_call *call)
|
|||||||
}
|
}
|
||||||
|
|
||||||
_debug("unmarshall UUID");
|
_debug("unmarshall UUID");
|
||||||
call->request = kmalloc(sizeof(struct uuid_v1), GFP_KERNEL);
|
call->request = kmalloc(sizeof(struct afs_uuid), GFP_KERNEL);
|
||||||
if (!call->request)
|
if (!call->request)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
@ -453,7 +453,7 @@ static int afs_deliver_cb_probe(struct afs_call *call)
|
|||||||
static void SRXAFSCB_ProbeUuid(struct work_struct *work)
|
static void SRXAFSCB_ProbeUuid(struct work_struct *work)
|
||||||
{
|
{
|
||||||
struct afs_call *call = container_of(work, struct afs_call, work);
|
struct afs_call *call = container_of(work, struct afs_call, work);
|
||||||
struct uuid_v1 *r = call->request;
|
struct afs_uuid *r = call->request;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
__be32 match;
|
__be32 match;
|
||||||
@ -476,7 +476,7 @@ static void SRXAFSCB_ProbeUuid(struct work_struct *work)
|
|||||||
*/
|
*/
|
||||||
static int afs_deliver_cb_probe_uuid(struct afs_call *call)
|
static int afs_deliver_cb_probe_uuid(struct afs_call *call)
|
||||||
{
|
{
|
||||||
struct uuid_v1 *r;
|
struct afs_uuid *r;
|
||||||
unsigned loop;
|
unsigned loop;
|
||||||
__be32 *b;
|
__be32 *b;
|
||||||
int ret;
|
int ret;
|
||||||
@ -502,15 +502,15 @@ static int afs_deliver_cb_probe_uuid(struct afs_call *call)
|
|||||||
}
|
}
|
||||||
|
|
||||||
_debug("unmarshall UUID");
|
_debug("unmarshall UUID");
|
||||||
call->request = kmalloc(sizeof(struct uuid_v1), GFP_KERNEL);
|
call->request = kmalloc(sizeof(struct afs_uuid), GFP_KERNEL);
|
||||||
if (!call->request)
|
if (!call->request)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
b = call->buffer;
|
b = call->buffer;
|
||||||
r = call->request;
|
r = call->request;
|
||||||
r->time_low = b[0];
|
r->time_low = ntohl(b[0]);
|
||||||
r->time_mid = htons(ntohl(b[1]));
|
r->time_mid = ntohl(b[1]);
|
||||||
r->time_hi_and_version = htons(ntohl(b[2]));
|
r->time_hi_and_version = ntohl(b[2]);
|
||||||
r->clock_seq_hi_and_reserved = ntohl(b[3]);
|
r->clock_seq_hi_and_reserved = ntohl(b[3]);
|
||||||
r->clock_seq_low = ntohl(b[4]);
|
r->clock_seq_low = ntohl(b[4]);
|
||||||
|
|
||||||
|
@ -410,6 +410,15 @@ struct afs_interface {
|
|||||||
unsigned mtu; /* MTU of interface */
|
unsigned mtu; /* MTU of interface */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct afs_uuid {
|
||||||
|
__be32 time_low; /* low part of timestamp */
|
||||||
|
__be16 time_mid; /* mid part of timestamp */
|
||||||
|
__be16 time_hi_and_version; /* high part of timestamp and version */
|
||||||
|
__u8 clock_seq_hi_and_reserved; /* clock seq hi and variant */
|
||||||
|
__u8 clock_seq_low; /* clock seq low */
|
||||||
|
__u8 node[6]; /* spatially unique node ID (MAC addr) */
|
||||||
|
};
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*
|
/*
|
||||||
* cache.c
|
* cache.c
|
||||||
@ -544,7 +553,7 @@ extern int afs_drop_inode(struct inode *);
|
|||||||
* main.c
|
* main.c
|
||||||
*/
|
*/
|
||||||
extern struct workqueue_struct *afs_wq;
|
extern struct workqueue_struct *afs_wq;
|
||||||
extern struct uuid_v1 afs_uuid;
|
extern struct afs_uuid afs_uuid;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* misc.c
|
* misc.c
|
||||||
|
@ -31,7 +31,7 @@ static char *rootcell;
|
|||||||
module_param(rootcell, charp, 0);
|
module_param(rootcell, charp, 0);
|
||||||
MODULE_PARM_DESC(rootcell, "root AFS cell name and VL server IP addr list");
|
MODULE_PARM_DESC(rootcell, "root AFS cell name and VL server IP addr list");
|
||||||
|
|
||||||
struct uuid_v1 afs_uuid;
|
struct afs_uuid afs_uuid;
|
||||||
struct workqueue_struct *afs_wq;
|
struct workqueue_struct *afs_wq;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -3950,7 +3950,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
|
|||||||
sb->s_qcop = &ext4_qctl_operations;
|
sb->s_qcop = &ext4_qctl_operations;
|
||||||
sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ;
|
sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ;
|
||||||
#endif
|
#endif
|
||||||
memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
|
memcpy(&sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
|
||||||
|
|
||||||
INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
|
INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
|
||||||
mutex_init(&sbi->s_orphan_lock);
|
mutex_init(&sbi->s_orphan_lock);
|
||||||
|
@ -1937,7 +1937,7 @@ try_onemore:
|
|||||||
sb->s_time_gran = 1;
|
sb->s_time_gran = 1;
|
||||||
sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
|
sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
|
||||||
(test_opt(sbi, POSIX_ACL) ? MS_POSIXACL : 0);
|
(test_opt(sbi, POSIX_ACL) ? MS_POSIXACL : 0);
|
||||||
memcpy(sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
|
memcpy(&sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
|
||||||
|
|
||||||
/* init f2fs-specific super block info */
|
/* init f2fs-specific super block info */
|
||||||
sbi->valid_super_block = valid_super_block;
|
sbi->valid_super_block = valid_super_block;
|
||||||
|
@ -203,7 +203,7 @@ static void gfs2_sb_in(struct gfs2_sbd *sdp, const void *buf)
|
|||||||
|
|
||||||
memcpy(sb->sb_lockproto, str->sb_lockproto, GFS2_LOCKNAME_LEN);
|
memcpy(sb->sb_lockproto, str->sb_lockproto, GFS2_LOCKNAME_LEN);
|
||||||
memcpy(sb->sb_locktable, str->sb_locktable, GFS2_LOCKNAME_LEN);
|
memcpy(sb->sb_locktable, str->sb_locktable, GFS2_LOCKNAME_LEN);
|
||||||
memcpy(s->s_uuid, str->sb_uuid, 16);
|
memcpy(&s->s_uuid, str->sb_uuid, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -71,25 +71,14 @@ static ssize_t fsname_show(struct gfs2_sbd *sdp, char *buf)
|
|||||||
return snprintf(buf, PAGE_SIZE, "%s\n", sdp->sd_fsname);
|
return snprintf(buf, PAGE_SIZE, "%s\n", sdp->sd_fsname);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int gfs2_uuid_valid(const u8 *uuid)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < 16; i++) {
|
|
||||||
if (uuid[i])
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ssize_t uuid_show(struct gfs2_sbd *sdp, char *buf)
|
static ssize_t uuid_show(struct gfs2_sbd *sdp, char *buf)
|
||||||
{
|
{
|
||||||
struct super_block *s = sdp->sd_vfs;
|
struct super_block *s = sdp->sd_vfs;
|
||||||
const u8 *uuid = s->s_uuid;
|
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
if (!gfs2_uuid_valid(uuid))
|
if (uuid_is_null(&s->s_uuid))
|
||||||
return 0;
|
return 0;
|
||||||
return snprintf(buf, PAGE_SIZE, "%pUB\n", uuid);
|
return snprintf(buf, PAGE_SIZE, "%pUB\n", &s->s_uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t freeze_show(struct gfs2_sbd *sdp, char *buf)
|
static ssize_t freeze_show(struct gfs2_sbd *sdp, char *buf)
|
||||||
@ -712,14 +701,13 @@ static int gfs2_uevent(struct kset *kset, struct kobject *kobj,
|
|||||||
{
|
{
|
||||||
struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);
|
struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);
|
||||||
struct super_block *s = sdp->sd_vfs;
|
struct super_block *s = sdp->sd_vfs;
|
||||||
const u8 *uuid = s->s_uuid;
|
|
||||||
|
|
||||||
add_uevent_var(env, "LOCKTABLE=%s", sdp->sd_table_name);
|
add_uevent_var(env, "LOCKTABLE=%s", sdp->sd_table_name);
|
||||||
add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name);
|
add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name);
|
||||||
if (!test_bit(SDF_NOJOURNALID, &sdp->sd_flags))
|
if (!test_bit(SDF_NOJOURNALID, &sdp->sd_flags))
|
||||||
add_uevent_var(env, "JOURNALID=%d", sdp->sd_lockstruct.ls_jid);
|
add_uevent_var(env, "JOURNALID=%d", sdp->sd_lockstruct.ls_jid);
|
||||||
if (gfs2_uuid_valid(uuid))
|
if (!uuid_is_null(&s->s_uuid))
|
||||||
add_uevent_var(env, "UUID=%pUB", uuid);
|
add_uevent_var(env, "UUID=%pUB", &s->s_uuid);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,7 +486,7 @@ secinfo_parse(char **mesg, char *buf, struct svc_export *exp) { return 0; }
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
uuid_parse(char **mesg, char *buf, unsigned char **puuid)
|
nfsd_uuid_parse(char **mesg, char *buf, unsigned char **puuid)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
@ -586,7 +586,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
|
|||||||
if (strcmp(buf, "fsloc") == 0)
|
if (strcmp(buf, "fsloc") == 0)
|
||||||
err = fsloc_parse(&mesg, buf, &exp.ex_fslocs);
|
err = fsloc_parse(&mesg, buf, &exp.ex_fslocs);
|
||||||
else if (strcmp(buf, "uuid") == 0)
|
else if (strcmp(buf, "uuid") == 0)
|
||||||
err = uuid_parse(&mesg, buf, &exp.ex_uuid);
|
err = nfsd_uuid_parse(&mesg, buf, &exp.ex_uuid);
|
||||||
else if (strcmp(buf, "secinfo") == 0)
|
else if (strcmp(buf, "secinfo") == 0)
|
||||||
err = secinfo_parse(&mesg, buf, &exp);
|
err = secinfo_parse(&mesg, buf, &exp);
|
||||||
else
|
else
|
||||||
|
@ -2062,7 +2062,7 @@ static int ocfs2_initialize_super(struct super_block *sb,
|
|||||||
cbits = le32_to_cpu(di->id2.i_super.s_clustersize_bits);
|
cbits = le32_to_cpu(di->id2.i_super.s_clustersize_bits);
|
||||||
bbits = le32_to_cpu(di->id2.i_super.s_blocksize_bits);
|
bbits = le32_to_cpu(di->id2.i_super.s_blocksize_bits);
|
||||||
sb->s_maxbytes = ocfs2_max_file_offset(bbits, cbits);
|
sb->s_maxbytes = ocfs2_max_file_offset(bbits, cbits);
|
||||||
memcpy(sb->s_uuid, di->id2.i_super.s_uuid,
|
memcpy(&sb->s_uuid, di->id2.i_super.s_uuid,
|
||||||
sizeof(di->id2.i_super.s_uuid));
|
sizeof(di->id2.i_super.s_uuid));
|
||||||
|
|
||||||
osb->osb_dx_mask = (1 << (cbits - bbits)) - 1;
|
osb->osb_dx_mask = (1 << (cbits - bbits)) - 1;
|
||||||
|
@ -233,7 +233,7 @@ int ovl_set_attr(struct dentry *upperdentry, struct kstat *stat)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ovl_fh *ovl_encode_fh(struct dentry *lower, uuid_be *uuid)
|
static struct ovl_fh *ovl_encode_fh(struct dentry *lower, uuid_t *uuid)
|
||||||
{
|
{
|
||||||
struct ovl_fh *fh;
|
struct ovl_fh *fh;
|
||||||
int fh_type, fh_len, dwords;
|
int fh_type, fh_len, dwords;
|
||||||
@ -284,7 +284,6 @@ static int ovl_set_origin(struct dentry *dentry, struct dentry *lower,
|
|||||||
struct dentry *upper)
|
struct dentry *upper)
|
||||||
{
|
{
|
||||||
struct super_block *sb = lower->d_sb;
|
struct super_block *sb = lower->d_sb;
|
||||||
uuid_be *uuid = (uuid_be *) &sb->s_uuid;
|
|
||||||
const struct ovl_fh *fh = NULL;
|
const struct ovl_fh *fh = NULL;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
@ -294,8 +293,8 @@ static int ovl_set_origin(struct dentry *dentry, struct dentry *lower,
|
|||||||
* up and a pure upper inode.
|
* up and a pure upper inode.
|
||||||
*/
|
*/
|
||||||
if (sb->s_export_op && sb->s_export_op->fh_to_dentry &&
|
if (sb->s_export_op && sb->s_export_op->fh_to_dentry &&
|
||||||
uuid_be_cmp(*uuid, NULL_UUID_BE)) {
|
!uuid_is_null(&sb->s_uuid)) {
|
||||||
fh = ovl_encode_fh(lower, uuid);
|
fh = ovl_encode_fh(lower, &sb->s_uuid);
|
||||||
if (IS_ERR(fh))
|
if (IS_ERR(fh))
|
||||||
return PTR_ERR(fh);
|
return PTR_ERR(fh);
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ static struct dentry *ovl_get_origin(struct dentry *dentry,
|
|||||||
* Make sure that the stored uuid matches the uuid of the lower
|
* Make sure that the stored uuid matches the uuid of the lower
|
||||||
* layer where file handle will be decoded.
|
* layer where file handle will be decoded.
|
||||||
*/
|
*/
|
||||||
if (uuid_be_cmp(fh->uuid, *(uuid_be *) &mnt->mnt_sb->s_uuid))
|
if (!uuid_equal(&fh->uuid, &mnt->mnt_sb->s_uuid))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
origin = exportfs_decode_fh(mnt, (struct fid *)fh->fid,
|
origin = exportfs_decode_fh(mnt, (struct fid *)fh->fid,
|
||||||
|
@ -56,7 +56,7 @@ struct ovl_fh {
|
|||||||
u8 len; /* size of this header + size of fid */
|
u8 len; /* size of this header + size of fid */
|
||||||
u8 flags; /* OVL_FH_FLAG_* */
|
u8 flags; /* OVL_FH_FLAG_* */
|
||||||
u8 type; /* fid_type of fid */
|
u8 type; /* fid_type of fid */
|
||||||
uuid_be uuid; /* uuid of filesystem */
|
uuid_t uuid; /* uuid of filesystem */
|
||||||
u8 fid[0]; /* file identifier */
|
u8 fid[0]; /* file identifier */
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
|
@ -98,8 +98,7 @@ xfs-y += xfs_aops.o \
|
|||||||
xfs_sysfs.o \
|
xfs_sysfs.o \
|
||||||
xfs_trans.o \
|
xfs_trans.o \
|
||||||
xfs_xattr.o \
|
xfs_xattr.o \
|
||||||
kmem.o \
|
kmem.o
|
||||||
uuid.o
|
|
||||||
|
|
||||||
# low-level transaction/log code
|
# low-level transaction/log code
|
||||||
xfs-y += xfs_log.o \
|
xfs-y += xfs_log.o \
|
||||||
|
@ -1,63 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
|
|
||||||
* All Rights Reserved.
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it would be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
#include <xfs.h>
|
|
||||||
|
|
||||||
/* IRIX interpretation of an uuid_t */
|
|
||||||
typedef struct {
|
|
||||||
__be32 uu_timelow;
|
|
||||||
__be16 uu_timemid;
|
|
||||||
__be16 uu_timehi;
|
|
||||||
__be16 uu_clockseq;
|
|
||||||
__be16 uu_node[3];
|
|
||||||
} xfs_uu_t;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* uuid_getnodeuniq - obtain the node unique fields of a UUID.
|
|
||||||
*
|
|
||||||
* This is not in any way a standard or condoned UUID function;
|
|
||||||
* it just something that's needed for user-level file handles.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
uuid_getnodeuniq(uuid_t *uuid, int fsid [2])
|
|
||||||
{
|
|
||||||
xfs_uu_t *uup = (xfs_uu_t *)uuid;
|
|
||||||
|
|
||||||
fsid[0] = (be16_to_cpu(uup->uu_clockseq) << 16) |
|
|
||||||
be16_to_cpu(uup->uu_timemid);
|
|
||||||
fsid[1] = be32_to_cpu(uup->uu_timelow);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
uuid_is_nil(uuid_t *uuid)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
char *cp = (char *)uuid;
|
|
||||||
|
|
||||||
if (uuid == NULL)
|
|
||||||
return 0;
|
|
||||||
/* implied check of version number here... */
|
|
||||||
for (i = 0; i < sizeof *uuid; i++)
|
|
||||||
if (*cp++) return 0; /* not nil */
|
|
||||||
return 1; /* is nil */
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
uuid_equal(uuid_t *uuid1, uuid_t *uuid2)
|
|
||||||
{
|
|
||||||
return memcmp(uuid1, uuid2, sizeof(uuid_t)) ? 0 : 1;
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
|
|
||||||
* All Rights Reserved.
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it would be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
#ifndef __XFS_SUPPORT_UUID_H__
|
|
||||||
#define __XFS_SUPPORT_UUID_H__
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
unsigned char __u_bits[16];
|
|
||||||
} uuid_t;
|
|
||||||
|
|
||||||
extern int uuid_is_nil(uuid_t *uuid);
|
|
||||||
extern int uuid_equal(uuid_t *uuid1, uuid_t *uuid2);
|
|
||||||
extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
uuid_copy(uuid_t *dst, uuid_t *src)
|
|
||||||
{
|
|
||||||
memcpy(dst, src, sizeof(uuid_t));
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* __XFS_SUPPORT_UUID_H__ */
|
|
@ -834,9 +834,7 @@ xfs_inode_item_format_convert(
|
|||||||
in_f->ilf_dsize = in_f32->ilf_dsize;
|
in_f->ilf_dsize = in_f32->ilf_dsize;
|
||||||
in_f->ilf_ino = in_f32->ilf_ino;
|
in_f->ilf_ino = in_f32->ilf_ino;
|
||||||
/* copy biggest field of ilf_u */
|
/* copy biggest field of ilf_u */
|
||||||
memcpy(in_f->ilf_u.ilfu_uuid.__u_bits,
|
uuid_copy(&in_f->ilf_u.ilfu_uuid, &in_f32->ilf_u.ilfu_uuid);
|
||||||
in_f32->ilf_u.ilfu_uuid.__u_bits,
|
|
||||||
sizeof(uuid_t));
|
|
||||||
in_f->ilf_blkno = in_f32->ilf_blkno;
|
in_f->ilf_blkno = in_f32->ilf_blkno;
|
||||||
in_f->ilf_len = in_f32->ilf_len;
|
in_f->ilf_len = in_f32->ilf_len;
|
||||||
in_f->ilf_boffset = in_f32->ilf_boffset;
|
in_f->ilf_boffset = in_f32->ilf_boffset;
|
||||||
@ -851,9 +849,7 @@ xfs_inode_item_format_convert(
|
|||||||
in_f->ilf_dsize = in_f64->ilf_dsize;
|
in_f->ilf_dsize = in_f64->ilf_dsize;
|
||||||
in_f->ilf_ino = in_f64->ilf_ino;
|
in_f->ilf_ino = in_f64->ilf_ino;
|
||||||
/* copy biggest field of ilf_u */
|
/* copy biggest field of ilf_u */
|
||||||
memcpy(in_f->ilf_u.ilfu_uuid.__u_bits,
|
uuid_copy(&in_f->ilf_u.ilfu_uuid, &in_f64->ilf_u.ilfu_uuid);
|
||||||
in_f64->ilf_u.ilfu_uuid.__u_bits,
|
|
||||||
sizeof(uuid_t));
|
|
||||||
in_f->ilf_blkno = in_f64->ilf_blkno;
|
in_f->ilf_blkno = in_f64->ilf_blkno;
|
||||||
in_f->ilf_len = in_f64->ilf_len;
|
in_f->ilf_len = in_f64->ilf_len;
|
||||||
in_f->ilf_boffset = in_f64->ilf_boffset;
|
in_f->ilf_boffset = in_f64->ilf_boffset;
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#define __XFS_LINUX__
|
#define __XFS_LINUX__
|
||||||
|
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
|
#include <linux/uuid.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Kernel specific type declarations for XFS
|
* Kernel specific type declarations for XFS
|
||||||
@ -42,7 +43,6 @@ typedef __u32 xfs_nlink_t;
|
|||||||
|
|
||||||
#include "kmem.h"
|
#include "kmem.h"
|
||||||
#include "mrlock.h"
|
#include "mrlock.h"
|
||||||
#include "uuid.h"
|
|
||||||
|
|
||||||
#include <linux/semaphore.h>
|
#include <linux/semaphore.h>
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
|
@ -352,13 +352,13 @@ xlog_header_check_mount(
|
|||||||
{
|
{
|
||||||
ASSERT(head->h_magicno == cpu_to_be32(XLOG_HEADER_MAGIC_NUM));
|
ASSERT(head->h_magicno == cpu_to_be32(XLOG_HEADER_MAGIC_NUM));
|
||||||
|
|
||||||
if (uuid_is_nil(&head->h_fs_uuid)) {
|
if (uuid_is_null(&head->h_fs_uuid)) {
|
||||||
/*
|
/*
|
||||||
* IRIX doesn't write the h_fs_uuid or h_fmt fields. If
|
* IRIX doesn't write the h_fs_uuid or h_fmt fields. If
|
||||||
* h_fs_uuid is nil, we assume this log was last mounted
|
* h_fs_uuid is null, we assume this log was last mounted
|
||||||
* by IRIX and continue.
|
* by IRIX and continue.
|
||||||
*/
|
*/
|
||||||
xfs_warn(mp, "nil uuid in log - IRIX style log");
|
xfs_warn(mp, "null uuid in log - IRIX style log");
|
||||||
} else if (unlikely(!uuid_equal(&mp->m_sb.sb_uuid, &head->h_fs_uuid))) {
|
} else if (unlikely(!uuid_equal(&mp->m_sb.sb_uuid, &head->h_fs_uuid))) {
|
||||||
xfs_warn(mp, "log has mismatched uuid - can't recover");
|
xfs_warn(mp, "log has mismatched uuid - can't recover");
|
||||||
xlog_header_check_dump(mp, head);
|
xlog_header_check_dump(mp, head);
|
||||||
|
@ -74,20 +74,19 @@ xfs_uuid_mount(
|
|||||||
int hole, i;
|
int hole, i;
|
||||||
|
|
||||||
/* Publish UUID in struct super_block */
|
/* Publish UUID in struct super_block */
|
||||||
BUILD_BUG_ON(sizeof(mp->m_super->s_uuid) != sizeof(uuid_t));
|
uuid_copy(&mp->m_super->s_uuid, uuid);
|
||||||
memcpy(&mp->m_super->s_uuid, uuid, sizeof(uuid_t));
|
|
||||||
|
|
||||||
if (mp->m_flags & XFS_MOUNT_NOUUID)
|
if (mp->m_flags & XFS_MOUNT_NOUUID)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (uuid_is_nil(uuid)) {
|
if (uuid_is_null(uuid)) {
|
||||||
xfs_warn(mp, "Filesystem has nil UUID - can't mount");
|
xfs_warn(mp, "Filesystem has null UUID - can't mount");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_lock(&xfs_uuid_table_mutex);
|
mutex_lock(&xfs_uuid_table_mutex);
|
||||||
for (i = 0, hole = -1; i < xfs_uuid_table_size; i++) {
|
for (i = 0, hole = -1; i < xfs_uuid_table_size; i++) {
|
||||||
if (uuid_is_nil(&xfs_uuid_table[i])) {
|
if (uuid_is_null(&xfs_uuid_table[i])) {
|
||||||
hole = i;
|
hole = i;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -124,7 +123,7 @@ xfs_uuid_unmount(
|
|||||||
|
|
||||||
mutex_lock(&xfs_uuid_table_mutex);
|
mutex_lock(&xfs_uuid_table_mutex);
|
||||||
for (i = 0; i < xfs_uuid_table_size; i++) {
|
for (i = 0; i < xfs_uuid_table_size; i++) {
|
||||||
if (uuid_is_nil(&xfs_uuid_table[i]))
|
if (uuid_is_null(&xfs_uuid_table[i]))
|
||||||
continue;
|
continue;
|
||||||
if (!uuid_equal(uuid, &xfs_uuid_table[i]))
|
if (!uuid_equal(uuid, &xfs_uuid_table[i]))
|
||||||
continue;
|
continue;
|
||||||
@ -793,7 +792,10 @@ xfs_mountfs(
|
|||||||
* Copies the low order bits of the timestamp and the randomly
|
* Copies the low order bits of the timestamp and the randomly
|
||||||
* set "sequence" number out of a UUID.
|
* set "sequence" number out of a UUID.
|
||||||
*/
|
*/
|
||||||
uuid_getnodeuniq(&sbp->sb_uuid, mp->m_fixedfsid);
|
mp->m_fixedfsid[0] =
|
||||||
|
(get_unaligned_be16(&sbp->sb_uuid.b[8]) << 16) |
|
||||||
|
get_unaligned_be16(&sbp->sb_uuid.b[4]);
|
||||||
|
mp->m_fixedfsid[1] = get_unaligned_be32(&sbp->sb_uuid.b[0]);
|
||||||
|
|
||||||
mp->m_dmevmask = 0; /* not persistent; set after each mount */
|
mp->m_dmevmask = 0; /* not persistent; set after each mount */
|
||||||
|
|
||||||
|
@ -61,17 +61,18 @@ bool acpi_ata_match(acpi_handle handle);
|
|||||||
bool acpi_bay_match(acpi_handle handle);
|
bool acpi_bay_match(acpi_handle handle);
|
||||||
bool acpi_dock_match(acpi_handle handle);
|
bool acpi_dock_match(acpi_handle handle);
|
||||||
|
|
||||||
bool acpi_check_dsm(acpi_handle handle, const u8 *uuid, u64 rev, u64 funcs);
|
bool acpi_check_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 funcs);
|
||||||
union acpi_object *acpi_evaluate_dsm(acpi_handle handle, const u8 *uuid,
|
union acpi_object *acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid,
|
||||||
u64 rev, u64 func, union acpi_object *argv4);
|
u64 rev, u64 func, union acpi_object *argv4);
|
||||||
|
|
||||||
static inline union acpi_object *
|
static inline union acpi_object *
|
||||||
acpi_evaluate_dsm_typed(acpi_handle handle, const u8 *uuid, u64 rev, u64 func,
|
acpi_evaluate_dsm_typed(acpi_handle handle, const guid_t *guid, u64 rev,
|
||||||
union acpi_object *argv4, acpi_object_type type)
|
u64 func, union acpi_object *argv4,
|
||||||
|
acpi_object_type type)
|
||||||
{
|
{
|
||||||
union acpi_object *obj;
|
union acpi_object *obj;
|
||||||
|
|
||||||
obj = acpi_evaluate_dsm(handle, uuid, rev, func, argv4);
|
obj = acpi_evaluate_dsm(handle, guid, rev, func, argv4);
|
||||||
if (obj && obj->type != type) {
|
if (obj && obj->type != type) {
|
||||||
ACPI_FREE(obj);
|
ACPI_FREE(obj);
|
||||||
obj = NULL;
|
obj = NULL;
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <linux/resource_ext.h>
|
#include <linux/resource_ext.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/property.h>
|
#include <linux/property.h>
|
||||||
|
#include <linux/uuid.h>
|
||||||
|
|
||||||
#ifndef _LINUX
|
#ifndef _LINUX
|
||||||
#define _LINUX
|
#define _LINUX
|
||||||
@ -457,7 +458,6 @@ struct acpi_osc_context {
|
|||||||
struct acpi_buffer ret; /* free by caller if success */
|
struct acpi_buffer ret; /* free by caller if success */
|
||||||
};
|
};
|
||||||
|
|
||||||
acpi_status acpi_str_to_uuid(char *str, u8 *uuid);
|
|
||||||
acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context);
|
acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context);
|
||||||
|
|
||||||
/* Indexes into _OSC Capabilities Buffer (DWORDs 2 & 3 are device-specific) */
|
/* Indexes into _OSC Capabilities Buffer (DWORDs 2 & 3 are device-specific) */
|
||||||
@ -741,7 +741,7 @@ static inline bool acpi_driver_match_device(struct device *dev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline union acpi_object *acpi_evaluate_dsm(acpi_handle handle,
|
static inline union acpi_object *acpi_evaluate_dsm(acpi_handle handle,
|
||||||
const u8 *uuid,
|
const guid_t *guid,
|
||||||
int rev, int func,
|
int rev, int func,
|
||||||
union acpi_object *argv4)
|
union acpi_object *argv4)
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@ struct cleancache_filekey {
|
|||||||
|
|
||||||
struct cleancache_ops {
|
struct cleancache_ops {
|
||||||
int (*init_fs)(size_t);
|
int (*init_fs)(size_t);
|
||||||
int (*init_shared_fs)(char *uuid, size_t);
|
int (*init_shared_fs)(uuid_t *uuid, size_t);
|
||||||
int (*get_page)(int, struct cleancache_filekey,
|
int (*get_page)(int, struct cleancache_filekey,
|
||||||
pgoff_t, struct page *);
|
pgoff_t, struct page *);
|
||||||
void (*put_page)(int, struct cleancache_filekey,
|
void (*put_page)(int, struct cleancache_filekey,
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include <linux/percpu-rwsem.h>
|
#include <linux/percpu-rwsem.h>
|
||||||
#include <linux/workqueue.h>
|
#include <linux/workqueue.h>
|
||||||
#include <linux/delayed_call.h>
|
#include <linux/delayed_call.h>
|
||||||
|
#include <linux/uuid.h>
|
||||||
|
|
||||||
#include <asm/byteorder.h>
|
#include <asm/byteorder.h>
|
||||||
#include <uapi/linux/fs.h>
|
#include <uapi/linux/fs.h>
|
||||||
@ -1329,7 +1330,7 @@ struct super_block {
|
|||||||
struct sb_writers s_writers;
|
struct sb_writers s_writers;
|
||||||
|
|
||||||
char s_id[32]; /* Informational name */
|
char s_id[32]; /* Informational name */
|
||||||
u8 s_uuid[16]; /* UUID */
|
uuid_t s_uuid; /* UUID */
|
||||||
|
|
||||||
void *s_fs_info; /* Filesystem private info */
|
void *s_fs_info; /* Filesystem private info */
|
||||||
unsigned int s_max_links;
|
unsigned int s_max_links;
|
||||||
|
@ -219,12 +219,6 @@ static inline struct gendisk *part_to_disk(struct hd_struct *part)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int blk_part_pack_uuid(const u8 *uuid_str, u8 *to)
|
|
||||||
{
|
|
||||||
uuid_be_to_bin(uuid_str, (uuid_be *)to);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int disk_max_parts(struct gendisk *disk)
|
static inline int disk_max_parts(struct gendisk *disk)
|
||||||
{
|
{
|
||||||
if (disk->flags & GENHD_FL_EXT_DEVT)
|
if (disk->flags & GENHD_FL_EXT_DEVT)
|
||||||
@ -736,11 +730,6 @@ static inline dev_t blk_lookup_devt(const char *name, int partno)
|
|||||||
dev_t devt = MKDEV(0, 0);
|
dev_t devt = MKDEV(0, 0);
|
||||||
return devt;
|
return devt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int blk_part_pack_uuid(const u8 *uuid_str, u8 *to)
|
|
||||||
{
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
#endif /* CONFIG_BLOCK */
|
#endif /* CONFIG_BLOCK */
|
||||||
|
|
||||||
#endif /* _LINUX_GENHD_H */
|
#endif /* _LINUX_GENHD_H */
|
||||||
|
@ -177,7 +177,6 @@ struct fcnvme_lsdesc_rjt {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#define FCNVME_ASSOC_HOSTID_LEN 16
|
|
||||||
#define FCNVME_ASSOC_HOSTNQN_LEN 256
|
#define FCNVME_ASSOC_HOSTNQN_LEN 256
|
||||||
#define FCNVME_ASSOC_SUBNQN_LEN 256
|
#define FCNVME_ASSOC_SUBNQN_LEN 256
|
||||||
|
|
||||||
@ -191,7 +190,7 @@ struct fcnvme_lsdesc_cr_assoc_cmd {
|
|||||||
__be16 cntlid;
|
__be16 cntlid;
|
||||||
__be16 sqsize;
|
__be16 sqsize;
|
||||||
__be32 rsvd52;
|
__be32 rsvd52;
|
||||||
u8 hostid[FCNVME_ASSOC_HOSTID_LEN];
|
uuid_t hostid;
|
||||||
u8 hostnqn[FCNVME_ASSOC_HOSTNQN_LEN];
|
u8 hostnqn[FCNVME_ASSOC_HOSTNQN_LEN];
|
||||||
u8 subnqn[FCNVME_ASSOC_SUBNQN_LEN];
|
u8 subnqn[FCNVME_ASSOC_SUBNQN_LEN];
|
||||||
u8 rsvd632[384];
|
u8 rsvd632[384];
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#define _LINUX_NVME_H
|
#define _LINUX_NVME_H
|
||||||
|
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
|
#include <linux/uuid.h>
|
||||||
|
|
||||||
/* NQN names in commands fields specified one size */
|
/* NQN names in commands fields specified one size */
|
||||||
#define NVMF_NQN_FIELD_LEN 256
|
#define NVMF_NQN_FIELD_LEN 256
|
||||||
@ -843,7 +844,7 @@ struct nvmf_connect_command {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct nvmf_connect_data {
|
struct nvmf_connect_data {
|
||||||
__u8 hostid[16];
|
uuid_t hostid;
|
||||||
__le16 cntlid;
|
__le16 cntlid;
|
||||||
char resv4[238];
|
char resv4[238];
|
||||||
char subsysnqn[NVMF_NQN_FIELD_LEN];
|
char subsysnqn[NVMF_NQN_FIELD_LEN];
|
||||||
|
@ -105,7 +105,7 @@ static inline void acpiphp_remove_slots(struct pci_bus *bus) { }
|
|||||||
static inline void acpiphp_check_host_bridge(struct acpi_device *adev) { }
|
static inline void acpiphp_check_host_bridge(struct acpi_device *adev) { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern const u8 pci_acpi_dsm_uuid[];
|
extern const guid_t pci_acpi_dsm_guid;
|
||||||
#define DEVICE_LABEL_DSM 0x07
|
#define DEVICE_LABEL_DSM 0x07
|
||||||
#define RESET_DELAY_DSM 0x08
|
#define RESET_DELAY_DSM 0x08
|
||||||
#define FUNCTION_DELAY_DSM 0x09
|
#define FUNCTION_DELAY_DSM 0x09
|
||||||
|
@ -18,29 +18,16 @@
|
|||||||
|
|
||||||
#include <uapi/linux/uuid.h>
|
#include <uapi/linux/uuid.h>
|
||||||
|
|
||||||
/*
|
typedef struct {
|
||||||
* V1 (time-based) UUID definition [RFC 4122].
|
__u8 b[16];
|
||||||
* - the timestamp is a 60-bit value, split 32/16/12, and goes in 100ns
|
} uuid_t;
|
||||||
* increments since midnight 15th October 1582
|
|
||||||
* - add AFS_UUID_TO_UNIX_TIME to convert unix time in 100ns units to UUID
|
#define UUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
|
||||||
* time
|
((uuid_t) \
|
||||||
* - the clock sequence is a 14-bit counter to avoid duplicate times
|
{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
|
||||||
*/
|
((b) >> 8) & 0xff, (b) & 0xff, \
|
||||||
struct uuid_v1 {
|
((c) >> 8) & 0xff, (c) & 0xff, \
|
||||||
__be32 time_low; /* low part of timestamp */
|
(d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
|
||||||
__be16 time_mid; /* mid part of timestamp */
|
|
||||||
__be16 time_hi_and_version; /* high part of timestamp and version */
|
|
||||||
#define UUID_TO_UNIX_TIME 0x01b21dd213814000ULL
|
|
||||||
#define UUID_TIMEHI_MASK 0x0fff
|
|
||||||
#define UUID_VERSION_TIME 0x1000 /* time-based UUID */
|
|
||||||
#define UUID_VERSION_NAME 0x3000 /* name-based UUID */
|
|
||||||
#define UUID_VERSION_RANDOM 0x4000 /* (pseudo-)random generated UUID */
|
|
||||||
u8 clock_seq_hi_and_reserved; /* clock seq hi and variant */
|
|
||||||
#define UUID_CLOCKHI_MASK 0x3f
|
|
||||||
#define UUID_VARIANT_STD 0x80
|
|
||||||
u8 clock_seq_low; /* clock seq low */
|
|
||||||
u8 node[6]; /* spatially unique node ID (MAC addr) */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The length of a UUID string ("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
|
* The length of a UUID string ("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
|
||||||
@ -48,27 +35,73 @@ struct uuid_v1 {
|
|||||||
*/
|
*/
|
||||||
#define UUID_STRING_LEN 36
|
#define UUID_STRING_LEN 36
|
||||||
|
|
||||||
static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2)
|
extern const guid_t guid_null;
|
||||||
|
extern const uuid_t uuid_null;
|
||||||
|
|
||||||
|
static inline bool guid_equal(const guid_t *u1, const guid_t *u2)
|
||||||
{
|
{
|
||||||
return memcmp(&u1, &u2, sizeof(uuid_le));
|
return memcmp(u1, u2, sizeof(guid_t)) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int uuid_be_cmp(const uuid_be u1, const uuid_be u2)
|
static inline void guid_copy(guid_t *dst, const guid_t *src)
|
||||||
{
|
{
|
||||||
return memcmp(&u1, &u2, sizeof(uuid_be));
|
memcpy(dst, src, sizeof(guid_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool guid_is_null(const guid_t *guid)
|
||||||
|
{
|
||||||
|
return guid_equal(guid, &guid_null);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool uuid_equal(const uuid_t *u1, const uuid_t *u2)
|
||||||
|
{
|
||||||
|
return memcmp(u1, u2, sizeof(uuid_t)) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void uuid_copy(uuid_t *dst, const uuid_t *src)
|
||||||
|
{
|
||||||
|
memcpy(dst, src, sizeof(uuid_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool uuid_is_null(const uuid_t *uuid)
|
||||||
|
{
|
||||||
|
return uuid_equal(uuid, &uuid_null);
|
||||||
}
|
}
|
||||||
|
|
||||||
void generate_random_uuid(unsigned char uuid[16]);
|
void generate_random_uuid(unsigned char uuid[16]);
|
||||||
|
|
||||||
extern void uuid_le_gen(uuid_le *u);
|
extern void guid_gen(guid_t *u);
|
||||||
extern void uuid_be_gen(uuid_be *u);
|
extern void uuid_gen(uuid_t *u);
|
||||||
|
|
||||||
bool __must_check uuid_is_valid(const char *uuid);
|
bool __must_check uuid_is_valid(const char *uuid);
|
||||||
|
|
||||||
extern const u8 uuid_le_index[16];
|
extern const u8 guid_index[16];
|
||||||
extern const u8 uuid_be_index[16];
|
extern const u8 uuid_index[16];
|
||||||
|
|
||||||
int uuid_le_to_bin(const char *uuid, uuid_le *u);
|
int guid_parse(const char *uuid, guid_t *u);
|
||||||
int uuid_be_to_bin(const char *uuid, uuid_be *u);
|
int uuid_parse(const char *uuid, uuid_t *u);
|
||||||
|
|
||||||
|
/* backwards compatibility, don't use in new code */
|
||||||
|
typedef uuid_t uuid_be;
|
||||||
|
#define UUID_BE(a, _b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
|
||||||
|
UUID_INIT(a, _b, c, d0, d1, d2, d3, d4, d5, d6, d7)
|
||||||
|
#define NULL_UUID_BE \
|
||||||
|
UUID_BE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \
|
||||||
|
0x00, 0x00, 0x00, 0x00)
|
||||||
|
|
||||||
|
#define uuid_le_gen(u) guid_gen(u)
|
||||||
|
#define uuid_be_gen(u) uuid_gen(u)
|
||||||
|
#define uuid_le_to_bin(guid, u) guid_parse(guid, u)
|
||||||
|
#define uuid_be_to_bin(uuid, u) uuid_parse(uuid, u)
|
||||||
|
|
||||||
|
static inline int uuid_le_cmp(const guid_t u1, const guid_t u2)
|
||||||
|
{
|
||||||
|
return memcmp(&u1, &u2, sizeof(guid_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int uuid_be_cmp(const uuid_t u1, const uuid_t u2)
|
||||||
|
{
|
||||||
|
return memcmp(&u1, &u2, sizeof(uuid_t));
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -22,33 +22,21 @@
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
__u8 b[16];
|
__u8 b[16];
|
||||||
} uuid_le;
|
} guid_t;
|
||||||
|
|
||||||
typedef struct {
|
#define GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
|
||||||
__u8 b[16];
|
((guid_t) \
|
||||||
} uuid_be;
|
|
||||||
|
|
||||||
#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
|
|
||||||
((uuid_le) \
|
|
||||||
{{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
|
{{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
|
||||||
(b) & 0xff, ((b) >> 8) & 0xff, \
|
(b) & 0xff, ((b) >> 8) & 0xff, \
|
||||||
(c) & 0xff, ((c) >> 8) & 0xff, \
|
(c) & 0xff, ((c) >> 8) & 0xff, \
|
||||||
(d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
|
(d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
|
||||||
|
|
||||||
#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
|
/* backwards compatibility, don't use in new code */
|
||||||
((uuid_be) \
|
typedef guid_t uuid_le;
|
||||||
{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
|
#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
|
||||||
((b) >> 8) & 0xff, (b) & 0xff, \
|
GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)
|
||||||
((c) >> 8) & 0xff, (c) & 0xff, \
|
|
||||||
(d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
|
|
||||||
|
|
||||||
#define NULL_UUID_LE \
|
#define NULL_UUID_LE \
|
||||||
UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \
|
UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \
|
||||||
0x00, 0x00, 0x00, 0x00)
|
0x00, 0x00, 0x00, 0x00)
|
||||||
|
|
||||||
#define NULL_UUID_BE \
|
|
||||||
UUID_BE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \
|
|
||||||
0x00, 0x00, 0x00, 0x00)
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* _UAPI_LINUX_UUID_H_ */
|
#endif /* _UAPI_LINUX_UUID_H_ */
|
||||||
|
@ -1119,7 +1119,7 @@ static ssize_t bin_uuid(struct file *file,
|
|||||||
/* Only supports reads */
|
/* Only supports reads */
|
||||||
if (oldval && oldlen) {
|
if (oldval && oldlen) {
|
||||||
char buf[UUID_STRING_LEN + 1];
|
char buf[UUID_STRING_LEN + 1];
|
||||||
uuid_be uuid;
|
uuid_t uuid;
|
||||||
|
|
||||||
result = kernel_read(file, 0, buf, sizeof(buf) - 1);
|
result = kernel_read(file, 0, buf, sizeof(buf) - 1);
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
@ -1128,7 +1128,7 @@ static ssize_t bin_uuid(struct file *file,
|
|||||||
buf[result] = '\0';
|
buf[result] = '\0';
|
||||||
|
|
||||||
result = -EIO;
|
result = -EIO;
|
||||||
if (uuid_be_to_bin(buf, &uuid))
|
if (uuid_parse(buf, &uuid))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (oldlen > 16)
|
if (oldlen > 16)
|
||||||
|
@ -11,25 +11,25 @@
|
|||||||
|
|
||||||
struct test_uuid_data {
|
struct test_uuid_data {
|
||||||
const char *uuid;
|
const char *uuid;
|
||||||
uuid_le le;
|
guid_t le;
|
||||||
uuid_be be;
|
uuid_t be;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct test_uuid_data test_uuid_test_data[] = {
|
static const struct test_uuid_data test_uuid_test_data[] = {
|
||||||
{
|
{
|
||||||
.uuid = "c33f4995-3701-450e-9fbf-206a2e98e576",
|
.uuid = "c33f4995-3701-450e-9fbf-206a2e98e576",
|
||||||
.le = UUID_LE(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
|
.le = GUID_INIT(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
|
||||||
.be = UUID_BE(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
|
.be = UUID_INIT(0xc33f4995, 0x3701, 0x450e, 0x9f, 0xbf, 0x20, 0x6a, 0x2e, 0x98, 0xe5, 0x76),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.uuid = "64b4371c-77c1-48f9-8221-29f054fc023b",
|
.uuid = "64b4371c-77c1-48f9-8221-29f054fc023b",
|
||||||
.le = UUID_LE(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
|
.le = GUID_INIT(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
|
||||||
.be = UUID_BE(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
|
.be = UUID_INIT(0x64b4371c, 0x77c1, 0x48f9, 0x82, 0x21, 0x29, 0xf0, 0x54, 0xfc, 0x02, 0x3b),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.uuid = "0cb4ddff-a545-4401-9d06-688af53e7f84",
|
.uuid = "0cb4ddff-a545-4401-9d06-688af53e7f84",
|
||||||
.le = UUID_LE(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
|
.le = GUID_INIT(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
|
||||||
.be = UUID_BE(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
|
.be = UUID_INIT(0x0cb4ddff, 0xa545, 0x4401, 0x9d, 0x06, 0x68, 0x8a, 0xf5, 0x3e, 0x7f, 0x84),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -61,28 +61,28 @@ static void __init test_uuid_failed(const char *prefix, bool wrong, bool be,
|
|||||||
|
|
||||||
static void __init test_uuid_test(const struct test_uuid_data *data)
|
static void __init test_uuid_test(const struct test_uuid_data *data)
|
||||||
{
|
{
|
||||||
uuid_le le;
|
guid_t le;
|
||||||
uuid_be be;
|
uuid_t be;
|
||||||
char buf[48];
|
char buf[48];
|
||||||
|
|
||||||
/* LE */
|
/* LE */
|
||||||
total_tests++;
|
total_tests++;
|
||||||
if (uuid_le_to_bin(data->uuid, &le))
|
if (guid_parse(data->uuid, &le))
|
||||||
test_uuid_failed("conversion", false, false, data->uuid, NULL);
|
test_uuid_failed("conversion", false, false, data->uuid, NULL);
|
||||||
|
|
||||||
total_tests++;
|
total_tests++;
|
||||||
if (uuid_le_cmp(data->le, le)) {
|
if (!guid_equal(&data->le, &le)) {
|
||||||
sprintf(buf, "%pUl", &le);
|
sprintf(buf, "%pUl", &le);
|
||||||
test_uuid_failed("cmp", false, false, data->uuid, buf);
|
test_uuid_failed("cmp", false, false, data->uuid, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* BE */
|
/* BE */
|
||||||
total_tests++;
|
total_tests++;
|
||||||
if (uuid_be_to_bin(data->uuid, &be))
|
if (uuid_parse(data->uuid, &be))
|
||||||
test_uuid_failed("conversion", false, true, data->uuid, NULL);
|
test_uuid_failed("conversion", false, true, data->uuid, NULL);
|
||||||
|
|
||||||
total_tests++;
|
total_tests++;
|
||||||
if (uuid_be_cmp(data->be, be)) {
|
if (uuid_equal(&data->be, &be)) {
|
||||||
sprintf(buf, "%pUb", &be);
|
sprintf(buf, "%pUb", &be);
|
||||||
test_uuid_failed("cmp", false, true, data->uuid, buf);
|
test_uuid_failed("cmp", false, true, data->uuid, buf);
|
||||||
}
|
}
|
||||||
@ -90,17 +90,17 @@ static void __init test_uuid_test(const struct test_uuid_data *data)
|
|||||||
|
|
||||||
static void __init test_uuid_wrong(const char *data)
|
static void __init test_uuid_wrong(const char *data)
|
||||||
{
|
{
|
||||||
uuid_le le;
|
guid_t le;
|
||||||
uuid_be be;
|
uuid_t be;
|
||||||
|
|
||||||
/* LE */
|
/* LE */
|
||||||
total_tests++;
|
total_tests++;
|
||||||
if (!uuid_le_to_bin(data, &le))
|
if (!guid_parse(data, &le))
|
||||||
test_uuid_failed("negative", true, false, data, NULL);
|
test_uuid_failed("negative", true, false, data, NULL);
|
||||||
|
|
||||||
/* BE */
|
/* BE */
|
||||||
total_tests++;
|
total_tests++;
|
||||||
if (!uuid_be_to_bin(data, &be))
|
if (!uuid_parse(data, &be))
|
||||||
test_uuid_failed("negative", true, true, data, NULL);
|
test_uuid_failed("negative", true, true, data, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
33
lib/uuid.c
33
lib/uuid.c
@ -21,10 +21,13 @@
|
|||||||
#include <linux/uuid.h>
|
#include <linux/uuid.h>
|
||||||
#include <linux/random.h>
|
#include <linux/random.h>
|
||||||
|
|
||||||
const u8 uuid_le_index[16] = {3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15};
|
const guid_t guid_null;
|
||||||
EXPORT_SYMBOL(uuid_le_index);
|
EXPORT_SYMBOL(guid_null);
|
||||||
const u8 uuid_be_index[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
|
const uuid_t uuid_null;
|
||||||
EXPORT_SYMBOL(uuid_be_index);
|
EXPORT_SYMBOL(uuid_null);
|
||||||
|
|
||||||
|
const u8 guid_index[16] = {3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15};
|
||||||
|
const u8 uuid_index[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
|
||||||
|
|
||||||
/***************************************************************
|
/***************************************************************
|
||||||
* Random UUID interface
|
* Random UUID interface
|
||||||
@ -53,21 +56,21 @@ static void __uuid_gen_common(__u8 b[16])
|
|||||||
b[8] = (b[8] & 0x3F) | 0x80;
|
b[8] = (b[8] & 0x3F) | 0x80;
|
||||||
}
|
}
|
||||||
|
|
||||||
void uuid_le_gen(uuid_le *lu)
|
void guid_gen(guid_t *lu)
|
||||||
{
|
{
|
||||||
__uuid_gen_common(lu->b);
|
__uuid_gen_common(lu->b);
|
||||||
/* version 4 : random generation */
|
/* version 4 : random generation */
|
||||||
lu->b[7] = (lu->b[7] & 0x0F) | 0x40;
|
lu->b[7] = (lu->b[7] & 0x0F) | 0x40;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(uuid_le_gen);
|
EXPORT_SYMBOL_GPL(guid_gen);
|
||||||
|
|
||||||
void uuid_be_gen(uuid_be *bu)
|
void uuid_gen(uuid_t *bu)
|
||||||
{
|
{
|
||||||
__uuid_gen_common(bu->b);
|
__uuid_gen_common(bu->b);
|
||||||
/* version 4 : random generation */
|
/* version 4 : random generation */
|
||||||
bu->b[6] = (bu->b[6] & 0x0F) | 0x40;
|
bu->b[6] = (bu->b[6] & 0x0F) | 0x40;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(uuid_be_gen);
|
EXPORT_SYMBOL_GPL(uuid_gen);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* uuid_is_valid - checks if UUID string valid
|
* uuid_is_valid - checks if UUID string valid
|
||||||
@ -97,7 +100,7 @@ bool uuid_is_valid(const char *uuid)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(uuid_is_valid);
|
EXPORT_SYMBOL(uuid_is_valid);
|
||||||
|
|
||||||
static int __uuid_to_bin(const char *uuid, __u8 b[16], const u8 ei[16])
|
static int __uuid_parse(const char *uuid, __u8 b[16], const u8 ei[16])
|
||||||
{
|
{
|
||||||
static const u8 si[16] = {0,2,4,6,9,11,14,16,19,21,24,26,28,30,32,34};
|
static const u8 si[16] = {0,2,4,6,9,11,14,16,19,21,24,26,28,30,32,34};
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@ -115,14 +118,14 @@ static int __uuid_to_bin(const char *uuid, __u8 b[16], const u8 ei[16])
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int uuid_le_to_bin(const char *uuid, uuid_le *u)
|
int guid_parse(const char *uuid, guid_t *u)
|
||||||
{
|
{
|
||||||
return __uuid_to_bin(uuid, u->b, uuid_le_index);
|
return __uuid_parse(uuid, u->b, guid_index);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(uuid_le_to_bin);
|
EXPORT_SYMBOL(guid_parse);
|
||||||
|
|
||||||
int uuid_be_to_bin(const char *uuid, uuid_be *u)
|
int uuid_parse(const char *uuid, uuid_t *u)
|
||||||
{
|
{
|
||||||
return __uuid_to_bin(uuid, u->b, uuid_be_index);
|
return __uuid_parse(uuid, u->b, uuid_index);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(uuid_be_to_bin);
|
EXPORT_SYMBOL(uuid_parse);
|
||||||
|
@ -1308,14 +1308,14 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
|
|||||||
char uuid[UUID_STRING_LEN + 1];
|
char uuid[UUID_STRING_LEN + 1];
|
||||||
char *p = uuid;
|
char *p = uuid;
|
||||||
int i;
|
int i;
|
||||||
const u8 *index = uuid_be_index;
|
const u8 *index = uuid_index;
|
||||||
bool uc = false;
|
bool uc = false;
|
||||||
|
|
||||||
switch (*(++fmt)) {
|
switch (*(++fmt)) {
|
||||||
case 'L':
|
case 'L':
|
||||||
uc = true; /* fall-through */
|
uc = true; /* fall-through */
|
||||||
case 'l':
|
case 'l':
|
||||||
index = uuid_le_index;
|
index = guid_index;
|
||||||
break;
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
uc = true;
|
uc = true;
|
||||||
|
@ -130,7 +130,7 @@ void __cleancache_init_shared_fs(struct super_block *sb)
|
|||||||
int pool_id = CLEANCACHE_NO_BACKEND_SHARED;
|
int pool_id = CLEANCACHE_NO_BACKEND_SHARED;
|
||||||
|
|
||||||
if (cleancache_ops) {
|
if (cleancache_ops) {
|
||||||
pool_id = cleancache_ops->init_shared_fs(sb->s_uuid, PAGE_SIZE);
|
pool_id = cleancache_ops->init_shared_fs(&sb->s_uuid, PAGE_SIZE);
|
||||||
if (pool_id < 0)
|
if (pool_id < 0)
|
||||||
pool_id = CLEANCACHE_NO_POOL;
|
pool_id = CLEANCACHE_NO_POOL;
|
||||||
}
|
}
|
||||||
|
@ -75,6 +75,7 @@ static struct vfsmount *shm_mnt;
|
|||||||
#include <uapi/linux/memfd.h>
|
#include <uapi/linux/memfd.h>
|
||||||
#include <linux/userfaultfd_k.h>
|
#include <linux/userfaultfd_k.h>
|
||||||
#include <linux/rmap.h>
|
#include <linux/rmap.h>
|
||||||
|
#include <linux/uuid.h>
|
||||||
|
|
||||||
#include <linux/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
#include <asm/pgtable.h>
|
#include <asm/pgtable.h>
|
||||||
@ -3761,6 +3762,7 @@ int shmem_fill_super(struct super_block *sb, void *data, int silent)
|
|||||||
#ifdef CONFIG_TMPFS_POSIX_ACL
|
#ifdef CONFIG_TMPFS_POSIX_ACL
|
||||||
sb->s_flags |= MS_POSIXACL;
|
sb->s_flags |= MS_POSIXACL;
|
||||||
#endif
|
#endif
|
||||||
|
uuid_gen(&sb->s_uuid);
|
||||||
|
|
||||||
inode = shmem_get_inode(sb, NULL, S_IFDIR | sbinfo->mode, 0, VM_NORESERVE);
|
inode = shmem_get_inode(sb, NULL, S_IFDIR | sbinfo->mode, 0, VM_NORESERVE);
|
||||||
if (!inode)
|
if (!inode)
|
||||||
|
@ -164,7 +164,7 @@ static void hmac_add_misc(struct shash_desc *desc, struct inode *inode,
|
|||||||
hmac_misc.mode = inode->i_mode;
|
hmac_misc.mode = inode->i_mode;
|
||||||
crypto_shash_update(desc, (const u8 *)&hmac_misc, sizeof(hmac_misc));
|
crypto_shash_update(desc, (const u8 *)&hmac_misc, sizeof(hmac_misc));
|
||||||
if (evm_hmac_attrs & EVM_ATTR_FSUUID)
|
if (evm_hmac_attrs & EVM_ATTR_FSUUID)
|
||||||
crypto_shash_update(desc, inode->i_sb->s_uuid,
|
crypto_shash_update(desc, &inode->i_sb->s_uuid.b[0],
|
||||||
sizeof(inode->i_sb->s_uuid));
|
sizeof(inode->i_sb->s_uuid));
|
||||||
crypto_shash_final(desc, digest);
|
crypto_shash_final(desc, digest);
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ struct ima_rule_entry {
|
|||||||
enum ima_hooks func;
|
enum ima_hooks func;
|
||||||
int mask;
|
int mask;
|
||||||
unsigned long fsmagic;
|
unsigned long fsmagic;
|
||||||
u8 fsuuid[16];
|
uuid_t fsuuid;
|
||||||
kuid_t uid;
|
kuid_t uid;
|
||||||
kuid_t fowner;
|
kuid_t fowner;
|
||||||
bool (*uid_op)(kuid_t, kuid_t); /* Handlers for operators */
|
bool (*uid_op)(kuid_t, kuid_t); /* Handlers for operators */
|
||||||
@ -244,7 +244,7 @@ static bool ima_match_rules(struct ima_rule_entry *rule, struct inode *inode,
|
|||||||
&& rule->fsmagic != inode->i_sb->s_magic)
|
&& rule->fsmagic != inode->i_sb->s_magic)
|
||||||
return false;
|
return false;
|
||||||
if ((rule->flags & IMA_FSUUID) &&
|
if ((rule->flags & IMA_FSUUID) &&
|
||||||
memcmp(rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
|
!uuid_equal(&rule->fsuuid, &inode->i_sb->s_uuid))
|
||||||
return false;
|
return false;
|
||||||
if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid, rule->uid))
|
if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid, rule->uid))
|
||||||
return false;
|
return false;
|
||||||
@ -711,14 +711,12 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
|
|||||||
case Opt_fsuuid:
|
case Opt_fsuuid:
|
||||||
ima_log_string(ab, "fsuuid", args[0].from);
|
ima_log_string(ab, "fsuuid", args[0].from);
|
||||||
|
|
||||||
if (memchr_inv(entry->fsuuid, 0x00,
|
if (uuid_is_null(&entry->fsuuid)) {
|
||||||
sizeof(entry->fsuuid))) {
|
|
||||||
result = -EINVAL;
|
result = -EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = blk_part_pack_uuid(args[0].from,
|
result = uuid_parse(args[0].from, &entry->fsuuid);
|
||||||
entry->fsuuid);
|
|
||||||
if (!result)
|
if (!result)
|
||||||
entry->flags |= IMA_FSUUID;
|
entry->flags |= IMA_FSUUID;
|
||||||
break;
|
break;
|
||||||
@ -1087,7 +1085,7 @@ int ima_policy_show(struct seq_file *m, void *v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (entry->flags & IMA_FSUUID) {
|
if (entry->flags & IMA_FSUUID) {
|
||||||
seq_printf(m, "fsuuid=%pU", entry->fsuuid);
|
seq_printf(m, "fsuuid=%pU", &entry->fsuuid);
|
||||||
seq_puts(m, " ");
|
seq_puts(m, " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,9 @@
|
|||||||
#include "skl.h"
|
#include "skl.h"
|
||||||
|
|
||||||
/* Unique identification for getting NHLT blobs */
|
/* Unique identification for getting NHLT blobs */
|
||||||
static u8 OSC_UUID[16] = {0x6E, 0x88, 0x9F, 0xA6, 0xEB, 0x6C, 0x94, 0x45,
|
static guid_t osc_guid =
|
||||||
0xA4, 0x1F, 0x7B, 0x5D, 0xCE, 0x24, 0xC5, 0x53};
|
GUID_INIT(0xA69F886E, 0x6CEB, 0x4594,
|
||||||
|
0xA4, 0x1F, 0x7B, 0x5D, 0xCE, 0x24, 0xC5, 0x53);
|
||||||
|
|
||||||
struct nhlt_acpi_table *skl_nhlt_init(struct device *dev)
|
struct nhlt_acpi_table *skl_nhlt_init(struct device *dev)
|
||||||
{
|
{
|
||||||
@ -37,7 +38,7 @@ struct nhlt_acpi_table *skl_nhlt_init(struct device *dev)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj = acpi_evaluate_dsm(handle, OSC_UUID, 1, 1, NULL);
|
obj = acpi_evaluate_dsm(handle, &osc_guid, 1, 1, NULL);
|
||||||
if (obj && obj->type == ACPI_TYPE_BUFFER) {
|
if (obj && obj->type == ACPI_TYPE_BUFFER) {
|
||||||
nhlt_ptr = (struct nhlt_resource_desc *)obj->buffer.pointer;
|
nhlt_ptr = (struct nhlt_resource_desc *)obj->buffer.pointer;
|
||||||
nhlt_table = (struct nhlt_acpi_table *)
|
nhlt_table = (struct nhlt_acpi_table *)
|
||||||
|
@ -370,7 +370,7 @@ acpi_status __wrap_acpi_evaluate_object(acpi_handle handle, acpi_string path,
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(__wrap_acpi_evaluate_object);
|
EXPORT_SYMBOL(__wrap_acpi_evaluate_object);
|
||||||
|
|
||||||
union acpi_object * __wrap_acpi_evaluate_dsm(acpi_handle handle, const u8 *uuid,
|
union acpi_object * __wrap_acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid,
|
||||||
u64 rev, u64 func, union acpi_object *argv4)
|
u64 rev, u64 func, union acpi_object *argv4)
|
||||||
{
|
{
|
||||||
union acpi_object *obj = ERR_PTR(-ENXIO);
|
union acpi_object *obj = ERR_PTR(-ENXIO);
|
||||||
@ -379,11 +379,11 @@ union acpi_object * __wrap_acpi_evaluate_dsm(acpi_handle handle, const u8 *uuid,
|
|||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
ops = list_first_or_null_rcu(&iomap_head, typeof(*ops), list);
|
ops = list_first_or_null_rcu(&iomap_head, typeof(*ops), list);
|
||||||
if (ops)
|
if (ops)
|
||||||
obj = ops->evaluate_dsm(handle, uuid, rev, func, argv4);
|
obj = ops->evaluate_dsm(handle, guid, rev, func, argv4);
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
|
||||||
if (IS_ERR(obj))
|
if (IS_ERR(obj))
|
||||||
return acpi_evaluate_dsm(handle, uuid, rev, func, argv4);
|
return acpi_evaluate_dsm(handle, guid, rev, func, argv4);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(__wrap_acpi_evaluate_dsm);
|
EXPORT_SYMBOL(__wrap_acpi_evaluate_dsm);
|
||||||
|
@ -1559,7 +1559,7 @@ static unsigned long nfit_ctl_handle;
|
|||||||
union acpi_object *result;
|
union acpi_object *result;
|
||||||
|
|
||||||
static union acpi_object *nfit_test_evaluate_dsm(acpi_handle handle,
|
static union acpi_object *nfit_test_evaluate_dsm(acpi_handle handle,
|
||||||
const u8 *uuid, u64 rev, u64 func, union acpi_object *argv4)
|
const guid_t *guid, u64 rev, u64 func, union acpi_object *argv4)
|
||||||
{
|
{
|
||||||
if (handle != &nfit_ctl_handle)
|
if (handle != &nfit_ctl_handle)
|
||||||
return ERR_PTR(-ENXIO);
|
return ERR_PTR(-ENXIO);
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#ifndef __NFIT_TEST_H__
|
#ifndef __NFIT_TEST_H__
|
||||||
#define __NFIT_TEST_H__
|
#define __NFIT_TEST_H__
|
||||||
#include <linux/list.h>
|
#include <linux/list.h>
|
||||||
|
#include <linux/uuid.h>
|
||||||
#include <linux/ioport.h>
|
#include <linux/ioport.h>
|
||||||
#include <linux/spinlock_types.h>
|
#include <linux/spinlock_types.h>
|
||||||
|
|
||||||
@ -36,7 +37,8 @@ typedef void *acpi_handle;
|
|||||||
|
|
||||||
typedef struct nfit_test_resource *(*nfit_test_lookup_fn)(resource_size_t);
|
typedef struct nfit_test_resource *(*nfit_test_lookup_fn)(resource_size_t);
|
||||||
typedef union acpi_object *(*nfit_test_evaluate_dsm_fn)(acpi_handle handle,
|
typedef union acpi_object *(*nfit_test_evaluate_dsm_fn)(acpi_handle handle,
|
||||||
const u8 *uuid, u64 rev, u64 func, union acpi_object *argv4);
|
const guid_t *guid, u64 rev, u64 func,
|
||||||
|
union acpi_object *argv4);
|
||||||
void __iomem *__wrap_ioremap_nocache(resource_size_t offset,
|
void __iomem *__wrap_ioremap_nocache(resource_size_t offset,
|
||||||
unsigned long size);
|
unsigned long size);
|
||||||
void __wrap_iounmap(volatile void __iomem *addr);
|
void __wrap_iounmap(volatile void __iomem *addr);
|
||||||
|
Loading…
Reference in New Issue
Block a user