sctp: use consistent names for locking macros

While there, add also a macro for an assert. Will be used shortly.
No functional change intended.

MFC after:	1 week
This commit is contained in:
Michael Tuexen
2023-08-13 22:32:54 +02:00
parent bef7d49101
commit 6cb8b3b5cd
2 changed files with 9 additions and 4 deletions
+7 -2
View File
@@ -234,12 +234,12 @@ __FBSDID("$FreeBSD$");
* or cookie secrets we lock the INP level.
*/
#define SCTP_INP_READ_INIT(_inp) do { \
#define SCTP_INP_READ_LOCK_INIT(_inp) do { \
mtx_init(&(_inp)->inp_rdata_mtx, "sctp-read", "inpr", \
MTX_DEF | MTX_DUPOK); \
} while (0)
#define SCTP_INP_READ_DESTROY(_inp) do { \
#define SCTP_INP_READ_LOCK_DESTROY(_inp) do { \
mtx_destroy(&(_inp)->inp_rdata_mtx); \
} while (0)
@@ -251,6 +251,11 @@ __FBSDID("$FreeBSD$");
mtx_unlock(&(_inp)->inp_rdata_mtx); \
} while (0)
#define SCTP_INP_READ_LOCK_ASSERT(_inp) do { \
KASSERT(mtx_owned(&(_inp)->inp_rdata_mtx), \
("Don't own INP read queue lock")); \
} while (0)
#define SCTP_INP_LOCK_INIT(_inp) do { \
mtx_init(&(_inp)->inp_mtx, "sctp-inp", "inp", \
MTX_DEF | MTX_DUPOK); \
+2 -2
View File
@@ -2501,7 +2501,7 @@ sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id)
SCTP_INP_LOCK_INIT(inp);
rw_init_flags(&inp->ip_inp.inp.inp_lock, "sctpinp",
RW_RECURSE | RW_DUPOK);
SCTP_INP_READ_INIT(inp);
SCTP_INP_READ_LOCK_INIT(inp);
SCTP_ASOC_CREATE_LOCK_INIT(inp);
/* lock the new ep */
SCTP_INP_WLOCK(inp);
@@ -3678,7 +3678,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from)
crfree(inp->ip_inp.inp.inp_cred);
INP_LOCK_DESTROY(&inp->ip_inp.inp);
SCTP_INP_LOCK_DESTROY(inp);
SCTP_INP_READ_DESTROY(inp);
SCTP_INP_READ_LOCK_DESTROY(inp);
SCTP_ASOC_CREATE_LOCK_DESTROY(inp);
SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_ep), inp);
SCTP_DECR_EP_COUNT();