OpenAFS
OpenAFS distributed network file system
|
00001 /* $Id$ */ 00002 00003 /* Copyright 1990, 1991, 1999 by the Massachusetts Institute of 00004 * Technology. 00005 * 00006 * Permission to use, copy, modify, and distribute this 00007 * software and its documentation for any purpose and without 00008 * fee is hereby granted, provided that the above copyright 00009 * notice appear in all copies and that both that copyright 00010 * notice and this permission notice appear in supporting 00011 * documentation, and that the name of M.I.T. not be used in 00012 * advertising or publicity pertaining to distribution of the 00013 * software without specific, written prior permission. 00014 * M.I.T. makes no representations about the suitability of 00015 * this software for any purpose. It is provided "as is" 00016 * without express or implied warranty. 00017 */ 00018 00019 #ifndef AKLOG__LINKED_LIST_H 00020 #define AKLOG__LINKED_LIST_H 00021 00022 #define LL_SUCCESS 0 00023 #define LL_FAILURE -1 00024 00025 typedef struct _ll_node { 00026 struct _ll_node *prev; 00027 struct _ll_node *next; 00028 void *data; 00029 } ll_node; 00030 00031 typedef struct { 00032 ll_node *first; 00033 ll_node *last; 00034 int nelements; 00035 } linked_list; 00036 00037 typedef enum {ll_head, ll_tail} ll_end; 00038 00039 00040 /* ll_add_data just assigns the data field of node to be d. */ 00041 #define ll_add_data(n,d) (((n)->data)=(d)) 00042 00043 void ll_init(linked_list *list); 00044 ll_node *ll_add_node(linked_list *list, ll_end which_end); 00045 int ll_delete_node(linked_list *list, ll_node *node); 00046 int ll_string_check(linked_list *, char *); 00047 int ll_add_string(linked_list *, char *); 00048 00049 #endif /* AKLOG__LINKED_LIST_H */