summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile10
-rw-r--r--lf_fifo.c (renamed from lfq.c)12
-rw-r--r--lf_fifo.h (renamed from lfq.h)18
-rw-r--r--lf_fifo_cas.h (renamed from lfq_cas.h)4
-rw-r--r--lf_fifo_test.c (renamed from lfq_test.c)14
5 files changed, 29 insertions, 29 deletions
diff --git a/Makefile b/Makefile
index a196f10..2265400 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
CC = gcc
STD = _GNU_SOURCE
CFLAGS = -DDEBUG
-BIN = cas_test lock_free_queue_test lfq_test
+BIN = cas_test lock_free_queue_test lf_fifo_test
.c.o:
$(CC) -c -Wall -I. $(CFLAGS) -D$(STD) $<
@@ -16,13 +16,13 @@ cas_test: cas_test.o
lock_free_queue_test: lock_free_queue.o lock_free_queue_test.o
$(CC) lock_free_queue.o lock_free_queue_test.o -o lock_free_queue_test
-lfq.o: lfq.h lfq_cas.h
+lf_fifo.o: lf_fifo.h lf_fifo_cas.h
-lfq_test: lfq.o lfq_test.o
- $(CC) lfq.o lfq_test.o -o lfq_test
+lf_fifo_test: lf_fifo.o lf_fifo_test.o
+ $(CC) lf_fifo.o lf_fifo_test.o -o lf_fifo_test
as:
- $(CC) -S lfq.c
+ $(CC) -S lf_fifo.c
clean:
rm -f *~ *.o *.s core $(BIN)
diff --git a/lfq.c b/lf_fifo.c
index 8fa9758..f13045f 100644
--- a/lfq.c
+++ b/lf_fifo.c
@@ -25,18 +25,18 @@
*
*/
-#include "lfq.h"
-#include "lfq_cas.h"
+#include "lf_fifo.h"
+#include "lf_fifo_cas.h"
#include "stdlib.h"
-/* initialize an empty lfq structure */
-void lfq_init( lfq_t *q ) {
+/* initialize an empty lf_fifo structure */
+void lf_fifo_init( lf_fifo_t *q ) {
q->head.split.next = q->tail.split.next = NULL;
q->head.split.count = q->tail.split.count = 0;
}
/* push a node at the tail of q */
-void lfq_push_tail( lfq_t *q, pointer_t *node ) {
+void lf_fifo_push_tail( lf_fifo_t *q, pointer_t *node ) {
pointer_t tail;
pointer_t last;
pointer_t tmp;
@@ -80,7 +80,7 @@ void lfq_push_tail( lfq_t *q, pointer_t *node ) {
}
/* pop a node from the head of q */
-pointer_t* pop_head( lfq_t *q ) {
+pointer_t* pop_head( lf_fifo_t *q ) {
pointer_t head;
pointer_t tail;
pointer_t tmp;
diff --git a/lfq.h b/lf_fifo.h
index 3906f9b..6cf896c 100644
--- a/lfq.h
+++ b/lf_fifo.h
@@ -1,5 +1,5 @@
/*
- * File : lfq.h
+ * File : lf_fifo.h
* Author : Jérémy Zurcher <jeremy@asynk.ch>
* Date : 02/11/09
* License :
@@ -26,8 +26,8 @@
*/
-#ifndef _LFQ_H_
-#define _LFQ_H_
+#ifndef _LF_FIFO_H_
+#define _LF_FIFO_H_
# ifdef __cplusplus
extern "C" {
@@ -44,20 +44,20 @@ typedef union pointer {
typedef struct queue {
pointer_t head;
pointer_t tail;
-} lfq_t;
+} lf_fifo_t;
-/* initialize an empty lfq structure */
-void lfq_init( lfq_t *q );
+/* initialize an empty lf_fifo structure */
+void lf_fifo_init( lf_fifo_t *q );
/* push a node at the tail of q */
-void lfq_push_tail( lfq_t *q, pointer_t *node );
+void lf_fifo_push_tail( lf_fifo_t *q, pointer_t *node );
/* pop a node from the head of q */
-pointer_t* pop_head( lfq_t *q );
+pointer_t* pop_head( lf_fifo_t *q );
# ifdef __cplusplus
}
# endif /* __cplusplus */
-# endif /* _LFQ_H_ */
+# endif /* _LF_FIFO_H_ */
diff --git a/lfq_cas.h b/lf_fifo_cas.h
index a77e1ef..e380f8e 100644
--- a/lfq_cas.h
+++ b/lf_fifo_cas.h
@@ -1,5 +1,5 @@
/*
- * File : lfq_cas.h
+ * File : lf_fifo_cas.h
* Author : Jérémy Zurcher <jeremy@asynk.ch>
* Date : 01/11/09
* License :
@@ -25,7 +25,7 @@
*
*/
-#include "lfq.h"
+#include "lf_fifo.h"
/* CMPXCHG8B m64 Compare EDX:EAX with m64. If equal, set ZF and load ECX:EBX into m64. Else, clear ZF and load m64 into EDX:EAX. */
static inline unsigned int cas( volatile struct split *mem,
diff --git a/lfq_test.c b/lf_fifo_test.c
index 4223f3f..e212197 100644
--- a/lfq_test.c
+++ b/lf_fifo_test.c
@@ -1,5 +1,5 @@
/*
- * File : lfq_test.c
+ * File : lf_fifo_test.c
* Author : Jérémy Zurcher <jeremy@asynk.ch>
* Date : 01/11/09
* License :
@@ -29,8 +29,8 @@
#include "stdlib.h"
#include "stddef.h"
-#include "lfq.h"
-#include "lfq_cas.h"
+#include "lf_fifo.h"
+#include "lf_fifo_cas.h"
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
@@ -47,7 +47,7 @@ int main(int argc, char *argv[]) {
pointer_t mem;
int ret;
- lfq_t q;
+ lf_fifo_t q;
pointer_t *it;
struct node data[10];
int i;
@@ -70,10 +70,10 @@ int main(int argc, char *argv[]) {
for(i=0; i<10; i++) data[i].data=i;
for(i=0; i<10; i++) printf("data[%d] :%d\n",i,data[i].data);
- /* check lfq */
- lfq_init( &q);
+ /* check lf_fifo */
+ lf_fifo_init( &q);
printf("pop %X\n",(unsigned int)pop_head( &q ));
- for(i=0; i<10; i++) lfq_push_tail( &q, &data[i].link );
+ for(i=0; i<10; i++) lf_fifo_push_tail( &q, &data[i].link );
it = (pointer_t*)q.head.split.next;
while(it!=NULL) {