diff mbox series

[daxctl,v2,2/5] util/json: Print device align

Message ID 20201216224833.6229-3-joao.m.martins@oracle.com (mailing list archive)
State New, archived
Headers show
Series daxctl: device align support | expand

Commit Message

Joao Martins Dec. 16, 2020, 10:48 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 77bd4781551d..357dff20d6be 100644
--- a/util/json.c
+++ b/util/json.c
@@ -455,7 +455,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)
@@ -476,6 +476,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