stand/ofw: ofw_disk isn't really a disk

The rest of the code in the tree assumes that a DEVT_DISK uses a
disk_devdesc to represent the device. However ofw_disk diesn't, so we
can't use disk_fmtdev, nor disk_parsedev. ofw needs to have a
dv_match-like routine to use devpasrse, though, since we have two
drivers (net and block) that claim the same sort of devices (eg
/path/to/ofw-dev) based on the device-type property. In the interim, we
can't use devmatch and ofw_disk's and the default net driver's parsing
is offloaded ofw_parsedev.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D37347
This commit is contained in:
Warner Losh 2022-11-30 15:09:23 -07:00
parent bb9f61da17
commit daaf594e84
2 changed files with 13 additions and 3 deletions

View File

@ -28,6 +28,8 @@
#include "openfirm.h"
#include <readin.h>
#define DEVT_OFDISK 1001
struct ofw_devdesc {
struct devdesc dd;
union {

View File

@ -49,10 +49,12 @@ static int ofwd_open(struct open_file *f, ...);
static int ofwd_close(struct open_file *f);
static int ofwd_ioctl(struct open_file *f, u_long cmd, void *data);
static int ofwd_print(int verbose);
static char * ofwd_fmtdev(struct devdesc *);
struct devsw ofwdisk = {
.dv_name = "block",
.dv_type = DEVT_DISK,
.dv_type = DEVT_OFDISK,
.dv_init = ofwd_init,
.dv_strategy = ofwd_strategy,
.dv_open = ofwd_open,
@ -60,8 +62,7 @@ struct devsw ofwdisk = {
.dv_ioctl = ofwd_ioctl,
.dv_print = ofwd_print,
.dv_cleanup = nullsys,
.dv_fmtdev = disk_fmtdev,
.dv_parsedev = disk_parsedev,
.dv_fmtdev = ofwd_fmtdev,
};
/*
@ -185,3 +186,10 @@ ofwd_print(int verbose __unused)
{
return (0);
}
static char *
ofwd_fmtdev(struct devdesc *idev)
{
struct ofw_devdesc *dev = (struct ofw_devdesc *)idev;
return (dev->d_path);
}