[Devel] [PATCH RHEL7 COMMIT] connector: add VE SS hook

Konstantin Khorenko khorenko at virtuozzo.com
Thu Aug 31 17:40:45 MSK 2017


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 07e77673691685713f04bd6b84fc0e07eae57158
Author: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
Date:   Thu Aug 31 17:40:45 2017 +0300

    connector: add VE SS hook
    
    And thus containerize connector finally.
    
    https://jira.sw.ru/browse/PSBM-60227
    
    Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
    Reviewed-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 drivers/connector/connector.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index 81854bf..752c692 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -273,8 +273,9 @@ static const struct file_operations cn_file_ops = {
 	.release = single_release
 };
 
-static int cn_init_ve(struct ve_struct *ve)
+static int cn_init_ve(void *data)
 {
+	struct ve_struct *ve = data;
 	struct cn_dev *dev;
 	struct netlink_kernel_cfg cfg = {
 		.groups	= CN_NETLINK_USERS + 0xf,
@@ -326,8 +327,9 @@ static int cn_init_ve(struct ve_struct *ve)
 	return err;
 }
 
-static void cn_fini_ve(struct ve_struct *ve)
+static void cn_fini_ve(void *data)
 {
+	struct ve_struct *ve = data;
 	struct cn_dev *dev = get_cdev(ve);
 	struct net *net = ve->ve_netns;
 
@@ -344,13 +346,28 @@ static void cn_fini_ve(struct ve_struct *ve)
 	ve->cn = NULL;
 }
 
+static struct ve_hook cn_ss_hook = {
+	.init = cn_init_ve,
+	.fini = cn_fini_ve,
+	.priority = HOOK_PRIO_DEFAULT,
+	.owner = THIS_MODULE,
+};
+
 static int cn_init(void)
 {
-	return cn_init_ve(get_ve0());
+	int err;
+
+	err = cn_init_ve(get_ve0());
+	if (err)
+		return err;
+
+	ve_hook_register(VE_SS_CHAIN, &cn_ss_hook);
+	return 0;
 }
 
 static void cn_fini(void)
 {
+	ve_hook_unregister(&cn_ss_hook);
 	return cn_fini_ve(get_ve0());
 }
 


More information about the Devel mailing list