Commit d1c6e08e authored by Dan Williams's avatar Dan Williams

libnvdimm/labels: Add uuid helpers

In preparation for CXL labels that move the uuid to a different offset
in the label, add nsl_{ref,get,validate}_uuid(). These helpers use the
proper uuid_t type. That type definition predated the libnvdimm
subsystem, so now is as a good a time as any to convert all the uuid
handling in the subsystem to uuid_t to match the helpers.

Note that the uuid fields in the label data and superblocks is not
replaced per Andy's expectation that uuid_t is a kernel internal type
not to appear in external ABI interfaces. So, in those case
{import,export}_uuid() is used to go between the 2 types.

Also note that this rework uncovered some unnecessary copies for label
comparisons, those are cleaned up with nsl_uuid_equal().

As for the whitespace changes, all new code is clang-format compliant.
Reported-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/163116429748.2460985.15659993454313919977.stgit@dwillia2-desk3.amr.corp.intel.comSigned-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent e4e737bb
...@@ -973,7 +973,7 @@ static int btt_arena_write_layout(struct arena_info *arena) ...@@ -973,7 +973,7 @@ static int btt_arena_write_layout(struct arena_info *arena)
u64 sum; u64 sum;
struct btt_sb *super; struct btt_sb *super;
struct nd_btt *nd_btt = arena->nd_btt; struct nd_btt *nd_btt = arena->nd_btt;
const u8 *parent_uuid = nd_dev_to_uuid(&nd_btt->ndns->dev); const uuid_t *parent_uuid = nd_dev_to_uuid(&nd_btt->ndns->dev);
ret = btt_map_init(arena); ret = btt_map_init(arena);
if (ret) if (ret)
...@@ -988,8 +988,8 @@ static int btt_arena_write_layout(struct arena_info *arena) ...@@ -988,8 +988,8 @@ static int btt_arena_write_layout(struct arena_info *arena)
return -ENOMEM; return -ENOMEM;
strncpy(super->signature, BTT_SIG, BTT_SIG_LEN); strncpy(super->signature, BTT_SIG, BTT_SIG_LEN);
memcpy(super->uuid, nd_btt->uuid, 16); export_uuid(super->uuid, nd_btt->uuid);
memcpy(super->parent_uuid, parent_uuid, 16); export_uuid(super->parent_uuid, parent_uuid);
super->flags = cpu_to_le32(arena->flags); super->flags = cpu_to_le32(arena->flags);
super->version_major = cpu_to_le16(arena->version_major); super->version_major = cpu_to_le16(arena->version_major);
super->version_minor = cpu_to_le16(arena->version_minor); super->version_minor = cpu_to_le16(arena->version_minor);
...@@ -1575,7 +1575,8 @@ static void btt_blk_cleanup(struct btt *btt) ...@@ -1575,7 +1575,8 @@ static void btt_blk_cleanup(struct btt *btt)
* Pointer to a new struct btt on success, NULL on failure. * Pointer to a new struct btt on success, NULL on failure.
*/ */
static struct btt *btt_init(struct nd_btt *nd_btt, unsigned long long rawsize, static struct btt *btt_init(struct nd_btt *nd_btt, unsigned long long rawsize,
u32 lbasize, u8 *uuid, struct nd_region *nd_region) u32 lbasize, uuid_t *uuid,
struct nd_region *nd_region)
{ {
int ret; int ret;
struct btt *btt; struct btt *btt;
...@@ -1694,7 +1695,7 @@ int nvdimm_namespace_attach_btt(struct nd_namespace_common *ndns) ...@@ -1694,7 +1695,7 @@ int nvdimm_namespace_attach_btt(struct nd_namespace_common *ndns)
} }
nd_region = to_nd_region(nd_btt->dev.parent); nd_region = to_nd_region(nd_btt->dev.parent);
btt = btt_init(nd_btt, rawsize, nd_btt->lbasize, nd_btt->uuid, btt = btt_init(nd_btt, rawsize, nd_btt->lbasize, nd_btt->uuid,
nd_region); nd_region);
if (!btt) if (!btt)
return -ENOMEM; return -ENOMEM;
nd_btt->btt = btt; nd_btt->btt = btt;
......
...@@ -180,8 +180,8 @@ bool is_nd_btt(struct device *dev) ...@@ -180,8 +180,8 @@ bool is_nd_btt(struct device *dev)
EXPORT_SYMBOL(is_nd_btt); EXPORT_SYMBOL(is_nd_btt);
static struct device *__nd_btt_create(struct nd_region *nd_region, static struct device *__nd_btt_create(struct nd_region *nd_region,
unsigned long lbasize, u8 *uuid, unsigned long lbasize, uuid_t *uuid,
struct nd_namespace_common *ndns) struct nd_namespace_common *ndns)
{ {
struct nd_btt *nd_btt; struct nd_btt *nd_btt;
struct device *dev; struct device *dev;
...@@ -244,14 +244,16 @@ struct device *nd_btt_create(struct nd_region *nd_region) ...@@ -244,14 +244,16 @@ struct device *nd_btt_create(struct nd_region *nd_region)
*/ */
bool nd_btt_arena_is_valid(struct nd_btt *nd_btt, struct btt_sb *super) bool nd_btt_arena_is_valid(struct nd_btt *nd_btt, struct btt_sb *super)
{ {
const u8 *parent_uuid = nd_dev_to_uuid(&nd_btt->ndns->dev); const uuid_t *ns_uuid = nd_dev_to_uuid(&nd_btt->ndns->dev);
uuid_t parent_uuid;
u64 checksum; u64 checksum;
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 (!guid_is_null((guid_t *)&super->parent_uuid)) import_uuid(&parent_uuid, super->parent_uuid);
if (memcmp(super->parent_uuid, parent_uuid, 16) != 0) if (!uuid_is_null(&parent_uuid))
if (!uuid_equal(&parent_uuid, ns_uuid))
return false; return false;
checksum = le64_to_cpu(super->checksum); checksum = le64_to_cpu(super->checksum);
...@@ -319,7 +321,7 @@ static int __nd_btt_probe(struct nd_btt *nd_btt, ...@@ -319,7 +321,7 @@ static int __nd_btt_probe(struct nd_btt *nd_btt,
return rc; return rc;
nd_btt->lbasize = le32_to_cpu(btt_sb->external_lbasize); nd_btt->lbasize = le32_to_cpu(btt_sb->external_lbasize);
nd_btt->uuid = kmemdup(btt_sb->uuid, 16, GFP_KERNEL); nd_btt->uuid = kmemdup(&btt_sb->uuid, sizeof(uuid_t), GFP_KERNEL);
if (!nd_btt->uuid) if (!nd_btt->uuid)
return -ENOMEM; return -ENOMEM;
......
...@@ -206,38 +206,6 @@ struct device *to_nvdimm_bus_dev(struct nvdimm_bus *nvdimm_bus) ...@@ -206,38 +206,6 @@ struct device *to_nvdimm_bus_dev(struct nvdimm_bus *nvdimm_bus)
} }
EXPORT_SYMBOL_GPL(to_nvdimm_bus_dev); EXPORT_SYMBOL_GPL(to_nvdimm_bus_dev);
static bool is_uuid_sep(char sep)
{
if (sep == '\n' || sep == '-' || sep == ':' || sep == '\0')
return true;
return false;
}
static int nd_uuid_parse(struct device *dev, u8 *uuid_out, const char *buf,
size_t len)
{
const char *str = buf;
u8 uuid[16];
int i;
for (i = 0; i < 16; i++) {
if (!isxdigit(str[0]) || !isxdigit(str[1])) {
dev_dbg(dev, "pos: %d buf[%zd]: %c buf[%zd]: %c\n",
i, str - buf, str[0],
str + 1 - buf, str[1]);
return -EINVAL;
}
uuid[i] = (hex_to_bin(str[0]) << 4) | hex_to_bin(str[1]);
str += 2;
if (is_uuid_sep(*str))
str++;
}
memcpy(uuid_out, uuid, sizeof(uuid));
return 0;
}
/** /**
* nd_uuid_store: common implementation for writing 'uuid' sysfs attributes * nd_uuid_store: common implementation for writing 'uuid' sysfs attributes
* @dev: container device for the uuid property * @dev: container device for the uuid property
...@@ -248,21 +216,21 @@ static int nd_uuid_parse(struct device *dev, u8 *uuid_out, const char *buf, ...@@ -248,21 +216,21 @@ static int nd_uuid_parse(struct device *dev, u8 *uuid_out, const char *buf,
* (driver detached) * (driver detached)
* LOCKING: expects nd_device_lock() is held on entry * LOCKING: expects nd_device_lock() is held on entry
*/ */
int nd_uuid_store(struct device *dev, u8 **uuid_out, const char *buf, int nd_uuid_store(struct device *dev, uuid_t **uuid_out, const char *buf,
size_t len) size_t len)
{ {
u8 uuid[16]; uuid_t uuid;
int rc; int rc;
if (dev->driver) if (dev->driver)
return -EBUSY; return -EBUSY;
rc = nd_uuid_parse(dev, uuid, buf, len); rc = uuid_parse(buf, &uuid);
if (rc) if (rc)
return rc; return rc;
kfree(*uuid_out); kfree(*uuid_out);
*uuid_out = kmemdup(uuid, sizeof(uuid), GFP_KERNEL); *uuid_out = kmemdup(&uuid, sizeof(uuid), GFP_KERNEL);
if (!(*uuid_out)) if (!(*uuid_out))
return -ENOMEM; return -ENOMEM;
......
...@@ -321,7 +321,8 @@ static bool preamble_index(struct nvdimm_drvdata *ndd, int idx, ...@@ -321,7 +321,8 @@ static bool preamble_index(struct nvdimm_drvdata *ndd, int idx,
return true; return true;
} }
char *nd_label_gen_id(struct nd_label_id *label_id, u8 *uuid, u32 flags) char *nd_label_gen_id(struct nd_label_id *label_id, const uuid_t *uuid,
u32 flags)
{ {
if (!label_id || !uuid) if (!label_id || !uuid)
return NULL; return NULL;
...@@ -400,9 +401,9 @@ int nd_label_reserve_dpa(struct nvdimm_drvdata *ndd) ...@@ -400,9 +401,9 @@ int nd_label_reserve_dpa(struct nvdimm_drvdata *ndd)
struct nvdimm *nvdimm = to_nvdimm(ndd->dev); struct nvdimm *nvdimm = to_nvdimm(ndd->dev);
struct nd_namespace_label *nd_label; struct nd_namespace_label *nd_label;
struct nd_region *nd_region = NULL; struct nd_region *nd_region = NULL;
u8 label_uuid[NSLABEL_UUID_LEN];
struct nd_label_id label_id; struct nd_label_id label_id;
struct resource *res; struct resource *res;
uuid_t label_uuid;
u32 flags; u32 flags;
nd_label = to_label(ndd, slot); nd_label = to_label(ndd, slot);
...@@ -410,11 +411,11 @@ int nd_label_reserve_dpa(struct nvdimm_drvdata *ndd) ...@@ -410,11 +411,11 @@ int nd_label_reserve_dpa(struct nvdimm_drvdata *ndd)
if (!slot_valid(ndd, nd_label, slot)) if (!slot_valid(ndd, nd_label, slot))
continue; continue;
memcpy(label_uuid, nd_label->uuid, NSLABEL_UUID_LEN); nsl_get_uuid(ndd, nd_label, &label_uuid);
flags = nsl_get_flags(ndd, nd_label); flags = nsl_get_flags(ndd, nd_label);
if (test_bit(NDD_NOBLK, &nvdimm->flags)) if (test_bit(NDD_NOBLK, &nvdimm->flags))
flags &= ~NSLABEL_FLAG_LOCAL; flags &= ~NSLABEL_FLAG_LOCAL;
nd_label_gen_id(&label_id, label_uuid, flags); nd_label_gen_id(&label_id, &label_uuid, flags);
res = nvdimm_allocate_dpa(ndd, &label_id, res = nvdimm_allocate_dpa(ndd, &label_id,
nsl_get_dpa(ndd, nd_label), nsl_get_dpa(ndd, nd_label),
nsl_get_rawsize(ndd, nd_label)); nsl_get_rawsize(ndd, nd_label));
...@@ -851,7 +852,7 @@ static int __pmem_label_update(struct nd_region *nd_region, ...@@ -851,7 +852,7 @@ static int __pmem_label_update(struct nd_region *nd_region,
nd_label = to_label(ndd, slot); nd_label = to_label(ndd, slot);
memset(nd_label, 0, sizeof_namespace_label(ndd)); memset(nd_label, 0, sizeof_namespace_label(ndd));
memcpy(nd_label->uuid, nspm->uuid, NSLABEL_UUID_LEN); nsl_set_uuid(ndd, nd_label, nspm->uuid);
nsl_set_name(ndd, nd_label, nspm->alt_name); nsl_set_name(ndd, nd_label, nspm->alt_name);
nsl_set_flags(ndd, nd_label, flags); nsl_set_flags(ndd, nd_label, flags);
nsl_set_nlabel(ndd, nd_label, nd_region->ndr_mappings); nsl_set_nlabel(ndd, nd_label, nd_region->ndr_mappings);
...@@ -878,9 +879,8 @@ static int __pmem_label_update(struct nd_region *nd_region, ...@@ -878,9 +879,8 @@ static int __pmem_label_update(struct nd_region *nd_region,
list_for_each_entry(label_ent, &nd_mapping->labels, list) { list_for_each_entry(label_ent, &nd_mapping->labels, list) {
if (!label_ent->label) if (!label_ent->label)
continue; continue;
if (test_and_clear_bit(ND_LABEL_REAP, &label_ent->flags) if (test_and_clear_bit(ND_LABEL_REAP, &label_ent->flags) ||
|| memcmp(nspm->uuid, label_ent->label->uuid, nsl_uuid_equal(ndd, label_ent->label, nspm->uuid))
NSLABEL_UUID_LEN) == 0)
reap_victim(nd_mapping, label_ent); reap_victim(nd_mapping, label_ent);
} }
...@@ -1005,7 +1005,6 @@ static int __blk_label_update(struct nd_region *nd_region, ...@@ -1005,7 +1005,6 @@ static int __blk_label_update(struct nd_region *nd_region,
unsigned long *free, *victim_map = NULL; unsigned long *free, *victim_map = NULL;
struct resource *res, **old_res_list; struct resource *res, **old_res_list;
struct nd_label_id label_id; struct nd_label_id label_id;
u8 uuid[NSLABEL_UUID_LEN];
int min_dpa_idx = 0; int min_dpa_idx = 0;
LIST_HEAD(list); LIST_HEAD(list);
u32 nslot, slot; u32 nslot, slot;
...@@ -1043,8 +1042,7 @@ static int __blk_label_update(struct nd_region *nd_region, ...@@ -1043,8 +1042,7 @@ static int __blk_label_update(struct nd_region *nd_region,
/* mark unused labels for garbage collection */ /* mark unused labels for garbage collection */
for_each_clear_bit_le(slot, free, nslot) { for_each_clear_bit_le(slot, free, nslot) {
nd_label = to_label(ndd, slot); nd_label = to_label(ndd, slot);
memcpy(uuid, nd_label->uuid, NSLABEL_UUID_LEN); if (!nsl_uuid_equal(ndd, nd_label, nsblk->uuid))
if (memcmp(uuid, nsblk->uuid, NSLABEL_UUID_LEN) != 0)
continue; continue;
res = to_resource(ndd, nd_label); res = to_resource(ndd, nd_label);
if (res && is_old_resource(res, old_res_list, if (res && is_old_resource(res, old_res_list,
...@@ -1113,7 +1111,7 @@ static int __blk_label_update(struct nd_region *nd_region, ...@@ -1113,7 +1111,7 @@ static int __blk_label_update(struct nd_region *nd_region,
nd_label = to_label(ndd, slot); nd_label = to_label(ndd, slot);
memset(nd_label, 0, sizeof_namespace_label(ndd)); memset(nd_label, 0, sizeof_namespace_label(ndd));
memcpy(nd_label->uuid, nsblk->uuid, NSLABEL_UUID_LEN); nsl_set_uuid(ndd, nd_label, nsblk->uuid);
nsl_set_name(ndd, nd_label, nsblk->alt_name); nsl_set_name(ndd, nd_label, nsblk->alt_name);
nsl_set_flags(ndd, nd_label, NSLABEL_FLAG_LOCAL); nsl_set_flags(ndd, nd_label, NSLABEL_FLAG_LOCAL);
...@@ -1161,8 +1159,7 @@ static int __blk_label_update(struct nd_region *nd_region, ...@@ -1161,8 +1159,7 @@ static int __blk_label_update(struct nd_region *nd_region,
if (!nd_label) if (!nd_label)
continue; continue;
nlabel++; nlabel++;
memcpy(uuid, nd_label->uuid, NSLABEL_UUID_LEN); if (!nsl_uuid_equal(ndd, nd_label, nsblk->uuid))
if (memcmp(uuid, nsblk->uuid, NSLABEL_UUID_LEN) != 0)
continue; continue;
nlabel--; nlabel--;
list_move(&label_ent->list, &list); list_move(&label_ent->list, &list);
...@@ -1192,8 +1189,7 @@ static int __blk_label_update(struct nd_region *nd_region, ...@@ -1192,8 +1189,7 @@ static int __blk_label_update(struct nd_region *nd_region,
} }
for_each_clear_bit_le(slot, free, nslot) { for_each_clear_bit_le(slot, free, nslot) {
nd_label = to_label(ndd, slot); nd_label = to_label(ndd, slot);
memcpy(uuid, nd_label->uuid, NSLABEL_UUID_LEN); if (!nsl_uuid_equal(ndd, nd_label, nsblk->uuid))
if (memcmp(uuid, nsblk->uuid, NSLABEL_UUID_LEN) != 0)
continue; continue;
res = to_resource(ndd, nd_label); res = to_resource(ndd, nd_label);
res->flags &= ~DPA_RESOURCE_ADJUSTED; res->flags &= ~DPA_RESOURCE_ADJUSTED;
...@@ -1273,12 +1269,11 @@ static int init_labels(struct nd_mapping *nd_mapping, int num_labels) ...@@ -1273,12 +1269,11 @@ static int init_labels(struct nd_mapping *nd_mapping, int num_labels)
return max(num_labels, old_num_labels); return max(num_labels, old_num_labels);
} }
static int del_labels(struct nd_mapping *nd_mapping, u8 *uuid) static int del_labels(struct nd_mapping *nd_mapping, uuid_t *uuid)
{ {
struct nvdimm_drvdata *ndd = to_ndd(nd_mapping); struct nvdimm_drvdata *ndd = to_ndd(nd_mapping);
struct nd_label_ent *label_ent, *e; struct nd_label_ent *label_ent, *e;
struct nd_namespace_index *nsindex; struct nd_namespace_index *nsindex;
u8 label_uuid[NSLABEL_UUID_LEN];
unsigned long *free; unsigned long *free;
LIST_HEAD(list); LIST_HEAD(list);
u32 nslot, slot; u32 nslot, slot;
...@@ -1298,8 +1293,7 @@ static int del_labels(struct nd_mapping *nd_mapping, u8 *uuid) ...@@ -1298,8 +1293,7 @@ static int del_labels(struct nd_mapping *nd_mapping, u8 *uuid)
if (!nd_label) if (!nd_label)
continue; continue;
active++; active++;
memcpy(label_uuid, nd_label->uuid, NSLABEL_UUID_LEN); if (!nsl_uuid_equal(ndd, nd_label, uuid))
if (memcmp(label_uuid, uuid, NSLABEL_UUID_LEN) != 0)
continue; continue;
active--; active--;
slot = to_slot(ndd, nd_label); slot = to_slot(ndd, nd_label);
......
This diff is collapsed.
...@@ -126,8 +126,9 @@ void nvdimm_bus_destroy_ndctl(struct nvdimm_bus *nvdimm_bus); ...@@ -126,8 +126,9 @@ void nvdimm_bus_destroy_ndctl(struct nvdimm_bus *nvdimm_bus);
void nd_synchronize(void); void nd_synchronize(void);
void __nd_device_register(struct device *dev); void __nd_device_register(struct device *dev);
struct nd_label_id; struct nd_label_id;
char *nd_label_gen_id(struct nd_label_id *label_id, u8 *uuid, u32 flags); char *nd_label_gen_id(struct nd_label_id *label_id, const uuid_t *uuid,
bool nd_is_uuid_unique(struct device *dev, u8 *uuid); u32 flags);
bool nd_is_uuid_unique(struct device *dev, uuid_t *uuid);
struct nd_region; struct nd_region;
struct nvdimm_drvdata; struct nvdimm_drvdata;
struct nd_mapping; struct nd_mapping;
......
...@@ -177,6 +177,38 @@ static inline void nsl_set_lbasize(struct nvdimm_drvdata *ndd, ...@@ -177,6 +177,38 @@ static inline void nsl_set_lbasize(struct nvdimm_drvdata *ndd,
nd_label->lbasize = __cpu_to_le64(lbasize); nd_label->lbasize = __cpu_to_le64(lbasize);
} }
static inline const uuid_t *nsl_get_uuid(struct nvdimm_drvdata *ndd,
struct nd_namespace_label *nd_label,
uuid_t *uuid)
{
import_uuid(uuid, nd_label->uuid);
return uuid;
}
static inline const uuid_t *nsl_set_uuid(struct nvdimm_drvdata *ndd,
struct nd_namespace_label *nd_label,
const uuid_t *uuid)
{
export_uuid(nd_label->uuid, uuid);
return uuid;
}
static inline bool nsl_uuid_equal(struct nvdimm_drvdata *ndd,
struct nd_namespace_label *nd_label,
const uuid_t *uuid)
{
uuid_t tmp;
import_uuid(&tmp, nd_label->uuid);
return uuid_equal(&tmp, uuid);
}
static inline const u8 *nsl_uuid_raw(struct nvdimm_drvdata *ndd,
struct nd_namespace_label *nd_label)
{
return nd_label->uuid;
}
bool nsl_validate_blk_isetcookie(struct nvdimm_drvdata *ndd, bool nsl_validate_blk_isetcookie(struct nvdimm_drvdata *ndd,
struct nd_namespace_label *nd_label, struct nd_namespace_label *nd_label,
u64 isetcookie); u64 isetcookie);
...@@ -335,7 +367,7 @@ struct nd_btt { ...@@ -335,7 +367,7 @@ struct nd_btt {
struct btt *btt; struct btt *btt;
unsigned long lbasize; unsigned long lbasize;
u64 size; u64 size;
u8 *uuid; uuid_t *uuid;
int id; int id;
int initial_offset; int initial_offset;
u16 version_major; u16 version_major;
...@@ -350,7 +382,7 @@ enum nd_pfn_mode { ...@@ -350,7 +382,7 @@ enum nd_pfn_mode {
struct nd_pfn { struct nd_pfn {
int id; int id;
u8 *uuid; uuid_t *uuid;
struct device dev; struct device dev;
unsigned long align; unsigned long align;
unsigned long npfns; unsigned long npfns;
...@@ -378,7 +410,7 @@ void wait_nvdimm_bus_probe_idle(struct device *dev); ...@@ -378,7 +410,7 @@ void wait_nvdimm_bus_probe_idle(struct device *dev);
void nd_device_register(struct device *dev); void nd_device_register(struct device *dev);
void nd_device_unregister(struct device *dev, enum nd_async_mode mode); void nd_device_unregister(struct device *dev, enum nd_async_mode mode);
void nd_device_notify(struct device *dev, enum nvdimm_event event); void nd_device_notify(struct device *dev, enum nvdimm_event event);
int nd_uuid_store(struct device *dev, u8 **uuid_out, const char *buf, int nd_uuid_store(struct device *dev, uuid_t **uuid_out, const char *buf,
size_t len); size_t len);
ssize_t nd_size_select_show(unsigned long current_size, ssize_t nd_size_select_show(unsigned long current_size,
const unsigned long *supported, char *buf); const unsigned long *supported, char *buf);
...@@ -561,6 +593,6 @@ static inline bool is_bad_pmem(struct badblocks *bb, sector_t sector, ...@@ -561,6 +593,6 @@ static inline bool is_bad_pmem(struct badblocks *bb, sector_t sector,
return false; return false;
} }
resource_size_t nd_namespace_blk_validate(struct nd_namespace_blk *nsblk); resource_size_t nd_namespace_blk_validate(struct nd_namespace_blk *nsblk);
const u8 *nd_dev_to_uuid(struct device *dev); const uuid_t *nd_dev_to_uuid(struct device *dev);
bool pmem_should_map_pages(struct device *dev); bool pmem_should_map_pages(struct device *dev);
#endif /* __ND_H__ */ #endif /* __ND_H__ */
...@@ -452,7 +452,7 @@ int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig) ...@@ -452,7 +452,7 @@ int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig)
unsigned long align, start_pad; unsigned long align, start_pad;
struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb; struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb;
struct nd_namespace_common *ndns = nd_pfn->ndns; struct nd_namespace_common *ndns = nd_pfn->ndns;
const u8 *parent_uuid = nd_dev_to_uuid(&ndns->dev); const uuid_t *parent_uuid = nd_dev_to_uuid(&ndns->dev);
if (!pfn_sb || !ndns) if (!pfn_sb || !ndns)
return -ENODEV; return -ENODEV;
......
...@@ -88,7 +88,7 @@ struct nd_namespace_pmem { ...@@ -88,7 +88,7 @@ struct nd_namespace_pmem {
struct nd_namespace_io nsio; struct nd_namespace_io nsio;
unsigned long lbasize; unsigned long lbasize;
char *alt_name; char *alt_name;
u8 *uuid; uuid_t *uuid;
int id; int id;
}; };
...@@ -105,7 +105,7 @@ struct nd_namespace_pmem { ...@@ -105,7 +105,7 @@ struct nd_namespace_pmem {
struct nd_namespace_blk { struct nd_namespace_blk {
struct nd_namespace_common common; struct nd_namespace_common common;
char *alt_name; char *alt_name;
u8 *uuid; uuid_t *uuid;
int id; int id;
unsigned long lbasize; unsigned long lbasize;
resource_size_t size; resource_size_t size;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment