mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-17 10:26:15 +00:00
- The last change conflicted with disks on a live system, as opposed to
the psim simulator. Look for the "file" property which only exists on psim disks, and as a bonus, print the contents of this at boot-time, which is the host file being used for the disk image. - remove remaining warnings.
This commit is contained in:
parent
c830473999
commit
ad1c13f493
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=123543
@ -55,7 +55,6 @@ struct ofwd_softc
|
||||
/*
|
||||
* Disk device bus interface.
|
||||
*/
|
||||
static void ofwd_identify(driver_t *, device_t);
|
||||
static int ofwd_probe(device_t);
|
||||
static int ofwd_attach(device_t);
|
||||
|
||||
@ -141,13 +140,19 @@ static int
|
||||
ofwd_probe(device_t dev)
|
||||
{
|
||||
char *type;
|
||||
char fname[32];
|
||||
phandle_t node;
|
||||
|
||||
type = nexus_get_device_type(dev);
|
||||
node = nexus_get_node(dev);
|
||||
|
||||
if (type == NULL ||
|
||||
(strcmp(type, "disk") != 0 && strcmp(type, "block") != 0))
|
||||
return (ENXIO);
|
||||
|
||||
if (OF_getprop(node, "file", fname, sizeof(fname)) == -1)
|
||||
return (ENXIO);
|
||||
|
||||
device_set_desc(dev, "OpenFirmware disk");
|
||||
return (0);
|
||||
}
|
||||
@ -157,14 +162,15 @@ ofwd_attach(device_t dev)
|
||||
{
|
||||
struct ofwd_softc *sc;
|
||||
char path[128];
|
||||
dev_t dsk;
|
||||
char fname[32];
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
sc->ofwd_dev = dev;
|
||||
|
||||
bzero(path, 128);
|
||||
OF_package_to_path(nexus_get_node(dev), path, 128);
|
||||
device_printf(dev, "located at %s\n", path);
|
||||
OF_getprop(nexus_get_node(dev), "file", fname, sizeof(fname));
|
||||
device_printf(dev, "located at %s, file %s\n", path, fname);
|
||||
sc->ofwd_instance = OF_open(path);
|
||||
if (sc->ofwd_instance == -1) {
|
||||
device_printf(dev, "could not create instance\n");
|
||||
|
Loading…
Reference in New Issue
Block a user