[Devel] [PATCH v2 05/27] connector: use device stored in VE

Stanislav Kinsburskiy skinsbursky at virtuozzo.com
Thu Aug 17 16:59:27 MSK 2017


Instead of global static device.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
 drivers/connector/connector.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index f5484b2..bc2308a 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -38,8 +38,6 @@ MODULE_AUTHOR("Evgeniy Polyakov <zbr at ioremap.net>");
 MODULE_DESCRIPTION("Generic userspace <-> kernelspace connector.");
 MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_CONNECTOR);
 
-static struct cn_dev cdev;
-
 static int cn_already_initialized;
 
 /*
@@ -66,7 +64,7 @@ static int cn_already_initialized;
 
 static struct cn_dev *get_cdev(struct ve_struct *ve)
 {
-	return &cdev;
+	return &ve->cn->cdev;
 }
 
 int cn_netlink_send(struct cn_msg *msg, u32 __group, gfp_t gfp_mask)
@@ -261,7 +259,7 @@ static const struct file_operations cn_file_ops = {
 
 static int cn_init_ve(struct ve_struct *ve)
 {
-	struct cn_dev *dev = get_cdev(get_ve0());
+	struct cn_dev *dev;
 	struct netlink_kernel_cfg cfg = {
 		.groups	= CN_NETLINK_USERS + 0xf,
 		.input	= cn_rx_skb,
@@ -272,6 +270,8 @@ static int cn_init_ve(struct ve_struct *ve)
 	if (!ve->cn)
 		return -ENOMEM;
 
+	dev = &ve->cn->cdev;
+
 	dev->nls = netlink_kernel_create(net, NETLINK_CONNECTOR, &cfg);
 	if (!dev->nls)
 		return -EIO;



More information about the Devel mailing list