Warning, cross-references for /kernel/include/util/circular.h need to be fixed.
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #ifndef _CIRCULAR_H_
0019 #define _CIRCULAR_H_
0020 #include "types.h"
0021 #include "smp/spinlock.h"
0022 #include "util/circular-defs.h"
0023
0024 struct _circular
0025 {
0026 void *buffer, *insert_ptr, *remove_ptr, *buffer_end;
0027 sint32 num_elts, elt_size, cur_count;
0028 sint32 (*insert)(struct _circular *, void *, uint32);
0029 sint32 (*remove)(struct _circular *, void *, uint32);
0030 spinlock lock;
0031 uint16 ins_waitq, rem_waitq;
0032 };
0033
0034 typedef struct _circular circular;
0035
0036 static inline sint32
0037 circular_insert (circular *c, void *elt)
0038 {
0039 return c->insert (c, elt, 0);
0040 }
0041
0042 static inline sint32
0043 circular_insert_nowait (circular *c, void *elt)
0044 {
0045 return c->insert (c, elt, CIRCULAR_FLAG_NOWAIT);
0046 }
0047
0048 static inline sint32
0049 circular_remove (circular *c, void *out_elt)
0050 {
0051 return c->remove (c, out_elt, 0);
0052 }
0053
0054 void circular_init (circular *c, void *buffer, sint32 num_elts, sint32 elt_size);
0055
0056 #endif
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067