freebsd-skq/sys/netpfil/ipfw/test/mylist.h
Gleb Smirnoff 3b3a8eb937 o Create directory sys/netpfil, where all packet filters should
reside, and move there ipfw(4) and pf(4).

o Move most modified parts of pf out of contrib.

Actual movements:

sys/contrib/pf/net/*.c		-> sys/netpfil/pf/
sys/contrib/pf/net/*.h		-> sys/net/
contrib/pf/pfctl/*.c		-> sbin/pfctl
contrib/pf/pfctl/*.h		-> sbin/pfctl
contrib/pf/pfctl/pfctl.8	-> sbin/pfctl
contrib/pf/pfctl/*.4		-> share/man/man4
contrib/pf/pfctl/*.5		-> share/man/man5

sys/netinet/ipfw		-> sys/netpfil/ipfw

The arguable movement is pf/net/*.h -> sys/net. There are
future plans to refactor pf includes, so I decided not to
break things twice.

Not modified bits of pf left in contrib: authpf, ftp-proxy,
tftp-proxy, pflogd.

The ipfw(4) movement is planned to be merged to stable/9,
to make head and stable match.

Discussed with:		bz, luigi
2012-09-14 11:51:49 +00:00

50 lines
1.0 KiB
C

/*
* $FreeBSD$
*
* linux-like bidirectional lists
*/
#ifndef _MYLIST_H
#define _MYLIST_H
struct list_head {
struct list_head *prev, *next;
};
#define INIT_LIST_HEAD(l) do { (l)->prev = (l)->next = (l); } while (0)
#define list_empty(l) ( (l)->next == l )
static inline void
__list_add(struct list_head *o, struct list_head *prev,
struct list_head *next)
{
next->prev = o;
o->next = next;
o->prev = prev;
prev->next = o;
}
static inline void
list_add_tail(struct list_head *o, struct list_head *head)
{
__list_add(o, head->prev, head);
}
#define list_first_entry(pL, ty, member) \
(ty *)((char *)((pL)->next) - offsetof(ty, member))
static inline void
__list_del(struct list_head *prev, struct list_head *next)
{
next->prev = prev;
prev->next = next;
}
static inline void
list_del(struct list_head *entry)
{
ND("called on %p", entry);
__list_del(entry->prev, entry->next);
entry->next = entry->prev = NULL;
}
#endif /* _MYLIST_H */