From nobody Tue Sep 24 05:03:20 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XCSRr5j4vz5XJ6w; Tue, 24 Sep 2024 05:03:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XCSRr54wNz4WgH; Tue, 24 Sep 2024 05:03:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727154200; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HLkQ6yp0Zlq1zrdbuj77jbrMMglZ3kbhdAepOfKt54k=; b=l/FxWQDxWMcf6wpookaV1xq7i1Pli+hlLexZ+VUJyb0iSsXVD4kA6j/WssHRRzlRplFuXN 73FcF5b8hxkSnCI34UTEc4p+qRRQ+LKG6lpiM8jZjS7r2NMIEgaErzS3XFnwmzSyhqDcW4 nZ8I+aZSf7uh6PYdxPA8kVZ7TK7gEWT49ODWwWsQLNKB2HKVUoxtwO20mq+fSLN9Venzi3 jQ390OGDRl0FKCv2bMb1CIaj8QL58mm5wS4292ZV8m/R4TH7HBgpxCX/hY9eSQPauJ3nbz So8HYCYijNdgo3lhDhP5NOCDTpH+k1WAJWdrXeTJ4nW/NaUNx1D3M+X+Zge+ng== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727154200; a=rsa-sha256; cv=none; b=NOF3ITlsnUxwP2d1W2U6aexeoYB6QInlJ/xVU0R4oMdfbRo5g3F9h4iGs14a7CSggkMlPR El6zxA9e9gZtdetFPstIQGrmoTn2SOgQAAa+n9j6tydDw3x9JuEGx6rCmtRBnoXMCnRPQP I0FfIMScT3Oor0ysgn0rNq1jCHXpvQfqzrMKgFPbk0WvyXuFvaeNgope6KT7tLHmuS9aWJ kT7greaWa5XZhuqLaKmoX2QzvN8vE9wUhejXhw4gyFzy9xw3vw/eCwA9tExIBPKr6u5/xD EMO85VRvqLsXrW6mZee9gLTnphInQgBHvqXHZVyj1ABCZS/OOEHKk4/jA5gDTQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727154200; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HLkQ6yp0Zlq1zrdbuj77jbrMMglZ3kbhdAepOfKt54k=; b=m630VeiaF4uofqo7TrlpCrFr5jpi2yQmlg3lIItUk4jQu0nLQec4SVAWyFw8Jnn+3LjBMb Nn4XEOm9Ozt+HTfSrmX2wkFlDxjGY+8AR9QwoKVTeaKQIeOwZPXXgUsxElOFtoD3k/rPNJ nWTWnXb1612NwDjl9atZ7WPX21v9x+5EkIioODRGJKApxbvbG6KkV21gyFyL+S6PcAc3P1 fA91uauqr9IOeUW+kcTayD7VHjS9ITMeSBcEvIx6taJERidXPxXaQcZppdiydejgLXz5hK YcV9A4Z6jfx10rY+VoWobAmBBu2wDDFPlh7XwV/5jr39Y34wNDIn8EH3n5A5eQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XCSRr4J6MzFqb; Tue, 24 Sep 2024 05:03:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 48O53KsL046365; Tue, 24 Sep 2024 05:03:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48O53K1t046362; Tue, 24 Sep 2024 05:03:20 GMT (envelope-from git) Date: Tue, 24 Sep 2024 05:03:20 GMT Message-Id: <202409240503.48O53K1t046362@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Zhenlei Huang Subject: git: 7b657faa655c - stable/13 - bpf: Some style and white space cleanup List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7b657faa655ceba6965a8873add57b079b910690 Auto-Submitted: auto-generated The branch stable/13 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=7b657faa655ceba6965a8873add57b079b910690 commit 7b657faa655ceba6965a8873add57b079b910690 Author: Zhenlei Huang AuthorDate: 2024-09-20 10:06:22 +0000 Commit: Zhenlei Huang CommitDate: 2024-09-24 05:02:29 +0000 bpf: Some style and white space cleanup MFC after: 3 days (cherry picked from commit 1baf6164e4d671ca1547a3096d8ce8fe69ed4e5c) (cherry picked from commit f97d0c91eefc8568a11ad47f910cdd9dc7826a72) --- sys/net/bpf.c | 19 +++++++++++-------- sys/net/bpf.h | 54 +++++++++++++++++++++++++++--------------------------- 2 files changed, 38 insertions(+), 35 deletions(-) diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 7aa1dfd302f4..b7c964ac8ac4 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -173,7 +173,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) /* @@ -641,7 +641,10 @@ bpf_movein(struct uio *uio, int linktype, struct ifnet *ifp, struct mbuf **mp, if (len < hlen || len - hlen > ifp->if_mtu) return (EMSGSIZE); - /* Allocate a mbuf for our write, since m_get2 fails if len >= to MJUMPAGESIZE, use m_getjcl for bigger buffers */ + /* + * Allocate a mbuf for our write, since m_get2 fails if len >= to + * MJUMPAGESIZE, use m_getjcl for bigger buffers + */ if (len < MJUMPAGESIZE) m = m_get2(len, M_WAITOK, MT_DATA, M_PKTHDR); else if (len <= MJUM9BYTES) @@ -1019,7 +1022,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); @@ -1062,7 +1065,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); @@ -2129,7 +2132,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. @@ -3039,7 +3042,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 */ @@ -3087,13 +3090,13 @@ bpfdetach(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 */ diff --git a/sys/net/bpf.h b/sys/net/bpf.h index 2fe8b6a78647..d6213ebd10f4 100644 --- a/sys/net/bpf.h +++ b/sys/net/bpf.h @@ -57,7 +57,7 @@ typedef u_int64_t bpf_u_int64; * 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 @@ -369,8 +369,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. @@ -416,20 +416,20 @@ 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_mtap(struct bpf_if *, struct mbuf *); -void bpf_mtap2(struct bpf_if *, 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 *); +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_mtap(struct bpf_if *, struct mbuf *); +void bpf_mtap2(struct bpf_if *, 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 *); #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) @@ -440,21 +440,21 @@ bpf_peers_present(struct bpf_if *bpf) return (!CK_LIST_EMPTY(&ext->bif_dlist)); } -#define BPF_TAP(_ifp,_pkt,_pktlen) do { \ - if (bpf_peers_present((_ifp)->if_bpf)) \ - bpf_tap((_ifp)->if_bpf, (_pkt), (_pktlen)); \ +#define BPF_TAP(_ifp, _pkt, _pktlen) do { \ + if (bpf_peers_present((_ifp)->if_bpf)) \ + bpf_tap((_ifp)->if_bpf, (_pkt), (_pktlen)); \ } while (0) -#define BPF_MTAP(_ifp,_m) do { \ - if (bpf_peers_present((_ifp)->if_bpf)) { \ - M_ASSERTVALID(_m); \ - bpf_mtap((_ifp)->if_bpf, (_m)); \ - } \ +#define BPF_MTAP(_ifp, _m) do { \ + if (bpf_peers_present((_ifp)->if_bpf)) { \ + M_ASSERTVALID(_m); \ + bpf_mtap((_ifp)->if_bpf, (_m)); \ + } \ } while (0) -#define BPF_MTAP2(_ifp,_data,_dlen,_m) do { \ - if (bpf_peers_present((_ifp)->if_bpf)) { \ - M_ASSERTVALID(_m); \ - bpf_mtap2((_ifp)->if_bpf,(_data),(_dlen),(_m)); \ - } \ +#define BPF_MTAP2(_ifp, _data, _dlen, _m) do { \ + if (bpf_peers_present((_ifp)->if_bpf)) { \ + M_ASSERTVALID(_m); \ + bpf_mtap2((_ifp)->if_bpf, (_data), (_dlen), (_m)); \ + } \ } while (0) #endif /* _KERNEL */