diff mbox series

[ndctl,29/36] ndctl/namespace: Update 'pfn' infoblock definition

Message ID 158300775957.2141307.2609326840825793142.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State New, archived
Headers show
Series Multiple topics / backlog for v68 | expand

Commit Message

Dan Williams Feb. 29, 2020, 8:22 p.m. UTC
Grab the latest definition of the pfn infoblock in preparation for
creating a write-infoblock command, and update read-infoblock parsing.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 ndctl/namespace.c |    2 ++
 ndctl/namespace.h |   12 +++++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index cfa0563f59a1..e38151430436 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -1612,6 +1612,8 @@  static json_object *pfn_parse(struct pfn_sb *pfn_sb, struct ndctl_namespace *ndn
 	parse_hex(pfn_sb, start_pad, 32);
 	parse_hex(pfn_sb, end_trunc, 32);
 	parse_hex(pfn_sb, align, 32);
+	parse_hex(pfn_sb, page_size, 32);
+	parse_hex(pfn_sb, page_struct_size, 16);
 
 	return jblock;
 err:
diff --git a/ndctl/namespace.h b/ndctl/namespace.h
index 861dfbfa5127..0f17df20ca3a 100644
--- a/ndctl/namespace.h
+++ b/ndctl/namespace.h
@@ -209,6 +209,12 @@  struct arena_map {
 #define PFN_SIG "NVDIMM_PFN_INFO\0"
 #define DAX_SIG "NVDIMM_DAX_INFO\0"
 
+enum pfn_mode {
+	PFN_MODE_NONE,
+	PFN_MODE_RAM,
+	PFN_MODE_PMEM,
+};
+
 struct pfn_sb {
 	u8 signature[PFN_SIG_LEN];
 	u8 uuid[16];
@@ -224,7 +230,11 @@  struct pfn_sb {
 	le32 end_trunc;
 	/* minor-version-2 record the base alignment of the mapping */
 	le32 align;
-	u8 padding[4000];
+	/* minor-version-3 guarantee the padding and flags are zero */
+	/* minor-version-4 record the page size and struct page size */
+	le32 page_size;
+	le16 page_struct_size;
+	u8 padding[3994];
 	le64 checksum;
 };