On Tue, Nov 08, 2022 at 09:18:47PM +0300, Vitaliy Makkoveev wrote:
> > On 8 Nov 2022, at 21:08, Klemens Nanni <k...@openbsd.org> wrote:
> > 
> > Now properly.  How about a single comment block at the top instead of
> > repeating it for every struct?
> > 
> > 
> 
> You forgot to mark [I] `if_cloners’ within net/if.c.

Like this?  First locking commit in if.c.


diff --git a/sys/net/if.c b/sys/net/if.c
index 58a972b802c..b7fc5258bd4 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -228,6 +228,7 @@ void        if_idxmap_remove(struct ifnet *);
 
 TAILQ_HEAD(, ifg_group) ifg_head = TAILQ_HEAD_INITIALIZER(ifg_head);
 
+/* [I] list of clonable interfaces */
 LIST_HEAD(, if_clone) if_cloners = LIST_HEAD_INITIALIZER(if_cloners);
 int if_cloners_count;
 
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index 28514a0bfcd..6272be882f4 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -73,6 +73,18 @@
  * interfaces.  These routines live in the files if.c and route.c
  */
 
+/*
+ *  Locks used to protect struct members in this file:
+ *     I       immutable after creation
+ *     d       protection left do the driver
+ *     c       only used in ioctl or routing socket contexts (kernel lock)
+ *     K       kernel lock
+ *     N       net lock
+ *
+ *  For SRP related structures that allow lock-free reads, the write lock
+ *  is indicated below.
+ */
+
 struct rtentry;
 struct ifnet;
 struct task;
@@ -82,7 +94,7 @@ struct cpumem;
  * Structure describing a `cloning' interface.
  */
 struct if_clone {
-       LIST_ENTRY(if_clone)     ifc_list;      /* on list of cloners */
+       LIST_ENTRY(if_clone)     ifc_list;      /* [I] on list of cloners */
        const char              *ifc_name;      /* name of device, e.g. `gif' */
        size_t                   ifc_namelen;   /* length of name */
 
@@ -99,17 +111,6 @@ struct if_clone {
   .ifc_destroy = destroy,                                              \
 }
 
-/*
- *  Locks used to protect struct members in this file:
- *     I       immutable after creation
- *     d       protection left do the driver
- *     c       only used in ioctl or routing socket contexts (kernel lock)
- *     K       kernel lock
- *     N       net lock
- *
- *  For SRP related structures that allow lock-free reads, the write lock
- *  is indicated below.
- */
 /*
  * Structure defining a queue for a network interface.
  *

Reply via email to