diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2009-10-01 22:40:05 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-02 13:54:01 -0400 |
commit | 7069331dbe7155f23966f5944109f909fea0c7e4 (patch) | |
tree | 5ea80628d1bf5e776a540ee84814f085c9adff04 | |
parent | 293500a23f4b0698cb04abfecfc9a954d8ab2742 (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.c | 2 | ||||
-rw-r--r-- | Documentation/connector/connector.txt | 8 | ||||
-rw-r--r-- | drivers/connector/cn_queue.c | 7 | ||||
-rw-r--r-- | drivers/connector/connector.c | 4 | ||||
-rw-r--r-- | drivers/md/dm-log-userspace-transfer.c | 2 | ||||
-rw-r--r-- | drivers/staging/dst/dcore.c | 2 | ||||
-rw-r--r-- | drivers/staging/pohmelfs/config.c | 2 | ||||
-rw-r--r-- | drivers/video/uvesafb.c | 2 | ||||
-rw-r--r-- | drivers/w1/w1_netlink.c | 2 | ||||
-rw-r--r-- | include/linux/connector.h | 6 |
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"; | |||
34 | static struct sock *nls; | 34 | static struct sock *nls; |
35 | static struct timer_list cn_test_timer; | 35 | static struct timer_list cn_test_timer; |
36 | 36 | ||
37 | static void cn_test_callback(struct cn_msg *msg) | 37 | static 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 | |||
23 | netlink based networking for inter-process communication in a significantly | 23 | netlink based networking for inter-process communication in a significantly |
24 | easier way: | 24 | easier way: |
25 | 25 | ||
26 | int cn_add_callback(struct cb_id *id, char *name, void (*callback) (void *)); | 26 | int cn_add_callback(struct cb_id *id, char *name, void (*callback) (struct cn_msg *, struct netlink_skb_parms *)); |
27 | void cn_netlink_send(struct cn_msg *msg, u32 __group, int gfp_mask); | 27 | void cn_netlink_send(struct cn_msg *msg, u32 __group, int gfp_mask); |
28 | 28 | ||
29 | struct cb_id | 29 | struct cb_id |
@@ -53,15 +53,15 @@ struct cn_msg | |||
53 | Connector interfaces. | 53 | Connector interfaces. |
54 | /*****************************************/ | 54 | /*****************************************/ |
55 | 55 | ||
56 | int cn_add_callback(struct cb_id *id, char *name, void (*callback) (void *)); | 56 | int 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 | ||
67 | void cn_del_callback(struct cb_id *id); | 67 | void 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 | ||
91 | static struct cn_callback_entry * | 92 | static struct cn_callback_entry * |
92 | cn_queue_alloc_callback_entry(char *name, struct cb_id *id, | 93 | cn_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 | ||
126 | int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, | 127 | int 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 | */ |
271 | int cn_add_callback(struct cb_id *id, char *name, | 271 | int 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 | */ |
354 | static void cn_callback(struct cn_msg *msg) | 354 | static 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 | */ |
132 | static void cn_ulog_callback(void *data) | 132 | static 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 | */ |
850 | static void cn_dst_callback(struct cn_msg *msg) | 850 | static 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 | ||
530 | static void pohmelfs_cn_callback(struct cn_msg *msg) | 530 | static 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 | */ |
70 | static void uvesafb_cn_callback(struct cn_msg *msg) | 70 | static 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 | ||
309 | static void w1_cn_callback(struct cn_msg *msg) | 309 | static 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 | ||
170 | int cn_add_callback(struct cb_id *, char *, void (*callback) (struct cn_msg *)); | 170 | int cn_add_callback(struct cb_id *, char *, void (*callback) (struct cn_msg *, struct netlink_skb_parms *)); |
171 | void cn_del_callback(struct cb_id *); | 171 | void cn_del_callback(struct cb_id *); |
172 | int cn_netlink_send(struct cn_msg *, u32, gfp_t); | 172 | int cn_netlink_send(struct cn_msg *, u32, gfp_t); |
173 | 173 | ||
174 | int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(struct cn_msg *)); | 174 | int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(struct cn_msg *, struct netlink_skb_parms *)); |
175 | void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id); | 175 | void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id); |
176 | 176 | ||
177 | int queue_cn_work(struct cn_callback_entry *cbq, struct work_struct *work); | 177 | int queue_cn_work(struct cn_callback_entry *cbq, struct work_struct *work); |