Date: Mon, 24 Sep 2007 21:51:54 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 126792 for review Message-ID: <200709242151.l8OLpsJx024155@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=126792 Change 126792 by kmacy@kmacy_home:ethng on 2007/09/24 21:51:45 add stack utility functions for creating LIFO cache Affected files ... .. //depot/projects/ethng/src/sys/dev/cxgb/cxgb_osdep.h#9 edit .. //depot/projects/ethng/src/sys/dev/cxgb/sys/cxgb_support.c#1 add Differences ... ==== //depot/projects/ethng/src/sys/dev/cxgb/cxgb_osdep.h#9 (text+ko) ==== @@ -100,7 +100,6 @@ return (m); } - static __inline struct mbuf * mbuf_ring_peek(struct mbuf_ring *mr) { @@ -118,6 +117,31 @@ return (m); } +struct buf_stack { + caddr_t *bs_stack; + volatile int bs_head; + int bs_size; +}; + +static __inline int +buf_push(struct buf_stack *bs, caddr_t buf) +{ + if (bs->bs_head + 1 >= bs->bs_size) + return (1); + + bs->bs_stack[++(bs->bs_head)] = buf; + return (0); +} + +static __inline caddr_t +buf_pop(struct buf_stack *bs) +{ + if (bs->bs_head < 0) + return (NULL); + + return (bs->bs_stack[(bs->bs_head)--]); +} + #define PANIC_IF(exp) do { \ if (exp) \ panic("BUG: %s", exp); \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200709242151.l8OLpsJx024155>