Index | Thread | Search

From:
Vitaliy Makkoveev <otto@bsdbox.dev>
Subject:
Re: reorder struct inpcb iterator
To:
Alexander Bluhm <bluhm@openbsd.org>
Cc:
tech@openbsd.org
Date:
Sun, 5 Jan 2025 14:24:56 +0300

Download raw body.

Thread
> On 5 Jan 2025, at 14:02, Alexander Bluhm <bluhm@openbsd.org> wrote:
> 
> Hi,
> 
> Reorder struct inpcb fields and shorten struct inpcb_iterator.
> 
> ok?
> 

ok mvs

> bluhm
> 
> Index: netinet/in_pcb.h
> ===================================================================
> RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/in_pcb.h,v
> diff -u -p -r1.162 in_pcb.h
> --- netinet/in_pcb.h	3 Jan 2025 00:49:26 -0000	1.162
> +++ netinet/in_pcb.h	4 Jan 2025 11:06:16 -0000
> @@ -125,10 +125,11 @@ union inpaddru {
>  * control block.
>  */
> struct inpcb {
> +	struct	  inpcbtable *inp_table;	/* [I] inet queue/hash table */
> +	TAILQ_ENTRY(inpcb) inp_queue;		/* [t] inet PCB queue */
> +	/* keep fields above in sync with struct inpcb_iterator */
> 	LIST_ENTRY(inpcb) inp_hash;		/* [t] local and foreign hash */
> 	LIST_ENTRY(inpcb) inp_lhash;		/* [t] local port hash */
> -	TAILQ_ENTRY(inpcb) inp_queue;		/* [t] inet PCB queue */
> -	struct	  inpcbtable *inp_table;	/* [I] inet queue/hash table */
> 	union	  inpaddru inp_faddru;		/* [t] Foreign address. */
> 	union	  inpaddru inp_laddru;		/* [t] Local address. */
> #define	inp_faddr	inp_faddru.iau_addr
> @@ -179,11 +180,9 @@ struct inpcb {
> LIST_HEAD(inpcbhead, inpcb);
> 
> struct inpcb_iterator {
> -	LIST_ENTRY(inpcb) inp_hash;		/* unused */
> -	LIST_ENTRY(inpcb) inp_lhash;		/* unused */
> -	TAILQ_ENTRY(inpcb) inp_queue;		/* [t] inet PCB queue */
> -	SIMPLEQ_ENTRY(inpcb) inp_notify;	/* unused */
> 	struct	  inpcbtable *inp_table;	/* [I] always NULL */
> +	TAILQ_ENTRY(inpcb) inp_queue;		/* [t] inet PCB queue */
> +	/* keep fields above in sync with struct inpcb */
> };
> 
> static inline int
>