aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2009-10-01 22:40:05 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-02 13:54:01 -0400
commit7069331dbe7155f23966f5944109f909fea0c7e4 (patch)
tree5ea80628d1bf5e776a540ee84814f085c9adff04
parent293500a23f4b0698cb04abfecfc9a954d8ab2742 (diff)
connector: Provide the sender's credentials to the callback
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Acked-by: Lars Ellenberg <lars.ellenberg@linbit.com> Acked-by: Evgeniy Polyakov <zbr@ioremap.net> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--Documentation/connector/cn_test.c2
-rw-r--r--Documentation/connector/connector.txt8
-rw-r--r--drivers/connector/cn_queue.c7
-rw-r--r--drivers/connector/connector.c4
-rw-r--r--drivers/md/dm-log-userspace-transfer.c2
-rw-r--r--drivers/staging/dst/dcore.c2
-rw-r--r--drivers/staging/pohmelfs/config.c2
-rw-r--r--drivers/video/uvesafb.c2
-rw-r--r--drivers/w1/w1_netlink.c2
-rw-r--r--include/linux/connector.h6
10 files changed, 19 insertions, 18 deletions
diff --git a/Documentation/connector/cn_test.c b/Documentation/connector/cn_test.c
index 1711adc3337..b07add3467f 100644
--- a/Documentation/connector/cn_test.c
+++ b/Documentation/connector/cn_test.c
@@ -34,7 +34,7 @@ static char cn_test_name[] = "cn_test";
34static struct sock *nls; 34static struct sock *nls;
35static struct timer_list cn_test_timer; 35static struct timer_list cn_test_timer;
36 36
37static void cn_test_callback(struct cn_msg *msg) 37static void cn_test_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
38{ 38{
39 pr_info("%s: %lu: idx=%x, val=%x, seq=%u, ack=%u, len=%d: %s.\n", 39 pr_info("%s: %lu: idx=%x, val=%x, seq=%u, ack=%u, len=%d: %s.\n",
40 __func__, jiffies, msg->id.idx, msg->id.val, 40 __func__, jiffies, msg->id.idx, msg->id.val,
diff --git a/Documentation/connector/connector.txt b/Documentation/connector/connector.txt
index 81e6bf6ead5..78c9466a9aa 100644
--- a/Documentation/connector/connector.txt
+++ b/Documentation/connector/connector.txt
@@ -23,7 +23,7 @@ handling, etc... The Connector driver allows any kernelspace agents to use
23netlink based networking for inter-process communication in a significantly 23netlink based networking for inter-process communication in a significantly
24easier way: 24easier way:
25 25
26int cn_add_callback(struct cb_id *id, char *name, void (*callback) (void *)); 26int cn_add_callback(struct cb_id *id, char *name, void (*callback) (struct cn_msg *, struct netlink_skb_parms *));
27void cn_netlink_send(struct cn_msg *msg, u32 __group, int gfp_mask); 27void cn_netlink_send(struct cn_msg *msg, u32 __group, int gfp_mask);
28 28
29struct cb_id 29struct cb_id
@@ -53,15 +53,15 @@ struct cn_msg
53Connector interfaces. 53Connector interfaces.
54/*****************************************/ 54/*****************************************/
55 55
56int cn_add_callback(struct cb_id *id, char *name, void (*callback) (void *)); 56int cn_add_callback(struct cb_id *id, char *name, void (*callback) (struct cn_msg *, struct netlink_skb_parms *));
57 57
58 Registers new callback with connector core. 58 Registers new callback with connector core.
59 59
60 struct cb_id *id - unique connector's user identifier. 60 struct cb_id *id - unique connector's user identifier.
61 It must be registered in connector.h for legal in-kernel users. 61 It must be registered in connector.h for legal in-kernel users.
62 char *name - connector's callback symbolic name. 62 char *name - connector's callback symbolic name.
63 void (*callback) (void *) - connector's callback. 63 void (*callback) (struct cn..) - connector's callback.
64 Argument must be dereferenced to struct cn_msg *. 64 cn_msg and the sender's credentials
65 65
66 66
67void cn_del_callback(struct cb_id *id); 67void cn_del_callback(struct cb_id *id);
diff --git a/drivers/connector/cn_queue.c b/drivers/connector/cn_queue.c
index b4cfac93f72..163c3e3d0d1 100644
--- a/drivers/connector/cn_queue.c
+++ b/drivers/connector/cn_queue.c
@@ -79,8 +79,9 @@ void cn_queue_wrapper(struct work_struct *work)
79 container_of(work, struct cn_callback_entry, work); 79 container_of(work, struct cn_callback_entry, work);
80 struct cn_callback_data *d = &cbq->data; 80 struct cn_callback_data *d = &cbq->data;
81 struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(d->skb)); 81 struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(d->skb));
82 struct netlink_skb_parms *nsp = &NETLINK_CB(d->skb);
82 83
83 d->callback(msg); 84 d->callback(msg, nsp);
84 85
85 d->destruct_data(d->ddata); 86 d->destruct_data(d->ddata);
86 d->ddata = NULL; 87 d->ddata = NULL;
@@ -90,7 +91,7 @@ void cn_queue_wrapper(struct work_struct *work)
90 91
91static struct cn_callback_entry * 92static struct cn_callback_entry *
92cn_queue_alloc_callback_entry(char *name, struct cb_id *id, 93cn_queue_alloc_callback_entry(char *name, struct cb_id *id,
93 void (*callback)(struct cn_msg *)) 94 void (*callback)(struct cn_msg *, struct netlink_skb_parms *))
94{ 95{
95 struct cn_callback_entry *cbq; 96 struct cn_callback_entry *cbq;
96 97
@@ -124,7 +125,7 @@ int cn_cb_equal(struct cb_id *i1, struct cb_id *i2)
124} 125}
125 126
126int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, 127int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id,
127 void (*callback)(struct cn_msg *)) 128 void (*callback)(struct cn_msg *, struct netlink_skb_parms *))
128{ 129{
129 struct cn_callback_entry *cbq, *__cbq; 130 struct cn_callback_entry *cbq, *__cbq;
130 int found = 0; 131 int found = 0;
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index fc9887fa453..e59f0ab8f82 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -269,7 +269,7 @@ static void cn_notify(struct cb_id *id, u32 notify_event)
269 * May sleep. 269 * May sleep.
270 */ 270 */
271int cn_add_callback(struct cb_id *id, char *name, 271int cn_add_callback(struct cb_id *id, char *name,
272 void (*callback)(struct cn_msg *)) 272 void (*callback)(struct cn_msg *, struct netlink_skb_parms *))
273{ 273{
274 int err; 274 int err;
275 struct cn_dev *dev = &cdev; 275 struct cn_dev *dev = &cdev;
@@ -351,7 +351,7 @@ static int cn_ctl_msg_equals(struct cn_ctl_msg *m1, struct cn_ctl_msg *m2)
351 * 351 *
352 * Used for notification of a request's processing. 352 * Used for notification of a request's processing.
353 */ 353 */
354static void cn_callback(struct cn_msg *msg) 354static void cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
355{ 355{
356 struct cn_ctl_msg *ctl; 356 struct cn_ctl_msg *ctl;
357 struct cn_ctl_entry *ent; 357 struct cn_ctl_entry *ent;
diff --git a/drivers/md/dm-log-userspace-transfer.c b/drivers/md/dm-log-userspace-transfer.c
index ba0edad2d04..556131f7d84 100644
--- a/drivers/md/dm-log-userspace-transfer.c
+++ b/drivers/md/dm-log-userspace-transfer.c
@@ -129,7 +129,7 @@ static int fill_pkg(struct cn_msg *msg, struct dm_ulog_request *tfr)
129 * This is the connector callback that delivers data 129 * This is the connector callback that delivers data
130 * that was sent from userspace. 130 * that was sent from userspace.
131 */ 131 */
132static void cn_ulog_callback(void *data) 132static void cn_ulog_callback(void *data, struct netlink_skb_parms *nsp)
133{ 133{
134 struct cn_msg *msg = (struct cn_msg *)data; 134 struct cn_msg *msg = (struct cn_msg *)data;
135 struct dm_ulog_request *tfr = (struct dm_ulog_request *)(msg + 1); 135 struct dm_ulog_request *tfr = (struct dm_ulog_request *)(msg + 1);
diff --git a/drivers/staging/dst/dcore.c b/drivers/staging/dst/dcore.c
index ac8577358ba..3943c91e6c9 100644
--- a/drivers/staging/dst/dcore.c
+++ b/drivers/staging/dst/dcore.c
@@ -847,7 +847,7 @@ static dst_command_func dst_commands[] = {
847/* 847/*
848 * Configuration parser. 848 * Configuration parser.
849 */ 849 */
850static void cn_dst_callback(struct cn_msg *msg) 850static void cn_dst_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
851{ 851{
852 struct dst_ctl *ctl; 852 struct dst_ctl *ctl;
853 int err; 853 int err;
diff --git a/drivers/staging/pohmelfs/config.c b/drivers/staging/pohmelfs/config.c
index 90f962ee5fd..c9162b3f0bf 100644
--- a/drivers/staging/pohmelfs/config.c
+++ b/drivers/staging/pohmelfs/config.c
@@ -527,7 +527,7 @@ out_unlock:
527 return err; 527 return err;
528} 528}
529 529
530static void pohmelfs_cn_callback(struct cn_msg *msg) 530static void pohmelfs_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
531{ 531{
532 int err; 532 int err;
533 533
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
index e98baf6916b..aa7cd959cce 100644
--- a/drivers/video/uvesafb.c
+++ b/drivers/video/uvesafb.c
@@ -67,7 +67,7 @@ static DEFINE_MUTEX(uvfb_lock);
67 * find the kernel part of the task struct, copy the registers and 67 * find the kernel part of the task struct, copy the registers and
68 * the buffer contents and then complete the task. 68 * the buffer contents and then complete the task.
69 */ 69 */
70static void uvesafb_cn_callback(struct cn_msg *msg) 70static void uvesafb_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
71{ 71{
72 struct uvesafb_task *utask; 72 struct uvesafb_task *utask;
73 struct uvesafb_ktask *task; 73 struct uvesafb_ktask *task;
diff --git a/drivers/w1/w1_netlink.c b/drivers/w1/w1_netlink.c
index 52ccb3d3a96..45c126fea31 100644
--- a/drivers/w1/w1_netlink.c
+++ b/drivers/w1/w1_netlink.c
@@ -306,7 +306,7 @@ static int w1_netlink_send_error(struct cn_msg *rcmsg, struct w1_netlink_msg *rm
306 return error; 306 return error;
307} 307}
308 308
309static void w1_cn_callback(struct cn_msg *msg) 309static void w1_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
310{ 310{
311 struct w1_netlink_msg *m = (struct w1_netlink_msg *)(msg + 1); 311 struct w1_netlink_msg *m = (struct w1_netlink_msg *)(msg + 1);
312 struct w1_netlink_cmd *cmd; 312 struct w1_netlink_cmd *cmd;
diff --git a/include/linux/connector.h b/include/linux/connector.h
index 05a7a14126d..545728e20b6 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -136,7 +136,7 @@ struct cn_callback_data {
136 void *ddata; 136 void *ddata;
137 137
138 struct sk_buff *skb; 138 struct sk_buff *skb;
139 void (*callback) (struct cn_msg *); 139 void (*callback) (struct cn_msg *, struct netlink_skb_parms *);
140 140
141 void *free; 141 void *free;
142}; 142};
@@ -167,11 +167,11 @@ struct cn_dev {
167 struct cn_queue_dev *cbdev; 167 struct cn_queue_dev *cbdev;
168}; 168};
169 169
170int cn_add_callback(struct cb_id *, char *, void (*callback) (struct cn_msg *)); 170int cn_add_callback(struct cb_id *, char *, void (*callback) (struct cn_msg *, struct netlink_skb_parms *));
171void cn_del_callback(struct cb_id *); 171void cn_del_callback(struct cb_id *);
172int cn_netlink_send(struct cn_msg *, u32, gfp_t); 172int cn_netlink_send(struct cn_msg *, u32, gfp_t);
173 173
174int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(struct cn_msg *)); 174int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(struct cn_msg *, struct netlink_skb_parms *));
175void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id); 175void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id);
176 176
177int queue_cn_work(struct cn_callback_entry *cbq, struct work_struct *work); 177int queue_cn_work(struct cn_callback_entry *cbq, struct work_struct *work);