Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/freebsd/freebsd-src.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/stand
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2022-10-22 18:09:23 +0300
committerWarner Losh <imp@FreeBSD.org>2022-10-23 04:47:24 +0300
commit2cb90a7b2efc41e791c589e17127f63ccf24167c (patch)
treec2d1bb9dd203297186cc20c18e24e53c3125fc99 /stand
parentbb3230e40bea68c1a0fc9ba1bee204bc05d7ea78 (diff)
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
Diffstat (limited to 'stand')
-rw-r--r--stand/kboot/hostdisk.c14
-rw-r--r--stand/kboot/kboot.h2
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 <sys/types.h>
#include <stdarg.h>
-#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);