From nobody Sun Oct 23 01:48:19 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 4Mw1Lr2Nntz4gnff; Sun, 23 Oct 2022 01:48: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 4Mw1Lr1lTlz3XRx; Sun, 23 Oct 2022 01:48:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666489700; 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=WlH1yEMDP34eLqOgMPKmU13dsFLQWW/43dJnypD+lPA=; b=VZwuKbgvos5Hw2giY0qz0g/WuQoZcHKthwMQUkUjByXvNi3l4Ka20hZXfxgK1iiKpKgZQr jplF+WSQZs1KamRgSYRimpBpmoYOM/rKzq0DctC5z9fE87Jh8cMgTnu3Ci1N/ozJT+s0hs C3qqnwuN2FD5TOz2N2+gKeq5GMmVPksodDBiSHpianq1z8jOtq/mYJBe5ab5ot+kAYHQ7z nLh52RvPAeT8M9+YZ2/0vUzcI1RFsrSj22ciOjmT2dqF+GVNBIzLrVKG0r/SYQ5jezSBip sZH+NIDQICMlWSNrZXilKuDHYLysLGrtAy22bAOxQBA3mHPiVj5Yr5fr2CTNaA== 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 4Mw1Lr07ggzknG; Sun, 23 Oct 2022 01:48: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 29N1mJRA069562; Sun, 23 Oct 2022 01:48:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29N1mJhQ069561; Sun, 23 Oct 2022 01:48:19 GMT (envelope-from git) Date: Sun, 23 Oct 2022 01:48:19 GMT Message-Id: <202210230148.29N1mJhQ069561@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: 2cb90a7b2efc - main - 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/main X-Git-Reftype: branch X-Git-Commit: 2cb90a7b2efc41e791c589e17127f63ccf24167c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666489700; 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=WlH1yEMDP34eLqOgMPKmU13dsFLQWW/43dJnypD+lPA=; b=Hnp1BftEH0/6Dse447IC5PcVqb0pD0QQtWaY32UqUUY+33hDkH9pLFKpLaBLEiNDe4bI/X e9oxGMTaXFB1kprQEwdsagh6oo3vpGs2qe9bxwNY2V5donTMcjAGtvw+P07GCxbC2Ku03i ieumEI0MLTY0bZyXdGVxXRcPefA6OdsB27ByS2b+y7fWDgaBWH1j5UdD5m1cthEHqyVJOk VvgqGv8PaOlpg9H2ppMX8hc6Ydm2tgNqL+nPUOLNTggvHeDP7oOtdYfrxrH+dffH/hLHrE R3hivHqYjrORTL6clYgXKN8+hgSrpLm/mxV6wn5Sxs7cAQ3ejAwGLu2Mf93S5Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1666489700; a=rsa-sha256; cv=none; b=Zh1AQz97bUHGOKxrfMVyHrK9+OdELyw1iMheyNdqxsqq7zXtMaTd/mO5nwwf0IiTjVLJ59 Qeek0TtK008PAKu80ZBT5qtfU1HWIj20JimTwm+1axnTEFJiCZDFqqQ0+vijrhGkCkUkGW sGiY0vtDRyM+3O8rG6syiVQmdm8HkXjf2VBBezywoSfUrUrNXrEBGc7JqwGbQX9WY0bDA/ WtbNbFfrIzxbgJEsr91l81Do/yTtIlTvUcFirSMxUI4scKS3LYdq7T2sanSBYG6i8z+qxw SOLbTAmzwRgq9bigmGOoaiceZOC3nRE3gA+O7zGmJ3aUjqTr2Dyh36NhVmEbkQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=2cb90a7b2efc41e791c589e17127f63ccf24167c commit 2cb90a7b2efc41e791c589e17127f63ccf24167c Author: Warner Losh AuthorDate: 2022-10-22 15:09:23 +0000 Commit: Warner Losh CommitDate: 2022-10-23 01:47:24 +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 --- 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);