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

Submitted by Stanislav Kinsburskiy on Aug. 17, 2017, 2 p.m.

Details

Message ID 20170817140032.23505.43937.stgit@localhost.localdomain
State New
Series "proc connector: containerize on per-VE basis"
Headers show

Commit Message

Stanislav Kinsburskiy Aug. 17, 2017, 2 p.m.
These routines will be called from main connecter per-ve init and fini
routines.

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

Patch hide | download patch | download mbox

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 *,