Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

device_lookup_private() puzzle



Trying out an old udsbr(4) on i386, I was surprised to get an error running
radioctl -a, ENXIO on open of /dev/radio.

In /sys/dev/radio.c, printing sc in radioattach and in radioopen show that
sc has a different value in each. Am I right in thinking that that is
wrong?

From radioopen:
    sc = device_lookup_private(&radio_cd, unit);

and device_lookup_private is device_lookup + device_private.

/sys/kern/subr_autoconf.c:
device_lookup(cfdriver_t cd, int unit)
...
    else if ((dv = cd->cd_devs[unit]) != NULL && dv->dv_del_gen != 0)
...
    return dv;
...


and now for the puzzle:

(gdb) print (*{struct device *}radio_cd.cd_devs).dv_xname
$11 = "radio0\000\000\000\000\000\000\000\000\000"
(gdb) print (*{struct device *}radio_cd.cd_devs[0]).dv_xname
$12 = "lºs�002\000\000\000\001\000\000\000\000\000\000"

(gdb) print (*{struct device *}radio_cd.cd_devs).dv_private
$14 = (void *) 0xca73beb0
(gdb) print (*{struct device *}radio_cd.cd_devs[0]).dv_private
$13 = (void *) 0x1

Where is cd_devs filled in? (Possibly a missing/stray & ?)

Cheers,

Patrick


Home | Main Index | Thread Index | Old Index