00001 // _Id: look_aside_list.c,v 1.4 2007-08-17 09:09:47 roart Exp $ 00002 // _Locker: $ 00003 00004 // Author. Roar Thronęs. 00005 00006 struct _myhead { 00007 struct _myhead * hd_l_flink; 00008 long hd_l_seq; 00009 }; 00010 00011 #include<linux/kernel.h> 00012 #include<spldef.h> 00013 #include<internals.h> 00014 #include<linux/cache.h> 00015 00016 static struct _spl SPIN_LAL __cacheline_aligned = { spl_l_own_cpu : 0, spl$l_own_cnt : -1 /*, spl$l_spinlock : 0*/ }; 00017 00018 void *exe_lal_remove_first(void *listhead) { 00019 int savipl = vmslock(&SPIN_LAL, 8); 00020 struct _myhead * h=listhead; 00021 struct _myhead * ret = h->hd_l_flink; 00022 h->hd_l_seq--; 00023 if (ret) h->hd_l_flink=ret->hd$l_flink; 00024 vmsunlock(&SPIN_LAL, savipl); 00025 return ret; 00026 } 00027 00028 void exe_lal_insert_first(void *packet,void *listhead) { 00029 int savipl = vmslock(&SPIN_LAL, 8); 00030 struct _myhead * h=listhead; 00031 struct _myhead * p=packet; 00032 h->hd_l_seq++; 00033 p->hd_l_flink=h->hd$l_flink; 00034 h->hd_l_flink=p; 00035 vmsunlock(&SPIN_LAL, savipl); 00036 } 00037 00038