From nobody Sat Jan 7 20:26:20 2023 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 4NqBYm5Fwhz2p2jD; Sat, 7 Jan 2023 20:26:20 +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 4NqBYm4kPvz3prB; Sat, 7 Jan 2023 20:26:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673123180; 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=vMHatml6+/PNio26TI49kQzjOHetNBi9vsr6vzHjPYI=; b=tzz2LK4wtd/q2h956GsIwUkflVquLRmNvqx/o8zvyXPAIvqyZyBXSJGYymtesB9xth54fN /FbdxxwAnviyFXh8NjiCNSq2uGa6exETV+IvcfgwfAxrHoeiV88G+9DWGXSTKkWM7ORZO4 +ZJBEBTWTaa9pfArhwYBauzYipgfCw+mqHBEClpJpiv/ymEbUgqC6ZvsJEYCJoVoCOkJpp NvYGi0+B7WZZilDzyp836q9dW4VwLYJ0tLauxzrWProf32PeEyelXMkCjTs922Ef9so2Wg VNJyxwWdj0rL4VSskl3+o2nMD25y3HsYervHj4BZl4XWRhAlRCVHjIF9qbCN3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673123180; 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=vMHatml6+/PNio26TI49kQzjOHetNBi9vsr6vzHjPYI=; b=kicNE2/stDyZrVMly9Ac1G7QKUvzIWbrvvOGGuUKfr1s2EgG9WvGuGw8YdAgEEou8TB981 A2/4fSdGGN4ZYr2qM+ebxBFcXcOTa/ScawrP3U+lfknd150EV4Y5RG5rtyFVoBe19+kdiN PwJxybLd/VazhOyjaRqTvIKlmZ4EjR/D7Qk5gageVJ4uCU0isR/fvA5fqSJIh2lsmdHAUf ajuy+aYzkpbudIvFccK+Cbwxnfrhk1DpVKCYbJC7EzJdB+1urQwUS7WSjThDLnZInosEEz xplZHuuZXlgiw/FPBEy3Iod+a1aSiZUMhRWsFUvHrJc76mIBerjYNMldNi751g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1673123180; a=rsa-sha256; cv=none; b=LzRzApOkrObyY70vkX83ewqgGGu8Iuy7QfJxUnuNtaOLX9W/t22HPmbK3Njeza7tVMTgEI tUaMGgO83m9PJqqZH55D6tRoqHLQ/svC8xyE38nb/FJsdFIg8HPQcedJxgTRto9Rk8q8EA JTyNsvFKrqHWMxE5+K07HZRnLq0kvK+Wc0FeWkOZpaS+kcb2zkCrS50GpZLfOA/vjwXgza AGp5gzszqJ1/HPBUrurysOESiNPLJrFSvCakI5jAbCrticrZzFMhZ7RBlsFBB5RLWn8jXS k4ha3wyl1VWdALpreQn4sProOW/RFNAYZtx6x6dN38R2R1SqKblb3FP/WX1W+g== 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 4NqBYm3lDbzNDB; Sat, 7 Jan 2023 20:26:20 +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 307KQKUj070404; Sat, 7 Jan 2023 20:26:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 307KQKWg070403; Sat, 7 Jan 2023 20:26:20 GMT (envelope-from git) Date: Sat, 7 Jan 2023 20:26:20 GMT Message-Id: <202301072026.307KQKWg070403@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 2f5f17b80c2d - main - stand: Add macros for file types from stat 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2f5f17b80c2d030196e05b12b15d544b363eb058 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=2f5f17b80c2d030196e05b12b15d544b363eb058 commit 2f5f17b80c2d030196e05b12b15d544b363eb058 Author: Warner Losh AuthorDate: 2023-01-07 20:23:05 +0000 Commit: Warner Losh CommitDate: 2023-01-07 20:23:05 +0000 stand: Add macros for file types from stat Add the familiar macros for file types for stat's st_mode member. Prepend HOST_ to the start of these. Make sure all the values match the linux nolibc and uapi headers. These values are the same as native values since they appear to be required by POSIX. Define anyway to allow the reader of the code to know that they are in the 'host (eg Linux)' namespace rather than the 'loader' namespace. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37967 --- stand/kboot/host_syscall.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/stand/kboot/host_syscall.h b/stand/kboot/host_syscall.h index ea0745542a5b..38f0fb04aa95 100644 --- a/stand/kboot/host_syscall.h +++ b/stand/kboot/host_syscall.h @@ -46,6 +46,28 @@ typedef int64_t host_blkcnt_t; #include "stat_arch.h" +/* + * stat flags + * These are arch independent and match the values in nolib and uapi headers + * with HOST_ prepended. + */ +#define HOST_S_IFMT 0170000 +#define HOST_S_IFIFO 0010000 +#define HOST_S_IFCHR 0020000 +#define HOST_S_IFDIR 0040000 +#define HOST_S_IFBLK 0060000 +#define HOST_S_IFREG 0100000 +#define HOST_S_IFLNK 0120000 +#define HOST_S_IFSOCK 0140000 + +#define HOST_S_ISBLK(mode) (((mode) & HOST_S_IFMT) == HOST_S_IFBLK) +#define HOST_S_ISCHR(mode) (((mode) & HOST_S_IFMT) == HOST_S_IFCHR) +#define HOST_S_ISDIR(mode) (((mode) & HOST_S_IFMT) == HOST_S_IFDIR) +#define HOST_S_ISFIFO(mode) (((mode) & HOST_S_IFMT) == HOST_S_IFIFO) +#define HOST_S_ISLNK(mode) (((mode) & HOST_S_IFMT) == HOST_S_IFLNK) +#define HOST_S_ISREG(mode) (((mode) & HOST_S_IFMT) == HOST_S_IFREG) +#define HOST_S_ISSOCK(mode) (((mode) & HOST_S_IFMT) == HOST_S_IFSOCK) + /* * Constants for open, fcntl, etc *