svn commit: r285909 - head/sys/dev/usb/net
Author: marius Date: Mon Jul 27 12:14:14 2015 New Revision: 285909 URL: https://svnweb.freebsd.org/changeset/base/285909 Log: - Probe UICLASS_CDC/UISUBCLASS_ABSTRACT_CONTROL_MODEL/0xff again. This variant of Microsoft RNDIS, i. e. their unofficial version of CDC ACM, has been disabled in r261544 for resolving a conflict with umodem(4). Eventually, in r275790 that problem was dealt with in the right way. However, r275790 failed to put probing of RNDIS devices in question back. - Initialize the device prior to querying it, as required by the RNDIS specification. Otherwise already determining the MAC address may fail rightfully. - On detach, halt the device again. - Use UCDC_SEND_ENCAPSULATED_{COMMAND,RESPONSE}. While these macros are resolving to the same values as UR_{CLEAR_FEATURE,GET_STATUS}, the former set is way more appropriate in this context. - Report unknown - rather: unimplemented - events unconditionally and not just in debug mode. This ensures that we'll get some hint of what is going wrong instead of the driver silently failing. - Deal with the Microsoft ActiveSync requirement of using an input buffer the size of the expected reply or larger - except for variably sized replies - when querying a device. - Fix some pointless NULL checks, style bugs etc. This changes allow urndis(4) to communicate with a Microsoft-certified USB RNDIS test token. MFC after:3 days Sponsored by: genua mbh Modified: head/sys/dev/usb/net/if_urndis.c Modified: head/sys/dev/usb/net/if_urndis.c == --- head/sys/dev/usb/net/if_urndis.cMon Jul 27 10:07:29 2015 (r285908) +++ head/sys/dev/usb/net/if_urndis.cMon Jul 27 12:14:14 2015 (r285909) @@ -78,12 +78,20 @@ static uether_fn_t urndis_start; static uether_fn_t urndis_setmulti; static uether_fn_t urndis_setpromisc; -static uint32_t urndis_ctrl_query(struct urndis_softc *, uint32_t, const void **, uint16_t *); -static uint32_t urndis_ctrl_set(struct urndis_softc *, uint32_t, struct urndis_set_req *, uint16_t); -static uint32_t urndis_ctrl_handle_init(struct urndis_softc *, const struct urndis_comp_hdr *); -static uint32_t urndis_ctrl_handle_query(struct urndis_softc *, const struct urndis_comp_hdr *, const void **, uint16_t *); -static uint32_t urndis_ctrl_handle_reset(struct urndis_softc *, const struct urndis_comp_hdr *); -static uint32_t urndis_ctrl_init(struct urndis_softc *); +static uint32_turndis_ctrl_query(struct urndis_softc *sc, uint32_t oid, + struct urndis_query_req *msg, uint16_t len, + const void **rbuf, uint16_t *rbufsz); +static uint32_turndis_ctrl_set(struct urndis_softc *sc, uint32_t oid, + struct urndis_set_req *msg, uint16_t len); +static uint32_turndis_ctrl_handle_init(struct urndis_softc *sc, + const struct urndis_comp_hdr *hdr); +static uint32_turndis_ctrl_handle_query(struct urndis_softc *sc, + const struct urndis_comp_hdr *hdr, const void **buf, + uint16_t *bufsz); +static uint32_turndis_ctrl_handle_reset(struct urndis_softc *sc, + const struct urndis_comp_hdr *hdr); +static uint32_turndis_ctrl_init(struct urndis_softc *sc); +static uint32_turndis_ctrl_halt(struct urndis_softc *sc); #ifdef USB_DEBUG static int urndis_debug = 0; @@ -93,7 +101,6 @@ SYSCTL_INT(_hw_usb_urndis, OID_AUTO, deb #endif static const struct usb_config urndis_config[URNDIS_N_TRANSFER] = { - [URNDIS_BULK_RX] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -154,7 +161,7 @@ static driver_t urndis_driver = { static devclass_t urndis_devclass; -DRIVER_MODULE(urndis, uhub, urndis_driver, urndis_devclass, NULL, 0); +DRIVER_MODULE(urndis, uhub, urndis_driver, urndis_devclass, NULL, NULL); MODULE_VERSION(urndis, 1); MODULE_DEPEND(urndis, uether, 1, 1, 1); MODULE_DEPEND(urndis, usb, 1, 1, 1); @@ -171,6 +178,9 @@ static const struct usb_ether_methods ur static const STRUCT_USB_HOST_ID urndis_host_devs[] = { /* Generic RNDIS class match */ + {USB_IFACE_CLASS(UICLASS_CDC), + USB_IFACE_SUBCLASS(UISUBCLASS_ABSTRACT_CONTROL_MODEL), + USB_IFACE_PROTOCOL(0xff)}, {USB_IFACE_CLASS(UICLASS_WIRELESS), USB_IFACE_SUBCLASS(UISUBCLASS_RF), USB_IFACE_PROTOCOL(UIPROTO_RNDIS)}, {USB_IFACE_CLASS(UICLASS_IAD), USB_IFACE_SUBCLASS(UISUBCLASS_SYNC), @@ -192,21 +202,27 @@ urndis_probe(device_t dev) static void urndis_attach_post(struct usb_ether *ue) { + /* no-op */ - return; } static int urndis_attach(device_t dev) { + static struct { + union { + struct urndis_query_req query; + struct urndis_set_req set; + }
svn commit: r285911 - in head/sys/dev/vt/hw: efifb fb
Author: marius Date: Mon Jul 27 14:03:34 2015 New Revision: 285911 URL: https://svnweb.freebsd.org/changeset/base/285911 Log: - Nuke dupe $FreeBSD$. - Fix whitespace. MFC after:3 days Modified: head/sys/dev/vt/hw/efifb/efifb.c head/sys/dev/vt/hw/fb/vt_early_fb.c head/sys/dev/vt/hw/fb/vt_fb.c Modified: head/sys/dev/vt/hw/efifb/efifb.c == --- head/sys/dev/vt/hw/efifb/efifb.cMon Jul 27 13:17:57 2015 (r285910) +++ head/sys/dev/vt/hw/efifb/efifb.cMon Jul 27 14:03:34 2015 (r285911) @@ -25,8 +25,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #include sys/cdefs.h @@ -178,4 +176,3 @@ vt_efifb_remap(void *xinfo) info-fb_vbase = (intptr_t)pmap_mapdev_attr(info-fb_pbase, info-fb_size, VM_MEMATTR_WRITE_COMBINING); } - Modified: head/sys/dev/vt/hw/fb/vt_early_fb.c == --- head/sys/dev/vt/hw/fb/vt_early_fb.c Mon Jul 27 13:17:57 2015 (r285910) +++ head/sys/dev/vt/hw/fb/vt_early_fb.c Mon Jul 27 14:03:34 2015 (r285911) @@ -25,8 +25,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #include sys/cdefs.h @@ -127,7 +125,7 @@ vt_efb_initialize(struct fb_info *info) default: panic(Unknown color space fb_depth %d, info-fb_depth); break; -} + } } static phandle_t @@ -213,9 +211,9 @@ vt_efb_init(struct vt_device *vd) if (len == -1) { len = OF_getprop(OF_parent(node), assigned-addresses, pciaddrs, sizeof(pciaddrs)); -} -if (len == -1) -len = 0; + } + if (len == -1) + len = 0; n_pciaddrs = len / sizeof(struct ofw_pci_register); /* @@ -283,7 +281,7 @@ vt_efb_init(struct vt_device *vd) BUS_SPACE_MAP_PREFETCHABLE, (bus_space_handle_t *)info-fb_vbase); #endif -} + } /* blank full size */ len = info-fb_size / 4; Modified: head/sys/dev/vt/hw/fb/vt_fb.c == --- head/sys/dev/vt/hw/fb/vt_fb.c Mon Jul 27 13:17:57 2015 (r285910) +++ head/sys/dev/vt/hw/fb/vt_fb.c Mon Jul 27 14:03:34 2015 (r285911) @@ -25,8 +25,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #include sys/cdefs.h @@ -188,7 +186,6 @@ vt_fb_setpixel(struct vt_device *vd, int /* panic? */ return; } - } void ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r285910 - in head: lib/libc/sys sys/kern sys/sys
Author: ed Date: Mon Jul 27 13:17:57 2015 New Revision: 285910 URL: https://svnweb.freebsd.org/changeset/base/285910 Log: Make shutdown() return ENOTCONN as required by POSIX, part deux. Summary: Back in 2005, maxim@ attempted to fix shutdown() to return ENOTCONN in case the socket was not connected (r150152). This had to be rolled back (r150155), as it broke some of the existing programs that depend on this behavior. I reapplied this change on my system and indeed, syslogd failed to start up. I fixed this back in February (279016) and MFC'ed it to the supported stable branches. Apart from that, things seem to work out all right. Since at least Linux and Mac OS X do the right thing, I'd like to go ahead and give this another try. To keep old copies of syslogd working, only start returning ENOTCONN for recent binaries. I took a look at the XNU sources and they seem to test against both SS_ISCONNECTED, SS_ISCONNECTING and SS_ISDISCONNECTING, instead of just SS_ISCONNECTED. That seams reasonable, so let's do the same. Test Plan: This issue was uncovered while writing tests for shutdown() in CloudABI: https://github.com/NuxiNL/cloudlibc/blob/master/src/libc/sys/socket/shutdown_test.c#L26 Reviewers: glebius, rwatson, #manpages, gnn, #network Reviewed By: gnn, #network Subscribers: bms, mjg, imp Differential Revision: https://reviews.freebsd.org/D3039 Modified: head/lib/libc/sys/shutdown.2 head/sys/kern/uipc_socket.c head/sys/kern/uipc_syscalls.c head/sys/sys/param.h Modified: head/lib/libc/sys/shutdown.2 == --- head/lib/libc/sys/shutdown.2Mon Jul 27 12:14:14 2015 (r285909) +++ head/lib/libc/sys/shutdown.2Mon Jul 27 13:17:57 2015 (r285910) @@ -29,7 +29,7 @@ .\ @(#)shutdown.2 8.1 (Berkeley) 6/4/93 .\ $FreeBSD$ .\ -.Dd March 5, 2007 +.Dd July 27, 2015 .Dt SHUTDOWN 2 .Os .Sh NAME @@ -79,40 +79,26 @@ The following protocol specific actions based on the properties of the socket associated with the file descriptor .Fa s . .Bl -column .Dv PF_INET6 .Dv SOCK_STREAM .Dv IPPROTO_SCTP -.It Sy Domain Ta Sy Type Ta Sy Protocol Ta Sy Return value and action +.It Sy Domain Ta Sy Type Ta Sy Protocol Ta Sy Action .It Dv PF_INET Ta Dv SOCK_DGRAM Ta Dv IPPROTO_SCTP Ta -Return \-1. -The global variable -.Va errno -will be set to -.Er EOPNOTSUPP . +Failure, +as socket is not connected. .It Dv PF_INET Ta Dv SOCK_DGRAM Ta Dv IPPROTO_UDP Ta -Return 0. -ICMP messages will -.Em not -be generated. +Failure, +as socket is not connected. .It Dv PF_INET Ta Dv SOCK_STREAM Ta Dv IPPROTO_SCTP Ta -Return 0. Send queued data and tear down association. .It Dv PF_INET Ta Dv SOCK_STREAM Ta Dv IPPROTO_TCP Ta -Return 0. Send queued data, wait for ACK, then send FIN. .It Dv PF_INET6 Ta Dv SOCK_DGRAM Ta Dv IPPROTO_SCTP Ta -Return \-1. -The global variable -.Va errno -will be set to -.Er EOPNOTSUPP . +Failure, +as socket is not connected. .It Dv PF_INET6 Ta Dv SOCK_DGRAM Ta Dv IPPROTO_UDP Ta -Return 0. -ICMP messages will -.Em not -be generated. +Failure, +as socket is not connected. .It Dv PF_INET6 Ta Dv SOCK_STREAM Ta Dv IPPROTO_SCTP Ta -Return 0. Send queued data and tear down association. .It Dv PF_INET6 Ta Dv SOCK_STREAM Ta Dv IPPROTO_TCP Ta -Return 0. Send queued data, wait for ACK, then send FIN. .El .\ @@ -131,16 +117,10 @@ argument is not a valid file descriptor. The .Fa how argument is invalid. -.It Bq Er EOPNOTSUPP -The socket associated with the file descriptor -.Fa s -does not support this operation. .It Bq Er ENOTCONN The .Fa s -argument specifies a -.Dv SOCK_STREAM -socket which is not connected. +argument specifies a socket which is not connected. .It Bq Er ENOTSOCK The .Fa s Modified: head/sys/kern/uipc_socket.c == --- head/sys/kern/uipc_socket.c Mon Jul 27 12:14:14 2015(r285909) +++ head/sys/kern/uipc_socket.c Mon Jul 27 13:17:57 2015(r285910) @@ -2334,6 +2334,9 @@ soshutdown(struct socket *so, int how) if (!(how == SHUT_RD || how == SHUT_WR || how == SHUT_RDWR)) return (EINVAL); + if ((so-so_state + (SS_ISCONNECTED | SS_ISCONNECTING | SS_ISDISCONNECTING)) == 0) + return (ENOTCONN); CURVNET_SET(so-so_vnet); if (pr-pr_usrreqs-pru_flush != NULL) Modified: head/sys/kern/uipc_syscalls.c == --- head/sys/kern/uipc_syscalls.c Mon Jul 27 12:14:14 2015 (r285909) +++ head/sys/kern/uipc_syscalls.c Mon Jul 27 13:17:57 2015 (r285910) @@ -1383,6 +1383,15 @@ sys_shutdown(td, uap) if (error == 0) { so = fp-f_data; error = soshutdown(so, uap-how); + /* +* Previous versions did not return ENOTCONN, but 0
svn commit: r285914 - head/sys/dev/usb/controller
Author: marius Date: Mon Jul 27 15:26:50 2015 New Revision: 285914 URL: https://svnweb.freebsd.org/changeset/base/285914 Log: - Move the remainder of host controller capability registers reading from xhci_start_controller() to xhci_init(). These values don't change at run- time so there's no point of acquiring them on every USB_HW_POWER_RESUME instead of only once during initialization. In r276717, reading the first couple of registers in question already had been moved as a prerequisite for the changes in that revision. - Identify ASMedia ASM1042A controllers. - Use NULL instead of 0 for pointers. MFC after:3 days Modified: head/sys/dev/usb/controller/xhci.c head/sys/dev/usb/controller/xhci_pci.c Modified: head/sys/dev/usb/controller/xhci.c == --- head/sys/dev/usb/controller/xhci.c Mon Jul 27 14:43:14 2015 (r285913) +++ head/sys/dev/usb/controller/xhci.c Mon Jul 27 15:26:50 2015 (r285914) @@ -375,54 +375,12 @@ xhci_start_controller(struct xhci_softc return (USB_ERR_IOERROR); } - if (!(XREAD4(sc, oper, XHCI_PAGESIZE) XHCI_PAGESIZE_4K)) { - device_printf(sc-sc_bus.parent, Controller does - not support 4K page size.\n); - return (USB_ERR_IOERROR); - } - - temp = XREAD4(sc, capa, XHCI_HCSPARAMS1); - - i = XHCI_HCS1_N_PORTS(temp); - - if (i == 0) { - device_printf(sc-sc_bus.parent, Invalid number - of ports: %u\n, i); - return (USB_ERR_IOERROR); - } - - sc-sc_noport = i; - sc-sc_noslot = XHCI_HCS1_DEVSLOT_MAX(temp); - - if (sc-sc_noslot XHCI_MAX_DEVICES) - sc-sc_noslot = XHCI_MAX_DEVICES; - /* set up number of device slots */ - DPRINTF(CONFIG=0x%08x - 0x%08x\n, XREAD4(sc, oper, XHCI_CONFIG), sc-sc_noslot); XWRITE4(sc, oper, XHCI_CONFIG, sc-sc_noslot); - DPRINTF(Max slots: %u\n, sc-sc_noslot); - - temp = XREAD4(sc, capa, XHCI_HCSPARAMS2); - - sc-sc_noscratch = XHCI_HCS2_SPB_MAX(temp); - - if (sc-sc_noscratch XHCI_MAX_SCRATCHPADS) { - device_printf(sc-sc_bus.parent, XHCI request - too many scratchpads\n); - return (USB_ERR_NOMEM); - } - - DPRINTF(Max scratch: %u\n, sc-sc_noscratch); - - temp = XREAD4(sc, capa, XHCI_HCSPARAMS3); - - sc-sc_exit_lat_max = XHCI_HCS3_U1_DEL(temp) + - XHCI_HCS3_U2_DEL(temp) + 250 /* us */; - temp = XREAD4(sc, oper, XHCI_USBSTS); /* clear interrupts */ @@ -454,29 +412,13 @@ xhci_start_controller(struct xhci_softc XWRITE4(sc, oper, XHCI_DCBAAP_LO, (uint32_t)addr); XWRITE4(sc, oper, XHCI_DCBAAP_HI, (uint32_t)(addr 32)); - /* Setup event table size */ - - temp = XREAD4(sc, capa, XHCI_HCSPARAMS2); - - DPRINTF(HCS2=0x%08x\n, temp); - - temp = XHCI_HCS2_ERST_MAX(temp); - temp = 1U temp; - if (temp XHCI_MAX_RSEG) - temp = XHCI_MAX_RSEG; - - sc-sc_erst_max = temp; - + /* set up event table size */ DPRINTF(ERSTSZ=0x%08x - 0x%08x\n, - XREAD4(sc, runt, XHCI_ERSTSZ(0)), temp); + XREAD4(sc, runt, XHCI_ERSTSZ(0)), sc-sc_erst_max); - XWRITE4(sc, runt, XHCI_ERSTSZ(0), XHCI_ERSTS_SET(temp)); + XWRITE4(sc, runt, XHCI_ERSTSZ(0), XHCI_ERSTS_SET(sc-sc_erst_max)); - /* Check if we should use the default IMOD value */ - if (sc-sc_imod_default == 0) - sc-sc_imod_default = XHCI_IMOD_DEFAULT; - - /* Setup interrupt rate */ + /* set up interrupt rate */ XWRITE4(sc, runt, XHCI_IMOD(0), sc-sc_imod_default); usbd_get_page(sc-sc_hw.root_pc, 0, buf_res); @@ -503,8 +445,7 @@ xhci_start_controller(struct xhci_softc XWRITE4(sc, runt, XHCI_ERSTBA_LO(0), (uint32_t)addr); XWRITE4(sc, runt, XHCI_ERSTBA_HI(0), (uint32_t)(addr 32)); - /* Setup interrupter registers */ - + /* set up interrupter registers */ temp = XREAD4(sc, runt, XHCI_IMAN(0)); temp |= XHCI_IMAN_INTR_ENA; XWRITE4(sc, runt, XHCI_IMAN(0), temp); @@ -615,6 +556,12 @@ xhci_init(struct xhci_softc *sc, device_ DPRINTF(xHCI version = 0x%04x\n, XREAD2(sc, capa, XHCI_HCIVERSION)); + if (!(XREAD4(sc, oper, XHCI_PAGESIZE) XHCI_PAGESIZE_4K)) { + device_printf(sc-sc_bus.parent, Controller does + not support 4K page size.\n); + return (ENXIO); + } + temp = XREAD4(sc, capa, XHCI_HCSPARAMS0); DPRINTF(HCS0 = 0x%08x\n, temp); @@ -633,6 +580,55 @@ xhci_init(struct xhci_softc *sc, device_ device_printf(self, %d bytes context size, %d-bit DMA\n, sc-sc_ctx_is_64_byte ? 64 : 32, (int)sc-sc_bus.dma_bits); + temp = XREAD4(sc, capa, XHCI_HCSPARAMS1);
svn commit: r285913 - in head: etc/devd sys/dev/usb/net
Author: marius Date: Mon Jul 27 14:43:14 2015 New Revision: 285913 URL: https://svnweb.freebsd.org/changeset/base/285913 Log: - Fix compilation after r285909 with USB_DEBUG defined. - Regenerate usb.conf. Modified: head/etc/devd/usb.conf head/sys/dev/usb/net/if_urndis.c Modified: head/etc/devd/usb.conf == --- head/etc/devd/usb.conf Mon Jul 27 14:34:32 2015(r285912) +++ head/etc/devd/usb.conf Mon Jul 27 14:43:14 2015(r285913) @@ -5436,6 +5436,15 @@ nomatch 32 { nomatch 32 { match bus uhub[0-9]+; match mode host; + match intclass 0x02; + match intsubclass 0x02; + match intprotocol 0xff; + action kldload -n if_urndis; +}; + +nomatch 32 { + match bus uhub[0-9]+; + match mode host; match intclass 0x03; match intsubclass 0x01; match intprotocol 0x01; @@ -5576,5 +5585,5 @@ nomatch 32 { action kldload -n umass; }; -# 2687 USB entries processed +# 2688 USB entries processed Modified: head/sys/dev/usb/net/if_urndis.c == --- head/sys/dev/usb/net/if_urndis.cMon Jul 27 14:34:32 2015 (r285912) +++ head/sys/dev/usb/net/if_urndis.cMon Jul 27 14:43:14 2015 (r285913) @@ -735,13 +735,13 @@ urndis_ctrl_query(struct urndis_softc *s DPRINTF(type %u len %u rid %u oid 0x%x infobuflen %u infobufoffset %u devicevchdl %u\n, - le32toh(msg.rm_type), - le32toh(msg.rm_len), - le32toh(msg.rm_rid), - le32toh(msg.rm_oid), - le32toh(msg.rm_infobuflen), - le32toh(msg.rm_infobufoffset), - le32toh(msg.rm_devicevchdl)); + le32toh(msg-rm_type), + le32toh(msg-rm_len), + le32toh(msg-rm_rid), + le32toh(msg-rm_oid), + le32toh(msg-rm_infobuflen), + le32toh(msg-rm_infobufoffset), + le32toh(msg-rm_devicevchdl)); rval = urndis_ctrl_send(sc, msg, len); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r285912 - head/sys/dev/vt/colors
Author: marius Date: Mon Jul 27 14:34:32 2015 New Revision: 285912 URL: https://svnweb.freebsd.org/changeset/base/285912 Log: - Use __FBSDID(). - Const'ify cons_to_vga_colors. - Fix line wrapping. MFC after:3 days Modified: head/sys/dev/vt/colors/vt_termcolors.c Modified: head/sys/dev/vt/colors/vt_termcolors.c == --- head/sys/dev/vt/colors/vt_termcolors.c Mon Jul 27 14:03:34 2015 (r285911) +++ head/sys/dev/vt/colors/vt_termcolors.c Mon Jul 27 14:34:32 2015 (r285912) @@ -25,15 +25,16 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ +#include sys/cdefs.h +__FBSDID($FreeBSD$); + #include sys/param.h #include dev/vt/colors/vt_termcolors.h -static struct { +static const struct { unsigned char r;/* Red percentage value. */ unsigned char g;/* Green percentage value. */ unsigned char b;/* Blue percentage value. */ @@ -68,8 +69,8 @@ static const int cons_to_vga_colors[16] }; int -vt_generate_cons_palette(uint32_t *palette, int format, uint32_t rmax, int roffset, -uint32_t gmax, int goffset, uint32_t bmax, int boffset) +vt_generate_cons_palette(uint32_t *palette, int format, uint32_t rmax, +int roffset, uint32_t gmax, int goffset, uint32_t bmax, int boffset) { int i; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r285923 - head/usr.bin/ident
Author: delphij Date: Mon Jul 27 19:21:23 2015 New Revision: 285923 URL: https://svnweb.freebsd.org/changeset/base/285923 Log: Rewrite scan procedure with a FSM. This improves code readability by making clear transits between different states, and avoids bug with handling repeated $'s. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D3221 Modified: head/usr.bin/ident/ident.c Modified: head/usr.bin/ident/ident.c == --- head/usr.bin/ident/ident.c Mon Jul 27 17:53:11 2015(r285922) +++ head/usr.bin/ident/ident.c Mon Jul 27 19:21:23 2015(r285923) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2015 Baptiste Daroussin b...@freebsd.org + * Copyright (c) 2015 Xin LI delp...@freebsd.org * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,68 +39,23 @@ __FBSDID($FreeBSD$); #include unistd.h #include xlocale.h -static bool -parse_id(FILE *fp, struct sbuf *buf, locale_t l) -{ - int c; - bool isid = false; - bool subversion = false; - - sbuf_putc(buf, '$'); - while ((c = fgetc(fp)) != EOF) { - sbuf_putc(buf, c); - if (!isid) { - if (c == '$') { - sbuf_clear(buf); - sbuf_putc(buf, '$'); - continue; - } - if (c == ':') { -c = fgetc(fp); -/* accept :: for subversion compatibility */ -if (c == ':') { - subversion = true; - sbuf_putc(buf, c); - c = fgetc(fp); - } - if (c == ' ') { - sbuf_putc(buf, c); - isid = true; - continue; - } - return (false); - } - - if (!isalpha_l(c, l)) - return (false); - } else { - if (c == '\n') - return (false); - if (c == '$') { - sbuf_finish(buf); - /* should end with a space */ - c = sbuf_data(buf)[sbuf_len(buf) - 2]; - if (!subversion) { - if (c != ' ') - return (0); - } else if (subversion) { - if (c != ' ' c != '#') - return (0); - } - printf( %s\n, sbuf_data(buf)); - return (true); - } - } - } - - return (false); -} +typedef enum { + /* statecondition to transit to next state */ + INIT, /* '$' */ + DELIM_SEEN, /* letter */ + KEYWORD,/* punctuation mark */ + PUNC_SEEN, /* ':' - _SVN; space - TEXT */ + PUNC_SEEN_SVN, /* space */ + TEXT +} analyzer_states; static int scan(FILE *fp, const char *name, bool quiet) { int c; bool hasid = false; + bool subversion = false; + analyzer_states state = INIT; struct sbuf *id = sbuf_new_auto(); locale_t l; @@ -109,10 +65,123 @@ scan(FILE *fp, const char *name, bool qu printf(%s:\n, name); while ((c = fgetc(fp)) != EOF) { - if (c == '$') { - sbuf_clear(id); - if (parse_id(fp, id, l)) - hasid = true; + switch (state) { + case INIT: + if (c == '$') { + /* Transit to DELIM_SEEN if we see $ */ + state = DELIM_SEEN; + } else { + /* Otherwise, stay in INIT state */ + continue; + } + break; + case DELIM_SEEN: + if (isalpha_l(c, l)) { + /* Transit to KEYWORD if we see letter */ + sbuf_clear(id); + sbuf_putc(id, '$'); + sbuf_putc(id, c); + state = KEYWORD; + + continue; + } else if (c == '$') { +
svn commit: r285925 - head/sys/netinet
Author: tuexen Date: Mon Jul 27 22:35:54 2015 New Revision: 285925 URL: https://svnweb.freebsd.org/changeset/base/285925 Log: Provide consistent error causes whenever an ABORT chunk is sent. MFC after:1 week Modified: head/sys/netinet/sctp_asconf.c head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_timer.c head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctp_asconf.c == --- head/sys/netinet/sctp_asconf.c Mon Jul 27 22:20:28 2015 (r285924) +++ head/sys/netinet/sctp_asconf.c Mon Jul 27 22:35:54 2015 (r285925) @@ -1680,8 +1680,14 @@ sctp_handle_asconf_ack(struct mbuf *m, i * abort the asoc, since someone probably just hijacked us... */ if (serial_num == (asoc-asconf_seq_out + 1)) { + struct mbuf *op_err; + char msg[SCTP_DIAG_INFO_LEN]; + SCTPDBG(SCTP_DEBUG_ASCONF1, handle_asconf_ack: got unexpected next serial number! Aborting asoc!\n); - sctp_abort_an_association(stcb-sctp_ep, stcb, NULL, SCTP_SO_NOT_LOCKED); + snprintf(msg, sizeof(msg), Never sent serial number %8.8x, + serial_num); + op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); + sctp_abort_an_association(stcb-sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); *abort_no_unlock = 1; return; } Modified: head/sys/netinet/sctp_indata.c == --- head/sys/netinet/sctp_indata.c Mon Jul 27 22:20:28 2015 (r285924) +++ head/sys/netinet/sctp_indata.c Mon Jul 27 22:35:54 2015 (r285925) @@ -2488,8 +2488,11 @@ sctp_process_data(struct mbuf **mm, int */ if (SCTP_BASE_SYSCTL(sctp_strict_data_order)) { struct mbuf *op_err; + char msg[SCTP_DIAG_INFO_LEN]; - op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, ); + snprintf(msg, sizeof(msg), DATA chunk followwd by chunk of type %2.2x, + ch-ch.chunk_type); + op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); sctp_abort_association(inp, stcb, m, iphlen, src, dst, Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Mon Jul 27 22:20:28 2015 (r285924) +++ head/sys/netinet/sctp_input.c Mon Jul 27 22:35:54 2015 (r285925) @@ -4624,7 +4624,7 @@ __attribute__((noinline)) } } if (stcb == NULL) { - snprintf(msg, sizeof(msg), OOTB, %s:%d at %s\n, __FILE__, __LINE__, __FUNCTION__); + snprintf(msg, sizeof(msg), OOTB, %s:%d at %s, __FILE__, __LINE__, __FUNCTION__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); /* no association, so it's out of the blue... */ @@ -4668,7 +4668,7 @@ __attribute__((noinline)) if (locked_tcb) { SCTP_TCB_UNLOCK(locked_tcb); } - snprintf(msg, sizeof(msg), OOTB, %s:%d at %s\n, __FILE__, __LINE__, __FUNCTION__); + snprintf(msg, sizeof(msg), OOTB, %s:%d at %s, __FILE__, __LINE__, __FUNCTION__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); sctp_handle_ootb(m, iphlen, *offset, src, dst, @@ -5834,7 +5834,7 @@ sctp_common_input_processing(struct mbuf */ SCTP_TCB_UNLOCK(stcb); stcb = NULL; - snprintf(msg, sizeof(msg), OOTB, %s:%d at %s\n, __FILE__, __LINE__, __FUNCTION__); + snprintf(msg, sizeof(msg), OOTB, %s:%d at %s, __FILE__, __LINE__, __FUNCTION__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); sctp_handle_ootb(m, iphlen, offset, src, dst, sh, inp, op_err, @@ -5886,7 +5886,7 @@ sctp_common_input_processing(struct mbuf } if (stcb == NULL) { /* out of the
svn commit: r285907 - head/sys/compat/cloudabi64
Author: ed Date: Mon Jul 27 10:04:28 2015 New Revision: 285907 URL: https://svnweb.freebsd.org/changeset/base/285907 Log: Regenerate system call table. Modified: head/sys/compat/cloudabi64/cloudabi64_proto.h head/sys/compat/cloudabi64/cloudabi64_syscall.h head/sys/compat/cloudabi64/cloudabi64_syscalls.c head/sys/compat/cloudabi64/cloudabi64_sysent.c head/sys/compat/cloudabi64/cloudabi64_systrace_args.c Modified: head/sys/compat/cloudabi64/cloudabi64_proto.h == --- head/sys/compat/cloudabi64/cloudabi64_proto.h Mon Jul 27 10:04:06 2015(r285906) +++ head/sys/compat/cloudabi64/cloudabi64_proto.h Mon Jul 27 10:04:28 2015(r285907) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/cloudabi64/syscalls.master 285790 2015-07-22 10:04:53Z ed + * created from FreeBSD: head/sys/compat/cloudabi64/syscalls.master 285906 2015-07-27 10:04:06Z ed */ #ifndef _CLOUDABI64_SYSPROTO_H_ @@ -43,7 +43,7 @@ struct cloudabi_sys_clock_time_get_args }; struct cloudabi_sys_condvar_signal_args { char condvar_l_[PADL_(cloudabi_condvar_t *)]; cloudabi_condvar_t * condvar; char condvar_r_[PADR_(cloudabi_condvar_t *)]; - char scope_l_[PADL_(cloudabi_futexscope_t)]; cloudabi_futexscope_t scope; char scope_r_[PADR_(cloudabi_futexscope_t)]; + char scope_l_[PADL_(cloudabi_mflags_t)]; cloudabi_mflags_t scope; char scope_r_[PADR_(cloudabi_mflags_t)]; char nwaiters_l_[PADL_(cloudabi_nthreads_t)]; cloudabi_nthreads_t nwaiters; char nwaiters_r_[PADR_(cloudabi_nthreads_t)]; }; struct cloudabi_sys_fd_close_args { @@ -194,7 +194,7 @@ struct cloudabi_sys_file_unlink_args { }; struct cloudabi_sys_lock_unlock_args { char lock_l_[PADL_(cloudabi_lock_t *)]; cloudabi_lock_t * lock; char lock_r_[PADR_(cloudabi_lock_t *)]; - char scope_l_[PADL_(cloudabi_futexscope_t)]; cloudabi_futexscope_t scope; char scope_r_[PADR_(cloudabi_futexscope_t)]; + char scope_l_[PADL_(cloudabi_mflags_t)]; cloudabi_mflags_t scope; char scope_r_[PADR_(cloudabi_mflags_t)]; }; struct cloudabi_sys_mem_advise_args { char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)]; @@ -302,7 +302,7 @@ struct cloudabi64_sys_thread_create_args }; struct cloudabi_sys_thread_exit_args { char lock_l_[PADL_(cloudabi_lock_t *)]; cloudabi_lock_t * lock; char lock_r_[PADR_(cloudabi_lock_t *)]; - char scope_l_[PADL_(cloudabi_futexscope_t)]; cloudabi_futexscope_t scope; char scope_r_[PADR_(cloudabi_futexscope_t)]; + char scope_l_[PADL_(cloudabi_mflags_t)]; cloudabi_mflags_t scope; char scope_r_[PADR_(cloudabi_mflags_t)]; }; struct cloudabi_sys_thread_tcb_set_args { char tcb_l_[PADL_(void *)]; void * tcb; char tcb_r_[PADR_(void *)]; Modified: head/sys/compat/cloudabi64/cloudabi64_syscall.h == --- head/sys/compat/cloudabi64/cloudabi64_syscall.h Mon Jul 27 10:04:06 2015(r285906) +++ head/sys/compat/cloudabi64/cloudabi64_syscall.h Mon Jul 27 10:04:28 2015(r285907) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/cloudabi64/syscalls.master 285790 2015-07-22 10:04:53Z ed + * created from FreeBSD: head/sys/compat/cloudabi64/syscalls.master 285906 2015-07-27 10:04:06Z ed */ #defineCLOUDABI64_SYS_cloudabi_sys_clock_res_get 0 Modified: head/sys/compat/cloudabi64/cloudabi64_syscalls.c == --- head/sys/compat/cloudabi64/cloudabi64_syscalls.cMon Jul 27 10:04:06 2015(r285906) +++ head/sys/compat/cloudabi64/cloudabi64_syscalls.cMon Jul 27 10:04:28 2015(r285907) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/cloudabi64/syscalls.master 285790 2015-07-22 10:04:53Z ed + * created from FreeBSD: head/sys/compat/cloudabi64/syscalls.master 285906 2015-07-27 10:04:06Z ed */ const char *cloudabi64_syscallnames[] = { Modified: head/sys/compat/cloudabi64/cloudabi64_sysent.c == --- head/sys/compat/cloudabi64/cloudabi64_sysent.c Mon Jul 27 10:04:06 2015(r285906) +++ head/sys/compat/cloudabi64/cloudabi64_sysent.c Mon Jul 27 10:04:28 2015(r285907) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/cloudabi64/syscalls.master 285790 2015-07-22 10:04:53Z ed + * created from FreeBSD: head/sys/compat/cloudabi64/syscalls.master 285906 2015-07-27 10:04:06Z ed */ #include sys/sysent.h Modified:
svn commit: r285906 - in head/sys: compat/cloudabi64 contrib/cloudabi
Author: ed Date: Mon Jul 27 10:04:06 2015 New Revision: 285906 URL: https://svnweb.freebsd.org/changeset/base/285906 Log: Sync in latest upstream system call definitions. Futex object scopes have been renamed from using their own constants to simply reusing the existing CLOUDABI_MAP_{PRIVATE,SHARED} flags, as they are more accurate in this context. Modified: head/sys/compat/cloudabi64/syscalls.master head/sys/contrib/cloudabi/syscalldefs_md.h head/sys/contrib/cloudabi/syscalldefs_mi.h Modified: head/sys/compat/cloudabi64/syscalls.master == --- head/sys/compat/cloudabi64/syscalls.master Mon Jul 27 04:11:41 2015 (r285905) +++ head/sys/compat/cloudabi64/syscalls.master Mon Jul 27 10:04:06 2015 (r285906) @@ -21,7 +21,7 @@ 2 AUE_NULLSTD { void cloudabi_sys_condvar_signal( \ cloudabi_condvar_t *condvar, \ - cloudabi_futexscope_t scope, \ + cloudabi_mflags_t scope, \ cloudabi_nthreads_t nwaiters); } 3 AUE_NULLSTD { void cloudabi_sys_fd_close( \ @@ -132,7 +132,7 @@ 31 AUE_NULLSTD { void cloudabi_sys_lock_unlock( \ cloudabi_lock_t *lock, \ - cloudabi_futexscope_t scope); } + cloudabi_mflags_t scope); } 32 AUE_NULLSTD { void cloudabi_sys_mem_advise( \ void *addr, size_t len, \ @@ -209,6 +209,6 @@ cloudabi64_threadattr_t *attr); } 54 AUE_NULLSTD { void cloudabi_sys_thread_exit( \ cloudabi_lock_t *lock, \ - cloudabi_futexscope_t scope); } + cloudabi_mflags_t scope); } 55 AUE_NULLSTD { void cloudabi_sys_thread_tcb_set(void *tcb); } 56 AUE_NULLSTD { void cloudabi_sys_thread_yield(); } Modified: head/sys/contrib/cloudabi/syscalldefs_md.h == --- head/sys/contrib/cloudabi/syscalldefs_md.h Mon Jul 27 04:11:41 2015 (r285905) +++ head/sys/contrib/cloudabi/syscalldefs_md.h Mon Jul 27 10:04:06 2015 (r285906) @@ -193,8 +193,8 @@ typedef struct { struct { MEMBER(PTR(_Atomic(cloudabi_condvar_t))) condvar; MEMBER(PTR(_Atomic(cloudabi_lock_t))) lock; - MEMBER(cloudabi_futexscope_t) condvar_scope; - MEMBER(cloudabi_futexscope_t) lock_scope; + MEMBER(cloudabi_mflags_t) condvar_scope; + MEMBER(cloudabi_mflags_t) lock_scope; } condvar; // CLOUDABI_EVENTTYPE_FD_READ and CLOUDABI_EVENTTYPE_FD_WRITE: @@ -208,7 +208,7 @@ typedef struct { // and acquire a read or write lock. struct { MEMBER(PTR(_Atomic(cloudabi_lock_t))) lock; - MEMBER(cloudabi_futexscope_t) lock_scope; + MEMBER(cloudabi_mflags_t) lock_scope; } lock; // CLOUDABI_EVENTTYPE_PROC_TERMINATE: Wait for a process to terminate. Modified: head/sys/contrib/cloudabi/syscalldefs_mi.h == --- head/sys/contrib/cloudabi/syscalldefs_mi.h Mon Jul 27 04:11:41 2015 (r285905) +++ head/sys/contrib/cloudabi/syscalldefs_mi.h Mon Jul 27 10:04:06 2015 (r285906) @@ -189,10 +189,6 @@ #define CLOUDABI_FILETYPE_SOCKET_STREAM 0x82 #define CLOUDABI_FILETYPE_SYMBOLIC_LINK 0x90 -// Futex object scopes. -#define CLOUDABI_FUTEXSCOPE_GLOBAL 1 -#define CLOUDABI_FUTEXSCOPE_PROCESS_LOCAL 2 - // Read-write lock related constants. #define CLOUDABI_LOCK_UNLOCKED 0 // Lock is unlocked. #define CLOUDABI_LOCK_WRLOCKED 0x4000// Lock is write locked. @@ -354,7 +350,6 @@ typedef int64_t cloudabi_filedelta_t; typedef uint64_t cloudabi_filesize_t; // ftruncate(), struct stat::st_size. typedef uint8_t cloudabi_filetype_t;// struct stat::st_mode. typedef uint16_t cloudabi_fsflags_t;// file_stat_put(). -typedef uint8_t cloudabi_futexscope_t; // Scope of lock or condition variable. typedef uint64_t cloudabi_inode_t; // struct stat::st_ino. typedef uint32_t cloudabi_linkcount_t; // struct stat::st_nlink. typedef uint32_t cloudabi_lock_t; // pthread_{mutex,rwlock}_*(). ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r285908 - head/sys/compat/cloudabi
Author: ed Date: Mon Jul 27 10:07:29 2015 New Revision: 285908 URL: https://svnweb.freebsd.org/changeset/base/285908 Log: Add a futex implementation for CloudABI. Summary: CloudABI provides two different types of futex objects: read-write locks and condition variables. There is no need to provide separate support for once objects and thread joining, as these are efficiently simulated by blocking on a read-write lock. Mutexes simply use read-write locks. Condition variables always have a lock object associated to them. They always know to which lock a thread needs to be migrated if woken up. This allows us to implement requeueing. A broadcast on a condition variable will never cause multiple threads to be woken up at once. They will be woken up iteratively. This implementation still has lots of room for improvement. Locking is coarse and right now we use linked lists to store all of the locks and condition variables, instead of using a hash table. The primary goal of this implementation was to behave correctly. Performance will be improved as we go. Test Plan: This futex implementation has been in use for the last couple of months and seems to work pretty well. All of the cloudlibc and libc++ unit tests seem to pass. Reviewers: dchagin, kib, vangyzen Subscribers: imp Differential Revision: https://reviews.freebsd.org/D3148 Modified: head/sys/compat/cloudabi/cloudabi_clock.c head/sys/compat/cloudabi/cloudabi_futex.c head/sys/compat/cloudabi/cloudabi_thread.c head/sys/compat/cloudabi/cloudabi_util.h Modified: head/sys/compat/cloudabi/cloudabi_clock.c == --- head/sys/compat/cloudabi/cloudabi_clock.c Mon Jul 27 10:04:28 2015 (r285907) +++ head/sys/compat/cloudabi/cloudabi_clock.c Mon Jul 27 10:07:29 2015 (r285908) @@ -80,31 +80,27 @@ cloudabi_convert_timespec(const struct t return (0); } +/* Fetches the time value of a clock. */ int -cloudabi_sys_clock_res_get(struct thread *td, -struct cloudabi_sys_clock_res_get_args *uap) +cloudabi_clock_time_get(struct thread *td, cloudabi_clockid_t clock_id, +cloudabi_timestamp_t *ret) { struct timespec ts; - cloudabi_timestamp_t cts; int error; clockid_t clockid; - error = cloudabi_convert_clockid(uap-clock_id, clockid); - if (error != 0) - return (error); - error = kern_clock_getres(td, clockid, ts); + error = cloudabi_convert_clockid(clock_id, clockid); if (error != 0) return (error); - error = cloudabi_convert_timespec(ts, cts); + error = kern_clock_gettime(td, clockid, ts); if (error != 0) return (error); - td-td_retval[0] = cts; - return (0); + return (cloudabi_convert_timespec(ts, ret)); } int -cloudabi_sys_clock_time_get(struct thread *td, -struct cloudabi_sys_clock_time_get_args *uap) +cloudabi_sys_clock_res_get(struct thread *td, +struct cloudabi_sys_clock_res_get_args *uap) { struct timespec ts; cloudabi_timestamp_t cts; @@ -114,7 +110,7 @@ cloudabi_sys_clock_time_get(struct threa error = cloudabi_convert_clockid(uap-clock_id, clockid); if (error != 0) return (error); - error = kern_clock_gettime(td, clockid, ts); + error = kern_clock_getres(td, clockid, ts); if (error != 0) return (error); error = cloudabi_convert_timespec(ts, cts); @@ -123,3 +119,15 @@ cloudabi_sys_clock_time_get(struct threa td-td_retval[0] = cts; return (0); } + +int +cloudabi_sys_clock_time_get(struct thread *td, +struct cloudabi_sys_clock_time_get_args *uap) +{ + cloudabi_timestamp_t ts; + int error; + + error = cloudabi_clock_time_get(td, uap-clock_id, ts); + td-td_retval[0] = ts; + return (error); +} Modified: head/sys/compat/cloudabi/cloudabi_futex.c == --- head/sys/compat/cloudabi/cloudabi_futex.c Mon Jul 27 10:04:28 2015 (r285907) +++ head/sys/compat/cloudabi/cloudabi_futex.c Mon Jul 27 10:07:29 2015 (r285908) @@ -26,22 +26,1197 @@ #include sys/cdefs.h __FBSDID($FreeBSD$); +#include sys/param.h +#include sys/kernel.h +#include sys/limits.h +#include sys/lock.h +#include sys/malloc.h +#include sys/mutex.h +#include sys/proc.h +#include sys/sx.h +#include sys/systm.h + +#include vm/vm.h +#include vm/vm_param.h +#include vm/pmap.h +#include vm/vm_extern.h +#include vm/vm_map.h +#include vm/vm_object.h + #include compat/cloudabi/cloudabi_proto.h +#include compat/cloudabi/cloudabi_syscalldefs.h +#include compat/cloudabi/cloudabi_util.h + +/* + * Futexes for CloudABI. + * + * On most systems, futexes are implemented as objects of a single type + * on which a set of operations can be performed.
svn commit: r285927 - head/sys/dev/proto
Author: marcel Date: Tue Jul 28 04:54:05 2015 New Revision: 285927 URL: https://svnweb.freebsd.org/changeset/base/285927 Log: Check the sync operation. Modified: head/sys/dev/proto/proto_busdma.c Modified: head/sys/dev/proto/proto_busdma.c == --- head/sys/dev/proto/proto_busdma.c Tue Jul 28 02:32:40 2015 (r285926) +++ head/sys/dev/proto/proto_busdma.c Tue Jul 28 04:54:05 2015 (r285927) @@ -325,7 +325,12 @@ static int proto_busdma_sync(struct proto_busdma *busdma, struct proto_md *md, struct proto_ioc_busdma *ioc) { - + u_int ops; + + ops = BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE | + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE; + if (ioc-u.sync.op ~ops) + return (EINVAL); if (!md-physaddr) return (ENXIO); bus_dmamap_sync(md-bd_tag, md-bd_map, ioc-u.sync.op); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r285926 - in head: libexec/ypxfr usr.bin/ypcat usr.bin/ypmatch usr.bin/ypwhich usr.sbin/yp_mkdb usr.sbin/yppush usr.sbin/ypserv
Author: araujo (ports committer) Date: Tue Jul 28 02:32:40 2015 New Revision: 285926 URL: https://svnweb.freebsd.org/changeset/base/285926 Log: Staticfy and constify some variables and clean up the code a bit to make it more readable. No functional change. Differential Revision:D3166 Reviewed by: kib Sponsored by: gandi.net Modified: head/libexec/ypxfr/ypxfr_getmap.c head/libexec/ypxfr/ypxfr_main.c head/libexec/ypxfr/ypxfrd_getmap.c head/usr.bin/ypcat/ypcat.c head/usr.bin/ypmatch/ypmatch.c head/usr.bin/ypwhich/ypwhich.c head/usr.sbin/yp_mkdb/yp_mkdb.c head/usr.sbin/yppush/yppush_main.c head/usr.sbin/ypserv/yp_access.c head/usr.sbin/ypserv/yp_dblookup.c head/usr.sbin/ypserv/yp_error.c head/usr.sbin/ypserv/yp_main.c Modified: head/libexec/ypxfr/ypxfr_getmap.c == --- head/libexec/ypxfr/ypxfr_getmap.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/libexec/ypxfr/ypxfr_getmap.c Tue Jul 28 02:32:40 2015 (r285926) @@ -43,8 +43,8 @@ __FBSDID($FreeBSD$); extern bool_t xdr_ypresp_all_seq(XDR *, unsigned long *); -int (*ypresp_allfn)(); -void *ypresp_data; +static int (*ypresp_allfn)(); +static void *ypresp_data; extern DB *specdbp; extern enum ypstat yp_errno; Modified: head/libexec/ypxfr/ypxfr_main.c == --- head/libexec/ypxfr/ypxfr_main.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/libexec/ypxfr/ypxfr_main.c Tue Jul 28 02:32:40 2015 (r285926) @@ -54,12 +54,12 @@ __FBSDID($FreeBSD$); char *progname = ypxfr; char *yp_dir = _PATH_YP; int _rpcpmstart = 0; -int ypxfr_use_yplib = 0; /* Assume the worst. */ -int ypxfr_clear = 1; -int ypxfr_prognum = 0; -struct sockaddr_in ypxfr_callback_addr; -struct yppushresp_xfr ypxfr_resp; -DB *dbp; +static int ypxfr_use_yplib = 0; /* Assume the worst. */ +static int ypxfr_clear = 1; +static int ypxfr_prognum = 0; +static struct sockaddr_in ypxfr_callback_addr; +static struct yppushresp_xfr ypxfr_resp; +static DB *dbp; static void ypxfr_exit(ypxfrstat retval, char *temp) Modified: head/libexec/ypxfr/ypxfrd_getmap.c == --- head/libexec/ypxfr/ypxfrd_getmap.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/libexec/ypxfr/ypxfrd_getmap.c Tue Jul 28 02:32:40 2015 (r285926) @@ -47,7 +47,7 @@ __FBSDID($FreeBSD$); #include sys/types.h #include ypxfr_extern.h -int fp = 0; +static int fp = 0; static bool_t xdr_my_xfr(register XDR *xdrs, xfr *objp) Modified: head/usr.bin/ypcat/ypcat.c == --- head/usr.bin/ypcat/ypcat.c Mon Jul 27 22:35:54 2015(r285925) +++ head/usr.bin/ypcat/ypcat.c Tue Jul 28 02:32:40 2015(r285926) @@ -47,9 +47,9 @@ __FBSDID($FreeBSD$); #include string.h #include unistd.h -struct ypalias { +const struct ypalias { char *alias, *name; -} ypaliases[] = { +} static ypaliases[] = { { passwd, passwd.byname }, { master.passwd, master.passwd.byname }, { shadow, shadow.byname }, @@ -62,7 +62,7 @@ struct ypalias { { ethers, ethers.byname }, }; -int key; +static int key; static void usage(void) Modified: head/usr.bin/ypmatch/ypmatch.c == --- head/usr.bin/ypmatch/ypmatch.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/usr.bin/ypmatch/ypmatch.c Tue Jul 28 02:32:40 2015 (r285926) @@ -47,9 +47,9 @@ __FBSDID($FreeBSD$); #include string.h #include unistd.h -struct ypalias { +const struct ypalias { char *alias, *name; -} ypaliases[] = { +} static ypaliases[] = { { passwd, passwd.byname }, { master.passwd, master.passwd.byname }, { shadow, shadow.byname }, Modified: head/usr.bin/ypwhich/ypwhich.c == --- head/usr.bin/ypwhich/ypwhich.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/usr.bin/ypwhich/ypwhich.c Tue Jul 28 02:32:40 2015 (r285926) @@ -59,9 +59,9 @@ __FBSDID($FreeBSD$); extern bool_t xdr_domainname(); -struct ypalias { +const struct ypalias { char *alias, *name; -} ypaliases[] = { +} static ypaliases[] = { { passwd, passwd.byname }, { master.passwd, master.passwd.byname }, { shadow, shadow.byname }, Modified: head/usr.sbin/yp_mkdb/yp_mkdb.c == --- head/usr.sbin/yp_mkdb/yp_mkdb.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/usr.sbin/yp_mkdb/yp_mkdb.c Tue Jul 28 02:32:40 2015 (r285926) @@ -51,7 +51,6 @@ __FBSDID($FreeBSD$); #include ypxfr_extern.h char *yp_dir = ; /* No particular default needed. */ -int