[Devel] [PATCH RH9 17/26] proc connector: add per-ve init and fini foutines

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Thu Oct 7 15:53:57 MSK 2021


From: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>

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

Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
Reviewed-by: Andrey Ryabinin <aryabinin at virtuozzo.com>

(cherry picked from vz8 commit 5e3858a525b434080e43d72e5b5a512c472cb6f7)
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 drivers/connector/cn_proc.c | 18 ++++++++++++++++++
 include/linux/connector.h   |  4 ++++
 2 files changed, 22 insertions(+)

diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c
index d389259447d0..c2f9d31305c1 100644
--- a/drivers/connector/cn_proc.c
+++ b/drivers/connector/cn_proc.c
@@ -16,6 +16,7 @@
 #include <linux/ptrace.h>
 #include <linux/atomic.h>
 #include <linux/pid_namespace.h>
+#include <linux/ve.h>
 
 #include <linux/cn_proc.h>
 #include <linux/local_lock.h>
@@ -352,6 +353,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 acee2c3bfc60..23ba9dd97571 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -64,6 +64,10 @@ struct cn_private {
 };
 
 struct ve_struct;
+
+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,
 		       const struct cb_id *id, const char *name,
 		       void (*callback)(struct cn_msg *,
-- 
2.31.1



More information about the Devel mailing list