From nobody Mon Apr 25 07:23:42 2022 X-Original-To: dev-commits-src-all@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 0C6391A90DDD; Mon, 25 Apr 2022 07:23:43 +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 4KmxML6Sqzz3FxF; Mon, 25 Apr 2022 07:23:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650871423; 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=Iyi6tX/EJrIvDAw/PcpXUUPYMxQN6m4ey1QytnSpukc=; b=Pcnn2rztAKtTCRdhMT9IHUdtNRm3D8hleAbSBw3bNYmw7ZMP9S5uPkYZ3I+z4ZeJYjxcF1 vZhbAVHYhF0o1KoXWAtdZnoCXOcXWpAkjudN9XI0AhdqkrxAgN1JeIZivUFUN5G03Z8Rpw W6mw1kzGvthEoenEDTK2RddG50K36Yf52qyW+lpxaYpZtjRK9adlXeI+186gLSqXc1RHvf xRZL0Cn63FAIkQ/P4ASY3HN7DnitZeZg/d+Kh4oUiVe+EvveE5ZCu+23mddcvS8J1ITSB5 zN5EkVU+XoRBHohH5WBd0/FJE2+/tW7vgWcgHtInPi4QvyAXVjgXxBW4e5aHCA== 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 BAC8516B12; Mon, 25 Apr 2022 07:23:42 +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 23P7NgQ5065701; Mon, 25 Apr 2022 07:23:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23P7NgJ1065700; Mon, 25 Apr 2022 07:23:42 GMT (envelope-from git) Date: Mon, 25 Apr 2022 07:23:42 GMT Message-Id: <202204250723.23P7NgJ1065700@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: bbddd5881d18 - main - linux(4): Microoptimize bsd_to_linux_sockaddr(). List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bbddd5881d1826a366d09d1e156ec6b64d3715e5 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650871423; 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=Iyi6tX/EJrIvDAw/PcpXUUPYMxQN6m4ey1QytnSpukc=; b=dwu4fplrOob4xpRuN3E8zUz66I1eeA++/OLI7daRugd0XvfnJu254MCNkWjpHz1HCY6suL XQ36fTPuagrzfR6iSw71YITq8U12ArG+4Egcdq82HArOMIz1ZZcXwmv5V4Vrfd0WQcly5E GEDuxPU14LRN665f0wy1O54RYlnk4BpydPEoT7NlSR5XTuNRl07x8JiLzh6pZAG6eYzaaL z7K7EC+fkDX7OWMyEd97zavgoofnfdDTY3KDEum/FZU/RWyJvSugtHCxG4ajQjJrN4kNBB bj+QX1C/Vhebx+VNUAGrdBv9o734Jjr8PAZcuAsbU3uz6jHqDcUjqqjaCICiRA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1650871423; a=rsa-sha256; cv=none; b=bfvxZ9sQuuKx3uzq7GTUOM4l8zz2F1p6B0xLj+W7OrOOcxPdSn0cTbo6UiNAJzG5Gl+hnV 95q2fryRcJzBkaFM/YKNbBg+1+zSLRLFyE2b/HMws6GWeO8Iuym2Gx2V0uoMWJ6PXT8Ruq vEf4xN6k/KucsZvBQjdsagm6bqq8/UQ+lduuQ5MF+BU+3vWF9VBNiN+JwW1oN5ghWhjiM4 Rxz7h5IN0gkbqQRU2qvrQ+PG6nlVL25zAoBz2ezF2eKni7fMGe0pXkVp2+rqSmdBriuG7v 3DXQZv3aT+gk2TFuKmObpFSuOUvjeThIy2QFDo6vLOrlqwEUbjPJrMFEC3fotw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=bbddd5881d1826a366d09d1e156ec6b64d3715e5 commit bbddd5881d1826a366d09d1e156ec6b64d3715e5 Author: Dmitry Chagin AuthorDate: 2022-04-25 07:21:20 +0000 Commit: Dmitry Chagin CommitDate: 2022-04-25 07:21:20 +0000 linux(4): Microoptimize bsd_to_linux_sockaddr(). Differential Revision: https://reviews.freebsd.org/D34725 MFC after: 2 weeks --- sys/compat/linux/linux.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/sys/compat/linux/linux.c b/sys/compat/linux/linux.c index 81ceb964662f..2de5d9ca1911 100644 --- a/sys/compat/linux/linux.c +++ b/sys/compat/linux/linux.c @@ -400,28 +400,20 @@ bsd_to_linux_sockaddr(const struct sockaddr *sa, struct l_sockaddr **lsa, socklen_t len) { struct l_sockaddr *kosa; - int error, bdom; + int bdom; *lsa = NULL; if (len < 2 || len > UCHAR_MAX) return (EINVAL); + bdom = bsd_to_linux_domain(sa->sa_family); + if (bdom == -1) + return (EAFNOSUPPORT); kosa = malloc(len, M_SONAME, M_WAITOK); bcopy(sa, kosa, len); - - bdom = bsd_to_linux_domain(sa->sa_family); - if (bdom == -1) { - error = EAFNOSUPPORT; - goto out; - } - kosa->sa_family = bdom; *lsa = kosa; return (0); - -out: - free(kosa, M_SONAME); - return (error); } int