From nobody Sun Feb 19 00:48:39 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 4PK6P36MLxz3s8n4; Sun, 19 Feb 2023 00:48:39 +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 4PK6P35lfGz43SY; Sun, 19 Feb 2023 00:48:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676767719; 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=w6Hw62Xeby/cWqKrw+KjONxuR882dNDfoE4vEIKf8+I=; b=j6BC8abFi6TFr23DMrKXhOfTFTCxuBEEjshsaYah3pakxG9c7NxsggXl3zzVfatK1WWPgF ApAsVa6UNXm+qSIBe9tzYgpmmxMOw6s9V7epe4UCq5/eFnL2sQQN3DzDBTmz2BNSTrNCqV wwkaKmVU2MW+ww3oO7mlCS4GrDBh+FfMBPfBoKORKH1Vkl6REd9Cg++6CM0EsKWM+VW+V+ pWiEob5oe6YJ7sfHsQPcQr9jN6YeoVqus1ze3tg8oM5lnRD9eOdFiXKAKMkqnJygpt5hGF STfgYvpFDPGeidLpCza4MgxYoyIlYGHHEpELCxfWcn7BeG+3hXuR+3K7ggG91w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676767719; 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=w6Hw62Xeby/cWqKrw+KjONxuR882dNDfoE4vEIKf8+I=; b=HnawUG3NZxBIZuUIgRJZqUep60VpC9204P5pqWfw6/LBu7L/p0+pi+fTzQ7hINLZZLE4sW 4Xh1V4RKGFZTnX/jQiPQEB3AbqEYnGqf1rDBM5pRMKkV8wEad6MqJnU4OpnSED5EYqamMD UWNM+Hzv1tBss4x+MsNW/HaPvGyBLjzLgVGXKe/qkaGFLnjV1woKAF6StvHX8nz0FfnxA/ 00Ji4AJlNhAk+8jHo8kuihmnJ3tv0c5Ex1tyV98jbXtA02WDo2nZSidBf1Fr8bWKOSQp61 sNnPyWKyHvk7K8XF3rsS8W6UANVaNugphN59r6etc0Yh7y6BwiBv8ON2FXHnNA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676767719; a=rsa-sha256; cv=none; b=RPpCVwHeARpI6O+6g6Qij/BXR6dJ81Ky3R6EhdGwLsRg9Pvlu04ehm4DXvhOJxza2SWIEq nB073nc5LYlvDxYfibnPL16gDbXcG0N+sjtPUNwrzZqSJwSQ1s6q+NCPjBy+ogOnsoCxol f6SpR7GDfpkCgUqBNqNzQUwx0U6JFBYYOA5I8QMIZiNsO9XGoZhxo9rH2+XzxXYxbmcW7r yEofDFWfO6eI8WbzgYV/oTz8FwoN/8fzzzdUzDIOXsTsvbXhuRp4E1R6uf2t+P/2XjbRxA 2X28EmGxg+Vu9Q74ZCbzQkGjGW71BFy1Sn6tJ095JjjR50wru1P5iphr7r/T3w== 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 4PK6P34lDnzjbq; Sun, 19 Feb 2023 00:48:39 +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 31J0mdXh069620; Sun, 19 Feb 2023 00:48:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31J0mdl8069619; Sun, 19 Feb 2023 00:48:39 GMT (envelope-from git) Date: Sun, 19 Feb 2023 00:48:39 GMT Message-Id: <202302190048.31J0mdl8069619@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: bae5c36257ec - stable/13 - efivar: support device paths as well as mounted paths in path_to_dp 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bae5c36257ec5289631abf49b33a4041acc84e3c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=bae5c36257ec5289631abf49b33a4041acc84e3c commit bae5c36257ec5289631abf49b33a4041acc84e3c Author: Warner Losh AuthorDate: 2023-02-16 16:36:03 +0000 Commit: Warner Losh CommitDate: 2023-02-19 00:46:57 +0000 efivar: support device paths as well as mounted paths in path_to_dp In path_to_dp, allow passing in either the actual device path "eg /dev/foo/bar" or the path where the device is mounted (say /mnt/baz/bing). In the former case we'll assume the path within the device is nothing (the relpath). In the latter, we'll take from the mount point on down as the relpath. Sponsored by: Netflix Reviewed by: corvink, manu, asomers Differential Revision: https://reviews.freebsd.org/D38616 (cherry picked from commit 57d5ca4eeba6192e91044aad86fca4429966cfac) --- lib/libefivar/efivar-dp-xlate.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/libefivar/efivar-dp-xlate.c b/lib/libefivar/efivar-dp-xlate.c index b6adae80fdb4..586ba7d08180 100644 --- a/lib/libefivar/efivar-dp-xlate.c +++ b/lib/libefivar/efivar-dp-xlate.c @@ -648,6 +648,7 @@ errout: } /* Handles /path/to/file */ +/* Handles /dev/foo/bar */ static int path_to_dp(struct gmesh *mesh, char *path, efidp *dp) { @@ -667,9 +668,19 @@ path_to_dp(struct gmesh *mesh, char *path, efidp *dp) } dev = buf.f_mntfromname; - if (strncmp(dev, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) - dev += sizeof(_PATH_DEV) -1; - ep = rp + strlen(buf.f_mntonname); + /* + * If we're fed a raw /dev/foo/bar, then devfs is returned from the + * statfs call. In that case, use that dev and assume we have a path + * of nothing. + */ + if (strcmp(dev, "devfs") == 0) { + dev = rp + sizeof(_PATH_DEV) - 1; + ep = NULL; + } else { + if (strncmp(dev, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) + dev += sizeof(_PATH_DEV) - 1; + ep = rp + strlen(buf.f_mntonname); + } efimedia = find_geom_efimedia(mesh, dev); #ifdef notyet