bpf: Some style and white space cleanup

MFC after:	3 days

(cherry picked from commit 1baf6164e4d671ca1547a3096d8ce8fe69ed4e5c)
This commit is contained in:
Zhenlei Huang 2024-09-20 18:06:22 +08:00
parent e8ced99143
commit f97d0c91ee
2 changed files with 29 additions and 29 deletions

View file

@ -174,7 +174,7 @@ struct bpf_dltlist32 {
#define BIOCSETFNR32 _IOW('B', 130, struct bpf_program32)
#endif
#define BPF_LOCK() sx_xlock(&bpf_sx)
#define BPF_LOCK() sx_xlock(&bpf_sx)
#define BPF_UNLOCK() sx_xunlock(&bpf_sx)
#define BPF_LOCK_ASSERT() sx_assert(&bpf_sx, SA_XLOCKED)
/*
@ -1024,7 +1024,7 @@ bpfread(struct cdev *dev, struct uio *uio, int ioflag)
d->bd_state = BPF_IDLE;
while (d->bd_hbuf_in_use) {
error = mtx_sleep(&d->bd_hbuf_in_use, &d->bd_lock,
PRINET|PCATCH, "bd_hbuf", 0);
PRINET | PCATCH, "bd_hbuf", 0);
if (error != 0) {
BPFD_UNLOCK(d);
return (error);
@ -1067,7 +1067,7 @@ bpfread(struct cdev *dev, struct uio *uio, int ioflag)
BPFD_UNLOCK(d);
return (EWOULDBLOCK);
}
error = msleep(d, &d->bd_lock, PRINET|PCATCH,
error = msleep(d, &d->bd_lock, PRINET | PCATCH,
"bpf", d->bd_rtout);
if (error == EINTR || error == ERESTART) {
BPFD_UNLOCK(d);
@ -2134,7 +2134,7 @@ bpfpoll(struct cdev *dev, int events, struct thread *td)
if (devfs_get_cdevpriv((void **)&d) != 0 || d->bd_bif == NULL)
return (events &
(POLLHUP|POLLIN|POLLRDNORM|POLLOUT|POLLWRNORM));
(POLLHUP | POLLIN | POLLRDNORM | POLLOUT | POLLWRNORM));
/*
* Refresh PID associated with this descriptor.
@ -3108,7 +3108,7 @@ bpf_stats_sysctl(SYSCTL_HANDLER_ARGS)
return (error);
}
SYSINIT(bpfdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE,bpf_drvinit,NULL);
SYSINIT(bpfdev, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, bpf_drvinit, NULL);
#else /* !DEV_BPF && !NETGRAPH_BPF */
@ -3177,13 +3177,13 @@ bpf_peers_present_if(struct ifnet *ifp)
u_int
bpf_filter(const struct bpf_insn *pc, u_char *p, u_int wirelen, u_int buflen)
{
return -1; /* "no filter" behaviour */
return (-1); /* "no filter" behaviour */
}
int
bpf_validate(const struct bpf_insn *f, int len)
{
return 0; /* false */
return (0); /* false */
}
#endif /* !DEV_BPF && !NETGRAPH_BPF */

View file

@ -58,7 +58,7 @@ struct ifnet;
* BPF_ALIGNMENT.
*/
#define BPF_ALIGNMENT sizeof(long)
#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1))
#define BPF_WORDALIGN(x) (((x) + (BPF_ALIGNMENT - 1)) & ~(BPF_ALIGNMENT - 1))
#define BPF_MAXINSNS 512
#define BPF_MAXBUFSIZE 0x80000
@ -370,8 +370,8 @@ struct bpf_insn {
/*
* Macros for insn array initializers.
*/
#define BPF_STMT(code, k) { (u_short)(code), 0, 0, k }
#define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k }
#define BPF_STMT(code, k) { (u_short)(code), 0, 0, k }
#define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k }
/*
* Structure to retrieve available DLTs for the interface.
@ -417,24 +417,24 @@ struct bpf_if_ext {
struct bpfd_list bif_dlist; /* descriptor list */
};
void bpf_bufheld(struct bpf_d *d);
int bpf_validate(const struct bpf_insn *, int);
void bpf_tap(struct bpf_if *, u_char *, u_int);
void bpf_tap_if(struct ifnet *, u_char *, u_int);
void bpf_mtap(struct bpf_if *, struct mbuf *);
void bpf_mtap_if(struct ifnet *, struct mbuf *);
void bpf_mtap2(struct bpf_if *, void *, u_int, struct mbuf *);
void bpf_mtap2_if(struct ifnet *, void *, u_int, struct mbuf *);
void bpfattach(struct ifnet *, u_int, u_int);
void bpfattach2(struct ifnet *, u_int, u_int, struct bpf_if **);
void bpfdetach(struct ifnet *);
bool bpf_peers_present_if(struct ifnet *);
void bpf_bufheld(struct bpf_d *d);
int bpf_validate(const struct bpf_insn *, int);
void bpf_tap(struct bpf_if *, u_char *, u_int);
void bpf_tap_if(struct ifnet *, u_char *, u_int);
void bpf_mtap(struct bpf_if *, struct mbuf *);
void bpf_mtap_if(struct ifnet *, struct mbuf *);
void bpf_mtap2(struct bpf_if *, void *, u_int, struct mbuf *);
void bpf_mtap2_if(struct ifnet *, void *, u_int, struct mbuf *);
void bpfattach(struct ifnet *, u_int, u_int);
void bpfattach2(struct ifnet *, u_int, u_int, struct bpf_if **);
void bpfdetach(struct ifnet *);
bool bpf_peers_present_if(struct ifnet *);
#ifdef VIMAGE
int bpf_get_bp_params(struct bpf_if *, u_int *, u_int *);
int bpf_get_bp_params(struct bpf_if *, u_int *, u_int *);
#endif
void bpfilterattach(int);
u_int bpf_filter(const struct bpf_insn *, u_char *, u_int, u_int);
void bpfilterattach(int);
u_int bpf_filter(const struct bpf_insn *, u_char *, u_int, u_int);
static __inline bool
bpf_peers_present(struct bpf_if *bpf)
@ -445,11 +445,11 @@ bpf_peers_present(struct bpf_if *bpf)
return (!CK_LIST_EMPTY(&ext->bif_dlist));
}
#define BPF_TAP(_ifp,_pkt,_pktlen) \
bpf_tap_if((_ifp), (_pkt), (_pktlen))
#define BPF_MTAP(_ifp,_m) \
#define BPF_TAP(_ifp, _pkt, _pktlen) \
bpf_tap_if((_ifp), (_pkt), (_pktlen))
#define BPF_MTAP(_ifp, _m) \
bpf_mtap_if((_ifp), (_m))
#define BPF_MTAP2(_ifp,_data,_dlen,_m) \
#define BPF_MTAP2(_ifp, _data, _dlen, _m) \
bpf_mtap2_if((_ifp), (_data), (_dlen), (_m))
#endif /* _KERNEL */