mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 09:10:28 +00:00
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
This commit is contained in:
parent
bb3230e40b
commit
2cb90a7b2e
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue