io_return_t scegetstat( dev_t dev, dev_flavor_t flavor, dev_status_t data, natural_t *count) { sce_softc_t ssc = scegetssc(minor(dev)); if (ssc == NULL_SSC) return (D_NO_SUCH_DEVICE); return (net_getstat(&ssc->sce_if, flavor, data, count)); }
static io_return_t device_get_status (void *d, dev_flavor_t flavor, dev_status_t status, mach_msg_type_number_t *count) { if (flavor == NET_FLAGS) { struct net_data *net = (struct net_data *) d; if (*count != 1) return D_INVALID_SIZE; status[0] = net->dev->flags; return D_SUCCESS; } if(flavor >= SIOCIWFIRST && flavor <= SIOCIWLAST) { /* handle wireless ioctl */ if(! IW_IS_GET(flavor)) return D_INVALID_OPERATION; if(*count * sizeof(int) < sizeof(struct ifreq)) return D_INVALID_OPERATION; struct net_data *nd = d; struct linux_device *dev = nd->dev; if(! dev->do_ioctl) return D_INVALID_OPERATION; int result; if (flavor == SIOCGIWRANGE || flavor == SIOCGIWENCODE || flavor == SIOCGIWESSID || flavor == SIOCGIWNICKN || flavor == SIOCGIWSPY) { /* * These ioctls require an `iw_point' as their argument (i.e. * they want to return some data to userspace. * Therefore supply some sane values and carry the data back * to userspace right behind the `struct iwreq'. */ struct iw_point *iwp = &((struct iwreq *) status)->u.data; iwp->length = *count * sizeof (dev_status_t) - sizeof (struct ifreq); iwp->pointer = (void *) status + sizeof (struct ifreq); result = dev->do_ioctl (dev, (struct ifreq *) status, flavor); *count = ((sizeof (struct ifreq) + iwp->length) / sizeof (dev_status_t)); if (iwp->length % sizeof (dev_status_t)) (*count) ++; } else { *count = sizeof(struct ifreq) / sizeof(int); result = dev->do_ioctl(dev, (struct ifreq *) status, flavor); } return result ? D_IO_ERROR : D_SUCCESS; } else { /* common get_status request */ return net_getstat (&((struct net_data *) d)->ifnet, flavor, status, count); } }