On Fri, Jun 30, 2017 at 04:43:06PM +0200, Claudio Jeker wrote:
> Would like to commit this so I can move on.

Just some remarks about variable naming.  But please commit as it
is, cleanup on uncommited diffs is difficult.

> -struct pfkeyv2_socket {
> -     LIST_ENTRY(pfkeyv2_socket)      kcb_list;
> -     struct socket *socket;
> +struct keycb {
> +     struct rawcb                    rcb;
> +     LIST_ENTRY(keycb)       kcb_list;
>       int flags;
>       uint32_t pid;
>       uint32_t registration;    /* Increase size if SATYPE_MAX > 31 */
>       uint rdomain;
>  };

I thinks all these fields should have a kcb_ prefix.

>  int
>  pfkeyv2_attach(struct socket *so, int proto)
>  {
> -     struct pfkeyv2_socket *pfkeyv2_socket;
> +     struct rawcb *rp;
> +     struct keycb *pk;

Could we always name the keycb variable *kp.  This would be consistent
to tcpcb *tp, rawcb *rp, routecp *rop.

>  int
> -pfkeyv2_detach(struct socket *socket, struct proc *p)
> +pfkeyv2_detach(struct socket *so, struct proc *p)
>  {
> -     struct pfkeyv2_socket *pp;
> -     int error;
> -
> -     LIST_FOREACH(pp, &pfkeyv2_sockets, kcb_list)
> -             if (pp->socket == socket)
> -                     break;
> +     struct keycb *pk;

Please call it kp.

>  int
> -pfkeyv2_sendmessage(void **headers, int mode, struct socket *socket,
> +pfkeyv2_sendmessage(void **headers, int mode, struct socket *so,
>      u_int8_t satype, int count, u_int rdomain)
>  {
>       int i, j, rval;
>       void *p, *buffer = NULL;
>       struct mbuf *packet;
> -     struct pfkeyv2_socket *s;
> +     struct keycb *s;

Plaese call it kp.

>  int
> -pfkeyv2_send(struct socket *socket, void *message, int len)
> +pfkeyv2_send(struct socket *so, void *message, int len)
>  {
>       int i, j, s, rval = 0, mode = PFKEYV2_SENDMESSAGE_BROADCAST;
>       int delflag = 0;
> @@ -950,7 +942,7 @@ pfkeyv2_send(struct socket *socket, void
>       struct radix_node_head *rnh;
>       struct radix_node *rn = NULL;
>  
> -     struct pfkeyv2_socket *pfkeyv2_socket, *so = NULL;
> +     struct keycb *pk, *bpk = NULL;

Call it kp, bkp.  Useless NULL initialisation.


>  struct routecb {
> -     struct rawcb    rcb;
> -     struct timeout  timeout;
> -     unsigned int    msgfilter;
> -     unsigned int    flags;
> -     u_int           rtableid;
> +     struct rawcb            rcb;
> +     LIST_ENTRY(routecb)     rcb_list;
> +     struct timeout          timeout;
> +     unsigned int            msgfilter;
> +     unsigned int            flags;
> +     u_int                   rtableid;
>  };

These should have the a rocb_ prefix.  Common prefixes per struct
make grepping the source code much easier.

OK bluhm@

Reply via email to