diff mbox series

[ndctl,v1,2/8] util/json: Print device align

Message ID 20200716184707.23018-3-joao.m.martins@oracle.com
State New
Headers show
Series None | expand

Commit Message

Joao Martins July 16, 2020, 6:47 p.m. UTC
Fetch device align and include it on listings.

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
---
 util/json.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/util/json.c b/util/json.c
index 21ab25674624..4d9787381d6b 100644
--- a/util/json.c
+++ b/util/json.c
@@ -278,7 +278,7 @@  struct json_object *util_daxctl_dev_to_json(struct daxctl_dev *dev,
 	struct daxctl_memory *mem = daxctl_dev_get_memory(dev);
 	const char *devname = daxctl_dev_get_devname(dev);
 	struct json_object *jdev, *jobj;
-	int node, movable;
+	int node, movable, align;
 
 	jdev = json_object_new_object();
 	if (!devname || !jdev)
@@ -299,6 +299,13 @@  struct json_object *util_daxctl_dev_to_json(struct daxctl_dev *dev,
 			json_object_object_add(jdev, "target_node", jobj);
 	}
 
+	align = daxctl_dev_get_align(dev);
+	if (align > 0) {
+		jobj = util_json_object_size(daxctl_dev_get_align(dev), flags);
+		if (jobj)
+			json_object_object_add(jdev, "align", jobj);
+	}
+
 	if (mem)
 		jobj = json_object_new_string("system-ram");
 	else