4
* 2004-2005 Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru>
7
* Modified by Philipp Reiser to work on older 2.6.x kernels.
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 2 of the License, or
12
* (at your option) any later version.
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
19
* You should have received a copy of the GNU General Public License
20
* along with this program; if not, write to the Free Software
21
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
#define DRBD_CONNECTOR_BACKPORT_HEADER
28
#include <asm/types.h>
30
#define NETLINK_CONNECTOR 11
32
#define CN_IDX_CONNECTOR 0xffffffff
33
#define CN_VAL_CONNECTOR 0xffffffff
36
* Process Events connector unique ids -- used for message routing
38
#define CN_IDX_PROC 0x1
39
#define CN_VAL_PROC 0x1
40
#define CN_IDX_CIFS 0x2
41
#define CN_VAL_CIFS 0x1
43
#define CN_NETLINK_USERS 1
46
* Maximum connector's message size.
48
#define CONNECTOR_MAX_MSG_SIZE 1024
51
* idx and val are unique identifiers which
52
* are used for message routing and
53
* must be registered in connector.h for in-kernel usage.
67
__u16 len; /* Length of the following data */
73
* Notify structure - requests notification about
74
* registering/unregistering idx/val in range [first, first+range].
76
struct cn_notify_req {
82
* Main notification control message
83
* *_notify_num - number of appropriate cn_notify_req structures after
85
* group - notification receiver's idx.
86
* len - total length of the attached data.
97
#include <linux/drbd_config.h>
99
#ifndef KERNEL_HAS_GFP_T
100
#define KERNEL_HAS_GFP_T
101
typedef unsigned gfp_t;
104
#include <asm/atomic.h>
106
#include <linux/list.h>
107
#include <linux/workqueue.h>
109
#include <net/sock.h>
111
#define CN_CBQ_NAMELEN 32
113
struct cn_queue_dev {
115
unsigned char name[CN_CBQ_NAMELEN];
117
struct workqueue_struct *cn_queue;
119
struct list_head queue_list;
120
spinlock_t queue_lock;
126
struct cn_callback_id {
127
unsigned char name[CN_CBQ_NAMELEN];
131
struct cn_callback_data {
132
void (*destruct_data) (void *);
136
void (*callback) (void *);
141
struct cn_callback_entry {
142
struct list_head callback_entry;
143
struct cn_callback *cb;
144
struct work_struct work;
145
struct cn_queue_dev *pdev;
147
struct cn_callback_id id;
148
struct cn_callback_data data;
154
struct cn_ctl_entry {
155
struct list_head notify_entry;
156
struct cn_ctl_msg *msg;
164
void (*input) (struct sock * sk, int len);
166
struct cn_queue_dev *cbdev;
169
int cn_add_callback(struct cb_id *, char *, void (*callback) (void *));
170
void cn_del_callback(struct cb_id *);
171
int cn_netlink_send(struct cn_msg *, u32, gfp_t);
173
int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(void *));
174
void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id);
176
struct cn_queue_dev *cn_queue_alloc_dev(char *name, struct sock *);
177
void cn_queue_free_dev(struct cn_queue_dev *dev);
179
int cn_cb_equal(struct cb_id *, struct cb_id *);
181
void cn_queue_wrapper(void *data);
183
extern int cn_already_initialized;
185
#endif /* __KERNEL__ */
186
#endif /* __CONNECTOR_H */