1 #ifndef __LINUX__FUSION_H__
2 #define __LINUX__FUSION_H__
7 * Fusion Kernel Device API Version
9 #define FUSION_API_MAJOR 3 /* Increased if backward compatibility is dropped. */
10 #define FUSION_API_MINOR 2 /* Increased if new features are added. */
13 * The Fusion ID is a unique identifier for one process consisting of threads.
15 typedef unsigned long FusionID
;
17 #define FUSION_ID_MASTER 1 /* This is the fusion id of the master (first process). */
24 int major
; /* Must be set to FUSION_API_MAJOR before entering. */
25 int minor
; /* Must be set to FUSION_API_MINOR before entering. */
28 FusionID fusion_id
; /* Returns the fusion id of the entering process. */
35 FusionID fusion_id
; /* Returns the fusion id of the new (forked) fusionee. */
42 FusionID fusion_id
; /* recipient */
44 int msg_id
; /* optional message identifier */
45 int msg_size
; /* message size, must be greater than zero */
46 const void *msg_data
; /* message data, must not be NULL */
53 FMT_SEND
, /* msg_id is an optional custom id */
54 FMT_CALL
, /* msg_id is the call id */
55 FMT_REACTOR
, /* msg_id is the reactor id */
56 FMT_SHMPOOL
/* msg_id is the pool id */
60 FusionMessageType msg_type
; /* type (origin) of message */
62 int msg_id
; /* message id (custom id or call/reactor/pool id) */
63 int msg_size
; /* size of the following message data */
65 /* message data follows */
69 * Dispatching a message via a reactor
75 int msg_size
; /* message size, must be greater than zero */
76 const void *msg_data
; /* message data, must not be NULL */
77 } FusionReactorDispatch
;
80 * Calling (synchronous RPC)
83 int call_id
; /* new call id returned */
85 void *handler
; /* function pointer of handler to install */
86 void *ctx
; /* optional handler context */
90 FCEF_NONE
= 0x00000000,
91 FCEF_ONEWAY
= 0x00000001,
93 } FusionCallExecFlags
;
96 int ret_val
; /* return value of the call */
98 int call_id
; /* id of the requested call, each call has a fixed owner */
100 int call_arg
; /* optional int argument */
101 void *call_ptr
; /* optional pointer argument (shared memory) */
103 FusionCallExecFlags flags
; /* execution flags */
107 int call_id
; /* id of currently executing call */
109 int val
; /* value to return */
113 void *handler
; /* function pointer of handler to call */
114 void *ctx
; /* optional handler context */
116 int caller
; /* fusion id of the caller or zero if called from Fusion */
117 int call_arg
; /* optional call parameter */
118 void *call_ptr
; /* optional call parameter */
122 * Watching a reference
124 * This information is needed to have a specific call being executed if the
125 * reference count reaches zero. Currently one watch per reference is allowed.
127 * The call is made by Fusion and therefor has a caller id of zero.
131 int id
; /* id of the reference to watch */
133 int call_id
; /* id of the call to execute */
134 int call_arg
; /* optional call parameter, e.g. the id of a user
135 space resource associated with that reference */
139 * Inheriting local count from other reference
142 int id
; /* own reference id */
143 int from
; /* id of the reference to inherit from */
147 * Killing other fusionees (experimental)
150 FusionID fusion_id
; /* fusionee to kill, zero means all but ourself */
151 int signal
; /* signal to be delivered, e.g. SIGTERM */
152 int timeout_ms
; /* -1 means no timeout, 0 means infinite, otherwise the
153 max. time to wait until the fusionee(s) terminated */
158 * Shared memory pools
161 int max_size
; /* Maximum size that this pool will be allowed to grow to. */
163 int pool_id
; /* Returns the new pool id. */
164 void *addr_base
; /* Returns the base of the reserved virtual memory address space. */
168 int pool_id
; /* The id of the pool to attach to. */
170 void *addr_base
; /* Returns the base of the reserved virtual memory address space. */
171 int size
; /* Returns the current size of the pool. */
172 } FusionSHMPoolAttach
;
175 int pool_id
; /* The id of the pool to notify. */
177 int size
; /* New size of the pool. */
178 } FusionSHMPoolDispatch
;
181 FSMT_REMAP
, /* Remap the pool due to a change of its size. */
182 FSMT_UNMAP
/* Unmap the pool due to its destruction. */
183 } FusionSHMPoolMessageType
;
186 FusionSHMPoolMessageType type
; /* Type of the message. */
188 int size
; /* New size of the pool, if type is FSMT_REMAP. */
189 } FusionSHMPoolMessage
;
208 * Set attributes like 'name' for an entry of the specified type.
210 #define FUSION_ENTRY_INFO_NAME_LENGTH 24
216 char name
[FUSION_ENTRY_INFO_NAME_LENGTH
];
221 #define FUSION_ENTER _IOR(FT_LOUNGE, 0x00, FusionEnter)
222 #define FUSION_UNBLOCK _IO (FT_LOUNGE, 0x01)
223 #define FUSION_KILL _IOW(FT_LOUNGE, 0x02, FusionKill)
225 #define FUSION_ENTRY_SET_INFO _IOW(FT_LOUNGE, 0x03, FusionEntryInfo)
226 #define FUSION_ENTRY_GET_INFO _IOW(FT_LOUNGE, 0x04, FusionEntryInfo)
228 #define FUSION_FORK _IOW(FT_LOUNGE, 0x05, FusionFork)
230 #define FUSION_SEND_MESSAGE _IOW(FT_MESSAGING, 0x00, FusionSendMessage)
232 #define FUSION_CALL_NEW _IOW(FT_CALL, 0x00, FusionCallNew)
233 #define FUSION_CALL_EXECUTE _IOW(FT_CALL, 0x01, FusionCallExecute)
234 #define FUSION_CALL_RETURN _IOW(FT_CALL, 0x02, FusionCallReturn)
235 #define FUSION_CALL_DESTROY _IOW(FT_CALL, 0x03, int)
237 #define FUSION_REF_NEW _IOW(FT_REF, 0x00, int)
238 #define FUSION_REF_UP _IOW(FT_REF, 0x01, int)
239 #define FUSION_REF_UP_GLOBAL _IOW(FT_REF, 0x02, int)
240 #define FUSION_REF_DOWN _IOW(FT_REF, 0x03, int)
241 #define FUSION_REF_DOWN_GLOBAL _IOW(FT_REF, 0x04, int)
242 #define FUSION_REF_ZERO_LOCK _IOW(FT_REF, 0x05, int)
243 #define FUSION_REF_ZERO_TRYLOCK _IOW(FT_REF, 0x06, int)
244 #define FUSION_REF_UNLOCK _IOW(FT_REF, 0x07, int)
245 #define FUSION_REF_STAT _IOW(FT_REF, 0x08, int)
246 #define FUSION_REF_WATCH _IOW(FT_REF, 0x09, FusionRefWatch)
247 #define FUSION_REF_INHERIT _IOW(FT_REF, 0x0A, FusionRefInherit)
248 #define FUSION_REF_DESTROY _IOW(FT_REF, 0x0B, int)
250 #define FUSION_SKIRMISH_NEW _IOW(FT_SKIRMISH, 0x00, int)
251 #define FUSION_SKIRMISH_PREVAIL _IOW(FT_SKIRMISH, 0x01, int)
252 #define FUSION_SKIRMISH_SWOOP _IOW(FT_SKIRMISH, 0x02, int)
253 #define FUSION_SKIRMISH_DISMISS _IOW(FT_SKIRMISH, 0x03, int)
254 #define FUSION_SKIRMISH_DESTROY _IOW(FT_SKIRMISH, 0x04, int)
255 #define FUSION_SKIRMISH_LOCK_COUNT _IOW(FT_SKIRMISH, 0x05, int)
257 #define FUSION_PROPERTY_NEW _IOW(FT_PROPERTY, 0x00, int)
258 #define FUSION_PROPERTY_LEASE _IOW(FT_PROPERTY, 0x01, int)
259 #define FUSION_PROPERTY_PURCHASE _IOW(FT_PROPERTY, 0x02, int)
260 #define FUSION_PROPERTY_CEDE _IOW(FT_PROPERTY, 0x03, int)
261 #define FUSION_PROPERTY_HOLDUP _IOW(FT_PROPERTY, 0x04, int)
262 #define FUSION_PROPERTY_DESTROY _IOW(FT_PROPERTY, 0x05, int)
264 #define FUSION_REACTOR_NEW _IOW(FT_REACTOR, 0x00, int)
265 #define FUSION_REACTOR_ATTACH _IOW(FT_REACTOR, 0x01, int)
266 #define FUSION_REACTOR_DETACH _IOW(FT_REACTOR, 0x02, int)
267 #define FUSION_REACTOR_DISPATCH _IOW(FT_REACTOR, 0x03, FusionReactorDispatch)
268 #define FUSION_REACTOR_DESTROY _IOW(FT_REACTOR, 0x04, int)
270 #define FUSION_SHMPOOL_NEW _IOW(FT_SHMPOOL, 0x00, FusionSHMPoolNew)
271 #define FUSION_SHMPOOL_ATTACH _IOW(FT_SHMPOOL, 0x01, FusionSHMPoolAttach)
272 #define FUSION_SHMPOOL_DETACH _IOW(FT_SHMPOOL, 0x02, int)
273 #define FUSION_SHMPOOL_DISPATCH _IOW(FT_SHMPOOL, 0x03, FusionSHMPoolDispatch)
274 #define FUSION_SHMPOOL_DESTROY _IOW(FT_SHMPOOL, 0x04, int)