hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/include/linux/connector.h
....@@ -1,22 +1,9 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * connector.h
34 *
45 * 2004-2005 Copyright (c) Evgeniy Polyakov <zbr@ioremap.net>
56 * All rights reserved.
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; either version 2 of the License, or
10
- * (at your option) any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program; if not, write to the Free Software
19
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
207 */
218 #ifndef __CONNECTOR_H
229 #define __CONNECTOR_H
....@@ -63,15 +50,75 @@
6350
6451 u32 seq, groups;
6552 struct sock *nls;
66
- void (*input) (struct sk_buff *skb);
6753
6854 struct cn_queue_dev *cbdev;
6955 };
7056
57
+/**
58
+ * cn_add_callback() - Registers new callback with connector core.
59
+ *
60
+ * @id: unique connector's user identifier.
61
+ * It must be registered in connector.h for legal
62
+ * in-kernel users.
63
+ * @name: connector's callback symbolic name.
64
+ * @callback: connector's callback.
65
+ * parameters are %cn_msg and the sender's credentials
66
+ */
7167 int cn_add_callback(struct cb_id *id, const char *name,
7268 void (*callback)(struct cn_msg *, struct netlink_skb_parms *));
73
-void cn_del_callback(struct cb_id *);
69
+/**
70
+ * cn_del_callback() - Unregisters new callback with connector core.
71
+ *
72
+ * @id: unique connector's user identifier.
73
+ */
74
+void cn_del_callback(struct cb_id *id);
75
+
76
+
77
+/**
78
+ * cn_netlink_send_mult - Sends message to the specified groups.
79
+ *
80
+ * @msg: message header(with attached data).
81
+ * @len: Number of @msg to be sent.
82
+ * @portid: destination port.
83
+ * If non-zero the message will be sent to the given port,
84
+ * which should be set to the original sender.
85
+ * @group: destination group.
86
+ * If @portid and @group is zero, then appropriate group will
87
+ * be searched through all registered connector users, and
88
+ * message will be delivered to the group which was created
89
+ * for user with the same ID as in @msg.
90
+ * If @group is not zero, then message will be delivered
91
+ * to the specified group.
92
+ * @gfp_mask: GFP mask.
93
+ *
94
+ * It can be safely called from softirq context, but may silently
95
+ * fail under strong memory pressure.
96
+ *
97
+ * If there are no listeners for given group %-ESRCH can be returned.
98
+ */
7499 int cn_netlink_send_mult(struct cn_msg *msg, u16 len, u32 portid, u32 group, gfp_t gfp_mask);
100
+
101
+/**
102
+ * cn_netlink_send_mult - Sends message to the specified groups.
103
+ *
104
+ * @msg: message header(with attached data).
105
+ * @portid: destination port.
106
+ * If non-zero the message will be sent to the given port,
107
+ * which should be set to the original sender.
108
+ * @group: destination group.
109
+ * If @portid and @group is zero, then appropriate group will
110
+ * be searched through all registered connector users, and
111
+ * message will be delivered to the group which was created
112
+ * for user with the same ID as in @msg.
113
+ * If @group is not zero, then message will be delivered
114
+ * to the specified group.
115
+ * @gfp_mask: GFP mask.
116
+ *
117
+ * It can be safely called from softirq context, but may silently
118
+ * fail under strong memory pressure.
119
+ *
120
+ * If there are no listeners for given group %-ESRCH can be returned.
121
+ */
75122 int cn_netlink_send(struct cn_msg *msg, u32 portid, u32 group, gfp_t gfp_mask);
76123
77124 int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name,