[Devel,RHEL7,COMMIT] proc connector: add per-ve init and fini foutines

Submitted by Konstantin Khorenko on Aug. 31, 2017, 2:40 p.m.

Details

Message ID 201708311440.v7VEedId015823@finist_ce7.work
State New
Series "proc connector: containerize on per-VE basis"
Headers show

Commit Message

Konstantin Khorenko Aug. 31, 2017, 2:40 p.m.
The commit is pushed to "branch-rh7-3.10.0-514.26.1.vz7.35.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.26.1.vz7.35.5
------>
commit ed6801f36adefd236c8d87418518763e876fb1ad
Author: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Date:   Thu Aug 31 17:40:38 2017 +0300

    proc connector: add per-ve init and fini foutines
    
    These routines will be called from main connecter per-ve init and fini
    routines.
    
    Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
    Reviewed-by: Andrey Ryabinin <aryabinin@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 *,