From nobody Mon May 9 17:55:03 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 15C481AD8A1C; Mon, 9 May 2022 17:55:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KxpjM5356z4sN4; Mon, 9 May 2022 17:55:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652118903; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gIsZost3024lLXZfA2Q07B3iDoD3Lf6/xAfp1y6WjdM=; b=i2jaxDB1y+56x5WBkJjDe0mE6I/zqIHRt+IPzw24/vC9UEVK3TYp2TexIqBh8MK1cMVsFL nsLetFCAuHGU+hwsuQ1rNVtMWoYFwO+xRKXDCRni9NXt2c2ceACBzI7WKx7+9FqPPLHaWK cTBDyifX1w1y2Mj11DeFKdK4IEgW5sHQrO66CyYDzQQIAjGGRPDhH8RFhEYlzAR82nSGgh uW1RM7oVInBdiw2Ist5aR2uroALFP2JzsCsxxAyNhVA/HuGDruo16VHVfgFvG7BgwwvCrE 926OeVCPaHYf603+bFnf0R2BAM6u+HCrSb0DfmycW+An5yv3ntUgBQmMLRZAdQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 71AC915B84; Mon, 9 May 2022 17:55:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 249Ht3Bb061028; Mon, 9 May 2022 17:55:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 249Ht30h061027; Mon, 9 May 2022 17:55:03 GMT (envelope-from git) Date: Mon, 9 May 2022 17:55:03 GMT Message-Id: <202205091755.249Ht30h061027@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 97f8198e95df - main - sockets: make SO_SND/SO_RCV a enum List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 97f8198e95df75f7bf01b885084cfc00f450c396 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652118903; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gIsZost3024lLXZfA2Q07B3iDoD3Lf6/xAfp1y6WjdM=; b=PMRD4XL9fm3wBiGSdJnAROVXikuYHbHBeiv6hymWosDXzUTnWtmkaiP9ZjufSzDElkQrnz J8W2EMlo9xeuIDzVh8wSyLF1b+KH4XgDjWq223G0bYqiGpq1Rzdd72azP4bhKcpTtxofO5 dJDUcVqrcdAhkiHM7nQv9X0u7S5Az37cAwnI9yDQvi1idP8A4jlRPSrZf5PmIQf/BI5hsm uv1Lol87o9DpWwVOpjvjBHCIUgqckpTxv4KrEl8oXu+eqF9HPwo0qu/39eD1RmWOSOAmEK +dbCHzDNoYvaG8Se7zt+8y2indUOIXtVhOY8YmsatyzXck1z4kYkc0S2rURKOA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1652118903; a=rsa-sha256; cv=none; b=MF9VzCX23HfETQayvhM9Iq3xevzB51VBq1SgQJZLRqbN3Spoa5x0pmtpkQ1z+G5oEcMZxW 2tcGyivNWsKGDV6bATz9zy+CIeYJ+s33qPk6iHMIbv39+hJiLxMyv1icWRkaN/d6stB9v8 lXTbqgJDQhil6Xg/RqeUrlmEKu5yVktVEeguh7pOyDsl1o/NP/ecINNIX9Mr4M44OQS3XS EXthkDemrluvihjJbi2U2d0cG/IOZmZ0bOrVpvA1cbzgTT4r4TlSQHbkJDVep31UeemzH8 hHJCI9Ab9ucFnwIqCtBcoJQmUpSfKnqe8oW8SMYrYhDhJnq7DG8wuNeER/dmQw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=97f8198e95df75f7bf01b885084cfc00f450c396 commit 97f8198e95df75f7bf01b885084cfc00f450c396 Author: Gleb Smirnoff AuthorDate: 2022-05-09 17:42:47 +0000 Commit: Gleb Smirnoff CommitDate: 2022-05-09 17:42:47 +0000 sockets: make SO_SND/SO_RCV a enum Not a functional change now. The enum will also be used for other socket buffer related KPIs. --- sys/kern/uipc_socket.c | 6 ++---- sys/sys/socketvar.h | 11 +++++------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 4c4fde0d6a26..f33814efd176 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -4240,7 +4240,7 @@ sodtor_set(struct socket *so, so_dtor_t *func) * Register per-socket buffer upcalls. */ void -soupcall_set(struct socket *so, int which, so_upcall_t func, void *arg) +soupcall_set(struct socket *so, sb_which which, so_upcall_t func, void *arg) { struct sockbuf *sb; @@ -4263,7 +4263,7 @@ soupcall_set(struct socket *so, int which, so_upcall_t func, void *arg) } void -soupcall_clear(struct socket *so, int which) +soupcall_clear(struct socket *so, sb_which which) { struct sockbuf *sb; @@ -4276,8 +4276,6 @@ soupcall_clear(struct socket *so, int which) case SO_SND: sb = &so->so_snd; break; - default: - panic("soupcall_clear: bad which"); } SOCKBUF_LOCK_ASSERT(sb); KASSERT(sb->sb_upcall != NULL, diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h index 019fdfc372ac..b379dc319cea 100644 --- a/sys/sys/socketvar.h +++ b/sys/sys/socketvar.h @@ -281,6 +281,9 @@ struct socket { #define SOCK_SENDBUF_UNLOCK_ASSERT(so) \ mtx_assert(SOCK_SENDBUF_MTX(so), MA_NOTOWNED) +/* 'which' values for socket buffer events and upcalls. */ +typedef enum { SO_RCV, SO_SND } sb_which; + /* * Macros for sockets and socket buffering. */ @@ -443,10 +446,6 @@ struct sockaddr; struct ucred; struct uio; -/* 'which' values for socket upcalls. */ -#define SO_RCV 1 -#define SO_SND 2 - /* Return values for socket upcalls. */ #define SU_OK 0 #define SU_ISCONNECTED 1 @@ -516,8 +515,8 @@ int sosend_generic(struct socket *so, struct sockaddr *addr, struct uio *uio, struct mbuf *top, struct mbuf *control, int flags, struct thread *td); int soshutdown(struct socket *so, int how); -void soupcall_clear(struct socket *, int); -void soupcall_set(struct socket *, int, so_upcall_t, void *); +void soupcall_clear(struct socket *, sb_which); +void soupcall_set(struct socket *, sb_which, so_upcall_t, void *); void solisten_upcall_set(struct socket *, so_upcall_t, void *); void sowakeup(struct socket *so, struct sockbuf *sb); void sowakeup_aio(struct socket *so, struct sockbuf *sb);