From nobody Tue Jan 24 22:12:53 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 4P1h6t2Y6tz3bgCS; Tue, 24 Jan 2023 22:12:54 +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 4P1h6t1K6nz3DvV; Tue, 24 Jan 2023 22:12:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674598374; 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=adCTMgrPvkKZgAgTMNZRE675IzF1jDrciXhTxHcyQ5g=; b=ss7gBbFLQE2RmqeFvrt+I7gnRBBrZGmu3kqm7fmANJnLEGcnbHl4/ZiqRrD4dfSMecuuZP ogfPcjmOuQ/5tcbt6ophiEjaDgLhxguc5J1EZoRAD2pIHzRU8PXkypE1jufb4Z8Hb29Yih HeWZAkMJtXt9ja94Oc7rEwqEldbKv8+SlF2Ol+vty+NU38QDQ4K/ToKDaNYvanNR0a5fJL 2G1oBJSvcOJunWMrqlZdIDIYJ2DaaaID7pZ8iUIUJ+O7q89t24RA/PnuxjwxczDIiLeAGj VFI1Xj6dXKtCVPbwIOpQff7hsHFncgAyAafSXbRN9AnuhN6/hA2ud+/qY6u6UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674598374; 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=adCTMgrPvkKZgAgTMNZRE675IzF1jDrciXhTxHcyQ5g=; b=FtLyKqlXEYgm48PkxkB3uEFjbyNcwRRhZkBoiq1XNuaVTRV/mP9H4o3ZbbmR5o8HrY2hBQ dp2hP0ZVs3o8PE/6Lt6VJDtqdWNnpe6mcXHYvFCDorzaRyETml6crAAIIPOSynuxHgNHx3 Cx6HpKekonY5EhYBO67V92Rtn106WDN/8znvkWkPKr4ym/6ApcqJwoQ92uSUqYZtDlldeO R/oE+g87QtGlQhRwzzvVj3Sbmo9TR9zPSxmKW5pKCPsuOc44C0Dc6L36mXbiin80gIsMwH 8vkK7xpuPLK7hVOdvf2eP020n2dE+q3enFCDtd2+pcLYBCnVlS+zJSAaXMS8jw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674598374; a=rsa-sha256; cv=none; b=TW5t/S8hU0oRs+ey936JaQD72a2l26ezoojYdd0Ri6cOUaxmuS0PUXJi3rdKRaueJL3iCt bWORV5FgdV+Wx+AK3arVewG36sKhT1DA+4+rIQO8KOULcxne4AKvJA9sk7/ifKhQLRDWCO A0AV0g6NQ6OSgpkxxpzKeP0fReMx7fSPzHbnTfW98IwjPQxKdHIlpRWYh7MyYF8RsIuZvX IPRoUItN8V18x3qa6KvTxDnBWgH20r0Z09uIdxWhdKO1Ki/Dh+8P4y6eWnfCdV9Z1QzRwU KclJ/VPd9T0IBsL6E4CLoz+XvKIy7/sqksmfDAa4zo3yuXfSpgOoT+SSN5qXug== 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 4P1h6t0GJHzQVk; Tue, 24 Jan 2023 22:12:54 +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 30OMCrcD087671; Tue, 24 Jan 2023 22:12:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30OMCr9G087670; Tue, 24 Jan 2023 22:12:53 GMT (envelope-from git) Date: Tue, 24 Jan 2023 22:12:53 GMT Message-Id: <202301242212.30OMCr9G087670@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: 228dfdb7f210 - stable/13 - stand/kboot: hostdisk isn't a DEVT_DISK, use a different 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 228dfdb7f2105c7e89d1b708c973e0f88d899475 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=228dfdb7f2105c7e89d1b708c973e0f88d899475 commit 228dfdb7f2105c7e89d1b708c973e0f88d899475 Author: Warner Losh AuthorDate: 2022-10-22 15:09:23 +0000 Commit: Warner Losh CommitDate: 2023-01-24 21:49:36 +0000 stand/kboot: hostdisk isn't a DEVT_DISK, use a different value. We assume in all the code that a DEVT_DISK uses common/disk.c and/or common/part.c and we can access a struct disk_devdesc. hostdisk.c opens raw devices directly, so has no such structures. Define a kboot-specific DEVT_HOSTDISK and use that instead. In addition, disk_fmtdev assumes it is working with a struct disk_devdesc, so write hostdisk_fmtdev as well. Sponsored by: Netflix (cherry picked from commit 2cb90a7b2efc41e791c589e17127f63ccf24167c) --- stand/kboot/hostdisk.c | 14 ++++++++++---- stand/kboot/kboot.h | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/stand/kboot/hostdisk.c b/stand/kboot/hostdisk.c index 487f24fde821..852785497989 100644 --- a/stand/kboot/hostdisk.c +++ b/stand/kboot/hostdisk.c @@ -28,9 +28,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include "bootstrap.h" #include "host_syscall.h" -#include "disk.h" +#include "kboot.h" static int hostdisk_init(void); static int hostdisk_strategy(void *devdata, int flag, daddr_t dblk, @@ -39,10 +38,11 @@ static int hostdisk_open(struct open_file *f, ...); static int hostdisk_close(struct open_file *f); static int hostdisk_ioctl(struct open_file *f, u_long cmd, void *data); static int hostdisk_print(int verbose); +static char *hostdisk_fmtdev(struct devdesc *vdev); struct devsw hostdisk = { .dv_name = "/dev", - .dv_type = DEVT_DISK, + .dv_type = DEVT_HOSTDISK, .dv_init = hostdisk_init, .dv_strategy = hostdisk_strategy, .dv_open = hostdisk_open, @@ -50,7 +50,7 @@ struct devsw hostdisk = { .dv_ioctl = hostdisk_ioctl, .dv_print = hostdisk_print, .dv_cleanup = nullsys, - .dv_fmtdev = disk_fmtdev, + .dv_fmtdev = hostdisk_fmtdev, }; static int @@ -136,3 +136,9 @@ hostdisk_print(int verbose) snprintf(line, sizeof(line), " /dev%d: Host disk\n", 0); return (pager_output(line)); } + +static char * +hostdisk_fmtdev(struct devdesc *vdev) +{ + return (vdev->d_opendata); +} diff --git a/stand/kboot/kboot.h b/stand/kboot/kboot.h index 13c9f9ad3032..679d645d8ff0 100644 --- a/stand/kboot/kboot.h +++ b/stand/kboot/kboot.h @@ -7,6 +7,8 @@ #ifndef KBOOT_H #define KBOOT_H +#define DEVT_HOSTDISK 1234 + void do_init(void); uint64_t kboot_get_phys_load_segment(void); uint8_t kboot_get_kernel_machine_bits(void);