[Devel] [PATCH v2 18/27] proc connector: add per-ve init and fini foutines

Stanislav Kinsburskiy skinsbursky at virtuozzo.com
Thu Aug 17 17:00:33 MSK 2017


These routines will be called from main connecter per-ve init and fini
routines.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
 drivers/connector/cn_proc.c |   17 +++++++++++++++++
 include/linux/connector.h   |    3 +++
 2 files changed, 20 insertions(+)

diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c
index 17a8c8c..8998335 100644
--- a/drivers/connector/cn_proc.c
+++ b/drivers/connector/cn_proc.c
@@ -329,6 +329,23 @@ static void cn_proc_mcast_ctl(struct cn_msg *msg,
 	cn_proc_ack(err, msg->seq, msg->ack);
 }
 
+int cn_proc_init_ve(struct ve_struct *ve)
+{
+	int err = cn_add_callback_ve(ve, &cn_proc_event_id,
+				     "cn_proc",
+				     &cn_proc_mcast_ctl);
+	if (err) {
+		pr_warn("VE#%d: cn_proc failed to register\n", ve->veid);
+		return err;
+	}
+	return 0;
+}
+
+void cn_proc_fini_ve(struct ve_struct *ve)
+{
+	cn_del_callback_ve(ve, &cn_proc_event_id);
+}
+
 /*
  * cn_proc_init - initialization entry point
  *
diff --git a/include/linux/connector.h b/include/linux/connector.h
index 8b44bf0..60eb089 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -76,6 +76,9 @@ struct cn_private {
 
 };
 
+int cn_proc_init_ve(struct ve_struct *ve);
+void cn_proc_fini_ve(struct ve_struct *ve);
+
 int cn_add_callback_ve(struct ve_struct *ve,
 		       struct cb_id *id, const char *name,
 		       void (*callback)(struct cn_msg *,



More information about the Devel mailing list