summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorKlemens Nanni <kn@cvs.openbsd.org>2022-11-08 18:43:23 +0000
committerKlemens Nanni <kn@cvs.openbsd.org>2022-11-08 18:43:23 +0000
commitbfd9b924c68c6ac6d2bcb653a3a6fff01ac6605f (patch)
treed28d6d88235bf7c5769d8e383228911f1c50185a /sys/net
parentf1d2b107b5849858901f272148fca97750a1af5f (diff)
Document ifc_list immutability
Move up to comment explaining different locks to account for all structs. OK millert mvs
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if.c7
-rw-r--r--sys/net/if_var.h27
2 files changed, 18 insertions, 16 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 99c19721a74..75f57394641 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.669 2022/11/08 17:57:47 kn Exp $ */
+/* $OpenBSD: if.c,v 1.670 2022/11/08 18:43:22 kn Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -228,8 +228,9 @@ void if_idxmap_remove(struct ifnet *);
TAILQ_HEAD(, ifg_group) ifg_head = TAILQ_HEAD_INITIALIZER(ifg_head);
-LIST_HEAD(, if_clone) if_cloners = LIST_HEAD_INITIALIZER(if_cloners);
-int if_cloners_count;
+LIST_HEAD(, if_clone) if_cloners =
+ LIST_HEAD_INITIALIZER(if_cloners); /* [I] list of clonable interfaces */
+int if_cloners_count; /* [I] number of clonable interfaces */
struct rwlock if_cloners_lock = RWLOCK_INITIALIZER("clonelk");
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index 28514a0bfcd..bf4adfbc744 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_var.h,v 1.117 2022/09/08 10:22:06 kn Exp $ */
+/* $OpenBSD: if_var.h,v 1.118 2022/11/08 18:43:22 kn Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
@@ -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 */
@@ -100,17 +112,6 @@ struct if_clone {
}
/*
- * 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.
*
* (Would like to call this struct ``if'', but C isn't PL/1.)