From 7b6d78ef23b57da21a82b7f0c48134c638fc57e6 Mon Sep 17 00:00:00 2001 From: alfred Date: Wed, 20 Feb 2002 20:47:21 +0000 Subject: Prefix structure members to protect them against clashes with eg. c++ keywords. This keeps us in sync with NetBSD because they actually committed my delta first. Ok'd by: lennard --- sys/dev/usb/ugen.c | 82 +++++++++++++++++++++--------------------- sys/dev/usb/uhid.c | 14 ++++---- sys/dev/usb/usb.c | 14 ++++---- sys/dev/usb/usb.h | 96 +++++++++++++++++++++++++------------------------- sys/dev/usb/usb_subr.c | 42 +++++++++++----------- sys/dev/usb/usbdi.c | 2 +- 6 files changed, 125 insertions(+), 125 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index ae18038..c529954 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -1161,37 +1161,37 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, case USB_GET_ALTINTERFACE: ai = (struct usb_alt_interface *)addr; err = usbd_device2interface_handle(sc->sc_udev, - ai->interface_index, &iface); + ai->uai_interface_index, &iface); if (err) return (EINVAL); idesc = usbd_get_interface_descriptor(iface); if (idesc == NULL) return (EIO); - ai->alt_no = idesc->bAlternateSetting; + ai->uai_alt_no = idesc->bAlternateSetting; break; case USB_SET_ALTINTERFACE: if (!(flag & FWRITE)) return (EPERM); ai = (struct usb_alt_interface *)addr; err = usbd_device2interface_handle(sc->sc_udev, - ai->interface_index, &iface); + ai->uai_interface_index, &iface); if (err) return (EINVAL); - err = ugen_set_interface(sc, ai->interface_index, ai->alt_no); + err = ugen_set_interface(sc, ai->uai_interface_index, ai->uai_alt_no); if (err) return (EINVAL); break; case USB_GET_NO_ALT: ai = (struct usb_alt_interface *)addr; - cdesc = ugen_get_cdesc(sc, ai->config_index, 0); + cdesc = ugen_get_cdesc(sc, ai->uai_config_index, 0); if (cdesc == NULL) return (EINVAL); - idesc = usbd_find_idesc(cdesc, ai->interface_index, 0); + idesc = usbd_find_idesc(cdesc, ai->uai_interface_index, 0); if (idesc == NULL) { free(cdesc, M_TEMP); return (EINVAL); } - ai->alt_no = usbd_get_no_alts(cdesc, idesc->bInterfaceNumber); + ai->uai_alt_no = usbd_get_no_alts(cdesc, idesc->bInterfaceNumber); free(cdesc, M_TEMP); break; case USB_GET_DEVICE_DESC: @@ -1200,47 +1200,47 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, break; case USB_GET_CONFIG_DESC: cd = (struct usb_config_desc *)addr; - cdesc = ugen_get_cdesc(sc, cd->config_index, 0); + cdesc = ugen_get_cdesc(sc, cd->ucd_config_index, 0); if (cdesc == NULL) return (EINVAL); - cd->desc = *cdesc; + cd->ucd_desc = *cdesc; free(cdesc, M_TEMP); break; case USB_GET_INTERFACE_DESC: id = (struct usb_interface_desc *)addr; - cdesc = ugen_get_cdesc(sc, id->config_index, 0); + cdesc = ugen_get_cdesc(sc, id->uid_config_index, 0); if (cdesc == NULL) return (EINVAL); - if (id->config_index == USB_CURRENT_CONFIG_INDEX && - id->alt_index == USB_CURRENT_ALT_INDEX) - alt = ugen_get_alt_index(sc, id->interface_index); + if (id->uid_config_index == USB_CURRENT_CONFIG_INDEX && + id->uid_alt_index == USB_CURRENT_ALT_INDEX) + alt = ugen_get_alt_index(sc, id->uid_interface_index); else - alt = id->alt_index; - idesc = usbd_find_idesc(cdesc, id->interface_index, alt); + alt = id->uid_alt_index; + idesc = usbd_find_idesc(cdesc, id->uid_interface_index, alt); if (idesc == NULL) { free(cdesc, M_TEMP); return (EINVAL); } - id->desc = *idesc; + id->uid_desc = *idesc; free(cdesc, M_TEMP); break; case USB_GET_ENDPOINT_DESC: ed = (struct usb_endpoint_desc *)addr; - cdesc = ugen_get_cdesc(sc, ed->config_index, 0); + cdesc = ugen_get_cdesc(sc, ed->ued_config_index, 0); if (cdesc == NULL) return (EINVAL); - if (ed->config_index == USB_CURRENT_CONFIG_INDEX && - ed->alt_index == USB_CURRENT_ALT_INDEX) - alt = ugen_get_alt_index(sc, ed->interface_index); + if (ed->ued_config_index == USB_CURRENT_CONFIG_INDEX && + ed->ued_alt_index == USB_CURRENT_ALT_INDEX) + alt = ugen_get_alt_index(sc, ed->ued_interface_index); else - alt = ed->alt_index; - edesc = usbd_find_edesc(cdesc, ed->interface_index, - alt, ed->endpoint_index); + alt = ed->ued_alt_index; + edesc = usbd_find_edesc(cdesc, ed->ued_interface_index, + alt, ed->ued_endpoint_index); if (edesc == NULL) { free(cdesc, M_TEMP); return (EINVAL); } - ed->desc = *edesc; + ed->ued_desc = *edesc; free(cdesc, M_TEMP); break; case USB_GET_FULL_DESC: @@ -1251,10 +1251,10 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, struct usb_full_desc *fd = (struct usb_full_desc *)addr; int error; - cdesc = ugen_get_cdesc(sc, fd->config_index, &len); - if (len > fd->size) - len = fd->size; - iov.iov_base = (caddr_t)fd->data; + cdesc = ugen_get_cdesc(sc, fd->ufd_config_index, &len); + if (len > fd->ufd_size) + len = fd->ufd_size; + iov.iov_base = (caddr_t)fd->ufd_data; iov.iov_len = len; uio.uio_iov = &iov; uio.uio_iovcnt = 1; @@ -1269,15 +1269,15 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, } case USB_GET_STRING_DESC: si = (struct usb_string_desc *)addr; - err = usbd_get_string_desc(sc->sc_udev, si->string_index, - si->language_id, &si->desc); + err = usbd_get_string_desc(sc->sc_udev, si->usd_string_index, + si->usd_language_id, &si->usd_desc); if (err) return (EINVAL); break; case USB_DO_REQUEST: { struct usb_ctl_request *ur = (void *)addr; - int len = UGETW(ur->request.wLength); + int len = UGETW(ur->ucr_request.wLength); struct iovec iov; struct uio uio; void *ptr = 0; @@ -1287,18 +1287,18 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, if (!(flag & FWRITE)) return (EPERM); /* Avoid requests that would damage the bus integrity. */ - if ((ur->request.bmRequestType == UT_WRITE_DEVICE && - ur->request.bRequest == UR_SET_ADDRESS) || - (ur->request.bmRequestType == UT_WRITE_DEVICE && - ur->request.bRequest == UR_SET_CONFIG) || - (ur->request.bmRequestType == UT_WRITE_INTERFACE && - ur->request.bRequest == UR_SET_INTERFACE)) + if ((ur->ucr_request.bmRequestType == UT_WRITE_DEVICE && + ur->ucr_request.bRequest == UR_SET_ADDRESS) || + (ur->ucr_request.bmRequestType == UT_WRITE_DEVICE && + ur->ucr_request.bRequest == UR_SET_CONFIG) || + (ur->ucr_request.bmRequestType == UT_WRITE_INTERFACE && + ur->ucr_request.bRequest == UR_SET_INTERFACE)) return (EINVAL); if (len < 0 || len > 32767) return (EINVAL); if (len != 0) { - iov.iov_base = (caddr_t)ur->data; + iov.iov_base = (caddr_t)ur->ucr_data; iov.iov_len = len; uio.uio_iov = &iov; uio.uio_iovcnt = 1; @@ -1306,7 +1306,7 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, uio.uio_offset = 0; uio.uio_segflg = UIO_USERSPACE; uio.uio_rw = - ur->request.bmRequestType & UT_READ ? + ur->ucr_request.bmRequestType & UT_READ ? UIO_READ : UIO_WRITE; uio.uio_procp = p; ptr = malloc(len, M_TEMP, M_WAITOK); @@ -1316,8 +1316,8 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, goto ret; } } - err = usbd_do_request_flags(sc->sc_udev, &ur->request, - ptr, ur->flags, &ur->actlen); + err = usbd_do_request_flags(sc->sc_udev, &ur->ucr_request, + ptr, ur->ucr_flags, &ur->ucr_actlen); if (err) { error = EIO; goto ret; diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c index be7e8dc..0578133 100644 --- a/sys/dev/usb/uhid.c +++ b/sys/dev/usb/uhid.c @@ -633,9 +633,9 @@ uhid_do_ioctl(sc, cmd, addr, flag, p) case USB_GET_REPORT_DESC: rd = (struct usb_ctl_report_desc *)addr; - size = min(sc->sc_repdesc_size, sizeof rd->data); - rd->size = size; - memcpy(rd->data, sc->sc_repdesc, size); + size = min(sc->sc_repdesc_size, sizeof rd->ucrd_data); + rd->ucrd_size = size; + memcpy(rd->ucrd_data, sc->sc_repdesc, size); break; case USB_SET_IMMED: @@ -653,7 +653,7 @@ uhid_do_ioctl(sc, cmd, addr, flag, p) case USB_GET_REPORT: re = (struct usb_ctl_report *)addr; - switch (re->report) { + switch (re->ucr_report) { case UHID_INPUT_REPORT: size = sc->sc_isize; id = sc->sc_iid; @@ -669,7 +669,7 @@ uhid_do_ioctl(sc, cmd, addr, flag, p) default: return (EINVAL); } - err = usbd_get_report(sc->sc_iface, re->report, id, re->data, + err = usbd_get_report(sc->sc_iface, re->ucr_report, id, re->ucr_data, size); if (err) return (EIO); @@ -677,7 +677,7 @@ uhid_do_ioctl(sc, cmd, addr, flag, p) case USB_SET_REPORT: re = (struct usb_ctl_report *)addr; - switch (re->report) { + switch (re->ucr_report) { case UHID_INPUT_REPORT: size = sc->sc_isize; id = sc->sc_iid; @@ -693,7 +693,7 @@ uhid_do_ioctl(sc, cmd, addr, flag, p) default: return (EINVAL); } - err = usbd_set_report(sc->sc_iface, re->report, id, re->data, + err = usbd_set_report(sc->sc_iface, re->ucr_report, id, re->ucr_data, size); if (err) return (EIO); diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index e54311c..a96bf35 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -470,11 +470,11 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) case USB_REQUEST: { struct usb_ctl_request *ur = (void *)data; - int len = UGETW(ur->request.wLength); + int len = UGETW(ur->ucr_request.wLength); struct iovec iov; struct uio uio; void *ptr = 0; - int addr = ur->addr; + int addr = ur->ucr_addr; usbd_status err; int error = 0; @@ -485,7 +485,7 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) sc->sc_bus->devices[addr] == 0) return (EINVAL); if (len != 0) { - iov.iov_base = (caddr_t)ur->data; + iov.iov_base = (caddr_t)ur->ucr_data; iov.iov_len = len; uio.uio_iov = &iov; uio.uio_iovcnt = 1; @@ -493,7 +493,7 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) uio.uio_offset = 0; uio.uio_segflg = UIO_USERSPACE; uio.uio_rw = - ur->request.bmRequestType & UT_READ ? + ur->ucr_request.bmRequestType & UT_READ ? UIO_READ : UIO_WRITE; uio.uio_procp = p; ptr = malloc(len, M_TEMP, M_WAITOK); @@ -504,7 +504,7 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) } } err = usbd_do_request_flags(sc->sc_bus->devices[addr], - &ur->request, ptr, ur->flags, &ur->actlen); + &ur->ucr_request, ptr, ur->ucr_flags, &ur->ucr_actlen); if (err) { error = EIO; goto ret; @@ -525,7 +525,7 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) case USB_DEVICEINFO: { struct usb_device_info *di = (void *)data; - int addr = di->addr; + int addr = di->udi_addr; usbd_device_handle dev; if (addr < 1 || addr >= USB_MAX_DEVICES) @@ -679,7 +679,7 @@ usb_add_event(int type, struct usb_event *uep) for (ueqi = TAILQ_FIRST(&usb_events); ueqi; ueqi = ueqi_next) { ueqi_next = TAILQ_NEXT(ueqi, next); if (ueqi->ue.u.ue_driver.ue_cookie.cookie == - uep->u.ue_device.cookie.cookie) { + uep->u.ue_device.udi_cookie.cookie) { TAILQ_REMOVE(&usb_events, ueqi, next); free(ueqi, M_USBDEV); usb_nevents--; diff --git a/sys/dev/usb/usb.h b/sys/dev/usb/usb.h index 2951eca..b300dd7 100644 --- a/sys/dev/usb/usb.h +++ b/sys/dev/usb/usb.h @@ -525,58 +525,58 @@ typedef struct { /*** ioctl() related stuff ***/ struct usb_ctl_request { - int addr; - usb_device_request_t request; - void *data; - int flags; + int ucr_addr; + usb_device_request_t ucr_request; + void *ucr_data; + int ucr_flags; #define USBD_SHORT_XFER_OK 0x04 /* allow short reads */ - int actlen; /* actual length transferred */ + int ucr_actlen; /* actual length transferred */ }; struct usb_alt_interface { - int config_index; - int interface_index; - int alt_no; + int uai_config_index; + int uai_interface_index; + int uai_alt_no; }; #define USB_CURRENT_CONFIG_INDEX (-1) #define USB_CURRENT_ALT_INDEX (-1) struct usb_config_desc { - int config_index; - usb_config_descriptor_t desc; + int ucd_config_index; + usb_config_descriptor_t ucd_desc; }; struct usb_interface_desc { - int config_index; - int interface_index; - int alt_index; - usb_interface_descriptor_t desc; + int uid_config_index; + int uid_interface_index; + int uid_alt_index; + usb_interface_descriptor_t uid_desc; }; struct usb_endpoint_desc { - int config_index; - int interface_index; - int alt_index; - int endpoint_index; - usb_endpoint_descriptor_t desc; + int ued_config_index; + int ued_interface_index; + int ued_alt_index; + int ued_endpoint_index; + usb_endpoint_descriptor_t ued_desc; }; struct usb_full_desc { - int config_index; - u_int size; - u_char *data; + int ufd_config_index; + u_int ufd_size; + u_char *ufd_data; }; struct usb_string_desc { - int string_index; - int language_id; - usb_string_descriptor_t desc; + int usd_string_index; + int usd_language_id; + usb_string_descriptor_t usd_desc; }; struct usb_ctl_report_desc { - int size; - u_char data[1024]; /* filled data size will vary */ + int ucrd_size; + u_char ucrd_data[1024]; /* filled data size will vary */ }; typedef struct { u_int32_t cookie; } usb_event_cookie_t; @@ -584,27 +584,27 @@ typedef struct { u_int32_t cookie; } usb_event_cookie_t; #define USB_MAX_DEVNAMES 4 #define USB_MAX_DEVNAMELEN 16 struct usb_device_info { - u_int8_t bus; - u_int8_t addr; /* device address */ - usb_event_cookie_t cookie; - char product[USB_MAX_STRING_LEN]; - char vendor[USB_MAX_STRING_LEN]; - char release[8]; - u_int16_t productNo; - u_int16_t vendorNo; - u_int16_t releaseNo; - u_int8_t class; - u_int8_t subclass; - u_int8_t protocol; - u_int8_t config; - u_int8_t speed; + u_int8_t udi_bus; + u_int8_t udi_addr; /* device address */ + usb_event_cookie_t udi_cookie; + char udi_product[USB_MAX_STRING_LEN]; + char udi_vendor[USB_MAX_STRING_LEN]; + char udi_release[8]; + u_int16_t udi_productNo; + u_int16_t udi_vendorNo; + u_int16_t udi_releaseNo; + u_int8_t udi_class; + u_int8_t udi_subclass; + u_int8_t udi_protocol; + u_int8_t udi_config; + u_int8_t udi_speed; #define USB_SPEED_LOW 1 #define USB_SPEED_FULL 2 #define USB_SPEED_HIGH 3 - int power; /* power consumption in mA, 0 if selfpowered */ - int nports; - char devnames[USB_MAX_DEVNAMES][USB_MAX_DEVNAMELEN]; - u_int8_t ports[16];/* hub only: addresses of devices on ports */ + int udi_power; /* power consumption in mA, 0 if selfpowered */ + int udi_nports; + char udi_devnames[USB_MAX_DEVNAMES][USB_MAX_DEVNAMELEN]; + u_int8_t udi_ports[16];/* hub only: addresses of devices on ports */ #define USB_PORT_ENABLED 0xff #define USB_PORT_SUSPENDED 0xfe #define USB_PORT_POWERED 0xfd @@ -612,12 +612,12 @@ struct usb_device_info { }; struct usb_ctl_report { - int report; - u_char data[1024]; /* filled data size will vary */ + int ucr_report; + u_char ucr_data[1024]; /* filled data size will vary */ }; struct usb_device_stats { - u_long requests[4]; /* indexed by transfer type UE_* */ + u_long uds_requests[4]; /* indexed by transfer type UE_* */ }; /* Events that can be read from /dev/usb */ diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c index abbbe90..d35a621 100644 --- a/sys/dev/usb/usb_subr.c +++ b/sys/dev/usb/usb_subr.c @@ -1156,37 +1156,37 @@ usbd_fill_deviceinfo(usbd_device_handle dev, struct usb_device_info *di, struct usbd_port *p; int i, err, s; - di->bus = USBDEVUNIT(dev->bus->bdev); - di->addr = dev->address; - di->cookie = dev->cookie; - usbd_devinfo_vp(dev, di->vendor, di->product, usedev); - usbd_printBCD(di->release, UGETW(dev->ddesc.bcdDevice)); - di->vendorNo = UGETW(dev->ddesc.idVendor); - di->productNo = UGETW(dev->ddesc.idProduct); - di->releaseNo = UGETW(dev->ddesc.bcdDevice); - di->class = dev->ddesc.bDeviceClass; - di->subclass = dev->ddesc.bDeviceSubClass; - di->protocol = dev->ddesc.bDeviceProtocol; - di->config = dev->config; - di->power = dev->self_powered ? 0 : dev->power; - di->speed = dev->speed; + di->udi_bus = USBDEVUNIT(dev->bus->bdev); + di->udi_addr = dev->address; + di->udi_cookie = dev->cookie; + usbd_devinfo_vp(dev, di->udi_vendor, di->udi_product, usedev); + usbd_printBCD(di->udi_release, UGETW(dev->ddesc.bcdDevice)); + di->udi_vendorNo = UGETW(dev->ddesc.idVendor); + di->udi_productNo = UGETW(dev->ddesc.idProduct); + di->udi_releaseNo = UGETW(dev->ddesc.bcdDevice); + di->udi_class = dev->ddesc.bDeviceClass; + di->udi_subclass = dev->ddesc.bDeviceSubClass; + di->udi_protocol = dev->ddesc.bDeviceProtocol; + di->udi_config = dev->config; + di->udi_power = dev->self_powered ? 0 : dev->power; + di->udi_speed = dev->speed; if (dev->subdevs != NULL) { for (i = 0; dev->subdevs[i] && i < USB_MAX_DEVNAMES; i++) { - strncpy(di->devnames[i], USBDEVPTRNAME(dev->subdevs[i]), + strncpy(di->udi_devnames[i], USBDEVPTRNAME(dev->subdevs[i]), USB_MAX_DEVNAMELEN); - di->devnames[i][USB_MAX_DEVNAMELEN-1] = '\0'; + di->udi_devnames[i][USB_MAX_DEVNAMELEN-1] = '\0'; } } else { i = 0; } for (/*i is set */; i < USB_MAX_DEVNAMES; i++) - di->devnames[i][0] = 0; /* empty */ + di->udi_devnames[i][0] = 0; /* empty */ if (dev->hub) { for (i = 0; - i < sizeof(di->ports) / sizeof(di->ports[0]) && + i < sizeof(di->udi_ports) / sizeof(di->udi_ports[0]) && i < dev->hub->hubdesc.bNbrPorts; i++) { p = &dev->hub->ports[i]; @@ -1203,11 +1203,11 @@ usbd_fill_deviceinfo(usbd_device_handle dev, struct usb_device_info *di, else err = USB_PORT_DISABLED; } - di->ports[i] = err; + di->udi_ports[i] = err; } - di->nports = dev->hub->hubdesc.bNbrPorts; + di->udi_nports = dev->hub->hubdesc.bNbrPorts; } else - di->nports = 0; + di->udi_nports = 0; } void diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c index c762918..368b695 100644 --- a/sys/dev/usb/usbdi.c +++ b/sys/dev/usb/usbdi.c @@ -823,7 +823,7 @@ usb_transfer_complete(xfer) } /* Count completed transfers. */ - ++pipe->device->bus->stats.requests + ++pipe->device->bus->stats.uds_requests [pipe->endpoint->edesc->bmAttributes & UE_XFERTYPE]; xfer->done = 1; -- cgit v1.1