26 #ifndef __OSDEP_SERVICE_H_
27 #define __OSDEP_SERVICE_H_
36 #include <linux/sched.h>
37 #include <linux/sem.h>
38 #include <linux/netdevice.h>
50 #define _pkt struct sk_buff
51 #define _buffer unsigned char
52 #define thread_exit() complete_and_exit(NULL, 0)
53 #define _workitem struct work_struct
55 #define _init_queue(pqueue) \
57 _init_listhead(&((pqueue)->queue)); \
58 spin_lock_init(&((pqueue)->lock)); \
68 return &(queue->
queue);
71 #define LIST_CONTAINOR(ptr, type, member) \
72 ((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member)))
74 static inline void list_delete(
struct list_head *plist)
79 static inline void _init_timer(
struct timer_list *ptimer,
81 void *pfunc,
void *cntx)
88 static inline void _set_timer(
struct timer_list *ptimer,
u32 delay_time)
93 static inline void _cancel_timer(
struct timer_list *ptimer,
u8 *bcancelled)
99 static inline void _init_workitem(
_workitem *pwork,
void *pfunc,
void *cntx)
104 static inline void _set_workitem(
_workitem *pwork)
110 #define BIT(x) (1 << (x))
118 static inline u32 is_list_empty(
struct list_head *phead)
120 if (list_empty(phead))
126 static inline void list_insert_tail(
struct list_head *plist,
142 INIT_LIST_HEAD(list);
145 static inline u32 _queue_empty(
struct __queue *pqueue)
147 return is_list_empty(&(pqueue->
queue));
158 static inline void sleep_schedulable(
int ms)
162 delta = (ms *
HZ) / 1000;
170 static inline u8 *_malloc(
u32 sz)
175 static inline unsigned char _cancel_timer_ex(
struct timer_list *ptimer)
180 static inline void thread_enter(
void *
context)
185 static inline void flush_signals_thread(
void)
191 static inline u32 _RND8(
u32 sz)
193 return ((sz >> 3) + ((sz & 7) ? 1 : 0)) << 3;
196 static inline u32 _RND128(
u32 sz)
198 return ((sz >> 7) + ((sz & 127) ? 1 : 0)) << 7;
201 static inline u32 _RND256(
u32 sz)
203 return ((sz >> 8) + ((sz & 255) ? 1 : 0)) << 8;
206 static inline u32 _RND512(
u32 sz)
208 return ((sz >> 9) + ((sz & 511) ? 1 : 0)) << 9;