diff options
author | simokawa <simokawa@FreeBSD.org> | 2003-01-25 14:47:33 +0000 |
---|---|---|
committer | simokawa <simokawa@FreeBSD.org> | 2003-01-25 14:47:33 +0000 |
commit | ea028a97eca8c07525da7487f7d0ee2e909f78b8 (patch) | |
tree | a7d9817a446ea43a90a137c6f9c6ac4f9116a388 /sys/dev/firewire/fwdev.c | |
parent | bd84d01eeac47ef04237e8993ab6d653caa88493 (diff) | |
download | FreeBSD-src-ea028a97eca8c07525da7487f7d0ee2e909f78b8.zip FreeBSD-src-ea028a97eca8c07525da7487f7d0ee2e909f78b8.tar.gz |
Change API of FW_GDEVLST ioctl.
- include information about itself.
- define struct fw_devinfo and use it in struct fw_devlstreq.
- unify EUI64 representation using struct fw_eui64.
Diffstat (limited to 'sys/dev/firewire/fwdev.c')
-rw-r--r-- | sys/dev/firewire/fwdev.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index d096ba1..7233f35 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -531,15 +531,13 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) struct fw_xferq *ir, *it; struct fw_xfer *xfer; struct fw_pkt *fp; + struct fw_devinfo *devinfo; struct fw_devlstreq *fwdevlst = (struct fw_devlstreq *)data; struct fw_asyreq *asyreq = (struct fw_asyreq *)data; struct fw_isochreq *ichreq = (struct fw_isochreq *)data; struct fw_isobufreq *ibufreq = (struct fw_isobufreq *)data; struct fw_asybindreq *bindreq = (struct fw_asybindreq *)data; -#if 0 - struct fw_map_buf *map_buf = (struct fw_map_buf *)data; -#endif struct fw_crom_buf *crom_buf = (struct fw_crom_buf *)data; if (DEV_FWMEM(dev)) @@ -842,19 +840,27 @@ error: err = fw_bindadd(sc->fc, fwb); break; case FW_GDEVLST: - i = 0; - for(fwdev = TAILQ_FIRST(&sc->fc->devices); fwdev != NULL; - fwdev = TAILQ_NEXT(fwdev, link)){ - if(i < fwdevlst->n){ - fwdevlst->dst[i] = fwdev->dst; - fwdevlst->status[i] = - (fwdev->status == FWDEVATTACHED)?1:0; - fwdevlst->eui[i].hi = fwdev->eui.hi; - fwdevlst->eui[i].lo = fwdev->eui.lo; + i = len = 1; + /* myself */ + devinfo = &fwdevlst->dev[0]; + devinfo->dst = sc->fc->nodeid; + devinfo->status = 0; /* XXX */ + devinfo->eui.hi = sc->fc->eui.hi; + devinfo->eui.lo = sc->fc->eui.lo; + for (fwdev = TAILQ_FIRST(&sc->fc->devices); fwdev != NULL; + fwdev = TAILQ_NEXT(fwdev, link)) { + if(len < FW_MAX_DEVLST){ + devinfo = &fwdevlst->dev[len++]; + devinfo->dst = fwdev->dst; + devinfo->status = + (fwdev->status == FWDEVINVAL)?0:1; + devinfo->eui.hi = fwdev->eui.hi; + devinfo->eui.lo = fwdev->eui.lo; } i++; } fwdevlst->n = i; + fwdevlst->info_len = len; break; case FW_GTPMAP: bcopy(sc->fc->topology_map, data, |