aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/connector/connector.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2012-06-29 02:15:21 -0400
committerDavid S. Miller <davem@davemloft.net>2012-06-29 19:46:02 -0400
commita31f2d17b331db970259e875b7223d3aba7e3821 (patch)
tree0d10021be81446ab360f4240b0d16729f518387f /drivers/connector/connector.c
parentdd7f36ba3ce17d4fe85987d83efd5901b0935816 (diff)
netlink: add netlink_kernel_cfg parameter to netlink_kernel_create
This patch adds the following structure: struct netlink_kernel_cfg { unsigned int groups; void (*input)(struct sk_buff *skb); struct mutex *cb_mutex; }; That can be passed to netlink_kernel_create to set optional configurations for netlink kernel sockets. I've populated this structure by looking for NULL and zero parameters at the existing code. The remaining parameters that always need to be set are still left in the original interface. That includes optional parameters for the netlink socket creation. This allows easy extensibility of this interface in the future. This patch also adapts all callers to use this new interface. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/connector/connector.c')
-rw-r--r--drivers/connector/connector.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index 34e0e9e4d913..116cf8d02834 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -251,15 +251,20 @@ static const struct file_operations cn_file_ops = {
251 .release = single_release 251 .release = single_release
252}; 252};
253 253
254static struct cn_dev cdev = {
255 .input = cn_rx_skb,
256};
257
254static int __devinit cn_init(void) 258static int __devinit cn_init(void)
255{ 259{
256 struct cn_dev *dev = &cdev; 260 struct cn_dev *dev = &cdev;
257 261 struct netlink_kernel_cfg cfg = {
258 dev->input = cn_rx_skb; 262 .groups = CN_NETLINK_USERS + 0xf,
263 .input = dev->input,
264 };
259 265
260 dev->nls = netlink_kernel_create(&init_net, NETLINK_CONNECTOR, 266 dev->nls = netlink_kernel_create(&init_net, NETLINK_CONNECTOR,
261 CN_NETLINK_USERS + 0xf, 267 THIS_MODULE, &cfg);
262 dev->input, NULL, THIS_MODULE);
263 if (!dev->nls) 268 if (!dev->nls)
264 return -EIO; 269 return -EIO;
265 270