@@ -144,6 +144,7 @@ struct ndctl_ctx {
struct kmod_ctx *kmod_ctx;
struct daxctl_ctx *daxctl_ctx;
unsigned long timeout;
+ void *private_data;
};
/**
@@ -434,6 +434,16 @@ NDCTL_EXPORT int ndctl_new(struct ndctl_ctx **ctx)
return rc;
}
+NDCTL_EXPORT void ndctl_set_private_data(struct ndctl_ctx *ctx, void *data)
+{
+ ctx->private_data = data;
+}
+
+NDCTL_EXPORT void *ndctl_get_private_data(struct ndctl_ctx *ctx)
+{
+ return ctx->private_data;
+}
+
NDCTL_EXPORT struct daxctl_ctx *ndctl_get_daxctl_ctx(struct ndctl_ctx *ctx)
{
return ctx->daxctl_ctx;
@@ -12,6 +12,8 @@ global:
ndctl_set_log_priority;
ndctl_new;
ndctl_get_daxctl_ctx;
+ ndctl_set_private_data;
+ ndctl_get_private_data;
ndctl_invalidate;
local:
*;
@@ -77,6 +77,8 @@ struct ndctl_ctx;
struct ndctl_ctx *ndctl_ref(struct ndctl_ctx *ctx);
struct ndctl_ctx *ndctl_unref(struct ndctl_ctx *ctx);
int ndctl_new(struct ndctl_ctx **ctx);
+void ndctl_set_private_data(struct ndctl_ctx *ctx, void *data);
+void *ndctl_get_private_data(struct ndctl_ctx *ctx);
struct daxctl_ctx;
struct daxctl_ctx *ndctl_get_daxctl_ctx(struct ndctl_ctx *ctx);
void ndctl_invalidate(struct ndctl_ctx *ctx);
Allow an application to attach private data to the context. The initial motivate is passing the ndctl_test instance into deeper leaf functions of the unit test. Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- ndctl/lib/libndctl-private.h | 1 + ndctl/lib/libndctl.c | 10 ++++++++++ ndctl/lib/libndctl.sym | 2 ++ ndctl/libndctl.h.in | 2 ++ 4 files changed, 15 insertions(+)