[Devel] [PATCH 5/6] proc connector: cn_initialized() helper added

Stanislav Kinsburskiy skinsbursky at virtuozzo.com
Tue Aug 15 15:42:14 MSK 2017


This is a precursor helper, which will hide all the containerization magic.

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

diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index 833aea4..e098d6f 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -187,6 +187,11 @@ static void cn_rx_skb(struct sk_buff *__skb)
 	}
 }
 
+static int cn_initialized(struct net *net)
+{
+	return cn_already_initialized;
+}
+
 /*
  * Callback add routing - adds callback with given ID and name.
  * If there is registered callback with the same ID it will not be added.
@@ -197,10 +202,11 @@ int cn_add_callback(struct cb_id *id, const char *name,
 		    void (*callback)(struct cn_msg *,
 				     struct netlink_skb_parms *))
 {
+	struct net *net = get_exec_env()->ve_netns;
 	int err;
 	struct cn_dev *dev = get_cdev();
 
-	if (!cn_already_initialized)
+	if (!cn_initialized(net))
 		return -EAGAIN;
 
 	err = cn_queue_add_callback(dev->cbdev, name, id, callback);



More information about the Devel mailing list