Re: percpu counters: replace KASSERT with CTASSERT

2017-01-30 Thread David Gwynne
ok.

> On 31 Jan 2017, at 10:41, Jeremie Courreges-Anglas  wrote:
> 
> 
> CTASSERT is more useful when the result of the test is known at compile
> time.  Build-tested on amd64 and armv7, ok?
> 
> 
> Index: net/rtsock.c
> ===
> RCS file: /d/cvs/src/sys/net/rtsock.c,v
> retrieving revision 1.220
> diff -u -p -r1.220 rtsock.c
> --- net/rtsock.c  24 Jan 2017 00:17:14 -  1.220
> +++ net/rtsock.c  30 Jan 2017 22:57:35 -
> @@ -1640,7 +1640,7 @@ sysctl_rtable_rtstat(void *oldp, size_t 
>   uint32_t *words = (uint32_t *)
>   int i;
> 
> - KASSERT(sizeof(rtstat) == (nitems(counters) * sizeof(uint32_t)));
> + CTASSERT(sizeof(rtstat) == (nitems(counters) * sizeof(uint32_t)));
> 
>   counters_read(rtcounters, counters, nitems(counters));
> 
> Index: netinet/igmp.c
> ===
> RCS file: /d/cvs/src/sys/netinet/igmp.c,v
> retrieving revision 1.62
> diff -u -p -r1.62 igmp.c
> --- netinet/igmp.c29 Jan 2017 19:58:47 -  1.62
> +++ netinet/igmp.c30 Jan 2017 22:57:56 -
> @@ -706,7 +706,7 @@ igmp_sysctl_igmpstat(void *oldp, size_t 
>   u_long *words = (u_long *)
>   int i;
> 
> - KASSERT(sizeof(igmpstat) == (nitems(counters) * sizeof(u_long)));
> + CTASSERT(sizeof(igmpstat) == (nitems(counters) * sizeof(u_long)));
> 
>   counters_read(igmpcounters, counters, nitems(counters));
> 
> Index: netinet/ip_input.c
> ===
> RCS file: /d/cvs/src/sys/netinet/ip_input.c,v
> retrieving revision 1.293
> diff -u -p -r1.293 ip_input.c
> --- netinet/ip_input.c29 Jan 2017 19:58:47 -  1.293
> +++ netinet/ip_input.c30 Jan 2017 22:58:09 -
> @@ -1654,7 +1654,7 @@ ip_sysctl_ipstat(void *oldp, size_t *old
>   u_long *words = (u_long *)
>   int i;
> 
> - KASSERT(sizeof(ipstat) == (nitems(counters) * sizeof(u_long)));
> + CTASSERT(sizeof(ipstat) == (nitems(counters) * sizeof(u_long)));
> 
>   counters_read(ipcounters, counters, nitems(counters));
> 
> Index: netinet/udp_usrreq.c
> ===
> RCS file: /d/cvs/src/sys/netinet/udp_usrreq.c,v
> retrieving revision 1.229
> diff -u -p -r1.229 udp_usrreq.c
> --- netinet/udp_usrreq.c  29 Jan 2017 19:58:47 -  1.229
> +++ netinet/udp_usrreq.c  30 Jan 2017 22:58:27 -
> @@ -1352,7 +1352,7 @@ udp_sysctl_udpstat(void *oldp, size_t *o
>   u_long *words = (u_long *)
>   int i;
> 
> - KASSERT(sizeof(udpstat) == (nitems(counters) * sizeof(u_long)));
> + CTASSERT(sizeof(udpstat) == (nitems(counters) * sizeof(u_long)));
> 
>   counters_read(udpcounters, counters, nitems(counters));
> 
> 
> 
> -- 
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE
> 



percpu counters: replace KASSERT with CTASSERT

2017-01-30 Thread Jeremie Courreges-Anglas

CTASSERT is more useful when the result of the test is known at compile
time.  Build-tested on amd64 and armv7, ok?


Index: net/rtsock.c
===
RCS file: /d/cvs/src/sys/net/rtsock.c,v
retrieving revision 1.220
diff -u -p -r1.220 rtsock.c
--- net/rtsock.c24 Jan 2017 00:17:14 -  1.220
+++ net/rtsock.c30 Jan 2017 22:57:35 -
@@ -1640,7 +1640,7 @@ sysctl_rtable_rtstat(void *oldp, size_t 
uint32_t *words = (uint32_t *)
int i;
 
-   KASSERT(sizeof(rtstat) == (nitems(counters) * sizeof(uint32_t)));
+   CTASSERT(sizeof(rtstat) == (nitems(counters) * sizeof(uint32_t)));
 
counters_read(rtcounters, counters, nitems(counters));
 
Index: netinet/igmp.c
===
RCS file: /d/cvs/src/sys/netinet/igmp.c,v
retrieving revision 1.62
diff -u -p -r1.62 igmp.c
--- netinet/igmp.c  29 Jan 2017 19:58:47 -  1.62
+++ netinet/igmp.c  30 Jan 2017 22:57:56 -
@@ -706,7 +706,7 @@ igmp_sysctl_igmpstat(void *oldp, size_t 
u_long *words = (u_long *)
int i;
 
-   KASSERT(sizeof(igmpstat) == (nitems(counters) * sizeof(u_long)));
+   CTASSERT(sizeof(igmpstat) == (nitems(counters) * sizeof(u_long)));
 
counters_read(igmpcounters, counters, nitems(counters));
 
Index: netinet/ip_input.c
===
RCS file: /d/cvs/src/sys/netinet/ip_input.c,v
retrieving revision 1.293
diff -u -p -r1.293 ip_input.c
--- netinet/ip_input.c  29 Jan 2017 19:58:47 -  1.293
+++ netinet/ip_input.c  30 Jan 2017 22:58:09 -
@@ -1654,7 +1654,7 @@ ip_sysctl_ipstat(void *oldp, size_t *old
u_long *words = (u_long *)
int i;
 
-   KASSERT(sizeof(ipstat) == (nitems(counters) * sizeof(u_long)));
+   CTASSERT(sizeof(ipstat) == (nitems(counters) * sizeof(u_long)));
 
counters_read(ipcounters, counters, nitems(counters));
 
Index: netinet/udp_usrreq.c
===
RCS file: /d/cvs/src/sys/netinet/udp_usrreq.c,v
retrieving revision 1.229
diff -u -p -r1.229 udp_usrreq.c
--- netinet/udp_usrreq.c29 Jan 2017 19:58:47 -  1.229
+++ netinet/udp_usrreq.c30 Jan 2017 22:58:27 -
@@ -1352,7 +1352,7 @@ udp_sysctl_udpstat(void *oldp, size_t *o
u_long *words = (u_long *)
int i;
 
-   KASSERT(sizeof(udpstat) == (nitems(counters) * sizeof(u_long)));
+   CTASSERT(sizeof(udpstat) == (nitems(counters) * sizeof(u_long)));
 
counters_read(udpcounters, counters, nitems(counters));
 


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE