From nobody Sat Mar 04 09:12:42 2023 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 4PTJyg2VJ8z3vmnQ; Sat, 4 Mar 2023 09:12: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 4PTJyg1DhFz3xvN; Sat, 4 Mar 2023 09:12:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677921163; 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=Ao3PmmlsABwlRRtFOftxGyHH3wtxIsjU04ZxXyLeAC0=; b=sdldINB1z9d5Y3MAbEWB5+rer2Ejvh6y+tGREvFI3x/sXGCPDxRhhtzdeSiidd65peJvhL M0U2nt3yf5Ogu2tmTuXq22soAv8M+x0ZSfmVgmA5IgCDkj2ltKgY1Y3koRtyBjrYaQJaeC /WB9PjB2aoNVCpH9FYGuRSMRJUasGxt5chuuvEB4II95u7ZK7rs9o90HJq4ngIFleNV9RW feDVNE1bl0QXdkfKB0xC9PBvYVXNluqTzzTqBErs3oTwVgKWUjCu4e6cCzm+TuhnSRIwL3 dv5da0Cf3gV+/eEWFpwR18OQLSqZMTaleGc6bXEM1z8Zoe2Evdytga/f7+3iVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677921163; 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=Ao3PmmlsABwlRRtFOftxGyHH3wtxIsjU04ZxXyLeAC0=; b=VaARinklHThIYAkVGj5mEE+zCkflk5HfNsh+XKIdfIAvWk4O+oYABS18xMenugFxrY6X6i Jr3Z3E3j0LR/Sc67Hef5oNsfqbTukA1u3rh2zyQgpFmeypfGXMYia6MejgaNE79d2ErgrT z8y/3lsIIESCGTUiDly8NoDVjsdoz/ns6Gxv84ammHr4Y5UXHJng5K9fFGvXMK/8YTVdnH ApyxNEpvSfFCect8TmjvlkBqYIAmpFrrvgLcFBzngxBujP+VVC+GsZepH83GyYEC8tJY0m UAcox4Ahu8/m4UVj4oZc5EnfKKoVyyFk9dPt7nkjSAAYH3zHQKYCz352onjOGw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677921163; a=rsa-sha256; cv=none; b=OHq0Qvd+21+nqql6qZdDpmsc9uynKtq5g4aj7OhTE9m3QBXp3RsrhL6Z6rWHFtP4nrZeEU s0AkpNHuqiNVvPF4l/3ThZ5zIioNjdAL2s4ZYalrRrfqFsUH3MJ7U4QSSkC4IJMSN8v4Ti 8sydTwVDCx9VrTAJBibViWGDMtiQbApjyxoKz+giavo5/StOYvq0c+BAFDJIp5jRoQK/eg GXGoxQ2H+Kstppf5+OBLu/66IX6IOrTlFGJvpWW//c6dp4tN3z6Hg45983dYu8HXn3jA16 ErumGpVh51ESwppHzn+iYMMH0cd9maoF5soUhJ2ZKmZNa3/sFcCHjQGKAaeZSA== 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 4PTJyf6rHczZGV; Sat, 4 Mar 2023 09:12: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 3249CgnA078809; Sat, 4 Mar 2023 09:12:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 3249CgjV078808; Sat, 4 Mar 2023 09:12:42 GMT (envelope-from git) Date: Sat, 4 Mar 2023 09:12:42 GMT Message-Id: <202303040912.3249CgjV078808@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: 130383f2f10c - main - linux(4): Make linux_ifflags return a value 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: 130383f2f10c110de3379a302766fa098290d5ac Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=130383f2f10c110de3379a302766fa098290d5ac commit 130383f2f10c110de3379a302766fa098290d5ac Author: Dmitry Chagin AuthorDate: 2023-03-04 09:11:38 +0000 Commit: Dmitry Chagin CommitDate: 2023-03-04 09:11:38 +0000 linux(4): Make linux_ifflags return a value To simplify the use of the function in the printf-like statements. Differential Revision: https://reviews.freebsd.org/D38830 --- sys/compat/linsysfs/linsysfs.c | 4 +--- sys/compat/linux/linux.c | 29 +++++++++++++++-------------- sys/compat/linux/linux_common.h | 2 +- sys/compat/linux/linux_ioctl.c | 4 ++-- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/sys/compat/linsysfs/linsysfs.c b/sys/compat/linsysfs/linsysfs.c index f916858a17a7..0c0744a054a0 100644 --- a/sys/compat/linsysfs/linsysfs.c +++ b/sys/compat/linsysfs/linsysfs.c @@ -98,13 +98,11 @@ static int linsysfs_ifnet_flags(PFS_FILL_ARGS) { struct ifnet *ifp; - unsigned short flags; ifp = ifname_linux_to_bsd(td, pn->pn_parent->pn_name, NULL); if (ifp == NULL) return (ENOENT); - linux_ifflags(ifp, &flags); - sbuf_printf(sb, "0x%x\n", flags); + sbuf_printf(sb, "0x%x\n", linux_ifflags(ifp)); return (0); } diff --git a/sys/compat/linux/linux.c b/sys/compat/linux/linux.c index a7844f4bbbcf..135bc10e2dc1 100644 --- a/sys/compat/linux/linux.c +++ b/sys/compat/linux/linux.c @@ -416,33 +416,34 @@ ifname_linux_to_bsd(struct thread *td, const char *lxname, char *bsdname) return (arg.ifp); } -void -linux_ifflags(struct ifnet *ifp, short *flags) +unsigned short +linux_ifflags(struct ifnet *ifp) { - unsigned short fl; + unsigned short fl, flags; fl = (if_getflags(ifp) | if_getdrvflags(ifp)) & 0xffff; - *flags = 0; + flags = 0; if (fl & IFF_UP) - *flags |= LINUX_IFF_UP; + flags |= LINUX_IFF_UP; if (fl & IFF_BROADCAST) - *flags |= LINUX_IFF_BROADCAST; + flags |= LINUX_IFF_BROADCAST; if (fl & IFF_DEBUG) - *flags |= LINUX_IFF_DEBUG; + flags |= LINUX_IFF_DEBUG; if (fl & IFF_LOOPBACK) - *flags |= LINUX_IFF_LOOPBACK; + flags |= LINUX_IFF_LOOPBACK; if (fl & IFF_POINTOPOINT) - *flags |= LINUX_IFF_POINTOPOINT; + flags |= LINUX_IFF_POINTOPOINT; if (fl & IFF_DRV_RUNNING) - *flags |= LINUX_IFF_RUNNING; + flags |= LINUX_IFF_RUNNING; if (fl & IFF_NOARP) - *flags |= LINUX_IFF_NOARP; + flags |= LINUX_IFF_NOARP; if (fl & IFF_PROMISC) - *flags |= LINUX_IFF_PROMISC; + flags |= LINUX_IFF_PROMISC; if (fl & IFF_ALLMULTI) - *flags |= LINUX_IFF_ALLMULTI; + flags |= LINUX_IFF_ALLMULTI; if (fl & IFF_MULTICAST) - *flags |= LINUX_IFF_MULTICAST; + flags |= LINUX_IFF_MULTICAST; + return (flags); } static u_int diff --git a/sys/compat/linux/linux_common.h b/sys/compat/linux/linux_common.h index 9ebaff26b9ff..c25c4abf18ae 100644 --- a/sys/compat/linux/linux_common.h +++ b/sys/compat/linux/linux_common.h @@ -36,7 +36,7 @@ int ifname_bsd_to_linux_name(const char *, char *, size_t); struct ifnet *ifname_linux_to_bsd(struct thread *td, const char *lxname, char *bsdname); -void linux_ifflags(struct ifnet *ifp, short *flags); +unsigned short linux_ifflags(struct ifnet *); int linux_ifhwaddr(struct ifnet *ifp, struct l_sockaddr *lsa); int linux_to_bsd_domain(int domain); diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c index 8900102bbbc7..8551ba180aa4 100644 --- a/sys/compat/linux/linux_ioctl.c +++ b/sys/compat/linux/linux_ioctl.c @@ -2237,9 +2237,9 @@ again: static int linux_gifflags(struct thread *td, struct ifnet *ifp, struct l_ifreq *ifr) { - l_short flags; + unsigned short flags; - linux_ifflags(ifp, &flags); + flags = linux_ifflags(ifp); return (copyout(&flags, &ifr->ifr_flags, sizeof(flags))); }