Blame view
include/linux/connector.h
3.75 KB
7672d0b54
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
/* * connector.h * * 2004-2005 Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru> * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __CONNECTOR_H #define __CONNECTOR_H |
00bfddaf7
|
24 |
#include <linux/types.h> |
7672d0b54
|
25 |
|
9f46080c4
|
26 27 28 29 30 |
/* * Process Events connector unique ids -- used for message routing */ #define CN_IDX_PROC 0x1 #define CN_VAL_PROC 0x1 |
a2653ebab
|
31 32 |
#define CN_IDX_CIFS 0x2 #define CN_VAL_CIFS 0x1 |
b6043fcab
|
33 34 |
#define CN_W1_IDX 0x3 /* w1 communication */ #define CN_W1_VAL 0x1 |
cc54f46e3
|
35 36 |
#define CN_IDX_V86D 0x4 #define CN_VAL_V86D_UVESAFB 0x1 |
2c203003f
|
37 |
#define CN_IDX_BB 0x5 /* BlackBoard, from the TSP GPL sampling framework */ |
ce0d9d725
|
38 39 |
#define CN_DST_IDX 0x6 #define CN_DST_VAL 0x1 |
f5db4af46
|
40 41 |
#define CN_IDX_DM 0x7 /* Device Mapper */ #define CN_VAL_DM_USERSPACE_LOG 0x1 |
35a8a3fdc
|
42 43 |
#define CN_IDX_DRBD 0x8 #define CN_VAL_DRBD 0x1 |
9f46080c4
|
44 |
|
f5db4af46
|
45 |
#define CN_NETLINK_USERS 8 |
7672d0b54
|
46 47 48 49 |
/* * Maximum connector's message size. */ |
3d62a44f7
|
50 |
#define CONNECTOR_MAX_MSG_SIZE 16384 |
7672d0b54
|
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
/* * idx and val are unique identifiers which * are used for message routing and * must be registered in connector.h for in-kernel usage. */ struct cb_id { __u32 idx; __u32 val; }; struct cn_msg { struct cb_id id; __u32 seq; __u32 ack; __u16 len; /* Length of the following data */ __u16 flags; __u8 data[0]; }; |
7672d0b54
|
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
#ifdef __KERNEL__ #include <asm/atomic.h> #include <linux/list.h> #include <linux/workqueue.h> #include <net/sock.h> #define CN_CBQ_NAMELEN 32 struct cn_queue_dev { atomic_t refcnt; unsigned char name[CN_CBQ_NAMELEN]; struct workqueue_struct *cn_queue; |
1a5645bc9
|
89 90 91 92 93 94 |
/* Sent to kevent to create cn_queue only when needed */ struct work_struct wq_creation; /* Tell if the wq_creation job is pending/completed */ atomic_t wq_requested; /* Wait for cn_queue to be created */ wait_queue_head_t wq_created; |
7672d0b54
|
95 96 97 |
struct list_head queue_list; spinlock_t queue_lock; |
7672d0b54
|
98 99 |
struct sock *nls; }; |
acd042bb2
|
100 |
struct cn_callback_id { |
7672d0b54
|
101 |
unsigned char name[CN_CBQ_NAMELEN]; |
7672d0b54
|
102 |
struct cb_id id; |
acd042bb2
|
103 104 105 |
}; struct cn_callback_data { |
293500a23
|
106 |
struct sk_buff *skb; |
7069331db
|
107 |
void (*callback) (struct cn_msg *, struct netlink_skb_parms *); |
acd042bb2
|
108 109 |
void *free; |
7672d0b54
|
110 111 112 113 |
}; struct cn_callback_entry { struct list_head callback_entry; |
a240d9f1d
|
114 |
struct work_struct work; |
7672d0b54
|
115 |
struct cn_queue_dev *pdev; |
acd042bb2
|
116 117 |
struct cn_callback_id id; struct cn_callback_data data; |
7672d0b54
|
118 |
|
6e32814bc
|
119 |
u32 seq, group; |
7672d0b54
|
120 |
}; |
7672d0b54
|
121 122 123 124 125 |
struct cn_dev { struct cb_id id; u32 seq, groups; struct sock *nls; |
cd40b7d39
|
126 |
void (*input) (struct sk_buff *skb); |
7672d0b54
|
127 128 129 |
struct cn_queue_dev *cbdev; }; |
7069331db
|
130 |
int cn_add_callback(struct cb_id *, char *, void (*callback) (struct cn_msg *, struct netlink_skb_parms *)); |
7672d0b54
|
131 |
void cn_del_callback(struct cb_id *); |
dd0fc66fb
|
132 |
int cn_netlink_send(struct cn_msg *, u32, gfp_t); |
7672d0b54
|
133 |
|
7069331db
|
134 |
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 *)); |
7672d0b54
|
135 |
void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id); |
1a5645bc9
|
136 |
int queue_cn_work(struct cn_callback_entry *cbq, struct work_struct *work); |
7672d0b54
|
137 138 139 140 |
struct cn_queue_dev *cn_queue_alloc_dev(char *name, struct sock *); void cn_queue_free_dev(struct cn_queue_dev *dev); int cn_cb_equal(struct cb_id *, struct cb_id *); |
c4028958b
|
141 |
void cn_queue_wrapper(struct work_struct *work); |
acd042bb2
|
142 |
|
7672d0b54
|
143 144 |
#endif /* __KERNEL__ */ #endif /* __CONNECTOR_H */ |