Blame SOURCES/0088-ndctl-Rename-util_filter-to-ndctl_filter.patch

2eb93d
From d7c5fa695a91d66485ca1febd6f29c3a483e20f6 Mon Sep 17 00:00:00 2001
2eb93d
From: Dan Williams <dan.j.williams@intel.com>
2eb93d
Date: Sun, 23 Jan 2022 16:52:00 -0800
2eb93d
Subject: [PATCH 088/217] ndctl: Rename util_filter to ndctl_filter
2eb93d
2eb93d
In preparation for introducing a cxl_filter_walk() implementation rename
2eb93d
the current filter_walk infrastructure with an ndctl_ prefix.
2eb93d
2eb93d
Link: https://lore.kernel.org/r/164298552014.3021641.16369576632179722489.stgit@dwillia2-desk3.amr.corp.intel.com
2eb93d
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2eb93d
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
2eb93d
---
2eb93d
 ndctl/filter.c         |  4 ++--
2eb93d
 ndctl/filter.h         | 21 +++++++++++----------
2eb93d
 ndctl/list.c           | 14 +++++++-------
2eb93d
 ndctl/monitor.c        | 12 ++++++------
2eb93d
 test/list-smart-dimm.c | 12 ++++++------
2eb93d
 5 files changed, 32 insertions(+), 31 deletions(-)
2eb93d
2eb93d
diff -up ndctl-71.1/ndctl/filter.c.orig ndctl-71.1/ndctl/filter.c
2eb93d
--- ndctl-71.1/ndctl/filter.c.orig	2022-10-07 17:54:40.799788014 -0400
2eb93d
+++ ndctl-71.1/ndctl/filter.c	2022-10-07 17:54:52.592828166 -0400
2eb93d
@@ -338,8 +338,8 @@ const char *util_nsmode_name(enum ndctl_
2eb93d
 	return modes[mode];
2eb93d
 }
2eb93d
 
