Lines Matching +full:uuid +full:- +full:dev

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright(c) 2013-2016 Intel Corporation. All rights reserved.
12 #include "nd-core.h"
18 static void nd_pfn_release(struct device *dev) in nd_pfn_release() argument
20 struct nd_region *nd_region = to_nd_region(dev->parent); in nd_pfn_release()
21 struct nd_pfn *nd_pfn = to_nd_pfn(dev); in nd_pfn_release()
23 dev_dbg(dev, "trace\n"); in nd_pfn_release()
24 nd_detach_ndns(&nd_pfn->dev, &nd_pfn->ndns); in nd_pfn_release()
25 ida_simple_remove(&nd_region->pfn_ida, nd_pfn->id); in nd_pfn_release()
26 kfree(nd_pfn->uuid); in nd_pfn_release()
30 struct nd_pfn *to_nd_pfn(struct device *dev) in to_nd_pfn() argument
32 struct nd_pfn *nd_pfn = container_of(dev, struct nd_pfn, dev); in to_nd_pfn()
34 WARN_ON(!is_nd_pfn(dev)); in to_nd_pfn()
39 static ssize_t mode_show(struct device *dev, in mode_show() argument
42 struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev); in mode_show()
44 switch (nd_pfn->mode) { in mode_show()
54 static ssize_t mode_store(struct device *dev, in mode_store() argument
57 struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev); in mode_store()
60 device_lock(dev); in mode_store()
61 nvdimm_bus_lock(dev); in mode_store()
62 if (dev->driver) in mode_store()
63 rc = -EBUSY; in mode_store()
65 size_t n = len - 1; in mode_store()
69 nd_pfn->mode = PFN_MODE_PMEM; in mode_store()
72 nd_pfn->mode = PFN_MODE_RAM; in mode_store()
75 nd_pfn->mode = PFN_MODE_NONE; in mode_store()
77 rc = -EINVAL; in mode_store()
79 dev_dbg(dev, "result: %zd wrote: %s%s", rc, buf, in mode_store()
80 buf[len - 1] == '\n' ? "" : "\n"); in mode_store()
81 nvdimm_bus_unlock(dev); in mode_store()
82 device_unlock(dev); in mode_store()
88 static ssize_t align_show(struct device *dev, in align_show() argument
91 struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev); in align_show()
93 return sprintf(buf, "%ld\n", nd_pfn->align); in align_show()
121 static ssize_t align_store(struct device *dev, in align_store() argument
124 struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev); in align_store()
128 device_lock(dev); in align_store()
129 nvdimm_bus_lock(dev); in align_store()
130 rc = nd_size_select_store(dev, buf, &nd_pfn->align, in align_store()
132 dev_dbg(dev, "result: %zd wrote: %s%s", rc, buf, in align_store()
133 buf[len - 1] == '\n' ? "" : "\n"); in align_store()
134 nvdimm_bus_unlock(dev); in align_store()
135 device_unlock(dev); in align_store()
141 static ssize_t uuid_show(struct device *dev, in uuid_show() argument
144 struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev); in uuid_show()
146 if (nd_pfn->uuid) in uuid_show()
147 return sprintf(buf, "%pUb\n", nd_pfn->uuid); in uuid_show()
151 static ssize_t uuid_store(struct device *dev, in uuid_store() argument
154 struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev); in uuid_store()
157 device_lock(dev); in uuid_store()
158 rc = nd_uuid_store(dev, &nd_pfn->uuid, buf, len); in uuid_store()
159 dev_dbg(dev, "result: %zd wrote: %s%s", rc, buf, in uuid_store()
160 buf[len - 1] == '\n' ? "" : "\n"); in uuid_store()
161 device_unlock(dev); in uuid_store()
165 static DEVICE_ATTR_RW(uuid);
167 static ssize_t namespace_show(struct device *dev, in namespace_show() argument
170 struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev); in namespace_show()
173 nvdimm_bus_lock(dev); in namespace_show()
174 rc = sprintf(buf, "%s\n", nd_pfn->ndns in namespace_show()
175 ? dev_name(&nd_pfn->ndns->dev) : ""); in namespace_show()
176 nvdimm_bus_unlock(dev); in namespace_show()
180 static ssize_t namespace_store(struct device *dev, in namespace_store() argument
183 struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev); in namespace_store()
186 device_lock(dev); in namespace_store()
187 nvdimm_bus_lock(dev); in namespace_store()
188 rc = nd_namespace_store(dev, &nd_pfn->ndns, buf, len); in namespace_store()
189 dev_dbg(dev, "result: %zd wrote: %s%s", rc, buf, in namespace_store()
190 buf[len - 1] == '\n' ? "" : "\n"); in namespace_store()
191 nvdimm_bus_unlock(dev); in namespace_store()
192 device_unlock(dev); in namespace_store()
198 static ssize_t resource_show(struct device *dev, in resource_show() argument
201 struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev); in resource_show()
204 device_lock(dev); in resource_show()
205 if (dev->driver) { in resource_show()
206 struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb; in resource_show()
207 u64 offset = __le64_to_cpu(pfn_sb->dataoff); in resource_show()
208 struct nd_namespace_common *ndns = nd_pfn->ndns; in resource_show()
209 u32 start_pad = __le32_to_cpu(pfn_sb->start_pad); in resource_show()
210 struct nd_namespace_io *nsio = to_nd_namespace_io(&ndns->dev); in resource_show()
212 rc = sprintf(buf, "%#llx\n", (unsigned long long) nsio->res.start in resource_show()
216 rc = -ENXIO; in resource_show()
218 device_unlock(dev); in resource_show()
224 static ssize_t size_show(struct device *dev, in size_show() argument
227 struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev); in size_show()
230 device_lock(dev); in size_show()
231 if (dev->driver) { in size_show()
232 struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb; in size_show()
233 u64 offset = __le64_to_cpu(pfn_sb->dataoff); in size_show()
234 struct nd_namespace_common *ndns = nd_pfn->ndns; in size_show()
235 u32 start_pad = __le32_to_cpu(pfn_sb->start_pad); in size_show()
236 u32 end_trunc = __le32_to_cpu(pfn_sb->end_trunc); in size_show()
237 struct nd_namespace_io *nsio = to_nd_namespace_io(&ndns->dev); in size_show()
240 resource_size(&nsio->res) - start_pad in size_show()
241 - end_trunc - offset); in size_show()
244 rc = -ENXIO; in size_show()
246 device_unlock(dev); in size_show()
252 static ssize_t supported_alignments_show(struct device *dev, in supported_alignments_show() argument
290 bool is_nd_pfn(struct device *dev) in is_nd_pfn() argument
292 return dev ? dev->type == &nd_pfn_device_type : false; in is_nd_pfn()
301 struct device *dev; in nd_pfn_devinit() local
306 nd_pfn->mode = PFN_MODE_NONE; in nd_pfn_devinit()
307 nd_pfn->align = nd_pfn_default_alignment(); in nd_pfn_devinit()
308 dev = &nd_pfn->dev; in nd_pfn_devinit()
309 device_initialize(&nd_pfn->dev); in nd_pfn_devinit()
310 lockdep_set_class(&nd_pfn->dev.mutex, &nvdimm_pfn_key); in nd_pfn_devinit()
311 if (ndns && !__nd_attach_ndns(&nd_pfn->dev, ndns, &nd_pfn->ndns)) { in nd_pfn_devinit()
312 dev_dbg(&ndns->dev, "failed, already claimed by %s\n", in nd_pfn_devinit()
313 dev_name(ndns->claim)); in nd_pfn_devinit()
314 put_device(dev); in nd_pfn_devinit()
317 return dev; in nd_pfn_devinit()
323 struct device *dev; in nd_pfn_alloc() local
329 nd_pfn->id = ida_simple_get(&nd_region->pfn_ida, 0, 0, GFP_KERNEL); in nd_pfn_alloc()
330 if (nd_pfn->id < 0) { in nd_pfn_alloc()
335 dev = &nd_pfn->dev; in nd_pfn_alloc()
336 dev_set_name(dev, "pfn%d.%d", nd_region->id, nd_pfn->id); in nd_pfn_alloc()
337 dev->type = &nd_pfn_device_type; in nd_pfn_alloc()
338 dev->parent = &nd_region->dev; in nd_pfn_alloc()
346 struct device *dev; in nd_pfn_create() local
348 if (!is_memory(&nd_region->dev)) in nd_pfn_create()
352 dev = nd_pfn_devinit(nd_pfn, NULL); in nd_pfn_create()
354 nd_device_register(dev); in nd_pfn_create()
355 return dev; in nd_pfn_create()
361 * this is a no-op. Since the memmap area is freshly initialized during
366 struct nd_region *nd_region = to_nd_region(nd_pfn->dev.parent); in nd_pfn_clear_memmap_errors()
367 struct nd_namespace_common *ndns = nd_pfn->ndns; in nd_pfn_clear_memmap_errors()
369 struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb; in nd_pfn_clear_memmap_errors()
374 if (nd_pfn->mode != PFN_MODE_PMEM) in nd_pfn_clear_memmap_errors()
377 nsio = to_nd_namespace_io(&ndns->dev); in nd_pfn_clear_memmap_errors()
379 meta_num = (le64_to_cpu(pfn_sb->dataoff) >> 9) - meta_start; in nd_pfn_clear_memmap_errors()
382 * re-enable the namespace with correct size so that we can access in nd_pfn_clear_memmap_errors()
385 devm_namespace_disable(&nd_pfn->dev, ndns); in nd_pfn_clear_memmap_errors()
386 rc = devm_namespace_enable(&nd_pfn->dev, ndns, le64_to_cpu(pfn_sb->dataoff)); in nd_pfn_clear_memmap_errors()
394 bb_present = badblocks_check(&nd_region->bb, meta_start, in nd_pfn_clear_memmap_errors()
397 dev_dbg(&nd_pfn->dev, "meta: %x badblocks at %llx\n", in nd_pfn_clear_memmap_errors()
399 nsoff = ALIGN_DOWN((nd_region->ndr_start in nd_pfn_clear_memmap_errors()
400 + (first_bad << 9)) - nsio->res.start, in nd_pfn_clear_memmap_errors()
411 zero_len -= chunk; in nd_pfn_clear_memmap_errors()
415 dev_err(&nd_pfn->dev, in nd_pfn_clear_memmap_errors()
442 * nd_pfn_validate - read and validate info-block
446 * Upon return the info-block buffer contents (->pfn_sb) are
447 * indeterminate when validation fails, and a coherent info-block
458 struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb; in nd_pfn_validate()
459 struct nd_namespace_common *ndns = nd_pfn->ndns; in nd_pfn_validate()
460 const uuid_t *parent_uuid = nd_dev_to_uuid(&ndns->dev); in nd_pfn_validate()
463 return -ENODEV; in nd_pfn_validate()
465 if (!is_memory(nd_pfn->dev.parent)) in nd_pfn_validate()
466 return -ENODEV; in nd_pfn_validate()
469 return -ENXIO; in nd_pfn_validate()
471 if (memcmp(pfn_sb->signature, sig, PFN_SIG_LEN) != 0) in nd_pfn_validate()
472 return -ENODEV; in nd_pfn_validate()
474 checksum = le64_to_cpu(pfn_sb->checksum); in nd_pfn_validate()
475 pfn_sb->checksum = 0; in nd_pfn_validate()
477 return -ENODEV; in nd_pfn_validate()
478 pfn_sb->checksum = cpu_to_le64(checksum); in nd_pfn_validate()
480 if (memcmp(pfn_sb->parent_uuid, parent_uuid, 16) != 0) in nd_pfn_validate()
481 return -ENODEV; in nd_pfn_validate()
483 if (__le16_to_cpu(pfn_sb->version_minor) < 1) { in nd_pfn_validate()
484 pfn_sb->start_pad = 0; in nd_pfn_validate()
485 pfn_sb->end_trunc = 0; in nd_pfn_validate()
488 if (__le16_to_cpu(pfn_sb->version_minor) < 2) in nd_pfn_validate()
489 pfn_sb->align = 0; in nd_pfn_validate()
491 if (__le16_to_cpu(pfn_sb->version_minor) < 4) { in nd_pfn_validate()
492 pfn_sb->page_struct_size = cpu_to_le16(64); in nd_pfn_validate()
493 pfn_sb->page_size = cpu_to_le32(PAGE_SIZE); in nd_pfn_validate()
496 switch (le32_to_cpu(pfn_sb->mode)) { in nd_pfn_validate()
501 return -ENXIO; in nd_pfn_validate()
504 align = le32_to_cpu(pfn_sb->align); in nd_pfn_validate()
505 offset = le64_to_cpu(pfn_sb->dataoff); in nd_pfn_validate()
506 start_pad = le32_to_cpu(pfn_sb->start_pad); in nd_pfn_validate()
507 end_trunc = le32_to_cpu(pfn_sb->end_trunc); in nd_pfn_validate()
510 mode = le32_to_cpu(pfn_sb->mode); in nd_pfn_validate()
512 if ((le32_to_cpu(pfn_sb->page_size) > PAGE_SIZE) && in nd_pfn_validate()
514 dev_err(&nd_pfn->dev, in nd_pfn_validate()
516 le32_to_cpu(pfn_sb->page_size)); in nd_pfn_validate()
517 return -EOPNOTSUPP; in nd_pfn_validate()
520 if ((le16_to_cpu(pfn_sb->page_struct_size) < sizeof(struct page)) && in nd_pfn_validate()
522 dev_err(&nd_pfn->dev, in nd_pfn_validate()
524 le16_to_cpu(pfn_sb->page_struct_size)); in nd_pfn_validate()
525 return -EOPNOTSUPP; in nd_pfn_validate()
534 !memcmp(pfn_sb->signature, DAX_SIG, PFN_SIG_LEN)) { in nd_pfn_validate()
535 dev_err(&nd_pfn->dev, "init failed, alignment mismatch: " in nd_pfn_validate()
536 "%ld:%ld\n", nd_pfn->align, align); in nd_pfn_validate()
537 return -EOPNOTSUPP; in nd_pfn_validate()
540 if (!nd_pfn->uuid) { in nd_pfn_validate()
542 * When probing a namepace via nd_pfn_probe() the uuid in nd_pfn_validate()
546 nd_pfn->uuid = kmemdup(pfn_sb->uuid, 16, GFP_KERNEL); in nd_pfn_validate()
547 if (!nd_pfn->uuid) in nd_pfn_validate()
548 return -ENOMEM; in nd_pfn_validate()
549 nd_pfn->align = align; in nd_pfn_validate()
550 nd_pfn->mode = mode; in nd_pfn_validate()
556 if (memcmp(nd_pfn->uuid, pfn_sb->uuid, 16) != 0) in nd_pfn_validate()
557 return -ENODEV; in nd_pfn_validate()
560 * If the uuid validates, but other settings mismatch in nd_pfn_validate()
565 if (nd_pfn->align != align || nd_pfn->mode != mode) { in nd_pfn_validate()
566 dev_err(&nd_pfn->dev, in nd_pfn_validate()
568 dev_dbg(&nd_pfn->dev, "align: %lx:%lx mode: %d:%d\n", in nd_pfn_validate()
569 nd_pfn->align, align, nd_pfn->mode, in nd_pfn_validate()
571 return -EOPNOTSUPP; in nd_pfn_validate()
576 dev_err(&nd_pfn->dev, "alignment: %lx exceeds capacity %llx\n", in nd_pfn_validate()
578 return -EOPNOTSUPP; in nd_pfn_validate()
587 nsio = to_nd_namespace_io(&ndns->dev); in nd_pfn_validate()
588 res = &nsio->res; in nd_pfn_validate()
591 dev_err(&nd_pfn->dev, "pfn array size exceeds capacity of %s\n", in nd_pfn_validate()
592 dev_name(&ndns->dev)); in nd_pfn_validate()
593 return -EOPNOTSUPP; in nd_pfn_validate()
596 if ((align && !IS_ALIGNED(res->start + offset + start_pad, align)) in nd_pfn_validate()
598 dev_err(&nd_pfn->dev, in nd_pfn_validate()
601 return -EOPNOTSUPP; in nd_pfn_validate()
604 if (!IS_ALIGNED(res->start + start_pad, memremap_compat_align())) { in nd_pfn_validate()
605 dev_err(&nd_pfn->dev, "resource start misaligned\n"); in nd_pfn_validate()
606 return -EOPNOTSUPP; in nd_pfn_validate()
609 if (!IS_ALIGNED(res->end + 1 - end_trunc, memremap_compat_align())) { in nd_pfn_validate()
610 dev_err(&nd_pfn->dev, "resource end misaligned\n"); in nd_pfn_validate()
611 return -EOPNOTSUPP; in nd_pfn_validate()
614 if (offset >= (res_size - start_pad - end_trunc)) { in nd_pfn_validate()
615 dev_err(&nd_pfn->dev, "bad offset with small namespace\n"); in nd_pfn_validate()
616 return -EOPNOTSUPP; in nd_pfn_validate()
622 int nd_pfn_probe(struct device *dev, struct nd_namespace_common *ndns) in nd_pfn_probe() argument
628 struct nd_region *nd_region = to_nd_region(ndns->dev.parent); in nd_pfn_probe()
630 if (ndns->force_raw) in nd_pfn_probe()
631 return -ENODEV; in nd_pfn_probe()
633 switch (ndns->claim_class) { in nd_pfn_probe()
638 return -ENODEV; in nd_pfn_probe()
641 nvdimm_bus_lock(&ndns->dev); in nd_pfn_probe()
644 nvdimm_bus_unlock(&ndns->dev); in nd_pfn_probe()
646 return -ENOMEM; in nd_pfn_probe()
647 pfn_sb = devm_kmalloc(dev, sizeof(*pfn_sb), GFP_KERNEL); in nd_pfn_probe()
649 nd_pfn->pfn_sb = pfn_sb; in nd_pfn_probe()
651 dev_dbg(dev, "pfn: %s\n", rc == 0 ? dev_name(pfn_dev) : "<none>"); in nd_pfn_probe()
653 nd_detach_ndns(pfn_dev, &nd_pfn->ndns); in nd_pfn_probe()
663 * We hotplug memory at sub-section granularity, pad the reserved area
678 reserve += base_pfn - SUBSECTION_ALIGN_DOWN(base_pfn); in init_altmap_reserve()
684 struct range *range = &pgmap->range; in __nvdimm_setup_pfn()
685 struct vmem_altmap *altmap = &pgmap->altmap; in __nvdimm_setup_pfn()
686 struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb; in __nvdimm_setup_pfn()
687 u64 offset = le64_to_cpu(pfn_sb->dataoff); in __nvdimm_setup_pfn()
688 u32 start_pad = __le32_to_cpu(pfn_sb->start_pad); in __nvdimm_setup_pfn()
689 u32 end_trunc = __le32_to_cpu(pfn_sb->end_trunc); in __nvdimm_setup_pfn()
691 struct nd_namespace_common *ndns = nd_pfn->ndns; in __nvdimm_setup_pfn()
692 struct nd_namespace_io *nsio = to_nd_namespace_io(&ndns->dev); in __nvdimm_setup_pfn()
693 resource_size_t base = nsio->res.start + start_pad; in __nvdimm_setup_pfn()
694 resource_size_t end = nsio->res.end - end_trunc; in __nvdimm_setup_pfn()
702 .start = nsio->res.start + start_pad, in __nvdimm_setup_pfn()
703 .end = nsio->res.end - end_trunc, in __nvdimm_setup_pfn()
705 pgmap->nr_range = 1; in __nvdimm_setup_pfn()
706 if (nd_pfn->mode == PFN_MODE_RAM) { in __nvdimm_setup_pfn()
708 return -EINVAL; in __nvdimm_setup_pfn()
709 nd_pfn->npfns = le64_to_cpu(pfn_sb->npfns); in __nvdimm_setup_pfn()
710 } else if (nd_pfn->mode == PFN_MODE_PMEM) { in __nvdimm_setup_pfn()
711 nd_pfn->npfns = PHYS_PFN((range_len(range) - offset)); in __nvdimm_setup_pfn()
712 if (le64_to_cpu(nd_pfn->pfn_sb->npfns) > nd_pfn->npfns) in __nvdimm_setup_pfn()
713 dev_info(&nd_pfn->dev, in __nvdimm_setup_pfn()
715 le64_to_cpu(nd_pfn->pfn_sb->npfns), in __nvdimm_setup_pfn()
716 nd_pfn->npfns); in __nvdimm_setup_pfn()
718 altmap->free = PHYS_PFN(offset - reserve); in __nvdimm_setup_pfn()
719 altmap->alloc = 0; in __nvdimm_setup_pfn()
720 pgmap->flags |= PGMAP_ALTMAP_VALID; in __nvdimm_setup_pfn()
722 return -ENXIO; in __nvdimm_setup_pfn()
729 struct nd_namespace_common *ndns = nd_pfn->ndns; in nd_pfn_init()
730 struct nd_namespace_io *nsio = to_nd_namespace_io(&ndns->dev); in nd_pfn_init()
741 pfn_sb = devm_kmalloc(&nd_pfn->dev, sizeof(*pfn_sb), GFP_KERNEL); in nd_pfn_init()
743 return -ENOMEM; in nd_pfn_init()
745 nd_pfn->pfn_sb = pfn_sb; in nd_pfn_init()
746 if (is_nd_dax(&nd_pfn->dev)) in nd_pfn_init()
754 if (rc != -ENODEV) in nd_pfn_init()
760 nd_region = to_nd_region(nd_pfn->dev.parent); in nd_pfn_init()
761 if (nd_region->ro) { in nd_pfn_init()
762 dev_info(&nd_pfn->dev, in nd_pfn_init()
763 "%s is read-only, unable to init metadata\n", in nd_pfn_init()
764 dev_name(&nd_region->dev)); in nd_pfn_init()
765 return -ENXIO; in nd_pfn_init()
768 start = nsio->res.start; in nd_pfn_init()
769 size = resource_size(&nsio->res); in nd_pfn_init()
770 npfns = PHYS_PFN(size - SZ_8K); in nd_pfn_init()
771 align = max(nd_pfn->align, memremap_compat_align()); in nd_pfn_init()
775 * the 'struct nd_pfn_sb' commentary on why ->start_pad is not in nd_pfn_init()
779 dev_err(&nd_pfn->dev, "%s: start %pa misaligned to %#lx\n", in nd_pfn_init()
780 dev_name(&ndns->dev), &start, in nd_pfn_init()
782 return -EINVAL; in nd_pfn_init()
784 end_trunc = start + size - ALIGN_DOWN(start + size, align); in nd_pfn_init()
785 if (nd_pfn->mode == PFN_MODE_PMEM) { in nd_pfn_init()
807 dev_err(&nd_pfn->dev, in nd_pfn_init()
809 return -EINVAL; in nd_pfn_init()
812 offset = ALIGN(start + SZ_8K + page_map_size, align) - start; in nd_pfn_init()
813 } else if (nd_pfn->mode == PFN_MODE_RAM) in nd_pfn_init()
814 offset = ALIGN(start + SZ_8K, align) - start; in nd_pfn_init()
816 return -ENXIO; in nd_pfn_init()
818 if (offset >= (size - end_trunc)) { in nd_pfn_init()
820 dev_err(&nd_pfn->dev, "%s unable to satisfy requested alignment\n", in nd_pfn_init()
821 dev_name(&ndns->dev)); in nd_pfn_init()
822 return -ENXIO; in nd_pfn_init()
825 npfns = PHYS_PFN(size - offset - end_trunc); in nd_pfn_init()
826 pfn_sb->mode = cpu_to_le32(nd_pfn->mode); in nd_pfn_init()
827 pfn_sb->dataoff = cpu_to_le64(offset); in nd_pfn_init()
828 pfn_sb->npfns = cpu_to_le64(npfns); in nd_pfn_init()
829 memcpy(pfn_sb->signature, sig, PFN_SIG_LEN); in nd_pfn_init()
830 memcpy(pfn_sb->uuid, nd_pfn->uuid, 16); in nd_pfn_init()
831 memcpy(pfn_sb->parent_uuid, nd_dev_to_uuid(&ndns->dev), 16); in nd_pfn_init()
832 pfn_sb->version_major = cpu_to_le16(1); in nd_pfn_init()
833 pfn_sb->version_minor = cpu_to_le16(4); in nd_pfn_init()
834 pfn_sb->end_trunc = cpu_to_le32(end_trunc); in nd_pfn_init()
835 pfn_sb->align = cpu_to_le32(nd_pfn->align); in nd_pfn_init()
837 pfn_sb->page_struct_size = cpu_to_le16(sizeof(struct page)); in nd_pfn_init()
839 pfn_sb->page_struct_size = cpu_to_le16(MAX_STRUCT_PAGE_SIZE); in nd_pfn_init()
840 pfn_sb->page_size = cpu_to_le32(PAGE_SIZE); in nd_pfn_init()
842 pfn_sb->checksum = cpu_to_le64(checksum); in nd_pfn_init()
859 if (!nd_pfn->uuid || !nd_pfn->ndns) in nvdimm_setup_pfn()
860 return -ENODEV; in nvdimm_setup_pfn()