00001 #ifndef __QOS_LIST_H__
00002 #define __QOS_LIST_H__
00003
00004 #ifdef QOS_KS
00005 #include <linux/list.h>
00006 #else
00007
00008 #undef offsetof
00009 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
00010 #define container_of(ptr, type, member) ({ \
00011 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
00012 (type *)( (char *)__mptr - offsetof(type,member) );})
00013 #define __KERNEL__
00014 #define __ASM_I386_PROCESSOR_H
00015 #define _LINUX_KERNEL_H
00016 #define __ASM_SYSTEM_H
00017 #include <linux/list.h>
00018 #undef __KERNEL__
00019 #undef __ASM_I386_PROCESSOR_H
00020 #undef _LINUX_KERNEL_H
00021 #undef __ASM_SYSTEM_H
00022 #endif
00023
00024
00025
00026
00027 #define INIT_LIST_HEAD_NULL(ptr) do { (ptr)->prev = NULL; (ptr)->next = NULL; } while (0)
00028
00044 #define list_add_ordered(head, obj_type, obj, list_field, ord_field, ret) \
00045 do { \
00046 struct list_head *h; \
00047 if (list_empty(&head)) { \
00048 list_add(&((obj)->list_field ), &(head)); \
00049 goto __ret1; \
00050 } else { \
00051 for (h = (head).next; h != &(head); h = h->next) { \
00052 if ( kal_time_lt( (obj)->ord_field, (list_entry(h, struct obj_type, list_field)->ord_field) ) ) { \
00053 break; \
00054 } \
00055 } \
00056 list_add_tail(&((obj)->list_field), h); \
00057 } \
00058 if (&((obj)->list_field) == (head).next) { \
00059 goto __ret1; \
00060 } \
00061 (ret) = 0; \
00062 break; \
00063 __ret1: \
00064 (ret) = 1; \
00065 } while (0)
00066
00068 static inline void list_del_null(struct list_head *entry)
00069 {
00070 list_del(entry);
00071 entry->next = entry->prev = 0;
00072 }
00073
00074 #endif