anitazha / rpms / ndctl

Forked from rpms/ndctl a year ago
Clone

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

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