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

Submitted by Stanislav Kinsburskiy on Aug. 17, 2017, 1:59 p.m.

Details

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

Commit Message

Stanislav Kinsburskiy Aug. 17, 2017, 1:59 p.m.
Instead of global static device.

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

Patch hide | download patch | download mbox

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@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;