2eb93d
-int util_filter_walk(struct ndctl_ctx *ctx, struct util_filter_ctx *fctx,
2eb93d
-		struct util_filter_params *param)
2eb93d
+int ndctl_filter_walk(struct ndctl_ctx *ctx, struct ndctl_filter_ctx *fctx,
2eb93d
+		      struct ndctl_filter_params *param)
2eb93d
 {
2eb93d
 	struct ndctl_bus *bus;
2eb93d
 	unsigned int type = 0;
2eb93d
diff -up ndctl-71.1/ndctl/filter.h.orig ndctl-71.1/ndctl/filter.h
2eb93d
--- ndctl-71.1/ndctl/filter.h.orig	2022-10-07 17:54:40.799788014 -0400
2eb93d
+++ ndctl-71.1/ndctl/filter.h	2022-10-07 17:54:52.593828169 -0400
2eb93d
@@ -31,7 +31,7 @@ const char *util_nsmode_name(enum ndctl_
2eb93d
 
2eb93d
 struct json_object;
2eb93d
 
2eb93d
-/* json object hierarchy for the util_filter_walk() performed by cmd_list() */
2eb93d
+/* json object hierarchy for the ndctl_filter_walk() performed by cmd_list() */
2eb93d
 struct list_filter_arg {
2eb93d
 	struct json_object *jnamespaces;
2eb93d
 	struct json_object *jregions;
2eb93d
@@ -50,19 +50,20 @@ struct monitor_filter_arg {
2eb93d
 };
2eb93d
 
2eb93d
 /*
2eb93d
- * struct util_filter_ctx - control and callbacks for util_filter_walk()
2eb93d
+ * struct ndctl_filter_ctx - control and callbacks for ndctl_filter_walk()
2eb93d
  * ->filter_bus() and ->filter_region() return bool because the
2eb93d
  * child-object filter routines can not be called if the parent context
2eb93d
  * is not established. ->filter_dimm() and ->filter_namespace() are leaf
2eb93d
  * objects, so no child dependencies to check.
2eb93d
  */
2eb93d
-struct util_filter_ctx {
2eb93d
-	bool (*filter_bus)(struct ndctl_bus *bus, struct util_filter_ctx *ctx);
2eb93d
-	void (*filter_dimm)(struct ndctl_dimm *dimm, struct util_filter_ctx *ctx);
2eb93d
+struct ndctl_filter_ctx {
2eb93d
+	bool (*filter_bus)(struct ndctl_bus *bus, struct ndctl_filter_ctx *ctx);
2eb93d
+	void (*filter_dimm)(struct ndctl_dimm *dimm,
2eb93d
+			    struct ndctl_filter_ctx *ctx);
2eb93d
 	bool (*filter_region)(struct ndctl_region *region,
2eb93d
-			struct util_filter_ctx *ctx);
2eb93d
+			      struct ndctl_filter_ctx *ctx);
2eb93d
 	void (*filter_namespace)(struct ndctl_namespace *ndns,
2eb93d
-			struct util_filter_ctx *ctx);
2eb93d
+				 struct ndctl_filter_ctx *ctx);
2eb93d
 	union {
2eb93d
 		void *arg;
2eb93d
 		struct list_filter_arg *list;
2eb93d
@@ -70,7 +71,7 @@ struct util_filter_ctx {
2eb93d
 	};
2eb93d
 };
2eb93d
 
2eb93d
-struct util_filter_params {
2eb93d
+struct ndctl_filter_params {
2eb93d
 	const char *bus;
2eb93d
 	const char *region;
2eb93d
 	const char *type;
2eb93d
@@ -81,6 +82,6 @@ struct util_filter_params {
2eb93d
 };
2eb93d
 
2eb93d
 struct ndctl_ctx;
2eb93d
-int util_filter_walk(struct ndctl_ctx *ctx, struct util_filter_ctx *fctx,
2eb93d
-		struct util_filter_params *param);
2eb93d
+int ndctl_filter_walk(struct ndctl_ctx *ctx, struct ndctl_filter_ctx *fctx,
2eb93d
+		      struct ndctl_filter_params *param);
2eb93d
 #endif /* _NDCTL_UTIL_FILTER_H_ */
2eb93d
diff -up ndctl-71.1/ndctl/list.c.orig ndctl-71.1/ndctl/list.c
2eb93d
--- ndctl-71.1/ndctl/list.c.orig	2022-10-07 17:54:40.806788038 -0400
2eb93d
+++ ndctl-71.1/ndctl/list.c	2022-10-07 17:54:52.593828169 -0400
2eb93d
@@ -55,7 +55,7 @@ static unsigned long listopts_to_flags(v
2eb93d
 	return flags;
2eb93d
 }
2eb93d
 
2eb93d
-static struct util_filter_params param;
2eb93d
+static struct ndctl_filter_params param;
2eb93d
 
2eb93d
 static int did_fail;
2eb93d
 
2eb93d
@@ -234,7 +234,7 @@ static struct json_object *region_to_jso
2eb93d
 }
2eb93d
 
2eb93d
 static void filter_namespace(struct ndctl_namespace *ndns,
2eb93d
-		struct util_filter_ctx *ctx)
2eb93d
+			     struct ndctl_filter_ctx *ctx)
2eb93d
 {
2eb93d
 	struct json_object *jndns;
2eb93d
 	struct list_filter_arg *lfa = ctx->list;
2eb93d
@@ -272,7 +272,7 @@ static void filter_namespace(struct ndct
2eb93d
 }
2eb93d
 
2eb93d
 static bool filter_region(struct ndctl_region *region,
2eb93d
-		struct util_filter_ctx *ctx)
2eb93d
+			  struct ndctl_filter_ctx *ctx)
2eb93d
 {
2eb93d
 	struct list_filter_arg *lfa = ctx->list;
2eb93d
 	struct json_object *jbus = lfa->jbus;
2eb93d
@@ -318,7 +318,7 @@ static bool filter_region(struct ndctl_r
2eb93d
 	return true;
2eb93d
 }
2eb93d
 
2eb93d
-static void filter_dimm(struct ndctl_dimm *dimm, struct util_filter_ctx *ctx)
2eb93d
+static void filter_dimm(struct ndctl_dimm *dimm, struct ndctl_filter_ctx *ctx)
2eb93d
 {
2eb93d
 	struct list_filter_arg *lfa = ctx->list;
2eb93d
 	struct json_object *jdimm;
2eb93d
@@ -367,7 +367,7 @@ static void filter_dimm(struct ndctl_dim
2eb93d
 	json_object_array_add(lfa->jdimms, jdimm);
2eb93d
 }
2eb93d
 
2eb93d
-static bool filter_bus(struct ndctl_bus *bus, struct util_filter_ctx *ctx)
2eb93d
+static bool filter_bus(struct ndctl_bus *bus, struct ndctl_filter_ctx *ctx)
2eb93d
 {
2eb93d
 	struct list_filter_arg *lfa = ctx->list;
2eb93d
 
2eb93d
@@ -489,7 +489,7 @@ int cmd_list(int argc, const char **argv
2eb93d
 		NULL
2eb93d
 	};
2eb93d
 	bool lint = !!secure_getenv("NDCTL_LIST_LINT");
2eb93d
-	struct util_filter_ctx fctx = { 0 };
2eb93d
+	struct ndctl_filter_ctx fctx = { 0 };
2eb93d
 	struct list_filter_arg lfa = { 0 };
2eb93d
 	int i, rc;
2eb93d
 
2eb93d
@@ -544,7 +544,7 @@ int cmd_list(int argc, const char **argv
2eb93d
 	fctx.list = &lfa;
2eb93d
 	lfa.flags = listopts_to_flags();
2eb93d
 
2eb93d
-	rc = util_filter_walk(ctx, &fctx, ¶m;;
2eb93d
+	rc = ndctl_filter_walk(ctx, &fctx, ¶m;;
2eb93d
 	if (rc)
2eb93d
 		return rc;
2eb93d
 
2eb93d
diff -up ndctl-71.1/ndctl/monitor.c.orig ndctl-71.1/ndctl/monitor.c
2eb93d
--- ndctl-71.1/ndctl/monitor.c.orig	2022-10-07 17:54:40.824788100 -0400
2eb93d
+++ ndctl-71.1/ndctl/monitor.c	2022-10-07 17:55:08.025880711 -0400
2eb93d
@@ -48,7 +48,7 @@ struct monitor_dimm {
2eb93d
 	struct list_node list;
2eb93d
 };
2eb93d
 
2eb93d
-static struct util_filter_params param;
2eb93d
+static struct ndctl_filter_params param;
2eb93d
 
2eb93d
 static int did_fail;
2eb93d
 
2eb93d
@@ -263,12 +263,12 @@ out:
2eb93d
 }
2eb93d
 
2eb93d
 static bool filter_region(struct ndctl_region *region,
2eb93d
-		struct util_filter_ctx *fctx)
2eb93d
+			  struct ndctl_filter_ctx *fctx)
2eb93d
 {
2eb93d
 	return true;
2eb93d
 }
2eb93d
 
2eb93d
-static void filter_dimm(struct ndctl_dimm *dimm, struct util_filter_ctx *fctx)
2eb93d
+static void filter_dimm(struct ndctl_dimm *dimm, struct ndctl_filter_ctx *fctx)
2eb93d
 {
2eb93d
 	struct monitor_dimm *mdimm;
2eb93d
 	struct monitor_filter_arg *mfa = fctx->monitor;
2eb93d
@@ -316,7 +316,7 @@ static void filter_dimm(struct ndctl_dim
2eb93d
 	return;
2eb93d
 }
2eb93d
 
2eb93d
-static bool filter_bus(struct ndctl_bus *bus, struct util_filter_ctx *fctx)
2eb93d
+static bool filter_bus(struct ndctl_bus *bus, struct ndctl_filter_ctx *fctx)
2eb93d
 {
2eb93d
 	return true;
2eb93d
 }
2eb93d
@@ -481,7 +481,7 @@ static void parse_config(const char **ar
2eb93d
 }
2eb93d
 
2eb93d
 static int read_config_file(struct ndctl_ctx *ctx, struct monitor *_monitor,
2eb93d
-		struct util_filter_params *_param)
2eb93d
+		struct ndctl_filter_params *_param)
2eb93d
 {
2eb93d
 	FILE *f;
2eb93d
 	size_t len = 0;
2eb93d
@@ -603,7 +603,7 @@ int cmd_monitor(int argc, const char **a
2eb93d
 		NULL
2eb93d
 	};
2eb93d
 	const char *prefix = "./";
2eb93d
-	struct util_filter_ctx fctx = { 0 };
2eb93d
+	struct ndctl_filter_ctx fctx = { 0 };
2eb93d
 	struct monitor_filter_arg mfa = { 0 };
2eb93d
 	int i, rc;
2eb93d
 
2eb93d
@@ -667,7 +667,7 @@ int cmd_monitor(int argc, const char **a
2eb93d
 	mfa.maxfd_dimm = -1;
2eb93d
 	mfa.flags = 0;
2eb93d
 
2eb93d
-	rc = util_filter_walk(ctx, &fctx, ¶m;;
2eb93d
+	rc = ndctl_filter_walk(ctx, &fctx, ¶m;;
2eb93d
 	if (rc)
2eb93d
 		goto out;
2eb93d
 
2eb93d
diff -up ndctl-71.1/test/list-smart-dimm.c.orig ndctl-71.1/test/list-smart-dimm.c
2eb93d
--- ndctl-71.1/test/list-smart-dimm.c.orig	2022-10-07 17:54:40.813788062 -0400
2eb93d
+++ ndctl-71.1/test/list-smart-dimm.c	2022-10-07 17:54:52.595828176 -0400
2eb93d
@@ -11,7 +11,7 @@
2eb93d
 #include <ndctl/ndctl.h>
2eb93d
 #include <ndctl/json.h>
2eb93d
 
2eb93d
-struct util_filter_params param;
2eb93d
+struct ndctl_filter_params param;
2eb93d
 static int did_fail;
2eb93d
 static int jflag = JSON_C_TO_STRING_PRETTY;
2eb93d
 
2eb93d
@@ -23,12 +23,12 @@ do { \
2eb93d
 } while (0)
2eb93d
 
2eb93d
 static bool filter_region(struct ndctl_region *region,
2eb93d
-		struct util_filter_ctx *ctx)
2eb93d
+		struct ndctl_filter_ctx *ctx)
2eb93d
 {
2eb93d
 	return true;
2eb93d
 }
2eb93d
 
2eb93d
-static void filter_dimm(struct ndctl_dimm *dimm, struct util_filter_ctx *ctx)
2eb93d
+static void filter_dimm(struct ndctl_dimm *dimm, struct ndctl_filter_ctx *ctx)
2eb93d
 {
2eb93d
 	struct list_filter_arg *lfa = ctx->list;
2eb93d
 	struct json_object *jdimm;
2eb93d
@@ -57,7 +57,7 @@ static void filter_dimm(struct ndctl_dim
2eb93d
 	json_object_array_add(lfa->jdimms, jdimm);
2eb93d
 }
2eb93d
 
2eb93d
-static bool filter_bus(struct ndctl_bus *bus, struct util_filter_ctx *ctx)
2eb93d
+static bool filter_bus(struct ndctl_bus *bus, struct ndctl_filter_ctx *ctx)
2eb93d
 {
2eb93d
 	return true;
2eb93d
 }
2eb93d
@@ -89,7 +89,7 @@ int main(int argc, const char *argv[])
2eb93d
 		"list-smart-dimm [<options>]",
2eb93d
 		NULL
2eb93d
 	};
2eb93d
-	struct util_filter_ctx fctx = { 0 };
2eb93d
+	struct ndctl_filter_ctx fctx = { 0 };
2eb93d
 	struct list_filter_arg lfa = { 0 };
2eb93d
 
2eb93d
 	rc = ndctl_new(&ctx;;
2eb93d
@@ -108,7 +108,7 @@ int main(int argc, const char *argv[])
2eb93d
 	fctx.list = &lfa;
2eb93d
 	lfa.flags = 0;
2eb93d
 
2eb93d
-	rc = util_filter_walk(ctx, &fctx, ¶m;;
2eb93d
+	rc = ndctl_filter_walk(ctx, &fctx, ¶m;;
2eb93d
 	if (rc)
2eb93d
 		return rc;
2eb93d
 
2eb93d
diff -up ndctl-71.1/util/filter.c.orig ndctl-71.1/util/filter.c
2eb93d
--- ndctl-71.1/util/filter.c.orig	2022-10-07 17:55:48.192017464 -0400
2eb93d
+++ ndctl-71.1/util/filter.c	2022-10-07 17:55:54.474038852 -0400
2eb93d
@@ -394,8 +394,8 @@ const char *util_nsmode_name(enum ndctl_
2eb93d
 	return modes[mode];
2eb93d
 }
2eb93d
 
2eb93d
-int util_filter_walk(struct ndctl_ctx *ctx, struct util_filter_ctx *fctx,
2eb93d
-		struct util_filter_params *param)
2eb93d
+int ndctl_filter_walk(struct ndctl_ctx *ctx, struct util_filter_ctx *fctx,
2eb93d
+		      struct util_filter_params *param)
2eb93d
 {
2eb93d
 	struct ndctl_bus *bus;
2eb93d
 	unsigned int type = 0;