From owner-svn-src-stable@FreeBSD.ORG Sun Jun 23 02:51:22 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id AB86C1B9; Sun, 23 Jun 2013 02:51:22 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9E43A1A81; Sun, 23 Jun 2013 02:51:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5N2pM1w069204; Sun, 23 Jun 2013 02:51:22 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5N2pMxG069203; Sun, 23 Jun 2013 02:51:22 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201306230251.r5N2pMxG069203@svn.freebsd.org> From: Hiroki Sato Date: Sun, 23 Jun 2013 02:51:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252104 - stable/9/sys/net X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2013 02:51:22 -0000 Author: hrs Date: Sun Jun 23 02:51:22 2013 New Revision: 252104 URL: http://svnweb.freebsd.org/changeset/base/252104 Log: MFC r251799: Return ENETDOWN when the parent interface is down. Modified: stable/9/sys/net/if_vlan.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/net/if_vlan.c ============================================================================== --- stable/9/sys/net/if_vlan.c Sun Jun 23 02:44:42 2013 (r252103) +++ stable/9/sys/net/if_vlan.c Sun Jun 23 02:51:22 2013 (r252104) @@ -1034,7 +1034,7 @@ vlan_transmit(struct ifnet *ifp, struct if (!UP_AND_RUNNING(p)) { m_freem(m); ifp->if_oerrors++; - return (0); + return (ENETDOWN); } /* From owner-svn-src-stable@FreeBSD.ORG Sun Jun 23 09:23:33 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 25068FE1; Sun, 23 Jun 2013 09:23:33 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 077FE1640; Sun, 23 Jun 2013 09:23:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5N9NWhQ079784; Sun, 23 Jun 2013 09:23:32 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5N9NWLr079783; Sun, 23 Jun 2013 09:23:32 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201306230923.r5N9NWLr079783@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 23 Jun 2013 09:23:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252107 - stable/8/sys/boot/pc98/libpc98 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2013 09:23:33 -0000 Author: nyan Date: Sun Jun 23 09:23:32 2013 New Revision: 252107 URL: http://svnweb.freebsd.org/changeset/base/252107 Log: MFi386: revision 245847 Add special loader environment variables 'comconsole_port' and 'comconsole_pcidev'. Modified: stable/8/sys/boot/pc98/libpc98/comconsole.c Modified: stable/8/sys/boot/pc98/libpc98/comconsole.c ============================================================================== --- stable/8/sys/boot/pc98/libpc98/comconsole.c Sun Jun 23 05:02:59 2013 (r252106) +++ stable/8/sys/boot/pc98/libpc98/comconsole.c Sun Jun 23 09:23:32 2013 (r252107) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "libi386.h" #define COMC_FMT 0x3 /* 8N1 */ @@ -49,14 +50,23 @@ static int comc_init(int arg); static void comc_putchar(int c); static int comc_getchar(void); static int comc_getspeed(void); +static void set_hw_console_hint(void); static int comc_ischar(void); -static int comc_parsespeed(const char *string); -static void comc_setup(int speed); +static int comc_parseint(const char *string); +static uint32_t comc_parse_pcidev(const char *string); +static int comc_pcidev_set(struct env_var *ev, int flags, + const void *value); +static int comc_pcidev_handle(uint32_t locator); +static int comc_port_set(struct env_var *ev, int flags, + const void *value); +static void comc_setup(int speed, int port); static int comc_speed_set(struct env_var *ev, int flags, const void *value); static int comc_started; static int comc_curspeed; +static int comc_port = COMPORT; +static uint32_t comc_locator; struct console comconsole = { "comconsole", @@ -72,9 +82,10 @@ struct console comconsole = { static void comc_probe(struct console *cp) { - char speedbuf[16]; - char *cons, *speedenv; - int speed; + char intbuf[16]; + char *cons, *env; + int speed, port; + uint32_t locator; /* XXX check the BIOS equipment list? */ cp->c_flags |= (C_PRESENTIN | C_PRESENTOUT); @@ -90,16 +101,40 @@ comc_probe(struct console *cp) getenv("boot_multicons") != NULL) { comc_curspeed = comc_getspeed(); } - speedenv = getenv("comconsole_speed"); - if (speedenv != NULL) { - speed = comc_parsespeed(speedenv); + + env = getenv("comconsole_speed"); + if (env != NULL) { + speed = comc_parseint(env); if (speed > 0) comc_curspeed = speed; } - sprintf(speedbuf, "%d", comc_curspeed); + sprintf(intbuf, "%d", comc_curspeed); unsetenv("comconsole_speed"); - env_setenv("comconsole_speed", EV_VOLATILE, speedbuf, comc_speed_set, + env_setenv("comconsole_speed", EV_VOLATILE, intbuf, comc_speed_set, + env_nounset); + + env = getenv("comconsole_port"); + if (env != NULL) { + port = comc_parseint(env); + if (port > 0) + comc_port = port; + } + + sprintf(intbuf, "%d", comc_port); + unsetenv("comconsole_port"); + env_setenv("comconsole_port", EV_VOLATILE, intbuf, comc_port_set, + env_nounset); + + env = getenv("comconsole_pcidev"); + if (env != NULL) { + locator = comc_parse_pcidev(env); + if (locator != 0) + comc_pcidev_handle(locator); + } + + unsetenv("comconsole_pcidev"); + env_setenv("comconsole_pcidev", EV_VOLATILE, env, comc_pcidev_set, env_nounset); } } @@ -111,7 +146,7 @@ comc_init(int arg) return 0; comc_started = 1; - comc_setup(comc_curspeed); + comc_setup(comc_curspeed, comc_port); return(0); } @@ -122,8 +157,8 @@ comc_putchar(int c) int wait; for (wait = COMC_TXWAIT; wait > 0; wait--) - if (inb(COMPORT + com_lsr) & LSR_TXRDY) { - outb(COMPORT + com_data, (u_char)c); + if (inb(comc_port + com_lsr) & LSR_TXRDY) { + outb(comc_port + com_data, (u_char)c); break; } } @@ -131,13 +166,13 @@ comc_putchar(int c) static int comc_getchar(void) { - return(comc_ischar() ? inb(COMPORT + com_data) : -1); + return(comc_ischar() ? inb(comc_port + com_data) : -1); } static int comc_ischar(void) { - return(inb(COMPORT + com_lsr) & LSR_RXRDY); + return(inb(comc_port + com_lsr) & LSR_RXRDY); } static int @@ -145,13 +180,33 @@ comc_speed_set(struct env_var *ev, int f { int speed; - if (value == NULL || (speed = comc_parsespeed(value)) <= 0) { + if (value == NULL || (speed = comc_parseint(value)) <= 0) { printf("Invalid speed\n"); return (CMD_ERROR); } if (comc_started && comc_curspeed != speed) - comc_setup(speed); + comc_setup(speed, comc_port); + + env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); + + return (CMD_OK); +} + +static int +comc_port_set(struct env_var *ev, int flags, const void *value) +{ + int port; + + if (value == NULL || (port = comc_parseint(value)) <= 0) { + printf("Invalid port\n"); + return (CMD_ERROR); + } + + if (comc_started && comc_port != port) { + comc_setup(comc_curspeed, port); + set_hw_console_hint(); + } env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); @@ -159,24 +214,126 @@ comc_speed_set(struct env_var *ev, int f } static void -comc_setup(int speed) +set_hw_console_hint(void) +{ + char intbuf[64]; + + unsetenv("hw.uart.console"); + sprintf(intbuf, "io:%d,br:%d", comc_port, comc_curspeed); + env_setenv("hw.uart.console", EV_VOLATILE, intbuf, + env_noset, env_nounset); +} + +/* + * Input: bus:dev:func[:bar]. If bar is not specified, it is 0x10. + * Output: bar[24:16] bus[15:8] dev[7:3] func[2:0] + */ +static uint32_t +comc_parse_pcidev(const char *string) +{ + char *p, *p1; + uint8_t bus, dev, func, bar; + uint32_t locator; + int pres; + + pres = strtol(string, &p, 0); + if (p == string || *p != ':' || pres < 0 ) + return (0); + bus = pres; + p1 = ++p; + + pres = strtol(p1, &p, 0); + if (p == string || *p != ':' || pres < 0 ) + return (0); + dev = pres; + p1 = ++p; + + pres = strtol(p1, &p, 0); + if (p == string || (*p != ':' && *p != '\0') || pres < 0 ) + return (0); + func = pres; + + if (*p == ':') { + p1 = ++p; + pres = strtol(p1, &p, 0); + if (p == string || *p != '\0' || pres <= 0 ) + return (0); + bar = pres; + } else + bar = 0x10; + + locator = (bar << 16) | biospci_locator(bus, dev, func); + return (locator); +} + +static int +comc_pcidev_handle(uint32_t locator) +{ + char intbuf[64]; + uint32_t port; + + if (biospci_read_config(locator & 0xffff, + (locator & 0xff0000) >> 16, 2, &port) == -1) { + printf("Cannot read bar at 0x%x\n", locator); + return (CMD_ERROR); + } + if (!PCI_BAR_IO(port)) { + printf("Memory bar at 0x%x\n", locator); + return (CMD_ERROR); + } + port &= PCIM_BAR_IO_BASE; + + sprintf(intbuf, "%d", port); + unsetenv("comconsole_port"); + env_setenv("comconsole_port", EV_VOLATILE, intbuf, + comc_port_set, env_nounset); + + comc_setup(comc_curspeed, port); + set_hw_console_hint(); + comc_locator = locator; + + return (CMD_OK); +} + +static int +comc_pcidev_set(struct env_var *ev, int flags, const void *value) +{ + uint32_t locator; + int error; + + if (value == NULL || (locator = comc_parse_pcidev(value)) <= 0) { + printf("Invalid pcidev\n"); + return (CMD_ERROR); + } + if (comc_started && comc_locator != locator) { + error = comc_pcidev_handle(locator); + if (error != CMD_OK) + return (error); + } + env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); + return (CMD_OK); +} + +static void +comc_setup(int speed, int port) { comc_curspeed = speed; + comc_port = port; - outb(COMPORT + com_cfcr, CFCR_DLAB | COMC_FMT); - outb(COMPORT + com_dlbl, COMC_BPS(speed) & 0xff); - outb(COMPORT + com_dlbh, COMC_BPS(speed) >> 8); - outb(COMPORT + com_cfcr, COMC_FMT); - outb(COMPORT + com_mcr, MCR_RTS | MCR_DTR); + outb(comc_port + com_cfcr, CFCR_DLAB | COMC_FMT); + outb(comc_port + com_dlbl, COMC_BPS(speed) & 0xff); + outb(comc_port + com_dlbh, COMC_BPS(speed) >> 8); + outb(comc_port + com_cfcr, COMC_FMT); + outb(comc_port + com_mcr, MCR_RTS | MCR_DTR); do - inb(COMPORT + com_data); - while (inb(COMPORT + com_lsr) & LSR_RXRDY); + inb(comc_port + com_data); + while (inb(comc_port + com_lsr) & LSR_RXRDY); } static int -comc_parsespeed(const char *speedstr) +comc_parseint(const char *speedstr) { char *p; int speed; @@ -196,13 +353,13 @@ comc_getspeed(void) u_char dlbl; u_char cfcr; - cfcr = inb(COMPORT + com_cfcr); - outb(COMPORT + com_cfcr, CFCR_DLAB | cfcr); + cfcr = inb(comc_port + com_cfcr); + outb(comc_port + com_cfcr, CFCR_DLAB | cfcr); - dlbl = inb(COMPORT + com_dlbl); - dlbh = inb(COMPORT + com_dlbh); + dlbl = inb(comc_port + com_dlbl); + dlbh = inb(comc_port + com_dlbh); - outb(COMPORT + com_cfcr, cfcr); + outb(comc_port + com_cfcr, cfcr); divisor = dlbh << 8 | dlbl; From owner-svn-src-stable@FreeBSD.ORG Sun Jun 23 09:34:55 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BE21F38C; Sun, 23 Jun 2013 09:34:55 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B0230168B; Sun, 23 Jun 2013 09:34:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5N9YtGL082687; Sun, 23 Jun 2013 09:34:55 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5N9YtZ0082686; Sun, 23 Jun 2013 09:34:55 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201306230934.r5N9YtZ0082686@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 23 Jun 2013 09:34:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252108 - stable/8/sys/pc98/pc98 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2013 09:34:55 -0000 Author: nyan Date: Sun Jun 23 09:34:55 2013 New Revision: 252108 URL: http://svnweb.freebsd.org/changeset/base/252108 Log: MFi386: revision 251332 Use slightly more idiomatic expression to get the address of array. Modified: stable/8/sys/pc98/pc98/machdep.c Modified: stable/8/sys/pc98/pc98/machdep.c ============================================================================== --- stable/8/sys/pc98/pc98/machdep.c Sun Jun 23 09:23:32 2013 (r252107) +++ stable/8/sys/pc98/pc98/machdep.c Sun Jun 23 09:34:55 2013 (r252108) @@ -2734,7 +2734,7 @@ get_fpcontext(struct thread *td, mcontex bzero(mcp->mc_fpstate, sizeof(mcp->mc_fpstate)); #else mcp->mc_ownedfp = npxgetregs(td); - bcopy(&td->td_pcb->pcb_user_save, &mcp->mc_fpstate, + bcopy(&td->td_pcb->pcb_user_save, &mcp->mc_fpstate[0], sizeof(mcp->mc_fpstate)); mcp->mc_fpformat = npxformat(); #endif From owner-svn-src-stable@FreeBSD.ORG Sun Jun 23 10:16:15 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2047AE9D; Sun, 23 Jun 2013 10:16:15 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 125E91795; Sun, 23 Jun 2013 10:16:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5NAGExt094333; Sun, 23 Jun 2013 10:16:14 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5NAGE7g094332; Sun, 23 Jun 2013 10:16:14 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201306231016.r5NAGE7g094332@svn.freebsd.org> From: Devin Teske Date: Sun, 23 Jun 2013 10:16:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252111 - stable/8/usr.sbin/sysinstall X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2013 10:16:15 -0000 Author: dteske Date: Sun Jun 23 10:16:14 2013 New Revision: 252111 URL: http://svnweb.freebsd.org/changeset/base/252111 Log: MFS9->8 r252025: Fix a copy/paste error introduced by r248452 (s/ftp/http/ in menu text). This is a direct commit to stable/8. Modified: stable/8/usr.sbin/sysinstall/menus.c Modified: stable/8/usr.sbin/sysinstall/menus.c ============================================================================== --- stable/8/usr.sbin/sysinstall/menus.c Sun Jun 23 10:04:23 2013 (r252110) +++ stable/8/usr.sbin/sysinstall/menus.c Sun Jun 23 10:16:14 2013 (r252111) @@ -891,7 +891,7 @@ DMenu MenuMediaHTTPDirect = { "guaranteed to carry the full range of possible distributions.", "Select a site that's close!", NULL, - { { "URL", "Specify some other ftp site by URL", NULL, dmenuSetVariable, NULL, + { { "URL", "Specify some other http site by URL", NULL, dmenuSetVariable, NULL, VAR_HTTP_PATH "=other" }, { NULL } } From owner-svn-src-stable@FreeBSD.ORG Sun Jun 23 13:27:38 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0769E696; Sun, 23 Jun 2013 13:27:38 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id ED3711CD9; Sun, 23 Jun 2013 13:27:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5NDRbh2047849; Sun, 23 Jun 2013 13:27:37 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5NDRboQ047848; Sun, 23 Jun 2013 13:27:37 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201306231327.r5NDRboQ047848@svn.freebsd.org> From: Rick Macklem Date: Sun, 23 Jun 2013 13:27:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252114 - stable/9/usr.bin/nfsstat X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2013 13:27:38 -0000 Author: rmacklem Date: Sun Jun 23 13:27:37 2013 New Revision: 252114 URL: http://svnweb.freebsd.org/changeset/base/252114 Log: MFC: r251585 Modify nfsstat.c so that it prints out an error when a non-root user attempts to use the "-m" option and it fails. Modified: stable/9/usr.bin/nfsstat/nfsstat.c Directory Properties: stable/9/usr.bin/nfsstat/ (props changed) Modified: stable/9/usr.bin/nfsstat/nfsstat.c ============================================================================== --- stable/9/usr.bin/nfsstat/nfsstat.c Sun Jun 23 10:51:26 2013 (r252113) +++ stable/9/usr.bin/nfsstat/nfsstat.c Sun Jun 23 13:27:37 2013 (r252114) @@ -133,6 +133,9 @@ main(int argc, char **argv) printf("%s on %s\n%s\n", mntbuf->f_mntfromname, mntbuf->f_mntonname, buf); + else if (errno == EPERM) + errx(1, "Only priviledged users" + " can use the -m option"); } mntbuf++; } From owner-svn-src-stable@FreeBSD.ORG Sun Jun 23 14:36:13 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 58383404; Sun, 23 Jun 2013 14:36:13 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4A30C1ECF; Sun, 23 Jun 2013 14:36:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5NEaDXq067554; Sun, 23 Jun 2013 14:36:13 GMT (envelope-from theraven@svn.freebsd.org) Received: (from theraven@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5NEaDh9067553; Sun, 23 Jun 2013 14:36:13 GMT (envelope-from theraven@svn.freebsd.org) Message-Id: <201306231436.r5NEaDh9067553@svn.freebsd.org> From: David Chisnall Date: Sun, 23 Jun 2013 14:36:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252116 - stable/9/gnu/lib/libsupc++ X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2013 14:36:13 -0000 Author: theraven Date: Sun Jun 23 14:36:12 2013 New Revision: 252116 URL: http://svnweb.freebsd.org/changeset/base/252116 Log: MFC r251820. This fixes some symbol visibility issues with libsupc++ that broke compilation of GNUstep libobjc. Modified: stable/9/gnu/lib/libsupc++/Version.map Directory Properties: stable/9/gnu/lib/libsupc++/ (props changed) Modified: stable/9/gnu/lib/libsupc++/Version.map ============================================================================== --- stable/9/gnu/lib/libsupc++/Version.map Sun Jun 23 14:20:54 2013 (r252115) +++ stable/9/gnu/lib/libsupc++/Version.map Sun Jun 23 14:36:12 2013 (r252116) @@ -147,6 +147,13 @@ GLIBCXX_3.4 { std::set_terminate*; std::set_unexpected*; + "std::unexpected()"; + "std::get_terminate()"; + "std::get_unexpected()"; + "std::uncaught_exception()"; + "std::terminate()"; + + std::bad_alloc; std::bad_cast; std::exception*; @@ -154,14 +161,20 @@ GLIBCXX_3.4 { "typeinfo for std::bad_alloc"; "typeinfo for std::bad_cast"; "typeinfo for std::exception"; + "typeinfo for std::type_info"; "typeinfo name for std::bad_alloc"; "typeinfo name for std::bad_cast"; "typeinfo name for std::exception"; + "typeinfo name for std::type_info"; "vtable for std::bad_alloc"; "vtable for std::bad_cast"; "vtable for std::exception"; + "vtable for std::type_info"; + + std::type_info::__*; + "std::type_info::~type_info()"; }; }; From owner-svn-src-stable@FreeBSD.ORG Sun Jun 23 20:09:59 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 34C431E0; Sun, 23 Jun 2013 20:09:59 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2705E1B4F; Sun, 23 Jun 2013 20:09:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5NK9xTg061896; Sun, 23 Jun 2013 20:09:59 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5NK9xLa061895; Sun, 23 Jun 2013 20:09:59 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201306232009.r5NK9xLa061895@svn.freebsd.org> From: Glen Barber Date: Sun, 23 Jun 2013 20:09:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252120 - stable/8/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2013 20:09:59 -0000 Author: gjb Date: Sun Jun 23 20:09:58 2013 New Revision: 252120 URL: http://svnweb.freebsd.org/changeset/base/252120 Log: Since we likely will not have an 8.5-RELEASE, reword the errata page for the 8.4-RELEASE. Modified: stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/8/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Sun Jun 23 19:47:59 2013 (r252119) +++ stable/8/release/doc/en_US.ISO8859-1/errata/article.xml Sun Jun 23 20:09:58 2013 (r252120) @@ -40,7 +40,7 @@ &os;. This errata document for &os; &release; - will be maintained until the release of &os; &release.next;. + will be maintained until the &os; &release; end of life. From owner-svn-src-stable@FreeBSD.ORG Sun Jun 23 20:19:05 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B1B8E76E; Sun, 23 Jun 2013 20:19:05 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A31001BD8; Sun, 23 Jun 2013 20:19:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5NKJ53d064855; Sun, 23 Jun 2013 20:19:05 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5NKJ53O064854; Sun, 23 Jun 2013 20:19:05 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201306232019.r5NKJ53O064854@svn.freebsd.org> From: Eitan Adler Date: Sun, 23 Jun 2013 20:19:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252122 - in stable: 8/share/man/man7 9/share/man/man7 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2013 20:19:05 -0000 Author: eadler Date: Sun Jun 23 20:19:05 2013 New Revision: 252122 URL: http://svnweb.freebsd.org/changeset/base/252122 Log: MFC r252042: Ports switched from dialog to dialog4ports some time ago. PR: docs/179785 Modified: stable/9/share/man/man7/ports.7 Directory Properties: stable/9/share/man/ (props changed) stable/9/share/man/man7/ (props changed) Changes in other areas also in this revision: Modified: stable/8/share/man/man7/ports.7 Directory Properties: stable/8/share/man/ (props changed) stable/8/share/man/man7/ (props changed) Modified: stable/9/share/man/man7/ports.7 ============================================================================== --- stable/9/share/man/man7/ports.7 Sun Jun 23 20:19:00 2013 (r252121) +++ stable/9/share/man/man7/ports.7 Sun Jun 23 20:19:05 2013 (r252122) @@ -97,7 +97,7 @@ target. Configure .Va OPTIONS for this port using -.Xr dialog 1 . +.Xr dialog4ports 1 . .It Cm fetch Fetch all of the files needed to build this port from the sites listed in @@ -177,7 +177,7 @@ configured. Configure .Va OPTIONS for this port and all its dependencies using -.Xr dialog 1 . +.Xr dialog4ports 1 . .It Cm fetch-list Show list of files to be fetched in order to build the port. .It Cm fetch-recursive From owner-svn-src-stable@FreeBSD.ORG Sun Jun 23 20:19:06 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1252A76F; Sun, 23 Jun 2013 20:19:06 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 038CF1BD9; Sun, 23 Jun 2013 20:19:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5NKJ50m064861; Sun, 23 Jun 2013 20:19:05 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5NKJ51p064860; Sun, 23 Jun 2013 20:19:05 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201306232019.r5NKJ51p064860@svn.freebsd.org> From: Eitan Adler Date: Sun, 23 Jun 2013 20:19:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252122 - in stable: 8/share/man/man7 9/share/man/man7 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2013 20:19:06 -0000 Author: eadler Date: Sun Jun 23 20:19:05 2013 New Revision: 252122 URL: http://svnweb.freebsd.org/changeset/base/252122 Log: MFC r252042: Ports switched from dialog to dialog4ports some time ago. PR: docs/179785 Modified: stable/8/share/man/man7/ports.7 Directory Properties: stable/8/share/man/ (props changed) stable/8/share/man/man7/ (props changed) Changes in other areas also in this revision: Modified: stable/9/share/man/man7/ports.7 Directory Properties: stable/9/share/man/ (props changed) stable/9/share/man/man7/ (props changed) Modified: stable/8/share/man/man7/ports.7 ============================================================================== --- stable/8/share/man/man7/ports.7 Sun Jun 23 20:19:00 2013 (r252121) +++ stable/8/share/man/man7/ports.7 Sun Jun 23 20:19:05 2013 (r252122) @@ -97,7 +97,7 @@ target. Configure .Va OPTIONS for this port using -.Xr dialog 1 . +.Xr dialog4ports 1 . .It Cm fetch Fetch all of the files needed to build this port from the sites listed in @@ -177,7 +177,7 @@ configured. Configure .Va OPTIONS for this port and all its dependencies using -.Xr dialog 1 . +.Xr dialog4ports 1 . .It Cm fetch-list Show list of files to be fetched in order to build the port. .It Cm fetch-recursive From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 01:03:58 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A0B572D4; Mon, 24 Jun 2013 01:03:58 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 92B1D161D; Mon, 24 Jun 2013 01:03:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5O13wgI057401; Mon, 24 Jun 2013 01:03:58 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5O13wHE057400; Mon, 24 Jun 2013 01:03:58 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201306240103.r5O13wHE057400@svn.freebsd.org> From: Mark Johnston Date: Mon, 24 Jun 2013 01:03:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252135 - stable/9/sys/dev/age X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 01:03:58 -0000 Author: markj Date: Mon Jun 24 01:03:58 2013 New Revision: 252135 URL: http://svnweb.freebsd.org/changeset/base/252135 Log: MFC r251872: Be sure to actually decrement the "count" parameter for each processed descriptor so that we return when the threshold has been reached. Modified: stable/9/sys/dev/age/if_age.c Modified: stable/9/sys/dev/age/if_age.c ============================================================================== --- stable/9/sys/dev/age/if_age.c Mon Jun 24 00:26:56 2013 (r252134) +++ stable/9/sys/dev/age/if_age.c Mon Jun 24 01:03:58 2013 (r252135) @@ -2478,7 +2478,7 @@ age_rxintr(struct age_softc *sc, int rr_ sc->age_cdata.age_rx_ring_map, BUS_DMASYNC_POSTWRITE); for (prog = 0; rr_cons != rr_prod; prog++) { - if (count <= 0) + if (count-- <= 0) break; rxrd = &sc->age_rdata.age_rr_ring[rr_cons]; nsegs = AGE_RX_NSEGS(le32toh(rxrd->index)); From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 01:05:52 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5DBC745B; Mon, 24 Jun 2013 01:05:52 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4DFF0162E; Mon, 24 Jun 2013 01:05:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5O15qYr057837; Mon, 24 Jun 2013 01:05:52 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5O15qYq057836; Mon, 24 Jun 2013 01:05:52 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201306240105.r5O15qYq057836@svn.freebsd.org> From: Mark Johnston Date: Mon, 24 Jun 2013 01:05:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252136 - stable/8/sys/dev/age X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 01:05:52 -0000 Author: markj Date: Mon Jun 24 01:05:51 2013 New Revision: 252136 URL: http://svnweb.freebsd.org/changeset/base/252136 Log: MFC r251872: Be sure to actually decrement the "count" parameter for each processed descriptor so that we return when the threshold has been reached. Modified: stable/8/sys/dev/age/if_age.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/age/ (props changed) Modified: stable/8/sys/dev/age/if_age.c ============================================================================== --- stable/8/sys/dev/age/if_age.c Mon Jun 24 01:03:58 2013 (r252135) +++ stable/8/sys/dev/age/if_age.c Mon Jun 24 01:05:51 2013 (r252136) @@ -2478,7 +2478,7 @@ age_rxintr(struct age_softc *sc, int rr_ sc->age_cdata.age_rx_ring_map, BUS_DMASYNC_POSTWRITE); for (prog = 0; rr_cons != rr_prod; prog++) { - if (count <= 0) + if (count-- <= 0) break; rxrd = &sc->age_rdata.age_rr_ring[rr_cons]; nsegs = AGE_RX_NSEGS(le32toh(rxrd->index)); From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 01:09:29 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 0C394637; Mon, 24 Jun 2013 01:09:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D875E1641; Mon, 24 Jun 2013 01:09:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5O19Sc8058593; Mon, 24 Jun 2013 01:09:28 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5O19S0j058592; Mon, 24 Jun 2013 01:09:28 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201306240109.r5O19S0j058592@svn.freebsd.org> From: Mark Johnston Date: Mon, 24 Jun 2013 01:09:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252137 - in stable/9/sys: . dev X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 01:09:29 -0000 Author: markj Date: Mon Jun 24 01:09:28 2013 New Revision: 252137 URL: http://svnweb.freebsd.org/changeset/base/252137 Log: Missed mergeinfo for r252135. Modified: Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 05:00:33 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7A6D78BC; Mon, 24 Jun 2013 05:00:33 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6A7EB1D73; Mon, 24 Jun 2013 05:00:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5O50X29036741; Mon, 24 Jun 2013 05:00:33 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5O50WC8036731; Mon, 24 Jun 2013 05:00:32 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201306240500.r5O50WC8036731@svn.freebsd.org> From: Xin LI Date: Mon, 24 Jun 2013 05:00:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252140 - in stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 05:00:33 -0000 Author: delphij Date: Mon Jun 24 05:00:31 2013 New Revision: 252140 URL: http://svnweb.freebsd.org/changeset/base/252140 Log: MFC r251478: MFV r251474: * Illumos zfs issue #3137 L2ARC compression Whether or not to compress buffers entering the L2ARC is controlled by "compression" setting on the dataset, when compression is not "off", L2ARC compression is enabled. The compress method is always LZ4 for L2ARC when enabled because it works best for the scenario. Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Mon Jun 24 02:24:22 2013 (r252139) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Mon Jun 24 05:00:31 2013 (r252140) @@ -22,6 +22,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ /* @@ -120,6 +121,7 @@ #include #include +#include #include #include #include @@ -322,7 +324,11 @@ typedef struct arc_stats { kstat_named_t arcstat_l2_cksum_bad; kstat_named_t arcstat_l2_io_error; kstat_named_t arcstat_l2_size; + kstat_named_t arcstat_l2_asize; kstat_named_t arcstat_l2_hdr_size; + kstat_named_t arcstat_l2_compress_successes; + kstat_named_t arcstat_l2_compress_zeros; + kstat_named_t arcstat_l2_compress_failures; kstat_named_t arcstat_l2_write_trylock_fail; kstat_named_t arcstat_l2_write_passed_headroom; kstat_named_t arcstat_l2_write_spa_mismatch; @@ -395,7 +401,11 @@ static arc_stats_t arc_stats = { { "l2_cksum_bad", KSTAT_DATA_UINT64 }, { "l2_io_error", KSTAT_DATA_UINT64 }, { "l2_size", KSTAT_DATA_UINT64 }, + { "l2_asize", KSTAT_DATA_UINT64 }, { "l2_hdr_size", KSTAT_DATA_UINT64 }, + { "l2_compress_successes", KSTAT_DATA_UINT64 }, + { "l2_compress_zeros", KSTAT_DATA_UINT64 }, + { "l2_compress_failures", KSTAT_DATA_UINT64 }, { "l2_write_trylock_fail", KSTAT_DATA_UINT64 }, { "l2_write_passed_headroom", KSTAT_DATA_UINT64 }, { "l2_write_spa_mismatch", KSTAT_DATA_UINT64 }, @@ -474,6 +484,9 @@ static arc_state_t *arc_l2c_only; #define arc_c_min ARCSTAT(arcstat_c_min) /* min target cache size */ #define arc_c_max ARCSTAT(arcstat_c_max) /* max target cache size */ +#define L2ARC_IS_VALID_COMPRESS(_c_) \ + ((_c_) == ZIO_COMPRESS_LZ4 || (_c_) == ZIO_COMPRESS_EMPTY) + static int arc_no_grow; /* Don't try to grow cache size */ static uint64_t arc_tempreserve; static uint64_t arc_loaned_bytes; @@ -636,7 +649,12 @@ uint64_t zfs_crc64_table[256]; */ #define L2ARC_WRITE_SIZE (8 * 1024 * 1024) /* initial write max */ -#define L2ARC_HEADROOM 2 /* num of writes */ +#define L2ARC_HEADROOM 2 /* num of writes */ +/* + * If we discover during ARC scan any buffers to be compressed, we boost + * our headroom for the next scanning cycle by this percentage multiple. + */ +#define L2ARC_HEADROOM_BOOST 200 #define L2ARC_FEED_SECS 1 /* caching interval secs */ #define L2ARC_FEED_MIN_MS 200 /* min caching interval ms */ @@ -649,6 +667,7 @@ uint64_t zfs_crc64_table[256]; uint64_t l2arc_write_max = L2ARC_WRITE_SIZE; /* default max write size */ uint64_t l2arc_write_boost = L2ARC_WRITE_SIZE; /* extra write during warmup */ uint64_t l2arc_headroom = L2ARC_HEADROOM; /* number of dev writes */ +uint64_t l2arc_headroom_boost = L2ARC_HEADROOM_BOOST; uint64_t l2arc_feed_secs = L2ARC_FEED_SECS; /* interval seconds */ uint64_t l2arc_feed_min_ms = L2ARC_FEED_MIN_MS; /* min interval milliseconds */ boolean_t l2arc_noprefetch = B_TRUE; /* don't cache prefetch bufs */ @@ -722,8 +741,6 @@ typedef struct l2arc_dev { vdev_t *l2ad_vdev; /* vdev */ spa_t *l2ad_spa; /* spa */ uint64_t l2ad_hand; /* next write location */ - uint64_t l2ad_write; /* desired write size, bytes */ - uint64_t l2ad_boost; /* warmup write boost, bytes */ uint64_t l2ad_start; /* first addr on device */ uint64_t l2ad_end; /* last addr on device */ uint64_t l2ad_evict; /* last addr eviction reached */ @@ -744,11 +761,12 @@ static kmutex_t l2arc_free_on_write_mtx; static uint64_t l2arc_ndev; /* number of devices */ typedef struct l2arc_read_callback { - arc_buf_t *l2rcb_buf; /* read buffer */ - spa_t *l2rcb_spa; /* spa */ - blkptr_t l2rcb_bp; /* original blkptr */ - zbookmark_t l2rcb_zb; /* original bookmark */ - int l2rcb_flags; /* original flags */ + arc_buf_t *l2rcb_buf; /* read buffer */ + spa_t *l2rcb_spa; /* spa */ + blkptr_t l2rcb_bp; /* original blkptr */ + zbookmark_t l2rcb_zb; /* original bookmark */ + int l2rcb_flags; /* original flags */ + enum zio_compress l2rcb_compress; /* applied compress */ } l2arc_read_callback_t; typedef struct l2arc_write_callback { @@ -758,8 +776,14 @@ typedef struct l2arc_write_callback { struct l2arc_buf_hdr { /* protected by arc_buf_hdr mutex */ - l2arc_dev_t *b_dev; /* L2ARC device */ - uint64_t b_daddr; /* disk address, offset byte */ + l2arc_dev_t *b_dev; /* L2ARC device */ + uint64_t b_daddr; /* disk address, offset byte */ + /* compression applied to buffer data */ + enum zio_compress b_compress; + /* real alloc'd buffer size depending on b_compress applied */ + int b_asize; + /* temporary buffer holder for in-flight compressed data */ + void *b_tmp_cdata; }; typedef struct l2arc_data_free { @@ -778,6 +802,11 @@ static void l2arc_read_done(zio_t *zio); static void l2arc_hdr_stat_add(void); static void l2arc_hdr_stat_remove(void); +static boolean_t l2arc_compress_buf(l2arc_buf_hdr_t *l2hdr); +static void l2arc_decompress_zio(zio_t *zio, arc_buf_hdr_t *hdr, + enum zio_compress c); +static void l2arc_release_cdata_buf(arc_buf_hdr_t *ab); + static uint64_t buf_hash(uint64_t spa, const dva_t *dva, uint64_t birth) { @@ -1696,6 +1725,7 @@ arc_hdr_destroy(arc_buf_hdr_t *hdr) hdr->b_size, 0); list_remove(l2hdr->b_dev->l2ad_buflist, hdr); ARCSTAT_INCR(arcstat_l2_size, -hdr->b_size); + ARCSTAT_INCR(arcstat_l2_asize, -l2hdr->b_asize); kmem_free(l2hdr, sizeof (l2arc_buf_hdr_t)); if (hdr->b_state == arc_l2c_only) l2arc_hdr_stat_remove(); @@ -3118,6 +3148,8 @@ top: arc_access(hdr, hash_lock); if (*arc_flags & ARC_L2CACHE) hdr->b_flags |= ARC_L2CACHE; + if (*arc_flags & ARC_L2COMPRESS) + hdr->b_flags |= ARC_L2COMPRESS; mutex_exit(hash_lock); ARCSTAT_BUMP(arcstat_hits); ARCSTAT_CONDSTAT(!(hdr->b_flags & ARC_PREFETCH), @@ -3158,6 +3190,8 @@ top: } if (*arc_flags & ARC_L2CACHE) hdr->b_flags |= ARC_L2CACHE; + if (*arc_flags & ARC_L2COMPRESS) + hdr->b_flags |= ARC_L2COMPRESS; if (BP_GET_LEVEL(bp) > 0) hdr->b_flags |= ARC_INDIRECT; } else { @@ -3174,6 +3208,8 @@ top: add_reference(hdr, hash_lock, private); if (*arc_flags & ARC_L2CACHE) hdr->b_flags |= ARC_L2CACHE; + if (*arc_flags & ARC_L2COMPRESS) + hdr->b_flags |= ARC_L2COMPRESS; buf = kmem_cache_alloc(buf_cache, KM_PUSHPAGE); buf->b_hdr = hdr; buf->b_data = NULL; @@ -3247,6 +3283,7 @@ top: cb->l2rcb_bp = *bp; cb->l2rcb_zb = *zb; cb->l2rcb_flags = zio_flags; + cb->l2rcb_compress = hdr->b_l2hdr->b_compress; ASSERT(addr >= VDEV_LABEL_START_SIZE && addr + size < vd->vdev_psize - @@ -3255,16 +3292,31 @@ top: /* * l2arc read. The SCL_L2ARC lock will be * released by l2arc_read_done(). + * Issue a null zio if the underlying buffer + * was squashed to zero size by compression. */ - rzio = zio_read_phys(pio, vd, addr, size, - buf->b_data, ZIO_CHECKSUM_OFF, - l2arc_read_done, cb, priority, zio_flags | - ZIO_FLAG_DONT_CACHE | ZIO_FLAG_CANFAIL | - ZIO_FLAG_DONT_PROPAGATE | - ZIO_FLAG_DONT_RETRY, B_FALSE); + if (hdr->b_l2hdr->b_compress == + ZIO_COMPRESS_EMPTY) { + rzio = zio_null(pio, spa, vd, + l2arc_read_done, cb, + zio_flags | ZIO_FLAG_DONT_CACHE | + ZIO_FLAG_CANFAIL | + ZIO_FLAG_DONT_PROPAGATE | + ZIO_FLAG_DONT_RETRY); + } else { + rzio = zio_read_phys(pio, vd, addr, + hdr->b_l2hdr->b_asize, + buf->b_data, ZIO_CHECKSUM_OFF, + l2arc_read_done, cb, priority, + zio_flags | ZIO_FLAG_DONT_CACHE | + ZIO_FLAG_CANFAIL | + ZIO_FLAG_DONT_PROPAGATE | + ZIO_FLAG_DONT_RETRY, B_FALSE); + } DTRACE_PROBE2(l2arc__read, vdev_t *, vd, zio_t *, rzio); - ARCSTAT_INCR(arcstat_l2_read_bytes, size); + ARCSTAT_INCR(arcstat_l2_read_bytes, + hdr->b_l2hdr->b_asize); if (*arc_flags & ARC_NOWAIT) { zio_nowait(rzio); @@ -3531,6 +3583,7 @@ arc_release(arc_buf_t *buf, void *tag) buf->b_private = NULL; if (l2hdr) { + ARCSTAT_INCR(arcstat_l2_asize, -l2hdr->b_asize); trim_map_free(l2hdr->b_dev->l2ad_vdev, l2hdr->b_daddr, hdr->b_size, 0); list_remove(l2hdr->b_dev->l2ad_buflist, hdr); @@ -3682,9 +3735,9 @@ arc_write_done(zio_t *zio) zio_t * arc_write(zio_t *pio, spa_t *spa, uint64_t txg, - blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, const zio_prop_t *zp, - arc_done_func_t *ready, arc_done_func_t *done, void *private, - int priority, int zio_flags, const zbookmark_t *zb) + blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, boolean_t l2arc_compress, + const zio_prop_t *zp, arc_done_func_t *ready, arc_done_func_t *done, + void *private, int priority, int zio_flags, const zbookmark_t *zb) { arc_buf_hdr_t *hdr = buf->b_hdr; arc_write_callback_t *callback; @@ -3697,6 +3750,8 @@ arc_write(zio_t *pio, spa_t *spa, uint64 ASSERT(hdr->b_acb == NULL); if (l2arc) hdr->b_flags |= ARC_L2CACHE; + if (l2arc_compress) + hdr->b_flags |= ARC_L2COMPRESS; callback = kmem_zalloc(sizeof (arc_write_callback_t), KM_SLEEP); callback->awcb_ready = ready; callback->awcb_done = done; @@ -4147,8 +4202,12 @@ arc_fini(void) * 2. The L2ARC attempts to cache data from the ARC before it is evicted. * It does this by periodically scanning buffers from the eviction-end of * the MFU and MRU ARC lists, copying them to the L2ARC devices if they are - * not already there. It scans until a headroom of buffers is satisfied, - * which itself is a buffer for ARC eviction. The thread that does this is + * not already there. It scans until a headroom of buffers is satisfied, + * which itself is a buffer for ARC eviction. If a compressible buffer is + * found during scanning and selected for writing to an L2ARC device, we + * temporarily boost scanning headroom during the next scan cycle to make + * sure we adapt to compression effects (which might significantly reduce + * the data volume we write to L2ARC). The thread that does this is * l2arc_feed_thread(), illustrated below; example sizes are included to * provide a better sense of ratio than this diagram: * @@ -4213,6 +4272,11 @@ arc_fini(void) * l2arc_write_boost extra write bytes during device warmup * l2arc_noprefetch skip caching prefetched buffers * l2arc_headroom number of max device writes to precache + * l2arc_headroom_boost when we find compressed buffers during ARC + * scanning, we multiply headroom by this + * percentage factor for the next scan cycle, + * since more compressed buffers are likely to + * be present * l2arc_feed_secs seconds between L2ARC writing * * Tunables may be removed or added as future performance improvements are @@ -4259,14 +4323,24 @@ l2arc_write_eligible(uint64_t spa_guid, } static uint64_t -l2arc_write_size(l2arc_dev_t *dev) +l2arc_write_size(void) { uint64_t size; - size = dev->l2ad_write; + /* + * Make sure our globals have meaningful values in case the user + * altered them. + */ + size = l2arc_write_max; + if (size == 0) { + cmn_err(CE_NOTE, "Bad value for l2arc_write_max, value must " + "be greater than zero, resetting it to the default (%d)", + L2ARC_WRITE_SIZE); + size = l2arc_write_max = L2ARC_WRITE_SIZE; + } if (arc_warm == B_FALSE) - size += dev->l2ad_boost; + size += l2arc_write_boost; return (size); @@ -4440,12 +4514,20 @@ l2arc_write_done(zio_t *zio) continue; } + abl2 = ab->b_l2hdr; + + /* + * Release the temporary compressed buffer as soon as possible. + */ + if (abl2->b_compress != ZIO_COMPRESS_OFF) + l2arc_release_cdata_buf(ab); + if (zio->io_error != 0) { /* * Error - drop L2ARC entry. */ list_remove(buflist, ab); - abl2 = ab->b_l2hdr; + ARCSTAT_INCR(arcstat_l2_asize, -abl2->b_asize); ab->b_l2hdr = NULL; trim_map_free(abl2->b_dev->l2ad_vdev, abl2->b_daddr, ab->b_size, 0); @@ -4500,6 +4582,13 @@ l2arc_read_done(zio_t *zio) ASSERT3P(hash_lock, ==, HDR_LOCK(hdr)); /* + * If the buffer was compressed, decompress it first. + */ + if (cb->l2rcb_compress != ZIO_COMPRESS_OFF) + l2arc_decompress_zio(zio, hdr, cb->l2rcb_compress); + ASSERT(zio->io_data != NULL); + + /* * Check this survived the L2ARC journey. */ equal = arc_cksum_equal(buf); @@ -4695,6 +4784,7 @@ top: */ if (ab->b_l2hdr != NULL) { abl2 = ab->b_l2hdr; + ARCSTAT_INCR(arcstat_l2_asize, -abl2->b_asize); ab->b_l2hdr = NULL; kmem_free(abl2, sizeof (l2arc_buf_hdr_t)); ARCSTAT_INCR(arcstat_l2_size, -ab->b_size); @@ -4720,38 +4810,55 @@ top: * * An ARC_L2_WRITING flag is set so that the L2ARC buffers are not valid * for reading until they have completed writing. + * The headroom_boost is an in-out parameter used to maintain headroom boost + * state between calls to this function. + * + * Returns the number of bytes actually written (which may be smaller than + * the delta by which the device hand has changed due to alignment). */ static uint64_t -l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz) +l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz, + boolean_t *headroom_boost) { arc_buf_hdr_t *ab, *ab_prev, *head; - l2arc_buf_hdr_t *hdrl2; list_t *list; - uint64_t passed_sz, write_sz, buf_sz, headroom; + uint64_t write_asize, write_psize, write_sz, headroom, + buf_compress_minsz; void *buf_data; - kmutex_t *hash_lock, *list_lock; - boolean_t have_lock, full; + kmutex_t *list_lock; + boolean_t full; l2arc_write_callback_t *cb; zio_t *pio, *wzio; uint64_t guid = spa_load_guid(spa); + const boolean_t do_headroom_boost = *headroom_boost; int try; ASSERT(dev->l2ad_vdev != NULL); + /* Lower the flag now, we might want to raise it again later. */ + *headroom_boost = B_FALSE; + pio = NULL; - write_sz = 0; + write_sz = write_asize = write_psize = 0; full = B_FALSE; head = kmem_cache_alloc(hdr_cache, KM_PUSHPAGE); head->b_flags |= ARC_L2_WRITE_HEAD; ARCSTAT_BUMP(arcstat_l2_write_buffer_iter); /* + * We will want to try to compress buffers that are at least 2x the + * device sector size. + */ + buf_compress_minsz = 2 << dev->l2ad_vdev->vdev_ashift; + + /* * Copy buffers for L2ARC writing. */ mutex_enter(&l2arc_buflist_mtx); for (try = 0; try < 2 * ARC_BUFC_NUMLISTS; try++) { + uint64_t passed_sz = 0; + list = l2arc_list_locked(try, &list_lock); - passed_sz = 0; ARCSTAT_BUMP(arcstat_l2_write_buffer_list_iter); /* @@ -4760,7 +4867,6 @@ l2arc_write_buffers(spa_t *spa, l2arc_de * Until the ARC is warm and starts to evict, read from the * head of the ARC lists rather than the tail. */ - headroom = target_sz * l2arc_headroom; if (arc_warm == B_FALSE) ab = list_head(list); else @@ -4768,7 +4874,15 @@ l2arc_write_buffers(spa_t *spa, l2arc_de if (ab == NULL) ARCSTAT_BUMP(arcstat_l2_write_buffer_list_null_iter); + headroom = target_sz * l2arc_headroom; + if (do_headroom_boost) + headroom = (headroom * l2arc_headroom_boost) / 100; + for (; ab; ab = ab_prev) { + l2arc_buf_hdr_t *l2hdr; + kmutex_t *hash_lock; + uint64_t buf_sz; + if (arc_warm == B_FALSE) ab_prev = list_next(list, ab); else @@ -4776,8 +4890,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_de ARCSTAT_INCR(arcstat_l2_write_buffer_bytes_scanned, ab->b_size); hash_lock = HDR_LOCK(ab); - have_lock = MUTEX_HELD(hash_lock); - if (!have_lock && !mutex_tryenter(hash_lock)) { + if (!mutex_tryenter(hash_lock)) { ARCSTAT_BUMP(arcstat_l2_write_trylock_fail); /* * Skip this buffer rather than waiting. @@ -4827,15 +4940,26 @@ l2arc_write_buffers(spa_t *spa, l2arc_de /* * Create and add a new L2ARC header. */ - hdrl2 = kmem_zalloc(sizeof (l2arc_buf_hdr_t), KM_SLEEP); - hdrl2->b_dev = dev; - hdrl2->b_daddr = dev->l2ad_hand; - + l2hdr = kmem_zalloc(sizeof (l2arc_buf_hdr_t), KM_SLEEP); + l2hdr->b_dev = dev; ab->b_flags |= ARC_L2_WRITING; - ab->b_l2hdr = hdrl2; - list_insert_head(dev->l2ad_buflist, ab); - buf_data = ab->b_buf->b_data; + + /* + * Temporarily stash the data buffer in b_tmp_cdata. + * The subsequent write step will pick it up from + * there. This is because can't access ab->b_buf + * without holding the hash_lock, which we in turn + * can't access without holding the ARC list locks + * (which we want to avoid during compression/writing). + */ + l2hdr->b_compress = ZIO_COMPRESS_OFF; + l2hdr->b_asize = ab->b_size; + l2hdr->b_tmp_cdata = ab->b_buf->b_data; + buf_sz = ab->b_size; + ab->b_l2hdr = l2hdr; + + list_insert_head(dev->l2ad_buflist, ab); /* * Compute and store the buffer cksum before @@ -4846,6 +4970,64 @@ l2arc_write_buffers(spa_t *spa, l2arc_de mutex_exit(hash_lock); + write_sz += buf_sz; + } + + mutex_exit(list_lock); + + if (full == B_TRUE) + break; + } + + /* No buffers selected for writing? */ + if (pio == NULL) { + ASSERT0(write_sz); + mutex_exit(&l2arc_buflist_mtx); + kmem_cache_free(hdr_cache, head); + return (0); + } + + /* + * Now start writing the buffers. We're starting at the write head + * and work backwards, retracing the course of the buffer selector + * loop above. + */ + for (ab = list_prev(dev->l2ad_buflist, head); ab; + ab = list_prev(dev->l2ad_buflist, ab)) { + l2arc_buf_hdr_t *l2hdr; + uint64_t buf_sz; + + /* + * We shouldn't need to lock the buffer here, since we flagged + * it as ARC_L2_WRITING in the previous step, but we must take + * care to only access its L2 cache parameters. In particular, + * ab->b_buf may be invalid by now due to ARC eviction. + */ + l2hdr = ab->b_l2hdr; + l2hdr->b_daddr = dev->l2ad_hand; + + if ((ab->b_flags & ARC_L2COMPRESS) && + l2hdr->b_asize >= buf_compress_minsz) { + if (l2arc_compress_buf(l2hdr)) { + /* + * If compression succeeded, enable headroom + * boost on the next scan cycle. + */ + *headroom_boost = B_TRUE; + } + } + + /* + * Pick up the buffer data we had previously stashed away + * (and now potentially also compressed). + */ + buf_data = l2hdr->b_tmp_cdata; + buf_sz = l2hdr->b_asize; + + /* Compression may have squashed the buffer to zero length. */ + if (buf_sz != 0) { + uint64_t buf_p_sz; + wzio = zio_write_phys(pio, dev->l2ad_vdev, dev->l2ad_hand, buf_sz, buf_data, ZIO_CHECKSUM_OFF, NULL, NULL, ZIO_PRIORITY_ASYNC_WRITE, @@ -4855,33 +5037,24 @@ l2arc_write_buffers(spa_t *spa, l2arc_de zio_t *, wzio); (void) zio_nowait(wzio); + write_asize += buf_sz; /* * Keep the clock hand suitably device-aligned. */ - buf_sz = vdev_psize_to_asize(dev->l2ad_vdev, buf_sz); - - write_sz += buf_sz; - dev->l2ad_hand += buf_sz; + buf_p_sz = vdev_psize_to_asize(dev->l2ad_vdev, buf_sz); + write_psize += buf_p_sz; + dev->l2ad_hand += buf_p_sz; } - - mutex_exit(list_lock); - - if (full == B_TRUE) - break; } - mutex_exit(&l2arc_buflist_mtx); - if (pio == NULL) { - ASSERT0(write_sz); - kmem_cache_free(hdr_cache, head); - return (0); - } + mutex_exit(&l2arc_buflist_mtx); - ASSERT3U(write_sz, <=, target_sz); + ASSERT3U(write_asize, <=, target_sz); ARCSTAT_BUMP(arcstat_l2_writes_sent); - ARCSTAT_INCR(arcstat_l2_write_bytes, write_sz); + ARCSTAT_INCR(arcstat_l2_write_bytes, write_asize); ARCSTAT_INCR(arcstat_l2_size, write_sz); - vdev_space_update(dev->l2ad_vdev, write_sz, 0, 0); + ARCSTAT_INCR(arcstat_l2_asize, write_asize); + vdev_space_update(dev->l2ad_vdev, write_psize, 0, 0); /* * Bump device hand to the device start if it is approaching the end. @@ -4899,7 +5072,153 @@ l2arc_write_buffers(spa_t *spa, l2arc_de (void) zio_wait(pio); dev->l2ad_writing = B_FALSE; - return (write_sz); + return (write_asize); +} + +/* + * Compresses an L2ARC buffer. + * The data to be compressed must be prefilled in l2hdr->b_tmp_cdata and its + * size in l2hdr->b_asize. This routine tries to compress the data and + * depending on the compression result there are three possible outcomes: + * *) The buffer was incompressible. The original l2hdr contents were left + * untouched and are ready for writing to an L2 device. + * *) The buffer was all-zeros, so there is no need to write it to an L2 + * device. To indicate this situation b_tmp_cdata is NULL'ed, b_asize is + * set to zero and b_compress is set to ZIO_COMPRESS_EMPTY. + * *) Compression succeeded and b_tmp_cdata was replaced with a temporary + * data buffer which holds the compressed data to be written, and b_asize + * tells us how much data there is. b_compress is set to the appropriate + * compression algorithm. Once writing is done, invoke + * l2arc_release_cdata_buf on this l2hdr to free this temporary buffer. + * + * Returns B_TRUE if compression succeeded, or B_FALSE if it didn't (the + * buffer was incompressible). + */ +static boolean_t +l2arc_compress_buf(l2arc_buf_hdr_t *l2hdr) +{ + void *cdata; + size_t csize, len; + + ASSERT(l2hdr->b_compress == ZIO_COMPRESS_OFF); + ASSERT(l2hdr->b_tmp_cdata != NULL); + + len = l2hdr->b_asize; + cdata = zio_data_buf_alloc(len); + csize = zio_compress_data(ZIO_COMPRESS_LZ4, l2hdr->b_tmp_cdata, + cdata, l2hdr->b_asize); + + if (csize == 0) { + /* zero block, indicate that there's nothing to write */ + zio_data_buf_free(cdata, len); + l2hdr->b_compress = ZIO_COMPRESS_EMPTY; + l2hdr->b_asize = 0; + l2hdr->b_tmp_cdata = NULL; + ARCSTAT_BUMP(arcstat_l2_compress_zeros); + return (B_TRUE); + } else if (csize > 0 && csize < len) { + /* + * Compression succeeded, we'll keep the cdata around for + * writing and release it afterwards. + */ + l2hdr->b_compress = ZIO_COMPRESS_LZ4; + l2hdr->b_asize = csize; + l2hdr->b_tmp_cdata = cdata; + ARCSTAT_BUMP(arcstat_l2_compress_successes); + return (B_TRUE); + } else { + /* + * Compression failed, release the compressed buffer. + * l2hdr will be left unmodified. + */ + zio_data_buf_free(cdata, len); + ARCSTAT_BUMP(arcstat_l2_compress_failures); + return (B_FALSE); + } +} + +/* + * Decompresses a zio read back from an l2arc device. On success, the + * underlying zio's io_data buffer is overwritten by the uncompressed + * version. On decompression error (corrupt compressed stream), the + * zio->io_error value is set to signal an I/O error. + * + * Please note that the compressed data stream is not checksummed, so + * if the underlying device is experiencing data corruption, we may feed + * corrupt data to the decompressor, so the decompressor needs to be + * able to handle this situation (LZ4 does). + */ +static void +l2arc_decompress_zio(zio_t *zio, arc_buf_hdr_t *hdr, enum zio_compress c) +{ + ASSERT(L2ARC_IS_VALID_COMPRESS(c)); + + if (zio->io_error != 0) { + /* + * An io error has occured, just restore the original io + * size in preparation for a main pool read. + */ + zio->io_orig_size = zio->io_size = hdr->b_size; + return; + } + + if (c == ZIO_COMPRESS_EMPTY) { + /* + * An empty buffer results in a null zio, which means we + * need to fill its io_data after we're done restoring the + * buffer's contents. + */ + ASSERT(hdr->b_buf != NULL); + bzero(hdr->b_buf->b_data, hdr->b_size); + zio->io_data = zio->io_orig_data = hdr->b_buf->b_data; + } else { + ASSERT(zio->io_data != NULL); + /* + * We copy the compressed data from the start of the arc buffer + * (the zio_read will have pulled in only what we need, the + * rest is garbage which we will overwrite at decompression) + * and then decompress back to the ARC data buffer. This way we + * can minimize copying by simply decompressing back over the + * original compressed data (rather than decompressing to an + * aux buffer and then copying back the uncompressed buffer, + * which is likely to be much larger). + */ + uint64_t csize; + void *cdata; + + csize = zio->io_size; + cdata = zio_data_buf_alloc(csize); + bcopy(zio->io_data, cdata, csize); + if (zio_decompress_data(c, cdata, zio->io_data, csize, + hdr->b_size) != 0) + zio->io_error = EIO; + zio_data_buf_free(cdata, csize); + } + + /* Restore the expected uncompressed IO size. */ + zio->io_orig_size = zio->io_size = hdr->b_size; +} + +/* + * Releases the temporary b_tmp_cdata buffer in an l2arc header structure. + * This buffer serves as a temporary holder of compressed data while + * the buffer entry is being written to an l2arc device. Once that is + * done, we can dispose of it. + */ +static void +l2arc_release_cdata_buf(arc_buf_hdr_t *ab) +{ + l2arc_buf_hdr_t *l2hdr = ab->b_l2hdr; + + if (l2hdr->b_compress == ZIO_COMPRESS_LZ4) { + /* + * If the data was compressed, then we've allocated a + * temporary buffer for it, so now we need to release it. + */ + ASSERT(l2hdr->b_tmp_cdata != NULL); + zio_data_buf_free(l2hdr->b_tmp_cdata, ab->b_size); + } + l2hdr->b_tmp_cdata = NULL; } /* @@ -4914,6 +5233,7 @@ l2arc_feed_thread(void *dummy __unused) spa_t *spa; uint64_t size, wrote; clock_t begin, next = ddi_get_lbolt(); + boolean_t headroom_boost = B_FALSE; CALLB_CPR_INIT(&cpr, &l2arc_feed_thr_lock, callb_generic_cpr, FTAG); @@ -4974,7 +5294,7 @@ l2arc_feed_thread(void *dummy __unused) ARCSTAT_BUMP(arcstat_l2_feeds); - size = l2arc_write_size(dev); + size = l2arc_write_size(); /* * Evict L2ARC buffers that will be overwritten. @@ -4984,7 +5304,7 @@ l2arc_feed_thread(void *dummy __unused) /* * Write ARC buffers. */ - wrote = l2arc_write_buffers(spa, dev, size); + wrote = l2arc_write_buffers(spa, dev, size, &headroom_boost); /* * Calculate interval between writes. @@ -5032,15 +5352,12 @@ l2arc_add_vdev(spa_t *spa, vdev_t *vd) adddev = kmem_zalloc(sizeof (l2arc_dev_t), KM_SLEEP); adddev->l2ad_spa = spa; adddev->l2ad_vdev = vd; - adddev->l2ad_write = l2arc_write_max; - adddev->l2ad_boost = l2arc_write_boost; adddev->l2ad_start = VDEV_LABEL_START_SIZE; adddev->l2ad_end = VDEV_LABEL_START_SIZE + vdev_get_min_asize(vd); adddev->l2ad_hand = adddev->l2ad_start; adddev->l2ad_evict = adddev->l2ad_start; adddev->l2ad_first = B_TRUE; adddev->l2ad_writing = B_FALSE; - ASSERT3U(adddev->l2ad_write, >, 0); /* * This is a list of all ARC buffers that are still valid on the Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Mon Jun 24 02:24:22 2013 (r252139) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Mon Jun 24 05:00:31 2013 (r252140) @@ -22,6 +22,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ #include @@ -568,6 +569,8 @@ dbuf_read_impl(dmu_buf_impl_t *db, zio_t if (DBUF_IS_L2CACHEABLE(db)) aflags |= ARC_L2CACHE; + if (DBUF_IS_L2COMPRESSIBLE(db)) + aflags |= ARC_L2COMPRESS; SET_BOOKMARK(&zb, db->db_objset->os_dsl_dataset ? db->db_objset->os_dsl_dataset->ds_object : DMU_META_OBJSET, @@ -2710,8 +2713,9 @@ dbuf_write(dbuf_dirty_record_t *dr, arc_ } else { ASSERT(arc_released(data)); dr->dr_zio = arc_write(zio, os->os_spa, txg, - db->db_blkptr, data, DBUF_IS_L2CACHEABLE(db), &zp, - dbuf_write_ready, dbuf_write_done, db, - ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, &zb); + db->db_blkptr, data, DBUF_IS_L2CACHEABLE(db), + DBUF_IS_L2COMPRESSIBLE(db), &zp, dbuf_write_ready, + dbuf_write_done, db, ZIO_PRIORITY_ASYNC_WRITE, + ZIO_FLAG_MUSTSUCCEED, &zb); } } Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Mon Jun 24 02:24:22 2013 (r252139) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Mon Jun 24 05:00:31 2013 (r252140) @@ -23,6 +23,8 @@ * Copyright (c) 2013 by Delphix. All rights reserved. */ +/* Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ + #include #include #include @@ -1514,9 +1516,9 @@ dmu_sync(zio_t *pio, uint64_t txg, dmu_s dsa->dsa_tx = NULL; zio_nowait(arc_write(pio, os->os_spa, txg, - bp, dr->dt.dl.dr_data, DBUF_IS_L2CACHEABLE(db), &zp, - dmu_sync_ready, dmu_sync_done, dsa, - ZIO_PRIORITY_SYNC_WRITE, ZIO_FLAG_CANFAIL, &zb)); + bp, dr->dt.dl.dr_data, DBUF_IS_L2CACHEABLE(db), + DBUF_IS_L2COMPRESSIBLE(db), &zp, dmu_sync_ready, dmu_sync_done, + dsa, ZIO_PRIORITY_SYNC_WRITE, ZIO_FLAG_CANFAIL, &zb)); return (0); } Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Mon Jun 24 02:24:22 2013 (r252139) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Mon Jun 24 05:00:31 2013 (r252140) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -276,6 +277,8 @@ dmu_objset_open_impl(spa_t *spa, dsl_dat if (DMU_OS_IS_L2CACHEABLE(os)) aflags |= ARC_L2CACHE; + if (DMU_OS_IS_L2COMPRESSIBLE(os)) + aflags |= ARC_L2COMPRESS; dprintf_bp(os->os_rootbp, "reading %s", ""); err = arc_read(NULL, spa, os->os_rootbp, @@ -991,9 +994,10 @@ dmu_objset_sync(objset_t *os, zio_t *pio dmu_write_policy(os, NULL, 0, 0, &zp); zio = arc_write(pio, os->os_spa, tx->tx_txg, - os->os_rootbp, os->os_phys_buf, DMU_OS_IS_L2CACHEABLE(os), &zp, - dmu_objset_write_ready, dmu_objset_write_done, os, - ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, &zb); + os->os_rootbp, os->os_phys_buf, DMU_OS_IS_L2CACHEABLE(os), + DMU_OS_IS_L2COMPRESSIBLE(os), &zp, dmu_objset_write_ready, + dmu_objset_write_done, os, ZIO_PRIORITY_ASYNC_WRITE, + ZIO_FLAG_MUSTSUCCEED, &zb); /* * Sync special dnodes - the parent IO for the sync is the root block Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Mon Jun 24 02:24:22 2013 (r252139) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Mon Jun 24 05:00:31 2013 (r252140) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ #ifndef _SYS_ARC_H @@ -67,6 +68,7 @@ typedef enum arc_buf_contents { #define ARC_PREFETCH (1 << 3) /* I/O is a prefetch */ #define ARC_CACHED (1 << 4) /* I/O was already in cache */ #define ARC_L2CACHE (1 << 5) /* cache in L2ARC */ +#define ARC_L2COMPRESS (1 << 6) /* compress in L2ARC */ /* * The following breakdows of arc_size exist for kstat only. @@ -105,9 +107,9 @@ int arc_read(zio_t *pio, spa_t *spa, con arc_done_func_t *done, void *priv, int priority, int flags, uint32_t *arc_flags, const zbookmark_t *zb); zio_t *arc_write(zio_t *pio, spa_t *spa, uint64_t txg, - blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, const zio_prop_t *zp, - arc_done_func_t *ready, arc_done_func_t *done, void *priv, - int priority, int zio_flags, const zbookmark_t *zb); + blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, boolean_t l2arc_compress, + const zio_prop_t *zp, arc_done_func_t *ready, arc_done_func_t *done, + void *priv, int priority, int zio_flags, const zbookmark_t *zb); void arc_set_callback(arc_buf_t *buf, arc_evict_func_t *func, void *priv); int arc_buf_evict(arc_buf_t *buf); Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h Mon Jun 24 02:24:22 2013 (r252139) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h Mon Jun 24 05:00:31 2013 (r252140) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ #ifndef _SYS_DBUF_H @@ -324,6 +325,9 @@ boolean_t dbuf_is_metadata(dmu_buf_impl_ (dbuf_is_metadata(_db) && \ ((_db)->db_objset->os_secondary_cache == ZFS_CACHE_METADATA))) +#define DBUF_IS_L2COMPRESSIBLE(_db) \ + ((_db)->db_objset->os_compress != ZIO_COMPRESS_OFF) + #ifdef ZFS_DEBUG /* Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h Mon Jun 24 02:24:22 2013 (r252139) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h Mon Jun 24 05:00:31 2013 (r252140) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -129,6 +130,8 @@ struct objset { ((os)->os_secondary_cache == ZFS_CACHE_ALL || \ (os)->os_secondary_cache == ZFS_CACHE_METADATA) +#define DMU_OS_IS_L2COMPRESSIBLE(os) ((os)->os_compress != ZIO_COMPRESS_OFF) + /* called from zpl */ int dmu_objset_hold(const char *name, void *tag, objset_t **osp); int dmu_objset_own(const char *name, dmu_objset_type_t type, From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 05:03:43 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A1EE1BBA; Mon, 24 Jun 2013 05:03:43 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 925B51D87; Mon, 24 Jun 2013 05:03:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5O53hwG037473; Mon, 24 Jun 2013 05:03:43 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5O53h7V037470; Mon, 24 Jun 2013 05:03:43 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201306240503.r5O53h7V037470@svn.freebsd.org> From: Xin LI Date: Mon, 24 Jun 2013 05:03:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252142 - in stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 05:03:43 -0000 Author: delphij Date: Mon Jun 24 05:03:42 2013 New Revision: 252142 URL: http://svnweb.freebsd.org/changeset/base/252142 Log: MFC r251520: MFV r251519: * Illumos ZFS issue #3805 arc shouldn't cache freed blocks Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Mon Jun 24 05:01:13 2013 (r252141) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Mon Jun 24 05:03:42 2013 (r252142) @@ -3372,6 +3372,34 @@ arc_set_callback(arc_buf_t *buf, arc_evi } /* + * Notify the arc that a block was freed, and thus will never be used again. + */ +void +arc_freed(spa_t *spa, const blkptr_t *bp) +{ + arc_buf_hdr_t *hdr; + kmutex_t *hash_lock; + uint64_t guid = spa_load_guid(spa); + + hdr = buf_hash_find(guid, BP_IDENTITY(bp), BP_PHYSICAL_BIRTH(bp), + &hash_lock); + if (hdr == NULL) + return; + if (HDR_BUF_AVAILABLE(hdr)) { + arc_buf_t *buf = hdr->b_buf; + add_reference(hdr, hash_lock, FTAG); + hdr->b_flags &= ~ARC_BUF_AVAILABLE; + mutex_exit(hash_lock); + + arc_release(buf, FTAG); + (void) arc_buf_remove_ref(buf, FTAG); + } else { + mutex_exit(hash_lock); + } + +} + +/* * This is used by the DMU to let the ARC know that a buffer is * being evicted, so the ARC should clean up. If this arc buf * is not yet in the evicted state, it will be put there. Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Mon Jun 24 05:01:13 2013 (r252141) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h Mon Jun 24 05:03:42 2013 (r252142) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ @@ -110,6 +110,7 @@ zio_t *arc_write(zio_t *pio, spa_t *spa, blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, boolean_t l2arc_compress, const zio_prop_t *zp, arc_done_func_t *ready, arc_done_func_t *done, void *priv, int priority, int zio_flags, const zbookmark_t *zb); +void arc_freed(spa_t *spa, const blkptr_t *bp); void arc_set_callback(arc_buf_t *buf, arc_evict_func_t *func, void *priv); int arc_buf_evict(arc_buf_t *buf); Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Mon Jun 24 05:01:13 2013 (r252141) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Mon Jun 24 05:03:42 2013 (r252142) @@ -772,6 +772,7 @@ zio_free_sync(zio_t *pio, spa_t *spa, ui ASSERT(spa_sync_pass(spa) < zfs_sync_pass_deferred_free); metaslab_check_free(spa, bp); + arc_freed(spa, bp); zio = zio_create(pio, spa, txg, bp, NULL, size, NULL, NULL, ZIO_TYPE_FREE, ZIO_PRIORITY_FREE, flags, From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 08:55:21 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 73C50F1C; Mon, 24 Jun 2013 08:55:21 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5653E1731; Mon, 24 Jun 2013 08:55:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5O8tLI4002569; Mon, 24 Jun 2013 08:55:21 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5O8tLBN002568; Mon, 24 Jun 2013 08:55:21 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201306240855.r5O8tLBN002568@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 24 Jun 2013 08:55:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252144 - stable/9/share/man/man4 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 08:55:21 -0000 Author: glebius Date: Mon Jun 24 08:55:20 2013 New Revision: 252144 URL: http://svnweb.freebsd.org/changeset/base/252144 Log: Merge r243151: o Remove meaningless PROTOCOLS section. o Describe passing file descriptors as separate section. - Descriptors can be passed through any protocol of the UNIX family, not SOCK_STREAM and SOCK_SEQPACKET only. [1] o Describe socket options as separate section. - Move LOCAL_PEERCRED option to this section. - Describe struct xucred. - In LOCAL_CREDS section mention that credentials are passed only on the first read on non-datagram sockets. o Xref all mentioned system calls. Noticed by: Igor Sysoev [1] Modified: stable/9/share/man/man4/unix.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/unix.4 ============================================================================== --- stable/9/share/man/man4/unix.4 Mon Jun 24 05:18:31 2013 (r252143) +++ stable/9/share/man/man4/unix.4 Mon Jun 24 08:55:20 2013 (r252144) @@ -32,7 +32,7 @@ .\" @(#)unix.4 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd October 5, 2009 +.Dd November 16, 2012 .Dt UNIX 4 .Os .Sh NAME @@ -123,20 +123,10 @@ of a or .Xr sendto 2 must be writable. -.Sh PROTOCOLS +.Sh PASSING FILE DESCRIPTORS The .Ux Ns -domain -protocol family is comprised of simple -transport protocols that support the -.Dv SOCK_STREAM , -.Dv SOCK_SEQPACKET , -and -.Dv SOCK_DGRAM -abstractions. -.Dv SOCK_STREAM -and -.Dv SOCK_SEQPACKET -sockets also support the communication of +sockets support the communication of .Ux file descriptors through the use of the .Va msg_control @@ -173,36 +163,7 @@ passed to a receiver. Descriptors that are awaiting delivery, or that are purposely not received, are automatically closed by the system when the destination socket is closed. -.Pp -The effective credentials (i.e., the user ID and group list) of a -peer on a -.Dv SOCK_STREAM -socket may be obtained using the -.Dv LOCAL_PEERCRED -socket option. -This may be used by a server to obtain and verify the credentials of -its client, and vice versa by the client to verify the credentials -of the server. -These will arrive in the form of a filled in -.Vt "struct xucred" -(defined in -.In sys/ucred.h ) . -The credentials presented to the server (the -.Xr listen 2 -caller) are those of the client when it called -.Xr connect 2 ; -the credentials presented to the client (the -.Xr connect 2 -caller) are those of the server when it called -.Xr listen 2 . -This mechanism is reliable; there is no way for either party to influence -the credentials presented to its peer except by calling the appropriate -system call (e.g., -.Xr connect 2 -or -.Xr listen 2 ) -under different effective credentials. -.Pp +.Sh SOCKET OPTIONS .Tn UNIX domain sockets support a number of socket options which can be set with .Xr setsockopt 2 @@ -256,6 +217,13 @@ cmsg_len = CMSG_LEN(SOCKCREDSIZE(ngroups cmsg_level = SOL_SOCKET cmsg_type = SCM_CREDS .Ed +.Pp +On +.Dv SOCK_STREAM +and +.Dv SOCK_SEQPACKET +sockets credentials are passed only on the first read from a socket, +then system clears the option on socket. .It Dv LOCAL_CONNWAIT Used with .Dv SOCK_STREAM @@ -264,8 +232,62 @@ sockets, this option causes the function to block until .Xr accept 2 has been called on the listening socket. +.It Dv LOCAL_PEERCRED +Requested via +.Xr getsockopt 2 +on a +.Dv SOCK_STREAM +socket returns credentials of the remote side. +These will arrive in the form of a filled in +.Vt xucred +structure, defined in +.In sys/ucred.h +as follows: +.Bd -literal +struct xucred { + u_int cr_version; /* structure layout version */ + uid_t cr_uid; /* effective user id */ + short cr_ngroups; /* number of groups */ + gid_t cr_groups[XU_NGROUPS]; /* groups */ +}; +.Ed +The +.Vt cr_version +fields should be checked against +.Dv XUCRED_VERSION +define. +.Pp +The credentials presented to the server (the +.Xr listen 2 +caller) are those of the client when it called +.Xr connect 2 ; +the credentials presented to the client (the +.Xr connect 2 +caller) are those of the server when it called +.Xr listen 2 . +This mechanism is reliable; there is no way for either party to influence +the credentials presented to its peer except by calling the appropriate +system call (e.g., +.Xr connect 2 +or +.Xr listen 2 ) +under different effective credentials. +.Pp +To reliably obtain peer credentials on a +.Dv SOCK_DGRAM +socket refer to the +.Dv LOCAL_CREDS +socket option. .El .Sh SEE ALSO +.Xr connect 2 , +.Xr dup 2 , +.Xr fcntl 2 , +.Xr getsockopt 2 , +.Xr listen 2 , +.Xr recvmsg 2 , +.Xr sendto 2 , +.Xr setsockopt 2 , .Xr socket 2 , .Xr intro 4 .Rs From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 09:00:19 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 47D4C17D; Mon, 24 Jun 2013 09:00:19 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3A65C1763; Mon, 24 Jun 2013 09:00:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5O90J7Y004737; Mon, 24 Jun 2013 09:00:19 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5O90Jau004735; Mon, 24 Jun 2013 09:00:19 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201306240900.r5O90Jau004735@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 24 Jun 2013 09:00:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252145 - stable/9/sys/net X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 09:00:19 -0000 Author: glebius Date: Mon Jun 24 09:00:18 2013 New Revision: 252145 URL: http://svnweb.freebsd.org/changeset/base/252145 Log: Merge r243569, r243601: Re-initialize eh pointer after m_adj(), after ng_ether(4) and if_bridge(4) processing. Submitted by: Kohji Okuno Reviewed by: yongari Modified: stable/9/sys/net/if_ethersubr.c Directory Properties: stable/9/sys/net/ (props changed) Modified: stable/9/sys/net/if_ethersubr.c ============================================================================== --- stable/9/sys/net/if_ethersubr.c Mon Jun 24 08:55:20 2013 (r252144) +++ stable/9/sys/net/if_ethersubr.c Mon Jun 24 09:00:18 2013 (r252145) @@ -694,6 +694,7 @@ ether_input_internal(struct ifnet *ifp, bcopy((char *)evl, (char *)evl + ETHER_VLAN_ENCAP_LEN, ETHER_HDR_LEN - ETHER_TYPE_LEN); m_adj(m, ETHER_VLAN_ENCAP_LEN); + eh = mtod(m, struct ether_header *); } M_SETFIB(m, ifp->if_fib); @@ -708,6 +709,7 @@ ether_input_internal(struct ifnet *ifp, CURVNET_RESTORE(); return; } + eh = mtod(m, struct ether_header *); } /* @@ -722,6 +724,7 @@ ether_input_internal(struct ifnet *ifp, CURVNET_RESTORE(); return; } + eh = mtod(m, struct ether_header *); } #if defined(INET) || defined(INET6) From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 09:14:38 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A3E8E786; Mon, 24 Jun 2013 09:14:38 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 95C6F1813; Mon, 24 Jun 2013 09:14:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5O9EckE008713; Mon, 24 Jun 2013 09:14:38 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5O9Ec08008711; Mon, 24 Jun 2013 09:14:38 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201306240914.r5O9Ec08008711@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 24 Jun 2013 09:14:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252146 - stable/9/sys/dev/sound/pci/hda X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 09:14:38 -0000 Author: glebius Date: Mon Jun 24 09:14:38 2013 New Revision: 252146 URL: http://svnweb.freebsd.org/changeset/base/252146 Log: Merge r247910: Plug a memory leak. Reviewed by: mav Sponsored by: Nginx, Inc. Modified: stable/9/sys/dev/sound/pci/hda/hdacc.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/sound/pci/hda/hdacc.c ============================================================================== --- stable/9/sys/dev/sound/pci/hda/hdacc.c Mon Jun 24 09:00:18 2013 (r252145) +++ stable/9/sys/dev/sound/pci/hda/hdacc.c Mon Jun 24 09:14:38 2013 (r252146) @@ -460,8 +460,12 @@ hdacc_attach(device_t dev) static int hdacc_detach(device_t dev) { + struct hdacc_softc *codec = device_get_softc(dev); + int error; - return (device_delete_children(dev)); + error = device_delete_children(dev); + free(codec->fgs, M_HDACC); + return (error); } static int From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 09:20:15 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 257C1AE2; Mon, 24 Jun 2013 09:20:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id F20FD185B; Mon, 24 Jun 2013 09:20:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5O9KEMw009530; Mon, 24 Jun 2013 09:20:14 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5O9KEKM009528; Mon, 24 Jun 2013 09:20:14 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201306240920.r5O9KEKM009528@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 24 Jun 2013 09:20:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252148 - stable/9/sys/dev/sound/pci/hda X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 09:20:15 -0000 Author: glebius Date: Mon Jun 24 09:20:14 2013 New Revision: 252148 URL: http://svnweb.freebsd.org/changeset/base/252148 Log: Merge r247911,r248187,r248254,r250797: Various quirks to enable headphones redirection on various Lenovo laptops: X220, X1, X1 Carbon, T420, T430, T430S, T520. Modified: stable/9/sys/dev/sound/pci/hda/hdaa_patches.c stable/9/sys/dev/sound/pci/hda/hdac.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/sound/pci/hda/hdaa_patches.c ============================================================================== --- stable/9/sys/dev/sound/pci/hda/hdaa_patches.c Mon Jun 24 09:18:41 2013 (r252147) +++ stable/9/sys/dev/sound/pci/hda/hdaa_patches.c Mon Jun 24 09:20:14 2013 (r252148) @@ -334,11 +334,34 @@ hdac_pin_patch(struct hdaa_widget *w) break; } } else if (id == HDA_CODEC_CX20590 && - subid == LENOVO_X220_SUBVENDOR) { + (subid == LENOVO_X1_SUBVENDOR || + subid == LENOVO_X220_SUBVENDOR || + subid == LENOVO_T420_SUBVENDOR || + subid == LENOVO_T520_SUBVENDOR)) { switch (nid) { case 25: patch = "as=1 seq=15"; break; + /* + * Group onboard mic and headphone mic + * together. Fixes onboard mic. + */ + case 27: + patch = "as=2 seq=15"; + break; + case 35: + patch = "as=2"; + break; + } + } else if (id == HDA_CODEC_ALC269 && + (subid == LENOVO_X1CRBN_SUBVENDOR || + subid == LENOVO_T430_SUBVENDOR || + subid == LENOVO_T430S_SUBVENDOR || + subid == LENOVO_T530_SUBVENDOR)) { + switch (nid) { + case 21: + patch = "as=1 seq=15"; + break; } } Modified: stable/9/sys/dev/sound/pci/hda/hdac.h ============================================================================== --- stable/9/sys/dev/sound/pci/hda/hdac.h Mon Jun 24 09:18:41 2013 (r252147) +++ stable/9/sys/dev/sound/pci/hda/hdac.h Mon Jun 24 09:20:14 2013 (r252148) @@ -220,8 +220,15 @@ #define LENOVO_3KN200_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x384e) #define LENOVO_B450_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x3a0d) #define LENOVO_TCA55_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x1015) +#define LENOVO_X1_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21e8) +#define LENOVO_X1CRBN_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f9) #define LENOVO_X220_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21da) #define LENOVO_X300_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x20ac) +#define LENOVO_T420_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21ce) +#define LENOVO_T430_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f3) +#define LENOVO_T430S_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21fb) +#define LENOVO_T520_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21cf) +#define LENOVO_T530_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0x21f6) #define LENOVO_ALL_SUBVENDOR HDA_MODEL_CONSTRUCT(LENOVO, 0xffff) /* Samsung */ From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 09:21:56 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 779D4C94; Mon, 24 Jun 2013 09:21:56 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6A593187D; Mon, 24 Jun 2013 09:21:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5O9LuAE011316; Mon, 24 Jun 2013 09:21:56 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5O9Lulg011315; Mon, 24 Jun 2013 09:21:56 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201306240921.r5O9Lulg011315@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 24 Jun 2013 09:21:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252149 - stable/9/sys/net X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 09:21:56 -0000 Author: glebius Date: Mon Jun 24 09:21:55 2013 New Revision: 252149 URL: http://svnweb.freebsd.org/changeset/base/252149 Log: Merge r248155: Reinitialize eh after pfil(9) processing. PR: 176764 Submitted by: adri Modified: stable/9/sys/net/if_bridge.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/net/ (props changed) Modified: stable/9/sys/net/if_bridge.c ============================================================================== --- stable/9/sys/net/if_bridge.c Mon Jun 24 09:20:14 2013 (r252148) +++ stable/9/sys/net/if_bridge.c Mon Jun 24 09:21:55 2013 (r252149) @@ -2318,6 +2318,7 @@ bridge_input(struct ifnet *ifp, struct m BRIDGE_UNLOCK(sc); \ return (NULL); \ } \ + eh = mtod(m, struct ether_header *); \ } \ } \ if (bif->bif_flags & IFBIF_LEARNING) { \ From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 09:23:25 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 522BEE15; Mon, 24 Jun 2013 09:23:25 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2BA54188E; Mon, 24 Jun 2013 09:23:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5O9NPgI011563; Mon, 24 Jun 2013 09:23:25 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5O9NPRL011562; Mon, 24 Jun 2013 09:23:25 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201306240923.r5O9NPRL011562@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 24 Jun 2013 09:23:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252150 - stable/9/sys/netinet/libalias X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 09:23:25 -0000 Author: glebius Date: Mon Jun 24 09:23:24 2013 New Revision: 252150 URL: http://svnweb.freebsd.org/changeset/base/252150 Log: Merge r248158: Remove LIBALIAS_LOCK_ASSERT(), including a couple with an uninitialzed argument, in code that isn't compiled in kernel. PR: kern/176667 Sponsored by: Nginx, Inc. Modified: stable/9/sys/netinet/libalias/alias_db.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/libalias/alias_db.c ============================================================================== --- stable/9/sys/netinet/libalias/alias_db.c Mon Jun 24 09:21:55 2013 (r252149) +++ stable/9/sys/netinet/libalias/alias_db.c Mon Jun 24 09:23:24 2013 (r252150) @@ -2729,7 +2729,6 @@ static void InitPunchFW(struct libalias *la) { - LIBALIAS_LOCK_ASSERT(la); la->fireWallField = malloc(la->fireWallNumNums); if (la->fireWallField) { memset(la->fireWallField, 0, la->fireWallNumNums); @@ -2745,7 +2744,6 @@ static void UninitPunchFW(struct libalias *la) { - LIBALIAS_LOCK_ASSERT(la); ClearAllFWHoles(la); if (la->fireWallFD >= 0) close(la->fireWallFD); @@ -2765,7 +2763,6 @@ PunchFWHole(struct alias_link *lnk) struct ip_fw rule; /* On-the-fly built rule */ int fwhole; /* Where to punch hole */ - LIBALIAS_LOCK_ASSERT(la); la = lnk->la; /* Don't do anything unless we are asked to */ @@ -2839,7 +2836,6 @@ ClearFWHole(struct alias_link *lnk) { struct libalias *la; - LIBALIAS_LOCK_ASSERT(la); la = lnk->la; if (lnk->link_type == LINK_TCP) { int fwhole = lnk->data.tcp->fwhole; /* Where is the firewall @@ -2864,7 +2860,6 @@ ClearAllFWHoles(struct libalias *la) struct ip_fw rule; /* On-the-fly built rule */ int i; - LIBALIAS_LOCK_ASSERT(la); if (la->fireWallFD < 0) return; @@ -2878,7 +2873,7 @@ ClearAllFWHoles(struct libalias *la) memset(la->fireWallField, 0, la->fireWallNumNums); } -#endif +#endif /* !NO_FW_PUNCH */ void LibAliasSetFWBase(struct libalias *la, unsigned int base, unsigned int num) From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 09:25:39 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 49C7DFB0; Mon, 24 Jun 2013 09:25:39 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3C70918A9; Mon, 24 Jun 2013 09:25:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5O9Pd45011866; Mon, 24 Jun 2013 09:25:39 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5O9Pdab011865; Mon, 24 Jun 2013 09:25:39 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201306240925.r5O9Pdab011865@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 24 Jun 2013 09:25:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252151 - stable/9/lib/libnetgraph X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 09:25:39 -0000 Author: glebius Date: Mon Jun 24 09:25:38 2013 New Revision: 252151 URL: http://svnweb.freebsd.org/changeset/base/252151 Log: Merge r248159: Fix for quite a special case when userland emulates a netgraph node, and userland can reply to a message with NGM_HASREPLY bit set. In this case we should not wait for a response to a responce. PR: 176771 Submitted by: Keith Reynolds Modified: stable/9/lib/libnetgraph/msg.c Directory Properties: stable/9/lib/libnetgraph/ (props changed) Modified: stable/9/lib/libnetgraph/msg.c ============================================================================== --- stable/9/lib/libnetgraph/msg.c Mon Jun 24 09:23:24 2013 (r252150) +++ stable/9/lib/libnetgraph/msg.c Mon Jun 24 09:25:38 2013 (r252151) @@ -234,7 +234,7 @@ NgDeliverMsg(int cs, const char *path, } /* Wait for reply if there should be one. */ - if (msg->header.cmd & NGM_HASREPLY) { + if (msg->header.cmd & NGM_HASREPLY && !(msg->header.flags & NGF_RESP)) { struct pollfd rfds; int n; From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 09:26:55 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id F158B1C7; Mon, 24 Jun 2013 09:26:54 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C98DC18BB; Mon, 24 Jun 2013 09:26:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5O9Qsnm012038; Mon, 24 Jun 2013 09:26:54 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5O9Qssq012037; Mon, 24 Jun 2013 09:26:54 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201306240926.r5O9Qssq012037@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 24 Jun 2013 09:26:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252152 - stable/9/usr.bin/ee/nls/ru_RU.KOI8-R X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 09:26:55 -0000 Author: glebius Date: Mon Jun 24 09:26:54 2013 New Revision: 252152 URL: http://svnweb.freebsd.org/changeset/base/252152 Log: Merge r248160: Fix spelling. PR: 176777 Submitted by: Andrey Simonenko Modified: stable/9/usr.bin/ee/nls/ru_RU.KOI8-R/ee.msg Directory Properties: stable/9/usr.bin/ee/ (props changed) Modified: stable/9/usr.bin/ee/nls/ru_RU.KOI8-R/ee.msg ============================================================================== Binary file (source and/or target). No diff available. From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 09:33:22 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 43EED3E3; Mon, 24 Jun 2013 09:33:22 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 363F71912; Mon, 24 Jun 2013 09:33:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5O9XMGr014436; Mon, 24 Jun 2013 09:33:22 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5O9XLxV014432; Mon, 24 Jun 2013 09:33:21 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201306240933.r5O9XLxV014432@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 24 Jun 2013 09:33:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252153 - in stable/9: . share/man/man4 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 09:33:22 -0000 Author: glebius Date: Mon Jun 24 09:33:21 2013 New Revision: 252153 URL: http://svnweb.freebsd.org/changeset/base/252153 Log: Merge r248370: Belatedly remove the vinum(4) manual page. The vinum manager is absent in FreeBSD since 6.0-RELEASE. Reviewed by: joel Deleted: stable/9/share/man/man4/vinum.4 Modified: stable/9/ObsoleteFiles.inc (contents, props changed) stable/9/share/man/man4/Makefile Directory Properties: stable/9/ (props changed) stable/9/share/ (props changed) stable/9/share/man/ (props changed) stable/9/share/man/man4/ (props changed) Modified: stable/9/ObsoleteFiles.inc ============================================================================== --- stable/9/ObsoleteFiles.inc Mon Jun 24 09:26:54 2013 (r252152) +++ stable/9/ObsoleteFiles.inc Mon Jun 24 09:33:21 2013 (r252153) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20130624: vinum.4 removed +OLD_FILES+=usr/share/man/man4/vinum.4.gz # 20130415: Ports are no more available via cvsup OLD_FILES+=usr/share/examples/cvsup/ports-supfile OLD_FILES+=usr/share/examples/cvsup/refuse Modified: stable/9/share/man/man4/Makefile ============================================================================== --- stable/9/share/man/man4/Makefile Mon Jun 24 09:26:54 2013 (r252152) +++ stable/9/share/man/man4/Makefile Mon Jun 24 09:33:21 2013 (r252153) @@ -509,7 +509,6 @@ MAN= aac.4 \ vge.4 \ viapm.4 \ ${_viawd.4} \ - vinum.4 \ ${_virtio.4} \ ${_virtio_balloon.4} \ ${_virtio_blk.4} \ From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 09:35:15 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7F186568; Mon, 24 Jun 2013 09:35:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 714BB1922; Mon, 24 Jun 2013 09:35:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5O9ZFt3014699; Mon, 24 Jun 2013 09:35:15 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5O9ZFE1014698; Mon, 24 Jun 2013 09:35:15 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201306240935.r5O9ZFE1014698@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 24 Jun 2013 09:35:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252154 - stable/9/lib/libc/sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 09:35:15 -0000 Author: glebius Date: Mon Jun 24 09:35:14 2013 New Revision: 252154 URL: http://svnweb.freebsd.org/changeset/base/252154 Log: Merge r248489: There are actually two different cases when mlock(2) returns ENOMEM. Clarify this, taking text from SUS. Reviewed by: kib Modified: stable/9/lib/libc/sys/mlock.2 Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/sys/ (props changed) Modified: stable/9/lib/libc/sys/mlock.2 ============================================================================== --- stable/9/lib/libc/sys/mlock.2 Mon Jun 24 09:33:21 2013 (r252153) +++ stable/9/lib/libc/sys/mlock.2 Mon Jun 24 09:35:14 2013 (r252154) @@ -28,7 +28,7 @@ .\" @(#)mlock.2 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd December 25, 2012 +.Dd March 18, 2013 .Dt MLOCK 2 .Os .Sh NAME @@ -138,7 +138,12 @@ is set to 0 and the caller is not the su .It Bq Er EINVAL The address given is not page aligned or the length is negative. .It Bq Er ENOMEM -Some portion of the indicated address range is not allocated. +Some or all of the address range specified by the addr and len +arguments does not correspond to valid mapped pages in the address space +of the process. +.It Bq Er ENOMEM +Locking the pages mapped by the specified range would exceed a limit on +the amount of memory that the process may lock. .El .Sh "SEE ALSO" .Xr fork 2 , From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 09:36:56 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E2C186EB; Mon, 24 Jun 2013 09:36:56 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D54A11930; Mon, 24 Jun 2013 09:36:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5O9auQ4014917; Mon, 24 Jun 2013 09:36:56 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5O9auhR014916; Mon, 24 Jun 2013 09:36:56 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201306240936.r5O9auhR014916@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 24 Jun 2013 09:36:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252155 - stable/9/share/man/man4 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 09:36:57 -0000 Author: glebius Date: Mon Jun 24 09:36:56 2013 New Revision: 252155 URL: http://svnweb.freebsd.org/changeset/base/252155 Log: Merge r248507: iwn(4) doesn't support adhoc mode. PR: misc/177106 Submitted by: Hiren Panchasara Modified: stable/9/share/man/man4/iwn.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/iwn.4 ============================================================================== --- stable/9/share/man/man4/iwn.4 Mon Jun 24 09:35:14 2013 (r252154) +++ stable/9/share/man/man4/iwn.4 Mon Jun 24 09:36:56 2013 (r252155) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 27, 2012 +.Dd March 19, 2013 .Dt IWN 4 .Os .Sh NAME @@ -100,8 +100,7 @@ driver provides support for: .Pp .Nm supports -.Cm station , -.Cm adhoc , +.Cm station and .Cm monitor mode operation. From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 09:39:07 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9690A9EC; Mon, 24 Jun 2013 09:39:07 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 787AE1941; Mon, 24 Jun 2013 09:39:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5O9d71m015217; Mon, 24 Jun 2013 09:39:07 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5O9d6tB015213; Mon, 24 Jun 2013 09:39:06 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201306240939.r5O9d6tB015213@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 24 Jun 2013 09:39:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252156 - in stable/9: share/man/man4 sys/netgraph X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 09:39:07 -0000 Author: glebius Date: Mon Jun 24 09:39:06 2013 New Revision: 252156 URL: http://svnweb.freebsd.org/changeset/base/252156 Log: Merge r248570, 248582: Add NGM_NAT_LIBALIAS_INFO command, that reports internal stats of libalias instance. To be used in the mpd5 daemon. Submitted by: Dmitry Luhtionov Modified: stable/9/share/man/man4/ng_nat.4 stable/9/sys/netgraph/ng_nat.c stable/9/sys/netgraph/ng_nat.h Directory Properties: stable/9/share/man/man4/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/share/man/man4/ng_nat.4 ============================================================================== --- stable/9/share/man/man4/ng_nat.4 Mon Jun 24 09:36:56 2013 (r252155) +++ stable/9/share/man/man4/ng_nat.4 Mon Jun 24 09:39:06 2013 (r252156) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 1, 2008 +.Dd March 21, 2013 .Dt NG_NAT 4 .Os .Sh NAME @@ -239,6 +239,31 @@ supplied as argument). See .Xr libalias 3 for details. +.It Dv NGM_NAT_LIBALIAS_INFO Pq Ic libaliasinfo +Return internal statistics of +.Xr libalias 3 +instance as +.Vt "struct ng_nat_libalias_info" . +.Bd -literal +struct ng_nat_libalias_info { + uint32_t icmpLinkCount; + uint32_t udpLinkCount; + uint32_t tcpLinkCount; + uint32_t sctpLinkCount; + uint32_t pptpLinkCount; + uint32_t protoLinkCount; + uint32_t fragmentIdLinkCount; + uint32_t fragmentPtrLinkCount; + uint32_t sockCount; +}; +.Ed +In case of +.Nm +failed to retreive a certain counter +from its +.Xr libalias +instance, the corresponding field is returned as +.Va UINT32_MAX . .El .Pp In all redirection messages Modified: stable/9/sys/netgraph/ng_nat.c ============================================================================== --- stable/9/sys/netgraph/ng_nat.c Mon Jun 24 09:36:56 2013 (r252155) +++ stable/9/sys/netgraph/ng_nat.c Mon Jun 24 09:39:06 2013 (r252156) @@ -145,6 +145,14 @@ static const struct ng_parse_type ng_nat &ng_nat_list_redirects_fields }; +/* Parse type for struct ng_nat_libalias_info. */ +static const struct ng_parse_struct_field ng_nat_libalias_info_fields[] + = NG_NAT_LIBALIAS_INFO; +static const struct ng_parse_type ng_nat_libalias_info_type = { + &ng_parse_struct_type, + &ng_nat_libalias_info_fields +}; + /* List of commands and how to convert arguments to/from ASCII. */ static const struct ng_cmdlist ng_nat_cmdlist[] = { { @@ -224,6 +232,13 @@ static const struct ng_cmdlist ng_nat_cm &ng_parse_string_type, NULL }, + { + NGM_NAT_COOKIE, + NGM_NAT_LIBALIAS_INFO, + "libaliasinfo", + NULL, + &ng_nat_libalias_info_type + }, { 0 } }; @@ -647,6 +662,36 @@ ng_nat_rcvmsg(node_p node, item_p item, error = ENOMEM; } break; + case NGM_NAT_LIBALIAS_INFO: + { + struct ng_nat_libalias_info *i; + + NG_MKRESPONSE(resp, msg, + sizeof(struct ng_nat_libalias_info), M_NOWAIT); + if (resp == NULL) { + error = ENOMEM; + break; + } + i = (struct ng_nat_libalias_info *)resp->data; +#define COPY(F) do { \ + if (priv->lib->F >= 0 && priv->lib->F < UINT32_MAX) \ + i->F = priv->lib->F; \ + else \ + i->F = UINT32_MAX; \ +} while (0) + + COPY(icmpLinkCount); + COPY(udpLinkCount); + COPY(tcpLinkCount); + COPY(pptpLinkCount); + COPY(sctpLinkCount); + COPY(protoLinkCount); + COPY(fragmentIdLinkCount); + COPY(fragmentPtrLinkCount); + COPY(sockCount); +#undef COPY + } + break; default: error = EINVAL; /* unknown command */ break; Modified: stable/9/sys/netgraph/ng_nat.h ============================================================================== --- stable/9/sys/netgraph/ng_nat.h Mon Jun 24 09:36:56 2013 (r252155) +++ stable/9/sys/netgraph/ng_nat.h Mon Jun 24 09:39:06 2013 (r252156) @@ -172,6 +172,33 @@ struct ng_nat_list_redirects { { NULL } \ } +/* Structure returned by NGM_NAT_LIBALIAS_INFO */ +struct ng_nat_libalias_info { + uint32_t icmpLinkCount; + uint32_t udpLinkCount; + uint32_t tcpLinkCount; + uint32_t sctpLinkCount; + uint32_t pptpLinkCount; + uint32_t protoLinkCount; + uint32_t fragmentIdLinkCount; + uint32_t fragmentPtrLinkCount; + uint32_t sockCount; +}; + +/* Keep this in sync with the above structure definition */ +#define NG_NAT_LIBALIAS_INFO { \ + { "icmpLinkCount", &ng_parse_uint32_type }, \ + { "udpLinkCount", &ng_parse_uint32_type }, \ + { "tcpLinkCount", &ng_parse_uint32_type }, \ + { "sctpLinkCount", &ng_parse_uint32_type }, \ + { "pptpLinkCount", &ng_parse_uint32_type }, \ + { "protoLinkCount", &ng_parse_uint32_type }, \ + { "fragmentIdLinkCount", &ng_parse_uint32_type }, \ + { "fragmentPtrLinkCount", &ng_parse_uint32_type }, \ + { "sockCount", &ng_parse_uint32_type }, \ + { NULL } \ +} + enum { NGM_NAT_SET_IPADDR = 1, NGM_NAT_SET_MODE, @@ -184,4 +211,5 @@ enum { NGM_NAT_ADD_SERVER, NGM_NAT_LIST_REDIRECTS, NGM_NAT_PROXY_RULE, + NGM_NAT_LIBALIAS_INFO, }; From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 09:53:43 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id CCD2ED20; Mon, 24 Jun 2013 09:53:43 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A352919B4; Mon, 24 Jun 2013 09:53:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5O9rh4p020003; Mon, 24 Jun 2013 09:53:43 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5O9rh2A020002; Mon, 24 Jun 2013 09:53:43 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201306240953.r5O9rh2A020002@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 24 Jun 2013 09:53:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252157 - stable/9/contrib/bsnmp/snmp_mibII X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 09:53:43 -0000 Author: glebius Date: Mon Jun 24 09:53:43 2013 New Revision: 252157 URL: http://svnweb.freebsd.org/changeset/base/252157 Log: Merge r249896: Restore the ipNetToMedia MIB, that was broken with new ARP commit in the r186119. Submitted by: Konstantin Kukushkin Modified: stable/9/contrib/bsnmp/snmp_mibII/mibII.c Directory Properties: stable/9/contrib/bsnmp/snmp_mibII/ (props changed) Modified: stable/9/contrib/bsnmp/snmp_mibII/mibII.c ============================================================================== --- stable/9/contrib/bsnmp/snmp_mibII/mibII.c Mon Jun 24 09:39:06 2013 (r252156) +++ stable/9/contrib/bsnmp/snmp_mibII/mibII.c Mon Jun 24 09:53:43 2013 (r252157) @@ -934,6 +934,34 @@ mib_find_ifa(struct in_addr addr) } /* + * Process a new ARP entry + */ +static void +process_arp(const struct rt_msghdr *rtm, const struct sockaddr_dl *sdl, + const struct sockaddr_in *sa) +{ + struct mibif *ifp; + struct mibarp *at; + + /* IP arp table entry */ + if (sdl->sdl_alen == 0) + return; + if ((ifp = mib_find_if_sys(sdl->sdl_index)) == NULL) + return; + /* have a valid entry */ + if ((at = mib_find_arp(ifp, sa->sin_addr)) == NULL && + (at = mib_arp_create(ifp, sa->sin_addr, + sdl->sdl_data + sdl->sdl_nlen, sdl->sdl_alen)) == NULL) + return; + + if (rtm->rtm_rmx.rmx_expire == 0) + at->flags |= MIBARP_PERM; + else + at->flags &= ~MIBARP_PERM; + at->flags |= MIBARP_FOUND; +} + +/* * Handle a routing socket message. */ static void @@ -1075,6 +1103,23 @@ handle_rtmsg(struct rt_msghdr *rtm) #endif case RTM_GET: case RTM_ADD: + mib_extract_addrs(rtm->rtm_addrs, (u_char *)(rtm + 1), addrs); + if (rtm->rtm_flags & RTF_LLINFO) { + if (addrs[RTAX_DST] == NULL || + addrs[RTAX_GATEWAY] == NULL || + addrs[RTAX_DST]->sa_family != AF_INET || + addrs[RTAX_GATEWAY]->sa_family != AF_LINK) + break; + process_arp(rtm, + (struct sockaddr_dl *)(void *)addrs[RTAX_GATEWAY], + (struct sockaddr_in *)(void *)addrs[RTAX_DST]); + } else { + if (rtm->rtm_errno == 0 && (rtm->rtm_flags & RTF_UP)) + mib_sroute_process(rtm, addrs[RTAX_GATEWAY], + addrs[RTAX_DST], addrs[RTAX_NETMASK]); + } + break; + case RTM_DELETE: mib_extract_addrs(rtm->rtm_addrs, (u_char *)(rtm + 1), addrs); From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 09:55:38 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5B5B3E95; Mon, 24 Jun 2013 09:55:38 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4D8C319BE; Mon, 24 Jun 2013 09:55:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5O9tbE5020316; Mon, 24 Jun 2013 09:55:37 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5O9tbF8020315; Mon, 24 Jun 2013 09:55:37 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201306240955.r5O9tbF8020315@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 24 Jun 2013 09:55:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252158 - stable/9/sbin/ifconfig X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 09:55:38 -0000 Author: glebius Date: Mon Jun 24 09:55:37 2013 New Revision: 252158 URL: http://svnweb.freebsd.org/changeset/base/252158 Log: Merge r249897: Don't free memory that is going to be used as error string. PR: bin/178121 Submitted by: Garrett Cooper Modified: stable/9/sbin/ifconfig/iflagg.c Directory Properties: stable/9/sbin/ifconfig/ (props changed) Modified: stable/9/sbin/ifconfig/iflagg.c ============================================================================== --- stable/9/sbin/ifconfig/iflagg.c Mon Jun 24 09:53:43 2013 (r252157) +++ stable/9/sbin/ifconfig/iflagg.c Mon Jun 24 09:55:37 2013 (r252158) @@ -98,10 +98,8 @@ setlagghash(const char *val, int d, int rf.rf_flags |= LAGG_F_HASHL3; else if (strcmp(tok, "l4") == 0) rf.rf_flags |= LAGG_F_HASHL4; - else { - free(str); + else errx(1, "Invalid lagghash option: %s", tok); - } } free(str); if (rf.rf_flags == 0) From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 09:57:42 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3FB05E3; Mon, 24 Jun 2013 09:57:42 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3213F19E0; Mon, 24 Jun 2013 09:57:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5O9vfqh020569; Mon, 24 Jun 2013 09:57:41 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5O9vfRS020568; Mon, 24 Jun 2013 09:57:41 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201306240957.r5O9vfRS020568@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 24 Jun 2013 09:57:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252159 - stable/9/sys/netpfil/ipfw X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 09:57:42 -0000 Author: glebius Date: Mon Jun 24 09:57:41 2013 New Revision: 252159 URL: http://svnweb.freebsd.org/changeset/base/252159 Log: Merge r250039: Remove useless ifdef KLD_MODULE from dummynet module unload path. This fixes panic on unload. Reported by: pho Modified: stable/9/sys/netpfil/ipfw/ip_dummynet.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netpfil/ipfw/ip_dummynet.c ============================================================================== --- stable/9/sys/netpfil/ipfw/ip_dummynet.c Mon Jun 24 09:55:37 2013 (r252158) +++ stable/9/sys/netpfil/ipfw/ip_dummynet.c Mon Jun 24 09:57:41 2013 (r252159) @@ -2169,7 +2169,6 @@ ip_dn_init(void) getmicrouptime(&dn_cfg.prev_t); } -#ifdef KLD_MODULE static void ip_dn_destroy(int last) { @@ -2193,7 +2192,6 @@ ip_dn_destroy(int last) DN_LOCK_DESTROY(); } -#endif /* KLD_MODULE */ static int dummynet_modevent(module_t mod, int type, void *data) @@ -2209,13 +2207,8 @@ dummynet_modevent(module_t mod, int type ip_dn_io_ptr = dummynet_io; return 0; } else if (type == MOD_UNLOAD) { -#if !defined(KLD_MODULE) - printf("dummynet statically compiled, cannot unload\n"); - return EINVAL ; -#else ip_dn_destroy(1 /* last */); return 0; -#endif } else return EOPNOTSUPP; } From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 15:35:47 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 85B63D78; Mon, 24 Jun 2013 15:35:47 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 740581E10; Mon, 24 Jun 2013 15:35:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5OFZl91039304; Mon, 24 Jun 2013 15:35:47 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5OFZho3039275; Mon, 24 Jun 2013 15:35:43 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306241535.r5OFZho3039275@svn.freebsd.org> From: Steven Hartland Date: Mon, 24 Jun 2013 15:35:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252162 - in stable/8: . cddl/lib/libzpool sys/cddl/compat/opensolaris/kern sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/u... X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 15:35:47 -0000 Author: smh Date: Mon Jun 24 15:35:42 2013 New Revision: 252162 URL: http://svnweb.freebsd.org/changeset/base/252162 Log: Added ZFS TRIM support which is enabled by default. To disable ZFS TRIM support set vfs.zfs.trim.enabled=0 in loader.conf. Creating new ZFS pools and adding new devices to existing pools first performs a full device level TRIM which can take a significant amount of time. The sysctl vfs.zfs.vdev.trim_on_init can be set to 0 to disable this behaviour. ZFS TRIM requires the underlying device support BIO_DELETE which is currently provided by methods such as ATA TRIM and SCSI UNMAP via CAM, which are typically supported by SSD's. Stats for ZFS TRIM can be monitored by looking at the sysctl's under kstat.zfs.misc.zio_trim. MFC r240868: Add TRIM support MFC r244155: Renamed zfs trim stats MFC r244187: Upgrade TRIM free request sizes optimisation MFC r244188: Added vfs.zfs.vdev.trim_on_init sysctl MFC r248572: Add TRIM support for L2ARC MFC r248573: Don't register repair writes in the trim map. MFC r248574: Improve TXG handling in the TRIM module MFC r248575: TRIM cache devices based on time instead of TXGs MFC r248576: Names the ZFS TRIM thread MFC r248577: Optimisation of TRIM processing MFC r248602: Fix for building libzpool under i386 MFC r249921: Enabled ZFS TRIM by default Added: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/trim_map.h - copied, changed from r240868, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/trim_map.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c - copied, changed from r240868, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Modified: stable/8/UPDATING stable/8/cddl/lib/libzpool/Makefile stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c stable/8/sys/cddl/compat/opensolaris/sys/dkio.h stable/8/sys/cddl/compat/opensolaris/sys/kstat.h stable/8/sys/cddl/compat/opensolaris/sys/time.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c stable/8/sys/modules/zfs/Makefile Directory Properties: stable/8/cddl/lib/ (props changed) stable/8/cddl/lib/libzpool/ (props changed) stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/modules/ (props changed) Modified: stable/8/UPDATING ============================================================================== --- stable/8/UPDATING Mon Jun 24 13:36:16 2013 (r252161) +++ stable/8/UPDATING Mon Jun 24 15:35:42 2013 (r252162) @@ -15,6 +15,22 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. debugging tools present in HEAD were left in place because sun4v support still needs work to become production ready. +20130624: + Added ZFS TRIM support which is enabled by default. To disable + ZFS TRIM support set vfs.zfs.trim.enabled=0 in loader.conf. + + Creating new ZFS pools and adding new devices to existing pools + first performs a full device level TRIM, which can take a significant + amount of time. Set the sysctl vfs.zfs.vdev.trim_on_init to 0 to + disable this behaviour. + + ZFS TRIM requires the underlying device support BIO_DELETE which + is currently provided by methods such as ATA TRIM and SCSI UNMAP + via CAM, which are typically supported by SSD's. + + Stats for ZFS TRIM can be monitored by looking at the sysctl's + under kstat.zfs.misc.zio_trim. + 20130607: 8.4-RELEASE. Modified: stable/8/cddl/lib/libzpool/Makefile ============================================================================== --- stable/8/cddl/lib/libzpool/Makefile Mon Jun 24 13:36:16 2013 (r252161) +++ stable/8/cddl/lib/libzpool/Makefile Mon Jun 24 15:35:42 2013 (r252162) @@ -26,7 +26,7 @@ ATOMIC_SRCS= opensolaris_atomic.c LIB= zpool -ZFS_COMMON_SRCS= ${ZFS_COMMON_OBJS:C/.o$/.c/} vdev_file.c +ZFS_COMMON_SRCS= ${ZFS_COMMON_OBJS:C/.o$/.c/} vdev_file.c trim_map.c ZFS_SHARED_SRCS= ${ZFS_SHARED_OBJS:C/.o$/.c/} KERNEL_SRCS= kernel.c taskq.c util.c LIST_SRCS= list.c Modified: stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c ============================================================================== --- stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c Mon Jun 24 13:36:16 2013 (r252161) +++ stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c Mon Jun 24 15:35:42 2013 (r252162) @@ -118,7 +118,7 @@ kstat_install(kstat_t *ksp) SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx, SYSCTL_CHILDREN(ksp->ks_sysctl_root), OID_AUTO, ksent->name, CTLTYPE_QUAD | CTLFLAG_RD, ksent, sizeof(*ksent), - kstat_sysctl, "QU", ""); + kstat_sysctl, "QU", ksent->desc); } } Modified: stable/8/sys/cddl/compat/opensolaris/sys/dkio.h ============================================================================== --- stable/8/sys/cddl/compat/opensolaris/sys/dkio.h Mon Jun 24 13:36:16 2013 (r252161) +++ stable/8/sys/cddl/compat/opensolaris/sys/dkio.h Mon Jun 24 15:35:42 2013 (r252162) @@ -75,6 +75,8 @@ extern "C" { */ #define DKIOCFLUSHWRITECACHE (DKIOC|34) /* flush cache to phys medium */ +#define DKIOCTRIM (DKIOC|35) /* TRIM a block */ + struct dk_callback { void (*dkc_callback)(void *dkc_cookie, int error); void *dkc_cookie; Modified: stable/8/sys/cddl/compat/opensolaris/sys/kstat.h ============================================================================== --- stable/8/sys/cddl/compat/opensolaris/sys/kstat.h Mon Jun 24 13:36:16 2013 (r252161) +++ stable/8/sys/cddl/compat/opensolaris/sys/kstat.h Mon Jun 24 15:35:42 2013 (r252162) @@ -53,6 +53,8 @@ typedef struct kstat_named { #define KSTAT_DATA_INT64 3 #define KSTAT_DATA_UINT64 4 uchar_t data_type; +#define KSTAT_DESCLEN 128 + char desc[KSTAT_DESCLEN]; union { uint64_t ui64; } value; Modified: stable/8/sys/cddl/compat/opensolaris/sys/time.h ============================================================================== --- stable/8/sys/cddl/compat/opensolaris/sys/time.h Mon Jun 24 13:36:16 2013 (r252161) +++ stable/8/sys/cddl/compat/opensolaris/sys/time.h Mon Jun 24 15:35:42 2013 (r252162) @@ -35,6 +35,7 @@ #define MILLISEC 1000 #define MICROSEC 1000000 #define NANOSEC 1000000000 +#define TIME_MAX LLONG_MAX typedef longlong_t hrtime_t; Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Mon Jun 24 13:36:16 2013 (r252161) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Mon Jun 24 15:35:42 2013 (r252162) @@ -130,6 +130,7 @@ #endif #include #include +#include #include #include @@ -1691,6 +1692,8 @@ arc_hdr_destroy(arc_buf_hdr_t *hdr) } if (l2hdr != NULL) { + trim_map_free(l2hdr->b_dev->l2ad_vdev, l2hdr->b_daddr, + hdr->b_size, 0); list_remove(l2hdr->b_dev->l2ad_buflist, hdr); ARCSTAT_INCR(arcstat_l2_size, -hdr->b_size); kmem_free(l2hdr, sizeof (l2arc_buf_hdr_t)); @@ -3528,6 +3531,8 @@ arc_release(arc_buf_t *buf, void *tag) buf->b_private = NULL; if (l2hdr) { + trim_map_free(l2hdr->b_dev->l2ad_vdev, l2hdr->b_daddr, + hdr->b_size, 0); list_remove(l2hdr->b_dev->l2ad_buflist, hdr); kmem_free(l2hdr, sizeof (l2arc_buf_hdr_t)); ARCSTAT_INCR(arcstat_l2_size, -buf_size); @@ -4442,6 +4447,8 @@ l2arc_write_done(zio_t *zio) list_remove(buflist, ab); abl2 = ab->b_l2hdr; ab->b_l2hdr = NULL; + trim_map_free(abl2->b_dev->l2ad_vdev, abl2->b_daddr, + ab->b_size, 0); kmem_free(abl2, sizeof (l2arc_buf_hdr_t)); ARCSTAT_INCR(arcstat_l2_size, -ab->b_size); } Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Mon Jun 24 13:36:16 2013 (r252161) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Mon Jun 24 15:35:42 2013 (r252162) @@ -397,7 +397,8 @@ void dsl_free_sync(zio_t *pio, dsl_pool_t *dp, uint64_t txg, const blkptr_t *bpp) { ASSERT(dsl_pool_sync_context(dp)); - zio_nowait(zio_free_sync(pio, dp->dp_spa, txg, bpp, pio->io_flags)); + zio_nowait(zio_free_sync(pio, dp->dp_spa, txg, bpp, BP_GET_PSIZE(bpp), + pio->io_flags)); } static uint64_t @@ -1364,7 +1365,7 @@ dsl_scan_free_block_cb(void *arg, const } zio_nowait(zio_free_sync(scn->scn_zio_root, scn->scn_dp->dp_spa, - dmu_tx_get_txg(tx), bp, 0)); + dmu_tx_get_txg(tx), bp, BP_GET_PSIZE(bp), 0)); dsl_dir_diduse_space(tx->tx_pool->dp_free_dir, DD_USED_HEAD, -bp_get_dsize_sync(scn->scn_dp->dp_spa, bp), -BP_GET_PSIZE(bp), -BP_GET_UCSIZE(bp), tx); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon Jun 24 13:36:16 2013 (r252161) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon Jun 24 15:35:42 2013 (r252162) @@ -67,6 +67,7 @@ #include #include #include +#include #ifdef _KERNEL #include @@ -1001,6 +1002,11 @@ spa_activate(spa_t *spa, int mode) spa_create_zio_taskqs(spa); } + /* + * Start TRIM thread. + */ + trim_thread_create(spa); + list_create(&spa->spa_config_dirty_list, sizeof (vdev_t), offsetof(vdev_t, vdev_config_dirty_node)); list_create(&spa->spa_state_dirty_list, sizeof (vdev_t), @@ -1029,6 +1035,12 @@ spa_deactivate(spa_t *spa) ASSERT(spa->spa_async_zio_root == NULL); ASSERT(spa->spa_state != POOL_STATE_UNINITIALIZED); + /* + * Stop TRIM thread in case spa_unload() wasn't called directly + * before spa_deactivate(). + */ + trim_thread_destroy(spa); + txg_list_destroy(&spa->spa_vdev_txg_list); list_destroy(&spa->spa_config_dirty_list); @@ -1145,6 +1157,11 @@ spa_unload(spa_t *spa) ASSERT(MUTEX_HELD(&spa_namespace_lock)); /* + * Stop TRIM thread. + */ + trim_thread_destroy(spa); + + /* * Stop async tasks. */ spa_async_suspend(spa); @@ -5875,7 +5892,7 @@ spa_free_sync_cb(void *arg, const blkptr zio_t *zio = arg; zio_nowait(zio_free_sync(zio, zio->io_spa, dmu_tx_get_txg(tx), bp, - zio->io_flags)); + BP_GET_PSIZE(bp), zio->io_flags)); return (0); } Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Mon Jun 24 13:36:16 2013 (r252161) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Mon Jun 24 15:35:42 2013 (r252162) @@ -221,6 +221,9 @@ struct spa { spa_proc_state_t spa_proc_state; /* see definition */ struct proc *spa_proc; /* "zpool-poolname" process */ uint64_t spa_did; /* if procp != p0, did of t1 */ + kthread_t *spa_trim_thread; /* thread sending TRIM I/Os */ + kmutex_t spa_trim_lock; /* protects spa_trim_cv */ + kcondvar_t spa_trim_cv; /* used to notify TRIM thread */ boolean_t spa_autoreplace; /* autoreplace set in open */ int spa_vdev_locks; /* locks grabbed */ uint64_t spa_creation_version; /* version at pool creation */ Copied and modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/trim_map.h (from r240868, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/trim_map.h) ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/trim_map.h Sun Sep 23 19:40:58 2012 (r240868, copy source) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/trim_map.h Mon Jun 24 15:35:42 2013 (r252162) @@ -36,7 +36,7 @@ extern "C" { extern void trim_map_create(vdev_t *vd); extern void trim_map_destroy(vdev_t *vd); -extern void trim_map_free(zio_t *zio); +extern void trim_map_free(vdev_t *vd, uint64_t offset, uint64_t size, uint64_t txg); extern boolean_t trim_map_write_start(zio_t *zio); extern void trim_map_write_done(zio_t *zio); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h Mon Jun 24 13:36:16 2013 (r252161) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h Mon Jun 24 15:35:42 2013 (r252162) @@ -46,6 +46,7 @@ typedef enum vdev_dtl_type { } vdev_dtl_type_t; extern boolean_t zfs_nocacheflush; +extern boolean_t zfs_trim_enabled; extern int vdev_open(vdev_t *); extern void vdev_open_children(vdev_t *); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Mon Jun 24 13:36:16 2013 (r252161) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Mon Jun 24 15:35:42 2013 (r252162) @@ -183,6 +183,7 @@ struct vdev { uint64_t vdev_unspare; /* unspare when resilvering done */ hrtime_t vdev_last_try; /* last reopen time */ boolean_t vdev_nowritecache; /* true if flushwritecache failed */ + boolean_t vdev_notrim; /* true if trim failed */ boolean_t vdev_checkremove; /* temporary online test */ boolean_t vdev_forcefault; /* force online fault */ boolean_t vdev_splitting; /* split or repair in progress */ @@ -198,6 +199,7 @@ struct vdev { spa_aux_vdev_t *vdev_aux; /* for l2cache vdevs */ zio_t *vdev_probe_zio; /* root of current probe */ vdev_aux_t vdev_label_aux; /* on-disk aux state */ + struct trim_map *vdev_trimmap; /* * For DTrace to work in userland (libzpool) context, these fields must Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Mon Jun 24 13:36:16 2013 (r252161) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Mon Jun 24 15:35:42 2013 (r252162) @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -137,7 +138,8 @@ enum zio_compress { #define ZIO_PRIORITY_RESILVER (zio_priority_table[9]) #define ZIO_PRIORITY_SCRUB (zio_priority_table[10]) #define ZIO_PRIORITY_DDT_PREFETCH (zio_priority_table[11]) -#define ZIO_PRIORITY_TABLE_SIZE 12 +#define ZIO_PRIORITY_TRIM (zio_priority_table[12]) +#define ZIO_PRIORITY_TABLE_SIZE 13 #define ZIO_PIPELINE_CONTINUE 0x100 #define ZIO_PIPELINE_STOP 0x101 @@ -367,6 +369,39 @@ typedef struct zio_link { list_node_t zl_child_node; } zio_link_t; +/* + * Used for TRIM kstat. + */ +typedef struct zio_trim_stats { + /* + * Number of bytes successfully TRIMmed. + */ + kstat_named_t bytes; + + /* + * Number of successful TRIM requests. + */ + kstat_named_t success; + + /* + * Number of TRIM requests that failed because TRIM is not + * supported. + */ + kstat_named_t unsupported; + + /* + * Number of TRIM requests that failed for other reasons. + */ + kstat_named_t failed; +} zio_trim_stats_t; + +extern zio_trim_stats_t zio_trim_stats; + +#define ZIO_TRIM_STAT_INCR(stat, val) \ + atomic_add_64(&zio_trim_stats.stat.value.ui64, (val)); +#define ZIO_TRIM_STAT_BUMP(stat) \ + ZIO_TRIM_STAT_INCR(stat, 1); + struct zio { /* Core information about this I/O */ zbookmark_t io_bookmark; @@ -441,6 +476,8 @@ struct zio { /* FreeBSD only. */ struct ostask io_task; #endif + avl_node_t io_trim_node; + list_node_t io_trim_link; }; extern zio_t *zio_null(zio_t *pio, spa_t *spa, vdev_t *vd, @@ -472,8 +509,8 @@ extern zio_t *zio_claim(zio_t *pio, spa_ zio_done_func_t *done, void *priv, enum zio_flag flags); extern zio_t *zio_ioctl(zio_t *pio, spa_t *spa, vdev_t *vd, int cmd, - zio_done_func_t *done, void *priv, int priority, - enum zio_flag flags); + uint64_t offset, uint64_t size, zio_done_func_t *done, void *priv, + int priority, enum zio_flag flags); extern zio_t *zio_read_phys(zio_t *pio, vdev_t *vd, uint64_t offset, uint64_t size, void *data, int checksum, @@ -486,12 +523,14 @@ extern zio_t *zio_write_phys(zio_t *pio, boolean_t labels); extern zio_t *zio_free_sync(zio_t *pio, spa_t *spa, uint64_t txg, - const blkptr_t *bp, enum zio_flag flags); + const blkptr_t *bp, uint64_t size, enum zio_flag flags); extern int zio_alloc_zil(spa_t *spa, uint64_t txg, blkptr_t *new_bp, blkptr_t *old_bp, uint64_t size, boolean_t use_slog); extern void zio_free_zil(spa_t *spa, uint64_t txg, blkptr_t *bp); extern void zio_flush(zio_t *zio, vdev_t *vd); +extern zio_t *zio_trim(zio_t *zio, spa_t *spa, vdev_t *vd, uint64_t offset, + uint64_t size); extern void zio_shrink(zio_t *zio, uint64_t size); extern int zio_wait(zio_t *zio); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h Mon Jun 24 13:36:16 2013 (r252161) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h Mon Jun 24 15:35:42 2013 (r252162) @@ -130,9 +130,9 @@ enum zio_stage { ZIO_STAGE_READY = 1 << 16, /* RWFCI */ - ZIO_STAGE_VDEV_IO_START = 1 << 17, /* RW--I */ - ZIO_STAGE_VDEV_IO_DONE = 1 << 18, /* RW--- */ - ZIO_STAGE_VDEV_IO_ASSESS = 1 << 19, /* RW--I */ + ZIO_STAGE_VDEV_IO_START = 1 << 17, /* RWF-I */ + ZIO_STAGE_VDEV_IO_DONE = 1 << 18, /* RWF-- */ + ZIO_STAGE_VDEV_IO_ASSESS = 1 << 19, /* RWF-I */ ZIO_STAGE_CHECKSUM_VERIFY = 1 << 20, /* R---- */ @@ -214,7 +214,9 @@ enum zio_stage { (ZIO_INTERLOCK_STAGES | \ ZIO_STAGE_FREE_BP_INIT | \ ZIO_STAGE_ISSUE_ASYNC | \ - ZIO_STAGE_DVA_FREE) + ZIO_STAGE_DVA_FREE | \ + ZIO_STAGE_VDEV_IO_START | \ + ZIO_STAGE_VDEV_IO_ASSESS) #define ZIO_DDT_FREE_PIPELINE \ (ZIO_INTERLOCK_STAGES | \ Copied and modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c (from r240868, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c) ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Sun Sep 23 19:40:58 2012 (r240868, copy source) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c Mon Jun 24 15:35:42 2013 (r252162) @@ -27,6 +27,30 @@ #include #include #include +#include + +/* + * Calculate the zio end, upgrading based on ashift which would be + * done by zio_vdev_io_start. + * + * This makes free range consolidation much more effective + * than it would otherwise be as well as ensuring that entire + * blocks are invalidated by writes. + */ +#define TRIM_ZIO_END(vd, offset, size) (offset + \ + P2ROUNDUP(size, 1ULL << vd->vdev_top->vdev_ashift)) + +#define TRIM_MAP_SINC(tm, size) \ + atomic_add_64(&(tm)->tm_bytes, (size)) + +#define TRIM_MAP_SDEC(tm, size) \ + atomic_add_64(&(tm)->tm_bytes, -(size)) + +#define TRIM_MAP_QINC(tm) \ + atomic_inc_64(&(tm)->tm_pending); \ + +#define TRIM_MAP_QDEC(tm) \ + atomic_dec_64(&(tm)->tm_pending); typedef struct trim_map { list_t tm_head; /* List of segments sorted by txg. */ @@ -35,6 +59,8 @@ typedef struct trim_map { avl_tree_t tm_inflight_writes; /* AVL tree of in-flight writes. */ list_t tm_pending_writes; /* Writes blocked on in-flight frees. */ kmutex_t tm_lock; + uint64_t tm_pending; /* Count of pending TRIMs. */ + uint64_t tm_bytes; /* Total size in bytes of queued TRIMs. */ } trim_map_t; typedef struct trim_seg { @@ -43,16 +69,46 @@ typedef struct trim_seg { uint64_t ts_start; /* Starting offset of this segment. */ uint64_t ts_end; /* Ending offset (non-inclusive). */ uint64_t ts_txg; /* Segment creation txg. */ + hrtime_t ts_time; /* Segment creation time. */ } trim_seg_t; -extern boolean_t zfs_notrim; +extern boolean_t zfs_trim_enabled; + +static u_int trim_txg_delay = 32; +static u_int trim_timeout = 30; +static u_int trim_max_interval = 1; +/* Limit outstanding TRIMs to 2G (max size for a single TRIM request) */ +static uint64_t trim_vdev_max_bytes = 2147483648; +/* Limit outstanding TRIMs to 64 (max ranges for a single TRIM request) */ +static u_int trim_vdev_max_pending = 64; SYSCTL_DECL(_vfs_zfs); -/* Delay TRIMs by that many TXGs. */ -static int trim_txg_limit = 64; -TUNABLE_INT("vfs.zfs.trim_txg_limit", &trim_txg_limit); -SYSCTL_INT(_vfs_zfs, OID_AUTO, trim_txg_limit, CTLFLAG_RW, &trim_txg_limit, 0, - "Delay TRIMs by that many TXGs."); +SYSCTL_NODE(_vfs_zfs, OID_AUTO, trim, CTLFLAG_RD, 0, "ZFS TRIM"); + +TUNABLE_INT("vfs.zfs.trim.txg_delay", &trim_txg_delay); +SYSCTL_UINT(_vfs_zfs_trim, OID_AUTO, txg_delay, CTLFLAG_RWTUN, &trim_txg_delay, + 0, "Delay TRIMs by up to this many TXGs"); + +TUNABLE_INT("vfs.zfs.trim.timeout", &trim_timeout); +SYSCTL_UINT(_vfs_zfs_trim, OID_AUTO, timeout, CTLFLAG_RWTUN, &trim_timeout, 0, + "Delay TRIMs by up to this many seconds"); + +TUNABLE_INT("vfs.zfs.trim.max_interval", &trim_max_interval); +SYSCTL_UINT(_vfs_zfs_trim, OID_AUTO, max_interval, CTLFLAG_RWTUN, + &trim_max_interval, 0, + "Maximum interval between TRIM queue processing (seconds)"); + +SYSCTL_DECL(_vfs_zfs_vdev); +TUNABLE_QUAD("vfs.zfs.vdev.trim_max_bytes", &trim_vdev_max_bytes); +SYSCTL_QUAD(_vfs_zfs_vdev, OID_AUTO, trim_max_bytes, CTLFLAG_RWTUN, + &trim_vdev_max_bytes, 0, + "Maximum pending TRIM bytes for a vdev"); + +TUNABLE_INT("vfs.zfs.vdev.trim_max_pending", &trim_vdev_max_pending); +SYSCTL_UINT(_vfs_zfs_vdev, OID_AUTO, trim_max_pending, CTLFLAG_RWTUN, + &trim_vdev_max_pending, 0, + "Maximum pending TRIM segments for a vdev"); + static void trim_map_vdev_commit_done(spa_t *spa, vdev_t *vd); @@ -101,7 +157,7 @@ trim_map_create(vdev_t *vd) ASSERT(vd->vdev_ops->vdev_op_leaf); - if (zfs_notrim) + if (!zfs_trim_enabled) return; tm = kmem_zalloc(sizeof (*tm), KM_SLEEP); @@ -127,7 +183,7 @@ trim_map_destroy(vdev_t *vd) ASSERT(vd->vdev_ops->vdev_op_leaf); - if (zfs_notrim) + if (!zfs_trim_enabled) return; tm = vd->vdev_trimmap; @@ -146,6 +202,8 @@ trim_map_destroy(vdev_t *vd) avl_remove(&tm->tm_queued_frees, ts); list_remove(&tm->tm_head, ts); kmem_free(ts, sizeof (*ts)); + TRIM_MAP_SDEC(tm, ts->ts_end - ts->ts_start); + TRIM_MAP_QDEC(tm); } mutex_exit(&tm->tm_lock); @@ -165,10 +223,12 @@ trim_map_segment_add(trim_map_t *tm, uin avl_index_t where; trim_seg_t tsearch, *ts_before, *ts_after, *ts; boolean_t merge_before, merge_after; + hrtime_t time; ASSERT(MUTEX_HELD(&tm->tm_lock)); VERIFY(start < end); + time = gethrtime(); tsearch.ts_start = start; tsearch.ts_end = end; @@ -184,25 +244,36 @@ trim_map_segment_add(trim_map_t *tm, uin ts_before = avl_nearest(&tm->tm_queued_frees, where, AVL_BEFORE); ts_after = avl_nearest(&tm->tm_queued_frees, where, AVL_AFTER); - merge_before = (ts_before != NULL && ts_before->ts_end == start && - ts_before->ts_txg == txg); - merge_after = (ts_after != NULL && ts_after->ts_start == end && - ts_after->ts_txg == txg); + merge_before = (ts_before != NULL && ts_before->ts_end == start); + merge_after = (ts_after != NULL && ts_after->ts_start == end); if (merge_before && merge_after) { + TRIM_MAP_SINC(tm, ts_after->ts_start - ts_before->ts_end); + TRIM_MAP_QDEC(tm); avl_remove(&tm->tm_queued_frees, ts_before); list_remove(&tm->tm_head, ts_before); ts_after->ts_start = ts_before->ts_start; + ts_after->ts_txg = txg; + ts_after->ts_time = time; kmem_free(ts_before, sizeof (*ts_before)); } else if (merge_before) { + TRIM_MAP_SINC(tm, end - ts_before->ts_end); ts_before->ts_end = end; + ts_before->ts_txg = txg; + ts_before->ts_time = time; } else if (merge_after) { + TRIM_MAP_SINC(tm, ts_after->ts_start - start); ts_after->ts_start = start; + ts_after->ts_txg = txg; + ts_after->ts_time = time; } else { + TRIM_MAP_SINC(tm, end - start); + TRIM_MAP_QINC(tm); ts = kmem_alloc(sizeof (*ts), KM_SLEEP); ts->ts_start = start; ts->ts_end = end; ts->ts_txg = txg; + ts->ts_time = time; avl_insert(&tm->tm_queued_frees, ts, where); list_insert_tail(&tm->tm_head, ts); } @@ -220,14 +291,17 @@ trim_map_segment_remove(trim_map_t *tm, left_over = (ts->ts_start < start); right_over = (ts->ts_end > end); + TRIM_MAP_SDEC(tm, end - start); if (left_over && right_over) { nts = kmem_alloc(sizeof (*nts), KM_SLEEP); nts->ts_start = end; nts->ts_end = ts->ts_end; nts->ts_txg = ts->ts_txg; + nts->ts_time = ts->ts_time; ts->ts_end = start; avl_insert_here(&tm->tm_queued_frees, nts, ts, AVL_AFTER); list_insert_after(&tm->tm_head, ts, nts); + TRIM_MAP_QINC(tm); } else if (left_over) { ts->ts_end = start; } else if (right_over) { @@ -235,6 +309,7 @@ trim_map_segment_remove(trim_map_t *tm, } else { avl_remove(&tm->tm_queued_frees, ts); list_remove(&tm->tm_head, ts); + TRIM_MAP_QDEC(tm); kmem_free(ts, sizeof (*ts)); } } @@ -261,17 +336,15 @@ trim_map_free_locked(trim_map_t *tm, uin } void -trim_map_free(zio_t *zio) +trim_map_free(vdev_t *vd, uint64_t offset, uint64_t size, uint64_t txg) { - vdev_t *vd = zio->io_vd; trim_map_t *tm = vd->vdev_trimmap; - if (zfs_notrim || vd->vdev_notrim || tm == NULL) + if (!zfs_trim_enabled || vd->vdev_notrim || tm == NULL) return; mutex_enter(&tm->tm_lock); - trim_map_free_locked(tm, zio->io_offset, zio->io_offset + zio->io_size, - vd->vdev_spa->spa_syncing_txg); + trim_map_free_locked(tm, offset, TRIM_ZIO_END(vd, offset, size), txg); mutex_exit(&tm->tm_lock); } @@ -284,11 +357,11 @@ trim_map_write_start(zio_t *zio) boolean_t left_over, right_over; uint64_t start, end; - if (zfs_notrim || vd->vdev_notrim || tm == NULL) + if (!zfs_trim_enabled || vd->vdev_notrim || tm == NULL) return (B_TRUE); start = zio->io_offset; - end = start + zio->io_size; + end = TRIM_ZIO_END(zio->io_vd, start, zio->io_size); tsearch.ts_start = start; tsearch.ts_end = end; @@ -331,7 +404,7 @@ trim_map_write_done(zio_t *zio) * Don't check for vdev_notrim, since the write could have * started before vdev_notrim was set. */ - if (zfs_notrim || tm == NULL) + if (!zfs_trim_enabled || tm == NULL) return; mutex_enter(&tm->tm_lock); @@ -348,19 +421,25 @@ trim_map_write_done(zio_t *zio) } /* - * Return the oldest segment (the one with the lowest txg) or false if - * the list is empty or the first element's txg is greater than txg given - * as function argument. + * Return the oldest segment (the one with the lowest txg / time) or NULL if: + * 1. The list is empty + * 2. The first element's txg is greater than txgsafe + * 3. The first element's txg is not greater than the txg argument and the + * the first element's time is not greater than time argument */ static trim_seg_t * -trim_map_first(trim_map_t *tm, uint64_t txg) +trim_map_first(trim_map_t *tm, uint64_t txg, uint64_t txgsafe, hrtime_t time) { trim_seg_t *ts; ASSERT(MUTEX_HELD(&tm->tm_lock)); + VERIFY(txgsafe >= txg); ts = list_head(&tm->tm_head); - if (ts != NULL && ts->ts_txg <= txg) + if (ts != NULL && ts->ts_txg <= txgsafe && + (ts->ts_txg <= txg || ts->ts_time <= time || + tm->tm_bytes > trim_vdev_max_bytes || + tm->tm_pending > trim_vdev_max_pending)) return (ts); return (NULL); } @@ -370,26 +449,37 @@ trim_map_vdev_commit(spa_t *spa, zio_t * { trim_map_t *tm = vd->vdev_trimmap; trim_seg_t *ts; - uint64_t start, size, txglimit; + uint64_t size, txgtarget, txgsafe; + hrtime_t timelimit; ASSERT(vd->vdev_ops->vdev_op_leaf); if (tm == NULL) return; - txglimit = MIN(spa->spa_syncing_txg, spa_freeze_txg(spa)) - - trim_txg_limit; + timelimit = gethrtime() - trim_timeout * NANOSEC; + if (vd->vdev_isl2cache) { + txgsafe = UINT64_MAX; + txgtarget = UINT64_MAX; + } else { + txgsafe = MIN(spa_last_synced_txg(spa), spa_freeze_txg(spa)); + if (txgsafe > trim_txg_delay) + txgtarget = txgsafe - trim_txg_delay; + else + txgtarget = 0; + } mutex_enter(&tm->tm_lock); - /* - * Loop until we send all frees up to the txglimit. - */ - while ((ts = trim_map_first(tm, txglimit)) != NULL) { + /* Loop until we have sent all outstanding free's */ + while ((ts = trim_map_first(tm, txgtarget, txgsafe, timelimit)) + != NULL) { list_remove(&tm->tm_head, ts); avl_remove(&tm->tm_queued_frees, ts); avl_add(&tm->tm_inflight_frees, ts); - zio_nowait(zio_trim(zio, spa, vd, ts->ts_start, - ts->ts_end - ts->ts_start)); + size = ts->ts_end - ts->ts_start; + zio_nowait(zio_trim(zio, spa, vd, ts->ts_start, size)); + TRIM_MAP_SDEC(tm, size); + TRIM_MAP_QDEC(tm); } mutex_exit(&tm->tm_lock); } @@ -434,7 +524,7 @@ trim_map_commit(spa_t *spa, zio_t *zio, { int c; - if (vd == NULL || spa->spa_syncing_txg <= trim_txg_limit) + if (vd == NULL) return; if (vd->vdev_ops->vdev_op_leaf) { @@ -467,6 +557,11 @@ trim_thread(void *arg) spa_t *spa = arg; zio_t *zio; +#ifdef _KERNEL + (void) snprintf(curthread->td_name, sizeof(curthread->td_name), + "trim %s", spa_name(spa)); +#endif + for (;;) { mutex_enter(&spa->spa_trim_lock); if (spa->spa_trim_thread == NULL) { @@ -475,7 +570,9 @@ trim_thread(void *arg) mutex_exit(&spa->spa_trim_lock); thread_exit(); } - cv_wait(&spa->spa_trim_cv, &spa->spa_trim_lock); + + (void) cv_timedwait(&spa->spa_trim_cv, &spa->spa_trim_lock, + hz * trim_max_interval); mutex_exit(&spa->spa_trim_lock); zio = zio_root(spa, NULL, NULL, ZIO_FLAG_CANFAIL); @@ -492,7 +589,7 @@ void trim_thread_create(spa_t *spa) { - if (zfs_notrim) + if (!zfs_trim_enabled) return; mutex_init(&spa->spa_trim_lock, NULL, MUTEX_DEFAULT, NULL); @@ -507,7 +604,7 @@ void trim_thread_destroy(spa_t *spa) { - if (zfs_notrim) + if (!zfs_trim_enabled) return; if (spa->spa_trim_thread == NULL) return; @@ -530,7 +627,7 @@ void trim_thread_wakeup(spa_t *spa) { - if (zfs_notrim) + if (!zfs_trim_enabled) return; if (spa->spa_trim_thread == NULL) return; Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Mon Jun 24 13:36:16 2013 (r252161) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Mon Jun 24 15:35:42 2013 (r252162) @@ -43,6 +43,7 @@ #include #include #include +#include SYSCTL_DECL(_vfs_zfs); SYSCTL_NODE(_vfs_zfs, OID_AUTO, vdev, CTLFLAG_RW, 0, "ZFS VDEV"); @@ -1196,6 +1197,11 @@ vdev_open(vdev_t *vd) if (vd->vdev_ishole || vd->vdev_ops == &vdev_missing_ops) return (0); + if (vd->vdev_ops->vdev_op_leaf) { + vd->vdev_notrim = B_FALSE; + trim_map_create(vd); + } + for (int c = 0; c < vd->vdev_children; c++) { if (vd->vdev_child[c]->vdev_state != VDEV_STATE_HEALTHY) { vdev_set_state(vd, B_TRUE, VDEV_STATE_DEGRADED, @@ -1441,6 +1447,9 @@ vdev_close(vdev_t *vd) vdev_cache_purge(vd); + if (vd->vdev_ops->vdev_op_leaf) + trim_map_destroy(vd); + /* * We record the previous state before we close it, so that if we are * doing a reopen(), we don't generate FMA ereports if we notice that Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Mon Jun 24 13:36:16 2013 (r252161) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Mon Jun 24 15:35:42 2013 (r252162) @@ -49,14 +49,17 @@ struct g_class zfs_vdev_class = { DECLARE_GEOM_CLASS(zfs_vdev_class, zfs_vdev); -/* - * Don't send BIO_FLUSH. - */ +SYSCTL_DECL(_vfs_zfs_vdev); +/* Don't send BIO_FLUSH. */ static int vdev_geom_bio_flush_disable = 0; TUNABLE_INT("vfs.zfs.vdev.bio_flush_disable", &vdev_geom_bio_flush_disable); -SYSCTL_DECL(_vfs_zfs_vdev); SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, bio_flush_disable, CTLFLAG_RW, &vdev_geom_bio_flush_disable, 0, "Disable BIO_FLUSH"); +/* Don't send BIO_DELETE. */ +static int vdev_geom_bio_delete_disable = 0; +TUNABLE_INT("vfs.zfs.vdev.bio_delete_disable", &vdev_geom_bio_delete_disable); +SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, bio_delete_disable, CTLFLAG_RW, + &vdev_geom_bio_delete_disable, 0, "Disable BIO_DELETE"); static void vdev_geom_orphan(struct g_consumer *cp) @@ -663,8 +666,8 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi *ashift = highbit(MAX(pp->sectorsize, SPA_MINBLOCKSIZE)) - 1; /* - * Clear the nowritecache bit, so that on a vdev_reopen() we will - * try again. + * Clear the nowritecache settings, so that on a vdev_reopen() + * we will try again. */ vd->vdev_nowritecache = B_FALSE; @@ -710,6 +713,15 @@ vdev_geom_io_intr(struct bio *bp) */ vd->vdev_nowritecache = B_TRUE; } + if (bp->bio_cmd == BIO_DELETE && bp->bio_error == ENOTSUP) { + /* + * If we get ENOTSUP, we know that no future + * attempts will ever succeed. In this case we + * set a persistent bit so that we don't bother + * with the ioctl in the future. + */ + vd->vdev_notrim = B_TRUE; + } if (zio->io_error == EIO && !vd->vdev_remove_wanted) { /* * If provider's error is set we assume it is being @@ -752,17 +764,21 @@ vdev_geom_io_start(zio_t *zio) } switch (zio->io_cmd) { - case DKIOCFLUSHWRITECACHE: - if (zfs_nocacheflush || vdev_geom_bio_flush_disable) break; - if (vd->vdev_nowritecache) { zio->io_error = ENOTSUP; break; } - + goto sendreq; + case DKIOCTRIM: + if (vdev_geom_bio_delete_disable) + break; + if (vd->vdev_notrim) { + zio->io_error = ENOTSUP; + break; + } goto sendreq; default: zio->io_error = ENOTSUP; @@ -787,11 +803,21 @@ sendreq: bp->bio_length = zio->io_size; break; case ZIO_TYPE_IOCTL: - bp->bio_cmd = BIO_FLUSH; - bp->bio_flags |= BIO_ORDERED; - bp->bio_data = NULL; - bp->bio_offset = cp->provider->mediasize; - bp->bio_length = 0; + switch (zio->io_cmd) { + case DKIOCFLUSHWRITECACHE: + bp->bio_cmd = BIO_FLUSH; + bp->bio_flags |= BIO_ORDERED; + bp->bio_data = NULL; + bp->bio_offset = cp->provider->mediasize; + bp->bio_length = 0; + break; + case DKIOCTRIM: + bp->bio_cmd = BIO_DELETE; + bp->bio_data = NULL; + bp->bio_offset = zio->io_offset; + bp->bio_length = zio->io_size; + break; + } break; } bp->bio_done = vdev_geom_io_intr; Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c Mon Jun 24 13:36:16 2013 (r252161) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c Mon Jun 24 15:35:42 2013 (r252162) @@ -145,8 +145,14 @@ #include #include #include +#include #include +static boolean_t vdev_trim_on_init = B_TRUE; +SYSCTL_DECL(_vfs_zfs_vdev); +SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, trim_on_init, CTLFLAG_RW, + &vdev_trim_on_init, 0, "Enable/disable full vdev trim on initialisation"); + /* * Basic routines to read and write from a vdev label. * Used throughout the rest of this file. @@ -718,6 +724,16 @@ vdev_label_init(vdev_t *vd, uint64_t crt } /* + * TRIM the whole thing so that we start with a clean slate. + * It's just an optimization, so we don't care if it fails. + * Don't TRIM if removing so that we don't interfere with zpool + * disaster recovery. + */ + if (zfs_trim_enabled && vdev_trim_on_init && (reason == VDEV_LABEL_CREATE || + reason == VDEV_LABEL_SPARE || reason == VDEV_LABEL_L2CACHE)) + zio_wait(zio_trim(NULL, spa, vd, 0, vd->vdev_psize)); + + /* * Initialize its label. */ vp = zio_buf_alloc(sizeof (vdev_phys_t)); @@ -1282,5 +1298,10 @@ vdev_config_sync(vdev_t **svd, int svdco * to disk to ensure that all odd-label updates are committed to * stable storage before the next transaction group begins. */ - return (vdev_label_sync_list(spa, 1, txg, flags)); + if ((error = vdev_label_sync_list(spa, 1, txg, flags)) != 0) + return (error); + + trim_thread_wakeup(spa); + + return (0); } Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Mon Jun 24 13:36:16 2013 (r252161) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Mon Jun 24 15:35:42 2013 (r252162) @@ -293,10 +293,11 @@ vdev_mirror_io_start(zio_t *zio) c = vdev_mirror_child_select(zio); children = (c >= 0); } else { - ASSERT(zio->io_type == ZIO_TYPE_WRITE); + ASSERT(zio->io_type == ZIO_TYPE_WRITE || + zio->io_type == ZIO_TYPE_FREE); /* - * Writes go to all children. + * Writes and frees go to all children. */ c = 0; children = mm->mm_children; @@ -377,6 +378,8 @@ vdev_mirror_io_done(zio_t *zio) zio->io_error = vdev_mirror_worst_error(mm); } return; + } else if (zio->io_type == ZIO_TYPE_FREE) { + return; } ASSERT(zio->io_type == ZIO_TYPE_READ); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c Mon Jun 24 13:36:16 2013 (r252161) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c Mon Jun 24 15:35:42 2013 (r252162) @@ -259,7 +259,9 @@ vdev_raidz_map_free(raidz_map_t *rm) size_t size; for (c = 0; c < rm->rm_firstdatacol; c++) { - zio_buf_free(rm->rm_col[c].rc_data, rm->rm_col[c].rc_size); + if (rm->rm_col[c].rc_data != NULL) + zio_buf_free(rm->rm_col[c].rc_data, + rm->rm_col[c].rc_size); if (rm->rm_col[c].rc_gdata != NULL) zio_buf_free(rm->rm_col[c].rc_gdata, @@ -504,14 +506,20 @@ vdev_raidz_map_alloc(zio_t *zio, uint64_ ASSERT3U(rm->rm_asize - asize, ==, rm->rm_nskip << unit_shift); ASSERT3U(rm->rm_nskip, <=, nparity); - for (c = 0; c < rm->rm_firstdatacol; c++) - rm->rm_col[c].rc_data = zio_buf_alloc(rm->rm_col[c].rc_size); - - rm->rm_col[c].rc_data = zio->io_data; + if (zio->io_type != ZIO_TYPE_FREE) { + for (c = 0; c < rm->rm_firstdatacol; c++) { + rm->rm_col[c].rc_data = + zio_buf_alloc(rm->rm_col[c].rc_size); + } - for (c = c + 1; c < acols; c++) - rm->rm_col[c].rc_data = (char *)rm->rm_col[c - 1].rc_data + - rm->rm_col[c - 1].rc_size; + rm->rm_col[c].rc_data = zio->io_data; + + for (c = c + 1; c < acols; c++) { + rm->rm_col[c].rc_data = + (char *)rm->rm_col[c - 1].rc_data + + rm->rm_col[c - 1].rc_size; + } + } /* * If all data stored spans all columns, there's a danger that parity @@ -1536,6 +1544,18 @@ vdev_raidz_io_start(zio_t *zio) ASSERT3U(rm->rm_asize, ==, vdev_psize_to_asize(vd, zio->io_size)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 16:05:02 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4034E52A; Mon, 24 Jun 2013 16:05:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 30B501F78; Mon, 24 Jun 2013 16:05:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5OG52Vx048066; Mon, 24 Jun 2013 16:05:02 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5OG50Ns048030; Mon, 24 Jun 2013 16:05:00 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306241605.r5OG50Ns048030@svn.freebsd.org> From: John Baldwin Date: Mon, 24 Jun 2013 16:05:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252163 - in stable/9: lib/libprocstat sys/kern sys/sys usr.bin/fstat X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 16:05:02 -0000 Author: jhb Date: Mon Jun 24 16:04:59 2013 New Revision: 252163 URL: http://svnweb.freebsd.org/changeset/base/252163 Log: MFC 250223,250233: Similar to 233760 and 236717, export some more useful info about the kernel-based POSIX semaphore descriptors to userland via procstat(1) and fstat(1): - Change sem file descriptors to track the pathname they are associated with and add a ksem_info() method to copy the path out to a caller-supplied buffer. - Use the fo_stat() method of shared memory objects and ksem_info() to export the path, mode, and value of a semaphore via struct kinfo_file. - Add a struct semstat to the libprocstat(3) interface along with a procstat_get_sem_info() to export the mode and value of a semaphore. - Teach fstat about semaphores and to display their path, mode, and value. Modified: stable/9/lib/libprocstat/Symbol.map stable/9/lib/libprocstat/libprocstat.3 stable/9/lib/libprocstat/libprocstat.c stable/9/lib/libprocstat/libprocstat.h stable/9/sys/kern/kern_descrip.c stable/9/sys/kern/uipc_sem.c stable/9/sys/sys/ksem.h stable/9/sys/sys/user.h stable/9/usr.bin/fstat/fstat.1 stable/9/usr.bin/fstat/fstat.c Directory Properties: stable/9/lib/libprocstat/ (props changed) stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) stable/9/usr.bin/fstat/ (props changed) Modified: stable/9/lib/libprocstat/Symbol.map ============================================================================== --- stable/9/lib/libprocstat/Symbol.map Mon Jun 24 15:35:42 2013 (r252162) +++ stable/9/lib/libprocstat/Symbol.map Mon Jun 24 16:04:59 2013 (r252163) @@ -22,6 +22,7 @@ FBSD_1.3 { procstat_freegroups; procstat_freekstack; procstat_freevmmap; + procstat_get_sem_info; procstat_get_shm_info; procstat_getargv; procstat_getauxv; Modified: stable/9/lib/libprocstat/libprocstat.3 ============================================================================== --- stable/9/lib/libprocstat/libprocstat.3 Mon Jun 24 15:35:42 2013 (r252162) +++ stable/9/lib/libprocstat/libprocstat.3 Mon Jun 24 16:04:59 2013 (r252163) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 20, 2013 +.Dd May 3, 2013 .Dt LIBPROCSTAT 3 .Os .Sh NAME @@ -53,6 +53,7 @@ .Nm procstat_freevmmap , .Nm procstat_get_pipe_info , .Nm procstat_get_pts_info , +.Nm procstat_get_sem_info , .Nm procstat_get_shm_info , .Nm procstat_get_socket_info , .Nm procstat_get_vnode_info @@ -115,6 +116,13 @@ .Fa "char *errbuf" .Fc .Ft int +.Fo procstat_get_sem_info +.Fa "struct procstat *procstat" +.Fa "struct filestat *fst" +.Fa "struct semstat *sem" +.Fa "char *errbuf" +.Fc +.Ft int .Fo procstat_get_shm_info .Fa "struct procstat *procstat" .Fa "struct filestat *fst" @@ -463,12 +471,13 @@ function call. The .Fn procstat_get_pipe_info , .Fn procstat_get_pts_info , +.Fn procstat_get_sem_info , .Fn procstat_get_shm_info , .Fn procstat_get_socket_info and .Fn procstat_get_vnode_info functions are used to retrieve information about pipes, pseudo-terminals, -shared memory objects, +semaphores, shared memory objects, sockets, and vnodes, respectively. Each of them have a similar interface API. The @@ -505,6 +514,8 @@ argument indicates an actual error messa .Nm procstat_get_pipe_info .It Li PS_FST_TYPE_PTS .Nm procstat_get_pts_info +.It Li PS_FST_TYPE_SEM +.Nm procstat_get_sem_info .It Li PS_FST_TYPE_SHM .Nm procstat_get_shm_info .El @@ -517,6 +528,7 @@ argument indicates an actual error messa .Xr elf 3 , .Xr kvm 3 , .Xr queue 3 , +.Xr sem_open 3 , .Xr sysctl 3 , .Xr pts 4 , .Xr core 5 , Modified: stable/9/lib/libprocstat/libprocstat.c ============================================================================== --- stable/9/lib/libprocstat/libprocstat.c Mon Jun 24 15:35:42 2013 (r252162) +++ stable/9/lib/libprocstat/libprocstat.c Mon Jun 24 16:04:59 2013 (r252163) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #define _WANT_FILE #include #include +#include #include #define _KERNEL #include @@ -129,6 +130,10 @@ static int procstat_get_pts_info_sysctl( struct ptsstat *pts, char *errbuf); static int procstat_get_pts_info_kvm(kvm_t *kd, struct filestat *fst, struct ptsstat *pts, char *errbuf); +static int procstat_get_sem_info_sysctl(struct filestat *fst, + struct semstat *sem, char *errbuf); +static int procstat_get_sem_info_kvm(kvm_t *kd, struct filestat *fst, + struct semstat *sem, char *errbuf); static int procstat_get_shm_info_sysctl(struct filestat *fst, struct shmstat *shm, char *errbuf); static int procstat_get_shm_info_kvm(kvm_t *kd, struct filestat *fst, @@ -560,6 +565,10 @@ procstat_getfiles_kvm(struct procstat *p data = file.f_data; break; #endif + case DTYPE_SEM: + type = PS_FST_TYPE_SEM; + data = file.f_data; + break; case DTYPE_SHM: type = PS_FST_TYPE_SHM; data = file.f_data; @@ -1008,6 +1017,87 @@ procstat_get_pts_info_sysctl(struct file } int +procstat_get_sem_info(struct procstat *procstat, struct filestat *fst, + struct semstat *sem, char *errbuf) +{ + + assert(sem); + if (procstat->type == PROCSTAT_KVM) { + return (procstat_get_sem_info_kvm(procstat->kd, fst, sem, + errbuf)); + } else if (procstat->type == PROCSTAT_SYSCTL || + procstat->type == PROCSTAT_CORE) { + return (procstat_get_sem_info_sysctl(fst, sem, errbuf)); + } else { + warnx("unknown access method: %d", procstat->type); + snprintf(errbuf, _POSIX2_LINE_MAX, "error"); + return (1); + } +} + +static int +procstat_get_sem_info_kvm(kvm_t *kd, struct filestat *fst, + struct semstat *sem, char *errbuf) +{ + struct ksem ksem; + void *ksemp; + char *path; + int i; + + assert(kd); + assert(sem); + assert(fst); + bzero(sem, sizeof(*sem)); + ksemp = fst->fs_typedep; + if (ksemp == NULL) + goto fail; + if (!kvm_read_all(kd, (unsigned long)ksemp, &ksem, + sizeof(struct ksem))) { + warnx("can't read ksem at %p", (void *)ksemp); + goto fail; + } + sem->mode = S_IFREG | ksem.ks_mode; + sem->value = ksem.ks_value; + if (fst->fs_path == NULL && ksem.ks_path != NULL) { + path = malloc(MAXPATHLEN); + for (i = 0; i < MAXPATHLEN - 1; i++) { + if (!kvm_read_all(kd, (unsigned long)ksem.ks_path + i, + path + i, 1)) + break; + if (path[i] == '\0') + break; + } + path[i] = '\0'; + if (i == 0) + free(path); + else + fst->fs_path = path; + } + return (0); + +fail: + snprintf(errbuf, _POSIX2_LINE_MAX, "error"); + return (1); +} + +static int +procstat_get_sem_info_sysctl(struct filestat *fst, struct semstat *sem, + char *errbuf __unused) +{ + struct kinfo_file *kif; + + assert(sem); + assert(fst); + bzero(sem, sizeof(*sem)); + kif = fst->fs_typedep; + if (kif == NULL) + return (0); + sem->value = kif->kf_un.kf_sem.kf_sem_value; + sem->mode = kif->kf_un.kf_sem.kf_sem_mode; + return (0); +} + +int procstat_get_shm_info(struct procstat *procstat, struct filestat *fst, struct shmstat *shm, char *errbuf) { Modified: stable/9/lib/libprocstat/libprocstat.h ============================================================================== --- stable/9/lib/libprocstat/libprocstat.h Mon Jun 24 15:35:42 2013 (r252162) +++ stable/9/lib/libprocstat/libprocstat.h Mon Jun 24 16:04:59 2013 (r252163) @@ -134,6 +134,10 @@ struct pipestat { uint64_t addr; uint64_t peer; }; +struct semstat { + uint32_t value; + uint16_t mode; +}; struct shmstat { uint64_t size; uint16_t mode; @@ -178,6 +182,8 @@ int procstat_get_pipe_info(struct procst struct pipestat *pipe, char *errbuf); int procstat_get_pts_info(struct procstat *procstat, struct filestat *fst, struct ptsstat *pts, char *errbuf); +int procstat_get_sem_info(struct procstat *procstat, struct filestat *fst, + struct semstat *sem, char *errbuf); int procstat_get_shm_info(struct procstat *procstat, struct filestat *fst, struct shmstat *shm, char *errbuf); int procstat_get_socket_info(struct procstat *procstat, struct filestat *fst, Modified: stable/9/sys/kern/kern_descrip.c ============================================================================== --- stable/9/sys/kern/kern_descrip.c Mon Jun 24 15:35:42 2013 (r252162) +++ stable/9/sys/kern/kern_descrip.c Mon Jun 24 16:04:59 2013 (r252163) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -110,6 +111,7 @@ MALLOC_DECLARE(M_FADVISE); static uma_zone_t file_zone; +void (*ksem_info)(struct ksem *ks, char *path, size_t size, uint32_t *value); /* Flags for do_dup() */ #define DUP_FIXED 0x1 /* Force fixed allocation */ @@ -129,6 +131,7 @@ static int fill_pts_info(struct tty *tp, static int fill_pipe_info(struct pipe *pi, struct kinfo_file *kif); static int fill_procdesc_info(struct procdesc *pdp, struct kinfo_file *kif); +static int fill_sem_info(struct file *fp, struct kinfo_file *kif); static int fill_shm_info(struct file *fp, struct kinfo_file *kif); /* @@ -3008,6 +3011,7 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE struct shmfd *shmfd; struct socket *so; struct vnode *vp; + struct ksem *ks; struct file *fp; struct proc *p; struct tty *tp; @@ -3037,6 +3041,7 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE continue; bzero(kif, sizeof(*kif)); kif->kf_structsize = sizeof(*kif); + ks = NULL; vp = NULL; so = NULL; tp = NULL; @@ -3097,6 +3102,7 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE case DTYPE_SEM: kif->kf_type = KF_TYPE_SEM; + ks = fp->f_data; break; case DTYPE_PTS: @@ -3208,6 +3214,8 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE } if (shmfd != NULL) shm_path(shmfd, kif->kf_path, sizeof(kif->kf_path)); + if (ks != NULL && ksem_info != NULL) + ksem_info(ks, kif->kf_path, sizeof(kif->kf_path), NULL); error = SYSCTL_OUT(req, kif, sizeof(*kif)); if (error) break; @@ -3280,6 +3288,9 @@ export_fd_to_sb(void *data, int type, in case KF_TYPE_PROCDESC: error = fill_procdesc_info((struct procdesc *)data, kif); break; + case KF_TYPE_SEM: + error = fill_sem_info((struct file *)data, kif); + break; case KF_TYPE_SHM: error = fill_shm_info((struct file *)data, kif); break; @@ -3463,6 +3474,7 @@ kern_proc_filedesc_out(struct proc *p, case DTYPE_SEM: type = KF_TYPE_SEM; + data = fp; break; case DTYPE_PTS: @@ -3699,6 +3711,25 @@ fill_procdesc_info(struct procdesc *pdp, } static int +fill_sem_info(struct file *fp, struct kinfo_file *kif) +{ + struct thread *td; + struct stat sb; + + td = curthread; + if (fp->f_data == NULL) + return (1); + if (fo_stat(fp, &sb, td->td_ucred, td) != 0) + return (1); + if (ksem_info == NULL) + return (1); + ksem_info(fp->f_data, kif->kf_path, sizeof(kif->kf_path), + &kif->kf_un.kf_sem.kf_sem_value); + kif->kf_un.kf_sem.kf_sem_mode = sb.st_mode; + return (0); +} + +static int fill_shm_info(struct file *fp, struct kinfo_file *kif) { struct thread *td; Modified: stable/9/sys/kern/uipc_sem.c ============================================================================== --- stable/9/sys/kern/uipc_sem.c Mon Jun 24 15:35:42 2013 (r252162) +++ stable/9/sys/kern/uipc_sem.c Mon Jun 24 16:04:59 2013 (r252163) @@ -71,7 +71,6 @@ FEATURE(p1003_1b_semaphores, "POSIX P100 * TODO * * - Resource limits? - * - Update fstat(1) * - Replace global sem_lock with mtx_pool locks? * - Add a MAC check_create() hook for creating new named semaphores. */ @@ -407,6 +406,7 @@ ksem_insert(char *path, Fnv32_t fnv, str map->km_path = path; map->km_fnv = fnv; map->km_ksem = ksem_hold(ks); + ks->ks_path = path; LIST_INSERT_HEAD(KSEM_HASH(fnv), map, km_link); } @@ -428,6 +428,7 @@ ksem_remove(char *path, Fnv32_t fnv, str error = ksem_access(map->km_ksem, ucred); if (error) return (error); + map->km_ksem->ks_path = NULL; LIST_REMOVE(map, km_link); ksem_drop(map->km_ksem); free(map->km_path, M_KSEM); @@ -439,6 +440,20 @@ ksem_remove(char *path, Fnv32_t fnv, str return (ENOENT); } +static void +ksem_info_impl(struct ksem *ks, char *path, size_t size, uint32_t *value) +{ + + if (ks->ks_path == NULL) + return; + sx_slock(&ksem_dict_lock); + if (ks->ks_path != NULL) + strlcpy(path, ks->ks_path, size); + if (value != NULL) + *value = ks->ks_value; + sx_sunlock(&ksem_dict_lock); +} + static int ksem_create_copyout_semid(struct thread *td, semid_t *semidp, int fd, int compat32) @@ -1014,6 +1029,7 @@ ksem_module_init(void) p31b_setcfg(CTL_P1003_1B_SEMAPHORES, 200112L); p31b_setcfg(CTL_P1003_1B_SEM_NSEMS_MAX, SEM_MAX); p31b_setcfg(CTL_P1003_1B_SEM_VALUE_MAX, SEM_VALUE_MAX); + ksem_info = ksem_info_impl; error = syscall_helper_register(ksem_syscalls); if (error) @@ -1035,6 +1051,7 @@ ksem_module_destroy(void) #endif syscall_helper_unregister(ksem_syscalls); + ksem_info = NULL; p31b_setcfg(CTL_P1003_1B_SEMAPHORES, 0); hashdestroy(ksem_dictionary, M_KSEM, ksem_hash); sx_destroy(&ksem_dict_lock); Modified: stable/9/sys/sys/ksem.h ============================================================================== --- stable/9/sys/sys/ksem.h Mon Jun 24 15:35:42 2013 (r252162) +++ stable/9/sys/sys/ksem.h Mon Jun 24 16:04:59 2013 (r252163) @@ -29,7 +29,7 @@ #ifndef _POSIX4_KSEM_H_ #define _POSIX4_KSEM_H_ -#ifndef _KERNEL +#if !defined(_KERNEL) && !defined(_WANT_FILE) #error "no user-servicable parts inside" #endif @@ -57,9 +57,15 @@ struct ksem { struct timespec ks_birthtime; struct label *ks_label; /* MAC label */ + const char *ks_path; }; #define KS_ANONYMOUS 0x0001 /* Anonymous (unnamed) semaphore. */ #define KS_DEAD 0x0002 /* No new waiters allowed. */ +#ifdef _KERNEL +extern void (*ksem_info)(struct ksem *ks, char *path, size_t size, + uint32_t *value); +#endif + #endif /* !_POSIX4_KSEM_H_ */ Modified: stable/9/sys/sys/user.h ============================================================================== --- stable/9/sys/sys/user.h Mon Jun 24 15:35:42 2013 (r252162) +++ stable/9/sys/sys/user.h Mon Jun 24 16:04:59 2013 (r252163) @@ -367,6 +367,10 @@ struct kinfo_file { uint32_t kf_file_pad1; } kf_file; struct { + uint32_t kf_sem_value; + uint16_t kf_sem_mode; + } kf_sem; + struct { uint64_t kf_pipe_addr; uint64_t kf_pipe_peer; uint32_t kf_pipe_buffer_cnt; Modified: stable/9/usr.bin/fstat/fstat.1 ============================================================================== --- stable/9/usr.bin/fstat/fstat.1 Mon Jun 24 15:35:42 2013 (r252162) +++ stable/9/usr.bin/fstat/fstat.1 Mon Jun 24 16:04:59 2013 (r252163) @@ -155,6 +155,8 @@ using a symbolic format (see otherwise, the mode is printed as an octal number. .It Li SZ\&|DV +If the file is a semaphore, +prints the current value of the semaphore. If the file is not a character or block special, prints the size of the file in bytes. Otherwise, if the Modified: stable/9/usr.bin/fstat/fstat.c ============================================================================== --- stable/9/usr.bin/fstat/fstat.c Mon Jun 24 15:35:42 2013 (r252162) +++ stable/9/usr.bin/fstat/fstat.c Mon Jun 24 16:04:59 2013 (r252163) @@ -84,6 +84,8 @@ static void print_pipe_info(struct procs struct filestat *fst); static void print_pts_info(struct procstat *procstat, struct filestat *fst); +static void print_sem_info(struct procstat *procstat, + struct filestat *fst); static void print_shm_info(struct procstat *procstat, struct filestat *fst); static void print_socket_info(struct procstat *procstat, @@ -294,6 +296,9 @@ print_file_info(struct procstat *procsta case PS_FST_TYPE_SHM: print_shm_info(procstat, fst); break; + case PS_FST_TYPE_SEM: + print_sem_info(procstat, fst); + break; default: if (vflg) fprintf(stderr, @@ -424,6 +429,30 @@ print_pts_info(struct procstat *procstat } static void +print_sem_info(struct procstat *procstat, struct filestat *fst) +{ + struct semstat sem; + char errbuf[_POSIX2_LINE_MAX]; + char mode[15]; + int error; + + error = procstat_get_sem_info(procstat, fst, &sem, errbuf); + if (error != 0) { + printf("* error"); + return; + } + if (nflg) { + printf(" "); + (void)snprintf(mode, sizeof(mode), "%o", sem.mode); + } else { + printf(" %-15s", fst->fs_path != NULL ? fst->fs_path : "-"); + strmode(sem.mode, mode); + } + printf(" %10s %6u", mode, sem.value); + print_access_flags(fst->fs_fflags); +} + +static void print_shm_info(struct procstat *procstat, struct filestat *fst) { struct shmstat shm; From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 17:09:30 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 246537E3; Mon, 24 Jun 2013 17:09:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 15A7B12BD; Mon, 24 Jun 2013 17:09:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5OH9TV8065953; Mon, 24 Jun 2013 17:09:29 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5OH9Tb5065947; Mon, 24 Jun 2013 17:09:29 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306241709.r5OH9Tb5065947@svn.freebsd.org> From: John Baldwin Date: Mon, 24 Jun 2013 17:09:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252164 - in stable/8: sys/kern sys/sys usr.bin/fstat X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 17:09:30 -0000 Author: jhb Date: Mon Jun 24 17:09:28 2013 New Revision: 252164 URL: http://svnweb.freebsd.org/changeset/base/252164 Log: MFC 250223: Similar to 233760 and 236717, export some more useful info about the kernel-based POSIX semaphore descriptors to userland via procstat(1) and fstat(1): - Change sem file descriptors to track the pathname they are associated with and add a ksem_info() method to copy the path out to a caller-supplied buffer. - Use ksem_info() to export the path of a semaphore via struct kinfo_file. - Teach fstat about semaphores and to display their path, mode, and value. Modified: stable/8/sys/kern/kern_descrip.c stable/8/sys/kern/uipc_sem.c stable/8/sys/sys/ksem.h stable/8/usr.bin/fstat/fstat.1 stable/8/usr.bin/fstat/fstat.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/kern/ (props changed) stable/8/sys/sys/ (props changed) stable/8/usr.bin/fstat/ (props changed) Modified: stable/8/sys/kern/kern_descrip.c ============================================================================== --- stable/8/sys/kern/kern_descrip.c Mon Jun 24 16:04:59 2013 (r252163) +++ stable/8/sys/kern/kern_descrip.c Mon Jun 24 17:09:28 2013 (r252164) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -96,6 +97,7 @@ MALLOC_DECLARE(M_FADVISE); static uma_zone_t file_zone; +void (*ksem_info)(struct ksem *ks, char *path, size_t size, uint32_t *value); /* Flags for do_dup() */ #define DUP_FIXED 0x1 /* Force fixed allocation */ @@ -2764,6 +2766,7 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE struct shmfd *shmfd; struct socket *so; struct vnode *vp; + struct ksem *ks; struct file *fp; struct proc *p; struct tty *tp; @@ -2796,6 +2799,7 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE continue; bzero(kif, sizeof(*kif)); kif->kf_structsize = sizeof(*kif); + ks = NULL; vp = NULL; so = NULL; tp = NULL; @@ -2840,6 +2844,7 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE case DTYPE_SEM: kif->kf_type = KF_TYPE_SEM; + ks = fp->f_data; break; case DTYPE_PTS: @@ -2945,6 +2950,8 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE } if (shmfd != NULL) shm_path(shmfd, kif->kf_path, sizeof(kif->kf_path)); + if (ks != NULL && ksem_info != NULL) + ksem_info(ks, kif->kf_path, sizeof(kif->kf_path), NULL); error = SYSCTL_OUT(req, kif, sizeof(*kif)); if (error) break; @@ -3022,6 +3029,7 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER struct shmfd *shmfd; struct socket *so; struct vnode *vp; + struct ksem *ks; struct file *fp; struct proc *p; struct tty *tp; @@ -3054,6 +3062,7 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER if ((fp = fdp->fd_ofiles[i]) == NULL) continue; bzero(kif, sizeof(*kif)); + ks = NULL; vp = NULL; so = NULL; tp = NULL; @@ -3098,6 +3107,7 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER case DTYPE_SEM: kif->kf_type = KF_TYPE_SEM; + ks = fp->f_data; break; case DTYPE_PTS: @@ -3203,6 +3213,8 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER } if (shmfd != NULL) shm_path(shmfd, kif->kf_path, sizeof(kif->kf_path)); + if (ks != NULL && ksem_info != NULL) + ksem_info(ks, kif->kf_path, sizeof(kif->kf_path), NULL); /* Pack record size down */ kif->kf_structsize = offsetof(struct kinfo_file, kf_path) + strlen(kif->kf_path) + 1; Modified: stable/8/sys/kern/uipc_sem.c ============================================================================== --- stable/8/sys/kern/uipc_sem.c Mon Jun 24 16:04:59 2013 (r252163) +++ stable/8/sys/kern/uipc_sem.c Mon Jun 24 17:09:28 2013 (r252164) @@ -344,6 +344,7 @@ ksem_insert(char *path, Fnv32_t fnv, str map->km_path = path; map->km_fnv = fnv; map->km_ksem = ksem_hold(ks); + ks->ks_path = path; LIST_INSERT_HEAD(KSEM_HASH(fnv), map, km_link); } @@ -365,6 +366,7 @@ ksem_remove(char *path, Fnv32_t fnv, str error = ksem_access(map->km_ksem, ucred); if (error) return (error); + map->km_ksem->ks_path = NULL; LIST_REMOVE(map, km_link); ksem_drop(map->km_ksem); free(map->km_path, M_KSEM); @@ -376,6 +378,20 @@ ksem_remove(char *path, Fnv32_t fnv, str return (ENOENT); } +static void +ksem_info_impl(struct ksem *ks, char *path, size_t size, uint32_t *value) +{ + + if (ks->ks_path == NULL) + return; + sx_slock(&ksem_dict_lock); + if (ks->ks_path != NULL) + strlcpy(path, ks->ks_path, size); + if (value != NULL) + *value = ks->ks_value; + sx_sunlock(&ksem_dict_lock); +} + static int ksem_create_copyout_semid(struct thread *td, semid_t *semidp, int fd, int compat32) @@ -953,6 +969,7 @@ ksem_module_init(void) p31b_setcfg(CTL_P1003_1B_SEMAPHORES, 200112L); p31b_setcfg(CTL_P1003_1B_SEM_NSEMS_MAX, SEM_MAX); p31b_setcfg(CTL_P1003_1B_SEM_VALUE_MAX, SEM_VALUE_MAX); + ksem_info = ksem_info_impl; error = syscall_helper_register(ksem_syscalls); if (error) @@ -974,6 +991,7 @@ ksem_module_destroy(void) #endif syscall_helper_unregister(ksem_syscalls); + ksem_info = NULL; p31b_setcfg(CTL_P1003_1B_SEMAPHORES, 0); hashdestroy(ksem_dictionary, M_KSEM, ksem_hash); sx_destroy(&ksem_dict_lock); Modified: stable/8/sys/sys/ksem.h ============================================================================== --- stable/8/sys/sys/ksem.h Mon Jun 24 16:04:59 2013 (r252163) +++ stable/8/sys/sys/ksem.h Mon Jun 24 17:09:28 2013 (r252164) @@ -29,7 +29,7 @@ #ifndef _POSIX4_KSEM_H_ #define _POSIX4_KSEM_H_ -#ifndef _KERNEL +#if !defined(_KERNEL) && !defined(_WANT_FILE) #error "no user-servicable parts inside" #endif @@ -57,9 +57,15 @@ struct ksem { struct timespec ks_birthtime; struct label *ks_label; /* MAC label */ + const char *ks_path; }; #define KS_ANONYMOUS 0x0001 /* Anonymous (unnamed) semaphore. */ #define KS_DEAD 0x0002 /* No new waiters allowed. */ +#ifdef _KERNEL +extern void (*ksem_info)(struct ksem *ks, char *path, size_t size, + uint32_t *value); +#endif + #endif /* !_POSIX4_KSEM_H_ */ Modified: stable/8/usr.bin/fstat/fstat.1 ============================================================================== --- stable/8/usr.bin/fstat/fstat.1 Mon Jun 24 16:04:59 2013 (r252163) +++ stable/8/usr.bin/fstat/fstat.1 Mon Jun 24 17:09:28 2013 (r252164) @@ -159,6 +159,8 @@ using a symbolic format (see otherwise, the mode is printed as an octal number. .It Li SZ\&|DV +If the file is a semaphore, +prints the current value of the semaphore. If the file is not a character or block special, prints the size of the file in bytes. Otherwise, if the Modified: stable/8/usr.bin/fstat/fstat.c ============================================================================== --- stable/8/usr.bin/fstat/fstat.c Mon Jun 24 16:04:59 2013 (r252163) +++ stable/8/usr.bin/fstat/fstat.c Mon Jun 24 17:09:28 2013 (r252164) @@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$"); #define _WANT_FILE #include #include +#include #include #define _KERNEL #include @@ -156,6 +157,7 @@ char *getmnton(struct mount *m); void pipetrans(struct pipe *pi, int i, int flag); void socktrans(struct socket *sock, int i); void ptstrans(struct tty *tp, int i, int flag); +void semtrans(struct ksem *ksemp, int i, int flag); void shmtrans(struct shmfd *shmp, int i, int flag); void getinetproto(int number); int getfname(const char *filename); @@ -426,6 +428,12 @@ dofiles(struct kinfo_proc *kp) shmtrans(file.f_data, i, file.f_flag); } #endif +#ifdef DTYPE_SEM + else if (file.f_type == DTYPE_SEM) { + if (checkfile == 0) + semtrans(file.f_data, i, file.f_flag); + } +#endif else { dprintf(stderr, "unknown file type %d for file %d of pid %d\n", @@ -948,6 +956,55 @@ bad: } void +semtrans(struct ksem *ksemp, int i, int flag) +{ + struct ksem ks; + char name[MAXPATHLEN]; + char mode[15]; + char rw[3]; + unsigned j; + + PREFIX(i); + + if (!KVM_READ(ksemp, &ks, sizeof(struct ksem))) { + dprintf(stderr, "can't read sem at %p\n", ksemp); + goto bad; + } + + if (ks.ks_path != NULL) { + for (j = 0; j < sizeof(name) - 1; j++) { + if (!KVM_READ(ks.ks_path + j, name + j, 1)) + break; + if (name[j] == '\0') + break; + } + name[j] = '\0'; + } else + name[0] = '\0'; + + rw[0] = '\0'; + if (flag & FREAD) + strcat(rw, "r"); + if (flag & FWRITE) + strcat(rw, "w"); + + ks.ks_mode |= S_IFREG; + if (nflg) { + printf(" "); + (void)snprintf(mode, sizeof(mode), "%o", ks.ks_mode); + } else { + printf(" %-15s", name[0] != '\0' ? name : "-"); + strmode(ks.ks_mode, mode); + } + printf(" %10s %6u", mode, ks.ks_value); + printf(" %2s\n", rw); + + return; +bad: + printf("* error\n"); +} + +void shmtrans(struct shmfd *shmp, int i, int flag) { struct shmfd shm; From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 18:27:45 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 42524BBE; Mon, 24 Jun 2013 18:27:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 19F0117E2; Mon, 24 Jun 2013 18:27:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5OIRiX5088834; Mon, 24 Jun 2013 18:27:44 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5OIRi6N088833; Mon, 24 Jun 2013 18:27:44 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306241827.r5OIRi6N088833@svn.freebsd.org> From: John Baldwin Date: Mon, 24 Jun 2013 18:27:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252165 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 18:27:45 -0000 Author: jhb Date: Mon Jun 24 18:27:44 2013 New Revision: 252165 URL: http://svnweb.freebsd.org/changeset/base/252165 Log: MFC 251470: Do not compare the existing mask of a cpuset with a new mask when changing the mask of a cpuset. Also, change the cpuset's mask before updating the masks of all children. Previously changing a cpuset's mask first required setting the mask to a super-set of both the old and new masks and then changing it a second time to the new mask. Modified: stable/9/sys/kern/kern_cpuset.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_cpuset.c ============================================================================== --- stable/9/sys/kern/kern_cpuset.c Mon Jun 24 17:09:28 2013 (r252164) +++ stable/9/sys/kern/kern_cpuset.c Mon Jun 24 18:27:44 2013 (r252165) @@ -303,7 +303,7 @@ cpuset_create(struct cpuset **setp, stru * empty as well as RDONLY flags. */ static int -cpuset_testupdate(struct cpuset *set, cpuset_t *mask) +cpuset_testupdate(struct cpuset *set, cpuset_t *mask, int check_mask) { struct cpuset *nset; cpuset_t newmask; @@ -312,13 +312,16 @@ cpuset_testupdate(struct cpuset *set, cp mtx_assert(&cpuset_lock, MA_OWNED); if (set->cs_flags & CPU_SET_RDONLY) return (EPERM); - if (!CPU_OVERLAP(&set->cs_mask, mask)) - return (EDEADLK); - CPU_COPY(&set->cs_mask, &newmask); - CPU_AND(&newmask, mask); + if (check_mask) { + if (!CPU_OVERLAP(&set->cs_mask, mask)) + return (EDEADLK); + CPU_COPY(&set->cs_mask, &newmask); + CPU_AND(&newmask, mask); + } else + CPU_COPY(mask, &newmask); error = 0; LIST_FOREACH(nset, &set->cs_children, cs_siblings) - if ((error = cpuset_testupdate(nset, &newmask)) != 0) + if ((error = cpuset_testupdate(nset, &newmask, 1)) != 0) break; return (error); } @@ -370,11 +373,11 @@ cpuset_modify(struct cpuset *set, cpuset if (root && !CPU_SUBSET(&root->cs_mask, mask)) return (EINVAL); mtx_lock_spin(&cpuset_lock); - error = cpuset_testupdate(set, mask); + error = cpuset_testupdate(set, mask, 0); if (error) goto out; - cpuset_update(set, mask); CPU_COPY(mask, &set->cs_mask); + cpuset_update(set, mask); out: mtx_unlock_spin(&cpuset_lock); From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 18:37:52 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C09C4298; Mon, 24 Jun 2013 18:37:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 985BA1844; Mon, 24 Jun 2013 18:37:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5OIbqx5091982; Mon, 24 Jun 2013 18:37:52 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5OIbqoo091981; Mon, 24 Jun 2013 18:37:52 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306241837.r5OIbqoo091981@svn.freebsd.org> From: John Baldwin Date: Mon, 24 Jun 2013 18:37:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252167 - stable/8/sys/kern X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 18:37:52 -0000 Author: jhb Date: Mon Jun 24 18:37:52 2013 New Revision: 252167 URL: http://svnweb.freebsd.org/changeset/base/252167 Log: MFC 251470: Do not compare the existing mask of a cpuset with a new mask when changing the mask of a cpuset. Also, change the cpuset's mask before updating the masks of all children. Previously changing a cpuset's mask first required setting the mask to a super-set of both the old and new masks and then changing it a second time to the new mask. Modified: stable/8/sys/kern/kern_cpuset.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/kern/ (props changed) Modified: stable/8/sys/kern/kern_cpuset.c ============================================================================== --- stable/8/sys/kern/kern_cpuset.c Mon Jun 24 18:30:44 2013 (r252166) +++ stable/8/sys/kern/kern_cpuset.c Mon Jun 24 18:37:52 2013 (r252167) @@ -298,7 +298,7 @@ cpuset_create(struct cpuset **setp, stru * empty as well as RDONLY flags. */ static int -cpuset_testupdate(struct cpuset *set, cpuset_t *mask) +cpuset_testupdate(struct cpuset *set, cpuset_t *mask, int check_mask) { struct cpuset *nset; cpuset_t newmask; @@ -307,13 +307,16 @@ cpuset_testupdate(struct cpuset *set, cp mtx_assert(&cpuset_lock, MA_OWNED); if (set->cs_flags & CPU_SET_RDONLY) return (EPERM); - if (!CPU_OVERLAP(&set->cs_mask, mask)) - return (EDEADLK); - CPU_COPY(&set->cs_mask, &newmask); - CPU_AND(&newmask, mask); + if (check_mask) { + if (!CPU_OVERLAP(&set->cs_mask, mask)) + return (EDEADLK); + CPU_COPY(&set->cs_mask, &newmask); + CPU_AND(&newmask, mask); + } else + CPU_COPY(mask, &newmask); error = 0; LIST_FOREACH(nset, &set->cs_children, cs_siblings) - if ((error = cpuset_testupdate(nset, &newmask)) != 0) + if ((error = cpuset_testupdate(nset, &newmask, 1)) != 0) break; return (error); } @@ -365,11 +368,11 @@ cpuset_modify(struct cpuset *set, cpuset if (root && !CPU_SUBSET(&root->cs_mask, mask)) return (EINVAL); mtx_lock_spin(&cpuset_lock); - error = cpuset_testupdate(set, mask); + error = cpuset_testupdate(set, mask, 0); if (error) goto out; - cpuset_update(set, mask); CPU_COPY(mask, &set->cs_mask); + cpuset_update(set, mask); out: mtx_unlock_spin(&cpuset_lock); From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 18:40:51 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9737F532; Mon, 24 Jun 2013 18:40:51 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 895FB1869; Mon, 24 Jun 2013 18:40:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5OIepBl094083; Mon, 24 Jun 2013 18:40:51 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5OIepQp094082; Mon, 24 Jun 2013 18:40:51 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306241840.r5OIepQp094082@svn.freebsd.org> From: John Baldwin Date: Mon, 24 Jun 2013 18:40:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252168 - stable/9/share/man/man9 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 18:40:51 -0000 Author: jhb Date: Mon Jun 24 18:40:51 2013 New Revision: 252168 URL: http://svnweb.freebsd.org/changeset/base/252168 Log: MFC 252037: Document RA_RECURSED and RA_NOTRECURSED. Modified: stable/9/share/man/man9/rwlock.9 Directory Properties: stable/9/share/man/man9/ (props changed) Modified: stable/9/share/man/man9/rwlock.9 ============================================================================== --- stable/9/share/man/man9/rwlock.9 Mon Jun 24 18:37:52 2013 (r252167) +++ stable/9/share/man/man9/rwlock.9 Mon Jun 24 18:40:51 2013 (r252168) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 1, 2008 +.Dd June 20, 2013 .Dt RWLOCK 9 .Os .Sh NAME @@ -256,7 +256,7 @@ with and .Cd "options INVARIANT_SUPPORT" , the kernel will panic. -Currently the following assertions are supported: +Currently the following base assertions are supported: .Bl -tag -width ".Dv RA_UNLOCKED" .It Dv RA_LOCKED Assert that current thread holds either a shared or exclusive lock @@ -272,6 +272,20 @@ Assert that current thread holds an excl Assert that current thread holds neither a shared nor exclusive lock of .Fa rw . .El +.Pp +In addition, one of the following optional flags may be specified with +.Dv RA_LOCKED , +.Dv RA_RLOCKED , +or +.Dv RA_WLOCKED : +.Bl -tag -width ".Dv RA_NOTRECURSED" +.It Dv RA_RECURSED +Assert that the current thread holds a recursive lock of +.Fa rw . +.It Dv RA_NOTRECURSED +Assert that the current thread does not hold a recursive lock of +.Fa rw . +.El .El .Sh SEE ALSO .Xr locking 9 , From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 18:41:29 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3AE866A4; Mon, 24 Jun 2013 18:41:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2D3B5186E; Mon, 24 Jun 2013 18:41:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5OIfTxD094216; Mon, 24 Jun 2013 18:41:29 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5OIfT6G094215; Mon, 24 Jun 2013 18:41:29 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306241841.r5OIfT6G094215@svn.freebsd.org> From: John Baldwin Date: Mon, 24 Jun 2013 18:41:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252169 - stable/8/share/man/man9 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 18:41:29 -0000 Author: jhb Date: Mon Jun 24 18:41:28 2013 New Revision: 252169 URL: http://svnweb.freebsd.org/changeset/base/252169 Log: MFC 252037: Document RA_RECURSED and RA_NOTRECURSED. Modified: stable/8/share/man/man9/rwlock.9 Directory Properties: stable/8/share/man/man9/ (props changed) Modified: stable/8/share/man/man9/rwlock.9 ============================================================================== --- stable/8/share/man/man9/rwlock.9 Mon Jun 24 18:40:51 2013 (r252168) +++ stable/8/share/man/man9/rwlock.9 Mon Jun 24 18:41:28 2013 (r252169) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 1, 2008 +.Dd June 20, 2013 .Dt RWLOCK 9 .Os .Sh NAME @@ -256,7 +256,7 @@ with and .Cd "options INVARIANT_SUPPORT" , the kernel will panic. -Currently the following assertions are supported: +Currently the following base assertions are supported: .Bl -tag -width ".Dv RA_UNLOCKED" .It Dv RA_LOCKED Assert that current thread holds either a shared or exclusive lock @@ -272,6 +272,20 @@ Assert that current thread holds an excl Assert that current thread holds neither a shared nor exclusive lock of .Fa rw . .El +.Pp +In addition, one of the following optional flags may be specified with +.Dv RA_LOCKED , +.Dv RA_RLOCKED , +or +.Dv RA_WLOCKED : +.Bl -tag -width ".Dv RA_NOTRECURSED" +.It Dv RA_RECURSED +Assert that the current thread holds a recursive lock of +.Fa rw . +.It Dv RA_NOTRECURSED +Assert that the current thread does not hold a recursive lock of +.Fa rw . +.El .El .Sh SEE ALSO .Xr locking 9 , From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 19:18:02 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8DD40591; Mon, 24 Jun 2013 19:18:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6628D19F4; Mon, 24 Jun 2013 19:18:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5OJI2Cl004433; Mon, 24 Jun 2013 19:18:02 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5OJI2g1004432; Mon, 24 Jun 2013 19:18:02 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306241918.r5OJI2g1004432@svn.freebsd.org> From: John Baldwin Date: Mon, 24 Jun 2013 19:18:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252172 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 19:18:02 -0000 Author: jhb Date: Mon Jun 24 19:18:01 2013 New Revision: 252172 URL: http://svnweb.freebsd.org/changeset/base/252172 Log: MFC 251323: - Handle the recursed/not recursed flags with RA_RLOCKED in rw_assert(). - Tweak a panic message. Modified: stable/9/sys/kern/kern_rwlock.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_rwlock.c ============================================================================== --- stable/9/sys/kern/kern_rwlock.c Mon Jun 24 19:14:09 2013 (r252171) +++ stable/9/sys/kern/kern_rwlock.c Mon Jun 24 19:18:01 2013 (r252172) @@ -330,7 +330,7 @@ _rw_rlock(struct rwlock *rw, const char KASSERT(rw->rw_lock != RW_DESTROYED, ("rw_rlock() of destroyed rwlock @ %s:%d", file, line)); KASSERT(rw_wowner(rw) != curthread, - ("%s (%s): wlock already held @ %s:%d", __func__, + ("rw_rlock: wlock already held for %s @ %s:%d", rw->lock_object.lo_name, file, line)); WITNESS_CHECKORDER(&rw->lock_object, LOP_NEWORDER, file, line, NULL); @@ -1055,6 +1055,8 @@ _rw_assert(struct rwlock *rw, int what, case RA_LOCKED | RA_RECURSED: case RA_LOCKED | RA_NOTRECURSED: case RA_RLOCKED: + case RA_RLOCKED | RA_RECURSED: + case RA_RLOCKED | RA_NOTRECURSED: #ifdef WITNESS witness_assert(&rw->lock_object, what, file, line); #else @@ -1064,13 +1066,13 @@ _rw_assert(struct rwlock *rw, int what, * has a lock at all, fail. */ if (rw->rw_lock == RW_UNLOCKED || - (!(rw->rw_lock & RW_LOCK_READ) && (what == RA_RLOCKED || + (!(rw->rw_lock & RW_LOCK_READ) && (what & RA_RLOCKED || rw_wowner(rw) != curthread))) panic("Lock %s not %slocked @ %s:%d\n", - rw->lock_object.lo_name, (what == RA_RLOCKED) ? + rw->lock_object.lo_name, (what & RA_RLOCKED) ? "read " : "", file, line); - if (!(rw->rw_lock & RW_LOCK_READ)) { + if (!(rw->rw_lock & RW_LOCK_READ) && !(what & RA_RLOCKED)) { if (rw_recursed(rw)) { if (what & RA_NOTRECURSED) panic("Lock %s recursed @ %s:%d\n", From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 19:28:37 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 001608B2; Mon, 24 Jun 2013 19:28:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CC9D61A97; Mon, 24 Jun 2013 19:28:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5OJSaH5007224; Mon, 24 Jun 2013 19:28:36 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5OJSa0o007223; Mon, 24 Jun 2013 19:28:36 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306241928.r5OJSa0o007223@svn.freebsd.org> From: John Baldwin Date: Mon, 24 Jun 2013 19:28:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252173 - stable/8/sys/kern X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 19:28:37 -0000 Author: jhb Date: Mon Jun 24 19:28:36 2013 New Revision: 252173 URL: http://svnweb.freebsd.org/changeset/base/252173 Log: MFC 251323: - Handle the recursed/not recursed flags with RA_RLOCKED in rw_assert(). - Tweak a panic message. Modified: stable/8/sys/kern/kern_rwlock.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/kern/ (props changed) Modified: stable/8/sys/kern/kern_rwlock.c ============================================================================== --- stable/8/sys/kern/kern_rwlock.c Mon Jun 24 19:18:01 2013 (r252172) +++ stable/8/sys/kern/kern_rwlock.c Mon Jun 24 19:28:36 2013 (r252173) @@ -326,7 +326,7 @@ _rw_rlock(struct rwlock *rw, const char KASSERT(rw->rw_lock != RW_DESTROYED, ("rw_rlock() of destroyed rwlock @ %s:%d", file, line)); KASSERT(rw_wowner(rw) != curthread, - ("%s (%s): wlock already held @ %s:%d", __func__, + ("rw_rlock: wlock already held for %s @ %s:%d", rw->lock_object.lo_name, file, line)); WITNESS_CHECKORDER(&rw->lock_object, LOP_NEWORDER, file, line, NULL); @@ -1045,6 +1045,8 @@ _rw_assert(struct rwlock *rw, int what, case RA_LOCKED | RA_RECURSED: case RA_LOCKED | RA_NOTRECURSED: case RA_RLOCKED: + case RA_RLOCKED | RA_RECURSED: + case RA_RLOCKED | RA_NOTRECURSED: #ifdef WITNESS witness_assert(&rw->lock_object, what, file, line); #else @@ -1054,13 +1056,13 @@ _rw_assert(struct rwlock *rw, int what, * has a lock at all, fail. */ if (rw->rw_lock == RW_UNLOCKED || - (!(rw->rw_lock & RW_LOCK_READ) && (what == RA_RLOCKED || + (!(rw->rw_lock & RW_LOCK_READ) && (what & RA_RLOCKED || rw_wowner(rw) != curthread))) panic("Lock %s not %slocked @ %s:%d\n", - rw->lock_object.lo_name, (what == RA_RLOCKED) ? + rw->lock_object.lo_name, (what & RA_RLOCKED) ? "read " : "", file, line); - if (!(rw->rw_lock & RW_LOCK_READ)) { + if (!(rw->rw_lock & RW_LOCK_READ) && !(what & RA_RLOCKED)) { if (rw_recursed(rw)) { if (what & RA_NOTRECURSED) panic("Lock %s recursed @ %s:%d\n", From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 21:33:24 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id BDD34F17; Mon, 24 Jun 2013 21:33:24 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id AD3B6111D; Mon, 24 Jun 2013 21:33:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5OLXOJK044777; Mon, 24 Jun 2013 21:33:24 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5OLXKYb044752; Mon, 24 Jun 2013 21:33:20 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201306242133.r5OLXKYb044752@svn.freebsd.org> From: Marius Strobl Date: Mon, 24 Jun 2013 21:33:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252181 - in stable/9: contrib/binutils/binutils contrib/binutils/ld contrib/openbsm/bin/auditdistd lib/libc/net lib/libipsec sbin/devd sbin/hastd usr.bin/ar usr.bin/bc usr.bin/csup usr... X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 21:33:24 -0000 Author: marius Date: Mon Jun 24 21:33:19 2013 New Revision: 252181 URL: http://svnweb.freebsd.org/changeset/base/252181 Log: A set of MFCs allowing stable/9 to be built again on head after r250881: r250227: Improve compatibility with recent flex from flex.sourceforge.net. r250914: Improve compatibility with old flex and fix build with GCC. r250926 (partial): Work around build breakages with GCC 4.2. Modified: stable/9/contrib/binutils/binutils/arlex.l stable/9/contrib/binutils/ld/ldlex.l stable/9/contrib/openbsm/bin/auditdistd/token.l stable/9/lib/libc/net/nslexer.l stable/9/lib/libipsec/policy_token.l stable/9/sbin/devd/token.l stable/9/sbin/hastd/hast.h stable/9/sbin/hastd/parse.y stable/9/sbin/hastd/token.l stable/9/usr.bin/ar/acplex.l stable/9/usr.bin/bc/scan.l stable/9/usr.bin/csup/token.l stable/9/usr.bin/mklocale/lex.l stable/9/usr.bin/xlint/lint1/scan.l stable/9/usr.sbin/apmd/apmdlex.l stable/9/usr.sbin/bluetooth/bthidd/lexer.l stable/9/usr.sbin/config/lang.l stable/9/usr.sbin/jail/jaillex.l stable/9/usr.sbin/kbdcontrol/lex.l stable/9/usr.sbin/ndiscvt/inf-token.l stable/9/usr.sbin/rrenumd/lexer.l Directory Properties: stable/9/contrib/binutils/ (props changed) stable/9/contrib/openbsm/ (props changed) stable/9/lib/libc/ (props changed) stable/9/lib/libipsec/ (props changed) stable/9/sbin/devd/ (props changed) stable/9/sbin/hastd/ (props changed) stable/9/usr.bin/ar/ (props changed) stable/9/usr.bin/bc/ (props changed) stable/9/usr.bin/csup/ (props changed) stable/9/usr.bin/mklocale/ (props changed) stable/9/usr.bin/xlint/ (props changed) stable/9/usr.sbin/apmd/ (props changed) stable/9/usr.sbin/bluetooth/bthidd/ (props changed) stable/9/usr.sbin/config/ (props changed) stable/9/usr.sbin/jail/ (props changed) stable/9/usr.sbin/kbdcontrol/ (props changed) stable/9/usr.sbin/ndiscvt/ (props changed) stable/9/usr.sbin/rrenumd/ (props changed) Modified: stable/9/contrib/binutils/binutils/arlex.l ============================================================================== --- stable/9/contrib/binutils/binutils/arlex.l Mon Jun 24 21:27:15 2013 (r252180) +++ stable/9/contrib/binutils/binutils/arlex.l Mon Jun 24 21:33:19 2013 (r252181) @@ -28,13 +28,13 @@ Foundation, Inc., 51 Franklin Street - F #include "libiberty.h" #include "arparse.h" -#define YY_NO_UNPUT - extern int yylex (void); int linenumber; %} +%option nounput + %a 10000 %o 25000 Modified: stable/9/contrib/binutils/ld/ldlex.l ============================================================================== --- stable/9/contrib/binutils/ld/ldlex.l Mon Jun 24 21:27:15 2013 (r252180) +++ stable/9/contrib/binutils/ld/ldlex.l Mon Jun 24 21:33:19 2013 (r252181) @@ -63,8 +63,6 @@ const char *lex_string = NULL; #undef YY_INPUT #define YY_INPUT(buf,result,max_size) yy_input (buf, &result, max_size) -#define YY_NO_UNPUT - #define MAX_INCLUDE_DEPTH 10 static YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; static const char *file_name_stack[MAX_INCLUDE_DEPTH]; @@ -72,7 +70,7 @@ static unsigned int lineno_stack[MAX_INC static unsigned int include_stack_ptr = 0; static int vers_node_nesting = 0; -static void yy_input (char *, int *, int); +static void yy_input (char *, yy_size_t *, yy_size_t); static void comment (void); static void lex_warn_invalid (char *where, char *what); @@ -94,6 +92,8 @@ int yywrap (void) { return 1; } #endif %} +%option nounput + %a 4000 %o 5000 @@ -612,7 +612,7 @@ ldlex_popstate (void) either the number of characters read, or 0 to indicate EOF. */ static void -yy_input (char *buf, int *result, int max_size) +yy_input (char *buf, yy_size_t *result, yy_size_t max_size) { *result = 0; if (YY_CURRENT_BUFFER->yy_input_file) Modified: stable/9/contrib/openbsm/bin/auditdistd/token.l ============================================================================== --- stable/9/contrib/openbsm/bin/auditdistd/token.l Mon Jun 24 21:27:15 2013 (r252180) +++ stable/9/contrib/openbsm/bin/auditdistd/token.l Mon Jun 24 21:33:19 2013 (r252181) @@ -52,6 +52,7 @@ int depth; int lineno; #define DP do { } while (0) +#define YY_DECL int yylex(void) %} %option noinput Modified: stable/9/lib/libc/net/nslexer.l ============================================================================== --- stable/9/lib/libc/net/nslexer.l Mon Jun 24 21:27:15 2013 (r252180) +++ stable/9/lib/libc/net/nslexer.l Mon Jun 24 21:33:19 2013 (r252181) @@ -53,11 +53,10 @@ static char *rcsid = #include "nsparser.h" -#define YY_NO_INPUT -#define YY_NO_UNPUT - %} +%option noinput +%option nounput %option yylineno BLANK [ \t] Modified: stable/9/lib/libipsec/policy_token.l ============================================================================== --- stable/9/lib/libipsec/policy_token.l Mon Jun 24 21:27:15 2013 (r252180) +++ stable/9/lib/libipsec/policy_token.l Mon Jun 24 21:33:19 2013 (r252181) @@ -139,8 +139,8 @@ void __policy__strbuffer__init__(msg) char *msg; { - if (yy_current_buffer) - yy_delete_buffer(yy_current_buffer); + if (YY_CURRENT_BUFFER) + yy_delete_buffer(YY_CURRENT_BUFFER); strbuffer = (YY_BUFFER_STATE)yy_scan_string(msg); yy_switch_to_buffer(strbuffer); Modified: stable/9/sbin/devd/token.l ============================================================================== --- stable/9/sbin/devd/token.l Mon Jun 24 21:27:15 2013 (r252180) +++ stable/9/sbin/devd/token.l Mon Jun 24 21:33:19 2013 (r252181) @@ -37,8 +37,6 @@ #include "y.tab.h" int lineno = 1; -#define YY_NO_UNPUT -#define YY_NO_INPUT static void update_lineno(const char *cp) @@ -50,6 +48,9 @@ update_lineno(const char *cp) %} +%option nounput +%option noinput + %% [ \t]+ ; Modified: stable/9/sbin/hastd/hast.h ============================================================================== --- stable/9/sbin/hastd/hast.h Mon Jun 24 21:27:15 2013 (r252180) +++ stable/9/sbin/hastd/hast.h Mon Jun 24 21:33:19 2013 (r252181) @@ -259,8 +259,6 @@ struct hast_resource { struct hastd_config *yy_config_parse(const char *config, bool exitonerror); void yy_config_free(struct hastd_config *config); -void yyerror(const char *); -int yylex(void); int yyparse(void); #endif /* !_HAST_H_ */ Modified: stable/9/sbin/hastd/parse.y ============================================================================== --- stable/9/sbin/hastd/parse.y Mon Jun 24 21:27:15 2013 (r252180) +++ stable/9/sbin/hastd/parse.y Mon Jun 24 21:33:19 2013 (r252181) @@ -75,6 +75,8 @@ static char depth1_provname[PATH_MAX]; static char depth1_localpath[PATH_MAX]; static int depth1_metaflush; +extern void yyerror(const char *); +extern int yylex(void); extern void yyrestart(FILE *); static int Modified: stable/9/sbin/hastd/token.l ============================================================================== --- stable/9/sbin/hastd/token.l Mon Jun 24 21:27:15 2013 (r252180) +++ stable/9/sbin/hastd/token.l Mon Jun 24 21:33:19 2013 (r252181) @@ -42,6 +42,9 @@ int depth; int lineno; #define DP do { } while (0) +#define YY_DECL int yylex(void) + +extern int yylex(void); %} %option noinput Modified: stable/9/usr.bin/ar/acplex.l ============================================================================== --- stable/9/usr.bin/ar/acplex.l Mon Jun 24 21:27:15 2013 (r252180) +++ stable/9/usr.bin/ar/acplex.l Mon Jun 24 21:33:19 2013 (r252181) @@ -36,14 +36,16 @@ __FBSDID("$FreeBSD$"); #include "y.tab.h" -#define YY_NO_UNPUT -#define YY_NO_INPUT int lineno = 1; int yylex(void); +#define YY_DECL int yylex(void) + %} +%option nounput +%option noinput %option noyywrap %% Modified: stable/9/usr.bin/bc/scan.l ============================================================================== --- stable/9/usr.bin/bc/scan.l Mon Jun 24 21:27:15 2013 (r252180) +++ stable/9/usr.bin/bc/scan.l Mon Jun 24 21:33:19 2013 (r252181) @@ -46,6 +46,7 @@ static void init_strbuf(void); static void add_str(const char *); static int bc_yyinput(char *, int); +#define YY_DECL int yylex(void) #define YY_NO_INPUT #undef YY_INPUT #define YY_INPUT(buf,retval,max) \ Modified: stable/9/usr.bin/csup/token.l ============================================================================== --- stable/9/usr.bin/csup/token.l Mon Jun 24 21:27:15 2013 (r252180) +++ stable/9/usr.bin/csup/token.l Mon Jun 24 21:33:19 2013 (r252181) @@ -35,12 +35,11 @@ #include "misc.h" #include "token.h" -#define YY_NO_UNPUT - int lineno = 1; %} +%option nounput %option noyywrap %% Modified: stable/9/usr.bin/mklocale/lex.l ============================================================================== --- stable/9/usr.bin/mklocale/lex.l Mon Jun 24 21:27:15 2013 (r252180) +++ stable/9/usr.bin/mklocale/lex.l Mon Jun 24 21:33:19 2013 (r252181) @@ -47,6 +47,8 @@ __FBSDID("$FreeBSD$"); #include "ldef.h" #include "y.tab.h" #include "extern.h" + +#define YY_DECL int yylex(void) %} ODIGIT [0-7] Modified: stable/9/usr.bin/xlint/lint1/scan.l ============================================================================== --- stable/9/usr.bin/xlint/lint1/scan.l Mon Jun 24 21:27:15 2013 (r252180) +++ stable/9/usr.bin/xlint/lint1/scan.l Mon Jun 24 21:33:19 2013 (r252181) @@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$"); #include "cgram.h" #define CHAR_MASK (~(~0 << CHAR_BIT)) -#define YY_NO_UNPUT /* Current position (its also updated when an included file is parsed) */ pos_t curr_pos = { 1, "", 0 }; @@ -86,6 +85,8 @@ static int wcstrg(void); %} +%option nounput + L [_A-Za-z] D [0-9] NZD [1-9] Modified: stable/9/usr.sbin/apmd/apmdlex.l ============================================================================== --- stable/9/usr.sbin/apmd/apmdlex.l Mon Jun 24 21:27:15 2013 (r252180) +++ stable/9/usr.sbin/apmd/apmdlex.l Mon Jun 24 21:33:19 2013 (r252181) @@ -36,14 +36,14 @@ #include "apmd.h" #include "y.tab.h" -/* We don't need it, avoid the warning. */ -#define YY_NO_UNPUT -#define YY_NO_INPUT - int lineno; int first_time; %} +/* We don't need it, avoid the warning. */ +%option nounput +%option noinput + %s TOP %% Modified: stable/9/usr.sbin/bluetooth/bthidd/lexer.l ============================================================================== --- stable/9/usr.sbin/bluetooth/bthidd/lexer.l Mon Jun 24 21:27:15 2013 (r252180) +++ stable/9/usr.sbin/bluetooth/bthidd/lexer.l Mon Jun 24 21:33:19 2013 (r252181) @@ -37,6 +37,8 @@ #include "parser.h" int yylex (void); + +#define YY_DECL int yylex(void) %} %option yylineno noyywrap nounput noinput Modified: stable/9/usr.sbin/config/lang.l ============================================================================== --- stable/9/usr.sbin/config/lang.l Mon Jun 24 21:27:15 2013 (r252180) +++ stable/9/usr.sbin/config/lang.l Mon Jun 24 21:33:19 2013 (r252181) @@ -38,9 +38,6 @@ #include "y.tab.h" #include "config.h" -#define YY_NO_UNPUT -#define YY_NO_INPUT - /* * Data for returning to previous files from include files. */ @@ -96,7 +93,12 @@ unsigned int octal(const char *); unsigned int hex(const char *); int yyerror(const char *); +#define YY_DECL int yylex(void) %} + +%option nounput +%option noinput + ID [A-Za-z_][-A-Za-z_0-9]* PATH [./][-/.%^A-Za-z_0-9]+ %START TOEOL Modified: stable/9/usr.sbin/jail/jaillex.l ============================================================================== --- stable/9/usr.sbin/jail/jaillex.l Mon Jun 24 21:27:15 2013 (r252180) +++ stable/9/usr.sbin/jail/jaillex.l Mon Jun 24 21:33:19 2013 (r252181) @@ -36,17 +36,19 @@ __FBSDID("$FreeBSD$"); #include "jailp.h" #include "y.tab.h" -#define YY_NO_INPUT -#define YY_NO_UNPUT - extern int yynerrs; static ssize_t text2lval(size_t triml, size_t trimr, int tovar); static int instr; static int lineno = 1; + +#define YY_DECL int yylex(void) %} +%option noinput +%option nounput + %start _ DQ %% Modified: stable/9/usr.sbin/kbdcontrol/lex.l ============================================================================== --- stable/9/usr.sbin/kbdcontrol/lex.l Mon Jun 24 21:27:15 2013 (r252180) +++ stable/9/usr.sbin/kbdcontrol/lex.l Mon Jun 24 21:33:19 2013 (r252181) @@ -31,11 +31,12 @@ %{ #include "lex.h" -#define YY_NO_UNPUT -#define YY_NO_INPUT %} +%option nounput +%option noinput + D [0-9] X [0-9a-fA-F] A . Modified: stable/9/usr.sbin/ndiscvt/inf-token.l ============================================================================== --- stable/9/usr.sbin/ndiscvt/inf-token.l Mon Jun 24 21:27:15 2013 (r252180) +++ stable/9/usr.sbin/ndiscvt/inf-token.l Mon Jun 24 21:33:19 2013 (r252181) @@ -43,8 +43,6 @@ __FBSDID("$FreeBSD$"); #include "y.tab.h" int lineno = 1; -#define YY_NO_UNPUT -#define YY_NO_INPUT int yylex(void); void yyerror(const char *); @@ -59,6 +57,9 @@ update_lineno(const char *cp) %} +%option nounput +%option noinput + %% [ \t]+ ; Modified: stable/9/usr.sbin/rrenumd/lexer.l ============================================================================== --- stable/9/usr.sbin/rrenumd/lexer.l Mon Jun 24 21:27:15 2013 (r252180) +++ stable/9/usr.sbin/rrenumd/lexer.l Mon Jun 24 21:33:19 2013 (r252181) @@ -32,8 +32,6 @@ */ %{ -#define YY_NO_UNPUT - #include #include #include @@ -64,6 +62,8 @@ void yyerror(const char *); int yylex(void); %} +%option nounput + /* common section */ nl \n ws [ \t]+ From owner-svn-src-stable@FreeBSD.ORG Mon Jun 24 23:41:17 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 85E2F76F; Mon, 24 Jun 2013 23:41:17 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 683F716FE; Mon, 24 Jun 2013 23:41:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5ONfHY3080884; Mon, 24 Jun 2013 23:41:17 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5ONfHDS080883; Mon, 24 Jun 2013 23:41:17 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201306242341.r5ONfHDS080883@svn.freebsd.org> From: Kirk McKusick Date: Mon, 24 Jun 2013 23:41:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252183 - stable/9/sys/ufs/ffs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jun 2013 23:41:17 -0000 Author: mckusick Date: Mon Jun 24 23:41:16 2013 New Revision: 252183 URL: http://svnweb.freebsd.org/changeset/base/252183 Log: MFC of 250891, 250892, 250894, 250895, 250897, and 250901 MFC 250891: Properly spell sentinel (not sintenel or sentinal). No functional changes. Spotted by: kib MFC 250892: Remove a bogus check for a NULL buffer pointer. Add a KASSERT that it is not NULL. Found by: Coverity Scan, CID 1009114 Reviewed by: kib MFC 250894: Null a pointer after it is freed so that when it is returned the return value is NULL. Based on the returned flags, the return value should never be inspected in the case where NULL is returned, but it is good coding practice not to return a pointer to freed memory. Found by: Coverity Scan, CID 1006096 Reviewed by: kib MFC 250895: Add missing 28th element to softdep types name array. Found by: Coverity Scan, CID 1007621 Reviewed by: kib MFC 250897: Add missing buffer releases (brelse) after bread calls that return an error. One could argue that returning a buffer even when it is not valid is incorrect, but bread has always returned a buffer valid or not. Reviewed by: kib MFC 250901: Properly spell sentinel (missed in 250891) No functional changes. Spotted by: Navdeep Parhar and Alexey Dokuchaev Modified: stable/9/sys/ufs/ffs/ffs_softdep.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- stable/9/sys/ufs/ffs/ffs_softdep.c Mon Jun 24 23:20:33 2013 (r252182) +++ stable/9/sys/ufs/ffs/ffs_softdep.c Mon Jun 24 23:41:16 2013 (r252183) @@ -656,8 +656,8 @@ FEATURE(softupdates, "FFS soft-updates s #define D_SBDEP 24 #define D_JTRUNC 25 #define D_JFSYNC 26 -#define D_SENTINAL 27 -#define D_LAST D_SENTINAL +#define D_SENTINEL 27 +#define D_LAST D_SENTINEL unsigned long dep_current[D_LAST + 1]; unsigned long dep_total[D_LAST + 1]; @@ -711,6 +711,8 @@ SOFTDEP_TYPE(SBDEP, sbdep, "Superblock w SOFTDEP_TYPE(JTRUNC, jtrunc, "Journal inode truncation"); SOFTDEP_TYPE(JFSYNC, jfsync, "Journal fsync complete"); +static MALLOC_DEFINE(M_SENTINEL, "sentinel", "Worklist sentinel"); + static MALLOC_DEFINE(M_SAVEDINO, "savedino", "Saved inodes"); static MALLOC_DEFINE(M_JBLOCKS, "jblocks", "Journal block locations"); @@ -745,7 +747,8 @@ static struct malloc_type *memtype[] = { M_JSEGDEP, M_SBDEP, M_JTRUNC, - M_JFSYNC + M_JFSYNC, + M_SENTINEL }; static LIST_HEAD(mkdirlist, mkdir) mkdirlisthd; @@ -1724,7 +1727,7 @@ process_worklist_item(mp, target, flags) int target; int flags; { - struct worklist sintenel; + struct worklist sentinel; struct worklist *wk; struct ufsmount *ump; int matchcnt; @@ -1742,14 +1745,14 @@ process_worklist_item(mp, target, flags) PHOLD(curproc); /* Don't let the stack go away. */ ump = VFSTOUFS(mp); matchcnt = 0; - sintenel.wk_mp = NULL; - sintenel.wk_type = D_SENTINAL; - LIST_INSERT_HEAD(&ump->softdep_workitem_pending, &sintenel, wk_list); - for (wk = LIST_NEXT(&sintenel, wk_list); wk != NULL; - wk = LIST_NEXT(&sintenel, wk_list)) { - if (wk->wk_type == D_SENTINAL) { - LIST_REMOVE(&sintenel, wk_list); - LIST_INSERT_AFTER(wk, &sintenel, wk_list); + sentinel.wk_mp = NULL; + sentinel.wk_type = D_SENTINEL; + LIST_INSERT_HEAD(&ump->softdep_workitem_pending, &sentinel, wk_list); + for (wk = LIST_NEXT(&sentinel, wk_list); wk != NULL; + wk = LIST_NEXT(&sentinel, wk_list)) { + if (wk->wk_type == D_SENTINEL) { + LIST_REMOVE(&sentinel, wk_list); + LIST_INSERT_AFTER(wk, &sentinel, wk_list); continue; } if (wk->wk_state & INPROGRESS) @@ -1806,11 +1809,11 @@ process_worklist_item(mp, target, flags) wake_worklist(wk); add_to_worklist(wk, WK_HEAD); } - LIST_REMOVE(&sintenel, wk_list); + LIST_REMOVE(&sentinel, wk_list); /* Sentinal could've become the tail from remove_from_worklist. */ - if (ump->softdep_worklist_tail == &sintenel) + if (ump->softdep_worklist_tail == &sentinel) ump->softdep_worklist_tail = - (struct worklist *)sintenel.wk_list.le_prev; + (struct worklist *)sentinel.wk_list.le_prev; PRELE(curproc); return (matchcnt); } @@ -4992,13 +4995,14 @@ bmsafemap_lookup(mp, bp, cg, newbmsafema struct fs *fs; mtx_assert(&lk, MA_OWNED); - if (bp) - LIST_FOREACH(wk, &bp->b_dep, wk_list) - if (wk->wk_type == D_BMSAFEMAP) { - if (newbmsafemap) - WORKITEM_FREE(newbmsafemap,D_BMSAFEMAP); - return (WK_BMSAFEMAP(wk)); - } + KASSERT(bp != NULL, ("bmsafemap_lookup: missing buffer")); + LIST_FOREACH(wk, &bp->b_dep, wk_list) { + if (wk->wk_type == D_BMSAFEMAP) { + if (newbmsafemap) + WORKITEM_FREE(newbmsafemap, D_BMSAFEMAP); + return (WK_BMSAFEMAP(wk)); + } + } fs = VFSTOUFS(mp)->um_fs; bmsafemaphd = BMSAFEMAP_HASH(fs, cg); if (bmsafemap_find(bmsafemaphd, mp, cg, &bmsafemap) == 1) { @@ -8157,6 +8161,7 @@ setup_newdir(dap, newinum, dinum, newdir (inodedep->id_state & ALLCOMPLETE) == ALLCOMPLETE) { dap->da_state &= ~MKDIR_PARENT; WORKITEM_FREE(mkdir2, D_MKDIR); + mkdir2 = NULL; } else { LIST_INSERT_HEAD(&mkdirlisthd, mkdir2, md_mkdirs); WORKLIST_INSERT(&inodedep->id_bufwait, &mkdir2->md_list); @@ -9365,13 +9370,16 @@ clear_unlinked_inodedep(inodedep) if (idp && (idp->id_state & UNLINKNEXT)) pino = idp->id_ino; FREE_LOCK(&lk); - if (pino == 0) + if (pino == 0) { bp = getblk(ump->um_devvp, btodb(fs->fs_sblockloc), (int)fs->fs_sbsize, 0, 0, 0); - else + } else { error = bread(ump->um_devvp, fsbtodb(fs, ino_to_fsba(fs, pino)), (int)fs->fs_bsize, NOCRED, &bp); + if (error) + brelse(bp); + } ACQUIRE_LOCK(&lk); if (error) break; @@ -12128,7 +12136,7 @@ restart: /* * Sync all cylinder groups that were dirty at the time this function is - * called. Newly dirtied cgs will be inserted before the sintenel. This + * called. Newly dirtied cgs will be inserted before the sentinel. This * is used to flush freedep activity that may be holding up writes to a * indirect block. */ @@ -12138,25 +12146,25 @@ sync_cgs(mp, waitfor) int waitfor; { struct bmsafemap *bmsafemap; - struct bmsafemap *sintenel; + struct bmsafemap *sentinel; struct ufsmount *ump; struct buf *bp; int error; - sintenel = malloc(sizeof(*sintenel), M_BMSAFEMAP, M_ZERO | M_WAITOK); - sintenel->sm_cg = -1; + sentinel = malloc(sizeof(*sentinel), M_BMSAFEMAP, M_ZERO | M_WAITOK); + sentinel->sm_cg = -1; ump = VFSTOUFS(mp); error = 0; ACQUIRE_LOCK(&lk); - LIST_INSERT_HEAD(&ump->softdep_dirtycg, sintenel, sm_next); - for (bmsafemap = LIST_NEXT(sintenel, sm_next); bmsafemap != NULL; - bmsafemap = LIST_NEXT(sintenel, sm_next)) { - /* Skip sintenels and cgs with no work to release. */ + LIST_INSERT_HEAD(&ump->softdep_dirtycg, sentinel, sm_next); + for (bmsafemap = LIST_NEXT(sentinel, sm_next); bmsafemap != NULL; + bmsafemap = LIST_NEXT(sentinel, sm_next)) { + /* Skip sentinels and cgs with no work to release. */ if (bmsafemap->sm_cg == -1 || (LIST_EMPTY(&bmsafemap->sm_freehd) && LIST_EMPTY(&bmsafemap->sm_freewr))) { - LIST_REMOVE(sintenel, sm_next); - LIST_INSERT_AFTER(bmsafemap, sintenel, sm_next); + LIST_REMOVE(sentinel, sm_next); + LIST_INSERT_AFTER(bmsafemap, sentinel, sm_next); continue; } /* @@ -12166,8 +12174,8 @@ sync_cgs(mp, waitfor) bp = getdirtybuf(bmsafemap->sm_buf, &lk, waitfor); if (bp == NULL && waitfor == MNT_WAIT) continue; - LIST_REMOVE(sintenel, sm_next); - LIST_INSERT_AFTER(bmsafemap, sintenel, sm_next); + LIST_REMOVE(sentinel, sm_next); + LIST_INSERT_AFTER(bmsafemap, sentinel, sm_next); if (bp == NULL) continue; FREE_LOCK(&lk); @@ -12179,9 +12187,9 @@ sync_cgs(mp, waitfor) if (error) break; } - LIST_REMOVE(sintenel, sm_next); + LIST_REMOVE(sentinel, sm_next); FREE_LOCK(&lk); - free(sintenel, M_BMSAFEMAP); + free(sentinel, M_BMSAFEMAP); return (error); } @@ -13180,6 +13188,7 @@ softdep_inode_append(ip, cred, wkhd) error = bread(ip->i_devvp, fsbtodb(fs, ino_to_fsba(fs, ip->i_number)), (int)fs->fs_bsize, cred, &bp); if (error) { + bqrelse(bp); softdep_freework(wkhd); return; } From owner-svn-src-stable@FreeBSD.ORG Tue Jun 25 04:42:16 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id DA30CD23; Tue, 25 Jun 2013 04:42:16 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CAA9311E8; Tue, 25 Jun 2013 04:42:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5P4gGSw066974; Tue, 25 Jun 2013 04:42:16 GMT (envelope-from bryanv@svn.freebsd.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5P4gGlY066973; Tue, 25 Jun 2013 04:42:16 GMT (envelope-from bryanv@svn.freebsd.org) Message-Id: <201306250442.r5P4gGlY066973@svn.freebsd.org> From: Bryan Venteicher Date: Tue, 25 Jun 2013 04:42:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252193 - stable/9/sys/dev/virtio/network X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2013 04:42:16 -0000 Author: bryanv Date: Tue Jun 25 04:42:16 2013 New Revision: 252193 URL: http://svnweb.freebsd.org/changeset/base/252193 Log: MFC r251796 Fix setting of the Rx filters QEMU 1.4 made the descriptor requirement stricter - the size of buffer descriptor must exactly match the number of MAC addresses provided. Modified: stable/9/sys/dev/virtio/network/if_vtnet.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- stable/9/sys/dev/virtio/network/if_vtnet.c Tue Jun 25 03:57:27 2013 (r252192) +++ stable/9/sys/dev/virtio/network/if_vtnet.c Tue Jun 25 04:42:16 2013 (r252193) @@ -2470,9 +2470,9 @@ vtnet_rx_filter_mac(struct vtnet_softc * sglist_init(&sg, 4, segs); error |= sglist_append(&sg, &hdr, sizeof(struct virtio_net_ctrl_hdr)); error |= sglist_append(&sg, &filter->vmf_unicast, - sizeof(struct vtnet_mac_table)); + sizeof(uint32_t) + filter->vmf_unicast.nentries * ETHER_ADDR_LEN); error |= sglist_append(&sg, &filter->vmf_multicast, - sizeof(struct vtnet_mac_table)); + sizeof(uint32_t) + filter->vmf_multicast.nentries * ETHER_ADDR_LEN); error |= sglist_append(&sg, &ack, sizeof(uint8_t)); KASSERT(error == 0 && sg.sg_nseg == 4, ("error adding MAC filtering message to sglist")); From owner-svn-src-stable@FreeBSD.ORG Tue Jun 25 04:44:43 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 421B7EC3; Tue, 25 Jun 2013 04:44:43 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3342611F9; Tue, 25 Jun 2013 04:44:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5P4ihcu067319; Tue, 25 Jun 2013 04:44:43 GMT (envelope-from bryanv@svn.freebsd.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5P4ihIr067318; Tue, 25 Jun 2013 04:44:43 GMT (envelope-from bryanv@svn.freebsd.org) Message-Id: <201306250444.r5P4ihIr067318@svn.freebsd.org> From: Bryan Venteicher Date: Tue, 25 Jun 2013 04:44:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252194 - stable/8/sys/dev/virtio/network X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2013 04:44:43 -0000 Author: bryanv Date: Tue Jun 25 04:44:42 2013 New Revision: 252194 URL: http://svnweb.freebsd.org/changeset/base/252194 Log: MFC r251769 Fix setting of the Rx filters QEMU 1.4 made the descriptor requirement stricter - the size of buffer descriptor must exactly match the number of MAC addresses provided. Modified: stable/8/sys/dev/virtio/network/if_vtnet.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/virtio/ (props changed) Modified: stable/8/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- stable/8/sys/dev/virtio/network/if_vtnet.c Tue Jun 25 04:42:16 2013 (r252193) +++ stable/8/sys/dev/virtio/network/if_vtnet.c Tue Jun 25 04:44:42 2013 (r252194) @@ -2470,9 +2470,9 @@ vtnet_rx_filter_mac(struct vtnet_softc * sglist_init(&sg, 4, segs); error |= sglist_append(&sg, &hdr, sizeof(struct virtio_net_ctrl_hdr)); error |= sglist_append(&sg, &filter->vmf_unicast, - sizeof(struct vtnet_mac_table)); + sizeof(uint32_t) + filter->vmf_unicast.nentries * ETHER_ADDR_LEN); error |= sglist_append(&sg, &filter->vmf_multicast, - sizeof(struct vtnet_mac_table)); + sizeof(uint32_t) + filter->vmf_multicast.nentries * ETHER_ADDR_LEN); error |= sglist_append(&sg, &ack, sizeof(uint8_t)); KASSERT(error == 0 && sg.sg_nseg == 4, ("error adding MAC filtering message to sglist")); From owner-svn-src-stable@FreeBSD.ORG Tue Jun 25 07:05:09 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 38A94A2F; Tue, 25 Jun 2013 07:05:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2BBC3174C; Tue, 25 Jun 2013 07:05:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5P759oL006705; Tue, 25 Jun 2013 07:05:09 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5P759pH006704; Tue, 25 Jun 2013 07:05:09 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201306250705.r5P759pH006704@svn.freebsd.org> From: Alexander Motin Date: Tue, 25 Jun 2013 07:05:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252197 - stable/9/sys/dev/ata/chipsets X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2013 07:05:09 -0000 Author: mav Date: Tue Jun 25 07:05:08 2013 New Revision: 252197 URL: http://svnweb.freebsd.org/changeset/base/252197 Log: MFC r251945: Pass proper memory type to free() in ata_ali_chipinit(). Modified: stable/9/sys/dev/ata/chipsets/ata-acerlabs.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/ata/chipsets/ata-acerlabs.c ============================================================================== --- stable/9/sys/dev/ata/chipsets/ata-acerlabs.c Tue Jun 25 06:43:04 2013 (r252196) +++ stable/9/sys/dev/ata/chipsets/ata-acerlabs.c Tue Jun 25 07:05:08 2013 (r252197) @@ -134,7 +134,7 @@ ata_ali_chipinit(device_t dev) for (i--; i >=0; i--) bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(i), res->bars[i]); - free(res, M_TEMP); + free(res, M_ATAPCI); return ENXIO; } } From owner-svn-src-stable@FreeBSD.ORG Tue Jun 25 07:11:08 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B3DFDBE8; Tue, 25 Jun 2013 07:11:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A6F9F1779; Tue, 25 Jun 2013 07:11:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5P7B8MA009259; Tue, 25 Jun 2013 07:11:08 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5P7B8aL009258; Tue, 25 Jun 2013 07:11:08 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201306250711.r5P7B8aL009258@svn.freebsd.org> From: Alexander Motin Date: Tue, 25 Jun 2013 07:11:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252198 - stable/8/sys/dev/ata/chipsets X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2013 07:11:08 -0000 Author: mav Date: Tue Jun 25 07:11:07 2013 New Revision: 252198 URL: http://svnweb.freebsd.org/changeset/base/252198 Log: MFC r251945: Pass proper memory type to free() in ata_ali_chipinit(). Modified: stable/8/sys/dev/ata/chipsets/ata-acerlabs.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/ata/ (props changed) Modified: stable/8/sys/dev/ata/chipsets/ata-acerlabs.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-acerlabs.c Tue Jun 25 07:05:08 2013 (r252197) +++ stable/8/sys/dev/ata/chipsets/ata-acerlabs.c Tue Jun 25 07:11:07 2013 (r252198) @@ -134,7 +134,7 @@ ata_ali_chipinit(device_t dev) for (i--; i >=0; i--) bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(i), res->bars[i]); - free(res, M_TEMP); + free(res, M_ATAPCI); return ENXIO; } } From owner-svn-src-stable@FreeBSD.ORG Tue Jun 25 07:17:10 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A43DDE71; Tue, 25 Jun 2013 07:17:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 97D4117B6; Tue, 25 Jun 2013 07:17:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5P7HAwX010173; Tue, 25 Jun 2013 07:17:10 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5P7HAp1010172; Tue, 25 Jun 2013 07:17:10 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201306250717.r5P7HAp1010172@svn.freebsd.org> From: Alexander Motin Date: Tue, 25 Jun 2013 07:17:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252199 - stable/9/sbin/camcontrol X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2013 07:17:10 -0000 Author: mav Date: Tue Jun 25 07:17:10 2013 New Revision: 252199 URL: http://svnweb.freebsd.org/changeset/base/252199 Log: MFC r251743: Improve firmware download status check. Previous check was insufficient for ATA since it ignored transport errors like command timeouts, while for SCSI it was just wrong. Modified: stable/9/sbin/camcontrol/fwdownload.c Directory Properties: stable/9/sbin/camcontrol/ (props changed) Modified: stable/9/sbin/camcontrol/fwdownload.c ============================================================================== --- stable/9/sbin/camcontrol/fwdownload.c Tue Jun 25 07:11:07 2013 (r252198) +++ stable/9/sbin/camcontrol/fwdownload.c Tue Jun 25 07:17:10 2013 (r252199) @@ -370,17 +370,15 @@ fw_download_img(struct cam_device *cam_d } if (!sim_mode) { /* Execute the command. */ - if (cam_send_ccb(cam_dev, ccb) < 0) { + if (cam_send_ccb(cam_dev, ccb) < 0 || + (ccb->ccb_h.status & CAM_STATUS_MASK) != + CAM_REQ_CMP) { warnx("Error writing image to device"); if (printerrors) cam_error_print(cam_dev, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); goto bailout; } - if (ccb->ataio.res.status != 0 /*&& !last_pkt*/) { - cam_error_print(cam_dev, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } } /* Prepare next round. */ pkt_count++; From owner-svn-src-stable@FreeBSD.ORG Tue Jun 25 07:27:24 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9B0C832E; Tue, 25 Jun 2013 07:27:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 725FC17F6; Tue, 25 Jun 2013 07:27:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5P7ROlr013303; Tue, 25 Jun 2013 07:27:24 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5P7ROJY013301; Tue, 25 Jun 2013 07:27:24 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201306250727.r5P7ROJY013301@svn.freebsd.org> From: Alexander Motin Date: Tue, 25 Jun 2013 07:27:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252201 - in stable/9/sys/cam: ata scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2013 07:27:24 -0000 Author: mav Date: Tue Jun 25 07:27:23 2013 New Revision: 252201 URL: http://svnweb.freebsd.org/changeset/base/252201 Log: MFC r251792: Restore use of polling mode for disk cache flush in case of kernel panic. While I am not sure that any extra hardware access is a good idea after panic, that is an existing behaviour that should better work correctly. Modified: stable/9/sys/cam/ata/ata_da.c stable/9/sys/cam/scsi/scsi_da.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ata/ata_da.c ============================================================================== --- stable/9/sys/cam/ata/ata_da.c Tue Jun 25 07:17:30 2013 (r252200) +++ stable/9/sys/cam/ata/ata_da.c Tue Jun 25 07:27:23 2013 (r252201) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #endif /* _KERNEL */ @@ -1932,11 +1933,16 @@ adaflush(void) int error; CAM_PERIPH_FOREACH(periph, &adadriver) { - /* If we paniced with lock held - not recurse here. */ - if (cam_periph_owned(periph)) + softc = (struct ada_softc *)periph->softc; + if (SCHEDULER_STOPPED()) { + /* If we paniced with the lock held, do not recurse. */ + if (!cam_periph_owned(periph) && + (softc->flags & ADA_FLAG_OPEN)) { + adadump(softc->disk, NULL, 0, 0, 0); + } continue; + } cam_periph_lock(periph); - softc = (struct ada_softc *)periph->softc; /* * We only sync the cache if the drive is still open, and * if the drive is capable of it.. Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Tue Jun 25 07:17:30 2013 (r252200) +++ stable/9/sys/cam/scsi/scsi_da.c Tue Jun 25 07:27:23 2013 (r252201) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #endif /* _KERNEL */ @@ -3617,8 +3618,16 @@ dashutdown(void * arg, int howto) int error; CAM_PERIPH_FOREACH(periph, &dadriver) { - cam_periph_lock(periph); softc = (struct da_softc *)periph->softc; + if (SCHEDULER_STOPPED()) { + /* If we paniced with the lock held, do not recurse. */ + if (!cam_periph_owned(periph) && + (softc->flags & DA_FLAG_OPEN)) { + dadump(softc->disk, NULL, 0, 0, 0); + } + continue; + } + cam_periph_lock(periph); /* * We only sync the cache if the drive is still open, and From owner-svn-src-stable@FreeBSD.ORG Tue Jun 25 07:32:50 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 912544E2; Tue, 25 Jun 2013 07:32:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 692B81818; Tue, 25 Jun 2013 07:32:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5P7Wo6q015573; Tue, 25 Jun 2013 07:32:50 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5P7WoBc015572; Tue, 25 Jun 2013 07:32:50 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201306250732.r5P7WoBc015572@svn.freebsd.org> From: Alexander Motin Date: Tue, 25 Jun 2013 07:32:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252202 - stable/9/sys/cam X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2013 07:32:50 -0000 Author: mav Date: Tue Jun 25 07:32:49 2013 New Revision: 252202 URL: http://svnweb.freebsd.org/changeset/base/252202 Log: MFC r249980: Give periph validity flag own periph reference. That slightly simplifies the release logic and covers hypothetical case if lock is dropped inside the periph_oninval() method. Modified: stable/9/sys/cam/cam_periph.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/cam_periph.c ============================================================================== --- stable/9/sys/cam/cam_periph.c Tue Jun 25 07:27:23 2013 (r252201) +++ stable/9/sys/cam/cam_periph.c Tue Jun 25 07:32:49 2013 (r252202) @@ -203,7 +203,7 @@ cam_periph_alloc(periph_ctor_t *periph_c periph->type = type; periph->periph_name = name; periph->immediate_priority = CAM_PRIORITY_NONE; - periph->refcount = 0; + periph->refcount = 1; /* Dropped by invalidation. */ periph->sim = sim; SLIST_INIT(&periph->ccb_list); status = xpt_create_path(&path, periph, path_id, target_id, lun_id); @@ -381,10 +381,8 @@ cam_periph_release_locked_buses(struct c mtx_assert(periph->sim->mtx, MA_OWNED); KASSERT(periph->refcount >= 1, ("periph->refcount >= 1")); - if (--periph->refcount == 0 - && (periph->flags & CAM_PERIPH_INVALID)) { + if (--periph->refcount == 0) camperiphfree(periph); - } } void @@ -579,23 +577,20 @@ void cam_periph_invalidate(struct cam_periph *periph) { - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph invalidated\n")); mtx_assert(periph->sim->mtx, MA_OWNED); /* * We only call this routine the first time a peripheral is * invalidated. */ - if (((periph->flags & CAM_PERIPH_INVALID) == 0) - && (periph->periph_oninval != NULL)) - periph->periph_oninval(periph); + if ((periph->flags & CAM_PERIPH_INVALID) != 0) + return; + CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph invalidated\n")); periph->flags |= CAM_PERIPH_INVALID; periph->flags &= ~CAM_PERIPH_NEW_DEV_FOUND; - - xpt_lock_buses(); - if (periph->refcount == 0) - camperiphfree(periph); - xpt_unlock_buses(); + if (periph->periph_oninval != NULL) + periph->periph_oninval(periph); + cam_periph_release_locked(periph); } static void From owner-svn-src-stable@FreeBSD.ORG Tue Jun 25 20:02:57 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 98BCA185; Tue, 25 Jun 2013 20:02:57 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 893CE11F7; Tue, 25 Jun 2013 20:02:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5PK2vCf035762; Tue, 25 Jun 2013 20:02:57 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5PK2v7g035761; Tue, 25 Jun 2013 20:02:57 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201306252002.r5PK2v7g035761@svn.freebsd.org> From: Eitan Adler Date: Tue, 25 Jun 2013 20:02:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252210 - stable/9/sbin/growfs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2013 20:02:57 -0000 Author: eadler Date: Tue Jun 25 20:02:57 2013 New Revision: 252210 URL: http://svnweb.freebsd.org/changeset/base/252210 Log: MFC r250377: Allow the use of lowercase 'yes' PR: bin/178422 Modified: stable/9/sbin/growfs/growfs.c Directory Properties: stable/9/sbin/growfs/ (props changed) Modified: stable/9/sbin/growfs/growfs.c ============================================================================== --- stable/9/sbin/growfs/growfs.c Tue Jun 25 18:44:15 2013 (r252209) +++ stable/9/sbin/growfs/growfs.c Tue Jun 25 20:02:57 2013 (r252210) @@ -1548,7 +1548,7 @@ main(int argc, char **argv) printf(" from %s to %s? [Yes/No] ", oldsizebuf, newsizebuf); fflush(stdout); fgets(reply, (int)sizeof(reply), stdin); - if (strcmp(reply, "Yes\n")){ + if (strcasecmp(reply, "Yes\n")){ printf("\nNothing done\n"); exit (0); } From owner-svn-src-stable@FreeBSD.ORG Tue Jun 25 20:03:06 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A247F295; Tue, 25 Jun 2013 20:03:06 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 93DCC11F9; Tue, 25 Jun 2013 20:03:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5PK36jK035844; Tue, 25 Jun 2013 20:03:06 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5PK36MF035843; Tue, 25 Jun 2013 20:03:06 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201306252003.r5PK36MF035843@svn.freebsd.org> From: Eitan Adler Date: Tue, 25 Jun 2013 20:03:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252211 - stable/8/sbin/growfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2013 20:03:06 -0000 Author: eadler Date: Tue Jun 25 20:03:06 2013 New Revision: 252211 URL: http://svnweb.freebsd.org/changeset/base/252211 Log: MFC r250377: Allow the use of lowercase 'yes' PR: bin/178422 Modified: stable/8/sbin/growfs/growfs.c Directory Properties: stable/8/sbin/growfs/ (props changed) Modified: stable/8/sbin/growfs/growfs.c ============================================================================== --- stable/8/sbin/growfs/growfs.c Tue Jun 25 20:02:57 2013 (r252210) +++ stable/8/sbin/growfs/growfs.c Tue Jun 25 20:03:06 2013 (r252211) @@ -2162,7 +2162,7 @@ main(int argc, char **argv) "before growing the Filesystem\n\n" " Did you backup your data (Yes/No) ? "); fgets(reply, (int)sizeof(reply), stdin); - if (strcmp(reply, "Yes\n")){ + if (strcasecmp(reply, "Yes\n")){ printf("\n Nothing done \n"); exit (0); } From owner-svn-src-stable@FreeBSD.ORG Tue Jun 25 21:43:51 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0778CEA7; Tue, 25 Jun 2013 21:43:51 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DC6CD18E5; Tue, 25 Jun 2013 21:43:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5PLhogv064345; Tue, 25 Jun 2013 21:43:50 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5PLhoM0064338; Tue, 25 Jun 2013 21:43:50 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201306252143.r5PLhoM0064338@svn.freebsd.org> From: "Kenneth D. Merry" Date: Tue, 25 Jun 2013 21:43:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252214 - in stable/9: bin/chio sys/cam/scsi sys/sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2013 21:43:51 -0000 Author: ken Date: Tue Jun 25 21:43:49 2013 New Revision: 252214 URL: http://svnweb.freebsd.org/changeset/base/252214 Log: MFC: 249658, 249701 Update chio(1) and ch(4) to support reporting element designators. This allows mapping a tape drive in a changer (as reported by 'chio status') to a sa(4) driver instance by comparing the serial numbers. The designators can be ASCII (which is printed out directly), binary (which is printed in hex format) or UTF-8, which is printed in either native UTF-8 format if the terminal can support it, or in %XX notation for non-ASCII characters. Thanks to Hiroki Sato for the explanation and example UTF-8 printing code. chio.h: Modify the changer_element_status structure to add new fields and definitions from the SMC3r16 spec. Rename the original CHIOGSTATUS ioctl to OCHIOGTATUS and define a new CHIOGSTATUS ioctl. Clean up some tab/space issues. chio.c: For the 'status' subcommand, print the designator field if it is supplied by a device. scsi_ch.h: Add new flags for DVCID and CURDATA to the READ ELEMENT STATUS command structure. Add a read_element_status_device_id structure for the data fields in the new standard. Add new unions, dt_or_obsolete and voltage_devid, to hold and address data from either SCSI-2 or newer devices. scsi_ch.c: Implement support for fetching device IDs with READ ELEMENT STATUS data. Add new arguments to scsi_read_element_status() to allow the user to request the DVCID and CURDATA bits. This isn't compiled into libcam (it's only an internal kernel interface), so we don't need any special handling for the API change. If the user issues the new CHIOGSTATUS ioctl, copy all of the available element status data out. If he issues the OCHIOGSTATUS ioctl, we don't copy the new fields in the structure. Fix a bug in chopen() that would result in the peripheral never getting unheld if chgetparams() failed. Sponsored by: Spectra Logic Submitted by: Po-Li Soong Modified: stable/9/bin/chio/chio.c stable/9/sys/cam/scsi/scsi_ch.c stable/9/sys/cam/scsi/scsi_ch.h stable/9/sys/sys/chio.h Directory Properties: stable/9/ (props changed) stable/9/bin/ (props changed) stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/bin/chio/chio.c ============================================================================== --- stable/9/bin/chio/chio.c Tue Jun 25 21:34:21 2013 (r252213) +++ stable/9/bin/chio/chio.c Tue Jun 25 21:43:49 2013 (r252214) @@ -54,6 +54,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include "defs.h" #include "pathnames.h" @@ -81,6 +83,7 @@ static int do_status(const char *, int, static int do_ielem(const char *, int, char **); static int do_return(const char *, int, char **); static int do_voltag(const char *, int, char **); +static void print_designator(const char *, u_int8_t, u_int8_t); #ifndef CHET_VT #define CHET_VT 10 /* Completely Arbitrary */ @@ -723,6 +726,10 @@ do_status(const char *cname, int argc, c putchar('?'); putchar('>'); } + if (ces->ces_designator_length > 0) + print_designator(ces->ces_designator, + ces->ces_code_set, + ces->ces_designator_length); putchar('\n'); } @@ -1177,3 +1184,66 @@ usage(void) "arg1 arg2 [arg3 [...]]\n", getprogname()); exit(1); } + +#define UTF8CODESET "UTF-8" + +static void +print_designator(const char *designator, u_int8_t code_set, + u_int8_t designator_length) +{ + printf(" serial number: <"); + switch (code_set) { + case CES_CODE_SET_ASCII: { + /* + * The driver insures that the string is always NUL terminated. + */ + printf("%s", designator); + break; + } + case CES_CODE_SET_UTF_8: { + char *cs_native; + + setlocale(LC_ALL, ""); + cs_native = nl_langinfo(CODESET); + + /* See if we can natively print UTF-8 */ + if (strcmp(cs_native, UTF8CODESET) == 0) + cs_native = NULL; + + if (cs_native == NULL) { + /* We can natively print UTF-8, so use printf. */ + printf("%s", designator); + } else { + int i; + + /* + * We can't natively print UTF-8. We should + * convert it to the terminal's codeset, but that + * requires iconv(3) and FreeBSD doesn't have + * iconv(3) in the base system yet. So we use %XX + * notation for non US-ASCII characters instead. + */ + for (i = 0; i < designator_length && + designator[i] != '\0'; i++) { + if ((unsigned char)designator[i] < 0x80) + printf("%c", designator[i]); + else + printf("%%%02x", + (unsigned char)designator[i]); + } + } + break; + } + case CES_CODE_SET_BINARY: { + int i; + + for (i = 0; i < designator_length; i++) + printf("%02X%s", designator[i], + (i == designator_length - 1) ? "" : " "); + break; + } + default: + break; + } + printf(">"); +} Modified: stable/9/sys/cam/scsi/scsi_ch.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_ch.c Tue Jun 25 21:34:21 2013 (r252213) +++ stable/9/sys/cam/scsi/scsi_ch.c Tue Jun 25 21:43:49 2013 (r252214) @@ -198,12 +198,14 @@ static int chexchange(struct cam_periph static int chposition(struct cam_periph *periph, struct changer_position *cp); static int chgetelemstatus(struct cam_periph *periph, + int scsi_version, u_long cmd, struct changer_element_status_request *csr); static int chsetvoltag(struct cam_periph *periph, struct changer_set_voltag_request *csvr); static int chielem(struct cam_periph *periph, unsigned int timeout); static int chgetparams(struct cam_periph *periph); +static int chscsiversion(struct cam_periph *periph); static struct periph_driver chdriver = { @@ -478,6 +480,7 @@ chopen(struct cdev *dev, int flags, int * Load information about this changer device into the softc. */ if ((error = chgetparams(periph)) != 0) { + cam_periph_unhold(periph); cam_periph_release_locked(periph); cam_periph_unlock(periph); return(error); @@ -779,6 +782,7 @@ chioctl(struct cdev *dev, u_long cmd, ca switch (cmd) { case CHIOGPICKER: case CHIOGPARAMS: + case OCHIOGSTATUS: case CHIOGSTATUS: break; @@ -831,10 +835,26 @@ chioctl(struct cdev *dev, u_long cmd, ca error = chielem(periph, *(unsigned int *)addr); break; + case OCHIOGSTATUS: + { + error = chgetelemstatus(periph, SCSI_REV_2, cmd, + (struct changer_element_status_request *)addr); + break; + } + case CHIOGSTATUS: { - error = chgetelemstatus(periph, - (struct changer_element_status_request *) addr); + int scsi_version; + + scsi_version = chscsiversion(periph); + if (scsi_version >= SCSI_REV_0) { + error = chgetelemstatus(periph, scsi_version, cmd, + (struct changer_element_status_request *)addr); + } + else { /* unable to determine the SCSI version */ + cam_periph_unlock(periph); + return (ENXIO); + } break; } @@ -1041,18 +1061,20 @@ copy_voltag(struct changer_voltag *uvolt } /* - * Copy an an element status descriptor to a user-mode + * Copy an element status descriptor to a user-mode * changer_element_status structure. */ - -static void +static void copy_element_status(struct ch_softc *softc, u_int16_t flags, struct read_element_status_descriptor *desc, - struct changer_element_status *ces) + struct changer_element_status *ces, + int scsi_version) { u_int16_t eaddr = scsi_2btoul(desc->eaddr); u_int16_t et; + struct volume_tag *pvol_tag = NULL, *avol_tag = NULL; + struct read_element_status_device_id *devid = NULL; ces->ces_int_addr = eaddr; /* set up logical address in element status */ @@ -1083,7 +1105,7 @@ copy_element_status(struct ch_softc *sof if ((softc->sc_firsts[et] <= eaddr) && ((softc->sc_firsts[et] + softc->sc_counts[et]) > eaddr)) { - ces->ces_source_addr = + ces->ces_source_addr = eaddr - softc->sc_firsts[et]; ces->ces_source_type = et; ces->ces_flags |= CES_SOURCE_VALID; @@ -1096,27 +1118,88 @@ copy_element_status(struct ch_softc *sof "address %ud to a valid element type\n", eaddr); } - + /* + * pvoltag and avoltag are common between SCSI-2 and later versions + */ if (flags & READ_ELEMENT_STATUS_PVOLTAG) - copy_voltag(&(ces->ces_pvoltag), &(desc->pvoltag)); + pvol_tag = &desc->voltag_devid.pvoltag; if (flags & READ_ELEMENT_STATUS_AVOLTAG) - copy_voltag(&(ces->ces_avoltag), &(desc->avoltag)); - - if (desc->dt_scsi_flags & READ_ELEMENT_STATUS_DT_IDVALID) { - ces->ces_flags |= CES_SCSIID_VALID; - ces->ces_scsi_id = desc->dt_scsi_addr; - } + avol_tag = (flags & READ_ELEMENT_STATUS_PVOLTAG) ? + &desc->voltag_devid.voltag[1] :&desc->voltag_devid.pvoltag; + /* + * For SCSI-3 and later, element status can carry designator and + * other information. + */ + if (scsi_version >= SCSI_REV_SPC) { + if ((flags & READ_ELEMENT_STATUS_PVOLTAG) ^ + (flags & READ_ELEMENT_STATUS_AVOLTAG)) + devid = &desc->voltag_devid.pvol_and_devid.devid; + else if (!(flags & READ_ELEMENT_STATUS_PVOLTAG) && + !(flags & READ_ELEMENT_STATUS_AVOLTAG)) + devid = &desc->voltag_devid.devid; + else /* Have both PVOLTAG and AVOLTAG */ + devid = &desc->voltag_devid.vol_tags_and_devid.devid; + } + + if (pvol_tag) + copy_voltag(&(ces->ces_pvoltag), pvol_tag); + if (avol_tag) + copy_voltag(&(ces->ces_pvoltag), avol_tag); + if (devid != NULL) { + if (devid->designator_length > 0) { + bcopy((void *)devid->designator, + (void *)ces->ces_designator, + devid->designator_length); + ces->ces_designator_length = devid->designator_length; + /* + * Make sure we are always NUL terminated. The + * This won't matter for the binary code set, + * since the user will only pay attention to the + * length field. + */ + ces->ces_designator[devid->designator_length]= '\0'; + } + if (devid->piv_assoc_designator_type & + READ_ELEMENT_STATUS_PIV_SET) { + ces->ces_flags |= CES_PIV; + ces->ces_protocol_id = + READ_ELEMENT_STATUS_PROTOCOL_ID( + devid->prot_code_set); + } + ces->ces_code_set = + READ_ELEMENT_STATUS_CODE_SET(devid->prot_code_set); + ces->ces_assoc = READ_ELEMENT_STATUS_ASSOCIATION( + devid->piv_assoc_designator_type); + ces->ces_designator_type = READ_ELEMENT_STATUS_DESIGNATOR_TYPE( + devid->piv_assoc_designator_type); + } else if (scsi_version > SCSI_REV_2) { + /* SCSI-SPC and No devid, no designator */ + ces->ces_designator_length = 0; + ces->ces_designator[0] = '\0'; + ces->ces_protocol_id = CES_PROTOCOL_ID_FCP_4; + } + + if (scsi_version <= SCSI_REV_2) { + if (desc->dt_or_obsolete.scsi_2.dt_scsi_flags & + READ_ELEMENT_STATUS_DT_IDVALID) { + ces->ces_flags |= CES_SCSIID_VALID; + ces->ces_scsi_id = + desc->dt_or_obsolete.scsi_2.dt_scsi_addr; + } - if (desc->dt_scsi_addr & READ_ELEMENT_STATUS_DT_LUVALID) { - ces->ces_flags |= CES_LUN_VALID; - ces->ces_scsi_lun = - desc->dt_scsi_flags & READ_ELEMENT_STATUS_DT_LUNMASK; + if (desc->dt_or_obsolete.scsi_2.dt_scsi_addr & + READ_ELEMENT_STATUS_DT_LUVALID) { + ces->ces_flags |= CES_LUN_VALID; + ces->ces_scsi_lun = + desc->dt_or_obsolete.scsi_2.dt_scsi_flags & + READ_ELEMENT_STATUS_DT_LUNMASK; + } } } static int -chgetelemstatus(struct cam_periph *periph, +chgetelemstatus(struct cam_periph *periph, int scsi_version, u_long cmd, struct changer_element_status_request *cesr) { struct read_element_status_header *st_hdr; @@ -1162,6 +1245,8 @@ chgetelemstatus(struct cam_periph *perip /* tag_action */ MSG_SIMPLE_Q_TAG, /* voltag */ want_voltags, /* sea */ softc->sc_firsts[chet], + /* dvcid */ 1, + /* curdata */ 1, /* count */ 1, /* data_ptr */ data, /* dxfer_len */ 1024, @@ -1184,7 +1269,6 @@ chgetelemstatus(struct cam_periph *perip size = sizeof(struct read_element_status_header) + sizeof(struct read_element_status_page_header) + (desclen * cesr->cesr_element_count); - /* * Reallocate storage for descriptors and get them from the * device. @@ -1200,12 +1284,14 @@ chgetelemstatus(struct cam_periph *perip /* voltag */ want_voltags, /* sea */ softc->sc_firsts[chet] + cesr->cesr_element_base, + /* dvcid */ 1, + /* curdata */ 1, /* count */ cesr->cesr_element_count, /* data_ptr */ data, /* dxfer_len */ size, /* sense_len */ SSD_FULL_SIZE, /* timeout */ CH_TIMEOUT_READ_ELEMENT_STATUS); - + error = cam_periph_runccb(ccb, cherror, /*cam_flags*/ CAM_RETRY_SELTO, /*sense_flags*/ SF_RETRY_UA, softc->device_stats); @@ -1238,18 +1324,41 @@ chgetelemstatus(struct cam_periph *perip * Set up the individual element status structures */ for (i = 0; i < avail; ++i) { - struct changer_element_status *ces = &(user_data[i]); + struct changer_element_status *ces; - copy_element_status(softc, pg_hdr->flags, desc, ces); + /* + * In the changer_element_status structure, fields from + * the beginning to the field of ces_scsi_lun are common + * between SCSI-2 and SCSI-3, while all the rest are new + * from SCSI-3. In order to maintain backward compatibility + * of the chio command, the ces pointer, below, is computed + * such that it lines up with the structure boundary + * corresponding to the SCSI version. + */ + ces = cmd == OCHIOGSTATUS ? + (struct changer_element_status *) + ((unsigned char *)user_data + i * + (offsetof(struct changer_element_status,ces_scsi_lun)+1)): + &user_data[i]; + + copy_element_status(softc, pg_hdr->flags, desc, + ces, scsi_version); desc = (struct read_element_status_descriptor *) - ((uintptr_t)desc + desclen); + ((unsigned char *)desc + desclen); } /* Copy element status structures out to userspace. */ - error = copyout(user_data, - cesr->cesr_element_status, - avail * sizeof(struct changer_element_status)); + if (cmd == OCHIOGSTATUS) + error = copyout(user_data, + cesr->cesr_element_status, + avail* (offsetof(struct changer_element_status, + ces_scsi_lun) + 1)); + else + error = copyout(user_data, + cesr->cesr_element_status, + avail * sizeof(struct changer_element_status)); + cam_periph_lock(periph); done: @@ -1556,6 +1665,39 @@ chgetparams(struct cam_periph *periph) return(error); } +static int +chscsiversion(struct cam_periph *periph) +{ + struct scsi_inquiry_data *inq_data; + struct ccb_getdev *cgd; + int dev_scsi_version; + struct cam_sim *sim; + + sim = xpt_path_sim(periph->path); + mtx_assert(sim->mtx, MA_OWNED); + if ((cgd = (struct ccb_getdev *)xpt_alloc_ccb_nowait()) == NULL) + return (-1); + /* + * Get the device information. + */ + xpt_setup_ccb(&cgd->ccb_h, + periph->path, + CAM_PRIORITY_NORMAL); + cgd->ccb_h.func_code = XPT_GDEV_TYPE; + xpt_action((union ccb *)cgd); + + if (cgd->ccb_h.status != CAM_REQ_CMP) { + xpt_free_ccb((union ccb *)cgd); + return -1; + } + + inq_data = &cgd->inq_data; + dev_scsi_version = inq_data->version; + xpt_free_ccb((union ccb *)cgd); + + return dev_scsi_version; +} + void scsi_move_medium(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), @@ -1661,6 +1803,7 @@ void scsi_read_element_status(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, int voltag, u_int32_t sea, + int curdata, int dvcid, u_int32_t count, u_int8_t *data_ptr, u_int32_t dxfer_len, u_int8_t sense_len, u_int32_t timeout) @@ -1675,6 +1818,10 @@ scsi_read_element_status(struct ccb_scsi scsi_ulto2b(sea, scsi_cmd->sea); scsi_ulto2b(count, scsi_cmd->count); scsi_ulto3b(dxfer_len, scsi_cmd->len); + if (dvcid) + scsi_cmd->flags |= READ_ELEMENT_STATUS_DVCID; + if (curdata) + scsi_cmd->flags |= READ_ELEMENT_STATUS_CURDATA; if (voltag) scsi_cmd->byte2 |= READ_ELEMENT_STATUS_VOLTAG; Modified: stable/9/sys/cam/scsi/scsi_ch.h ============================================================================== --- stable/9/sys/cam/scsi/scsi_ch.h Tue Jun 25 21:34:21 2013 (r252213) +++ stable/9/sys/cam/scsi/scsi_ch.h Tue Jun 25 21:43:49 2013 (r252214) @@ -136,11 +136,14 @@ struct scsi_position_to_element { struct scsi_read_element_status { u_int8_t opcode; u_int8_t byte2; -#define READ_ELEMENT_STATUS_VOLTAG 0x10 /* report volume tag info */ +#define READ_ELEMENT_STATUS_VOLTAG 0x10 /* report volume tag info */ /* ...next 4 bits are an element type code... */ u_int8_t sea[2]; /* starting element address */ u_int8_t count[2]; /* number of elements */ - u_int8_t reserved0; + u_int8_t flags; +#define READ_ELEMENT_STATUS_DVCID 0x01 /* report device serial number */ +#define READ_ELEMENT_STATUS_CURDATA 0x02 /* allow motion during command */ + u_int8_t len[3]; /* length of data buffer */ u_int8_t reserved1; u_int8_t control; @@ -149,7 +152,7 @@ struct scsi_read_element_status { struct scsi_request_volume_element_address { u_int8_t opcode; u_int8_t byte2; -#define REQUEST_VOLUME_ELEMENT_ADDRESS_VOLTAG 0x10 +#define REQUEST_VOLUME_ELEMENT_ADDRESS_VOLTAG 0x10 /* ...next 4 bits are an element type code... */ u_int8_t eaddr[2]; /* element address */ u_int8_t count[2]; /* number of elements */ @@ -182,8 +185,8 @@ struct read_element_status_header { struct read_element_status_page_header { u_int8_t type; /* element type code; see type codes below */ u_int8_t flags; -#define READ_ELEMENT_STATUS_AVOLTAG 0x40 -#define READ_ELEMENT_STATUS_PVOLTAG 0x80 +#define READ_ELEMENT_STATUS_AVOLTAG 0x40 +#define READ_ELEMENT_STATUS_PVOLTAG 0x80 u_int8_t edl[2]; /* element descriptor length */ u_int8_t reserved; u_int8_t nbytes[3]; /* byte count of all descriptors */ @@ -199,50 +202,79 @@ struct volume_tag { u_int8_t vsn[2]; /* volume sequence number */ }; +struct read_element_status_device_id { + u_int8_t prot_code_set; +#define READ_ELEMENT_STATUS_CODE_SET(p) ((p) & 0x0F) +#define READ_ELEMENT_STATUS_PROTOCOL_ID(p) ((p) >> 4) + + u_int8_t piv_assoc_designator_type; +#define READ_ELEMENT_STATUS_PIV_SET 0x80 +#define READ_ELEMENT_STATUS_ASSOCIATION(p) ((p) >> 4) +#define READ_ELEMENT_STATUS_DESIGNATOR_TYPE(p) ((p) & 0x0F) + + u_int8_t reserved2; + u_int8_t designator_length; + u_int8_t designator[256]; /* Allocate max length */ +}; + struct read_element_status_descriptor { u_int8_t eaddr[2]; /* element address */ u_int8_t flags1; -#define READ_ELEMENT_STATUS_FULL 0x01 -#define READ_ELEMENT_STATUS_IMPEXP 0x02 -#define READ_ELEMENT_STATUS_EXCEPT 0x04 -#define READ_ELEMENT_STATUS_ACCESS 0x08 -#define READ_ELEMENT_STATUS_EXENAB 0x10 -#define READ_ELEMENT_STATUS_INENAB 0x20 - -#define READ_ELEMENT_STATUS_MT_MASK1 0x05 -#define READ_ELEMENT_STATUS_ST_MASK1 0x0c -#define READ_ELEMENT_STATUS_IE_MASK1 0x3f -#define READ_ELEMENT_STATUS_DT_MASK1 0x0c +#define READ_ELEMENT_STATUS_FULL 0x01 +#define READ_ELEMENT_STATUS_IMPEXP 0x02 +#define READ_ELEMENT_STATUS_EXCEPT 0x04 +#define READ_ELEMENT_STATUS_ACCESS 0x08 +#define READ_ELEMENT_STATUS_EXENAB 0x10 +#define READ_ELEMENT_STATUS_INENAB 0x20 + +#define READ_ELEMENT_STATUS_MT_MASK1 0x05 +#define READ_ELEMENT_STATUS_ST_MASK1 0x0c +#define READ_ELEMENT_STATUS_IE_MASK1 0x3f +#define READ_ELEMENT_STATUS_DT_MASK1 0x0c u_int8_t reserved0; u_int8_t sense_code; u_int8_t sense_qual; - /* - * dt_scsi_flags and dt_scsi_addr are valid only on data transport - * elements. These bytes are undefined for all other element types. - */ - u_int8_t dt_scsi_flags; - -#define READ_ELEMENT_STATUS_DT_LUNMASK 0x07 -#define READ_ELEMENT_STATUS_DT_LUVALID 0x10 -#define READ_ELEMENT_STATUS_DT_IDVALID 0x20 -#define READ_ELEMENT_STATUS_DT_NOTBUS 0x80 - - u_int8_t dt_scsi_addr; - - u_int8_t reserved1; + union { + struct { + u_int8_t dt_scsi_flags; + +#define READ_ELEMENT_STATUS_DT_LUNMASK 0x07 +#define READ_ELEMENT_STATUS_DT_LUVALID 0x10 +#define READ_ELEMENT_STATUS_DT_IDVALID 0x20 +#define READ_ELEMENT_STATUS_DT_NOTBUS 0x80 + + u_int8_t dt_scsi_addr; + u_int8_t reserved1; + } scsi_2; + + /* reserved and obsolete (as of SCSI-3) fields */ + u_int8_t reserved_or_obsolete[3]; + } dt_or_obsolete; u_int8_t flags2; -#define READ_ELEMENT_STATUS_INVERT 0x40 -#define READ_ELEMENT_STATUS_SVALID 0x80 - u_int8_t ssea[2]; /* source storage element address */ +#define READ_ELEMENT_STATUS_INVERT 0x40 +#define READ_ELEMENT_STATUS_SVALID 0x80 +#define READ_ELEMENT_STATUS_ED 0x80 +#define READ_ELEMENT_STATUS_MEDIA_TYPE_MASK 0x07 - struct volume_tag pvoltag; /* omitted if PVOLTAG == 0 */ - struct volume_tag avoltag; /* omitted if AVOLTAG == 0 */ + u_int8_t ssea[2]; /* source storage element address */ - /* Other data may follow */ + union { + struct volume_tag pvoltag; + struct volume_tag voltag[2]; + struct read_element_status_device_id devid; + struct { + struct volume_tag pvoltag; + struct read_element_status_device_id devid; + } pvol_and_devid; + struct { + struct volume_tag voltag[2]; + struct read_element_status_device_id devid; + } vol_tags_and_devid; + } voltag_devid; }; /* XXX add data returned by REQUEST VOLUME ELEMENT ADDRESS */ @@ -457,6 +489,7 @@ void scsi_position_to_element(struct ccb void scsi_read_element_status(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, int voltag, u_int32_t sea, + int curdata, int dvcid, u_int32_t count, u_int8_t *data_ptr, u_int32_t dxfer_len, u_int8_t sense_len, u_int32_t timeout); Modified: stable/9/sys/sys/chio.h ============================================================================== --- stable/9/sys/sys/chio.h Tue Jun 25 21:34:21 2013 (r252213) +++ stable/9/sys/sys/chio.h Tue Jun 25 21:43:49 2013 (r252214) @@ -152,7 +152,8 @@ typedef enum { CES_INVERT = 0x040, /* invert bit */ CES_SOURCE_VALID = 0x080, /* source address (ces_source) valid */ CES_SCSIID_VALID = 0x100, /* ces_scsi_id is valid */ - CES_LUN_VALID = 0x200 /* ces_scsi_lun is valid */ + CES_LUN_VALID = 0x200, /* ces_scsi_lun is valid */ + CES_PIV = 0x400 /* ces_protocol_id is valid */ } ces_status_flags; struct changer_element_status { @@ -181,6 +182,55 @@ struct changer_element_status { changer_voltag_t ces_avoltag; /* alternate volume tag */ u_int8_t ces_scsi_id; /* SCSI id of element */ u_int8_t ces_scsi_lun; /* SCSI lun of element */ + + /* + * Data members for SMC3 and later versions + */ + u_int8_t ces_medium_type; +#define CES_MEDIUM_TYPE_UNKNOWN 0 /* Medium type unspecified */ +#define CES_MEDIUM_TYPE_DATA 1 /* Data medium */ +#define CES_MEDIUM_TYPE_CLEANING 2 /* Cleaning medium */ +#define CES_MEDIUM_TYPE_DIAGNOSTIC 3 /* Diagnostic medium */ +#define CES_MEDIUM_TYPE_WORM 4 /* WORM medium */ +#define CES_MEDIUM_TYPE_MICROCODE 5 /* Microcode image medium */ + + u_int8_t ces_protocol_id; +#define CES_PROTOCOL_ID_FCP_4 0 /* Fiber channel */ +#define CES_PROTOCOL_ID_SPI_5 1 /* Parallel SCSI */ +#define CES_PROTOCOL_ID_SSA_S3P 2 /* SSA */ +#define CES_PROTOCOL_ID_SBP_3 3 /* IEEE 1394 */ +#define CES_PROTOCOL_ID_SRP 4 /* SCSI Remote DMA */ +#define CES_PROTOCOL_ID_ISCSI 5 /* iSCSI */ +#define CES_PROTOCOL_ID_SPL 6 /* SAS */ +#define CES_PROTOCOL_ID_ADT_2 7 /* Automation/Drive Interface */ +#define CES_PROTOCOL_ID_ACS_2 8 /* ATA */ + + u_int8_t ces_assoc; +#define CES_ASSOC_LOGICAL_UNIT 0 +#define CES_ASSOC_TARGET_PORT 1 +#define CES_ASSOC_TARGET_DEVICE 2 + + u_int8_t ces_designator_type; +#define CES_DESIGNATOR_TYPE_VENDOR_SPECIFIC 0 +#define CES_DESIGNATOR_TYPE_T10_VENDOR_ID 1 +#define CES_DESIGNATOR_TYPE_EUI_64 2 +#define CES_DESIGNATOR_TYPE_NAA 3 +#define CES_DESIGNATOR_TYPE_TARGET_PORT_ID 4 +#define CES_DESIGNATOR_TYPE_TARGET_PORT_GRP 5 +#define CES_DESIGNATOR_TYPE_LOGICAL_UNIT_GRP 6 +#define CES_DESIGNATOR_TYPE_MD5_LOGICAL_UNIT_ID 7 +#define CES_DESIGNATOR_TYPE_SCSI_NAME_STRING 8 + + u_int8_t ces_code_set; +#define CES_CODE_SET_RESERVED 0 +#define CES_CODE_SET_BINARY 1 +#define CES_CODE_SET_ASCII 2 +#define CES_CODE_SET_UTF_8 3 + + u_int8_t ces_designator_length; + +#define CES_MAX_DESIGNATOR_LENGTH (1 << 8) + u_int8_t ces_designator[CES_MAX_DESIGNATOR_LENGTH + 1]; }; struct changer_element_status_request { @@ -189,7 +239,7 @@ struct changer_element_status_request { u_int16_t cesr_element_count; u_int16_t cesr_flags; -#define CESR_VOLTAGS 0x01 +#define CESR_VOLTAGS 0x01 struct changer_element_status *cesr_element_status; }; @@ -200,28 +250,29 @@ struct changer_set_voltag_request { u_int16_t csvr_addr; u_int16_t csvr_flags; -#define CSVR_MODE_MASK 0x0f /* mode mask, acceptable modes below: */ +#define CSVR_MODE_MASK 0x0f /* mode mask, acceptable modes below: */ #define CSVR_MODE_SET 0x00 /* set volume tag if not set */ -#define CSVR_MODE_REPLACE 0x01 /* unconditionally replace volume tag */ -#define CSVR_MODE_CLEAR 0x02 /* clear volume tag */ +#define CSVR_MODE_REPLACE 0x01 /* unconditionally replace volume tag */ +#define CSVR_MODE_CLEAR 0x02 /* clear volume tag */ -#define CSVR_ALTERNATE 0x10 /* set to work with alternate voltag */ +#define CSVR_ALTERNATE 0x10 /* set to work with alternate voltag */ changer_voltag_t csvr_voltag; }; -#define CESTATUS_BITS \ +#define CESTATUS_BITS \ "\20\6INEAB\5EXENAB\4ACCESS\3EXCEPT\2IMPEXP\1FULL" -#define CHIOMOVE _IOW('c', 0x01, struct changer_move) -#define CHIOEXCHANGE _IOW('c', 0x02, struct changer_exchange) -#define CHIOPOSITION _IOW('c', 0x03, struct changer_position) -#define CHIOGPICKER _IOR('c', 0x04, int) -#define CHIOSPICKER _IOW('c', 0x05, int) -#define CHIOGPARAMS _IOR('c', 0x06, struct changer_params) -#define CHIOIELEM _IOW('c', 0x07, u_int32_t) -#define CHIOGSTATUS _IOW('c', 0x08, struct changer_element_status_request) -#define CHIOSETVOLTAG _IOW('c', 0x09, struct changer_set_voltag_request) +#define CHIOMOVE _IOW('c', 0x01, struct changer_move) +#define CHIOEXCHANGE _IOW('c', 0x02, struct changer_exchange) +#define CHIOPOSITION _IOW('c', 0x03, struct changer_position) +#define CHIOGPICKER _IOR('c', 0x04, int) +#define CHIOSPICKER _IOW('c', 0x05, int) +#define CHIOGPARAMS _IOR('c', 0x06, struct changer_params) +#define CHIOIELEM _IOW('c', 0x07, u_int32_t) +#define OCHIOGSTATUS _IOW('c', 0x08, struct changer_element_status_request) +#define CHIOSETVOLTAG _IOW('c', 0x09, struct changer_set_voltag_request) +#define CHIOGSTATUS _IOW('c', 0x0A, struct changer_element_status_request) #endif /* !_SYS_CHIO_H_ */ From owner-svn-src-stable@FreeBSD.ORG Tue Jun 25 21:49:07 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 646E43C5; Tue, 25 Jun 2013 21:49:07 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 55BCF191F; Tue, 25 Jun 2013 21:49:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5PLn7IM065066; Tue, 25 Jun 2013 21:49:07 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5PLn7QG065065; Tue, 25 Jun 2013 21:49:07 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201306252149.r5PLn7QG065065@svn.freebsd.org> From: Baptiste Daroussin Date: Tue, 25 Jun 2013 21:49:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252216 - stable/9/usr.sbin/pkg X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2013 21:49:07 -0000 Author: bapt Date: Tue Jun 25 21:49:06 2013 New Revision: 252216 URL: http://svnweb.freebsd.org/changeset/base/252216 Log: MFC r251560 Fix a bad calloc(3) call Modified: stable/9/usr.sbin/pkg/dns_utils.c Directory Properties: stable/9/usr.sbin/pkg/ (props changed) Modified: stable/9/usr.sbin/pkg/dns_utils.c ============================================================================== --- stable/9/usr.sbin/pkg/dns_utils.c Tue Jun 25 21:44:48 2013 (r252215) +++ stable/9/usr.sbin/pkg/dns_utils.c Tue Jun 25 21:49:06 2013 (r252216) @@ -66,7 +66,7 @@ dns_getsrvinfo(const char *zone) p += len + NS_QFIXEDSZ; } - res = calloc(ancount, sizeof(struct dns_srvinfo)); + res = calloc(ancount, sizeof(struct dns_srvinfo *)); if (res == NULL) return (NULL); From owner-svn-src-stable@FreeBSD.ORG Tue Jun 25 21:50:06 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 11202547; Tue, 25 Jun 2013 21:50:06 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 024AE192E; Tue, 25 Jun 2013 21:50:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5PLo5It065270; Tue, 25 Jun 2013 21:50:05 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5PLo5Gj065269; Tue, 25 Jun 2013 21:50:05 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201306252150.r5PLo5Gj065269@svn.freebsd.org> From: Baptiste Daroussin Date: Tue, 25 Jun 2013 21:50:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252217 - stable/8/usr.sbin/pkg X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2013 21:50:06 -0000 Author: bapt Date: Tue Jun 25 21:50:05 2013 New Revision: 252217 URL: http://svnweb.freebsd.org/changeset/base/252217 Log: MFC r251560 Fix a bad calloc(3) call Modified: stable/8/usr.sbin/pkg/dns_utils.c Directory Properties: stable/8/usr.sbin/pkg/ (props changed) Modified: stable/8/usr.sbin/pkg/dns_utils.c ============================================================================== --- stable/8/usr.sbin/pkg/dns_utils.c Tue Jun 25 21:49:06 2013 (r252216) +++ stable/8/usr.sbin/pkg/dns_utils.c Tue Jun 25 21:50:05 2013 (r252217) @@ -66,7 +66,7 @@ dns_getsrvinfo(const char *zone) p += len + NS_QFIXEDSZ; } - res = calloc(ancount, sizeof(struct dns_srvinfo)); + res = calloc(ancount, sizeof(struct dns_srvinfo *)); if (res == NULL) return (NULL); From owner-svn-src-stable@FreeBSD.ORG Tue Jun 25 23:30:48 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D6E63F1; Tue, 25 Jun 2013 23:30:48 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C831D1C48; Tue, 25 Jun 2013 23:30:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5PNUmks095817; Tue, 25 Jun 2013 23:30:48 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5PNUmZH095816; Tue, 25 Jun 2013 23:30:48 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201306252330.r5PNUmZH095816@svn.freebsd.org> From: Jim Harris Date: Tue, 25 Jun 2013 23:30:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252221 - in stable/9: sbin/nvmecontrol sys/dev/nvd sys/dev/nvme sys/modules/nvd sys/modules/nvme X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2013 23:30:48 -0000 Author: jimharris Date: Tue Jun 25 23:30:48 2013 New Revision: 252221 URL: http://svnweb.freebsd.org/changeset/base/252221 Log: MFC r240616, r240619, r240620: Merge initial NVM Express (NVMe) commits to stable/9. This only pulls the nvme(4), nvd(4) and nvmecontrol(8) code into stable/9. A follow-up commit will link it into the build and merge all of the additional commits made for NVMe over the last few months. Sponsored by: Intel Added: stable/9/sbin/nvmecontrol/ - copied from r240620, head/sbin/nvmecontrol/ stable/9/sys/dev/nvd/ - copied from r240616, head/sys/dev/nvd/ stable/9/sys/dev/nvme/ - copied from r240616, head/sys/dev/nvme/ stable/9/sys/modules/nvd/ - copied from r240619, head/sys/modules/nvd/ stable/9/sys/modules/nvme/ - copied from r240619, head/sys/modules/nvme/ Modified: Directory Properties: stable/9/sbin/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/modules/ (props changed) From owner-svn-src-stable@FreeBSD.ORG Tue Jun 25 23:52:42 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6EEDC96E; Tue, 25 Jun 2013 23:52:42 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 512E81CDE; Tue, 25 Jun 2013 23:52:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5PNqgRN003649; Tue, 25 Jun 2013 23:52:42 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5PNqecx003637; Tue, 25 Jun 2013 23:52:40 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201306252352.r5PNqecx003637@svn.freebsd.org> From: Jim Harris Date: Tue, 25 Jun 2013 23:52:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252222 - in stable/9: etc/mtree include sbin sbin/nvmecontrol sys/amd64/conf sys/conf sys/dev/nvd sys/dev/nvme sys/i386/conf sys/modules sys/modules/nvme X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2013 23:52:42 -0000 Author: jimharris Date: Tue Jun 25 23:52:39 2013 New Revision: 252222 URL: http://svnweb.freebsd.org/changeset/base/252222 Log: 240618, 240621, 240633, 240671, 240672, 240697, 240700, 241433, 241434, 241657, 241658, 241659, 241660, 241661, 241662, 241663, 241664, 241665, 241689, 242420, 243951, 244410, 244411, 244413, 244549, 245136, 247963, 248729, 248730, 248731, 248732, 248733, 248734, 248735, 248736, 248737, 248738, 248739, 248740, 248741, 248746, 248747, 248748, 248749, 248754, 248755, 248756, 248757, 248758, 248759, 248760, 248761, 248762, 248763, 248764, 248765, 248766, 248767, 248768, 248769, 248770, 248771, 248772, 248773, 248780, 248834, 248835, 248913, 248977, 249067, 249416, 249417, 249418, 249419, 249420, 249421, 249422, 249432 Deleted: stable/9/sys/dev/nvme/nvme_uio.c Modified: stable/9/etc/mtree/BSD.include.dist stable/9/include/Makefile stable/9/sbin/Makefile.amd64 stable/9/sbin/Makefile.i386 stable/9/sbin/nvmecontrol/nvmecontrol.8 stable/9/sbin/nvmecontrol/nvmecontrol.c stable/9/sys/amd64/conf/NOTES stable/9/sys/conf/files.amd64 stable/9/sys/conf/files.i386 stable/9/sys/dev/nvd/nvd.c stable/9/sys/dev/nvme/nvme.c stable/9/sys/dev/nvme/nvme.h stable/9/sys/dev/nvme/nvme_ctrlr.c stable/9/sys/dev/nvme/nvme_ctrlr_cmd.c stable/9/sys/dev/nvme/nvme_ns.c stable/9/sys/dev/nvme/nvme_ns_cmd.c stable/9/sys/dev/nvme/nvme_private.h stable/9/sys/dev/nvme/nvme_qpair.c stable/9/sys/dev/nvme/nvme_sysctl.c stable/9/sys/dev/nvme/nvme_test.c stable/9/sys/i386/conf/NOTES stable/9/sys/modules/Makefile stable/9/sys/modules/nvme/Makefile Directory Properties: stable/9/etc/ (props changed) stable/9/etc/mtree/ (props changed) stable/9/include/ (props changed) stable/9/sbin/ (props changed) stable/9/sbin/nvmecontrol/ (props changed) stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/etc/mtree/BSD.include.dist ============================================================================== --- stable/9/etc/mtree/BSD.include.dist Tue Jun 25 23:30:48 2013 (r252221) +++ stable/9/etc/mtree/BSD.include.dist Tue Jun 25 23:52:39 2013 (r252222) @@ -126,6 +126,8 @@ mpilib .. .. + nvme + .. ofw .. pbio Modified: stable/9/include/Makefile ============================================================================== --- stable/9/include/Makefile Tue Jun 25 23:30:48 2013 (r252221) +++ stable/9/include/Makefile Tue Jun 25 23:52:39 2013 (r252222) @@ -44,8 +44,8 @@ LDIRS= bsm cam geom net net80211 netatal LSUBDIRS= cam/ata cam/scsi \ dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/filemon dev/firewire \ dev/hwpmc \ - dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/ofw \ - dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \ + dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/nvme \ + dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \ dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \ fs/devfs fs/fdescfs fs/fifofs fs/msdosfs fs/nfs fs/ntfs fs/nullfs \ ${_fs_nwfs} fs/portalfs fs/procfs fs/smbfs fs/udf fs/unionfs \ Modified: stable/9/sbin/Makefile.amd64 ============================================================================== --- stable/9/sbin/Makefile.amd64 Tue Jun 25 23:30:48 2013 (r252221) +++ stable/9/sbin/Makefile.amd64 Tue Jun 25 23:52:39 2013 (r252222) @@ -2,3 +2,4 @@ SUBDIR += bsdlabel SUBDIR += fdisk +SUBDIR += nvmecontrol Modified: stable/9/sbin/Makefile.i386 ============================================================================== --- stable/9/sbin/Makefile.i386 Tue Jun 25 23:30:48 2013 (r252221) +++ stable/9/sbin/Makefile.i386 Tue Jun 25 23:52:39 2013 (r252222) @@ -2,4 +2,5 @@ SUBDIR += bsdlabel SUBDIR += fdisk +SUBDIR += nvmecontrol SUBDIR += sconfig Modified: stable/9/sbin/nvmecontrol/nvmecontrol.8 ============================================================================== --- stable/9/sbin/nvmecontrol/nvmecontrol.8 Tue Jun 25 23:30:48 2013 (r252221) +++ stable/9/sbin/nvmecontrol/nvmecontrol.8 Tue Jun 25 23:52:39 2013 (r252222) @@ -33,7 +33,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 17, 2012 +.Dd March 26, 2013 .Dt NVMECONTROL 8 .Os .Sh NAME @@ -54,7 +54,10 @@ .Op Fl p .Aq Fl s Ar size_in_bytes .Aq Fl t Ar time_in_sec -.Aq device id +.Aq namespace id +.Nm +.Ic reset +.Aq controller id .Sh DESCRIPTION NVM Express (NVMe) is a storage protocol standard, for SSDs and other high-speed storage devices over PCI Express. @@ -62,6 +65,7 @@ high-speed storage devices over PCI Expr .Dl nvmecontrol devlist .Pp Display a list of NVMe controllers and namespaces along with their device nodes. +.Pp .Dl nvmecontrol identify nvme0 .Pp Display a human-readable summary of the nvme0 IDENTIFY_CONTROLLER data. @@ -77,6 +81,9 @@ Run a performance test on nvme0ns1 using thread will issue a single 512 byte read command. Results are printed to stdout when 30 seconds expires. .Pp +.Dl nvmecontrol reset nvme0 +.Pp +Perform a controller-level reset of the nvme0 controller. .Sh AUTHORS .An -nosplit .Nm Modified: stable/9/sbin/nvmecontrol/nvmecontrol.c ============================================================================== --- stable/9/sbin/nvmecontrol/nvmecontrol.c Tue Jun 25 23:30:48 2013 (r252221) +++ stable/9/sbin/nvmecontrol/nvmecontrol.c Tue Jun 25 23:52:39 2013 (r252222) @@ -56,6 +56,9 @@ __FBSDID("$FreeBSD$"); " <-i intr|wait> [-f refthread] [-p]\n" \ " \n" +#define RESET_USAGE \ +" nvmecontrol reset \n" + static void perftest_usage(void); static void @@ -64,6 +67,7 @@ usage(void) fprintf(stderr, "usage:\n"); fprintf(stderr, DEVLIST_USAGE); fprintf(stderr, IDENTIFY_USAGE); + fprintf(stderr, RESET_USAGE); fprintf(stderr, PERFTEST_USAGE); exit(EX_USAGE); } @@ -206,6 +210,53 @@ ns_get_sector_size(struct nvme_namespace return (1 << nsdata->lbaf[0].lbads); } +static void +read_controller_data(int fd, struct nvme_controller_data *cdata) +{ + struct nvme_pt_command pt; + + memset(&pt, 0, sizeof(pt)); + pt.cmd.opc = NVME_OPC_IDENTIFY; + pt.cmd.cdw10 = 1; + pt.buf = cdata; + pt.len = sizeof(*cdata); + pt.is_read = 1; + + if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) { + printf("Identify request failed. errno=%d (%s)\n", + errno, strerror(errno)); + exit(EX_IOERR); + } + + if (nvme_completion_is_error(&pt.cpl)) { + printf("Passthrough command returned error.\n"); + exit(EX_IOERR); + } +} + +static void +read_namespace_data(int fd, int nsid, struct nvme_namespace_data *nsdata) +{ + struct nvme_pt_command pt; + + memset(&pt, 0, sizeof(pt)); + pt.cmd.opc = NVME_OPC_IDENTIFY; + pt.cmd.nsid = nsid; + pt.buf = nsdata; + pt.len = sizeof(*nsdata); + pt.is_read = 1; + + if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) { + printf("Identify request failed. errno=%d (%s)\n", + errno, strerror(errno)); + exit(EX_IOERR); + } + + if (nvme_completion_is_error(&pt.cpl)) { + printf("Passthrough command returned error.\n"); + exit(EX_IOERR); + } +} static void devlist(int argc, char *argv[]) @@ -241,34 +292,18 @@ devlist(int argc, char *argv[]) fd = open(path, O_RDWR); if (fd < 0) { - printf("Could not open %s.\n", path); + printf("Could not open %s. errno=%d (%s)\n", path, + errno, strerror(errno)); exit_code = EX_NOPERM; continue; } - if (ioctl(fd, NVME_IDENTIFY_CONTROLLER, &cdata) == -1) { - printf("ioctl to %s failed.\n", path); - exit_code = EX_IOERR; - continue; - } - + read_controller_data(fd, &cdata); printf("%6s: %s\n", name, cdata.mn); for (i = 0; i < cdata.nn; i++) { sprintf(name, "nvme%dns%d", ctrlr, i+1); - sprintf(path, "/dev/%s", name); - - fd = open(path, O_RDWR); - if (fd < 0) { - printf("Could not open %s.\n", path); - exit_code = EX_NOPERM; - continue; - } - if (ioctl(fd, NVME_IDENTIFY_NAMESPACE, &nsdata) == -1) { - printf("ioctl to %s failed.\n", path); - exit_code = EX_IOERR; - continue; - } + read_namespace_data(fd, i+1, &nsdata); printf(" %10s (%lldGB)\n", name, nsdata.nsze * @@ -307,21 +342,20 @@ identify_ctrlr(int argc, char *argv[]) sprintf(path, "/dev/%s", argv[optind]); - if (stat(path, &devstat) != 0) { - printf("Invalid device node '%s'.\n", path); + if (stat(path, &devstat) < 0) { + printf("Invalid device node %s. errno=%d (%s)\n", path, errno, + strerror(errno)); exit(EX_IOERR); } fd = open(path, O_RDWR); if (fd < 0) { - printf("Could not open %s.\n", path); + printf("Could not open %s. errno=%d (%s)\n", path, errno, + strerror(errno)); exit(EX_NOPERM); } - if (ioctl(fd, NVME_IDENTIFY_CONTROLLER, &cdata) == -1) { - printf("ioctl to %s failed.\n", path); - exit(EX_IOERR); - } + read_controller_data(fd, &cdata); if (hexflag == 1) { if (verboseflag == 1) @@ -348,7 +382,8 @@ identify_ns(int argc, char *argv[]) struct nvme_namespace_data nsdata; struct stat devstat; char path[64]; - int ch, fd, hexflag = 0, hexlength; + char *nsloc; + int ch, fd, hexflag = 0, hexlength, nsid; int verboseflag = 0; while ((ch = getopt(argc, argv, "vx")) != -1) { @@ -364,23 +399,55 @@ identify_ns(int argc, char *argv[]) } } + /* + * Check if the specified device node exists before continuing. + * This is a cleaner check for cases where the correct controller + * is specified, but an invalid namespace on that controller. + */ sprintf(path, "/dev/%s", argv[optind]); + if (stat(path, &devstat) < 0) { + printf("Invalid device node %s. errno=%d (%s)\n", path, errno, + strerror(errno)); + exit(EX_IOERR); + } + + nsloc = strstr(argv[optind], "ns"); + if (nsloc == NULL) { + printf("Invalid namepsace %s.\n", argv[optind]); + exit(EX_IOERR); + } + + /* + * Pull the namespace id from the string. +2 skips past the "ns" part + * of the string. + */ + nsid = strtol(nsloc + 2, NULL, 10); + if (nsid == 0 && errno != 0) { + printf("Invalid namespace ID %s.\n", argv[optind]); + exit(EX_IOERR); + } - if (stat(path, &devstat) != 0) { - printf("Invalid device node '%s'.\n", path); + /* + * We send IDENTIFY commands to the controller, not the namespace, + * since it is an admin cmd. So the path should only include the + * nvmeX part of the nvmeXnsY string. + */ + sprintf(path, "/dev/"); + strncat(path, argv[optind], nsloc - argv[optind]); + if (stat(path, &devstat) < 0) { + printf("Invalid device node %s. errno=%d (%s)\n", path, errno, + strerror(errno)); exit(EX_IOERR); } fd = open(path, O_RDWR); if (fd < 0) { - printf("Could not open %s.\n", path); + printf("Could not open %s. errno=%d (%s)\n", path, errno, + strerror(errno)); exit(EX_NOPERM); } - if (ioctl(fd, NVME_IDENTIFY_NAMESPACE, &nsdata) == -1) { - printf("ioctl to %s failed.\n", path); - exit(EX_IOERR); - } + read_namespace_data(fd, nsid, &nsdata); if (hexflag == 1) { if (verboseflag == 1) @@ -423,7 +490,7 @@ identify(int argc, char *argv[]) optind = 1; /* - * If devicde node contains "ns", we consider it a namespace, + * If device node contains "ns", we consider it a namespace, * otherwise, consider it a controller. */ if (strstr(target, "ns") == NULL) @@ -475,7 +542,7 @@ perftest(int argc, char *argv[]) char path[64]; u_long ioctl_cmd = NVME_IO_TEST; bool nflag, oflag, sflag, tflag; - int err, perthread = 0; + int perthread = 0; nflag = oflag = sflag = tflag = false; name = NULL; @@ -565,14 +632,14 @@ perftest(int argc, char *argv[]) fd = open(path, O_RDWR); if (fd < 0) { - fprintf(stderr, "%s not valid device.\n", path); + fprintf(stderr, "%s not valid device. errno=%d (%s)\n", path, + errno, strerror(errno)); perftest_usage(); } - err = ioctl(fd, ioctl_cmd, &io_test); - - if (err) { - fprintf(stderr, "NVME_IO_TEST returned %d\n", errno); + if (ioctl(fd, ioctl_cmd, &io_test) < 0) { + fprintf(stderr, "NVME_IO_TEST failed. errno=%d (%s)\n", errno, + strerror(errno)); exit(EX_IOERR); } @@ -580,6 +647,44 @@ perftest(int argc, char *argv[]) exit(EX_OK); } +static void +reset_ctrlr(int argc, char *argv[]) +{ + struct stat devstat; + char path[64]; + int ch, fd; + + while ((ch = getopt(argc, argv, "")) != -1) { + switch ((char)ch) { + default: + usage(); + } + } + + sprintf(path, "/dev/%s", argv[optind]); + + if (stat(path, &devstat) < 0) { + printf("Invalid device node %s. errno=%d (%s)\n", path, errno, + strerror(errno)); + exit(EX_IOERR); + } + + fd = open(path, O_RDWR); + if (fd < 0) { + printf("Could not open %s. errno=%d (%s)\n", path, errno, + strerror(errno)); + exit(EX_NOPERM); + } + + if (ioctl(fd, NVME_RESET_CONTROLLER) < 0) { + printf("Reset request to %s failed. errno=%d (%s)\n", path, + errno, strerror(errno)); + exit(EX_IOERR); + } + + exit(EX_OK); +} + int main(int argc, char *argv[]) { @@ -593,6 +698,8 @@ main(int argc, char *argv[]) identify(argc-1, &argv[1]); else if (strcmp(argv[1], "perftest") == 0) perftest(argc-1, &argv[1]); + else if (strcmp(argv[1], "reset") == 0) + reset_ctrlr(argc-1, &argv[1]); usage(); Modified: stable/9/sys/amd64/conf/NOTES ============================================================================== --- stable/9/sys/amd64/conf/NOTES Tue Jun 25 23:30:48 2013 (r252221) +++ stable/9/sys/amd64/conf/NOTES Tue Jun 25 23:52:39 2013 (r252222) @@ -433,6 +433,11 @@ device isci options ISCI_LOGGING # enable debugging in isci HAL # +# NVM Express (NVMe) support +device nvme # base NVMe driver +device nvd # expose NVMe namespaces as disks, depends on nvme + +# # SafeNet crypto driver: can be moved to the MI NOTES as soon as # it's tested on a big-endian machine # Modified: stable/9/sys/conf/files.amd64 ============================================================================== --- stable/9/sys/conf/files.amd64 Tue Jun 25 23:30:48 2013 (r252221) +++ stable/9/sys/conf/files.amd64 Tue Jun 25 23:52:39 2013 (r252222) @@ -213,7 +213,16 @@ dev/kbd/kbd.c optional atkbd | sc | uk dev/lindev/full.c optional lindev dev/lindev/lindev.c optional lindev dev/nfe/if_nfe.c optional nfe pci +dev/nvd/nvd.c optional nvd nvme dev/nve/if_nve.c optional nve pci +dev/nvme/nvme.c optional nvme +dev/nvme/nvme_ctrlr.c optional nvme +dev/nvme/nvme_ctrlr_cmd.c optional nvme +dev/nvme/nvme_ns.c optional nvme +dev/nvme/nvme_ns_cmd.c optional nvme +dev/nvme/nvme_qpair.c optional nvme +dev/nvme/nvme_sysctl.c optional nvme +dev/nvme/nvme_test.c optional nvme dev/nvram/nvram.c optional nvram isa dev/random/ivy.c optional random rdrand_rng dev/random/nehemiah.c optional random padlock_rng Modified: stable/9/sys/conf/files.i386 ============================================================================== --- stable/9/sys/conf/files.i386 Tue Jun 25 23:30:48 2013 (r252221) +++ stable/9/sys/conf/files.i386 Tue Jun 25 23:52:39 2013 (r252222) @@ -222,7 +222,16 @@ dev/lindev/lindev.c optional lindev dev/mse/mse.c optional mse dev/mse/mse_isa.c optional mse isa dev/nfe/if_nfe.c optional nfe pci +dev/nvd/nvd.c optional nvd nvme dev/nve/if_nve.c optional nve pci +dev/nvme/nvme.c optional nvme +dev/nvme/nvme_ctrlr.c optional nvme +dev/nvme/nvme_ctrlr_cmd.c optional nvme +dev/nvme/nvme_ns.c optional nvme +dev/nvme/nvme_ns_cmd.c optional nvme +dev/nvme/nvme_qpair.c optional nvme +dev/nvme/nvme_sysctl.c optional nvme +dev/nvme/nvme_test.c optional nvme dev/nvram/nvram.c optional nvram isa dev/pcf/pcf_isa.c optional pcf dev/random/ivy.c optional random rdrand_rng Modified: stable/9/sys/dev/nvd/nvd.c ============================================================================== --- stable/9/sys/dev/nvd/nvd.c Tue Jun 25 23:30:48 2013 (r252221) +++ stable/9/sys/dev/nvd/nvd.c Tue Jun 25 23:52:39 2013 (r252222) @@ -45,9 +45,12 @@ struct nvd_disk; static disk_ioctl_t nvd_ioctl; static disk_strategy_t nvd_strategy; -static void create_geom_disk(void *, struct nvme_namespace *ns); +static void *nvd_new_disk(struct nvme_namespace *ns, void *ctrlr); static void destroy_geom_disk(struct nvd_disk *ndisk); +static void *nvd_new_controller(struct nvme_controller *ctrlr); +static void nvd_controller_fail(void *ctrlr); + static int nvd_load(void); static void nvd_unload(void); @@ -67,10 +70,18 @@ struct nvd_disk { uint32_t cur_depth; - TAILQ_ENTRY(nvd_disk) tailq; + TAILQ_ENTRY(nvd_disk) global_tailq; + TAILQ_ENTRY(nvd_disk) ctrlr_tailq; +}; + +struct nvd_controller { + + TAILQ_ENTRY(nvd_controller) tailq; + TAILQ_HEAD(, nvd_disk) disk_head; }; -TAILQ_HEAD(, nvd_disk) nvd_head; +static TAILQ_HEAD(, nvd_controller) ctrlr_head; +static TAILQ_HEAD(disk_list, nvd_disk) disk_head; static int nvd_modevent(module_t mod, int type, void *arg) { @@ -104,8 +115,11 @@ static int nvd_load() { - TAILQ_INIT(&nvd_head); - consumer_handle = nvme_register_consumer(create_geom_disk, NULL); + TAILQ_INIT(&ctrlr_head); + TAILQ_INIT(&disk_head); + + consumer_handle = nvme_register_consumer(nvd_new_disk, + nvd_new_controller, NULL, nvd_controller_fail); return (consumer_handle != NULL ? 0 : -1); } @@ -113,13 +127,20 @@ nvd_load() static void nvd_unload() { - struct nvd_disk *nvd; + struct nvd_controller *ctrlr; + struct nvd_disk *disk; + + while (!TAILQ_EMPTY(&ctrlr_head)) { + ctrlr = TAILQ_FIRST(&ctrlr_head); + TAILQ_REMOVE(&ctrlr_head, ctrlr, tailq); + free(ctrlr, M_NVD); + } - while (!TAILQ_EMPTY(&nvd_head)) { - nvd = TAILQ_FIRST(&nvd_head); - TAILQ_REMOVE(&nvd_head, nvd, tailq); - destroy_geom_disk(nvd); - free(nvd, M_NVD); + while (!TAILQ_EMPTY(&disk_head)) { + disk = TAILQ_FIRST(&disk_head); + TAILQ_REMOVE(&disk_head, disk, global_tailq); + destroy_geom_disk(disk); + free(disk, M_NVD); } nvme_unregister_consumer(consumer_handle); @@ -153,7 +174,7 @@ nvd_ioctl(struct disk *ndisk, u_long cmd } static void -nvd_done(void *arg, const struct nvme_completion *status) +nvd_done(void *arg, const struct nvme_completion *cpl) { struct bio *bp; struct nvd_disk *ndisk; @@ -162,14 +183,13 @@ nvd_done(void *arg, const struct nvme_co ndisk = bp->bio_disk->d_drv1; - if (atomic_fetchadd_int(&ndisk->cur_depth, -1) == NVME_QD) - taskqueue_enqueue(ndisk->tq, &ndisk->bioqtask); + atomic_add_int(&ndisk->cur_depth, -1); /* * TODO: add more extensive translation of NVMe status codes * to different bio error codes (i.e. EIO, EINVAL, etc.) */ - if (status->sf_sc || status->sf_sct) { + if (nvme_completion_is_error(cpl)) { bp->bio_error = EIO; bp->bio_flags |= BIO_ERROR; bp->bio_resid = bp->bio_bcount; @@ -187,9 +207,6 @@ nvd_bioq_process(void *arg, int pending) int err; for (;;) { - if (atomic_load_acq_int(&ndisk->cur_depth) >= NVME_QD) - break; - mtx_lock(&ndisk->bioqlock); bp = bioq_takefirst(&ndisk->bioq); mtx_unlock(&ndisk->bioqlock); @@ -210,13 +227,13 @@ nvd_bioq_process(void *arg, int pending) #endif bp->bio_driver1 = NULL; - atomic_add_acq_int(&ndisk->cur_depth, 1); + atomic_add_int(&ndisk->cur_depth, 1); err = nvme_ns_bio_process(ndisk->ns, bp, nvd_done); if (err) { - atomic_add_acq_int(&ndisk->cur_depth, -1); - bp->bio_error = EIO; + atomic_add_int(&ndisk->cur_depth, -1); + bp->bio_error = err; bp->bio_flags |= BIO_ERROR; bp->bio_resid = bp->bio_bcount; biodone(bp); @@ -237,13 +254,28 @@ nvd_bioq_process(void *arg, int pending) } } -static void -create_geom_disk(void *arg, struct nvme_namespace *ns) +static void * +nvd_new_controller(struct nvme_controller *ctrlr) { - struct nvd_disk *ndisk; - struct disk *disk; + struct nvd_controller *nvd_ctrlr; + + nvd_ctrlr = malloc(sizeof(struct nvd_controller), M_NVD, + M_ZERO | M_WAITOK); - ndisk = malloc(sizeof(struct nvd_disk), M_NVD, M_ZERO | M_NOWAIT); + TAILQ_INIT(&nvd_ctrlr->disk_head); + TAILQ_INSERT_TAIL(&ctrlr_head, nvd_ctrlr, tailq); + + return (nvd_ctrlr); +} + +static void * +nvd_new_disk(struct nvme_namespace *ns, void *ctrlr_arg) +{ + struct nvd_disk *ndisk; + struct disk *disk; + struct nvd_controller *ctrlr = ctrlr_arg; + + ndisk = malloc(sizeof(struct nvd_disk), M_NVD, M_ZERO | M_WAITOK); disk = disk_alloc(); disk->d_strategy = nvd_strategy; @@ -255,10 +287,11 @@ create_geom_disk(void *arg, struct nvme_ disk->d_sectorsize = nvme_ns_get_sector_size(ns); disk->d_mediasize = (off_t)nvme_ns_get_size(ns); - if (TAILQ_EMPTY(&nvd_head)) + if (TAILQ_EMPTY(&disk_head)) disk->d_unit = 0; else - disk->d_unit = TAILQ_FIRST(&nvd_head)->disk->d_unit + 1; + disk->d_unit = + TAILQ_LAST(&disk_head, disk_list)->disk->d_unit + 1; disk->d_flags = 0; @@ -268,6 +301,11 @@ create_geom_disk(void *arg, struct nvme_ if (nvme_ns_get_flags(ns) & NVME_NS_FLUSH_SUPPORTED) disk->d_flags |= DISKFLAG_CANFLUSHCACHE; +/* ifdef used here to ease porting to stable branches at a later point. */ +#ifdef DISKFLAG_UNMAPPED_BIO + disk->d_flags |= DISKFLAG_UNMAPPED_BIO; +#endif + strlcpy(disk->d_ident, nvme_ns_get_serial_number(ns), sizeof(disk->d_ident)); @@ -290,7 +328,10 @@ create_geom_disk(void *arg, struct nvme_ taskqueue_thread_enqueue, &ndisk->tq); taskqueue_start_threads(&ndisk->tq, 1, PI_DISK, "nvd taskq"); - TAILQ_INSERT_HEAD(&nvd_head, ndisk, tailq); + TAILQ_INSERT_TAIL(&disk_head, ndisk, global_tailq); + TAILQ_INSERT_TAIL(&ctrlr->disk_head, ndisk, ctrlr_tailq); + + return (NULL); } static void @@ -316,3 +357,22 @@ destroy_geom_disk(struct nvd_disk *ndisk mtx_destroy(&ndisk->bioqlock); } + +static void +nvd_controller_fail(void *ctrlr_arg) +{ + struct nvd_controller *ctrlr = ctrlr_arg; + struct nvd_disk *disk; + + while (!TAILQ_EMPTY(&ctrlr->disk_head)) { + disk = TAILQ_FIRST(&ctrlr->disk_head); + TAILQ_REMOVE(&disk_head, disk, global_tailq); + TAILQ_REMOVE(&ctrlr->disk_head, disk, ctrlr_tailq); + destroy_geom_disk(disk); + free(disk, M_NVD); + } + + TAILQ_REMOVE(&ctrlr_head, ctrlr, tailq); + free(ctrlr, M_NVD); +} + Modified: stable/9/sys/dev/nvme/nvme.c ============================================================================== --- stable/9/sys/dev/nvme/nvme.c Tue Jun 25 23:30:48 2013 (r252221) +++ stable/9/sys/dev/nvme/nvme.c Tue Jun 25 23:52:39 2013 (r252222) @@ -32,22 +32,33 @@ __FBSDID("$FreeBSD$"); #include #include +#include + +#include #include #include "nvme_private.h" struct nvme_consumer { - nvme_consumer_cb_fn_t cb_fn; - void *cb_arg; + uint32_t id; + nvme_cons_ns_fn_t ns_fn; + nvme_cons_ctrlr_fn_t ctrlr_fn; + nvme_cons_async_fn_t async_fn; + nvme_cons_fail_fn_t fail_fn; }; struct nvme_consumer nvme_consumer[NVME_MAX_CONSUMERS]; +#define INVALID_CONSUMER_ID 0xFFFF + +uma_zone_t nvme_request_zone; +int32_t nvme_retry_count; MALLOC_DEFINE(M_NVME, "nvme", "nvme(4) memory allocations"); static int nvme_probe(device_t); static int nvme_attach(device_t); static int nvme_detach(device_t); +static int nvme_modevent(module_t mod, int type, void *arg); static devclass_t nvme_devclass; @@ -65,7 +76,7 @@ static driver_t nvme_pci_driver = { sizeof(struct nvme_controller), }; -DRIVER_MODULE(nvme, pci, nvme_pci_driver, nvme_devclass, 0, 0); +DRIVER_MODULE(nvme, pci, nvme_pci_driver, nvme_devclass, nvme_modevent, 0); MODULE_VERSION(nvme, 1); static struct _pcsid @@ -75,15 +86,19 @@ static struct _pcsid } pci_ids[] = { { 0x01118086, "NVMe Controller" }, { CHATHAM_PCI_ID, "Chatham Prototype NVMe Controller" }, - { IDT_PCI_ID, "IDT NVMe Controller" }, + { IDT32_PCI_ID, "IDT NVMe Controller (32 channel)" }, + { IDT8_PCI_ID, "IDT NVMe Controller (8 channel)" }, { 0x00000000, NULL } }; static int nvme_probe (device_t device) { - u_int32_t type = pci_get_devid(device); - struct _pcsid *ep = pci_ids; + struct _pcsid *ep; + u_int32_t type; + + type = pci_get_devid(device); + ep = pci_ids; while (ep->type && ep->type != type) ++ep; @@ -91,11 +106,43 @@ nvme_probe (device_t device) if (ep->desc) { device_set_desc(device, ep->desc); return (BUS_PROBE_DEFAULT); - } else - return (ENXIO); + } + +#if defined(PCIS_STORAGE_NVM) + if (pci_get_class(device) == PCIC_STORAGE && + pci_get_subclass(device) == PCIS_STORAGE_NVM && + pci_get_progif(device) == PCIP_STORAGE_NVM_ENTERPRISE_NVMHCI_1_0) { + device_set_desc(device, "Generic NVMe Device"); + return (BUS_PROBE_GENERIC); + } +#endif + + return (ENXIO); } static void +nvme_init(void) +{ + uint32_t i; + + nvme_request_zone = uma_zcreate("nvme_request", + sizeof(struct nvme_request), NULL, NULL, NULL, NULL, 0, 0); + + for (i = 0; i < NVME_MAX_CONSUMERS; i++) + nvme_consumer[i].id = INVALID_CONSUMER_ID; +} + +SYSINIT(nvme_register, SI_SUB_DRIVERS, SI_ORDER_SECOND, nvme_init, NULL); + +static void +nvme_uninit(void) +{ + uma_zdestroy(nvme_request_zone); +} + +SYSUNINIT(nvme_unregister, SI_SUB_DRIVERS, SI_ORDER_SECOND, nvme_uninit, NULL); + +static void nvme_load(void) { } @@ -160,24 +207,14 @@ nvme_modevent(module_t mod, int type, vo return (0); } -moduledata_t nvme_mod = { - "nvme", - (modeventhand_t)nvme_modevent, - 0 -}; - -DECLARE_MODULE(nvme, nvme_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); - void nvme_dump_command(struct nvme_command *cmd) { - printf("opc:%x f:%x r1:%x cid:%x nsid:%x r2:%x r3:%x " - "mptr:%qx prp1:%qx prp2:%qx cdw:%x %x %x %x %x %x\n", + printf( +"opc:%x f:%x r1:%x cid:%x nsid:%x r2:%x r3:%x mptr:%jx prp1:%jx prp2:%jx cdw:%x %x %x %x %x %x\n", cmd->opc, cmd->fuse, cmd->rsvd1, cmd->cid, cmd->nsid, cmd->rsvd2, cmd->rsvd3, - (long long unsigned int)cmd->mptr, - (long long unsigned int)cmd->prp1, - (long long unsigned int)cmd->prp2, + (uintmax_t)cmd->mptr, (uintmax_t)cmd->prp1, (uintmax_t)cmd->prp2, cmd->cdw10, cmd->cdw11, cmd->cdw12, cmd->cdw13, cmd->cdw14, cmd->cdw15); } @@ -188,87 +225,8 @@ nvme_dump_completion(struct nvme_complet printf("cdw0:%08x sqhd:%04x sqid:%04x " "cid:%04x p:%x sc:%02x sct:%x m:%x dnr:%x\n", cpl->cdw0, cpl->sqhd, cpl->sqid, - cpl->cid, cpl->p, cpl->sf_sc, cpl->sf_sct, cpl->sf_m, - cpl->sf_dnr); -} - -void -nvme_payload_map(void *arg, bus_dma_segment_t *seg, int nseg, int error) -{ - struct nvme_tracker *tr; - struct nvme_qpair *qpair; - struct nvme_prp_list *prp_list; - uint32_t cur_nseg; - - KASSERT(error == 0, ("nvme_payload_map error != 0\n")); - - tr = (struct nvme_tracker *)arg; - qpair = tr->qpair; - - /* - * Note that we specified PAGE_SIZE for alignment and max - * segment size when creating the bus dma tags. So here - * we can safely just transfer each segment to its - * associated PRP entry. - */ - tr->cmd.prp1 = seg[0].ds_addr; - - if (nseg == 2) { - tr->cmd.prp2 = seg[1].ds_addr; - } else if (nseg > 2) { - KASSERT(tr->prp_list, - ("prp_list needed but not attached to tracker\n")); - cur_nseg = 1; - prp_list = tr->prp_list; - tr->cmd.prp2 = (uint64_t)prp_list->bus_addr; - while (cur_nseg < nseg) { - prp_list->prp[cur_nseg-1] = - (uint64_t)seg[cur_nseg].ds_addr; - cur_nseg++; - } - } - - nvme_qpair_submit_cmd(qpair, tr); -} - -struct nvme_tracker * -nvme_allocate_tracker(struct nvme_controller *ctrlr, boolean_t is_admin, - nvme_cb_fn_t cb_fn, void *cb_arg, uint32_t payload_size, void *payload) -{ - struct nvme_tracker *tr; - struct nvme_qpair *qpair; - uint32_t modulo, offset, num_prps; - boolean_t alloc_prp_list = FALSE; - - if (is_admin) { - qpair = &ctrlr->adminq; - } else { - if (ctrlr->per_cpu_io_queues) - qpair = &ctrlr->ioq[curcpu]; - else - qpair = &ctrlr->ioq[0]; - } - - num_prps = payload_size / PAGE_SIZE; - modulo = payload_size % PAGE_SIZE; - offset = (uint32_t)((uintptr_t)payload % PAGE_SIZE); - - if (modulo || offset) - num_prps += 1 + (modulo + offset - 1) / PAGE_SIZE; - - if (num_prps > 2) - alloc_prp_list = TRUE; - - tr = nvme_qpair_allocate_tracker(qpair, alloc_prp_list); - - memset(&tr->cmd, 0, sizeof(tr->cmd)); - - tr->qpair = qpair; - tr->cb_fn = cb_fn; - tr->cb_arg = cb_arg; - tr->payload_size = payload_size; - - return (tr); + cpl->cid, cpl->status.p, cpl->status.sc, cpl->status.sct, + cpl->status.m, cpl->status.dnr); } static int @@ -287,15 +245,17 @@ nvme_attach(device_t dev) * to cc.en==0. This is because we don't really know what status * the controller was left in when boot handed off to OS. */ - status = nvme_ctrlr_reset(ctrlr); + status = nvme_ctrlr_hw_reset(ctrlr); if (status != 0) return (status); - status = nvme_ctrlr_reset(ctrlr); + status = nvme_ctrlr_hw_reset(ctrlr); if (status != 0) return (status); - ctrlr->config_hook.ich_func = nvme_ctrlr_start; + nvme_sysctl_initialize_ctrlr(ctrlr); + + ctrlr->config_hook.ich_func = nvme_ctrlr_start_config_hook; ctrlr->config_hook.ich_arg = ctrlr; config_intrhook_establish(&ctrlr->config_hook); @@ -307,77 +267,75 @@ static int nvme_detach (device_t dev) { struct nvme_controller *ctrlr = DEVICE2SOFTC(dev); - struct nvme_namespace *ns; - int i; - - if (ctrlr->taskqueue) { - taskqueue_drain(ctrlr->taskqueue, &ctrlr->task); - taskqueue_free(ctrlr->taskqueue); - } - - for (i = 0; i < NVME_MAX_NAMESPACES; i++) { - ns = &ctrlr->ns[i]; - if (ns->cdev) - destroy_dev(ns->cdev); - } - - if (ctrlr->cdev) - destroy_dev(ctrlr->cdev); - - for (i = 0; i < ctrlr->num_io_queues; i++) { - nvme_io_qpair_destroy(&ctrlr->ioq[i]); - } - - free(ctrlr->ioq, M_NVME); - - nvme_admin_qpair_destroy(&ctrlr->adminq); - - if (ctrlr->resource != NULL) { - bus_release_resource(dev, SYS_RES_MEMORY, - ctrlr->resource_id, ctrlr->resource); - } - -#ifdef CHATHAM2 - if (ctrlr->chatham_resource != NULL) { - bus_release_resource(dev, SYS_RES_MEMORY, - ctrlr->chatham_resource_id, ctrlr->chatham_resource); - } -#endif - - if (ctrlr->tag) - bus_teardown_intr(ctrlr->dev, ctrlr->res, ctrlr->tag); - - if (ctrlr->res) - bus_release_resource(ctrlr->dev, SYS_RES_IRQ, - rman_get_rid(ctrlr->res), ctrlr->res); - - if (ctrlr->msix_enabled) - pci_release_msi(dev); + nvme_ctrlr_destruct(ctrlr, dev); return (0); } static void -nvme_notify_consumer(struct nvme_consumer *consumer) +nvme_notify_consumer(struct nvme_consumer *cons) { device_t *devlist; struct nvme_controller *ctrlr; - int dev, ns, devcount; + struct nvme_namespace *ns; + void *ctrlr_cookie; + int dev_idx, ns_idx, devcount; if (devclass_get_devices(nvme_devclass, &devlist, &devcount)) return; - for (dev = 0; dev < devcount; dev++) { - ctrlr = DEVICE2SOFTC(devlist[dev]); - for (ns = 0; ns < ctrlr->cdata.nn; ns++) - (*consumer->cb_fn)(consumer->cb_arg, &ctrlr->ns[ns]); + for (dev_idx = 0; dev_idx < devcount; dev_idx++) { + ctrlr = DEVICE2SOFTC(devlist[dev_idx]); + if (cons->ctrlr_fn != NULL) + ctrlr_cookie = (*cons->ctrlr_fn)(ctrlr); + else + ctrlr_cookie = NULL; + ctrlr->cons_cookie[cons->id] = ctrlr_cookie; + for (ns_idx = 0; ns_idx < ctrlr->cdata.nn; ns_idx++) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Tue Jun 25 23:59:19 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 660ACC90; Tue, 25 Jun 2013 23:59:19 +0000 (UTC) (envelope-from jim.harris@gmail.com) Received: from mail-ee0-x232.google.com (mail-ee0-x232.google.com [IPv6:2a00:1450:4013:c00::232]) by mx1.freebsd.org (Postfix) with ESMTP id 139511D1D; Tue, 25 Jun 2013 23:59:17 +0000 (UTC) Received: by mail-ee0-f50.google.com with SMTP id d49so7154630eek.9 for ; Tue, 25 Jun 2013 16:59:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=h1jMWxMYonGZ+2X3HlKHXNsJnMiwQWs6C42p3LjUSYs=; b=PlJRJuDxfPC/vI6Bz6zp2v00UjtiQT9GKy1wvQxnFecoYXE1Yc8t7NwRBwxABEbVF6 19ihcQDhByUVLFVOc/EhBM6pt6+G14DZYUf/JKB/mBP6j06aySzb20lWyOUvm6MwXBLh 9wzuMb82fQ+IxaIQ+FugtR8cYwt9BvzxIXitr4EOEYWswNstsNX14hFEzLftn9qQcpau +yagX3jlOUB6uZXFTIZhX+UZiGhczW9av5/pUuTB6jXASf+0SFXMgKJvv7kfFI6V3q9m HrjOasXkODT7PPHMMiviyGHqxxHjHxHwbXIIaU+62wp3WQLeFZ/uS7ckNUX1uup5deKv 9VWg== MIME-Version: 1.0 X-Received: by 10.15.36.72 with SMTP id h48mr1317282eev.33.1372204756604; Tue, 25 Jun 2013 16:59:16 -0700 (PDT) Received: by 10.15.25.7 with HTTP; Tue, 25 Jun 2013 16:59:16 -0700 (PDT) In-Reply-To: <201306252352.r5PNqecx003637@svn.freebsd.org> References: <201306252352.r5PNqecx003637@svn.freebsd.org> Date: Tue, 25 Jun 2013 16:59:16 -0700 Message-ID: Subject: Re: svn commit: r252222 - in stable/9: etc/mtree include sbin sbin/nvmecontrol sys/amd64/conf sys/conf sys/dev/nvd sys/dev/nvme sys/i386/conf sys/modules sys/modules/nvme From: Jim Harris To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jun 2013 23:59:19 -0000 On Tue, Jun 25, 2013 at 4:52 PM, Jim Harris wrote: > Author: jimharris > Date: Tue Jun 25 23:52:39 2013 > New Revision: 252222 > URL: http://svnweb.freebsd.org/changeset/base/252222 > > Log: > 240618, 240621, 240633, 240671, 240672, 240697, 240700, 241433, > 241434, 241657, 241658, 241659, 241660, 241661, 241662, 241663, > 241664, 241665, 241689, 242420, 243951, 244410, 244411, 244413, > 244549, 245136, 247963, 248729, 248730, 248731, 248732, 248733, > 248734, 248735, 248736, 248737, 248738, 248739, 248740, 248741, > 248746, 248747, 248748, 248749, 248754, 248755, 248756, 248757, > 248758, 248759, 248760, 248761, 248762, 248763, 248764, 248765, > 248766, 248767, 248768, 248769, 248770, 248771, 248772, 248773, > 248780, 248834, 248835, 248913, 248977, 249067, 249416, 249417, > 249418, 249419, 249420, 249421, 249422, 249432 > > Bad commit message obviously. Following up with a forced commit for the complete commit message. > Deleted: > stable/9/sys/dev/nvme/nvme_uio.c > Modified: > stable/9/etc/mtree/BSD.include.dist > stable/9/include/Makefile > stable/9/sbin/Makefile.amd64 > stable/9/sbin/Makefile.i386 > stable/9/sbin/nvmecontrol/nvmecontrol.8 > stable/9/sbin/nvmecontrol/nvmecontrol.c > stable/9/sys/amd64/conf/NOTES > stable/9/sys/conf/files.amd64 > stable/9/sys/conf/files.i386 > stable/9/sys/dev/nvd/nvd.c > stable/9/sys/dev/nvme/nvme.c > stable/9/sys/dev/nvme/nvme.h > stable/9/sys/dev/nvme/nvme_ctrlr.c > stable/9/sys/dev/nvme/nvme_ctrlr_cmd.c > stable/9/sys/dev/nvme/nvme_ns.c > stable/9/sys/dev/nvme/nvme_ns_cmd.c > stable/9/sys/dev/nvme/nvme_private.h > stable/9/sys/dev/nvme/nvme_qpair.c > stable/9/sys/dev/nvme/nvme_sysctl.c > stable/9/sys/dev/nvme/nvme_test.c > stable/9/sys/i386/conf/NOTES > stable/9/sys/modules/Makefile > stable/9/sys/modules/nvme/Makefile > Directory Properties: > stable/9/etc/ (props changed) > stable/9/etc/mtree/ (props changed) > stable/9/include/ (props changed) > stable/9/sbin/ (props changed) > stable/9/sbin/nvmecontrol/ (props changed) > stable/9/sys/ (props changed) > stable/9/sys/conf/ (props changed) > stable/9/sys/dev/ (props changed) > stable/9/sys/modules/ (props changed) > > Modified: stable/9/etc/mtree/BSD.include.dist > > ============================================================================== > --- stable/9/etc/mtree/BSD.include.dist Tue Jun 25 23:30:48 2013 > (r252221) > +++ stable/9/etc/mtree/BSD.include.dist Tue Jun 25 23:52:39 2013 > (r252222) > @@ -126,6 +126,8 @@ > mpilib > .. > .. > + nvme > + .. > ofw > .. > pbio > > Modified: stable/9/include/Makefile > > ============================================================================== > --- stable/9/include/Makefile Tue Jun 25 23:30:48 2013 (r252221) > +++ stable/9/include/Makefile Tue Jun 25 23:52:39 2013 (r252222) > @@ -44,8 +44,8 @@ LDIRS= bsm cam geom net net80211 netatal > LSUBDIRS= cam/ata cam/scsi \ > dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/filemon > dev/firewire \ > dev/hwpmc \ > - dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/ofw \ > - dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \ > + dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/nvme \ > + dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus > dev/smbus \ > dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \ > fs/devfs fs/fdescfs fs/fifofs fs/msdosfs fs/nfs fs/ntfs fs/nullfs \ > ${_fs_nwfs} fs/portalfs fs/procfs fs/smbfs fs/udf fs/unionfs \ > > Modified: stable/9/sbin/Makefile.amd64 > > ============================================================================== > --- stable/9/sbin/Makefile.amd64 Tue Jun 25 23:30:48 2013 > (r252221) > +++ stable/9/sbin/Makefile.amd64 Tue Jun 25 23:52:39 2013 > (r252222) > @@ -2,3 +2,4 @@ > > SUBDIR += bsdlabel > SUBDIR += fdisk > +SUBDIR += nvmecontrol > > Modified: stable/9/sbin/Makefile.i386 > > ============================================================================== > --- stable/9/sbin/Makefile.i386 Tue Jun 25 23:30:48 2013 (r252221) > +++ stable/9/sbin/Makefile.i386 Tue Jun 25 23:52:39 2013 (r252222) > @@ -2,4 +2,5 @@ > > SUBDIR += bsdlabel > SUBDIR += fdisk > +SUBDIR += nvmecontrol > SUBDIR += sconfig > > Modified: stable/9/sbin/nvmecontrol/nvmecontrol.8 > > ============================================================================== > --- stable/9/sbin/nvmecontrol/nvmecontrol.8 Tue Jun 25 23:30:48 2013 > (r252221) > +++ stable/9/sbin/nvmecontrol/nvmecontrol.8 Tue Jun 25 23:52:39 2013 > (r252222) > @@ -33,7 +33,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd September 17, 2012 > +.Dd March 26, 2013 > .Dt NVMECONTROL 8 > .Os > .Sh NAME > @@ -54,7 +54,10 @@ > .Op Fl p > .Aq Fl s Ar size_in_bytes > .Aq Fl t Ar time_in_sec > -.Aq device id > +.Aq namespace id > +.Nm > +.Ic reset > +.Aq controller id > .Sh DESCRIPTION > NVM Express (NVMe) is a storage protocol standard, for SSDs and other > high-speed storage devices over PCI Express. > @@ -62,6 +65,7 @@ high-speed storage devices over PCI Expr > .Dl nvmecontrol devlist > .Pp > Display a list of NVMe controllers and namespaces along with their device > nodes. > +.Pp > .Dl nvmecontrol identify nvme0 > .Pp > Display a human-readable summary of the nvme0 IDENTIFY_CONTROLLER data. > @@ -77,6 +81,9 @@ Run a performance test on nvme0ns1 using > thread will issue a single 512 byte read command. Results are printed to > stdout when 30 seconds expires. > .Pp > +.Dl nvmecontrol reset nvme0 > +.Pp > +Perform a controller-level reset of the nvme0 controller. > .Sh AUTHORS > .An -nosplit > .Nm > > Modified: stable/9/sbin/nvmecontrol/nvmecontrol.c > > ============================================================================== > --- stable/9/sbin/nvmecontrol/nvmecontrol.c Tue Jun 25 23:30:48 2013 > (r252221) > +++ stable/9/sbin/nvmecontrol/nvmecontrol.c Tue Jun 25 23:52:39 2013 > (r252222) > @@ -56,6 +56,9 @@ __FBSDID("$FreeBSD$"); > " <-i intr|wait> [-f refthread] [-p]\n" > \ > " \n" > > +#define RESET_USAGE > \ > +" nvmecontrol reset \n" > + > static void perftest_usage(void); > > static void > @@ -64,6 +67,7 @@ usage(void) > fprintf(stderr, "usage:\n"); > fprintf(stderr, DEVLIST_USAGE); > fprintf(stderr, IDENTIFY_USAGE); > + fprintf(stderr, RESET_USAGE); > fprintf(stderr, PERFTEST_USAGE); > exit(EX_USAGE); > } > @@ -206,6 +210,53 @@ ns_get_sector_size(struct nvme_namespace > return (1 << nsdata->lbaf[0].lbads); > } > > +static void > +read_controller_data(int fd, struct nvme_controller_data *cdata) > +{ > + struct nvme_pt_command pt; > + > + memset(&pt, 0, sizeof(pt)); > + pt.cmd.opc = NVME_OPC_IDENTIFY; > + pt.cmd.cdw10 = 1; > + pt.buf = cdata; > + pt.len = sizeof(*cdata); > + pt.is_read = 1; > + > + if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) { > + printf("Identify request failed. errno=%d (%s)\n", > + errno, strerror(errno)); > + exit(EX_IOERR); > + } > + > + if (nvme_completion_is_error(&pt.cpl)) { > + printf("Passthrough command returned error.\n"); > + exit(EX_IOERR); > + } > +} > + > +static void > +read_namespace_data(int fd, int nsid, struct nvme_namespace_data *nsdata) > +{ > + struct nvme_pt_command pt; > + > + memset(&pt, 0, sizeof(pt)); > + pt.cmd.opc = NVME_OPC_IDENTIFY; > + pt.cmd.nsid = nsid; > + pt.buf = nsdata; > + pt.len = sizeof(*nsdata); > + pt.is_read = 1; > + > + if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) { > + printf("Identify request failed. errno=%d (%s)\n", > + errno, strerror(errno)); > + exit(EX_IOERR); > + } > + > + if (nvme_completion_is_error(&pt.cpl)) { > + printf("Passthrough command returned error.\n"); > + exit(EX_IOERR); > + } > +} > > static void > devlist(int argc, char *argv[]) > @@ -241,34 +292,18 @@ devlist(int argc, char *argv[]) > > fd = open(path, O_RDWR); > if (fd < 0) { > - printf("Could not open %s.\n", path); > + printf("Could not open %s. errno=%d (%s)\n", path, > + errno, strerror(errno)); > exit_code = EX_NOPERM; > continue; > } > > - if (ioctl(fd, NVME_IDENTIFY_CONTROLLER, &cdata) == -1) { > - printf("ioctl to %s failed.\n", path); > - exit_code = EX_IOERR; > - continue; > - } > - > + read_controller_data(fd, &cdata); > printf("%6s: %s\n", name, cdata.mn); > > for (i = 0; i < cdata.nn; i++) { > sprintf(name, "nvme%dns%d", ctrlr, i+1); > - sprintf(path, "/dev/%s", name); > - > - fd = open(path, O_RDWR); > - if (fd < 0) { > - printf("Could not open %s.\n", path); > - exit_code = EX_NOPERM; > - continue; > - } > - if (ioctl(fd, NVME_IDENTIFY_NAMESPACE, &nsdata) == > -1) { > - printf("ioctl to %s failed.\n", path); > - exit_code = EX_IOERR; > - continue; > - } > + read_namespace_data(fd, i+1, &nsdata); > printf(" %10s (%lldGB)\n", > name, > nsdata.nsze * > @@ -307,21 +342,20 @@ identify_ctrlr(int argc, char *argv[]) > > sprintf(path, "/dev/%s", argv[optind]); > > - if (stat(path, &devstat) != 0) { > - printf("Invalid device node '%s'.\n", path); > + if (stat(path, &devstat) < 0) { > + printf("Invalid device node %s. errno=%d (%s)\n", path, > errno, > + strerror(errno)); > exit(EX_IOERR); > } > > fd = open(path, O_RDWR); > if (fd < 0) { > - printf("Could not open %s.\n", path); > + printf("Could not open %s. errno=%d (%s)\n", path, errno, > + strerror(errno)); > exit(EX_NOPERM); > } > > - if (ioctl(fd, NVME_IDENTIFY_CONTROLLER, &cdata) == -1) { > - printf("ioctl to %s failed.\n", path); > - exit(EX_IOERR); > - } > + read_controller_data(fd, &cdata); > > if (hexflag == 1) { > if (verboseflag == 1) > @@ -348,7 +382,8 @@ identify_ns(int argc, char *argv[]) > struct nvme_namespace_data nsdata; > struct stat devstat; > char path[64]; > - int ch, fd, hexflag = 0, hexlength; > + char *nsloc; > + int ch, fd, hexflag = 0, hexlength, > nsid; > int verboseflag = 0; > > while ((ch = getopt(argc, argv, "vx")) != -1) { > @@ -364,23 +399,55 @@ identify_ns(int argc, char *argv[]) > } > } > > + /* > + * Check if the specified device node exists before continuing. > + * This is a cleaner check for cases where the correct controller > + * is specified, but an invalid namespace on that controller. > + */ > sprintf(path, "/dev/%s", argv[optind]); > + if (stat(path, &devstat) < 0) { > + printf("Invalid device node %s. errno=%d (%s)\n", path, > errno, > + strerror(errno)); > + exit(EX_IOERR); > + } > + > + nsloc = strstr(argv[optind], "ns"); > + if (nsloc == NULL) { > + printf("Invalid namepsace %s.\n", argv[optind]); > + exit(EX_IOERR); > + } > + > + /* > + * Pull the namespace id from the string. +2 skips past the "ns" > part > + * of the string. > + */ > + nsid = strtol(nsloc + 2, NULL, 10); > + if (nsid == 0 && errno != 0) { > + printf("Invalid namespace ID %s.\n", argv[optind]); > + exit(EX_IOERR); > + } > > - if (stat(path, &devstat) != 0) { > - printf("Invalid device node '%s'.\n", path); > + /* > + * We send IDENTIFY commands to the controller, not the namespace, > + * since it is an admin cmd. So the path should only include the > + * nvmeX part of the nvmeXnsY string. > + */ > + sprintf(path, "/dev/"); > + strncat(path, argv[optind], nsloc - argv[optind]); > + if (stat(path, &devstat) < 0) { > + printf("Invalid device node %s. errno=%d (%s)\n", path, > errno, > + strerror(errno)); > exit(EX_IOERR); > } > > fd = open(path, O_RDWR); > if (fd < 0) { > - printf("Could not open %s.\n", path); > + printf("Could not open %s. errno=%d (%s)\n", path, errno, > + strerror(errno)); > exit(EX_NOPERM); > } > > - if (ioctl(fd, NVME_IDENTIFY_NAMESPACE, &nsdata) == -1) { > - printf("ioctl to %s failed.\n", path); > - exit(EX_IOERR); > - } > + read_namespace_data(fd, nsid, &nsdata); > > if (hexflag == 1) { > if (verboseflag == 1) > @@ -423,7 +490,7 @@ identify(int argc, char *argv[]) > optind = 1; > > /* > - * If devicde node contains "ns", we consider it a namespace, > + * If device node contains "ns", we consider it a namespace, > * otherwise, consider it a controller. > */ > if (strstr(target, "ns") == NULL) > @@ -475,7 +542,7 @@ perftest(int argc, char *argv[]) > char path[64]; > u_long ioctl_cmd = NVME_IO_TEST; > bool nflag, oflag, sflag, tflag; > - int err, perthread = 0; > + int perthread = 0; > > nflag = oflag = sflag = tflag = false; > name = NULL; > @@ -565,14 +632,14 @@ perftest(int argc, char *argv[]) > > fd = open(path, O_RDWR); > if (fd < 0) { > - fprintf(stderr, "%s not valid device.\n", path); > + fprintf(stderr, "%s not valid device. errno=%d (%s)\n", > path, > + errno, strerror(errno)); > perftest_usage(); > } > > - err = ioctl(fd, ioctl_cmd, &io_test); > - > - if (err) { > - fprintf(stderr, "NVME_IO_TEST returned %d\n", errno); > + if (ioctl(fd, ioctl_cmd, &io_test) < 0) { > + fprintf(stderr, "NVME_IO_TEST failed. errno=%d (%s)\n", > errno, > + strerror(errno)); > exit(EX_IOERR); > } > > @@ -580,6 +647,44 @@ perftest(int argc, char *argv[]) > exit(EX_OK); > } > > +static void > +reset_ctrlr(int argc, char *argv[]) > +{ > + struct stat devstat; > + char path[64]; > + int ch, fd; > + > + while ((ch = getopt(argc, argv, "")) != -1) { > + switch ((char)ch) { > + default: > + usage(); > + } > + } > + > + sprintf(path, "/dev/%s", argv[optind]); > + > + if (stat(path, &devstat) < 0) { > + printf("Invalid device node %s. errno=%d (%s)\n", path, > errno, > + strerror(errno)); > + exit(EX_IOERR); > + } > + > + fd = open(path, O_RDWR); > + if (fd < 0) { > + printf("Could not open %s. errno=%d (%s)\n", path, errno, > + strerror(errno)); > + exit(EX_NOPERM); > + } > + > + if (ioctl(fd, NVME_RESET_CONTROLLER) < 0) { > + printf("Reset request to %s failed. errno=%d (%s)\n", path, > + errno, strerror(errno)); > + exit(EX_IOERR); > + } > + > + exit(EX_OK); > +} > + > int > main(int argc, char *argv[]) > { > @@ -593,6 +698,8 @@ main(int argc, char *argv[]) > identify(argc-1, &argv[1]); > else if (strcmp(argv[1], "perftest") == 0) > perftest(argc-1, &argv[1]); > + else if (strcmp(argv[1], "reset") == 0) > + reset_ctrlr(argc-1, &argv[1]); > > usage(); > > > Modified: stable/9/sys/amd64/conf/NOTES > > ============================================================================== > --- stable/9/sys/amd64/conf/NOTES Tue Jun 25 23:30:48 2013 > (r252221) > +++ stable/9/sys/amd64/conf/NOTES Tue Jun 25 23:52:39 2013 > (r252222) > @@ -433,6 +433,11 @@ device isci > options ISCI_LOGGING # enable debugging in isci HAL > > # > +# NVM Express (NVMe) support > +device nvme # base NVMe driver > +device nvd # expose NVMe namespaces as disks, depends on nvme > + > +# > # SafeNet crypto driver: can be moved to the MI NOTES as soon as > # it's tested on a big-endian machine > # > > Modified: stable/9/sys/conf/files.amd64 > > ============================================================================== > --- stable/9/sys/conf/files.amd64 Tue Jun 25 23:30:48 2013 > (r252221) > +++ stable/9/sys/conf/files.amd64 Tue Jun 25 23:52:39 2013 > (r252222) > @@ -213,7 +213,16 @@ dev/kbd/kbd.c optional > atkbd | sc | uk > dev/lindev/full.c optional lindev > dev/lindev/lindev.c optional lindev > dev/nfe/if_nfe.c optional nfe pci > +dev/nvd/nvd.c optional nvd nvme > dev/nve/if_nve.c optional nve pci > +dev/nvme/nvme.c optional nvme > +dev/nvme/nvme_ctrlr.c optional nvme > +dev/nvme/nvme_ctrlr_cmd.c optional nvme > +dev/nvme/nvme_ns.c optional nvme > +dev/nvme/nvme_ns_cmd.c optional nvme > +dev/nvme/nvme_qpair.c optional nvme > +dev/nvme/nvme_sysctl.c optional nvme > +dev/nvme/nvme_test.c optional nvme > dev/nvram/nvram.c optional nvram isa > dev/random/ivy.c optional random rdrand_rng > dev/random/nehemiah.c optional random padlock_rng > > Modified: stable/9/sys/conf/files.i386 > > ============================================================================== > --- stable/9/sys/conf/files.i386 Tue Jun 25 23:30:48 2013 > (r252221) > +++ stable/9/sys/conf/files.i386 Tue Jun 25 23:52:39 2013 > (r252222) > @@ -222,7 +222,16 @@ dev/lindev/lindev.c optional lindev > dev/mse/mse.c optional mse > dev/mse/mse_isa.c optional mse isa > dev/nfe/if_nfe.c optional nfe pci > +dev/nvd/nvd.c optional nvd nvme > dev/nve/if_nve.c optional nve pci > +dev/nvme/nvme.c optional nvme > +dev/nvme/nvme_ctrlr.c optional nvme > +dev/nvme/nvme_ctrlr_cmd.c optional nvme > +dev/nvme/nvme_ns.c optional nvme > +dev/nvme/nvme_ns_cmd.c optional nvme > +dev/nvme/nvme_qpair.c optional nvme > +dev/nvme/nvme_sysctl.c optional nvme > +dev/nvme/nvme_test.c optional nvme > dev/nvram/nvram.c optional nvram isa > dev/pcf/pcf_isa.c optional pcf > dev/random/ivy.c optional random rdrand_rng > > Modified: stable/9/sys/dev/nvd/nvd.c > > ============================================================================== > --- stable/9/sys/dev/nvd/nvd.c Tue Jun 25 23:30:48 2013 (r252221) > +++ stable/9/sys/dev/nvd/nvd.c Tue Jun 25 23:52:39 2013 (r252222) > @@ -45,9 +45,12 @@ struct nvd_disk; > static disk_ioctl_t nvd_ioctl; > static disk_strategy_t nvd_strategy; > > -static void create_geom_disk(void *, struct nvme_namespace *ns); > +static void *nvd_new_disk(struct nvme_namespace *ns, void *ctrlr); > static void destroy_geom_disk(struct nvd_disk *ndisk); > > +static void *nvd_new_controller(struct nvme_controller *ctrlr); > +static void nvd_controller_fail(void *ctrlr); > + > static int nvd_load(void); > static void nvd_unload(void); > > @@ -67,10 +70,18 @@ struct nvd_disk { > > uint32_t cur_depth; > > - TAILQ_ENTRY(nvd_disk) tailq; > + TAILQ_ENTRY(nvd_disk) global_tailq; > + TAILQ_ENTRY(nvd_disk) ctrlr_tailq; > +}; > + > +struct nvd_controller { > + > + TAILQ_ENTRY(nvd_controller) tailq; > + TAILQ_HEAD(, nvd_disk) disk_head; > }; > > -TAILQ_HEAD(, nvd_disk) nvd_head; > +static TAILQ_HEAD(, nvd_controller) ctrlr_head; > +static TAILQ_HEAD(disk_list, nvd_disk) disk_head; > > static int nvd_modevent(module_t mod, int type, void *arg) > { > @@ -104,8 +115,11 @@ static int > nvd_load() > { > > - TAILQ_INIT(&nvd_head); > - consumer_handle = nvme_register_consumer(create_geom_disk, NULL); > + TAILQ_INIT(&ctrlr_head); > + TAILQ_INIT(&disk_head); > + > + consumer_handle = nvme_register_consumer(nvd_new_disk, > + nvd_new_controller, NULL, nvd_controller_fail); > > return (consumer_handle != NULL ? 0 : -1); > } > @@ -113,13 +127,20 @@ nvd_load() > static void > nvd_unload() > { > - struct nvd_disk *nvd; > + struct nvd_controller *ctrlr; > + struct nvd_disk *disk; > + > + while (!TAILQ_EMPTY(&ctrlr_head)) { > + ctrlr = TAILQ_FIRST(&ctrlr_head); > + TAILQ_REMOVE(&ctrlr_head, ctrlr, tailq); > + free(ctrlr, M_NVD); > + } > > - while (!TAILQ_EMPTY(&nvd_head)) { > - nvd = TAILQ_FIRST(&nvd_head); > - TAILQ_REMOVE(&nvd_head, nvd, tailq); > - destroy_geom_disk(nvd); > - free(nvd, M_NVD); > + while (!TAILQ_EMPTY(&disk_head)) { > + disk = TAILQ_FIRST(&disk_head); > + TAILQ_REMOVE(&disk_head, disk, global_tailq); > + destroy_geom_disk(disk); > + free(disk, M_NVD); > } > > nvme_unregister_consumer(consumer_handle); > @@ -153,7 +174,7 @@ nvd_ioctl(struct disk *ndisk, u_long cmd > } > > static void > -nvd_done(void *arg, const struct nvme_completion *status) > +nvd_done(void *arg, const struct nvme_completion *cpl) > { > struct bio *bp; > struct nvd_disk *ndisk; > @@ -162,14 +183,13 @@ nvd_done(void *arg, const struct nvme_co > > ndisk = bp->bio_disk->d_drv1; > > - if (atomic_fetchadd_int(&ndisk->cur_depth, -1) == NVME_QD) > - taskqueue_enqueue(ndisk->tq, &ndisk->bioqtask); > + atomic_add_int(&ndisk->cur_depth, -1); > > /* > * TODO: add more extensive translation of NVMe status codes > * to different bio error codes (i.e. EIO, EINVAL, etc.) > */ > - if (status->sf_sc || status->sf_sct) { > + if (nvme_completion_is_error(cpl)) { > bp->bio_error = EIO; > bp->bio_flags |= BIO_ERROR; > bp->bio_resid = bp->bio_bcount; > @@ -187,9 +207,6 @@ nvd_bioq_process(void *arg, int pending) > int err; > > for (;;) { > - if (atomic_load_acq_int(&ndisk->cur_depth) >= NVME_QD) > - break; > - > mtx_lock(&ndisk->bioqlock); > bp = bioq_takefirst(&ndisk->bioq); > mtx_unlock(&ndisk->bioqlock); > @@ -210,13 +227,13 @@ nvd_bioq_process(void *arg, int pending) > #endif > > bp->bio_driver1 = NULL; > - atomic_add_acq_int(&ndisk->cur_depth, 1); > + atomic_add_int(&ndisk->cur_depth, 1); > > err = nvme_ns_bio_process(ndisk->ns, bp, nvd_done); > > if (err) { > - atomic_add_acq_int(&ndisk->cur_depth, -1); > - bp->bio_error = EIO; > + atomic_add_int(&ndisk->cur_depth, -1); > + bp->bio_error = err; > bp->bio_flags |= BIO_ERROR; > bp->bio_resid = bp->bio_bcount; > biodone(bp); > @@ -237,13 +254,28 @@ nvd_bioq_process(void *arg, int pending) > } > } > > -static void > -create_geom_disk(void *arg, struct nvme_namespace *ns) > +static void * > +nvd_new_controller(struct nvme_controller *ctrlr) > { > - struct nvd_disk *ndisk; > - struct disk *disk; > + struct nvd_controller *nvd_ctrlr; > + > + nvd_ctrlr = malloc(sizeof(struct nvd_controller), M_NVD, > + M_ZERO | M_WAITOK); > > - ndisk = malloc(sizeof(struct nvd_disk), M_NVD, M_ZERO | M_NOWAIT); > + TAILQ_INIT(&nvd_ctrlr->disk_head); > + TAILQ_INSERT_TAIL(&ctrlr_head, nvd_ctrlr, tailq); > + > + return (nvd_ctrlr); > +} > + > +static void * > +nvd_new_disk(struct nvme_namespace *ns, void *ctrlr_arg) > +{ > + struct nvd_disk *ndisk; > + struct disk *disk; > + struct nvd_controller *ctrlr = ctrlr_arg; > + > + ndisk = malloc(sizeof(struct nvd_disk), M_NVD, M_ZERO | M_WAITOK); > > disk = disk_alloc(); > disk->d_strategy = nvd_strategy; > @@ -255,10 +287,11 @@ create_geom_disk(void *arg, struct nvme_ > disk->d_sectorsize = nvme_ns_get_sector_size(ns); > disk->d_mediasize = (off_t)nvme_ns_get_size(ns); > > - if (TAILQ_EMPTY(&nvd_head)) > + if (TAILQ_EMPTY(&disk_head)) > disk->d_unit = 0; > else > - disk->d_unit = TAILQ_FIRST(&nvd_head)->disk->d_unit + 1; > + disk->d_unit = > + TAILQ_LAST(&disk_head, disk_list)->disk->d_unit + 1; > > disk->d_flags = 0; > > @@ -268,6 +301,11 @@ create_geom_disk(void *arg, struct nvme_ > if (nvme_ns_get_flags(ns) & NVME_NS_FLUSH_SUPPORTED) > disk->d_flags |= DISKFLAG_CANFLUSHCACHE; > > +/* ifdef used here to ease porting to stable branches at a later point. */ > +#ifdef DISKFLAG_UNMAPPED_BIO > + disk->d_flags |= DISKFLAG_UNMAPPED_BIO; > +#endif > + > strlcpy(disk->d_ident, nvme_ns_get_serial_number(ns), > sizeof(disk->d_ident)); > > @@ -290,7 +328,10 @@ create_geom_disk(void *arg, struct nvme_ > taskqueue_thread_enqueue, &ndisk->tq); > taskqueue_start_threads(&ndisk->tq, 1, PI_DISK, "nvd taskq"); > > - TAILQ_INSERT_HEAD(&nvd_head, ndisk, tailq); > + TAILQ_INSERT_TAIL(&disk_head, ndisk, global_tailq); > + TAILQ_INSERT_TAIL(&ctrlr->disk_head, ndisk, ctrlr_tailq); > + > + return (NULL); > } > > static void > @@ -316,3 +357,22 @@ destroy_geom_disk(struct nvd_disk *ndisk > > mtx_destroy(&ndisk->bioqlock); > } > + > +static void > +nvd_controller_fail(void *ctrlr_arg) > +{ > + struct nvd_controller *ctrlr = ctrlr_arg; > + struct nvd_disk *disk; > + > + while (!TAILQ_EMPTY(&ctrlr->disk_head)) { > + disk = TAILQ_FIRST(&ctrlr->disk_head); > + TAILQ_REMOVE(&disk_head, disk, global_tailq); > + TAILQ_REMOVE(&ctrlr->disk_head, disk, ctrlr_tailq); > + destroy_geom_disk(disk); > + free(disk, M_NVD); > + } > + > + TAILQ_REMOVE(&ctrlr_head, ctrlr, tailq); > + free(ctrlr, M_NVD); > +} > + > > Modified: stable/9/sys/dev/nvme/nvme.c > > ============================================================================== > --- stable/9/sys/dev/nvme/nvme.c Tue Jun 25 23:30:48 2013 > (r252221) > +++ stable/9/sys/dev/nvme/nvme.c Tue Jun 25 23:52:39 2013 > (r252222) > @@ -32,22 +32,33 @@ __FBSDID("$FreeBSD$"); > #include > #include > > +#include > + > +#include > #include > > #include "nvme_private.h" > > struct nvme_consumer { > - nvme_consumer_cb_fn_t cb_fn; > - void *cb_arg; > + uint32_t id; > + nvme_cons_ns_fn_t ns_fn; > + nvme_cons_ctrlr_fn_t ctrlr_fn; > + nvme_cons_async_fn_t async_fn; > + nvme_cons_fail_fn_t fail_fn; > }; > > struct nvme_consumer nvme_consumer[NVME_MAX_CONSUMERS]; > +#define INVALID_CONSUMER_ID 0xFFFF > + > +uma_zone_t nvme_request_zone; > +int32_t nvme_retry_count; > > MALLOC_DEFINE(M_NVME, "nvme", "nvme(4) memory allocations"); > > static int nvme_probe(device_t); > static int nvme_attach(device_t); > static int nvme_detach(device_t); > +static int nvme_modevent(module_t mod, int type, void *arg); > > static devclass_t nvme_devclass; > > @@ -65,7 +76,7 @@ static driver_t nvme_pci_driver = { > sizeof(struct nvme_controller), > }; > > -DRIVER_MODULE(nvme, pci, nvme_pci_driver, nvme_devclass, 0, 0); > +DRIVER_MODULE(nvme, pci, nvme_pci_driver, nvme_devclass, nvme_modevent, > 0); > MODULE_VERSION(nvme, 1); > > static struct _pcsid > @@ -75,15 +86,19 @@ static struct _pcsid > } pci_ids[] = { > { 0x01118086, "NVMe Controller" }, > { CHATHAM_PCI_ID, "Chatham Prototype NVMe Controller" }, > - { IDT_PCI_ID, "IDT NVMe Controller" }, > + { IDT32_PCI_ID, "IDT NVMe Controller (32 channel)" }, > + { IDT8_PCI_ID, "IDT NVMe Controller (8 channel)" }, > { 0x00000000, NULL } > }; > > static int > nvme_probe (device_t device) > { > - u_int32_t type = pci_get_devid(device); > - struct _pcsid *ep = pci_ids; > + struct _pcsid *ep; > + u_int32_t type; > + > + type = pci_get_devid(device); > + ep = pci_ids; > > while (ep->type && ep->type != type) > ++ep; > @@ -91,11 +106,43 @@ nvme_probe (device_t device) > if (ep->desc) { > device_set_desc(device, ep->desc); > return (BUS_PROBE_DEFAULT); > - } else > - return (ENXIO); > + } > + > +#if defined(PCIS_STORAGE_NVM) > + if (pci_get_class(device) == PCIC_STORAGE && > + pci_get_subclass(device) == PCIS_STORAGE_NVM && > + pci_get_progif(device) == > PCIP_STORAGE_NVM_ENTERPRISE_NVMHCI_1_0) { > + device_set_desc(device, "Generic NVMe Device"); > + return (BUS_PROBE_GENERIC); > + } > +#endif > + > + return (ENXIO); > } > > static void > +nvme_init(void) > +{ > + uint32_t i; > + > + nvme_request_zone = uma_zcreate("nvme_request", > + sizeof(struct nvme_request), NULL, NULL, NULL, NULL, 0, 0); > + > + for (i = 0; i < NVME_MAX_CONSUMERS; i++) > + nvme_consumer[i].id = INVALID_CONSUMER_ID; > +} > + > +SYSINIT(nvme_register, SI_SUB_DRIVERS, SI_ORDER_SECOND, nvme_init, NULL); > + > +static void > +nvme_uninit(void) > +{ > + uma_zdestroy(nvme_request_zone); > +} > + > +SYSUNINIT(nvme_unregister, SI_SUB_DRIVERS, SI_ORDER_SECOND, nvme_uninit, > NULL); > + > +static void > nvme_load(void) > { > } > @@ -160,24 +207,14 @@ nvme_modevent(module_t mod, int type, vo > return (0); > } > > -moduledata_t nvme_mod = { > - "nvme", > - (modeventhand_t)nvme_modevent, > - 0 > -}; > - > -DECLARE_MODULE(nvme, nvme_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); > - > void > nvme_dump_command(struct nvme_command *cmd) > { > - printf("opc:%x f:%x r1:%x cid:%x nsid:%x r2:%x r3:%x " > - "mptr:%qx prp1:%qx prp2:%qx cdw:%x %x %x %x %x %x\n", > + printf( > +"opc:%x f:%x r1:%x cid:%x nsid:%x r2:%x r3:%x mptr:%jx prp1:%jx prp2:%jx > cdw:%x %x %x %x %x %x\n", > cmd->opc, cmd->fuse, cmd->rsvd1, cmd->cid, cmd->nsid, > cmd->rsvd2, cmd->rsvd3, > - (long long unsigned int)cmd->mptr, > - (long long unsigned int)cmd->prp1, > - (long long unsigned int)cmd->prp2, > + (uintmax_t)cmd->mptr, (uintmax_t)cmd->prp1, > (uintmax_t)cmd->prp2, > cmd->cdw10, cmd->cdw11, cmd->cdw12, cmd->cdw13, cmd->cdw14, > cmd->cdw15); > } > @@ -188,87 +225,8 @@ nvme_dump_completion(struct nvme_complet > printf("cdw0:%08x sqhd:%04x sqid:%04x " > "cid:%04x p:%x sc:%02x sct:%x m:%x dnr:%x\n", > cpl->cdw0, cpl->sqhd, cpl->sqid, > - cpl->cid, cpl->p, cpl->sf_sc, cpl->sf_sct, cpl->sf_m, > - cpl->sf_dnr); > -} > - > -void > -nvme_payload_map(void *arg, bus_dma_segment_t *seg, int nseg, int error) > -{ > - struct nvme_tracker *tr; > - struct nvme_qpair *qpair; > - struct nvme_prp_list *prp_list; > - uint32_t cur_nseg; > - > - KASSERT(error == 0, ("nvme_payload_map error != 0\n")); > - > - tr = (struct nvme_tracker *)arg; > - qpair = tr->qpair; > - > - /* > - * Note that we specified PAGE_SIZE for alignment and max > - * segment size when creating the bus dma tags. So here > - * we can safely just transfer each segment to its > - * associated PRP entry. > - */ > - tr->cmd.prp1 = seg[0].ds_addr; > - > - if (nseg == 2) { > - tr->cmd.prp2 = seg[1].ds_addr; > - } else if (nseg > 2) { > - KASSERT(tr->prp_list, > - ("prp_list needed but not attached to tracker\n")); > - cur_nseg = 1; > - prp_list = tr->prp_list; > - tr->cmd.prp2 = (uint64_t)prp_list->bus_addr; > - while (cur_nseg < nseg) { > - prp_list->prp[cur_nseg-1] = > - (uint64_t)seg[cur_nseg].ds_addr; > - cur_nseg++; > - } > - } > - > - nvme_qpair_submit_cmd(qpair, tr); > -} > - > -struct nvme_tracker * > -nvme_allocate_tracker(struct nvme_controller *ctrlr, boolean_t is_admin, > - nvme_cb_fn_t cb_fn, void *cb_arg, uint32_t payload_size, void > *payload) > -{ > - struct nvme_tracker *tr; > - struct nvme_qpair *qpair; > - uint32_t modulo, offset, num_prps; > - boolean_t alloc_prp_list = FALSE; > - > - if (is_admin) { > - qpair = &ctrlr->adminq; > - } else { > - if (ctrlr->per_cpu_io_queues) > - qpair = &ctrlr->ioq[curcpu]; > - else > - qpair = &ctrlr->ioq[0]; > - } > - > - num_prps = payload_size / PAGE_SIZE; > - modulo = payload_size % PAGE_SIZE; > - offset = (uint32_t)((uintptr_t)payload % PAGE_SIZE); > - > - if (modulo || offset) > - num_prps += 1 + (modulo + offset - 1) / PAGE_SIZE; > - > - if (num_prps > 2) > - alloc_prp_list = TRUE; > - > - tr = nvme_qpair_allocate_tracker(qpair, alloc_prp_list); > - > - memset(&tr->cmd, 0, sizeof(tr->cmd)); > - > - tr->qpair = qpair; > - tr->cb_fn = cb_fn; > - tr->cb_arg = cb_arg; > - tr->payload_size = payload_size; > - > - return (tr); > + cpl->cid, cpl->status.p, cpl->status.sc, cpl->status.sct, > + cpl->status.m, cpl->status.dnr); > } > > static int > @@ -287,15 +245,17 @@ nvme_attach(device_t dev) > * to cc.en==0. This is because we don't really know what status > * the controller was left in when boot handed off to OS. > */ > - status = nvme_ctrlr_reset(ctrlr); > + status = nvme_ctrlr_hw_reset(ctrlr); > if (status != 0) > return (status); > > - status = nvme_ctrlr_reset(ctrlr); > + status = nvme_ctrlr_hw_reset(ctrlr); > if (status != 0) > return (status); > > - ctrlr->config_hook.ich_func = nvme_ctrlr_start; > + nvme_sysctl_initialize_ctrlr(ctrlr); > + > + ctrlr->config_hook.ich_func = nvme_ctrlr_start_config_hook; > ctrlr->config_hook.ich_arg = ctrlr; > > config_intrhook_establish(&ctrlr->config_hook); > @@ -307,77 +267,75 @@ static int > nvme_detach (device_t dev) > { > struct nvme_controller *ctrlr = DEVICE2SOFTC(dev); > - struct nvme_namespace *ns; > - int i; > - > - if (ctrlr->taskqueue) { > - taskqueue_drain(ctrlr->taskqueue, &ctrlr->task); > - taskqueue_free(ctrlr->taskqueue); > - } > - > - for (i = 0; i < NVME_MAX_NAMESPACES; i++) { > - ns = &ctrlr->ns[i]; > - if (ns->cdev) > - destroy_dev(ns->cdev); > - } > - > - if (ctrlr->cdev) > - destroy_dev(ctrlr->cdev); > - > - for (i = 0; i < ctrlr->num_io_queues; i++) { > - nvme_io_qpair_destroy(&ctrlr->ioq[i]); > - } > - > - free(ctrlr->ioq, M_NVME); > - > - nvme_admin_qpair_destroy(&ctrlr->adminq); > - > - if (ctrlr->resource != NULL) { > - bus_release_resource(dev, SYS_RES_MEMORY, > - ctrlr->resource_id, ctrlr->resource); > - } > - > -#ifdef CHATHAM2 > - if (ctrlr->chatham_resource != NULL) { > - bus_release_resource(dev, SYS_RES_MEMORY, > - ctrlr->chatham_resource_id, ctrlr->chatham_resource); > - } > -#endif > - > - if (ctrlr->tag) > - bus_teardown_intr(ctrlr->dev, ctrlr->res, ctrlr->tag); > - > - if (ctrlr->res) > - bus_release_resource(ctrlr->dev, SYS_RES_IRQ, > - rman_get_rid(ctrlr->res), ctrlr->res); > - > - if (ctrlr->msix_enabled) > - pci_release_msi(dev); > > + nvme_ctrlr_destruct(ctrlr, dev); > return (0); > } > > static void > -nvme_notify_consumer(struct nvme_consumer *consumer) > +nvme_notify_consumer(struct nvme_consumer *cons) > { > device_t *devlist; > struct nvme_controller *ctrlr; > - int dev, ns, devcount; > + struct nvme_namespace *ns; > + void *ctrlr_cookie; > + int dev_idx, ns_idx, devcount; > > if (devclass_get_devices(nvme_devclass, &devlist, &devcount)) > return; > > - for (dev = 0; dev < devcount; dev++) { > - ctrlr = DEVICE2SOFTC(devlist[dev]); > - for (ns = 0; ns < ctrlr->cdata.nn; ns++) > - (*consumer->cb_fn)(consumer->cb_arg, > &ctrlr->ns[ns]); > + for (dev_idx = 0; dev_idx < devcount; dev_idx++) { > + ctrlr = DEVICE2SOFTC(devlist[dev_idx]); > + if (cons->ctrlr_fn != NULL) > + ctrlr_cookie = (*cons->ctrlr_fn)(ctrlr); > + else > + ctrlr_cookie = NULL; > + ctrlr->cons_cookie[cons->id] = ctrlr_cookie; > + for (ns_idx = 0; ns_idx < ctrlr->cdata.nn; ns_idx++) { > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > From owner-svn-src-stable@FreeBSD.ORG Wed Jun 26 00:09:04 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E2B79EAC; Wed, 26 Jun 2013 00:09:04 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D53F01D61; Wed, 26 Jun 2013 00:09:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5Q094Ao007539; Wed, 26 Jun 2013 00:09:04 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5Q0942H007538; Wed, 26 Jun 2013 00:09:04 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201306260009.r5Q0942H007538@svn.freebsd.org> From: Jim Harris Date: Wed, 26 Jun 2013 00:09:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252223 - stable/9/sbin/nvmecontrol X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2013 00:09:05 -0000 Author: jimharris Date: Wed Jun 26 00:09:04 2013 New Revision: 252223 URL: http://svnweb.freebsd.org/changeset/base/252223 Log: Forced commit due to bad commit message in r252222. MFC: r240618, r240621, r240633, r240671, r240672, r240697, r240700, r241433, r241434, r241657, r241658, r241659, r241660, r241661, r241662, r241663, r241664, r241665, r241689, r242420, r243951, r244410, r244411, r244413, r244549, r245136, r247963, r248729, r248730, r248731, r248732, r248733, r248734, r248735, r248736, r248737, r248738, r248739, r248740, r248741, r248746, r248747, r248748, r248749, r248754, r248755, r248756, r248757, r248758, r248759, r248760, r248761, r248762, r248763, r248764, r248765, r248766, r248767, r248768, r248769, r248770, r248771, r248772, r248773, r248780, r248834, r248835, r248913, r248977, r249067, r249416, r249417, r249418, r249419, r249420, r249421, r249422, r249432 Merge all NVMe-related changes since the original code was added to HEAD, including linking it into the build. Sponsored by: Intel Modified: stable/9/sbin/nvmecontrol/nvmecontrol.c Modified: stable/9/sbin/nvmecontrol/nvmecontrol.c ============================================================================== --- stable/9/sbin/nvmecontrol/nvmecontrol.c Tue Jun 25 23:52:39 2013 (r252222) +++ stable/9/sbin/nvmecontrol/nvmecontrol.c Wed Jun 26 00:09:04 2013 (r252223) @@ -705,3 +705,4 @@ main(int argc, char *argv[]) return (0); } + From owner-svn-src-stable@FreeBSD.ORG Wed Jun 26 00:38:40 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D95556FF; Wed, 26 Jun 2013 00:38:40 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id CBD0B1E5C; Wed, 26 Jun 2013 00:38:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5Q0cewU015872; Wed, 26 Jun 2013 00:38:40 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5Q0ceNm015870; Wed, 26 Jun 2013 00:38:40 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201306260038.r5Q0ceNm015870@svn.freebsd.org> From: Glen Barber Date: Wed, 26 Jun 2013 00:38:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252224 - stable/9/release X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2013 00:38:40 -0000 Author: gjb Date: Wed Jun 26 00:38:40 2013 New Revision: 252224 URL: http://svnweb.freebsd.org/changeset/base/252224 Log: MFC r251652, r251811, r252101: r251652: Add new script to run release builds. The script is heavily based upon the release/generate-release.sh script by nwhitehorn. This script can use optional configuration file to override defaults, making running multiple serialzied builds with different specific configurations or architecture-specific tunings quite easy. Sample overrideable options are included in the release.conf.sample file. r251811: Fix OSVERSION variable within PBUILD_FLAGS. r252101: If MAKE_CONF and/or SRC_CONF are set and not character devices, copy to chroot to use with release build. Approved by: kib (mentor, implicit) Added: stable/9/release/release.conf.sample - copied unchanged from r251652, head/release/release.conf.sample stable/9/release/release.sh - copied, changed from r251652, head/release/release.sh Modified: Directory Properties: stable/9/release/ (props changed) Copied: stable/9/release/release.conf.sample (from r251652, head/release/release.conf.sample) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/release/release.conf.sample Wed Jun 26 00:38:40 2013 (r252224, copy of r251652, head/release/release.conf.sample) @@ -0,0 +1,41 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +## Set the directory within which the release will be built. +CHROOTDIR="/scratch" + +## Set the svn host. +SVNROOT="svn://svn.FreeBSD.org" + +## Set the src/, ports/, and doc/ branches or tags. +SRCBRANCH="base/head" +DOCBRANCH="doc/head" +PORTBRANCH="ports/head" + +## Set the src/, ports/, and doc/ revisions. +SRCREVISION="-rHEAD" +DOCREVISION="-rHEAD" +PORTREVISION="-rHEAD" + +## Set to override the default target architecture. +#TARGET="amd64" +#TARGET_ARCH="amd64" +#KERNEL="GENERIC" + +## Set to specify a custom make.conf and/or src.conf +#MAKE_CONF="/etc/local/make.conf" +#SRC_CONF="/etc/local/src.conf" + +## Set to use make(1) flags. +#MAKE_FLAGS="-s" + +## Set to use world- and kernel-specific make(1) flags. +#WORLD_FLAGS="-j $(sysctl -n hw.ncpu)" +#KERNEL_FLAGS="-j $(expr $(sysctl -n hw.ncpu) / 2)" + +## Set miscellaneous 'make release' settings. +#NODOC= +#NOPORTS= +#RELSTRING= Copied and modified: stable/9/release/release.sh (from r251652, head/release/release.sh) ============================================================================== --- head/release/release.sh Wed Jun 12 13:15:28 2013 (r251652, copy source) +++ stable/9/release/release.sh Wed Jun 26 00:38:40 2013 (r252224) @@ -165,12 +165,23 @@ build_doc_ports() { ## Trick the ports 'run-autotools-fixup' target to do the right thing. _OSVERSION=$(sysctl -n kern.osreldate) if [ -d ${CHROOTDIR}/usr/doc ] && [ "x${NODOC}" != "x" ]; then - PBUILD_FLAGS="OSVERSION=${OSVERSION} WITHOUT_JADETEX=yes BATCH=yes" + PBUILD_FLAGS="OSVERSION=${_OSVERSION} WITHOUT_JADETEX=yes BATCH=yes" chroot ${CHROOTDIR} make -C /usr/ports/textproc/docproj \ ${PBUILD_FLAGS} install fi } +# If MAKE_CONF and/or SRC_CONF are set and not character devices (/dev/null), +# copy them to the chroot. +if [ -e ${MAKE_CONF} ] && [ ! -c ${MAKE_CONF} ]; then + mkdir -p ${CHROOTDIR}/$(dirname ${MAKE_CONF}) + cp ${MAKE_CONF} ${CHROOTDIR}/${MAKE_CONF} +fi +if [ -e ${SRC_CONF} ] && [ ! -c ${SRC_CONF} ]; then + mkdir -p ${CHROOTDIR}/$(dirname ${SRC_CONF}) + cp ${SRC_CONF} ${CHROOTDIR}/${SRC_CONF} +fi + if [ -d ${CHROOTDIR}/usr/ports ]; then cp /etc/resolv.conf ${CHROOTDIR}/etc/resolv.conf build_doc_ports ${CHROOTDIR} From owner-svn-src-stable@FreeBSD.ORG Wed Jun 26 00:42:46 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3373C89A; Wed, 26 Jun 2013 00:42:46 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 242371E77; Wed, 26 Jun 2013 00:42:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5Q0gkHU017913; Wed, 26 Jun 2013 00:42:46 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5Q0gkKW017912; Wed, 26 Jun 2013 00:42:46 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201306260042.r5Q0gkKW017912@svn.freebsd.org> From: Glen Barber Date: Wed, 26 Jun 2013 00:42:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252225 - stable/9/release X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2013 00:42:46 -0000 Author: gjb Date: Wed Jun 26 00:42:45 2013 New Revision: 252225 URL: http://svnweb.freebsd.org/changeset/base/252225 Log: Set SRCBRANCH to stable/9 in release.conf.sample. This is a direct commit to stable/9. Approved by: kib (mentor, implicit) Modified: stable/9/release/release.conf.sample Modified: stable/9/release/release.conf.sample ============================================================================== --- stable/9/release/release.conf.sample Wed Jun 26 00:38:40 2013 (r252224) +++ stable/9/release/release.conf.sample Wed Jun 26 00:42:45 2013 (r252225) @@ -10,7 +10,7 @@ CHROOTDIR="/scratch" SVNROOT="svn://svn.FreeBSD.org" ## Set the src/, ports/, and doc/ branches or tags. -SRCBRANCH="base/head" +SRCBRANCH="base/stable/9" DOCBRANCH="doc/head" PORTBRANCH="ports/head" From owner-svn-src-stable@FreeBSD.ORG Wed Jun 26 04:34:18 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 07B3044D; Wed, 26 Jun 2013 04:34:18 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id ED8B01CC2; Wed, 26 Jun 2013 04:34:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5Q4YHpu084300; Wed, 26 Jun 2013 04:34:17 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5Q4YGeQ084292; Wed, 26 Jun 2013 04:34:16 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201306260434.r5Q4YGeQ084292@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Wed, 26 Jun 2013 04:34:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252234 - stable/9/sys/fs/ext2fs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2013 04:34:18 -0000 Author: pfg Date: Wed Jun 26 04:34:16 2013 New Revision: 252234 URL: http://svnweb.freebsd.org/changeset/base/252234 Log: MFC r252103: Define and use e2fs_lbn_t in ext2fs. In line to what is done in UFS, define an internal type e2fs_lbn_t for the logical block numbers. This change is basically a no-op as the new type is unchanged (int32_t) but it may be useful as bumping this may be required for ext4fs. Also, as pointed out by Bruce Evans: -Use daddr_t for daddr in ext2_bmaparray(). This seems to improve reliability with the reallocblks option. - Add a cast to the fsbtodb() macro as in UFS. Modified: stable/9/sys/fs/ext2fs/ext2_alloc.c stable/9/sys/fs/ext2fs/ext2_balloc.c stable/9/sys/fs/ext2fs/ext2_bmap.c stable/9/sys/fs/ext2fs/ext2_extern.h stable/9/sys/fs/ext2fs/ext2_subr.c stable/9/sys/fs/ext2fs/fs.h stable/9/sys/fs/ext2fs/inode.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/ext2fs/ext2_alloc.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_alloc.c Wed Jun 26 04:33:57 2013 (r252233) +++ stable/9/sys/fs/ext2fs/ext2_alloc.c Wed Jun 26 04:34:16 2013 (r252234) @@ -165,7 +165,8 @@ ext2_reallocblks(struct vop_reallocblks_ struct ext2mount *ump; struct cluster_save *buflist; struct indir start_ap[NIADDR + 1], end_ap[NIADDR + 1], *idp; - int32_t start_lbn, end_lbn, soff, newblk, blkno; + e2fs_lbn_t start_lbn, end_lbn; + int32_t soff, newblk, blkno; int i, len, start_lvl, end_lvl, pref, ssize; if (doreallocblks == 0) @@ -550,7 +551,7 @@ ext2_dirpref(struct inode *pip) * that will hold the pointer */ int32_t -ext2_blkpref(struct inode *ip, int32_t lbn, int indx, int32_t *bap, +ext2_blkpref(struct inode *ip, e2fs_lbn_t lbn, int indx, int32_t *bap, int32_t blocknr) { int tmp; Modified: stable/9/sys/fs/ext2fs/ext2_balloc.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_balloc.c Wed Jun 26 04:33:57 2013 (r252233) +++ stable/9/sys/fs/ext2fs/ext2_balloc.c Wed Jun 26 04:34:16 2013 (r252234) @@ -57,7 +57,7 @@ * the inode and the logical block number in a file. */ int -ext2_balloc(struct inode *ip, int32_t lbn, int size, struct ucred *cred, +ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size, struct ucred *cred, struct buf **bpp, int flags) { struct m_ext2fs *fs; Modified: stable/9/sys/fs/ext2fs/ext2_bmap.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_bmap.c Wed Jun 26 04:33:57 2013 (r252233) +++ stable/9/sys/fs/ext2fs/ext2_bmap.c Wed Jun 26 04:34:16 2013 (r252234) @@ -99,8 +99,8 @@ ext2_bmaparray(struct vnode *vp, int32_t struct mount *mp; struct vnode *devvp; struct indir a[NIADDR+1], *ap; - int32_t daddr; - long metalbn; + daddr_t daddr; + e2fs_lbn_t metalbn; int error, num, maxrun = 0, bsize; int *nump; @@ -241,7 +241,8 @@ ext2_bmaparray(struct vnode *vp, int32_t int ext2_getlbns(struct vnode *vp, int32_t bn, struct indir *ap, int *nump) { - long blockcnt, metalbn, realbn; + long blockcnt; + e2fs_lbn_t metalbn, realbn; struct ext2mount *ump; int i, numlevels, off; int64_t qblockcnt; Modified: stable/9/sys/fs/ext2fs/ext2_extern.h ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_extern.h Wed Jun 26 04:33:57 2013 (r252233) +++ stable/9/sys/fs/ext2fs/ext2_extern.h Wed Jun 26 04:34:16 2013 (r252234) @@ -49,10 +49,10 @@ struct vnode; int ext2_alloc(struct inode *, int32_t, int32_t, int, struct ucred *, int32_t *); int ext2_balloc(struct inode *, - int32_t, int, struct ucred *, struct buf **, int); + e2fs_lbn_t, int, struct ucred *, struct buf **, int); int ext2_blkatoff(struct vnode *, off_t, char **, struct buf **); void ext2_blkfree(struct inode *, int32_t, long); -int32_t ext2_blkpref(struct inode *, int32_t, int, int32_t *, int32_t); +int32_t ext2_blkpref(struct inode *, e2fs_lbn_t, int, int32_t *, int32_t); int ext2_bmap(struct vop_bmap_args *); int ext2_bmaparray(struct vnode *, int32_t, int32_t *, int *, int *); void ext2_clusteracct(struct m_ext2fs *, char *, int, daddr_t, int); Modified: stable/9/sys/fs/ext2fs/ext2_subr.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_subr.c Wed Jun 26 04:33:57 2013 (r252233) +++ stable/9/sys/fs/ext2fs/ext2_subr.c Wed Jun 26 04:34:16 2013 (r252234) @@ -68,7 +68,7 @@ ext2_blkatoff(struct vnode *vp, off_t of struct inode *ip; struct m_ext2fs *fs; struct buf *bp; - int32_t lbn; + e2fs_lbn_t lbn; int bsize, error; ip = VTOI(vp); Modified: stable/9/sys/fs/ext2fs/fs.h ============================================================================== --- stable/9/sys/fs/ext2fs/fs.h Wed Jun 26 04:33:57 2013 (r252233) +++ stable/9/sys/fs/ext2fs/fs.h Wed Jun 26 04:34:16 2013 (r252234) @@ -98,8 +98,8 @@ * Turn file system block numbers into disk block addresses. * This maps file system blocks to device size blocks. */ -#define fsbtodb(fs, b) ((b) << ((fs)->e2fs_fsbtodb)) -#define dbtofsb(fs, b) ((b) >> ((fs)->e2fs_fsbtodb)) +#define fsbtodb(fs, b) ((daddr_t)(b) << (fs)->e2fs_fsbtodb) +#define dbtofsb(fs, b) ((b) >> (fs)->e2fs_fsbtodb) /* get group containing inode */ #define ino_to_cg(fs, x) (((x) - 1) / (fs->e2fs_ipg)) Modified: stable/9/sys/fs/ext2fs/inode.h ============================================================================== --- stable/9/sys/fs/ext2fs/inode.h Wed Jun 26 04:33:57 2013 (r252233) +++ stable/9/sys/fs/ext2fs/inode.h Wed Jun 26 04:34:16 2013 (r252234) @@ -50,6 +50,11 @@ #define NIADDR 3 /* Indirect addresses in inode. */ /* + * The size of physical and logical block numbers and time fields in UFS. + */ +typedef int32_t e2fs_lbn_t; + +/* * The inode is used to describe each active (or recently active) file in the * EXT2FS filesystem. It is composed of two types of information. The first * part is the information that is needed only while the file is active (such @@ -148,7 +153,7 @@ struct inode { * ext2_getlbns and used by truncate and bmap code. */ struct indir { - int32_t in_lbn; /* Logical block number. */ + e2fs_lbn_t in_lbn; /* Logical block number. */ int in_off; /* Offset in buffer. */ }; From owner-svn-src-stable@FreeBSD.ORG Wed Jun 26 05:49:29 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D6A4D140; Wed, 26 Jun 2013 05:49:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C89E01F45; Wed, 26 Jun 2013 05:49:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5Q5nTrM004626; Wed, 26 Jun 2013 05:49:29 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5Q5nTU6004625; Wed, 26 Jun 2013 05:49:29 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306260549.r5Q5nTU6004625@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 26 Jun 2013 05:49:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252245 - stable/9/lib/libthr/thread X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2013 05:49:29 -0000 Author: kib Date: Wed Jun 26 05:49:29 2013 New Revision: 252245 URL: http://svnweb.freebsd.org/changeset/base/252245 Log: MFC r251985: When enabling the cancellation, only process the pending cancellation for asynchronous mode. Modified: stable/9/lib/libthr/thread/thr_cancel.c Directory Properties: stable/9/lib/libthr/ (props changed) Modified: stable/9/lib/libthr/thread/thr_cancel.c ============================================================================== --- stable/9/lib/libthr/thread/thr_cancel.c Wed Jun 26 05:36:51 2013 (r252244) +++ stable/9/lib/libthr/thread/thr_cancel.c Wed Jun 26 05:49:29 2013 (r252245) @@ -87,7 +87,8 @@ _pthread_setcancelstate(int state, int * break; case PTHREAD_CANCEL_ENABLE: curthread->cancel_enable = 1; - testcancel(curthread); + if (curthread->cancel_async) + testcancel(curthread); break; default: return (EINVAL); From owner-svn-src-stable@FreeBSD.ORG Wed Jun 26 05:54:38 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 42F8D3BF; Wed, 26 Jun 2013 05:54:38 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 33BAD1F63; Wed, 26 Jun 2013 05:54:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5Q5scE0006794; Wed, 26 Jun 2013 05:54:38 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5Q5sbvs006792; Wed, 26 Jun 2013 05:54:37 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306260554.r5Q5sbvs006792@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 26 Jun 2013 05:54:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252246 - in stable/9/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2013 05:54:38 -0000 Author: kib Date: Wed Jun 26 05:54:37 2013 New Revision: 252246 URL: http://svnweb.freebsd.org/changeset/base/252246 Log: MFC r251988: Some clarifications and updates for the comments, mostly retrieved from Bruce Evans. Trim the trailing spaces. Modified: stable/9/sys/amd64/amd64/exception.S stable/9/sys/i386/i386/exception.s Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/exception.S ============================================================================== --- stable/9/sys/amd64/amd64/exception.S Wed Jun 26 05:49:29 2013 (r252245) +++ stable/9/sys/amd64/amd64/exception.S Wed Jun 26 05:54:37 2013 (r252246) @@ -80,18 +80,22 @@ dtrace_invop_calltrap_addr: * This is equivalent to the i386 port's use of SDT_SYS386TGT. * * The cpu will push a certain amount of state onto the kernel stack for - * the current process. See amd64/include/frame.h. - * This includes the current RFLAGS (status register, which includes + * the current process. See amd64/include/frame.h. + * This includes the current RFLAGS (status register, which includes * the interrupt disable state prior to the trap), the code segment register, - * and the return instruction pointer are pushed by the cpu. The cpu - * will also push an 'error' code for certain traps. We push a dummy - * error code for those traps where the cpu doesn't in order to maintain + * and the return instruction pointer are pushed by the cpu. The cpu + * will also push an 'error' code for certain traps. We push a dummy + * error code for those traps where the cpu doesn't in order to maintain * a consistent frame. We also push a contrived 'trap number'. * - * The cpu does not push the general registers, we must do that, and we - * must restore them prior to calling 'iret'. The cpu adjusts the %cs and - * %ss segment registers, but does not mess with %ds, %es, or %fs. Thus we - * must load them with appropriate values for supervisor mode operation. + * The CPU does not push the general registers, so we must do that, and we + * must restore them prior to calling 'iret'. The CPU adjusts %cs and %ss + * but does not mess with %ds, %es, %gs or %fs. We swap the %gs base for + * for the kernel mode operation shortly, without changes to the selector + * loaded. Since superuser long mode works with any selectors loaded into + * segment registers other then %cs, which makes them mostly unused in long + * mode, and kernel does not reference %fs, leave them alone. The segment + * registers are reloaded on return to the usermode. */ MCOUNT_LABEL(user) @@ -503,7 +507,7 @@ nmi_calltrap: #ifdef HWPMC_HOOKS /* * Capture a userspace callchain if needed. - * + * * - Check if the current trap was from user mode. * - Check if the current thread is valid. * - Check if the thread requires a user call chain to be @@ -549,7 +553,7 @@ outofnmi: * At this point the processor has exited NMI mode and is running * with interrupts turned off on the normal kernel stack. * - * If a pending NMI gets recognized at or after this point, it + * If a pending NMI gets recognized at or after this point, it * will cause a kernel callchain to be traced. * * We turn interrupts back on, and call the user callchain capture hook. @@ -567,7 +571,7 @@ nocallchain: #endif testl %ebx,%ebx jnz doreti_exit -nmi_kernelexit: +nmi_kernelexit: /* * Put back the preserved MSR_GSBASE value. */ Modified: stable/9/sys/i386/i386/exception.s ============================================================================== --- stable/9/sys/i386/i386/exception.s Wed Jun 26 05:49:29 2013 (r252245) +++ stable/9/sys/i386/i386/exception.s Wed Jun 26 05:54:37 2013 (r252246) @@ -54,13 +54,13 @@ .globl dtrace_invop_jump_addr .align 4 .type dtrace_invop_jump_addr, @object - .size dtrace_invop_jump_addr, 4 + .size dtrace_invop_jump_addr, 4 dtrace_invop_jump_addr: .zero 4 .globl dtrace_invop_calltrap_addr .align 4 .type dtrace_invop_calltrap_addr, @object - .size dtrace_invop_calltrap_addr, 4 + .size dtrace_invop_calltrap_addr, 4 dtrace_invop_calltrap_addr: .zero 8 #endif @@ -75,22 +75,22 @@ dtrace_invop_calltrap_addr: * Trap and fault vector routines. * * Most traps are 'trap gates', SDT_SYS386TGT. A trap gate pushes state on - * the stack that mostly looks like an interrupt, but does not disable - * interrupts. A few of the traps we are use are interrupt gates, + * the stack that mostly looks like an interrupt, but does not disable + * interrupts. A few of the traps we are use are interrupt gates, * SDT_SYS386IGT, which are nearly the same thing except interrupts are * disabled on entry. * * The cpu will push a certain amount of state onto the kernel stack for - * the current process. The amount of state depends on the type of trap - * and whether the trap crossed rings or not. See i386/include/frame.h. - * At the very least the current EFLAGS (status register, which includes + * the current process. The amount of state depends on the type of trap + * and whether the trap crossed rings or not. See i386/include/frame.h. + * At the very least the current EFLAGS (status register, which includes * the interrupt disable state prior to the trap), the code segment register, - * and the return instruction pointer are pushed by the cpu. The cpu - * will also push an 'error' code for certain traps. We push a dummy - * error code for those traps where the cpu doesn't in order to maintain + * and the return instruction pointer are pushed by the cpu. The cpu + * will also push an 'error' code for certain traps. We push a dummy + * error code for those traps where the cpu doesn't in order to maintain * a consistent frame. We also push a contrived 'trap number'. * - * The cpu does not push the general registers, we must do that, and we + * The cpu does not push the general registers, we must do that, and we * must restore them prior to calling 'iret'. The cpu adjusts the %cs and * %ss segment registers, but does not mess with %ds, %es, or %fs. Thus we * must load them with appropriate values for supervisor mode operation. @@ -145,13 +145,14 @@ IDTVEC(xmm) pushl $0; TRAP(T_XMMFLT) /* - * alltraps entry point. Interrupts are enabled if this was a trap - * gate (TGT), else disabled if this was an interrupt gate (IGT). - * Note that int0x80_syscall is a trap gate. Interrupt gates are - * used by page faults, non-maskable interrupts, debug and breakpoint + * All traps except ones for syscalls jump to alltraps. If + * interrupts were enabled when the trap occurred, then interrupts + * are enabled now if the trap was through a trap gate, else + * disabled if the trap was through an interrupt gate. Note that + * int0x80_syscall is a trap gate. Interrupt gates are used by + * page faults, non-maskable interrupts, debug and breakpoint * exceptions. */ - SUPERALIGN_TEXT .globl alltraps .type alltraps,@function @@ -168,7 +169,7 @@ calltrap: pushl %esp call trap add $4, %esp - + /* * Return via doreti to handle ASTs. */ @@ -187,10 +188,10 @@ IDTVEC(ill) /* Check if this is a user fault. */ cmpl $GSEL_KPL, 4(%esp) /* Check the code segment. */ - + /* If so, just handle it as a normal trap. */ jne norm_ill - + /* * This is a kernel instruction fault that might have been caused * by a DTrace provider. @@ -215,10 +216,10 @@ norm_ill: #endif /* - * SYSCALL CALL GATE (old entry point for a.out binaries) + * Call gate entry for syscalls (lcall 7,0). + * This is used by FreeBSD 1.x a.out executables and "old" NetBSD executables. * * The intersegment call has been set up to specify one dummy parameter. - * * This leaves a place to put eflags so that the call frame can be * converted to a trap frame. Note that the eflags is (semi-)bogusly * pushed into (what will be) tf_err and then copied later into the @@ -246,11 +247,13 @@ IDTVEC(lcall_syscall) jmp doreti /* - * Call gate entry for FreeBSD ELF and Linux/NetBSD syscall (int 0x80) + * Trap gate entry for syscalls (int 0x80). + * This is used by FreeBSD ELF executables, "new" NetBSD executables, and all + * Linux executables. * - * Even though the name says 'int0x80', this is actually a TGT (trap gate) - * rather then an IGT (interrupt gate). Thus interrupts are enabled on - * entry just as they are for a normal syscall. + * Even though the name says 'int0x80', this is actually a trap gate, not an + * interrupt gate. Thus interrupts are enabled on entry just as they are for + * a normal syscall. */ SUPERALIGN_TEXT IDTVEC(int0x80_syscall) @@ -348,13 +351,14 @@ doreti_next: /* * PSL_VM must be checked first since segment registers only * have an RPL in non-VM86 mode. + * ASTs can not be handled now if we are in a vm86 call. */ - testl $PSL_VM,TF_EFLAGS(%esp) /* are we in vm86 mode? */ + testl $PSL_VM,TF_EFLAGS(%esp) jz doreti_notvm86 movl PCPU(CURPCB),%ecx - testl $PCB_VM86CALL,PCB_FLAGS(%ecx) /* are we in a vm86 call? */ - jz doreti_ast /* can handle ASTS now if not */ - jmp doreti_exit + testl $PCB_VM86CALL,PCB_FLAGS(%ecx) + jz doreti_ast + jmp doreti_exit doreti_notvm86: testb $SEL_RPL_MASK,TF_CS(%esp) /* are we returning to user mode? */ @@ -401,7 +405,7 @@ doreti_popl_ds: doreti_iret: iret - /* + /* * doreti_iret_fault and friends. Alternative return code for * the case where we get a fault in the doreti_exit code * above. trap() (i386/i386/trap.c) catches this specific From owner-svn-src-stable@FreeBSD.ORG Thu Jun 27 00:31:22 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id CED9EF4D; Thu, 27 Jun 2013 00:31:22 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BEED518FE; Thu, 27 Jun 2013 00:31:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5R0VMIC023671; Thu, 27 Jun 2013 00:31:22 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5R0VLls023659; Thu, 27 Jun 2013 00:31:21 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201306270031.r5R0VLls023659@svn.freebsd.org> From: Xin LI Date: Thu, 27 Jun 2013 00:31:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252281 - in stable/9: contrib/libpcap contrib/libpcap/pcap lib/libpcap X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 00:31:22 -0000 Author: delphij Date: Thu Jun 27 00:31:21 2013 New Revision: 252281 URL: http://svnweb.freebsd.org/changeset/base/252281 Log: MFC r251129: libpcap 1.4.0. Modified: stable/9/contrib/libpcap/CHANGES stable/9/contrib/libpcap/CREDITS stable/9/contrib/libpcap/README stable/9/contrib/libpcap/VERSION stable/9/contrib/libpcap/bpf_image.c stable/9/contrib/libpcap/config.h.in stable/9/contrib/libpcap/configure stable/9/contrib/libpcap/configure.in stable/9/contrib/libpcap/fad-getad.c stable/9/contrib/libpcap/fad-gifc.c stable/9/contrib/libpcap/fad-glifc.c stable/9/contrib/libpcap/fad-sita.c stable/9/contrib/libpcap/gencode.c stable/9/contrib/libpcap/grammar.y stable/9/contrib/libpcap/nametoaddr.c stable/9/contrib/libpcap/optimize.c stable/9/contrib/libpcap/pcap-bpf.c stable/9/contrib/libpcap/pcap-bt-linux.c stable/9/contrib/libpcap/pcap-bt-linux.h stable/9/contrib/libpcap/pcap-can-linux.c stable/9/contrib/libpcap/pcap-can-linux.h stable/9/contrib/libpcap/pcap-canusb-linux.c stable/9/contrib/libpcap/pcap-canusb-linux.h stable/9/contrib/libpcap/pcap-common.c stable/9/contrib/libpcap/pcap-dag.c stable/9/contrib/libpcap/pcap-dag.h stable/9/contrib/libpcap/pcap-dlpi.c stable/9/contrib/libpcap/pcap-filter.manmisc stable/9/contrib/libpcap/pcap-filter.manmisc.in stable/9/contrib/libpcap/pcap-int.h stable/9/contrib/libpcap/pcap-libdlpi.c stable/9/contrib/libpcap/pcap-linux.c stable/9/contrib/libpcap/pcap-netfilter-linux.c stable/9/contrib/libpcap/pcap-netfilter-linux.h stable/9/contrib/libpcap/pcap-nit.c stable/9/contrib/libpcap/pcap-null.c stable/9/contrib/libpcap/pcap-pf.c stable/9/contrib/libpcap/pcap-septel.c stable/9/contrib/libpcap/pcap-septel.h stable/9/contrib/libpcap/pcap-sita.c stable/9/contrib/libpcap/pcap-snf.c stable/9/contrib/libpcap/pcap-snf.h stable/9/contrib/libpcap/pcap-snit.c stable/9/contrib/libpcap/pcap-snoop.c stable/9/contrib/libpcap/pcap-usb-linux.c stable/9/contrib/libpcap/pcap-usb-linux.h stable/9/contrib/libpcap/pcap-win32.c stable/9/contrib/libpcap/pcap.c stable/9/contrib/libpcap/pcap/bpf.h stable/9/contrib/libpcap/pcap/pcap.h stable/9/contrib/libpcap/pcap_breakloop.3pcap stable/9/contrib/libpcap/pcap_loop.3pcap stable/9/contrib/libpcap/pcap_offline_filter.3pcap stable/9/contrib/libpcap/scanner.l stable/9/lib/libpcap/config.h Directory Properties: stable/9/contrib/libpcap/ (props changed) stable/9/lib/libpcap/ (props changed) Modified: stable/9/contrib/libpcap/CHANGES ============================================================================== --- stable/9/contrib/libpcap/CHANGES Thu Jun 27 00:22:40 2013 (r252280) +++ stable/9/contrib/libpcap/CHANGES Thu Jun 27 00:31:21 2013 (r252281) @@ -1,3 +1,35 @@ +Monday March 18, 2013 guy@alum.mit.edu +Summary for 1.4.0 libpcap release + Add netfilter/nfqueue interface. + If we don't have support for IPv6 address resolution, support, + in filter expressions, what IPv6 stuff we can. + Checks added for malloc()/realloc()/etc. failures. + Fix pcap-config to include -lpthread if canusb support is + present + Try to fix "pcap_parse not defined" problems when --without-flex + and --without-bison are used when you have Flex and Bison + Fix some issues with the pcap_loop man page. + Fix pcap_getnonblock() and pcap_setnonblock() to fill in the + supplied error message buffer + Fix typo that, it appeared, would cause pcap-libdlpi.c not to + compile (perhaps systems with libdlpi also have BPF and use + that instead) + Catch attempts to call pcap_compile() on a non-activated pcap_t + Fix crash on Linux with CAN-USB support without usbfs + Fix addition of VLAN tags for Linux cooked captures + Check for both EOPNOTSUPP and EINVAL after SIOCETHTOOL ioctl, so + that the driver can report either one if it doesn't support + SIOCETHTOOL + Add DLT_INFINIBAND and DLT_SCTP + Describe "proto XXX" and "protochain XXX" in the pcap-filter man + page + Handle either directories, or symlinks to directories, that + correspond to interfaces in /sys/class/net + Fix handling of VLAN tag insertion to check, on Linux 3.x + kernels, for VLAN tag valid flag + Clean up some man pages + Support libnl3 as well as libnl1 and libnl2 on Linux + Friday March 30, 2012. mcr@sandelman.ca Summary for 1.3.0 libpcap release Handle DLT_PFSYNC in {FreeBSD, other *BSD+Mac OS X, other}. Modified: stable/9/contrib/libpcap/CREDITS ============================================================================== --- stable/9/contrib/libpcap/CREDITS Thu Jun 27 00:22:40 2013 (r252280) +++ stable/9/contrib/libpcap/CREDITS Thu Jun 27 00:31:21 2013 (r252281) @@ -22,6 +22,7 @@ Additional people who have contributed p Armando L. Caro Jr. Assar Westerlund Brian Ginsbach + Bill Parker Charles M. Hannum Chris G. Demetriou Chris Lightfoot @@ -59,6 +60,7 @@ Additional people who have contributed p Henri Doreau Hyung Sik Yoon Igor Khristophorov + Jakub Zawadzki Jan-Philip Velders Jason R. Thorpe Javier Achirica @@ -152,4 +154,4 @@ The original LBL crew: Van Jacobson Past maintainers: - Jun-ichiro itojun Hagino + Jun-ichiro itojun Hagino Also see: http://www.wide.ad.jp/itojun-award/ Modified: stable/9/contrib/libpcap/README ============================================================================== --- stable/9/contrib/libpcap/README Thu Jun 27 00:22:40 2013 (r252280) +++ stable/9/contrib/libpcap/README Thu Jun 27 00:31:21 2013 (r252281) @@ -13,8 +13,11 @@ Anonymous Git is available via: Version 1.x.y of LIBPCAP can be retrieved with the CVS tag "libpcap_1_{x}rel{y}": cvs -d :pserver:tcpdump@cvs.tcpdump.org:/tcpdump/master checkout -r libpcap_1_{x}rel{y} libpcap -Please submit patches against the master copy to the libpcap project on -sourceforge.net. +Please submit patches by forking the branch on GitHub at + + http://github.com/mcr/libpcap/tree/master + +and issuing a pull request. formerly from Lawrence Berkeley National Laboratory Network Research Group @@ -91,15 +94,18 @@ a particular release of libpcap. Problems, bugs, questions, desirable enhancements, etc. should be sent to the address "tcpdump-workers@lists.tcpdump.org". Bugs, support -requests, and feature requests may also be submitted on the SourceForge -site for libpcap at +requests, and feature requests may also be submitted on the GitHub issue +tracker for libpcap at - http://sourceforge.net/projects/libpcap/ + https://github.com/mcr/libpcap/issues Source code contributions, etc. should be sent to the email address -submitted as patches on the SourceForge site for libpcap. +above or submitted by forking the branch on GitHub at + + http://github.com/mcr/libpcap/tree/master + +and issuing a pull request. -Current versions can be found at www.tcpdump.org, or the SourceForge -site for libpcap. +Current versions can be found at www.tcpdump.org. - The TCPdump team Modified: stable/9/contrib/libpcap/VERSION ============================================================================== --- stable/9/contrib/libpcap/VERSION Thu Jun 27 00:22:40 2013 (r252280) +++ stable/9/contrib/libpcap/VERSION Thu Jun 27 00:31:21 2013 (r252281) @@ -1 +1 @@ -1.3.0 +1.4.0 Modified: stable/9/contrib/libpcap/bpf_image.c ============================================================================== --- stable/9/contrib/libpcap/bpf_image.c Thu Jun 27 00:22:40 2013 (r252280) +++ stable/9/contrib/libpcap/bpf_image.c Thu Jun 27 00:31:21 2013 (r252281) @@ -292,11 +292,14 @@ bpf_image(p, n) break; } (void)snprintf(operand, sizeof operand, fmt, v); - (void)snprintf(image, sizeof image, - (BPF_CLASS(p->code) == BPF_JMP && - BPF_OP(p->code) != BPF_JA) ? - "(%03d) %-8s %-16s jt %d\tjf %d" - : "(%03d) %-8s %s", - n, op, operand, n + 1 + p->jt, n + 1 + p->jf); + if (BPF_CLASS(p->code) == BPF_JMP && BPF_OP(p->code) != BPF_JA) { + (void)snprintf(image, sizeof image, + "(%03d) %-8s %-16s jt %d\tjf %d", + n, op, operand, n + 1 + p->jt, n + 1 + p->jf); + } else { + (void)snprintf(image, sizeof image, + "(%03d) %-8s %s", + n, op, operand); + } return image; } Modified: stable/9/contrib/libpcap/config.h.in ============================================================================== --- stable/9/contrib/libpcap/config.h.in Thu Jun 27 00:22:40 2013 (r252280) +++ stable/9/contrib/libpcap/config.h.in Thu Jun 27 00:31:21 2013 (r252281) @@ -58,6 +58,15 @@ /* if libnl exists and is version 2.x */ #undef HAVE_LIBNL_2_x +/* if libnl exists and is version 3.x */ +#undef HAVE_LIBNL_3_x + +/* libnl has NLE_FAILURE */ +#undef HAVE_LIBNL_NLE + +/* libnl has new-style socket api */ +#undef HAVE_LIBNL_SOCKETS + /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H @@ -211,6 +220,9 @@ /* path for device for USB sniffing */ #undef LINUX_USB_MON_DEV +/* if we need a pcap_parse wrapper around yyparse */ +#undef NEED_YYPARSE_WRAPPER + /* Define to 1 if netinet/ether.h declares `ether_hostton' */ #undef NETINET_ETHER_H_DECLARES_ETHER_HOSTTON @@ -232,9 +244,6 @@ /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME -/* Define to the home page for this package. */ -#undef PACKAGE_URL - /* Define to the version of this package. */ #undef PACKAGE_VERSION @@ -259,6 +268,9 @@ /* include ACN support */ #undef SITA +/* if struct sockaddr_hci has hci_channel member */ +#undef SOCKADDR_HCI_HAS_HCI_CHANNEL + /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS Modified: stable/9/contrib/libpcap/configure ============================================================================== --- stable/9/contrib/libpcap/configure Thu Jun 27 00:22:40 2013 (r252280) +++ stable/9/contrib/libpcap/configure Thu Jun 27 00:31:21 2013 (r252281) @@ -1,84 +1,61 @@ #! /bin/sh # From configure.in Revision: 1.168 . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.67. -# +# Generated by GNU Autoconf 2.61. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. -# -# +# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; esac + fi -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' + PATH_SEPARATOR=: fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' + rm -f conf$$.sh fi -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false fi @@ -87,18 +64,20 @@ fi # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) +as_nl=' +' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -case $0 in #(( +case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done IFS=$as_save_IFS ;; @@ -109,321 +88,354 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` # CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH +$as_unset CDPATH + if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST + if (eval ":") 2>/dev/null; then + as_have_required=yes else - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac + as_have_required=no fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes +if as_func_success; then + : else - as_have_required=no + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : +if as_func_ret_success; then + : else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( + case $as_dir in /*) for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : - break 2 -fi -fi + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac - as_found=false done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } IFS=$as_save_IFS - if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a shell if you do have one." - fi - exit 1 -fi + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + fi + + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi -} # as_fn_mkdir_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' +if as_func_ret_success; then + : else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error + exitcode=1 + echo positional parameters were not saved. +fi -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr +test $exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : else - as_expr=false + exitcode=1 + echo as_func_success failed. fi -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : else - as_basename=false + exitcode=1 + echo as_func_ret_success failed. fi -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : else - as_dirname=false + exitcode=1 + echo positional parameters were not saved. fi -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell autoconf@gnu.org about your system, + echo including any error possibly output before this + echo message +} -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= @@ -440,7 +452,8 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the @@ -450,40 +463,49 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits exit } -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; + *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null + mkdir conf$$.dir fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Thu Jun 27 00:38:01 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C767B48E; Thu, 27 Jun 2013 00:38:01 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B66B2194C; Thu, 27 Jun 2013 00:38:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5R0c1Uk024778; Thu, 27 Jun 2013 00:38:01 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5R0c0S4024756; Thu, 27 Jun 2013 00:38:00 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201306270038.r5R0c0S4024756@svn.freebsd.org> From: Xin LI Date: Thu, 27 Jun 2013 00:38:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252283 - in stable/9: contrib/tcpdump usr.sbin/tcpdump/tcpdump X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 00:38:01 -0000 Author: delphij Date: Thu Jun 27 00:37:59 2013 New Revision: 252283 URL: http://svnweb.freebsd.org/changeset/base/252283 Log: MFC: tcpdump 4.4.0. Added: stable/9/contrib/tcpdump/print-msnlb.c - copied unchanged from r252282, head/contrib/tcpdump/print-msnlb.c stable/9/contrib/tcpdump/print-otv.c - copied unchanged from r252282, head/contrib/tcpdump/print-otv.c stable/9/contrib/tcpdump/print-pfsync.c - copied unchanged from r241234, head/contrib/tcpdump/print-pfsync.c stable/9/contrib/tcpdump/print-vxlan.c - copied unchanged from r252282, head/contrib/tcpdump/print-vxlan.c stable/9/contrib/tcpdump/print-zeromq.c - copied unchanged from r252282, head/contrib/tcpdump/print-zeromq.c Modified: stable/9/contrib/tcpdump/CHANGES stable/9/contrib/tcpdump/CREDITS stable/9/contrib/tcpdump/Makefile.in stable/9/contrib/tcpdump/README stable/9/contrib/tcpdump/VERSION stable/9/contrib/tcpdump/addrtoname.c stable/9/contrib/tcpdump/checksum.c stable/9/contrib/tcpdump/configure stable/9/contrib/tcpdump/configure.in stable/9/contrib/tcpdump/ethertype.h stable/9/contrib/tcpdump/icmp6.h stable/9/contrib/tcpdump/interface.h stable/9/contrib/tcpdump/ipproto.c stable/9/contrib/tcpdump/netdissect.h stable/9/contrib/tcpdump/nlpid.c stable/9/contrib/tcpdump/nlpid.h stable/9/contrib/tcpdump/print-802_11.c stable/9/contrib/tcpdump/print-babel.c stable/9/contrib/tcpdump/print-bgp.c stable/9/contrib/tcpdump/print-dhcp6.c stable/9/contrib/tcpdump/print-domain.c stable/9/contrib/tcpdump/print-eigrp.c stable/9/contrib/tcpdump/print-ether.c stable/9/contrib/tcpdump/print-icmp6.c stable/9/contrib/tcpdump/print-ip.c stable/9/contrib/tcpdump/print-isoclns.c stable/9/contrib/tcpdump/print-ldp.c stable/9/contrib/tcpdump/print-lldp.c stable/9/contrib/tcpdump/print-lmp.c stable/9/contrib/tcpdump/print-lspping.c stable/9/contrib/tcpdump/print-ntp.c stable/9/contrib/tcpdump/print-pppoe.c stable/9/contrib/tcpdump/print-rip.c stable/9/contrib/tcpdump/print-rpki-rtr.c stable/9/contrib/tcpdump/print-rsvp.c stable/9/contrib/tcpdump/print-slow.c stable/9/contrib/tcpdump/print-stp.c stable/9/contrib/tcpdump/print-tcp.c stable/9/contrib/tcpdump/print-udp.c stable/9/contrib/tcpdump/tcp.h stable/9/contrib/tcpdump/tcpdump.1.in stable/9/contrib/tcpdump/tcpdump.c stable/9/contrib/tcpdump/udp.h stable/9/usr.sbin/tcpdump/tcpdump/Makefile stable/9/usr.sbin/tcpdump/tcpdump/config.h stable/9/usr.sbin/tcpdump/tcpdump/tcpdump.1 Directory Properties: stable/9/contrib/tcpdump/ (props changed) stable/9/usr.sbin/tcpdump/ (props changed) Modified: stable/9/contrib/tcpdump/CHANGES ============================================================================== --- stable/9/contrib/tcpdump/CHANGES Thu Jun 27 00:33:08 2013 (r252282) +++ stable/9/contrib/tcpdump/CHANGES Thu Jun 27 00:37:59 2013 (r252283) @@ -1,3 +1,37 @@ +Thursday February 19, 2013 guy@alum.mit.edu. + Summary for 4.4.0 tcpdump release + RPKI-RTR (RFC6810) is now official (TCP Port 323) + Fix detection of OpenSSL libcrypto. + Add DNSSL (RFC6106) support. + Add "radius" as an option for -T. + Update Action codes for handle_action function according to + 802.11s amendment. + Decode DHCPv6 AFTR-Name option (RFC6334). + Updates for Babel. + Fix printing of infinite lifetime in ICMPv6. + Added support for SPB, SPBM Service Identifier, and Unicast + Address sub-TLV in ISIS. + Decode RIPv2 authentication up to RFC4822. + Fix RIP Request/full table decoding issues. + On Linux systems with cap-ng.h, drop root privileges + using Linux Capabilities. + Add support for reading multiple files. + +Wednesday November 28, 2012 guy@alum.mit.edu. + Summary for 4.3.1 tcpdump release + Print "LLDP, length N" for LLDP packets even when not in verbose + mode, so something is printed even if only the timestamp is + present + Document "-T carp" + Print NTP poll interval correctly (it's an exponent, so print + both its raw value and 2^value) + Document that "-e" is used to get MAC addresses + More clearly document that you need to escape or quote + backslashes in filter expressions on the command line + Fix some "the the" in the man page + Use the right maximum path length + Don't treat 192_1_2, when passed to -i, as an interface number + Friday April 3, 2011. mcr@sandelman.ca. Summary for 4.3.0 tcpdump release fixes for forces: SPARSE data (per RFC 5810) Modified: stable/9/contrib/tcpdump/CREDITS ============================================================================== --- stable/9/contrib/tcpdump/CREDITS Thu Jun 27 00:33:08 2013 (r252282) +++ stable/9/contrib/tcpdump/CREDITS Thu Jun 27 00:37:59 2013 (r252283) @@ -52,6 +52,7 @@ Additional people who have contributed p David Horn David Smith David Young + Denis Ovsienko Dmitry Eremin-Solenikov Don Ebright Eddie Kohler Modified: stable/9/contrib/tcpdump/Makefile.in ============================================================================== --- stable/9/contrib/tcpdump/Makefile.in Thu Jun 27 00:33:08 2013 (r252282) +++ stable/9/contrib/tcpdump/Makefile.in Thu Jun 27 00:37:59 2013 (r252283) @@ -84,7 +84,7 @@ CSRC = addrtoname.c af.c checksum.c cpac print-l2tp.c print-lane.c print-ldp.c print-lldp.c print-llc.c \ print-lmp.c print-lspping.c print-lwapp.c \ print-lwres.c print-mobile.c print-mpcp.c print-mpls.c print-msdp.c \ - print-nfs.c print-ntp.c print-null.c print-olsr.c print-ospf.c \ + print-msnlb.c print-nfs.c print-ntp.c print-null.c print-olsr.c print-ospf.c \ print-pgm.c print-pim.c \ print-ppi.c print-ppp.c print-pppoe.c print-pptp.c \ print-radius.c print-raw.c print-rip.c print-rpki-rtr.c print-rrcp.c print-rsvp.c \ @@ -93,7 +93,7 @@ CSRC = addrtoname.c af.c checksum.c cpac print-symantec.c print-syslog.c print-tcp.c print-telnet.c print-tftp.c \ print-timed.c print-tipc.c print-token.c print-udld.c print-udp.c \ print-usb.c print-vjc.c print-vqp.c print-vrrp.c print-vtp.c \ - print-wb.c print-zephyr.c signature.c setsignal.c tcpdump.c util.c + print-wb.c print-zephyr.c print-zeromq.c print-vxlan.c print-otv.c signature.c setsignal.c tcpdump.c util.c LIBNETDISSECT_SRC=print-isakmp.c LIBNETDISSECT_OBJ=$(LIBNETDISSECT_SRC:.c=.o) @@ -263,93 +263,8 @@ EXTRA_DIST = \ stime.awk \ strcasecmp.c \ tcpdump.1.in \ - tests/02-sunrise-sunset-esp.pcap \ - tests/08-sunrise-sunset-aes.pcap \ - tests/08-sunrise-sunset-esp2.pcap \ - tests/QinQpacket.out \ - tests/QinQpacket.pcap \ - tests/QinQpacketv.out \ - tests/TESTLIST \ - tests/TESTonce \ - tests/TESTrun.sh \ - tests/babel.pcap \ - tests/babel1.out \ - tests/babel1v.out \ - tests/bgp-infinite-loop.pcap \ - tests/bgp_vpn_attrset.out \ - tests/bgp_vpn_attrset.pcap \ - tests/chdlc-slarp-short.pcap \ - tests/chdlc-slarp.pcap \ - tests/dio.out \ - tests/dio.pcap \ - tests/e1000g.out \ - tests/e1000g.pcap \ - tests/eapon1.gdbinit \ - tests/eapon1.out \ - tests/eapon1.pcap \ - tests/empty.uu \ - tests/esp-secrets.txt \ - tests/esp0.out \ - tests/esp1.gdbinit \ - tests/esp1.out \ - tests/esp2.gdbinit \ - tests/esp2.out \ - tests/esp3.gdbinit \ - tests/esp4.gdbinit \ - tests/esp5.gdbinit \ - tests/esp5.out \ - tests/espudp1.out \ - tests/espudp1.pcap \ - tests/forces1.out \ - tests/forces1.pcap \ - tests/forces1vvv.out \ - tests/forces1vvvv.out \ - tests/forces2v.out \ - tests/forces2vv.out \ - tests/forces3vvv.out \ - tests/icmpv6.out \ - tests/icmpv6.pcap \ - tests/ikev2four.out \ - tests/ikev2four.pcap \ - tests/ikev2fourv.out \ - tests/ikev2fourv4.out \ - tests/ikev2pI2-secrets.txt \ - tests/ikev2pI2.out \ - tests/ikev2pI2.pcap \ - tests/isakmp-delete-segfault.pcap \ - tests/isakmp-identification-segfault.pcap \ - tests/isakmp-pointer-loop.pcap \ - tests/isakmp1.out \ - tests/isakmp2.out \ - tests/isakmp3.out \ - tests/isakmp4.out \ - tests/isakmp4500.pcap \ - tests/isis-infinite-loop.pcap \ - tests/ldp-infinite-loop.pcap \ - tests/lmp.out \ - tests/lmp.pcap \ - tests/lmp.sh \ - tests/lspping-fec-ldp.pcap \ - tests/lspping-fec-rsvp.pcap \ - tests/mpls-ldp-hello.out \ - tests/mpls-ldp-hello.pcap \ - tests/mpls-traceroute.pcap \ - tests/ospf-gmpls.out \ - tests/ospf-gmpls.pcap \ - tests/pppoe.out \ - tests/pppoe.pcap \ - tests/print-A.out \ - tests/print-AA.out \ - tests/print-capX.out \ - tests/print-capXX.out \ - tests/print-flags.pcap \ - tests/print-flags.sh \ - tests/print-x.out \ - tests/print-xx.out \ - tests/rsvp-infinite-loop.pcap \ - tests/sflow_multiple_counter_30_pdus.out \ - tests/sflow_multiple_counter_30_pdus.pcap \ vfprintf.c \ + win32/Include/bittypes.h \ win32/Include/errno.h \ win32/Include/getopt.h \ win32/Include/w32_fzs.h \ @@ -358,6 +273,8 @@ EXTRA_DIST = \ win32/prj/WinDump.dsp \ win32/prj/WinDump.dsw +TEST_DIST= `find tests \( -name 'DIFF' -prune \) -o \( -name NEW -prune \) -o -type f \! -name '.*' \! -name '*~' -print` + all: $(PROG) $(PROG): $(OBJ) @V_PCAPDEP@ @@ -366,7 +283,7 @@ $(PROG): $(OBJ) @V_PCAPDEP@ $(LIBNETDISSECT): $(LIBNETDISSECT_OBJ) @rm -f $@ - $(AR) cr $@ $(LIBNETDISSECT_OBJ) + $(AR) $(ARFLAGS) $@ $(LIBNETDISSECT_OBJ) $(RANLIB) $@ datalinks.o: $(srcdir)/missing/datalinks.c @@ -443,9 +360,12 @@ TAGS: $(TAGFILES) releasetar: @cwd=`pwd` ; dir=`basename $$cwd` ; name=$(PROG)-`cat VERSION` ; \ mkdir $$name; \ - tar cf - $(CSRC) $(HDR) $(LIBNETDISSECT_SRC) $(EXTRA_DIST) | (cd $$name; tar xf -); \ + tar cf - $(CSRC) $(HDR) $(LIBNETDISSECT_SRC) $(EXTRA_DIST) $(TEST_DIST) | (cd $$name; tar xf -); \ tar -c -z -f $$name.tar.gz $$name; \ rm -rf $$name +testlist: + echo $(TEST_DIST) + depend: $(GENSRC) ${srcdir}/mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC) Modified: stable/9/contrib/tcpdump/README ============================================================================== --- stable/9/contrib/tcpdump/README Thu Jun 27 00:33:08 2013 (r252282) +++ stable/9/contrib/tcpdump/README Thu Jun 27 00:37:59 2013 (r252283) @@ -13,8 +13,11 @@ Anonymous Git is available via: Version 4.x.y of TCPDUMP can be retrieved with the CVS tag "tcpdump_4_xrely": cvs -d :pserver:cvs.tcpdump.org:/tcpdump/master checkout -r tcpdump_4_xrely tcpdump -Please submit patches against the master copy to the tcpdump project on -sourceforge.net. +Please submit patches by forking the branch on GitHub at + + http://github.com/mcr/tcpdump/tree/master + +and issuing a pull request. formerly from Lawrence Berkeley National Laboratory Network Research Group @@ -68,16 +71,19 @@ documentation. Problems, bugs, questions, desirable enhancements, etc. should be sent to the address "tcpdump-workers@lists.tcpdump.org". Bugs, support -requests, and feature requests may also be submitted on the SourceForge -site for tcpdump at +requests, and feature requests may also be submitted on the GitHub issue +tracker for tcpdump at - http://sourceforge.net/projects/tcpdump/ + https://github.com/mcr/tcpdump/issues Source code contributions, etc. should be sent to the email address -submitted as patches on the SourceForge site for tcpdump. +above or submitted by forking the branch on GitHub at + + http://github.com/mcr/tcpdump/tree/master + +and issuing a pull request. -Current versions can be found at www.tcpdump.org, or the SourceForge -site for tcpdump. +Current versions can be found at www.tcpdump.org. - The TCPdump team Modified: stable/9/contrib/tcpdump/VERSION ============================================================================== --- stable/9/contrib/tcpdump/VERSION Thu Jun 27 00:33:08 2013 (r252282) +++ stable/9/contrib/tcpdump/VERSION Thu Jun 27 00:37:59 2013 (r252283) @@ -1 +1 @@ -4.3.0 +4.4.0 Modified: stable/9/contrib/tcpdump/addrtoname.c ============================================================================== --- stable/9/contrib/tcpdump/addrtoname.c Thu Jun 27 00:33:08 2013 (r252282) +++ stable/9/contrib/tcpdump/addrtoname.c Thu Jun 27 00:37:59 2013 (r252283) @@ -383,6 +383,9 @@ lookup_bytestring(register const u_char tp->e_addr2 = k; tp->e_bs = (u_char *) calloc(1, nlen + 1); + if (tp->e_bs == NULL) + error("lookup_bytestring: calloc"); + memcpy(tp->e_bs, bs, nlen); tp->e_nxt = (struct enamemem *)calloc(1, sizeof(*tp)); if (tp->e_nxt == NULL) Modified: stable/9/contrib/tcpdump/checksum.c ============================================================================== --- stable/9/contrib/tcpdump/checksum.c Thu Jun 27 00:33:08 2013 (r252282) +++ stable/9/contrib/tcpdump/checksum.c Thu Jun 27 00:37:59 2013 (r252283) @@ -152,8 +152,6 @@ create_osi_cksum (const u_int8_t *pptr, u_int16_t checksum; int index; - checksum = 0; - c0 = 0; c1 = 0; Modified: stable/9/contrib/tcpdump/configure ============================================================================== --- stable/9/contrib/tcpdump/configure Thu Jun 27 00:33:08 2013 (r252282) +++ stable/9/contrib/tcpdump/configure Thu Jun 27 00:37:59 2013 (r252283) @@ -1,61 +1,84 @@ #! /bin/sh # From configure.in Revision: 1.204 . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61. +# Generated by GNU Autoconf 2.68. +# # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. +# +# # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; esac - fi - - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' else - PATH_SEPARATOR=: + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' fi - rm -f conf$$.sh + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' fi -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } fi @@ -64,20 +87,19 @@ fi # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) -as_nl=' -' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -case $0 in +as_myself= +case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done IFS=$as_save_IFS ;; @@ -88,354 +110,328 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 fi -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE # CDPATH. -$as_unset CDPATH - +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then - if (eval ":") 2>/dev/null; then - as_have_required=yes + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST else - as_have_required=no + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac fi - - if test $as_have_required = yes && (eval ": -(as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes else - exitcode=1 - echo positional parameters were not saved. + as_have_required=no fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : -test \$exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=\$LINENO - as_lineno_2=\$LINENO - test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && - test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } -") 2> /dev/null; then - : else - as_candidate_shells= - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - case $as_dir in + as_found=: + case $as_dir in #( /*) for as_base in sh bash ksh sh5; do - as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi done;; esac + as_found=false done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } IFS=$as_save_IFS - for as_shell in $as_candidate_shells $SHELL; do - # Try only shells that exist, to save several forks. - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { ("$as_shell") 2> /dev/null <<\_ASEOF -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - -: -_ASEOF -}; then - CONFIG_SHELL=$as_shell - as_have_required=yes - if { "$as_shell" 2> /dev/null <<\_ASEOF -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - -: -(as_func_return () { - (exit $1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = "$1" ); then - : -else - exitcode=1 - echo positional parameters were not saved. + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi -test $exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } - -_ASEOF -}; then - break + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 fi - fi - - done - - if test "x$CONFIG_SHELL" != x; then - for as_var in BASH_ENV ENV - do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - done - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ - if test $as_have_required = no; then - echo This script requires a shell more modern than all the - echo shells that I found on your system. Please install a - echo modern shell, or manually run the script under such a - echo shell if you do have one. - { (exit 1); exit 1; } -fi - + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" -fi -fi +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith -(eval "as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error -exitcode=0 -if as_func_success; then - : +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. + as_expr=false fi -if as_func_ret_success; then - : +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. + as_basename=false fi -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname else - exitcode=1 - echo positional parameters were not saved. + as_dirname=false fi -test \$exitcode = 0") || { - echo No shell found that supports shell functions. - echo Please tell autoconf@gnu.org about your system, - echo including any error possibly output before this - echo message -} +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Thu Jun 27 00:50:23 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 51828A9E; Thu, 27 Jun 2013 00:50:23 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 4381B19C1; Thu, 27 Jun 2013 00:50:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5R0oNvI028033; Thu, 27 Jun 2013 00:50:23 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5R0oNjX028032; Thu, 27 Jun 2013 00:50:23 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201306270050.r5R0oNjX028032@svn.freebsd.org> From: Jim Harris Date: Thu, 27 Jun 2013 00:50:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252285 - stable/9/sys/netinet X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 00:50:23 -0000 Author: jimharris Date: Thu Jun 27 00:50:22 2013 New Revision: 252285 URL: http://svnweb.freebsd.org/changeset/base/252285 Log: MFC r250613: Fix typo in net.inet.tcp.minmss sysctl description. Modified: stable/9/sys/netinet/tcp_subr.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/tcp_subr.c ============================================================================== --- stable/9/sys/netinet/tcp_subr.c Thu Jun 27 00:42:23 2013 (r252284) +++ stable/9/sys/netinet/tcp_subr.c Thu Jun 27 00:50:22 2013 (r252285) @@ -172,7 +172,7 @@ SYSCTL_VNET_PROC(_net_inet_tcp, TCPCTL_V VNET_DEFINE(int, tcp_minmss) = TCP_MINMSS; SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, minmss, CTLFLAG_RW, &VNET_NAME(tcp_minmss), 0, - "Minmum TCP Maximum Segment Size"); + "Minimum TCP Maximum Segment Size"); VNET_DEFINE(int, tcp_do_rfc1323) = 1; SYSCTL_VNET_INT(_net_inet_tcp, TCPCTL_DO_RFC1323, rfc1323, CTLFLAG_RW, From owner-svn-src-stable@FreeBSD.ORG Thu Jun 27 00:51:47 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B7472C1B; Thu, 27 Jun 2013 00:51:47 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A9D8919CE; Thu, 27 Jun 2013 00:51:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5R0plaD029798; Thu, 27 Jun 2013 00:51:47 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5R0plqM029797; Thu, 27 Jun 2013 00:51:47 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201306270051.r5R0plqM029797@svn.freebsd.org> From: Jim Harris Date: Thu, 27 Jun 2013 00:51:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252286 - stable/8/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 00:51:47 -0000 Author: jimharris Date: Thu Jun 27 00:51:47 2013 New Revision: 252286 URL: http://svnweb.freebsd.org/changeset/base/252286 Log: MFC r250613: Fix typo in net.inet.tcp.minmss sysctl description. Modified: stable/8/sys/netinet/tcp_subr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/tcp_subr.c ============================================================================== --- stable/8/sys/netinet/tcp_subr.c Thu Jun 27 00:50:22 2013 (r252285) +++ stable/8/sys/netinet/tcp_subr.c Thu Jun 27 00:51:47 2013 (r252286) @@ -181,7 +181,7 @@ vnet_sysctl_msec_to_ticks(SYSCTL_HANDLER VNET_DEFINE(int, tcp_minmss) = TCP_MINMSS; SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, minmss, CTLFLAG_RW, &VNET_NAME(tcp_minmss), 0, - "Minmum TCP Maximum Segment Size"); + "Minimum TCP Maximum Segment Size"); VNET_DEFINE(int, tcp_do_rfc1323) = 1; SYSCTL_VNET_INT(_net_inet_tcp, TCPCTL_DO_RFC1323, rfc1323, CTLFLAG_RW, From owner-svn-src-stable@FreeBSD.ORG Thu Jun 27 02:27:14 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 137E33F0; Thu, 27 Jun 2013 02:27:14 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0596A1DC4; Thu, 27 Jun 2013 02:27:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5R2RDar056966; Thu, 27 Jun 2013 02:27:13 GMT (envelope-from mjg@svn.freebsd.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5R2RDTc056963; Thu, 27 Jun 2013 02:27:13 GMT (envelope-from mjg@svn.freebsd.org) Message-Id: <201306270227.r5R2RDTc056963@svn.freebsd.org> From: Mateusz Guzik Date: Thu, 27 Jun 2013 02:27:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252288 - in stable/9/sys: kern sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 02:27:14 -0000 Author: mjg Date: Thu Jun 27 02:27:13 2013 New Revision: 252288 URL: http://svnweb.freebsd.org/changeset/base/252288 Log: MFC r249480: Add fdallocn function and use it when passing fds over unix socket. This gets rid of "unp_externalize fdalloc failed" panic. Modified: stable/9/sys/kern/kern_descrip.c stable/9/sys/kern/uipc_usrreq.c stable/9/sys/sys/filedesc.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/sys/kern/kern_descrip.c ============================================================================== --- stable/9/sys/kern/kern_descrip.c Thu Jun 27 00:56:09 2013 (r252287) +++ stable/9/sys/kern/kern_descrip.c Thu Jun 27 02:27:13 2013 (r252288) @@ -1588,6 +1588,34 @@ fdalloc(struct thread *td, int minfd, in } /* + * Allocate n file descriptors for the process. + */ +int +fdallocn(struct thread *td, int minfd, int *fds, int n) +{ + struct proc *p = td->td_proc; + struct filedesc *fdp = p->p_fd; + int i; + + FILEDESC_XLOCK_ASSERT(fdp); + + if (!fdavail(td, n)) + return (EMFILE); + + for (i = 0; i < n; i++) + if (fdalloc(td, 0, &fds[i]) != 0) + break; + + if (i < n) { + for (i--; i >= 0; i--) + fdunused(fdp, fds[i]); + return (EMFILE); + } + + return (0); +} + +/* * Check to see whether n user file descriptors are available to the process * p. */ Modified: stable/9/sys/kern/uipc_usrreq.c ============================================================================== --- stable/9/sys/kern/uipc_usrreq.c Thu Jun 27 00:56:09 2013 (r252287) +++ stable/9/sys/kern/uipc_usrreq.c Thu Jun 27 02:27:13 2013 (r252288) @@ -1684,7 +1684,6 @@ unp_externalize(struct mbuf *control, st void *data; socklen_t clen = control->m_len, datalen; int error, newfds; - int f; u_int newlen; UNP_LINK_UNLOCK_ASSERT(); @@ -1710,14 +1709,6 @@ unp_externalize(struct mbuf *control, st goto next; } FILEDESC_XLOCK(td->td_proc->p_fd); - /* if the new FD's will not fit free them. */ - if (!fdavail(td, newfds)) { - FILEDESC_XUNLOCK(td->td_proc->p_fd); - error = EMSGSIZE; - unp_freerights(rp, newfds); - goto next; - } - /* * Now change each pointer to an fd in the global * table to an integer that is the index to the local @@ -1736,13 +1727,18 @@ unp_externalize(struct mbuf *control, st fdp = (int *) CMSG_DATA(mtod(*controlp, struct cmsghdr *)); + if (fdallocn(td, 0, fdp, newfds) != 0) { + FILEDESC_XUNLOCK(td->td_proc->p_fd); + error = EMSGSIZE; + unp_freerights(rp, newfds); + m_freem(*controlp); + *controlp = NULL; + goto next; + } for (i = 0; i < newfds; i++) { - if (fdalloc(td, 0, &f)) - panic("unp_externalize fdalloc failed"); fp = *rp++; - td->td_proc->p_fd->fd_ofiles[f] = fp; + td->td_proc->p_fd->fd_ofiles[fdp[i]] = fp; unp_externalize_fp(fp); - *fdp++ = f; } FILEDESC_XUNLOCK(td->td_proc->p_fd); } else { Modified: stable/9/sys/sys/filedesc.h ============================================================================== --- stable/9/sys/sys/filedesc.h Thu Jun 27 00:56:09 2013 (r252287) +++ stable/9/sys/sys/filedesc.h Thu Jun 27 02:27:13 2013 (r252288) @@ -116,6 +116,7 @@ int falloc(struct thread *td, struct fil int falloc_noinstall(struct thread *td, struct file **resultfp); int finstall(struct thread *td, struct file *fp, int *resultfp, int flags); int fdalloc(struct thread *td, int minfd, int *result); +int fdallocn(struct thread *td, int minfd, int *fds, int n); int fdavail(struct thread *td, int n); int fdcheckstd(struct thread *td); void fdclose(struct filedesc *fdp, struct file *fp, int idx, struct thread *td); From owner-svn-src-stable@FreeBSD.ORG Thu Jun 27 06:57:09 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E32BB882; Thu, 27 Jun 2013 06:57:09 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id D4AB41D73; Thu, 27 Jun 2013 06:57:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5R6v9lN034158; Thu, 27 Jun 2013 06:57:09 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5R6v9lG034156; Thu, 27 Jun 2013 06:57:09 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201306270657.r5R6v9lG034156@svn.freebsd.org> From: Hiroki Sato Date: Thu, 27 Jun 2013 06:57:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252291 - stable/9/sbin/mdconfig X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 06:57:10 -0000 Author: hrs Date: Thu Jun 27 06:57:09 2013 New Revision: 252291 URL: http://svnweb.freebsd.org/changeset/base/252291 Log: MFC 230423, 230612, 232964, 252033, 252036, 252051: - Replace the beerware license on mdconfig(8) with standard 2-clause BSD. - Rewrite option parsing in mdconfig(8). This makes it more user-friendly by removing the ordering requirements and adding more descriptive error messages; it also makes it more readable and maintainable. - Add "-f file" support to listing mode (-l). When a -f option is specified, only md(4) devices which have the specified file as backing store are displayed. - Use MD_NAME instead of "md". - Use _PATH_DEV instead of "/dev/". - Return -1 when the specified backing store file is not found in the md device list. Modified: stable/9/sbin/mdconfig/mdconfig.8 stable/9/sbin/mdconfig/mdconfig.c Directory Properties: stable/9/sbin/mdconfig/ (props changed) Modified: stable/9/sbin/mdconfig/mdconfig.8 ============================================================================== --- stable/9/sbin/mdconfig/mdconfig.8 Thu Jun 27 06:37:24 2013 (r252290) +++ stable/9/sbin/mdconfig/mdconfig.8 Thu Jun 27 06:57:09 2013 (r252291) @@ -41,7 +41,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 3, 2012 +.Dd June 20, 2013 .Dt MDCONFIG 8 .Os .Sh NAME @@ -67,6 +67,7 @@ .Fl l .Op Fl n .Op Fl v +.Op Fl f Ar file .Op Fl u Ar unit .Nm .Ar file @@ -124,6 +125,19 @@ List configured devices. If given with .Fl u , display details about that particular device. +If given with +.Fl f Ar file , +display +.Xr md 4 +device names of which +.Ar file +is used as the backing store. +If both of +.Fl u +and +.Fl f +options are specified, +display devices which match the two conditions. If the .Fl v option is specified, show all details. Modified: stable/9/sbin/mdconfig/mdconfig.c ============================================================================== --- stable/9/sbin/mdconfig/mdconfig.c Thu Jun 27 06:37:24 2013 (r252290) +++ stable/9/sbin/mdconfig/mdconfig.c Thu Jun 27 06:57:09 2013 (r252291) @@ -1,14 +1,35 @@ -/* - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- +/*- + * Copyright (c) 2000-2004 Poul-Henning Kamp + * Copyright (c) 2012 The FreeBSD Foundation + * All rights reserved. * - * $FreeBSD$ + * Portions of this software were developed by Edward Tomasz Napierala + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * 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 #include #include @@ -26,22 +47,22 @@ #include #include #include +#include #include #include #include #include #include - static struct md_ioctl mdio; static enum {UNSET, ATTACH, DETACH, LIST} action = UNSET; static int nflag; static void usage(void); static void md_set_file(const char *); -static int md_find(char *, const char *); -static int md_query(char *name); -static int md_list(char *units, int opt); +static int md_find(const char *, const char *); +static int md_query(const char *, const int, const char *); +static int md_list(const char *, int, const char *); static char *geom_config_get(struct gconf *g, const char *name); static void md_prthumanval(char *length); @@ -55,12 +76,13 @@ static void md_prthumanval(char *length) static void usage(void) { + fprintf(stderr, "usage: mdconfig -a -t type [-n] [-o [no]option] ... [-f file]\n" " [-s size] [-S sectorsize] [-u unit]\n" " [-x sectors/track] [-y heads/cylinder]\n" " mdconfig -d -u unit [-o [no]force]\n" -" mdconfig -l [-v] [-n] [-u unit]\n" +" mdconfig -l [-v] [-n] [-f file] [-u unit]\n" " mdconfig file\n"); fprintf(stderr, "\t\ttype = {malloc, vnode, swap}\n"); fprintf(stderr, "\t\toption = {cluster, compress, reserve}\n"); @@ -75,8 +97,7 @@ main(int argc, char **argv) { int ch, fd, i, vflag; char *p; - int cmdline = 0; - char *mdunit = NULL; + char *fflag = NULL, *tflag = NULL, *uflag = NULL; bzero(&mdio, sizeof(mdio)); mdio.md_file = malloc(PATH_MAX); @@ -84,76 +105,59 @@ main(int argc, char **argv) err(1, "could not allocate memory"); vflag = 0; bzero(mdio.md_file, PATH_MAX); + + if (argc == 1) + usage(); + while ((ch = getopt(argc, argv, "ab:df:lno:s:S:t:u:vx:y:")) != -1) { switch (ch) { case 'a': - if (cmdline != 0) - usage(); + if (action != UNSET && action != ATTACH) + errx(1, + "-a is mutually exclusive with -d and -l"); action = ATTACH; - cmdline = 1; break; case 'd': - if (cmdline != 0) - usage(); + if (action != UNSET && action != DETACH) + errx(1, + "-d is mutually exclusive with -a and -l"); action = DETACH; - mdio.md_options = MD_AUTOUNIT; - cmdline = 3; + mdio.md_options |= MD_AUTOUNIT; break; case 'l': - if (cmdline != 0) - usage(); + if (action != UNSET && action != LIST) + errx(1, + "-l is mutually exclusive with -a and -d"); action = LIST; - mdio.md_options = MD_AUTOUNIT; - cmdline = 3; + mdio.md_options |= MD_AUTOUNIT; break; case 'n': nflag = 1; break; case 't': - if (cmdline != 1) - usage(); + if (tflag != NULL) + errx(1, "-t can be passed only once"); + tflag = optarg; if (!strcmp(optarg, "malloc")) { mdio.md_type = MD_MALLOC; - mdio.md_options = MD_AUTOUNIT | MD_COMPRESS; + mdio.md_options |= MD_AUTOUNIT | MD_COMPRESS; + } else if (!strcmp(optarg, "preload")) { + mdio.md_type = MD_PRELOAD; } else if (!strcmp(optarg, "vnode")) { mdio.md_type = MD_VNODE; - mdio.md_options = MD_CLUSTER | MD_AUTOUNIT | MD_COMPRESS; + mdio.md_options |= MD_CLUSTER | MD_AUTOUNIT | MD_COMPRESS; } else if (!strcmp(optarg, "swap")) { mdio.md_type = MD_SWAP; - mdio.md_options = MD_CLUSTER | MD_AUTOUNIT | MD_COMPRESS; - } else { - usage(); - } - cmdline=2; + mdio.md_options |= MD_CLUSTER | MD_AUTOUNIT | MD_COMPRESS; + } else + errx(1, "unknown type: %s", optarg); break; case 'f': - if (cmdline == 0) { - action = ATTACH; - cmdline = 1; - } - if (cmdline == 1) { - /* Imply ``-t vnode'' */ - mdio.md_type = MD_VNODE; - mdio.md_options = MD_CLUSTER | MD_AUTOUNIT | MD_COMPRESS; - cmdline = 2; - } - if (cmdline != 2) - usage(); - md_set_file(optarg); + if (fflag != NULL) + errx(1, "-f can be passed only once"); + fflag = optarg; break; case 'o': - if (action == DETACH) { - if (!strcmp(optarg, "force")) - mdio.md_options |= MD_FORCE; - else if (!strcmp(optarg, "noforce")) - mdio.md_options &= ~MD_FORCE; - else - errx(1, "Unknown option: %s.", optarg); - break; - } - - if (cmdline != 2) - usage(); if (!strcmp(optarg, "async")) mdio.md_options |= MD_ASYNC; else if (!strcmp(optarg, "noasync")) @@ -179,27 +183,12 @@ main(int argc, char **argv) else if (!strcmp(optarg, "noreserve")) mdio.md_options &= ~MD_RESERVE; else - errx(1, "Unknown option: %s.", optarg); + errx(1, "unknown option: %s", optarg); break; case 'S': - if (cmdline != 2) - usage(); mdio.md_sectorsize = strtoul(optarg, &p, 0); break; case 's': - if (cmdline == 0) { - /* Imply ``-a'' */ - action = ATTACH; - cmdline = 1; - } - if (cmdline == 1) { - /* Imply ``-t swap'' */ - mdio.md_type = MD_SWAP; - mdio.md_options = MD_CLUSTER | MD_AUTOUNIT | MD_COMPRESS; - cmdline = 2; - } - if (cmdline != 2) - usage(); mdio.md_mediasize = (off_t)strtoumax(optarg, &p, 0); if (p == NULL || *p == '\0') mdio.md_mediasize *= DEV_BSIZE; @@ -215,34 +204,22 @@ main(int argc, char **argv) mdio.md_mediasize <<= 30; mdio.md_mediasize <<= 10; } else - errx(1, "Unknown suffix on -s argument"); + errx(1, "unknown suffix on -s argument"); break; case 'u': - if (cmdline != 2 && cmdline != 3) - usage(); - if (!strncmp(optarg, "/dev/", 5)) - optarg += 5; + if (!strncmp(optarg, _PATH_DEV, sizeof(_PATH_DEV) - 1)) + optarg += sizeof(_PATH_DEV) - 1; if (!strncmp(optarg, MD_NAME, sizeof(MD_NAME) - 1)) optarg += sizeof(MD_NAME) - 1; - mdio.md_unit = strtoul(optarg, &p, 0); - if (mdio.md_unit == (unsigned)ULONG_MAX || *p != '\0') - errx(1, "bad unit: %s", optarg); - mdunit = optarg; - mdio.md_options &= ~MD_AUTOUNIT; + uflag = optarg; break; case 'v': - if (cmdline != 3) - usage(); vflag = OPT_VERBOSE; break; case 'x': - if (cmdline != 2) - usage(); mdio.md_fwsectors = strtoul(optarg, &p, 0); break; case 'y': - if (cmdline != 2) - usage(); mdio.md_fwheads = strtoul(optarg, &p, 0); break; default: @@ -252,14 +229,88 @@ main(int argc, char **argv) argc -= optind; argv += optind; - if (action == UNSET) { - if (argc != 1) - usage(); + + if (action == UNSET) action = ATTACH; - mdio.md_type = MD_VNODE; - mdio.md_options = MD_CLUSTER | MD_AUTOUNIT | MD_COMPRESS; - cmdline = 2; - md_set_file(*argv); + + if (action == ATTACH) { + if (tflag == NULL) { + /* + * Try to infer the type based on other arguments. + */ + if (fflag != NULL || argc > 0) { + /* Imply ``-t vnode'' */ + mdio.md_type = MD_VNODE; + mdio.md_options |= MD_CLUSTER | MD_AUTOUNIT | + MD_COMPRESS; + } else if (mdio.md_mediasize != 0) { + /* Imply ``-t swap'' */ + mdio.md_type = MD_SWAP; + mdio.md_options |= MD_CLUSTER | MD_AUTOUNIT | + MD_COMPRESS; + } else + errx(1, "unable to determine type"); + } + + if ((fflag != NULL || argc > 0) && mdio.md_type != MD_VNODE) + errx(1, "only -t vnode can be used with file name"); + + if (mdio.md_type == MD_VNODE) { + if (fflag != NULL) { + if (argc != 0) + usage(); + md_set_file(fflag); + } else { + if (argc != 1) + usage(); + md_set_file(*argv); + } + + if ((mdio.md_options & MD_READONLY) == 0 && + access(mdio.md_file, W_OK) < 0 && + (errno == EACCES || errno == EPERM || + errno == EROFS)) { + warnx("WARNING: opening backing store: %s " + "readonly", mdio.md_file); + mdio.md_options |= MD_READONLY; + } + } + + if ((mdio.md_type == MD_MALLOC || mdio.md_type == MD_SWAP) && + mdio.md_mediasize == 0) + errx(1, "must specify -s for -t malloc or -t swap"); + if (mdio.md_type == MD_VNODE && mdio.md_file[0] == '\0') + errx(1, "must specify -f for -t vnode"); + } else { + if (mdio.md_sectorsize != 0) + errx(1, "-S can only be used with -a"); + if (mdio.md_mediasize != 0) + errx(1, "-s can only be used with -a"); + if (mdio.md_fwsectors != 0) + errx(1, "-x can only be used with -a"); + if (mdio.md_fwheads != 0) + errx(1, "-y can only be used with -a"); + if (fflag != NULL && action != LIST) + errx(1, "-f can only be used with -a and -l"); + if (tflag != NULL) + errx(1, "-t can only be used with -a"); + if (argc > 0) + errx(1, "file can only be used with -a"); + if (action != DETACH && (mdio.md_options & ~MD_AUTOUNIT) != 0) + errx(1, "-o can only be used with -a and -d"); + if (action == DETACH && + (mdio.md_options & ~(MD_FORCE | MD_AUTOUNIT)) != 0) + errx(1, "only -o [no]force can be used with -d"); + } + + if (action != LIST && vflag == OPT_VERBOSE) + errx(1, "-v can only be used with -l"); + + if (uflag != NULL) { + mdio.md_unit = strtoul(uflag, &p, 0); + if (mdio.md_unit == (unsigned)ULONG_MAX || *p != '\0') + errx(1, "bad unit: %s", uflag); + mdio.md_options &= ~MD_AUTOUNIT; } mdio.md_version = MDIOVERSION; @@ -267,53 +318,35 @@ main(int argc, char **argv) if (!kld_isloaded("g_md") && kld_load("geom_md") == -1) err(1, "failed to load geom_md module"); - fd = open("/dev/" MDCTL_NAME, O_RDWR, 0); + fd = open(_PATH_DEV MDCTL_NAME, O_RDWR, 0); if (fd < 0) - err(1, "open(/dev/%s)", MDCTL_NAME); - if (cmdline == 2 - && (mdio.md_type == MD_MALLOC || mdio.md_type == MD_SWAP)) - if (mdio.md_mediasize == 0) - errx(1, "must specify -s for -t malloc or -t swap"); - if (cmdline == 2 && mdio.md_type == MD_VNODE) - if (mdio.md_file[0] == '\0') - errx(1, "must specify -f for -t vnode"); - if (mdio.md_type == MD_VNODE && - (mdio.md_options & MD_READONLY) == 0) { - if (access(mdio.md_file, W_OK) < 0 && - (errno == EACCES || errno == EPERM || errno == EROFS)) { - fprintf(stderr, - "WARNING: opening backing store: %s readonly\n", - mdio.md_file); - mdio.md_options |= MD_READONLY; - } - } - if (action == LIST) { - if (mdio.md_options & MD_AUTOUNIT) { - /* - * Listing all devices. This is why we pass NULL - * together with OPT_LIST. - */ - md_list(NULL, OPT_LIST | vflag); - } else { - return (md_query(mdunit)); - } - } else if (action == ATTACH) { - if (cmdline < 2) - usage(); + err(1, "open(%s%s)", _PATH_DEV, MDCTL_NAME); + + if (action == ATTACH) { i = ioctl(fd, MDIOCATTACH, &mdio); if (i < 0) - err(1, "ioctl(/dev/%s)", MDCTL_NAME); + err(1, "ioctl(%s%s)", _PATH_DEV, MDCTL_NAME); if (mdio.md_options & MD_AUTOUNIT) printf("%s%d\n", nflag ? "" : MD_NAME, mdio.md_unit); } else if (action == DETACH) { if (mdio.md_options & MD_AUTOUNIT) - usage(); + errx(1, "-d requires -u"); i = ioctl(fd, MDIOCDETACH, &mdio); if (i < 0) - err(1, "ioctl(/dev/%s)", MDCTL_NAME); + err(1, "ioctl(%s%s)", _PATH_DEV, MDCTL_NAME); + } else if (action == LIST) { + if (mdio.md_options & MD_AUTOUNIT) { + /* + * Listing all devices. This is why we pass NULL + * together with OPT_LIST. + */ + return (md_list(NULL, OPT_LIST | vflag, fflag)); + } else + return (md_query(uflag, vflag, fflag)); + } else usage(); - close (fd); + close(fd); return (0); } @@ -344,7 +377,7 @@ md_set_file(const char *fn) * between list and query mode. */ static int -md_list(char *units, int opt) +md_list(const char *units, int opt, const char *fflag) { struct gmesh gm; struct gprovider *pp; @@ -354,7 +387,7 @@ md_list(char *units, int opt) struct ggeom *gg; struct gclass *gcl; void *sq; - int retcode, found; + int retcode, ffound, ufound; char *type, *file, *length; type = file = length = NULL; @@ -369,7 +402,7 @@ md_list(char *units, int opt) if (sq == NULL) return (-1); - found = 0; + ffound = ufound = 0; while ((gsp = geom_stats_snapshot_next(sq)) != NULL) { gid = geom_lookupid(&gm, gsp->id); if (gid == NULL) @@ -385,18 +418,25 @@ md_list(char *units, int opt) if (retcode != 1) continue; else - found = 1; + ufound = 1; } gc = &pp->lg_config; - if (nflag && strncmp(pp->lg_name, "md", 2) == 0) + type = geom_config_get(gc, "type"); + if (strcmp(type, "vnode") == 0) { + file = geom_config_get(gc, "file"); + if (fflag != NULL && + strcmp(fflag, file) != 0) + continue; + else + ffound = 1; + } + if (nflag && strncmp(pp->lg_name, MD_NAME, 2) == 0) printf("%s", pp->lg_name + 2); else printf("%s", pp->lg_name); - if (opt & OPT_VERBOSE || opt & OPT_UNIT) { - type = geom_config_get(gc, "type"); - if (strcmp(type, "vnode") == 0) - file = geom_config_get(gc, "file"); + if (opt & OPT_VERBOSE || + ((opt & OPT_UNIT) && fflag == NULL)) { length = geom_config_get(gc, "length"); printf("\t%s\t", type); if (length != NULL) @@ -417,7 +457,9 @@ md_list(char *units, int opt) printf("\n"); /* XXX: Check if it's enough to clean everything. */ geom_stats_snapshot_free(sq); - if ((opt & OPT_UNIT) && found) + if (((opt & OPT_UNIT) && (fflag == NULL) && ufound) || + ((opt & OPT_UNIT) == 0 && (fflag != NULL) && ffound) || + ((opt & OPT_UNIT) && (fflag != NULL) && ufound && ffound)) return (0); else return (-1); @@ -444,10 +486,10 @@ geom_config_get(struct gconf *g, const c * otherwise. */ static int -md_find(char *list, const char *name) +md_find(const char *list, const char *name) { int ret; - char num[16]; + char num[PATH_MAX]; char *ptr, *p, *u; ret = 0; @@ -455,10 +497,10 @@ md_find(char *list, const char *name) if (ptr == NULL) return (-1); for (p = ptr; (u = strsep(&p, ",")) != NULL;) { - if (strncmp(u, "/dev/", 5) == 0) - u += 5; + if (strncmp(u, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) + u += sizeof(_PATH_DEV) - 1; /* Just in case user specified number instead of full name */ - snprintf(num, sizeof(num), "md%s", u); + snprintf(num, sizeof(num), "%s%s", MD_NAME, u); if (strcmp(u, name) == 0 || strcmp(num, name) == 0) { ret = 1; break; @@ -484,8 +526,9 @@ md_prthumanval(char *length) (void)printf("%6s", buf); } -int -md_query(char *name) +static int +md_query(const char *name, const int opt, const char *fflag) { - return (md_list(name, OPT_UNIT)); + + return (md_list(name, opt | OPT_UNIT, fflag)); } From owner-svn-src-stable@FreeBSD.ORG Thu Jun 27 07:27:08 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E85B197B; Thu, 27 Jun 2013 07:27:08 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C98DA1EEE; Thu, 27 Jun 2013 07:27:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5R7R8Ad043924; Thu, 27 Jun 2013 07:27:08 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5R7R8oB043923; Thu, 27 Jun 2013 07:27:08 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201306270727.r5R7R8oB043923@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 27 Jun 2013 07:27:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252292 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 07:27:09 -0000 Author: kib Date: Thu Jun 27 07:27:08 2013 New Revision: 252292 URL: http://svnweb.freebsd.org/changeset/base/252292 Log: MFC r251684: Fix two issues with the spin loops in the umtx(2) implementation. - When looping, check for the pending suspension. - Add missed checks for the faults from casuword*(). Modified: stable/9/sys/kern/kern_umtx.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_umtx.c ============================================================================== --- stable/9/sys/kern/kern_umtx.c Thu Jun 27 06:57:09 2013 (r252291) +++ stable/9/sys/kern/kern_umtx.c Thu Jun 27 07:27:08 2013 (r252292) @@ -505,6 +505,32 @@ umtxq_count_pi(struct umtx_key *key, str return (0); } +static int +umtxq_check_susp(struct thread *td) +{ + struct proc *p; + int error; + + /* + * The check for TDF_NEEDSUSPCHK is racy, but it is enough to + * eventually break the lockstep loop. + */ + if ((td->td_flags & TDF_NEEDSUSPCHK) == 0) + return (0); + error = 0; + p = td->td_proc; + PROC_LOCK(p); + if (P_SHOULDSTOP(p) || + ((p->p_flag & P_TRACED) && (td->td_dbgflags & TDB_SUSPEND))) { + if (p->p_flag & P_SINGLE_EXIT) + error = EINTR; + else + error = ERESTART; + } + PROC_UNLOCK(p); + return (error); +} + /* * Wake up threads waiting on an userland object. */ @@ -666,6 +692,10 @@ _do_lock_umtx(struct thread *td, struct if (owner == -1) return (EFAULT); + error = umtxq_check_susp(td); + if (error != 0) + break; + /* If this failed the lock has changed, restart. */ continue; } @@ -715,6 +745,9 @@ _do_lock_umtx(struct thread *td, struct umtxq_remove(uq); umtxq_unlock(&uq->uq_key); umtx_key_release(&uq->uq_key); + + if (error == 0) + error = umtxq_check_susp(td); } return (0); @@ -865,6 +898,10 @@ _do_lock_umtx32(struct thread *td, uint3 if (owner == -1) return (EFAULT); + error = umtxq_check_susp(td); + if (error != 0) + break; + /* If this failed the lock has changed, restart. */ continue; } @@ -914,6 +951,9 @@ _do_lock_umtx32(struct thread *td, uint3 umtxq_remove(uq); umtxq_unlock(&uq->uq_key); umtx_key_release(&uq->uq_key); + + if (error == 0) + error = umtxq_check_susp(td); } return (0); @@ -1157,6 +1197,10 @@ _do_lock_normal(struct thread *td, struc if (owner == -1) return (EFAULT); + error = umtxq_check_susp(td); + if (error != 0) + return (error); + /* If this failed the lock has changed, restart. */ continue; } @@ -1215,6 +1259,9 @@ _do_lock_normal(struct thread *td, struc umtxq_remove(uq); umtxq_unlock(&uq->uq_key); umtx_key_release(&uq->uq_key); + + if (error == 0) + error = umtxq_check_susp(td); } return (0); @@ -1374,6 +1421,11 @@ do_wake2_umutex(struct thread *td, struc if (old == owner) break; owner = old; + if (old == -1) + break; + error = umtxq_check_susp(td); + if (error != 0) + break; } } else if (count == 1) { owner = fuword32(__DEVOLATILE(uint32_t *, &m->m_owner)); @@ -1384,6 +1436,11 @@ do_wake2_umutex(struct thread *td, struc if (old == owner) break; owner = old; + if (old == -1) + break; + error = umtxq_check_susp(td); + if (error != 0) + break; } } umtxq_lock(&key); @@ -1848,6 +1905,10 @@ _do_lock_pi(struct thread *td, struct um break; } + error = umtxq_check_susp(td); + if (error != 0) + break; + /* If this failed the lock has changed, restart. */ continue; } @@ -1904,6 +1965,10 @@ _do_lock_pi(struct thread *td, struct um umtxq_unbusy(&uq->uq_key); umtxq_unlock(&uq->uq_key); } + + error = umtxq_check_susp(td); + if (error != 0) + break; } umtxq_lock(&uq->uq_key); @@ -2585,10 +2650,17 @@ do_rw_rdlock(struct thread *td, struct u return (EAGAIN); } oldstate = casuword32(&rwlock->rw_state, state, state + 1); + if (oldstate == -1) { + umtx_key_release(&uq->uq_key); + return (EFAULT); + } if (oldstate == state) { umtx_key_release(&uq->uq_key); return (0); } + error = umtxq_check_susp(td); + if (error != 0) + break; state = oldstate; } @@ -2609,9 +2681,22 @@ do_rw_rdlock(struct thread *td, struct u /* set read contention bit */ while ((state & wrflags) && !(state & URWLOCK_READ_WAITERS)) { oldstate = casuword32(&rwlock->rw_state, state, state | URWLOCK_READ_WAITERS); + if (oldstate == -1) { + error = EFAULT; + break; + } if (oldstate == state) goto sleep; state = oldstate; + error = umtxq_check_susp(td); + if (error != 0) + break; + } + if (error != 0) { + umtxq_lock(&uq->uq_key); + umtxq_unbusy(&uq->uq_key); + umtxq_unlock(&uq->uq_key); + break; } /* state is changed while setting flags, restart */ @@ -2619,6 +2704,9 @@ do_rw_rdlock(struct thread *td, struct u umtxq_lock(&uq->uq_key); umtxq_unbusy(&uq->uq_key); umtxq_unlock(&uq->uq_key); + error = umtxq_check_susp(td); + if (error != 0) + break; continue; } @@ -2650,15 +2738,24 @@ sleep: for (;;) { oldstate = casuword32(&rwlock->rw_state, state, state & ~URWLOCK_READ_WAITERS); + if (oldstate == -1) { + error = EFAULT; + break; + } if (oldstate == state) break; state = oldstate; + error = umtxq_check_susp(td); + if (error != 0) + break; } } umtxq_lock(&uq->uq_key); umtxq_unbusy(&uq->uq_key); umtxq_unlock(&uq->uq_key); + if (error != 0) + break; } umtx_key_release(&uq->uq_key); return (error); @@ -2713,11 +2810,18 @@ do_rw_wrlock(struct thread *td, struct u state = fuword32(__DEVOLATILE(int32_t *, &rwlock->rw_state)); while (!(state & URWLOCK_WRITE_OWNER) && URWLOCK_READER_COUNT(state) == 0) { oldstate = casuword32(&rwlock->rw_state, state, state | URWLOCK_WRITE_OWNER); + if (oldstate == -1) { + umtx_key_release(&uq->uq_key); + return (EFAULT); + } if (oldstate == state) { umtx_key_release(&uq->uq_key); return (0); } state = oldstate; + error = umtxq_check_susp(td); + if (error != 0) + break; } if (error) { @@ -2747,15 +2851,31 @@ do_rw_wrlock(struct thread *td, struct u while (((state & URWLOCK_WRITE_OWNER) || URWLOCK_READER_COUNT(state) != 0) && (state & URWLOCK_WRITE_WAITERS) == 0) { oldstate = casuword32(&rwlock->rw_state, state, state | URWLOCK_WRITE_WAITERS); + if (oldstate == -1) { + error = EFAULT; + break; + } if (oldstate == state) goto sleep; state = oldstate; + error = umtxq_check_susp(td); + if (error != 0) + break; + } + if (error != 0) { + umtxq_lock(&uq->uq_key); + umtxq_unbusy(&uq->uq_key); + umtxq_unlock(&uq->uq_key); + break; } if (!(state & URWLOCK_WRITE_OWNER) && URWLOCK_READER_COUNT(state) == 0) { umtxq_lock(&uq->uq_key); umtxq_unbusy(&uq->uq_key); umtxq_unlock(&uq->uq_key); + error = umtxq_check_susp(td); + if (error != 0) + break; continue; } sleep: @@ -2784,9 +2904,21 @@ sleep: for (;;) { oldstate = casuword32(&rwlock->rw_state, state, state & ~URWLOCK_WRITE_WAITERS); + if (oldstate == -1) { + error = EFAULT; + break; + } if (oldstate == state) break; state = oldstate; + error = umtxq_check_susp(td); + /* + * We are leaving the URWLOCK_WRITE_WAITERS + * behind, but this should not harm the + * correctness. + */ + if (error != 0) + break; } blocked_readers = fuword32(&rwlock->rw_blocked_readers); } else @@ -2848,12 +2980,19 @@ do_rw_unlock(struct thread *td, struct u for (;;) { oldstate = casuword32(&rwlock->rw_state, state, state & ~URWLOCK_WRITE_OWNER); + if (oldstate == -1) { + error = EFAULT; + goto out; + } if (oldstate != state) { state = oldstate; if (!(oldstate & URWLOCK_WRITE_OWNER)) { error = EPERM; goto out; } + error = umtxq_check_susp(td); + if (error != 0) + goto out; } else break; } @@ -2861,14 +3000,20 @@ do_rw_unlock(struct thread *td, struct u for (;;) { oldstate = casuword32(&rwlock->rw_state, state, state - 1); + if (oldstate == -1) { + error = EFAULT; + goto out; + } if (oldstate != state) { state = oldstate; if (URWLOCK_READER_COUNT(oldstate) == 0) { error = EPERM; goto out; } - } - else + error = umtxq_check_susp(td); + if (error != 0) + goto out; + } else break; } } else { From owner-svn-src-stable@FreeBSD.ORG Thu Jun 27 09:14:50 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A9155197; Thu, 27 Jun 2013 09:14:50 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9AD2D15C4; Thu, 27 Jun 2013 09:14:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5R9EokW075230; Thu, 27 Jun 2013 09:14:50 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5R9EoWO075229; Thu, 27 Jun 2013 09:14:50 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201306270914.r5R9EoWO075229@svn.freebsd.org> From: Marius Strobl Date: Thu, 27 Jun 2013 09:14:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252296 - stable/9/sys/boot/sparc64/loader X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 09:14:50 -0000 Author: marius Date: Thu Jun 27 09:14:50 2013 New Revision: 252296 URL: http://svnweb.freebsd.org/changeset/base/252296 Log: MFC: r251589 - The method introduced as part of r234898 (MFCed to stable/9 in r236076) for not altering the boot path when booting from ZFS turned out to also cause the boot path not being adjusted if booting from CD-ROM with firmware versions that do not employ the "cdrom" alias in that case. So shuffle the code around instead in order to achieve the original intent. Ideally, we shouldn't fiddle with the boot path when booting from UFS on a disk either; unfortunately, there doesn't seem to be an universal way of telling disks and CD-ROMs apart, though. [1] - Use NULL instead of 0 for pointers. PR: 179289 [1] Modified: stable/9/sys/boot/sparc64/loader/main.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/boot/ (props changed) Modified: stable/9/sys/boot/sparc64/loader/main.c ============================================================================== --- stable/9/sys/boot/sparc64/loader/main.c Thu Jun 27 09:08:07 2013 (r252295) +++ stable/9/sys/boot/sparc64/loader/main.c Thu Jun 27 09:14:50 2013 (r252296) @@ -160,17 +160,19 @@ struct devsw *devsw[] = { #ifdef LOADER_ZFS_SUPPORT &zfs_dev, #endif - 0 + NULL }; + struct arch_switch archsw; static struct file_format sparc64_elf = { __elfN(loadfile), __elfN(exec) }; + struct file_format *file_formats[] = { &sparc64_elf, - 0 + NULL }; struct fs_ops *file_system[] = { @@ -198,19 +200,20 @@ struct fs_ops *file_system[] = { #ifdef LOADER_TFTP_SUPPORT &tftp_fsops, #endif - 0 + NULL }; + struct netif_driver *netif_drivers[] = { #ifdef LOADER_NET_SUPPORT &ofwnet, #endif - 0 + NULL }; extern struct console ofwconsole; struct console *consoles[] = { &ofwconsole, - 0 + NULL }; #ifdef LOADER_DEBUG @@ -854,24 +857,6 @@ main(int (*openfirm)(void *)) OF_getprop(chosen, "bootpath", bootpath, sizeof(bootpath)); /* - * Sun compatible bootable CD-ROMs have a disk label placed - * before the cd9660 data, with the actual filesystem being - * in the first partition, while the other partitions contain - * pseudo disk labels with embedded boot blocks for different - * architectures, which may be followed by UFS filesystems. - * The firmware will set the boot path to the partition it - * boots from ('f' in the sun4u case), but we want the kernel - * to be loaded from the cd9660 fs ('a'), so the boot path - * needs to be altered. - */ - if (bootpath[strlen(bootpath) - 2] == ':' && - bootpath[strlen(bootpath) - 1] == 'f' && - strstr(bootpath, "cdrom") != NULL) { - bootpath[strlen(bootpath) - 1] = 'a'; - printf("Boot path set to %s\n", bootpath); - } - - /* * Initialize devices. */ for (dp = devsw; *dp != 0; dp++) @@ -883,9 +868,24 @@ main(int (*openfirm)(void *)) (void)strncpy(bootpath, zfs_fmtdev(&zfs_currdev), sizeof(bootpath) - 1); bootpath[sizeof(bootpath) - 1] = '\0'; - } + } else #endif + /* + * Sun compatible bootable CD-ROMs have a disk label placed before + * the ISO 9660 data, with the actual file system being in the first + * partition, while the other partitions contain pseudo disk labels + * with embedded boot blocks for different architectures, which may + * be followed by UFS file systems. + * The firmware will set the boot path to the partition it boots from + * ('f' in the sun4u/sun4v case), but we want the kernel to be loaded + * from the ISO 9660 file system ('a'), so the boot path needs to be + * altered. + */ + if (bootpath[strlen(bootpath) - 2] == ':' && + bootpath[strlen(bootpath) - 1] == 'f') + bootpath[strlen(bootpath) - 1] = 'a'; + env_setenv("currdev", EV_VOLATILE, bootpath, ofw_setcurrdev, env_nounset); env_setenv("loaddev", EV_VOLATILE, bootpath, From owner-svn-src-stable@FreeBSD.ORG Thu Jun 27 09:20:23 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 45DD4461; Thu, 27 Jun 2013 09:20:23 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3904B161E; Thu, 27 Jun 2013 09:20:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5R9KNi4077279; Thu, 27 Jun 2013 09:20:23 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5R9KNr3077245; Thu, 27 Jun 2013 09:20:23 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201306270920.r5R9KNr3077245@svn.freebsd.org> From: Marius Strobl Date: Thu, 27 Jun 2013 09:20:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252297 - stable/9/sys/dev/puc X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 09:20:23 -0000 Author: marius Date: Thu Jun 27 09:20:22 2013 New Revision: 252297 URL: http://svnweb.freebsd.org/changeset/base/252297 Log: MFC: r248340 Add support for Exar XR17V358 8-port serial device to puc(4) Modified: stable/9/sys/dev/puc/pucdata.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/puc/ (props changed) Modified: stable/9/sys/dev/puc/pucdata.c ============================================================================== --- stable/9/sys/dev/puc/pucdata.c Thu Jun 27 09:14:50 2013 (r252296) +++ stable/9/sys/dev/puc/pucdata.c Thu Jun 27 09:20:22 2013 (r252297) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); static puc_config_f puc_config_amc; static puc_config_f puc_config_diva; static puc_config_f puc_config_exar; +static puc_config_f puc_config_exar_pcie; static puc_config_f puc_config_icbook; static puc_config_f puc_config_moxa; static puc_config_f puc_config_oxford_pcie; @@ -630,6 +631,14 @@ const struct puc_cfg puc_pci_devices[] = PUC_PORT_8S, 0x10, 0, -1, }, + /* The XR17V358 uses the 125MHz PCIe clock as its reference clock. */ + { 0x13a8, 0x0358, 0xffff, 0, + "Exar XR17V358", + 125000000, + PUC_PORT_8S, 0x10, 0, -1, + .config_function = puc_config_exar_pcie + }, + { 0x13fe, 0x1600, 0x1602, 0x0002, "Advantech PCI-1602", DEFAULT_RCLK * 8, @@ -1186,6 +1195,17 @@ puc_config_exar(struct puc_softc *sc, en } static int +puc_config_exar_pcie(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port, + intptr_t *res) +{ + if (cmd == PUC_CFG_GET_OFS) { + *res = port * 0x400; + return (0); + } + return (ENXIO); +} + +static int puc_config_icbook(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port, intptr_t *res) { From owner-svn-src-stable@FreeBSD.ORG Thu Jun 27 09:21:22 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 91E4A5CF; Thu, 27 Jun 2013 09:21:22 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 84A161626; Thu, 27 Jun 2013 09:21:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5R9LMUN077645; Thu, 27 Jun 2013 09:21:22 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5R9LMQp077644; Thu, 27 Jun 2013 09:21:22 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201306270921.r5R9LMQp077644@svn.freebsd.org> From: Marius Strobl Date: Thu, 27 Jun 2013 09:21:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252298 - stable/9/sys/dev/puc X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 09:21:22 -0000 Author: marius Date: Thu Jun 27 09:21:22 2013 New Revision: 252298 URL: http://svnweb.freebsd.org/changeset/base/252298 Log: MFC: r248472 Correct the definition for Exar XR17V258IV: we must use a config_function to specify the offset into the PCI memory spare at which each serial port will find its registers. This was already done for other Exar PCI serial devices; it was accidentally omitted for this specific device. Modified: stable/9/sys/dev/puc/pucdata.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/puc/ (props changed) Modified: stable/9/sys/dev/puc/pucdata.c ============================================================================== --- stable/9/sys/dev/puc/pucdata.c Thu Jun 27 09:20:22 2013 (r252297) +++ stable/9/sys/dev/puc/pucdata.c Thu Jun 27 09:21:22 2013 (r252298) @@ -629,6 +629,7 @@ const struct puc_cfg puc_pci_devices[] = "Exar XR17V258IV", DEFAULT_RCLK * 8, PUC_PORT_8S, 0x10, 0, -1, + .config_function = puc_config_exar }, /* The XR17V358 uses the 125MHz PCIe clock as its reference clock. */ From owner-svn-src-stable@FreeBSD.ORG Thu Jun 27 09:22:37 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7C6B87DB; Thu, 27 Jun 2013 09:22:37 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6EAF2163B; Thu, 27 Jun 2013 09:22:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5R9MbUL077864; Thu, 27 Jun 2013 09:22:37 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5R9MbFY077863; Thu, 27 Jun 2013 09:22:37 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201306270922.r5R9MbFY077863@svn.freebsd.org> From: Marius Strobl Date: Thu, 27 Jun 2013 09:22:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252299 - stable/9/sys/dev/puc X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 09:22:37 -0000 Author: marius Date: Thu Jun 27 09:22:36 2013 New Revision: 252299 URL: http://svnweb.freebsd.org/changeset/base/252299 Log: MFC: r251713 Fix whitespace and normalize some entries. Modified: stable/9/sys/dev/puc/pucdata.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/puc/ (props changed) Modified: stable/9/sys/dev/puc/pucdata.c ============================================================================== --- stable/9/sys/dev/puc/pucdata.c Thu Jun 27 09:21:22 2013 (r252298) +++ stable/9/sys/dev/puc/pucdata.c Thu Jun 27 09:22:36 2013 (r252299) @@ -512,14 +512,14 @@ const struct puc_cfg puc_pci_devices[] = "Moxa Technologies, Smartio CP-102E/PCIe", DEFAULT_RCLK * 8, PUC_PORT_2S, 0x14, 0, -1, - .config_function = puc_config_moxa + .config_function = puc_config_moxa }, { 0x1393, 0x1025, 0xffff, 0, "Moxa Technologies, Smartio CP-102EL/PCIe", DEFAULT_RCLK * 8, PUC_PORT_2S, 0x14, 0, -1, - .config_function = puc_config_moxa + .config_function = puc_config_moxa }, { 0x1393, 0x1040, 0xffff, 0, @@ -550,7 +550,7 @@ const struct puc_cfg puc_pci_devices[] = "Moxa Technologies, Smartio CP-104EL-A/PCIe", DEFAULT_RCLK * 8, PUC_PORT_4S, 0x14, 0, -1, - .config_function = puc_config_moxa + .config_function = puc_config_moxa }, { 0x1393, 0x1120, 0xffff, 0, @@ -569,14 +569,14 @@ const struct puc_cfg puc_pci_devices[] = "Moxa Technologies, Smartio CP-114EL/PCIe", DEFAULT_RCLK * 8, PUC_PORT_4S, 0x14, 0, -1, - .config_function = puc_config_moxa + .config_function = puc_config_moxa }, { 0x1393, 0x1182, 0xffff, 0, "Moxa Technologies, Smartio CP-118EL-A/PCIe", DEFAULT_RCLK * 8, PUC_PORT_8S, 0x14, 0, -1, - .config_function = puc_config_moxa + .config_function = puc_config_moxa }, { 0x1393, 0x1680, 0xffff, 0, @@ -601,7 +601,7 @@ const struct puc_cfg puc_pci_devices[] = "Moxa Technologies, Smartio CP-168EL-A/PCIe", DEFAULT_RCLK * 8, PUC_PORT_8S, 0x14, 0, -1, - .config_function = puc_config_moxa + .config_function = puc_config_moxa }, { 0x13a8, 0x0152, 0xffff, 0, @@ -711,10 +711,10 @@ const struct puc_cfg puc_pci_devices[] = * I/O Flex PCI I/O Card Model-223 with 4 serial and 1 parallel ports. */ { - 0x1415, 0x9501, 0x10fc ,0xc070, - "I-O DATA RSA-PCI2/R", - DEFAULT_RCLK * 8, - PUC_PORT_2S, 0x10, 0, 8, + 0x1415, 0x9501, 0x10fc, 0xc070, + "I-O DATA RSA-PCI2/R", + DEFAULT_RCLK * 8, + PUC_PORT_2S, 0x10, 0, 8, }, { 0x1415, 0x9501, 0x131f, 0x2050, @@ -830,7 +830,7 @@ const struct puc_cfg puc_pci_devices[] = * * Lindy 51189 (4 port) * - * + * * StarTech.com PEX4S952 (4 port) and PEX8S952 (8 port) * */ @@ -990,10 +990,10 @@ const struct puc_cfg puc_pci_devices[] = PUC_PORT_2S, 0x10, 0, 8, }, - { 0x5372, 0x6873, 0xffff, 0, - "Sun 1040 PCI Quad Serial", - DEFAULT_RCLK, - PUC_PORT_4S, 0x10, 4, 0, + { 0x5372, 0x6873, 0xffff, 0, + "Sun 1040 PCI Quad Serial", + DEFAULT_RCLK, + PUC_PORT_4S, 0x10, 4, 0, }, { 0x6666, 0x0001, 0xffff, 0, @@ -1015,10 +1015,10 @@ const struct puc_cfg puc_pci_devices[] = }, { 0x9710, 0x9815, 0xffff, 0, - "NetMos NM9815 Dual 1284 Printer port", + "NetMos NM9815 Dual 1284 Printer port", 0, PUC_PORT_2P, 0x10, 8, 0, - }, + }, /* * This is more specific than the generic NM9835 entry that follows, and @@ -1444,19 +1444,19 @@ puc_config_timedia(struct puc_softc *sc, { static const uint16_t dual[] = { 0x0002, 0x4036, 0x4037, 0x4038, 0x4078, 0x4079, 0x4085, - 0x4088, 0x4089, 0x5037, 0x5078, 0x5079, 0x5085, 0x6079, - 0x7079, 0x8079, 0x8137, 0x8138, 0x8237, 0x8238, 0x9079, + 0x4088, 0x4089, 0x5037, 0x5078, 0x5079, 0x5085, 0x6079, + 0x7079, 0x8079, 0x8137, 0x8138, 0x8237, 0x8238, 0x9079, 0x9137, 0x9138, 0x9237, 0x9238, 0xA079, 0xB079, 0xC079, 0xD079, 0 }; static const uint16_t quad[] = { - 0x4055, 0x4056, 0x4095, 0x4096, 0x5056, 0x8156, 0x8157, - 0x8256, 0x8257, 0x9056, 0x9156, 0x9157, 0x9158, 0x9159, + 0x4055, 0x4056, 0x4095, 0x4096, 0x5056, 0x8156, 0x8157, + 0x8256, 0x8257, 0x9056, 0x9156, 0x9157, 0x9158, 0x9159, 0x9256, 0x9257, 0xA056, 0xA157, 0xA158, 0xA159, 0xB056, 0xB157, 0 }; static const uint16_t octa[] = { - 0x4065, 0x4066, 0x5065, 0x5066, 0x8166, 0x9066, 0x9166, + 0x4065, 0x4066, 0x5065, 0x5066, 0x8166, 0x9066, 0x9166, 0x9167, 0x9168, 0xA066, 0xA167, 0xA168, 0 }; static const struct { From owner-svn-src-stable@FreeBSD.ORG Thu Jun 27 09:23:54 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 2A95495E; Thu, 27 Jun 2013 09:23:54 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 02F26164D; Thu, 27 Jun 2013 09:23:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5R9NrH1078049; Thu, 27 Jun 2013 09:23:53 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5R9NrbU078048; Thu, 27 Jun 2013 09:23:53 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201306270923.r5R9NrbU078048@svn.freebsd.org> From: Marius Strobl Date: Thu, 27 Jun 2013 09:23:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252300 - stable/9/sys/dev/puc X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 09:23:54 -0000 Author: marius Date: Thu Jun 27 09:23:53 2013 New Revision: 252300 URL: http://svnweb.freebsd.org/changeset/base/252300 Log: MFC: r251715 All of Oxford/PLX OX16PCI954, OXm16PCI954 and OXu16PCI954 share the exact same (subsystem) device and vendor IDs. However, the reference design for the OXu16PCI954 uses a 14.7456 MHz clock (as does the EXSYS EX-41098-2 equipped with these), while at least the OX16PCI954 defaults to a 1.8432 MHz one. According to the datasheets of these chips, the only difference in PCI configuration space is that OXu16PCI954 have a revision ID of 1 while the other two are at 0. So employ the latter for determining the default clock rates of this family. Modified: stable/9/sys/dev/puc/pucdata.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/puc/ (props changed) Modified: stable/9/sys/dev/puc/pucdata.c ============================================================================== --- stable/9/sys/dev/puc/pucdata.c Thu Jun 27 09:22:36 2013 (r252299) +++ stable/9/sys/dev/puc/pucdata.c Thu Jun 27 09:23:53 2013 (r252300) @@ -53,6 +53,7 @@ static puc_config_f puc_config_exar; static puc_config_f puc_config_exar_pcie; static puc_config_f puc_config_icbook; static puc_config_f puc_config_moxa; +static puc_config_f puc_config_oxford_pci954; static puc_config_f puc_config_oxford_pcie; static puc_config_f puc_config_quatech; static puc_config_f puc_config_syba; @@ -743,8 +744,9 @@ const struct puc_cfg puc_pci_devices[] = { 0x1415, 0x9501, 0xffff, 0, "Oxford Semiconductor OX16PCI954 UARTs", - DEFAULT_RCLK, + 0, PUC_PORT_4S, 0x10, 0, 8, + .config_function = puc_config_oxford_pci954 }, { 0x1415, 0x950a, 0x131f, 0x2030, @@ -1516,6 +1518,28 @@ puc_config_timedia(struct puc_softc *sc, } static int +puc_config_oxford_pci954(struct puc_softc *sc, enum puc_cfg_cmd cmd, + int port __unused, intptr_t *res) +{ + + switch (cmd) { + case PUC_CFG_GET_CLOCK: + /* + * OXu16PCI954 use a 14.7456 MHz clock by default while + * OX16PCI954 and OXm16PCI954 employ a 1.8432 MHz one. + */ + if (pci_get_revid(sc->sc_dev) == 1) + *res = DEFAULT_RCLK * 8; + else + *res = DEFAULT_RCLK; + return (0); + default: + break; + } + return (ENXIO); +} + +static int puc_config_oxford_pcie(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port, intptr_t *res) { From owner-svn-src-stable@FreeBSD.ORG Thu Jun 27 09:30:10 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 79994B65; Thu, 27 Jun 2013 09:30:10 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 52A3C168F; Thu, 27 Jun 2013 09:30:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5R9UAp8079079; Thu, 27 Jun 2013 09:30:10 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5R9UAgE079078; Thu, 27 Jun 2013 09:30:10 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201306270930.r5R9UAgE079078@svn.freebsd.org> From: Marius Strobl Date: Thu, 27 Jun 2013 09:30:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252301 - stable/9/sys/dev/mpt X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 09:30:10 -0000 Author: marius Date: Thu Jun 27 09:30:09 2013 New Revision: 252301 URL: http://svnweb.freebsd.org/changeset/base/252301 Log: MFC: r252180 Flag mpt(4) as supporting unmapped I/O; all necessary conversion actually already has been done as part of r246713 (MFCed to stable/9 in r251874) except for a comment update. Modified: stable/9/sys/dev/mpt/mpt_cam.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/mpt/mpt_cam.c ============================================================================== --- stable/9/sys/dev/mpt/mpt_cam.c Thu Jun 27 09:23:53 2013 (r252300) +++ stable/9/sys/dev/mpt/mpt_cam.c Thu Jun 27 09:30:09 2013 (r252301) @@ -1254,7 +1254,8 @@ mpt_timeout(void *arg) } /* - * Callback routine from "bus_dmamap_load" or, in simple cases, called directly. + * Callback routine from bus_dmamap_load_ccb(9) or, in simple cases, called + * directly. * * Takes a list of physical segments and builds the SGL for SCSI IO command * and forwards the commard to the IOC after one last check that CAM has not @@ -1688,7 +1689,6 @@ mpt_execute_req(void *arg, bus_dma_segme hdrp = req->req_vbuf; mpt_off = req->req_vbuf; - if (error == 0 && ((uint32_t)nseg) >= mpt->max_seg_cnt) { error = EFBIG; } @@ -3595,21 +3595,21 @@ mpt_action(struct cam_sim *sim, union cc #ifdef CAM_NEW_TRAN_CODE cpi->protocol = PROTO_SCSI; if (mpt->is_fc) { - cpi->hba_misc = PIM_NOBUSRESET; + cpi->hba_misc = PIM_NOBUSRESET | PIM_UNMAPPED; cpi->base_transfer_speed = 100000; cpi->hba_inquiry = PI_TAG_ABLE; cpi->transport = XPORT_FC; cpi->transport_version = 0; cpi->protocol_version = SCSI_REV_SPC; } else if (mpt->is_sas) { - cpi->hba_misc = PIM_NOBUSRESET; + cpi->hba_misc = PIM_NOBUSRESET | PIM_UNMAPPED; cpi->base_transfer_speed = 300000; cpi->hba_inquiry = PI_TAG_ABLE; cpi->transport = XPORT_SAS; cpi->transport_version = 0; cpi->protocol_version = SCSI_REV_SPC2; } else { - cpi->hba_misc = PIM_SEQSCAN; + cpi->hba_misc = PIM_SEQSCAN | PIM_UNMAPPED; cpi->base_transfer_speed = 3300; cpi->hba_inquiry = PI_SDTR_ABLE|PI_TAG_ABLE|PI_WIDE_16; cpi->transport = XPORT_SPI; From owner-svn-src-stable@FreeBSD.ORG Thu Jun 27 10:55:35 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id BF95AD92; Thu, 27 Jun 2013 10:55:35 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B14CD1AAD; Thu, 27 Jun 2013 10:55:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5RAtZZ4003474; Thu, 27 Jun 2013 10:55:35 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5RAtZnA003473; Thu, 27 Jun 2013 10:55:35 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306271055.r5RAtZnA003473@svn.freebsd.org> From: Steven Hartland Date: Thu, 27 Jun 2013 10:55:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252303 - stable/9/sys/cam/scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 10:55:35 -0000 Author: smh Date: Thu Jun 27 10:55:35 2013 New Revision: 252303 URL: http://svnweb.freebsd.org/changeset/base/252303 Log: MFC r252045: Corrected ATA Passthrough defines from decimal to hex Modified: stable/9/sys/cam/scsi/scsi_all.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.h Thu Jun 27 10:42:09 2013 (r252302) +++ stable/9/sys/cam/scsi/scsi_all.h Thu Jun 27 10:55:35 2013 (r252303) @@ -917,10 +917,10 @@ struct ata_pass_12 { #define AP_PROTO_DMA_QUEUED (0x07 << 1) #define AP_PROTO_DEVICE_DIAG (0x08 << 1) #define AP_PROTO_DEVICE_RESET (0x09 << 1) -#define AP_PROTO_UDMA_IN (0x10 << 1) -#define AP_PROTO_UDMA_OUT (0x11 << 1) -#define AP_PROTO_FPDMA (0x12 << 1) -#define AP_PROTO_RESP_INFO (0x15 << 1) +#define AP_PROTO_UDMA_IN (0x0a << 1) +#define AP_PROTO_UDMA_OUT (0x0b << 1) +#define AP_PROTO_FPDMA (0x0c << 1) +#define AP_PROTO_RESP_INFO (0x0f << 1) #define AP_MULTI 0xe0 u_int8_t flags; #define AP_T_LEN 0x03 From owner-svn-src-stable@FreeBSD.ORG Thu Jun 27 10:58:31 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9A514F4E; Thu, 27 Jun 2013 10:58:31 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8C5B51AD8; Thu, 27 Jun 2013 10:58:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5RAwVaa003817; Thu, 27 Jun 2013 10:58:31 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5RAwVdk003816; Thu, 27 Jun 2013 10:58:31 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306271058.r5RAwVdk003816@svn.freebsd.org> From: Steven Hartland Date: Thu, 27 Jun 2013 10:58:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252304 - stable/8/sys/cam/scsi X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 10:58:31 -0000 Author: smh Date: Thu Jun 27 10:58:31 2013 New Revision: 252304 URL: http://svnweb.freebsd.org/changeset/base/252304 Log: MFC r252045: Corrected ATA Passthrough defines from decimal to hex Modified: stable/8/sys/cam/scsi/scsi_all.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cam/ (props changed) Modified: stable/8/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/8/sys/cam/scsi/scsi_all.h Thu Jun 27 10:55:35 2013 (r252303) +++ stable/8/sys/cam/scsi/scsi_all.h Thu Jun 27 10:58:31 2013 (r252304) @@ -571,10 +571,10 @@ struct ata_pass_12 { #define AP_PROTO_DMA_QUEUED (0x07 << 1) #define AP_PROTO_DEVICE_DIAG (0x08 << 1) #define AP_PROTO_DEVICE_RESET (0x09 << 1) -#define AP_PROTO_UDMA_IN (0x10 << 1) -#define AP_PROTO_UDMA_OUT (0x11 << 1) -#define AP_PROTO_FPDMA (0x12 << 1) -#define AP_PROTO_RESP_INFO (0x15 << 1) +#define AP_PROTO_UDMA_IN (0x0a << 1) +#define AP_PROTO_UDMA_OUT (0x0b << 1) +#define AP_PROTO_FPDMA (0x0c << 1) +#define AP_PROTO_RESP_INFO (0x0f << 1) #define AP_MULTI 0xe0 u_int8_t flags; #define AP_T_LEN 0x03 From owner-svn-src-stable@FreeBSD.ORG Thu Jun 27 13:03:20 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 18BC5F6; Thu, 27 Jun 2013 13:03:20 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 09ADD126D; Thu, 27 Jun 2013 13:03:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5RD3JjN042031; Thu, 27 Jun 2013 13:03:19 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5RD3JgO042024; Thu, 27 Jun 2013 13:03:19 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201306271303.r5RD3JgO042024@svn.freebsd.org> From: Glen Barber Date: Thu, 27 Jun 2013 13:03:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252305 - in stable/9: . release/doc share/man/man5 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 13:03:20 -0000 Author: gjb Date: Thu Jun 27 13:03:19 2013 New Revision: 252305 URL: http://svnweb.freebsd.org/changeset/base/252305 Log: MFC r230786, r246283, r251084, r251085, r251086: r230786 (imp): - Allow specification of build shell for the buildenv target. r246283 (hrs) (partial): - Add {WORLD,KERNEL}_FLAGS to [BTWK]MAKE. r251084: - r245757 introduced warning output if update method is set to CVS_UPDATE or SUP_UPDATE. - CVS exporter for stable/9/ is turned off for nearly one month now. - It is finally time to swing the ax at these update methods. r251085: - Fix typo introduced in r251084. r251086: - Remove references to CVS_UPDATE and SUP_UPDATE to catch up with r251084. Approved by: kib (mentor) Modified: stable/9/Makefile.inc1 (contents, props changed) stable/9/release/doc/Makefile stable/9/share/man/man5/make.conf.5 Directory Properties: stable/9/release/doc/ (props changed) stable/9/share/man/man5/ (props changed) Modified: stable/9/Makefile.inc1 ============================================================================== --- stable/9/Makefile.inc1 Thu Jun 27 10:58:31 2013 (r252304) +++ stable/9/Makefile.inc1 Thu Jun 27 13:03:19 2013 (r252305) @@ -23,6 +23,9 @@ # when NO_ROOT is set. (default: ${DESTDIR}/METALOG) # TARGET="machine" to crossbuild world for a different machine type # TARGET_ARCH= may be required when a TARGET supports multiple endians +# BUILDENV_SHELL= shell to launch for the buildenv target (def:/bin/sh) +# WORLD_FLAGS= additional flags to pass to make(1) during buildworld +# KERNEL_FLAGS= additional flags to pass to make(1) during buildkernel # # The intended user-driven targets are: @@ -111,15 +114,10 @@ CLEANDIR= clean cleandepend CLEANDIR= cleandir .endif -CVS?= cvs -CVSFLAGS?= -A -P -d -I! -SVN?= svn +BUILDENV_SHELL?=/bin/sh + +SVN?= /usr/local/bin/svn SVNFLAGS?= -r HEAD -SUP?= /usr/bin/csup -SUPFLAGS?= -g -L 2 -.if defined(SUPHOST) -SUPFLAGS+= -h ${SUPHOST} -.endif MAKEOBJDIRPREFIX?= /usr/obj .if !defined(OSRELDATE) @@ -240,7 +238,7 @@ BMAKEENV= INSTALL="sh ${.CURDIR}/tools/i MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \ COMPILER_TYPE=${COMPILER_TYPE} BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ - ${BMAKEENV} ${MAKE} -f Makefile.inc1 \ + ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ DESTDIR= \ BOOTSTRAPPING=${OSRELDATE} \ SSP_CFLAGS= \ @@ -250,7 +248,7 @@ BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ # build-tools stage TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ - ${BMAKEENV} ${MAKE} -f Makefile.inc1 \ + ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ DESTDIR= \ BOOTSTRAPPING=${OSRELDATE} \ @@ -283,7 +281,7 @@ WMAKE_COMPILER_TYPE= gcc WMAKE_COMPILER_TYPE= clang .endif WMAKEENV+= COMPILER_TYPE=${WMAKE_COMPILER_TYPE} -WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP} +WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP} .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64" # 32 bit world @@ -373,7 +371,7 @@ IMAKE_MTREE= MTREE_CMD="nmtree ${MTREEFL # kernel stage KMAKEENV= ${WMAKEENV} -KMAKE= ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} +KMAKE= ${KMAKEENV} ${MAKE} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME} # # buildworld @@ -602,7 +600,7 @@ buildenvvars: buildenv: @echo Entering world for ${TARGET_ARCH}:${TARGET} - @cd ${.CURDIR} && env ${WMAKEENV} sh || true + @cd ${.CURDIR} && env ${WMAKEENV} ${BUILDENV_SHELL} || true TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32} toolchain: ${TOOLCHAIN_TGTS} @@ -1014,59 +1012,18 @@ doxygen: # latest copy. # update: -.if defined(SUP_UPDATE) +.if (defined(CVS_UPDATE) || defined(SUP_UPDATE)) && !defined(SVN_UPDATE) @echo "--------------------------------------------------------------" - @echo ">>> Running ${SUP}" + @echo "CVS_UPDATE and SUP_UPDATE are no longer supported." + @echo "Please see: https://wiki.freebsd.org/CvsIsDeprecated" @echo "--------------------------------------------------------------" - @echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!" - @echo "!! Update methods with ${SUP} are deprecated." - @echo "!! Please see http://www.freebsd.org/handbook/svn.html" - @echo "!! and convert your update method to SVN_UPDATE or" - @echo "!! freebsd-update(8)." - @echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!" - @sleep 5 -.if defined(SUPFILE) - @${SUP} ${SUPFLAGS} ${SUPFILE} -.endif -.if defined(SUPFILE1) - @${SUP} ${SUPFLAGS} ${SUPFILE1} -.endif -.if defined(SUPFILE2) - @${SUP} ${SUPFLAGS} ${SUPFILE2} -.endif -.if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE) - @${SUP} ${SUPFLAGS} ${PORTSSUPFILE} -.endif -.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE) - @${SUP} ${SUPFLAGS} ${DOCSUPFILE} -.endif -.endif -.if defined(CVS_UPDATE) - @cd ${.CURDIR} ; \ - if [ -d CVS ] ; then \ - echo "--------------------------------------------------------------" ; \ - echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} ; \ - echo "--------------------------------------------------------------" ; \ - echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!" ; \ - echo "!! Update methods with CVS are deprecated." ; \ - echo "!! Please see http://www.freebsd.org/handbook/svn.html" ; \ - echo "!! and convert your update method to SVN_UPDATE or" ; \ - echo "!! freebsd-update(8)." ; \ - echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!" ; \ - sleep 5 ; \ - echo ${CVS} -R -q update ${CVSFLAGS} ; \ - ${CVS} -R -q update ${CVSFLAGS} ; \ - fi + @exit 1 .endif .if defined(SVN_UPDATE) - @cd ${.CURDIR} ; \ - if [ -d .svn ] ; then \ - echo "--------------------------------------------------------------" ; \ - echo ">>> Updating ${.CURDIR} using Subversion" ; \ - echo "--------------------------------------------------------------" ; \ - echo ${SVN} update ${SVNFLAGS} ; \ - ${SVN} update ${SVNFLAGS} ; \ - fi + @echo "--------------------------------------------------------------" + @echo ">>> Updating ${.CURDIR} using Subversion" + @echo "--------------------------------------------------------------" + @(cd ${.CURDIR} && ${SVN} update ${SVNFLAGS}) .endif # Modified: stable/9/release/doc/Makefile ============================================================================== --- stable/9/release/doc/Makefile Thu Jun 27 10:58:31 2013 (r252304) +++ stable/9/release/doc/Makefile Thu Jun 27 13:03:19 2013 (r252305) @@ -12,26 +12,30 @@ SUBDIR+= share/xml RELN_ROOT?= ${.CURDIR} -.if defined(SUPHOST) -SUPFLAGS+= -h ${SUPHOST} -.endif +SVN?= /usr/local/bin/svn +SVNFLAGS?= -r HEAD + update: -.if defined(SUP_UPDATE) -.if !defined(DOCSUPFILE) - @echo "Error: Please define DOCSUPFILE before doing make update." +.if (defined(CVS_UPDATE) || defined(SUP_UPDATE)) && !defined(SVN_UPDATE) + @echo "--------------------------------------------------------------" + @echo "CVS_UPDATE and SUP_UPDATE are no longer supported." + @echo "Please see: https://wiki.freebsd.org/CvsIsDeprecated" + @echo "--------------------------------------------------------------" @exit 1 .endif +.if defined(SVN_UPDATE) +. if !exists(${SVN}) @echo "--------------------------------------------------------------" - @echo ">>> Running ${SUP}" + @echo ">>> Updating ${RELN_ROOT} requires ${SVN}." @echo "--------------------------------------------------------------" - @${SUP} ${SUPFLAGS} ${DOCSUPFILE} -.elif defined(CVS_UPDATE) + @exit 1 +. endif @echo "--------------------------------------------------------------" - @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT} + @echo ">>> Updating ${.CURDIR} using Subversion" @echo "--------------------------------------------------------------" - cd ${.CURDIR}; cvs -q update -P -d + @(cd ${.CURDIR} && ${SVN} update ${SVNFLAGS}) .else - @echo "Error: Please define either SUP_UPDATE or CVS_UPDATE first." + @echo "Error: Please define SVN_UPDATE first." .endif .include "${RELN_ROOT}/share/mk/doc.relnotes.mk" Modified: stable/9/share/man/man5/make.conf.5 ============================================================================== --- stable/9/share/man/man5/make.conf.5 Thu Jun 27 10:58:31 2013 (r252304) +++ stable/9/share/man/man5/make.conf.5 Thu Jun 27 13:03:19 2013 (r252305) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 26, 2013 +.Dd May 28, 2013 .Dt MAKE.CONF 5 .Os .Sh NAME @@ -177,16 +177,6 @@ Refer to for a list of recognized .Va CPUTYPE options. -.It Va CVS_UPDATE -.Pq Vt bool -Set this to use -.Xr cvs 1 -to update your -.Pa src , ports -and -.Pa doc -trees with -.Dq Li "make update" . .It Va CXXFLAGS .Pq Vt str Controls the compiler settings when compiling C++ code. @@ -255,61 +245,6 @@ Set this to not update the doc tree duri .Pq Vt bool Set this to not update the ports tree during .Dq Li "make update" . -.It Va SUP -.Pq Vt str -The location of the -.Xr csup 1 -or -.Xr cvsup 1 -command for -.Dq Li "make update" . -.It Va SUPFILE -.Pq Vt str -The first -.Ar supfile -to use when doing a -.Dq Li "make update" . -For example, -.Pa /usr/share/examples/cvsup/standard-supfile . -.It Va SUPFILE1 -.Pq Vt str -The second -.Ar supfile -to use when doing a -.Dq Li "make update" . -.It Va SUPFILE2 -.Pq Vt str -The third -.Ar supfile -to use when doing a -.Dq Li "make update" . -.It Va SUPFLAGS -.Pq Vt str -The flag for the -.Xr sup 1 -command when doing -.Dq Li "make update" . -This defaults to -.Op Fl g L Ar 2 . -.It Va SUPHOST -.Pq Vt str -The hostname of the sup server to use when doing -.Dq Li "make update" . -.It Va SUP_UPDATE -.Pq Vt bool -Set this to use -.Xr csup 1 -to update your -.Pa src , -and -.Pa ports -trees with -.Dq Li "make update" . -This option is deprecated. -Please use -.Va SVN_UPDATE -or -.Xr freebsd-update 8 . .It Va SVN_UPDATE .Pq Vt bool Set this to use From owner-svn-src-stable@FreeBSD.ORG Thu Jun 27 13:58:27 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 89FB4365; Thu, 27 Jun 2013 13:58:27 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from onyx.glenbarber.us (onyx.glenbarber.us [199.48.134.227]) by mx1.freebsd.org (Postfix) with ESMTP id 667571722; Thu, 27 Jun 2013 13:58:27 +0000 (UTC) Received: from glenbarber.us (unknown [IPv6:2001:470:8:120e:1:1:c57c:729]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gjb) by onyx.glenbarber.us (Postfix) with ESMTPSA id ED80623F840; Thu, 27 Jun 2013 09:58:25 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.8.3 onyx.glenbarber.us ED80623F840 Authentication-Results: onyx.glenbarber.us; dkim=none reason="no signature"; dkim-adsp=none Date: Thu, 27 Jun 2013 09:58:20 -0400 From: Glen Barber To: Xin LI Subject: Re: svn commit: r252283 - in stable/9: contrib/tcpdump usr.sbin/tcpdump/tcpdump Message-ID: <20130627135820.GA1686@glenbarber.us> References: <201306270038.r5R0c0S4024756@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="45Z9DzgjV8m4Oswq" Content-Disposition: inline In-Reply-To: <201306270038.r5R0c0S4024756@svn.freebsd.org> X-Operating-System: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 13:58:27 -0000 --45Z9DzgjV8m4Oswq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jun 27, 2013 at 12:38:00AM +0000, Xin LI wrote: > Author: delphij > Date: Thu Jun 27 00:37:59 2013 > New Revision: 252283 > URL: http://svnweb.freebsd.org/changeset/base/252283 >=20 > Log: > MFC: tcpdump 4.4.0. >=20 I think this breaks the build. cc -O -pipe -G0 -I/src/usr.sbin/tcpdump/tcpdump -I/src/usr.sbin/tcpdump/tcpdump/../../../contrib/tcpdump -DHAVE_CONFIG_H -D_U_=3D"__attribute__((unused))" -DINET6 -DLBL_ALIGN -I/obj/mips.mipsel/src/tmp/usr/include/openssl -DHAVE_LIBCRYPTO -DHAVE_OPEN= SSL_EVP_H -DHAVE_NET_PFVAR_H -std=3Dgnu99 -Wsystem-headers -Werror -Wall -Wno-format-= y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-ar= ith -Wno-uninitialized -Wno-pointer-sign -c /src/usr.sbin/tcpdump/tcpdump/../../../contrib/tcpdump/print-pfsync.c /src/usr.sbin/tcpdump/tcpdump/../../../contrib/tcpdump/print-pfsync.c: In f= unction 'print_src_dst': /src/usr.sbin/tcpdump/tcpdump/../../../contrib/tcpdump/print-pfsync.c:330: = error: 'tcpstates' undeclared (first use in this function) /src/usr.sbin/tcpdump/tcpdump/../../../contrib/tcpdump/print-pfsync.c:330: = error: (Each undeclared identifier is reported only once /src/usr.sbin/tcpdump/tcpdump/../../../contrib/tcpdump/print-pfsync.c:330: = error: for each function it appears in.) *** Error code 1 Stop in /src/usr.sbin/tcpdump/tcpdump. *** Error code 1 Glen --45Z9DzgjV8m4Oswq Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQEcBAEBCAAGBQJRzET8AAoJEFJPDDeguUajBw0IALVurLjmbsLLPRNu9ToXEXIz rij0hclqBaGjCvb48is9oCU7R2u23x2/tgIeap7YQaXQmCDpBUFIU2CeCSfeqZ2s O7FohjT5G6vqtFGkmMZZDEiw0nNBIi55PeCNBWrh61G71oi/fcU/3pBv+WDTh77h XH3zP0ThUATZQKUUbEGxm7jy0d5Jp+WRKAtPZQPx+Z3o8MgK/mhoY6uOkONL0pPG ah1tc8evzAhyEEtZ7F0t1F8nyyph21Ok5mSPOFfB6btS1kWoAYOVUzB6aRfjWvIO tNBLo7DT8dw38Yf32x40Ipfb+uJ4wQUy+xxWEP2AtWWjt2Ouy8dA2qqFdn99oGs= =7W5q -----END PGP SIGNATURE----- --45Z9DzgjV8m4Oswq-- From owner-svn-src-stable@FreeBSD.ORG Thu Jun 27 14:32:52 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 91C0AD41; Thu, 27 Jun 2013 14:32:52 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 828D01918; Thu, 27 Jun 2013 14:32:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5REWqRW067845; Thu, 27 Jun 2013 14:32:52 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5REWphP067841; Thu, 27 Jun 2013 14:32:51 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306271432.r5REWphP067841@svn.freebsd.org> From: Steven Hartland Date: Thu, 27 Jun 2013 14:32:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252306 - in stable/8: cddl/contrib/opensolaris/cmd/zpool sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 14:32:52 -0000 Author: smh Date: Thu Jun 27 14:32:51 2013 New Revision: 252306 URL: http://svnweb.freebsd.org/changeset/base/252306 Log: MFC r252056: Fix destroyed ZFS pools failing to import MFC r252059: Fix ZFS zpool freeze (debug command) not processing due to invalid ioctl call syntax. MFC r252060: Fix intermittent ZFS lock panic MFC r252061: Switch ZFS mutex_owner macro to use sx_xholder as its now exported via sx.h Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/8/sys/cddl/compat/opensolaris/sys/mutex.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jun 27 13:03:19 2013 (r252305) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jun 27 14:32:51 2013 (r252306) @@ -5332,10 +5332,9 @@ main(int argc, char **argv) * 'freeze' is a vile debugging abomination, so we treat * it as such. */ - char buf[16384]; - int fd = open(ZFS_DEV, O_RDWR); - (void) strcpy((void *)buf, argv[2]); - return (!!ioctl(fd, ZFS_IOC_POOL_FREEZE, buf)); + zfs_cmd_t zc = { 0 }; + (void) strlcpy(zc.zc_name, argv[2], sizeof (zc.zc_name)); + return (!!zfs_ioctl(g_zfs, ZFS_IOC_POOL_FREEZE, &zc)); } else { (void) fprintf(stderr, gettext("unrecognized " "command '%s'\n"), cmdname); Modified: stable/8/sys/cddl/compat/opensolaris/sys/mutex.h ============================================================================== --- stable/8/sys/cddl/compat/opensolaris/sys/mutex.h Thu Jun 27 13:03:19 2013 (r252305) +++ stable/8/sys/cddl/compat/opensolaris/sys/mutex.h Thu Jun 27 14:32:51 2013 (r252306) @@ -71,8 +71,7 @@ typedef struct sx kmutex_t; #define mutex_tryenter(lock) sx_try_xlock(lock) #define mutex_exit(lock) sx_xunlock(lock) #define mutex_owned(lock) sx_xlocked(lock) -/* TODO: Change to sx_xholder() once it is moved from kern_sx.c to sx.h. */ -#define mutex_owner(lock) ((lock)->sx_lock & SX_LOCK_SHARED ? NULL : (struct thread *)SX_OWNER((lock)->sx_lock)) +#define mutex_owner(lock) sx_xholder(lock) #endif /* _KERNEL */ Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Thu Jun 27 13:03:19 2013 (r252305) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Thu Jun 27 14:32:51 2013 (r252306) @@ -1834,6 +1834,7 @@ vdev_dtl_sync(vdev_t *vd, uint64_t txg) vdev_config_dirty(vd->vdev_top); } + bzero(&smlock, sizeof (smlock)); mutex_init(&smlock, NULL, MUTEX_DEFAULT, NULL); space_map_create(&smsync, sm->sm_start, sm->sm_size, sm->sm_shift, Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Thu Jun 27 13:03:19 2013 (r252305) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Thu Jun 27 14:32:51 2013 (r252306) @@ -270,8 +270,7 @@ vdev_geom_read_config(struct g_consumer continue; if (nvlist_lookup_uint64(*config, ZPOOL_CONFIG_POOL_STATE, - &state) != 0 || state == POOL_STATE_DESTROYED || - state > POOL_STATE_L2CACHE) { + &state) != 0 || state > POOL_STATE_L2CACHE) { nvlist_free(*config); *config = NULL; continue; From owner-svn-src-stable@FreeBSD.ORG Thu Jun 27 15:52:56 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 99F4A9E9; Thu, 27 Jun 2013 15:52:56 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-wg0-x233.google.com (mail-wg0-x233.google.com [IPv6:2a00:1450:400c:c00::233]) by mx1.freebsd.org (Postfix) with ESMTP id 662511F3B; Thu, 27 Jun 2013 15:52:55 +0000 (UTC) Received: by mail-wg0-f51.google.com with SMTP id e11so729039wgh.30 for ; Thu, 27 Jun 2013 08:52:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=DybVAblirX5fgIh2jZHuZGLzv5XdTsfpmDvhj0MHX28=; b=j/SHHZYuPZzDQP677NBS+dPzg7JcORKKBAlUFNksN42AGsbSp8xCadwEnAHqYgRP/g uqEoPboqGAEuGy43RN0qLo/hW0q2UibcKHOydD7cHn5Zz9ivCftJ3MtEP6cA6bx5PKz8 BxOe3XL0iCow/x6GfsEAJ0Dc3+X68vlUl1xCA2qlDNfo+/FVum3akSt0qHCUJxCKjVzg vCZCGh4L7IFyCTgT0ltFGE1aOSUkLq7hWiIH+SWrI4Jwydpn7x9Vs/qp9lNCfVgGjDJF fk4bdyXEEAFXn4i1fK/QzXQ48Ut1wiljX0LXMS3X3UlrZcci84KCVB+6jrNpWalyj4AP UVag== MIME-Version: 1.0 X-Received: by 10.180.182.229 with SMTP id eh5mr6353746wic.63.1372348374550; Thu, 27 Jun 2013 08:52:54 -0700 (PDT) Sender: pluknet@gmail.com Received: by 10.194.172.133 with HTTP; Thu, 27 Jun 2013 08:52:54 -0700 (PDT) In-Reply-To: <20130627135820.GA1686@glenbarber.us> References: <201306270038.r5R0c0S4024756@svn.freebsd.org> <20130627135820.GA1686@glenbarber.us> Date: Thu, 27 Jun 2013 19:52:54 +0400 X-Google-Sender-Auth: Kx2EzqCtA9yt8N7wHcESLSMtER8 Message-ID: Subject: Re: svn commit: r252283 - in stable/9: contrib/tcpdump usr.sbin/tcpdump/tcpdump From: Sergey Kandaurov To: Glen Barber Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Xin LI , svn-src-stable-9@freebsd.org X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 15:52:56 -0000 On 27 June 2013 17:58, Glen Barber wrote: > On Thu, Jun 27, 2013 at 12:38:00AM +0000, Xin LI wrote: >> Author: delphij >> Date: Thu Jun 27 00:37:59 2013 >> New Revision: 252283 >> URL: http://svnweb.freebsd.org/changeset/base/252283 >> >> Log: >> MFC: tcpdump 4.4.0. >> > > I think this breaks the build. > > cc -O -pipe -G0 -I/src/usr.sbin/tcpdump/tcpdump > -I/src/usr.sbin/tcpdump/tcpdump/../../../contrib/tcpdump -DHAVE_CONFIG_H > -D_U_="__attribute__((unused))" -DINET6 -DLBL_ALIGN > -I/obj/mips.mipsel/src/tmp/usr/include/openssl -DHAVE_LIBCRYPTO -DHAVE_OPENSSL_EVP_H > -DHAVE_NET_PFVAR_H -std=gnu99 -Wsystem-headers -Werror -Wall -Wno-format-y2k -W > -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith > -Wno-uninitialized -Wno-pointer-sign -c > /src/usr.sbin/tcpdump/tcpdump/../../../contrib/tcpdump/print-pfsync.c > /src/usr.sbin/tcpdump/tcpdump/../../../contrib/tcpdump/print-pfsync.c: In function > 'print_src_dst': > /src/usr.sbin/tcpdump/tcpdump/../../../contrib/tcpdump/print-pfsync.c:330: error: 'tcpstates' > undeclared (first use in this function) > /src/usr.sbin/tcpdump/tcpdump/../../../contrib/tcpdump/print-pfsync.c:330: error: (Each > undeclared identifier is reported only once > /src/usr.sbin/tcpdump/tcpdump/../../../contrib/tcpdump/print-pfsync.c:330: error: for each > function it appears in.) It is broken in stable/9 due to contrib/pf include spaghetti. This does work in head thanks to glebius. This change tries to fix the build on stable/9. Merge r240136 partially from projects/pf via head. This is a direct change due to significant divergence in code. Index: sys/contrib/pf/net/if_pfsync.c =================================================================== --- sys/contrib/pf/net/if_pfsync.c (revision 252306) +++ sys/contrib/pf/net/if_pfsync.c (working copy) @@ -114,6 +114,7 @@ #include #include #include +#include #include #ifdef INET Index: sys/contrib/pf/net/pf.c =================================================================== --- sys/contrib/pf/net/pf.c (revision 252306) +++ sys/contrib/pf/net/pf.c (working copy) @@ -111,6 +111,7 @@ #include #include #include +#include #include #include #include Index: sys/contrib/pf/net/pf_norm.c =================================================================== --- sys/contrib/pf/net/pf_norm.c (revision 252306) +++ sys/contrib/pf/net/pf_norm.c (working copy) @@ -67,6 +67,7 @@ #include #include #include +#include #include #include #include Index: sys/contrib/pf/net/pfvar.h =================================================================== --- sys/contrib/pf/net/pfvar.h (revision 252306) +++ sys/contrib/pf/net/pfvar.h (working copy) @@ -58,8 +58,6 @@ #include #endif -#include - struct ip; struct ip6_hdr; #ifdef __FreeBSD__ -- wbr, pluknet From owner-svn-src-stable@FreeBSD.ORG Thu Jun 27 17:18:52 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 24236EC9; Thu, 27 Jun 2013 17:18:52 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from anubis.delphij.net (anubis.delphij.net [64.62.153.212]) by mx1.freebsd.org (Postfix) with ESMTP id 0A6D11331; Thu, 27 Jun 2013 17:18:51 +0000 (UTC) Received: from zeta.ixsystems.com (c-67-188-85-47.hsd1.ca.comcast.net [67.188.85.47]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by anubis.delphij.net (Postfix) with ESMTPSA id 50FA01EBDC; Thu, 27 Jun 2013 10:18:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=delphij.net; s=anubis; t=1372353531; bh=hgt/t7/5IgznaqU6/6apowa8Qj2l4iWpMhEfZLDayFc=; h=Date:From:Reply-To:To:CC:Subject:References:In-Reply-To; b=oWkgkrg3PNFs/nezkLE1dX/zxRcjZWsuZY677tKMdPmMNKUrFYHtbEbjvi+OFcnrE HPmkTVeZJO9cBngWQ+g05EquWQ+CglD6aJV8HZLjWANwRe2lyPDgSJSq54q9AxnVZ6 46CtR14vWuHlpK2mgwKORkuc8SiRvnsXSmkGRvGc= Message-ID: <51CC73F8.4060206@delphij.net> Date: Thu, 27 Jun 2013 10:18:48 -0700 From: Xin Li Organization: The FreeBSD Project MIME-Version: 1.0 To: Glen Barber Subject: Re: svn commit: r252283 - in stable/9: contrib/tcpdump usr.sbin/tcpdump/tcpdump References: <201306270038.r5R0c0S4024756@svn.freebsd.org> <20130627135820.GA1686@glenbarber.us> In-Reply-To: <20130627135820.GA1686@glenbarber.us> X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Xin LI , svn-src-stable-9@freebsd.org X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: d@delphij.net List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 17:18:52 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 On 06/27/13 06:58, Glen Barber wrote: > On Thu, Jun 27, 2013 at 12:38:00AM +0000, Xin LI wrote: >> Author: delphij Date: Thu Jun 27 00:37:59 2013 New Revision: >> 252283 URL: http://svnweb.freebsd.org/changeset/base/252283 >> >> Log: MFC: tcpdump 4.4.0. >> > > I think this breaks the build. I'll fix this asap. Cheers, - -- Xin LI https://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJRzHP4AAoJEG80Jeu8UPuz07kH/15VQh2bOnSK86+rfDx1w01P nD4wxr7TnZuTk/D6hfGUoHpfyFBGdC6l8aCeWQJHGGwd4FuEcFcxV7k9BMqFvNdr kJyhO1ZR2QvIda2eRjW2rzGMsKNYK6zJiMYjE5NKUUW27PIPVr+YbWb7zSwUPlhz 3/bD4xndI/pyxPUvPJ7/7/T1kqsUmvwAIrVEKABs6AQjhQ8vJQfCc8hdiyDZgav/ /GtQtKiRqRTMXLTQOAgCwpsYc/lwpi66sZdY7WNVNdqPZ9RbxKqZWPwc+gLsHWDO FcMVliD2uVarXd6a2BMceZzLcnqN4FKRanTHcmm3TD1IrjiePtRiQ2ds/tHF68o= =+GO0 -----END PGP SIGNATURE----- From owner-svn-src-stable@FreeBSD.ORG Thu Jun 27 17:33:05 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id CE9AA33D; Thu, 27 Jun 2013 17:33:05 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BF7A613CC; Thu, 27 Jun 2013 17:33:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5RHX5NW018731; Thu, 27 Jun 2013 17:33:05 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5RHX5sx018730; Thu, 27 Jun 2013 17:33:05 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201306271733.r5RHX5sx018730@svn.freebsd.org> From: Xin LI Date: Thu, 27 Jun 2013 17:33:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252307 - stable/9/contrib/tcpdump X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 17:33:05 -0000 Author: delphij Date: Thu Jun 27 17:33:04 2013 New Revision: 252307 URL: http://svnweb.freebsd.org/changeset/base/252307 Log: Fix build: in a recent pf refactor (head@240233), pf_var.h was modified to not include netinet/tcp_fsm.h, and HEAD tcpdump rely on this change as the tcp_fsm.h will only be processed once. Solve this by defining TCPSTATES earlier. This wouldn't cause breakage should pf be merged in the future. Noticed by: tinderbox via many Pointy hat to: delphij Modified: stable/9/contrib/tcpdump/print-pfsync.c Modified: stable/9/contrib/tcpdump/print-pfsync.c ============================================================================== --- stable/9/contrib/tcpdump/print-pfsync.c Thu Jun 27 14:32:51 2013 (r252306) +++ stable/9/contrib/tcpdump/print-pfsync.c Thu Jun 27 17:33:04 2013 (r252307) @@ -37,10 +37,10 @@ #include #include +#define TCPSTATES #include /* XXX */ #include #include -#define TCPSTATES #include #include From owner-svn-src-stable@FreeBSD.ORG Thu Jun 27 18:20:20 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id A85FA3A2; Thu, 27 Jun 2013 18:20:20 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 981E21801; Thu, 27 Jun 2013 18:20:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5RIKKfq031249; Thu, 27 Jun 2013 18:20:20 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5RIKJGR031244; Thu, 27 Jun 2013 18:20:19 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201306271820.r5RIKJGR031244@svn.freebsd.org> From: Steven Hartland Date: Thu, 27 Jun 2013 18:20:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252308 - in stable/9: cddl/contrib/opensolaris/cmd/zpool sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 18:20:20 -0000 Author: smh Date: Thu Jun 27 18:20:19 2013 New Revision: 252308 URL: http://svnweb.freebsd.org/changeset/base/252308 Log: MFC r252056: Fix destroyed ZFS pools failing to import MFC r252059: Fix ZFS zpool freeze (debug command) not processing due to invalid ioctl call syntax. MFC r252060: Fix intermittent ZFS lock panic MFC r252061: Switch ZFS mutex_owner macro to use sx_xholder as its now exported via sx.h Modified: stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/9/sys/cddl/compat/opensolaris/sys/mutex.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jun 27 17:33:04 2013 (r252307) +++ stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jun 27 18:20:19 2013 (r252308) @@ -5322,10 +5322,9 @@ main(int argc, char **argv) * 'freeze' is a vile debugging abomination, so we treat * it as such. */ - char buf[16384]; - int fd = open(ZFS_DEV, O_RDWR); - (void) strcpy((void *)buf, argv[2]); - return (!!ioctl(fd, ZFS_IOC_POOL_FREEZE, buf)); + zfs_cmd_t zc = { 0 }; + (void) strlcpy(zc.zc_name, argv[2], sizeof (zc.zc_name)); + return (!!zfs_ioctl(g_zfs, ZFS_IOC_POOL_FREEZE, &zc)); } else { (void) fprintf(stderr, gettext("unrecognized " "command '%s'\n"), cmdname); Modified: stable/9/sys/cddl/compat/opensolaris/sys/mutex.h ============================================================================== --- stable/9/sys/cddl/compat/opensolaris/sys/mutex.h Thu Jun 27 17:33:04 2013 (r252307) +++ stable/9/sys/cddl/compat/opensolaris/sys/mutex.h Thu Jun 27 18:20:19 2013 (r252308) @@ -71,8 +71,7 @@ typedef struct sx kmutex_t; #define mutex_tryenter(lock) sx_try_xlock(lock) #define mutex_exit(lock) sx_xunlock(lock) #define mutex_owned(lock) sx_xlocked(lock) -/* TODO: Change to sx_xholder() once it is moved from kern_sx.c to sx.h. */ -#define mutex_owner(lock) ((lock)->sx_lock & SX_LOCK_SHARED ? NULL : (struct thread *)SX_OWNER((lock)->sx_lock)) +#define mutex_owner(lock) sx_xholder(lock) #endif /* _KERNEL */ Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Thu Jun 27 17:33:04 2013 (r252307) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Thu Jun 27 18:20:19 2013 (r252308) @@ -1834,6 +1834,7 @@ vdev_dtl_sync(vdev_t *vd, uint64_t txg) vdev_config_dirty(vd->vdev_top); } + bzero(&smlock, sizeof (smlock)); mutex_init(&smlock, NULL, MUTEX_DEFAULT, NULL); space_map_create(&smsync, sm->sm_start, sm->sm_size, sm->sm_shift, Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Thu Jun 27 17:33:04 2013 (r252307) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Thu Jun 27 18:20:19 2013 (r252308) @@ -270,8 +270,7 @@ vdev_geom_read_config(struct g_consumer continue; if (nvlist_lookup_uint64(*config, ZPOOL_CONFIG_POOL_STATE, - &state) != 0 || state == POOL_STATE_DESTROYED || - state > POOL_STATE_L2CACHE) { + &state) != 0 || state > POOL_STATE_L2CACHE) { nvlist_free(*config); *config = NULL; continue; From owner-svn-src-stable@FreeBSD.ORG Thu Jun 27 20:35:39 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A9C291C9; Thu, 27 Jun 2013 20:35:39 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 99B8A1DC9; Thu, 27 Jun 2013 20:35:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5RKZdeW070608; Thu, 27 Jun 2013 20:35:39 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5RKZdgB070607; Thu, 27 Jun 2013 20:35:39 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306272035.r5RKZdgB070607@svn.freebsd.org> From: John Baldwin Date: Thu, 27 Jun 2013 20:35:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252317 - stable/9/sys/dev/pci X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 20:35:39 -0000 Author: jhb Date: Thu Jun 27 20:35:39 2013 New Revision: 252317 URL: http://svnweb.freebsd.org/changeset/base/252317 Log: MFC 250418,252166: Revision 233677 broke certain machines. Specifically, if the firmware/BIOS assigned conflicting ranges to BARs then leaving the BARs alone could result in one device stealing mmio accesses intended to go to a second device. Prior to 233677 the PCI bus driver attempted to handle this case by clearing the BAR to 0 depending on BARs based at 0 not decoding (which is not guaranteed to be true). Now when a conflicting BAR is detected the following steps are taken: 1) If hw.pci.realloc_bars (a new tunable) is enabled (default is disabled), then ignore the current BAR setting from the firmware and attempt to allocate a fresh resource range for the BAR. 2) If 1) failed (or was disabled), disable decoding for the relevant BAR type (e.g. disable mem decoding for a memory BAR) and emit a warning if booting verbose. Modified: stable/9/sys/dev/pci/pci.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/pci/pci.c ============================================================================== --- stable/9/sys/dev/pci/pci.c Thu Jun 27 20:27:34 2013 (r252316) +++ stable/9/sys/dev/pci/pci.c Thu Jun 27 20:35:39 2013 (r252317) @@ -289,6 +289,12 @@ SYSCTL_INT(_hw_pci, OID_AUTO, enable_io_ enable these bits correctly. We'd like to do this all the time, but there\n\ are some peripherals that this causes problems with."); +static int pci_do_realloc_bars = 0; +TUNABLE_INT("hw.pci.realloc_bars", &pci_do_realloc_bars); +SYSCTL_INT(_hw_pci, OID_AUTO, realloc_bars, CTLFLAG_RW, + &pci_do_realloc_bars, 0, + "Attempt to allocate a new range for any BARs whose original firmware-assigned ranges fail to allocate during the initial device scan."); + static int pci_do_power_nodriver = 0; TUNABLE_INT("hw.pci.do_power_nodriver", &pci_do_power_nodriver); SYSCTL_INT(_hw_pci, OID_AUTO, do_power_nodriver, CTLFLAG_RW, @@ -2745,13 +2751,34 @@ pci_add_map(device_t bus, device_t dev, */ res = resource_list_reserve(rl, bus, dev, type, ®, start, end, count, prefetch ? RF_PREFETCHABLE : 0); + if (pci_do_realloc_bars && res == NULL && (start != 0 || end != ~0ul)) { + /* + * If the allocation fails, try to allocate a resource for + * this BAR using any available range. The firmware felt + * it was important enough to assign a resource, so don't + * disable decoding if we can help it. + */ + resource_list_delete(rl, type, reg); + resource_list_add(rl, type, reg, 0, ~0ul, count); + res = resource_list_reserve(rl, bus, dev, type, ®, 0, ~0ul, + count, prefetch ? RF_PREFETCHABLE : 0); + } if (res == NULL) { /* * If the allocation fails, delete the resource list entry - * to force pci_alloc_resource() to allocate resources - * from the parent. + * and disable decoding for this device. + * + * If the driver requests this resource in the future, + * pci_reserve_map() will try to allocate a fresh + * resource range. */ resource_list_delete(rl, type, reg); + pci_disable_io(dev, type); + if (bootverbose) + device_printf(bus, + "pci%d:%d:%d:%d bar %#x failed to allocate\n", + pci_get_domain(dev), pci_get_bus(dev), + pci_get_slot(dev), pci_get_function(dev), reg); } else { start = rman_get_start(res); pci_write_bar(dev, pm, start); From owner-svn-src-stable@FreeBSD.ORG Thu Jun 27 21:02:26 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id CE397760; Thu, 27 Jun 2013 21:02:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BF83E1EA4; Thu, 27 Jun 2013 21:02:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5RL2QwN078733; Thu, 27 Jun 2013 21:02:26 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5RL2Q04078732; Thu, 27 Jun 2013 21:02:26 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306272102.r5RL2Q04078732@svn.freebsd.org> From: John Baldwin Date: Thu, 27 Jun 2013 21:02:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252318 - stable/8/sys/dev/pci X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jun 2013 21:02:26 -0000 Author: jhb Date: Thu Jun 27 21:02:26 2013 New Revision: 252318 URL: http://svnweb.freebsd.org/changeset/base/252318 Log: MFC 233662,233677-233678,250418,252166: If the firmware/BIOS assigns conflicting ranges to BARs then leaving the BARs alone could result in one device stealing mmio accesses intended to go to a second device. Previously the PCI bus driver attempted to handle this case by clearing the BAR to 0 depending on BARs based at 0 not decoding (which is not guaranteed to be true). Now when a conflicting BAR is detected the following steps are taken: 1) If hw.pci.realloc_bars (a new tunable) is enabled (default is disabled), then ignore the current BAR setting from the firmware and attempt to allocate a fresh resource range for the BAR. 2) If 1) failed (or was disabled), disable decoding for the relevant BAR type (e.g. disable mem decoding for a memory BAR) and emit a warning if booting verbose. Modified: stable/8/sys/dev/pci/pci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/pci/ (props changed) Modified: stable/8/sys/dev/pci/pci.c ============================================================================== --- stable/8/sys/dev/pci/pci.c Thu Jun 27 20:35:39 2013 (r252317) +++ stable/8/sys/dev/pci/pci.c Thu Jun 27 21:02:26 2013 (r252318) @@ -295,6 +295,12 @@ SYSCTL_INT(_hw_pci, OID_AUTO, enable_io_ enable these bits correctly. We'd like to do this all the time, but there\n\ are some peripherals that this causes problems with."); +static int pci_do_realloc_bars = 0; +TUNABLE_INT("hw.pci.realloc_bars", &pci_do_realloc_bars); +SYSCTL_INT(_hw_pci, OID_AUTO, realloc_bars, CTLFLAG_RW, + &pci_do_realloc_bars, 0, + "Attempt to allocate a new range for any BARs whose original firmware-assigned ranges fail to allocate during the initial device scan."); + static int pci_do_power_nodriver = 0; TUNABLE_INT("hw.pci.do_power_nodriver", &pci_do_power_nodriver); SYSCTL_INT(_hw_pci, OID_AUTO, do_power_nodriver, CTLFLAG_RW, @@ -2743,20 +2749,39 @@ pci_add_map(device_t bus, device_t dev, */ res = resource_list_alloc(rl, bus, dev, type, ®, start, end, count, prefetch ? RF_PREFETCHABLE : 0); + if (pci_do_realloc_bars && res == NULL && (start != 0 || end != ~0ul)) { + /* + * If the allocation fails, try to allocate a resource for + * this BAR using any available range. The firmware felt + * it was important enough to assign a resource, so don't + * disable decoding if we can help it. + */ + resource_list_delete(rl, type, reg); + resource_list_add(rl, type, reg, 0, ~0ul, count); + res = resource_list_alloc(rl, bus, dev, type, ®, 0, ~0ul, + count, prefetch ? RF_PREFETCHABLE : 0); + } if (res == NULL) { /* - * If the allocation fails, clear the BAR and delete - * the resource list entry to force - * pci_alloc_resource() to allocate resources from the - * parent. + * If the allocation fails, delete the resource list entry + * and disable decoding for this device. + * + * If the driver requests this resource in the future, + * pci_reserve_map() will try to allocate a fresh + * resource range. */ resource_list_delete(rl, type, reg); - start = 0; + pci_disable_io(dev, type); + if (bootverbose) + device_printf(bus, + "pci%d:%d:%d:%d bar %#x failed to allocate\n", + pci_get_domain(dev), pci_get_bus(dev), + pci_get_slot(dev), pci_get_function(dev), reg); } else { start = rman_get_start(res); + pci_write_bar(dev, pm, start); rman_set_device(res, bus); } - pci_write_bar(dev, pm, start); return (barlen); } @@ -3732,7 +3757,7 @@ pci_describe_device(device_t dev) if ((desc = malloc(strlen(vp) + strlen(dp) + 3, M_DEVBUF, M_NOWAIT)) != NULL) sprintf(desc, "%s, %s", vp, dp); - out: +out: if (vp != NULL) free(vp, M_DEVBUF); if (dp != NULL) @@ -4008,7 +4033,7 @@ pci_alloc_map(device_t dev, device_t chi count, *rid, type, rman_get_start(res)); map = rman_get_start(res); pci_write_bar(child, pm, map); -out:; +out: return (res); } @@ -4210,19 +4235,6 @@ pci_delete_resource(device_t dev, device rman_get_start(rle->res)); return; } - -#ifndef __PCI_BAR_ZERO_VALID - /* - * If this is a BAR, clear the BAR so it stops - * decoding before releasing the resource. - */ - switch (type) { - case SYS_RES_IOPORT: - case SYS_RES_MEMORY: - pci_write_bar(child, pci_find_bar(child, rid), 0); - break; - } -#endif bus_release_resource(dev, type, rid, rle->res); } resource_list_delete(rl, type, rid); From owner-svn-src-stable@FreeBSD.ORG Fri Jun 28 02:38:33 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8C81A91B; Fri, 28 Jun 2013 02:38:33 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7D1AE1C85; Fri, 28 Jun 2013 02:38:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5S2cXUQ074794; Fri, 28 Jun 2013 02:38:33 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5S2cXMJ074793; Fri, 28 Jun 2013 02:38:33 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201306280238.r5S2cXMJ074793@svn.freebsd.org> From: Lawrence Stewart Date: Fri, 28 Jun 2013 02:38:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252323 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2013 02:38:33 -0000 Author: lstewart Date: Fri Jun 28 02:38:33 2013 New Revision: 252323 URL: http://svnweb.freebsd.org/changeset/base/252323 Log: MFC r250951,251838: Ensure alq's shutdown_pre_sync event handler is deregistered on module unload to avoid a dangling pointer and eventual panic on system shutdown. Reported by: Ali Modified: stable/9/sys/kern/kern_alq.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_alq.c ============================================================================== --- stable/9/sys/kern/kern_alq.c Fri Jun 28 00:34:39 2013 (r252322) +++ stable/9/sys/kern/kern_alq.c Fri Jun 28 02:38:33 2013 (r252323) @@ -99,6 +99,7 @@ static LIST_HEAD(, alq) ald_active; static int ald_shutingdown = 0; struct thread *ald_thread; static struct proc *ald_proc; +static eventhandler_tag alq_eventhandler_tag = NULL; #define ALD_LOCK() mtx_lock(&ald_mtx) #define ALD_UNLOCK() mtx_unlock(&ald_mtx) @@ -194,8 +195,8 @@ ald_daemon(void) ald_thread = FIRST_THREAD_IN_PROC(ald_proc); - EVENTHANDLER_REGISTER(shutdown_pre_sync, ald_shutdown, NULL, - SHUTDOWN_PRI_FIRST); + alq_eventhandler_tag = EVENTHANDLER_REGISTER(shutdown_pre_sync, + ald_shutdown, NULL, SHUTDOWN_PRI_FIRST); ALD_LOCK(); @@ -941,6 +942,8 @@ alq_load_handler(module_t mod, int what, if (LIST_FIRST(&ald_queues) == NULL) { ald_shutingdown = 1; ALD_UNLOCK(); + EVENTHANDLER_DEREGISTER(shutdown_pre_sync, + alq_eventhandler_tag); ald_shutdown(NULL, 0); mtx_destroy(&ald_mtx); } else { From owner-svn-src-stable@FreeBSD.ORG Fri Jun 28 03:04:08 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 26570E58; Fri, 28 Jun 2013 03:04:08 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 18FCE1E0E; Fri, 28 Jun 2013 03:04:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5S347H3083996; Fri, 28 Jun 2013 03:04:07 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5S3478W083995; Fri, 28 Jun 2013 03:04:07 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201306280304.r5S3478W083995@svn.freebsd.org> From: Lawrence Stewart Date: Fri, 28 Jun 2013 03:04:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252324 - stable/8/sys/kern X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2013 03:04:08 -0000 Author: lstewart Date: Fri Jun 28 03:04:07 2013 New Revision: 252324 URL: http://svnweb.freebsd.org/changeset/base/252324 Log: MFC r250951,251838: Ensure alq's shutdown_pre_sync event handler is deregistered on module unload to avoid a dangling pointer and eventual panic on system shutdown. Reported by: Ali Modified: stable/8/sys/kern/kern_alq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/kern/ (props changed) Modified: stable/8/sys/kern/kern_alq.c ============================================================================== --- stable/8/sys/kern/kern_alq.c Fri Jun 28 02:38:33 2013 (r252323) +++ stable/8/sys/kern/kern_alq.c Fri Jun 28 03:04:07 2013 (r252324) @@ -99,6 +99,7 @@ static LIST_HEAD(, alq) ald_active; static int ald_shutingdown = 0; struct thread *ald_thread; static struct proc *ald_proc; +static eventhandler_tag alq_eventhandler_tag = NULL; #define ALD_LOCK() mtx_lock(&ald_mtx) #define ALD_UNLOCK() mtx_unlock(&ald_mtx) @@ -194,8 +195,8 @@ ald_daemon(void) ald_thread = FIRST_THREAD_IN_PROC(ald_proc); - EVENTHANDLER_REGISTER(shutdown_pre_sync, ald_shutdown, NULL, - SHUTDOWN_PRI_FIRST); + alq_eventhandler_tag = EVENTHANDLER_REGISTER(shutdown_pre_sync, + ald_shutdown, NULL, SHUTDOWN_PRI_FIRST); ALD_LOCK(); @@ -941,6 +942,8 @@ alq_load_handler(module_t mod, int what, if (LIST_FIRST(&ald_queues) == NULL) { ald_shutingdown = 1; ALD_UNLOCK(); + EVENTHANDLER_DEREGISTER(shutdown_pre_sync, + alq_eventhandler_tag); ald_shutdown(NULL, 0); mtx_destroy(&ald_mtx); } else { From owner-svn-src-stable@FreeBSD.ORG Fri Jun 28 03:22:43 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9A1555FD; Fri, 28 Jun 2013 03:22:43 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8C17C1F30; Fri, 28 Jun 2013 03:22:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5S3MhmV089972; Fri, 28 Jun 2013 03:22:43 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5S3Mh1b089971; Fri, 28 Jun 2013 03:22:43 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201306280322.r5S3Mh1b089971@svn.freebsd.org> From: Lawrence Stewart Date: Fri, 28 Jun 2013 03:22:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252326 - stable/9/sys/sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2013 03:22:43 -0000 Author: lstewart Date: Fri Jun 28 03:22:43 2013 New Revision: 252326 URL: http://svnweb.freebsd.org/changeset/base/252326 Log: MFC r251682: Remove some duplicate code by making KHELP_DECLARE_MOD() a wrapper around KHELP_DECLARE_MOD_UMA(). Modified: stable/9/sys/sys/module_khelp.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/sys/sys/module_khelp.h ============================================================================== --- stable/9/sys/sys/module_khelp.h Fri Jun 28 03:14:40 2013 (r252325) +++ stable/9/sys/sys/module_khelp.h Fri Jun 28 03:22:43 2013 (r252326) @@ -70,22 +70,6 @@ struct khelp_modevent_data { uma_dtor umadtor; }; -#define KHELP_DECLARE_MOD(hname, hdata, hhooks, version) \ - static struct khelp_modevent_data kmd_##hname = { \ - .name = #hname, \ - .helper = hdata \ - .hooks = hhooks, \ - .nhooks = sizeof(hhooks) / sizeof(hhooks[0]), \ - }; \ - static moduledata_t h_##hname = { \ - .name = #hname, \ - .evhand = khelp_modevent, \ - .priv = &kmd_##hname \ - }; \ - DECLARE_MODULE(hname, h_##hname, SI_SUB_PROTO_IFATTACHDOMAIN, \ - SI_ORDER_ANY); \ - MODULE_VERSION(hname, version) - #define KHELP_DECLARE_MOD_UMA(hname, hdata, hhooks, version, size, ctor, dtor) \ static struct khelp_modevent_data kmd_##hname = { \ .name = #hname, \ @@ -105,6 +89,9 @@ struct khelp_modevent_data { SI_ORDER_ANY); \ MODULE_VERSION(hname, version) +#define KHELP_DECLARE_MOD(hname, hdata, hhooks, version) \ + KHELP_DECLARE_MOD_UMA(hname, hdata, hhooks, version, 0, NULL, NULL) + int khelp_modevent(module_t mod, int type, void *data); #endif /* _SYS_MODULE_KHELP_H_ */ From owner-svn-src-stable@FreeBSD.ORG Fri Jun 28 03:23:24 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id EB90D775; Fri, 28 Jun 2013 03:23:24 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id DD5641F3D; Fri, 28 Jun 2013 03:23:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5S3NOGU090086; Fri, 28 Jun 2013 03:23:24 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5S3NOPl090085; Fri, 28 Jun 2013 03:23:24 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201306280323.r5S3NOPl090085@svn.freebsd.org> From: Lawrence Stewart Date: Fri, 28 Jun 2013 03:23:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252327 - stable/8/sys/sys X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2013 03:23:25 -0000 Author: lstewart Date: Fri Jun 28 03:23:24 2013 New Revision: 252327 URL: http://svnweb.freebsd.org/changeset/base/252327 Log: MFC r251682: Remove some duplicate code by making KHELP_DECLARE_MOD() a wrapper around KHELP_DECLARE_MOD_UMA(). Modified: stable/8/sys/sys/module_khelp.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/sys/ (props changed) Modified: stable/8/sys/sys/module_khelp.h ============================================================================== --- stable/8/sys/sys/module_khelp.h Fri Jun 28 03:22:43 2013 (r252326) +++ stable/8/sys/sys/module_khelp.h Fri Jun 28 03:23:24 2013 (r252327) @@ -70,22 +70,6 @@ struct khelp_modevent_data { uma_dtor umadtor; }; -#define KHELP_DECLARE_MOD(hname, hdata, hhooks, version) \ - static struct khelp_modevent_data kmd_##hname = { \ - .name = #hname, \ - .helper = hdata \ - .hooks = hhooks, \ - .nhooks = sizeof(hhooks) / sizeof(hhooks[0]), \ - }; \ - static moduledata_t h_##hname = { \ - .name = #hname, \ - .evhand = khelp_modevent, \ - .priv = &kmd_##hname \ - }; \ - DECLARE_MODULE(hname, h_##hname, SI_SUB_PROTO_IFATTACHDOMAIN, \ - SI_ORDER_ANY); \ - MODULE_VERSION(hname, version) - #define KHELP_DECLARE_MOD_UMA(hname, hdata, hhooks, version, size, ctor, dtor) \ static struct khelp_modevent_data kmd_##hname = { \ .name = #hname, \ @@ -105,6 +89,9 @@ struct khelp_modevent_data { SI_ORDER_ANY); \ MODULE_VERSION(hname, version) +#define KHELP_DECLARE_MOD(hname, hdata, hhooks, version) \ + KHELP_DECLARE_MOD_UMA(hname, hdata, hhooks, version, 0, NULL, NULL) + int khelp_modevent(module_t mod, int type, void *data); #endif /* _SYS_MODULE_KHELP_H_ */ From owner-svn-src-stable@FreeBSD.ORG Fri Jun 28 03:39:55 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3E423AAF; Fri, 28 Jun 2013 03:39:55 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3021E1FB9; Fri, 28 Jun 2013 03:39:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5S3dstq093549; Fri, 28 Jun 2013 03:39:54 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5S3dseI093548; Fri, 28 Jun 2013 03:39:54 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201306280339.r5S3dseI093548@svn.freebsd.org> From: Lawrence Stewart Date: Fri, 28 Jun 2013 03:39:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252328 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2013 03:39:55 -0000 Author: lstewart Date: Fri Jun 28 03:39:54 2013 New Revision: 252328 URL: http://svnweb.freebsd.org/changeset/base/252328 Log: MFC r251725: Fix a potential NULL-pointer dereference that would trigger if the hhook registration site did not provide storage for a copy of the hhook_head struct. Modified: stable/9/sys/kern/kern_hhook.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_hhook.c ============================================================================== --- stable/9/sys/kern/kern_hhook.c Fri Jun 28 03:23:24 2013 (r252327) +++ stable/9/sys/kern/kern_hhook.c Fri Jun 28 03:39:54 2013 (r252328) @@ -264,9 +264,10 @@ hhook_head_register(int32_t hhook_type, STAILQ_INIT(&tmphhh->hhh_hooks); HHH_LOCK_INIT(tmphhh); - if (hhh != NULL) + if (hhh != NULL) { refcount_init(&tmphhh->hhh_refcount, 1); - else + *hhh = tmphhh; + } else refcount_init(&tmphhh->hhh_refcount, 0); if (flags & HHOOK_HEADISINVNET) { @@ -278,8 +279,6 @@ hhook_head_register(int32_t hhook_type, /* XXXLAS: Add tmphhh to the non-virtualised list. */ } - *hhh = tmphhh; - return (0); } From owner-svn-src-stable@FreeBSD.ORG Fri Jun 28 03:41:23 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D5EAEC2E; Fri, 28 Jun 2013 03:41:23 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id C795B1FC6; Fri, 28 Jun 2013 03:41:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5S3fN9Q095376; Fri, 28 Jun 2013 03:41:23 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5S3fNNH095375; Fri, 28 Jun 2013 03:41:23 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201306280341.r5S3fNNH095375@svn.freebsd.org> From: Lawrence Stewart Date: Fri, 28 Jun 2013 03:41:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252329 - stable/8/sys/kern X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2013 03:41:23 -0000 Author: lstewart Date: Fri Jun 28 03:41:23 2013 New Revision: 252329 URL: http://svnweb.freebsd.org/changeset/base/252329 Log: MFC r251725: Fix a potential NULL-pointer dereference that would trigger if the hhook registration site did not provide storage for a copy of the hhook_head struct. Modified: stable/8/sys/kern/kern_hhook.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/kern/ (props changed) Modified: stable/8/sys/kern/kern_hhook.c ============================================================================== --- stable/8/sys/kern/kern_hhook.c Fri Jun 28 03:39:54 2013 (r252328) +++ stable/8/sys/kern/kern_hhook.c Fri Jun 28 03:41:23 2013 (r252329) @@ -264,9 +264,10 @@ hhook_head_register(int32_t hhook_type, STAILQ_INIT(&tmphhh->hhh_hooks); HHH_LOCK_INIT(tmphhh); - if (hhh != NULL) + if (hhh != NULL) { refcount_init(&tmphhh->hhh_refcount, 1); - else + *hhh = tmphhh; + } else refcount_init(&tmphhh->hhh_refcount, 0); if (flags & HHOOK_HEADISINVNET) { @@ -278,8 +279,6 @@ hhook_head_register(int32_t hhook_type, /* XXXLAS: Add tmphhh to the non-virtualised list. */ } - *hhh = tmphhh; - return (0); } From owner-svn-src-stable@FreeBSD.ORG Fri Jun 28 09:55:01 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2940753B; Fri, 28 Jun 2013 09:55:01 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1BACD1EF5; Fri, 28 Jun 2013 09:55:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5S9t0tE002979; Fri, 28 Jun 2013 09:55:00 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5S9t0kc002976; Fri, 28 Jun 2013 09:55:00 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201306280955.r5S9t0kc002976@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Fri, 28 Jun 2013 09:55:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252339 - stable/9/crypto/openssh X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2013 09:55:01 -0000 Author: des Date: Fri Jun 28 09:55:00 2013 New Revision: 252339 URL: http://svnweb.freebsd.org/changeset/base/252339 Log: Insta-MFH (r252338): update docs to reflect correct default privsep setting Modified: stable/9/crypto/openssh/sshd_config stable/9/crypto/openssh/sshd_config.5 Directory Properties: stable/9/crypto/openssh/ (props changed) Modified: stable/9/crypto/openssh/sshd_config ============================================================================== --- stable/9/crypto/openssh/sshd_config Fri Jun 28 09:41:59 2013 (r252338) +++ stable/9/crypto/openssh/sshd_config Fri Jun 28 09:55:00 2013 (r252339) @@ -105,7 +105,7 @@ #PrintLastLog yes #TCPKeepAlive yes #UseLogin no -#UsePrivilegeSeparation sandbox +#UsePrivilegeSeparation yes #PermitUserEnvironment no #Compression delayed #ClientAliveInterval 0 Modified: stable/9/crypto/openssh/sshd_config.5 ============================================================================== --- stable/9/crypto/openssh/sshd_config.5 Fri Jun 28 09:41:59 2013 (r252338) +++ stable/9/crypto/openssh/sshd_config.5 Fri Jun 28 09:55:00 2013 (r252339) @@ -1169,7 +1169,7 @@ the privilege of the authenticated user. The goal of privilege separation is to prevent privilege escalation by containing any corruption within the unprivileged processes. The default is -.Dq sandbox . +.Dq yes . If .Cm UsePrivilegeSeparation is set to From owner-svn-src-stable@FreeBSD.ORG Fri Jun 28 10:21:50 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6AACDC69; Fri, 28 Jun 2013 10:21:50 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 430901030; Fri, 28 Jun 2013 10:21:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5SALoWJ011423; Fri, 28 Jun 2013 10:21:50 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5SALn0p011420; Fri, 28 Jun 2013 10:21:49 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201306281021.r5SALn0p011420@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Fri, 28 Jun 2013 10:21:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252340 - stable/8/crypto/openssh X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2013 10:21:50 -0000 Author: des Date: Fri Jun 28 10:21:49 2013 New Revision: 252340 URL: http://svnweb.freebsd.org/changeset/base/252340 Log: MFH (r251088, r252338): revert default privsep setting to "yes" Modified: stable/8/crypto/openssh/servconf.c stable/8/crypto/openssh/sshd_config stable/8/crypto/openssh/sshd_config.5 Directory Properties: stable/8/crypto/openssh/ (props changed) Modified: stable/8/crypto/openssh/servconf.c ============================================================================== --- stable/8/crypto/openssh/servconf.c Fri Jun 28 09:55:00 2013 (r252339) +++ stable/8/crypto/openssh/servconf.c Fri Jun 28 10:21:49 2013 (r252340) @@ -294,7 +294,7 @@ fill_default_server_options(ServerOption options->version_addendum = xstrdup(SSH_VERSION_FREEBSD); /* Turn privilege separation on by default */ if (use_privsep == -1) - use_privsep = PRIVSEP_ON; + use_privsep = PRIVSEP_NOSANDBOX; #ifndef HAVE_MMAP if (use_privsep && options->compression == 1) { Modified: stable/8/crypto/openssh/sshd_config ============================================================================== --- stable/8/crypto/openssh/sshd_config Fri Jun 28 09:55:00 2013 (r252339) +++ stable/8/crypto/openssh/sshd_config Fri Jun 28 10:21:49 2013 (r252340) @@ -102,7 +102,7 @@ #PrintLastLog yes #TCPKeepAlive yes #UseLogin no -#UsePrivilegeSeparation sandbox +#UsePrivilegeSeparation yes #PermitUserEnvironment no #Compression delayed #ClientAliveInterval 0 Modified: stable/8/crypto/openssh/sshd_config.5 ============================================================================== --- stable/8/crypto/openssh/sshd_config.5 Fri Jun 28 09:55:00 2013 (r252339) +++ stable/8/crypto/openssh/sshd_config.5 Fri Jun 28 10:21:49 2013 (r252340) @@ -1095,7 +1095,7 @@ the privilege of the authenticated user. The goal of privilege separation is to prevent privilege escalation by containing any corruption within the unprivileged processes. The default is -.Dq sandbox . +.Dq yes . If .Cm UsePrivilegeSeparation is set to From owner-svn-src-stable@FreeBSD.ORG Fri Jun 28 16:07:23 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 2F8D28B9; Fri, 28 Jun 2013 16:07:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0FF0516AF; Fri, 28 Jun 2013 16:07:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5SG7NEA009730; Fri, 28 Jun 2013 16:07:23 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5SG7L3e009715; Fri, 28 Jun 2013 16:07:21 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306281607.r5SG7L3e009715@svn.freebsd.org> From: John Baldwin Date: Fri, 28 Jun 2013 16:07:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252343 - in stable/9: include lib/libc/stdio tools/regression/lib/libc/stdio X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2013 16:07:23 -0000 Author: jhb Date: Fri Jun 28 16:07:20 2013 New Revision: 252343 URL: http://svnweb.freebsd.org/changeset/base/252343 Log: MFC 246120,246148,246206,246587,247411,247415: Add fmemopen(3), open_memstream(3), and open_wmemstream(3) which provide stdio FILE objects for memory buffers. port exprun by: bdrewery Added: stable/9/lib/libc/stdio/fmemopen.c - copied, changed from r246120, head/lib/libc/stdio/fmemopen.c stable/9/lib/libc/stdio/open_memstream.3 - copied, changed from r247411, head/lib/libc/stdio/open_memstream.3 stable/9/lib/libc/stdio/open_memstream.c - copied unchanged from r247411, head/lib/libc/stdio/open_memstream.c stable/9/lib/libc/stdio/open_wmemstream.c - copied unchanged from r247411, head/lib/libc/stdio/open_wmemstream.c stable/9/tools/regression/lib/libc/stdio/test-fmemopen.c - copied, changed from r246120, head/tools/regression/lib/libc/stdio/test-fmemopen.c stable/9/tools/regression/lib/libc/stdio/test-fmemopen.t - copied unchanged from r246120, head/tools/regression/lib/libc/stdio/test-fmemopen.t stable/9/tools/regression/lib/libc/stdio/test-open_memstream.c - copied unchanged from r247411, head/tools/regression/lib/libc/stdio/test-open_memstream.c stable/9/tools/regression/lib/libc/stdio/test-open_memstream.t - copied unchanged from r247411, head/tools/regression/lib/libc/stdio/test-open_memstream.t stable/9/tools/regression/lib/libc/stdio/test-open_wmemstream.c - copied unchanged from r247411, head/tools/regression/lib/libc/stdio/test-open_wmemstream.c stable/9/tools/regression/lib/libc/stdio/test-open_wmemstream.t - copied unchanged from r247411, head/tools/regression/lib/libc/stdio/test-open_wmemstream.t Modified: stable/9/include/stdio.h (contents, props changed) stable/9/include/wchar.h stable/9/lib/libc/stdio/Makefile.inc (contents, props changed) stable/9/lib/libc/stdio/Symbol.map (contents, props changed) stable/9/lib/libc/stdio/fopen.3 (contents, props changed) stable/9/tools/regression/lib/libc/stdio/Makefile Directory Properties: stable/9/include/ (props changed) stable/9/lib/libc/ (props changed) stable/9/tools/regression/lib/libc/ (props changed) Modified: stable/9/include/stdio.h ============================================================================== --- stable/9/include/stdio.h Fri Jun 28 15:55:30 2013 (r252342) +++ stable/9/include/stdio.h Fri Jun 28 16:07:20 2013 (r252343) @@ -343,8 +343,10 @@ char *tempnam(const char *, const char * #endif #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 +FILE *fmemopen(void * __restrict, size_t, const char * __restrict); ssize_t getdelim(char ** __restrict, size_t * __restrict, int, FILE * __restrict); +FILE *open_memstream(char **, size_t *); int renameat(int, const char *, int, const char *); int vdprintf(int, const char * __restrict, __va_list); Modified: stable/9/include/wchar.h ============================================================================== --- stable/9/include/wchar.h Fri Jun 28 15:55:30 2013 (r252342) +++ stable/9/include/wchar.h Fri Jun 28 16:07:20 2013 (r252343) @@ -209,6 +209,7 @@ int wcwidth(wchar_t); #if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE size_t mbsnrtowcs(wchar_t * __restrict, const char ** __restrict, size_t, size_t, mbstate_t * __restrict); +FILE *open_wmemstream(wchar_t **, size_t *); wchar_t *wcpcpy(wchar_t * __restrict, const wchar_t * __restrict); wchar_t *wcpncpy(wchar_t * __restrict, const wchar_t * __restrict, size_t); wchar_t *wcsdup(const wchar_t *) __malloc_like; Modified: stable/9/lib/libc/stdio/Makefile.inc ============================================================================== --- stable/9/lib/libc/stdio/Makefile.inc Fri Jun 28 15:55:30 2013 (r252342) +++ stable/9/lib/libc/stdio/Makefile.inc Fri Jun 28 16:07:20 2013 (r252343) @@ -8,11 +8,13 @@ SRCS+= _flock_stub.c asprintf.c clrerr.c fclose.c fcloseall.c fdopen.c \ feof.c ferror.c fflush.c fgetc.c fgetln.c fgetpos.c fgets.c fgetwc.c \ fgetwln.c fgetws.c \ - fileno.c findfp.c flags.c fopen.c fprintf.c fpurge.c fputc.c fputs.c \ + fileno.c findfp.c flags.c fmemopen.c fopen.c fprintf.c fpurge.c \ + fputc.c fputs.c \ fputwc.c fputws.c fread.c freopen.c fscanf.c fseek.c fsetpos.c \ ftell.c funopen.c fvwrite.c fwalk.c fwide.c fwprintf.c fwscanf.c \ fwrite.c getc.c getchar.c getdelim.c getline.c \ gets.c getw.c getwc.c getwchar.c makebuf.c mktemp.c \ + open_memstream.c open_wmemstream.c \ perror.c printf.c printf-pos.c putc.c putchar.c \ puts.c putw.c putwc.c putwchar.c \ refill.c remove.c rewind.c rget.c scanf.c setbuf.c setbuffer.c \ @@ -35,7 +37,7 @@ MAN+= fclose.3 ferror.3 fflush.3 fgetln. flockfile.3 \ fopen.3 fputs.3 \ fputws.3 fread.3 fseek.3 funopen.3 fwide.3 getc.3 \ - getline.3 getwc.3 mktemp.3 \ + getline.3 getwc.3 mktemp.3 open_memstream.3 \ printf.3 printf_l.3 putc.3 putwc.3 remove.3 scanf.3 scanf_l.3 setbuf.3 \ stdio.3 tmpnam.3 \ ungetc.3 ungetwc.3 wprintf.3 wscanf.3 @@ -48,7 +50,7 @@ MLINKS+=ferror.3 ferror_unlocked.3 \ MLINKS+=fflush.3 fpurge.3 MLINKS+=fgets.3 gets.3 MLINKS+=flockfile.3 ftrylockfile.3 flockfile.3 funlockfile.3 -MLINKS+=fopen.3 fdopen.3 fopen.3 freopen.3 +MLINKS+=fopen.3 fdopen.3 fopen.3 freopen.3 fopen.3 fmemopen.3 MLINKS+=fputs.3 puts.3 MLINKS+=fread.3 fwrite.3 MLINKS+=fseek.3 fgetpos.3 fseek.3 fseeko.3 fseek.3 fsetpos.3 fseek.3 ftell.3 \ @@ -59,6 +61,7 @@ MLINKS+=getc.3 fgetc.3 getc.3 getc_unloc MLINKS+=getline.3 getdelim.3 MLINKS+=getwc.3 fgetwc.3 getwc.3 getwchar.3 MLINKS+=mktemp.3 mkdtemp.3 mktemp.3 mkstemp.3 mktemp.3 mkstemps.3 +MLINKS+=open_memstream.3 open_wmemstream.3 MLINKS+=printf.3 asprintf.3 printf.3 dprintf.3 printf.3 fprintf.3 \ printf.3 snprintf.3 printf.3 sprintf.3 \ printf.3 vasprintf.3 printf.3 vdprintf.3 \ Modified: stable/9/lib/libc/stdio/Symbol.map ============================================================================== --- stable/9/lib/libc/stdio/Symbol.map Fri Jun 28 15:55:30 2013 (r252342) +++ stable/9/lib/libc/stdio/Symbol.map Fri Jun 28 16:07:20 2013 (r252343) @@ -155,6 +155,9 @@ FBSD_1.3 { getwchar_l; putwc_l; putwchar_l; + fmemopen; + open_memstream; + open_wmemstream; }; FBSDprivate_1.0 { Copied and modified: stable/9/lib/libc/stdio/fmemopen.c (from r246120, head/lib/libc/stdio/fmemopen.c) ============================================================================== --- head/lib/libc/stdio/fmemopen.c Wed Jan 30 14:59:26 2013 (r246120, copy source) +++ stable/9/lib/libc/stdio/fmemopen.c Fri Jun 28 16:07:20 2013 (r252343) @@ -1,99 +1,166 @@ /*- -Copyright (C) 2013 Pietro Cerutti - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -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. -*/ + * Copyright (C) 2013 Pietro Cerutti + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * 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. + */ #include __FBSDID("$FreeBSD$"); +#include +#include #include #include #include #include +#include "local.h" -struct __fmemopen_cookie +struct fmemopen_cookie { - char *buf; /* pointer to the memory region */ - char own; /* did we allocate the buffer ourselves? */ - long len; /* buffer length in bytes */ - long off; /* current offset into the buffer */ + char *buf; /* pointer to the memory region */ + bool own; /* did we allocate the buffer ourselves? */ + char bin; /* is this a binary buffer? */ + size_t size; /* buffer length in bytes */ + size_t len; /* data length in bytes */ + size_t off; /* current offset into the buffer */ }; -static int fmemopen_read (void *cookie, char *buf, int nbytes); -static int fmemopen_write (void *cookie, const char *buf, int nbytes); -static fpos_t fmemopen_seek (void *cookie, fpos_t offset, int whence); -static int fmemopen_close (void *cookie); +static int fmemopen_read(void *cookie, char *buf, int nbytes); +static int fmemopen_write(void *cookie, const char *buf, int nbytes); +static fpos_t fmemopen_seek(void *cookie, fpos_t offset, int whence); +static int fmemopen_close(void *cookie); FILE * -fmemopen (void * __restrict buf, size_t size, const char * __restrict mode) +fmemopen(void * __restrict buf, size_t size, const char * __restrict mode) { - /* allocate cookie */ - struct __fmemopen_cookie *ck = malloc (sizeof (struct __fmemopen_cookie)); + struct fmemopen_cookie *ck; + FILE *f; + int flags, rc; + + /* + * Retrieve the flags as used by open(2) from the mode argument, and + * validate them. + */ + rc = __sflags(mode, &flags); + if (rc == 0) { + errno = EINVAL; + return (NULL); + } + + /* + * There's no point in requiring an automatically allocated buffer + * in write-only mode. + */ + if (!(flags & O_RDWR) && buf == NULL) { + errno = EINVAL; + return (NULL); + } + + ck = malloc(sizeof(struct fmemopen_cookie)); if (ck == NULL) { - errno = ENOMEM; return (NULL); } - ck->off = 0; - ck->len = size; + ck->off = 0; + ck->size = size; - /* do we have to allocate the buffer ourselves? */ + /* Check whether we have to allocate the buffer ourselves. */ ck->own = ((ck->buf = buf) == NULL); if (ck->own) { - ck->buf = malloc (size); + ck->buf = malloc(size); if (ck->buf == NULL) { - free (ck); - errno = ENOMEM; + free(ck); return (NULL); } + } + + /* + * POSIX distinguishes between w+ and r+, in that w+ is supposed to + * truncate the buffer. + */ + if (ck->own || mode[0] == 'w') { ck->buf[0] = '\0'; } - if (mode[0] == 'a') - ck->off = strnlen(ck->buf, ck->len); + /* Check for binary mode. */ + ck->bin = strchr(mode, 'b') != NULL; - /* actuall wrapper */ - FILE *f = funopen ((void *)ck, fmemopen_read, fmemopen_write, + /* + * The size of the current buffer contents is set depending on the + * mode: + * + * for append (text-mode), the position of the first NULL byte, or the + * size of the buffer if none is found + * + * for append (binary-mode), the size of the buffer + * + * for read, the size of the buffer + * + * for write, 0 + */ + switch (mode[0]) { + case 'a': + if (ck->bin) { + /* + * This isn't useful, since the buffer isn't allowed + * to grow. + */ + ck->off = ck->len = size; + } else + ck->off = ck->len = strnlen(ck->buf, ck->size); + break; + case 'r': + ck->len = size; + break; + case 'w': + ck->len = 0; + break; + } + + f = funopen(ck, + flags & O_WRONLY ? NULL : fmemopen_read, + flags & O_RDONLY ? NULL : fmemopen_write, fmemopen_seek, fmemopen_close); if (f == NULL) { if (ck->own) - free (ck->buf); - free (ck); + free(ck->buf); + free(ck); return (NULL); } - /* turn off buffering, so a write past the end of the buffer - * correctly returns a short object count */ - setvbuf (f, (char *) NULL, _IONBF, 0); + /* + * Turn off buffering, so a write past the end of the buffer + * correctly returns a short object count. + */ + setvbuf(f, NULL, _IONBF, 0); return (f); } static int -fmemopen_read (void *cookie, char *buf, int nbytes) +fmemopen_read(void *cookie, char *buf, int nbytes) { - struct __fmemopen_cookie *ck = cookie; + struct fmemopen_cookie *ck = cookie; if (nbytes > ck->len - ck->off) nbytes = ck->len - ck->off; @@ -101,7 +168,7 @@ fmemopen_read (void *cookie, char *buf, if (nbytes == 0) return (0); - memcpy (buf, ck->buf + ck->off, nbytes); + memcpy(buf, ck->buf + ck->off, nbytes); ck->off += nbytes; @@ -109,35 +176,44 @@ fmemopen_read (void *cookie, char *buf, } static int -fmemopen_write (void *cookie, const char *buf, int nbytes) +fmemopen_write(void *cookie, const char *buf, int nbytes) { - struct __fmemopen_cookie *ck = cookie; + struct fmemopen_cookie *ck = cookie; - if (nbytes > ck->len - ck->off) - nbytes = ck->len - ck->off; + if (nbytes > ck->size - ck->off) + nbytes = ck->size - ck->off; if (nbytes == 0) return (0); - memcpy (ck->buf + ck->off, buf, nbytes); + memcpy(ck->buf + ck->off, buf, nbytes); ck->off += nbytes; - if (ck->off < ck->len && ck->buf[ck->off - 1] != '\0') + if (ck->off > ck->len) + ck->len = ck->off; + + /* + * We append a NULL byte if all these conditions are met: + * - the buffer is not binary + * - the buffer is not full + * - the data just written doesn't already end with a NULL byte + */ + if (!ck->bin && ck->off < ck->size && ck->buf[ck->off - 1] != '\0') ck->buf[ck->off] = '\0'; return (nbytes); } static fpos_t -fmemopen_seek (void *cookie, fpos_t offset, int whence) +fmemopen_seek(void *cookie, fpos_t offset, int whence) { - struct __fmemopen_cookie *ck = cookie; + struct fmemopen_cookie *ck = cookie; switch (whence) { case SEEK_SET: - if (offset > ck->len) { + if (offset > ck->size) { errno = EINVAL; return (-1); } @@ -145,7 +221,7 @@ fmemopen_seek (void *cookie, fpos_t offs break; case SEEK_CUR: - if (ck->off + offset > ck->len) { + if (ck->off + offset > ck->size) { errno = EINVAL; return (-1); } @@ -169,14 +245,14 @@ fmemopen_seek (void *cookie, fpos_t offs } static int -fmemopen_close (void *cookie) +fmemopen_close(void *cookie) { - struct __fmemopen_cookie *ck = cookie; + struct fmemopen_cookie *ck = cookie; if (ck->own) - free (ck->buf); + free(ck->buf); - free (ck); + free(ck); return (0); } Modified: stable/9/lib/libc/stdio/fopen.3 ============================================================================== --- stable/9/lib/libc/stdio/fopen.3 Fri Jun 28 15:55:30 2013 (r252342) +++ stable/9/lib/libc/stdio/fopen.3 Fri Jun 28 16:07:20 2013 (r252343) @@ -32,13 +32,14 @@ .\" @(#)fopen.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd October 17, 2011 +.Dd January 30, 2013 .Dt FOPEN 3 .Os .Sh NAME .Nm fopen , .Nm fdopen , -.Nm freopen +.Nm freopen , +.Nm fmemopen .Nd stream open functions .Sh LIBRARY .Lb libc @@ -50,6 +51,8 @@ .Fn fdopen "int fildes" "const char *mode" .Ft FILE * .Fn freopen "const char *path" "const char *mode" "FILE *stream" +.Ft FILE * +.Fn fmemopen "void *restrict *buf" "size_t size" "const char * restrict mode" .Sh DESCRIPTION The .Fn fopen @@ -107,7 +110,9 @@ after either the or the first letter. This is strictly for compatibility with .St -isoC -and has no effect; the ``b'' is ignored. +and has effect only for +.Fn fmemopen +; otherwise the ``b'' is ignored. .Pp Any created files will have mode .Do Dv S_IRUSR @@ -189,6 +194,34 @@ standard text stream .Dv ( stderr , stdin , or .Dv stdout ) . +.Pp +The +.Fn fmemopen +function +associates the buffer given by the +.Fa buf +and +.Fa size +arguments with a stream. +The +.Fa buf +argument is either a null pointer or point to a buffer that +is at least +.Fa size +bytes long. +If a null pointer is specified as the +.Fa buf +argument, +.Fn fmemopen +allocates +.Fa size +bytes of memory. This buffer is automatically freed when the +stream is closed. Buffers can be opened in text-mode (default) or binary-mode +(if ``b'' is present in the second or third position of the +.Fa mode +argument). Buffers opened in text-mode make sure that writes are terminated with +a NULL byte, if the last write hasn't filled up the whole buffer. Buffers +opened in binary-mode never append a NULL byte. .Sh RETURN VALUES Upon successful completion .Fn fopen , @@ -212,16 +245,18 @@ argument to .Fn fopen , .Fn fdopen , +.Fn freopen , or -.Fn freopen +.Fn fmemopen was invalid. .El .Pp The .Fn fopen , -.Fn fdopen -and +.Fn fdopen , .Fn freopen +and +.Fn fmemopen functions may also fail and set .Va errno @@ -277,3 +312,10 @@ The function conforms to .St -p1003.1-88 . +The +.Fn fmemopen +function +conforms to +.St -p1003.1-2008 . +The ``b'' mode does not conform to any standard +but is also supported by glibc. Copied and modified: stable/9/lib/libc/stdio/open_memstream.3 (from r247411, head/lib/libc/stdio/open_memstream.3) ============================================================================== --- head/lib/libc/stdio/open_memstream.3 Wed Feb 27 19:50:46 2013 (r247411, copy source) +++ stable/9/lib/libc/stdio/open_memstream.3 Fri Jun 28 16:07:20 2013 (r252343) @@ -137,6 +137,7 @@ argument was .Dv NULL . .It Bq Er ENOMEM Memory for the stream or buffer could not be allocated. +.El .Sh SEE ALSO .Xr fclose 3 , .Xr fflush 3 , Copied: stable/9/lib/libc/stdio/open_memstream.c (from r247411, head/lib/libc/stdio/open_memstream.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/lib/libc/stdio/open_memstream.c Fri Jun 28 16:07:20 2013 (r252343, copy of r247411, head/lib/libc/stdio/open_memstream.c) @@ -0,0 +1,209 @@ +/*- + * Copyright (c) 2013 Advanced Computing Technologies LLC + * Written by: John H. Baldwin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "namespace.h" +#include +#include +#include +#include +#include +#include +#include +#include "un-namespace.h" + +/* XXX: There is no FPOS_MAX. This assumes fpos_t is an off_t. */ +#define FPOS_MAX OFF_MAX + +struct memstream { + char **bufp; + size_t *sizep; + ssize_t len; + fpos_t offset; +}; + +static int +memstream_grow(struct memstream *ms, fpos_t newoff) +{ + char *buf; + ssize_t newsize; + + if (newoff < 0 || newoff >= SSIZE_MAX) + newsize = SSIZE_MAX - 1; + else + newsize = newoff; + if (newsize > ms->len) { + buf = realloc(*ms->bufp, newsize + 1); + if (buf != NULL) { +#ifdef DEBUG + fprintf(stderr, "MS: %p growing from %zd to %zd\n", + ms, ms->len, newsize); +#endif + memset(buf + ms->len + 1, 0, newsize - ms->len); + *ms->bufp = buf; + ms->len = newsize; + return (1); + } + return (0); + } + return (1); +} + +static void +memstream_update(struct memstream *ms) +{ + + assert(ms->len >= 0 && ms->offset >= 0); + *ms->sizep = ms->len < ms->offset ? ms->len : ms->offset; +} + +static int +memstream_write(void *cookie, const char *buf, int len) +{ + struct memstream *ms; + ssize_t tocopy; + + ms = cookie; + if (!memstream_grow(ms, ms->offset + len)) + return (-1); + tocopy = ms->len - ms->offset; + if (len < tocopy) + tocopy = len; + memcpy(*ms->bufp + ms->offset, buf, tocopy); + ms->offset += tocopy; + memstream_update(ms); +#ifdef DEBUG + fprintf(stderr, "MS: write(%p, %d) = %zd\n", ms, len, tocopy); +#endif + return (tocopy); +} + +static fpos_t +memstream_seek(void *cookie, fpos_t pos, int whence) +{ + struct memstream *ms; +#ifdef DEBUG + fpos_t old; +#endif + + ms = cookie; +#ifdef DEBUG + old = ms->offset; +#endif + switch (whence) { + case SEEK_SET: + /* _fseeko() checks for negative offsets. */ + assert(pos >= 0); + ms->offset = pos; + break; + case SEEK_CUR: + /* This is only called by _ftello(). */ + assert(pos == 0); + break; + case SEEK_END: + if (pos < 0) { + if (pos + ms->len < 0) { +#ifdef DEBUG + fprintf(stderr, + "MS: bad SEEK_END: pos %jd, len %zd\n", + (intmax_t)pos, ms->len); +#endif + errno = EINVAL; + return (-1); + } + } else { + if (FPOS_MAX - ms->len < pos) { +#ifdef DEBUG + fprintf(stderr, + "MS: bad SEEK_END: pos %jd, len %zd\n", + (intmax_t)pos, ms->len); +#endif + errno = EOVERFLOW; + return (-1); + } + } + ms->offset = ms->len + pos; + break; + } + memstream_update(ms); +#ifdef DEBUG + fprintf(stderr, "MS: seek(%p, %jd, %d) %jd -> %jd\n", ms, (intmax_t)pos, + whence, (intmax_t)old, (intmax_t)ms->offset); +#endif + return (ms->offset); +} + +static int +memstream_close(void *cookie) +{ + + free(cookie); + return (0); +} + +FILE * +open_memstream(char **bufp, size_t *sizep) +{ + struct memstream *ms; + int save_errno; + FILE *fp; + + if (bufp == NULL || sizep == NULL) { + errno = EINVAL; + return (NULL); + } + *bufp = calloc(1, 1); + if (*bufp == NULL) + return (NULL); + ms = malloc(sizeof(*ms)); + if (ms == NULL) { + save_errno = errno; + free(*bufp); + *bufp = NULL; + errno = save_errno; + return (NULL); + } + ms->bufp = bufp; + ms->sizep = sizep; + ms->len = 0; + ms->offset = 0; + memstream_update(ms); + fp = funopen(ms, NULL, memstream_write, memstream_seek, + memstream_close); + if (fp == NULL) { + save_errno = errno; + free(ms); + free(*bufp); + *bufp = NULL; + errno = save_errno; + return (NULL); + } + fwide(fp, -1); + return (fp); +} Copied: stable/9/lib/libc/stdio/open_wmemstream.c (from r247411, head/lib/libc/stdio/open_wmemstream.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/lib/libc/stdio/open_wmemstream.c Fri Jun 28 16:07:20 2013 (r252343, copy of r247411, head/lib/libc/stdio/open_wmemstream.c) @@ -0,0 +1,271 @@ +/*- + * Copyright (c) 2013 Advanced Computing Technologies LLC + * Written by: John H. Baldwin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "namespace.h" +#include +#include +#include +#include +#include +#include +#include +#include "un-namespace.h" + +/* XXX: There is no FPOS_MAX. This assumes fpos_t is an off_t. */ +#define FPOS_MAX OFF_MAX + +struct wmemstream { + wchar_t **bufp; + size_t *sizep; + ssize_t len; + fpos_t offset; + mbstate_t mbstate; +}; + +static int +wmemstream_grow(struct wmemstream *ms, fpos_t newoff) +{ + wchar_t *buf; + ssize_t newsize; + + if (newoff < 0 || newoff >= SSIZE_MAX / sizeof(wchar_t)) + newsize = SSIZE_MAX / sizeof(wchar_t) - 1; + else + newsize = newoff; + if (newsize > ms->len) { + buf = realloc(*ms->bufp, (newsize + 1) * sizeof(wchar_t)); + if (buf != NULL) { +#ifdef DEBUG + fprintf(stderr, "WMS: %p growing from %zd to %zd\n", + ms, ms->len, newsize); +#endif + wmemset(buf + ms->len + 1, 0, newsize - ms->len); + *ms->bufp = buf; + ms->len = newsize; + return (1); + } + return (0); + } + return (1); +} + +static void +wmemstream_update(struct wmemstream *ms) +{ + + assert(ms->len >= 0 && ms->offset >= 0); + *ms->sizep = ms->len < ms->offset ? ms->len : ms->offset; +} + +/* + * Based on a starting multibyte state and an input buffer, determine + * how many wchar_t's would be output. This doesn't use mbsnrtowcs() + * so that it can handle embedded null characters. + */ +static size_t +wbuflen(const mbstate_t *state, const char *buf, int len) +{ + mbstate_t lenstate; + size_t charlen, count; + + count = 0; + lenstate = *state; + while (len > 0) { + charlen = mbrlen(buf, len, &lenstate); + if (charlen == (size_t)-1) + return (-1); + if (charlen == (size_t)-2) + break; + if (charlen == 0) + /* XXX: Not sure how else to handle this. */ + charlen = 1; + len -= charlen; + buf += charlen; + count++; + } + return (count); +} + +static int +wmemstream_write(void *cookie, const char *buf, int len) +{ + struct wmemstream *ms; + ssize_t consumed, wlen; + size_t charlen; + + ms = cookie; + wlen = wbuflen(&ms->mbstate, buf, len); + if (wlen < 0) { + errno = EILSEQ; + return (-1); + } + if (!wmemstream_grow(ms, ms->offset + wlen)) + return (-1); + + /* + * This copies characters one at a time rather than using + * mbsnrtowcs() so it can properly handle embedded null + * characters. + */ + consumed = 0; + while (len > 0 && ms->offset < ms->len) { + charlen = mbrtowc(*ms->bufp + ms->offset, buf, len, + &ms->mbstate); + if (charlen == (size_t)-1) { + if (consumed == 0) { + errno = EILSEQ; + return (-1); + } + /* Treat it as a successful short write. */ + break; + } + if (charlen == 0) + /* XXX: Not sure how else to handle this. */ + charlen = 1; + if (charlen == (size_t)-2) { + consumed += len; + len = 0; + } else { + consumed += charlen; + buf += charlen; + len -= charlen; + ms->offset++; + } + } + wmemstream_update(ms); +#ifdef DEBUG + fprintf(stderr, "WMS: write(%p, %d) = %zd\n", ms, len, consumed); +#endif + return (consumed); +} + +static fpos_t +wmemstream_seek(void *cookie, fpos_t pos, int whence) +{ + struct wmemstream *ms; + fpos_t old; + + ms = cookie; + old = ms->offset; + switch (whence) { + case SEEK_SET: + /* _fseeko() checks for negative offsets. */ + assert(pos >= 0); + ms->offset = pos; + break; + case SEEK_CUR: + /* This is only called by _ftello(). */ + assert(pos == 0); + break; + case SEEK_END: + if (pos < 0) { + if (pos + ms->len < 0) { +#ifdef DEBUG + fprintf(stderr, + "WMS: bad SEEK_END: pos %jd, len %zd\n", + (intmax_t)pos, ms->len); +#endif + errno = EINVAL; + return (-1); + } + } else { + if (FPOS_MAX - ms->len < pos) { +#ifdef DEBUG + fprintf(stderr, + "WMS: bad SEEK_END: pos %jd, len %zd\n", + (intmax_t)pos, ms->len); +#endif + errno = EOVERFLOW; + return (-1); + } + } + ms->offset = ms->len + pos; + break; + } + /* Reset the multibyte state if a seek changes the position. */ + if (ms->offset != old) + memset(&ms->mbstate, 0, sizeof(ms->mbstate)); + wmemstream_update(ms); +#ifdef DEBUG + fprintf(stderr, "WMS: seek(%p, %jd, %d) %jd -> %jd\n", ms, + (intmax_t)pos, whence, (intmax_t)old, (intmax_t)ms->offset); +#endif + return (ms->offset); +} + +static int +wmemstream_close(void *cookie) +{ + + free(cookie); + return (0); +} + +FILE * +open_wmemstream(wchar_t **bufp, size_t *sizep) +{ + struct wmemstream *ms; + int save_errno; + FILE *fp; + + if (bufp == NULL || sizep == NULL) { + errno = EINVAL; + return (NULL); + } + *bufp = calloc(1, sizeof(wchar_t)); + if (*bufp == NULL) + return (NULL); + ms = malloc(sizeof(*ms)); + if (ms == NULL) { + save_errno = errno; + free(*bufp); + *bufp = NULL; + errno = save_errno; + return (NULL); + } + ms->bufp = bufp; + ms->sizep = sizep; + ms->len = 0; + ms->offset = 0; + memset(&ms->mbstate, 0, sizeof(mbstate_t)); + wmemstream_update(ms); + fp = funopen(ms, NULL, wmemstream_write, wmemstream_seek, + wmemstream_close); + if (fp == NULL) { + save_errno = errno; + free(ms); + free(*bufp); + *bufp = NULL; + errno = save_errno; + return (NULL); + } + fwide(fp, 1); + return (fp); +} Modified: stable/9/tools/regression/lib/libc/stdio/Makefile ============================================================================== --- stable/9/tools/regression/lib/libc/stdio/Makefile Fri Jun 28 15:55:30 2013 (r252342) +++ stable/9/tools/regression/lib/libc/stdio/Makefile Fri Jun 28 16:07:20 2013 (r252343) @@ -1,6 +1,8 @@ # $FreeBSD$ -TESTS= test-getdelim test-perror test-print-positional test-printbasic test-printfloat test-scanfloat *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Fri Jun 28 18:25:05 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 20494D87; Fri, 28 Jun 2013 18:25:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 113CA1D97; Fri, 28 Jun 2013 18:25:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5SIP40m049659; Fri, 28 Jun 2013 18:25:04 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5SIP43f049658; Fri, 28 Jun 2013 18:25:04 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201306281825.r5SIP43f049658@svn.freebsd.org> From: John Baldwin Date: Fri, 28 Jun 2013 18:25:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252350 - stable/9/etc/periodic/daily X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jun 2013 18:25:05 -0000 Author: jhb Date: Fri Jun 28 18:25:04 2013 New Revision: 252350 URL: http://svnweb.freebsd.org/changeset/base/252350 Log: MFC 252205: If daily_status_security_inline is set, the rc value needs to be forced to 3 so that the output of this script is always displayed. In fact, setting this flag is identical to setting daily_status_security_output to an empty string. To make the logic less confusing, change the behavior of daily_status_security_inline such that it just forces daily_status_security_output to an empty string and then applies the normal logic. PR: conf/178611 Modified: stable/9/etc/periodic/daily/450.status-security Directory Properties: stable/9/etc/ (props changed) Modified: stable/9/etc/periodic/daily/450.status-security ============================================================================== --- stable/9/etc/periodic/daily/450.status-security Fri Jun 28 18:07:41 2013 (r252349) +++ stable/9/etc/periodic/daily/450.status-security Fri Jun 28 18:25:04 2013 (r252350) @@ -18,19 +18,19 @@ case "$daily_status_security_enable" in case "$daily_status_security_inline" in [Yy][Ee][Ss]) - export security_output="";; + daily_status_security_output="";; + esac + + export security_output="${daily_status_security_output}" + case "${daily_status_security_output}" in + "") + rc=3;; + /*) + echo " (output logged separately)" + rc=0;; *) - export security_output="${daily_status_security_output}" - case "${daily_status_security_output}" in - "") - rc=3;; - /*) - echo " (output logged separately)" - rc=0;; - *) - echo " (output mailed separately)" - rc=0;; - esac;; + echo " (output mailed separately)" + rc=0;; esac periodic security || rc=3;; From owner-svn-src-stable@FreeBSD.ORG Sat Jun 29 04:25:41 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1B1A4B84; Sat, 29 Jun 2013 04:25:41 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 0BEDE177A; Sat, 29 Jun 2013 04:25:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5T4PelM028298; Sat, 29 Jun 2013 04:25:40 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5T4PeXl028296; Sat, 29 Jun 2013 04:25:40 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201306290425.r5T4PeXl028296@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 29 Jun 2013 04:25:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252365 - in stable/9: share/man/man3 sys/sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jun 2013 04:25:41 -0000 Author: lstewart Date: Sat Jun 29 04:25:40 2013 New Revision: 252365 URL: http://svnweb.freebsd.org/changeset/base/252365 Log: MFC r251887: Add new FOREACH_FROM variants of the queue(3) FOREACH macros which can optionally start the traversal from a previously found element by passing the element in as "var". Passing a NULL "var" retains the same semantics as the regular FOREACH macros. Reviewed by: jhb (previous version), rpaulo Modified: stable/9/share/man/man3/queue.3 stable/9/sys/sys/queue.h Directory Properties: stable/9/share/man/ (props changed) stable/9/share/man/man3/ (props changed) stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/share/man/man3/queue.3 ============================================================================== --- stable/9/share/man/man3/queue.3 Sat Jun 29 01:35:28 2013 (r252364) +++ stable/9/share/man/man3/queue.3 Sat Jun 29 04:25:40 2013 (r252365) @@ -32,7 +32,7 @@ .\" @(#)queue.3 8.2 (Berkeley) 1/24/94 .\" $FreeBSD$ .\" -.Dd Sep 12, 2012 +.Dd June 17, 2013 .Dt QUEUE 3 .Os .Sh NAME @@ -40,7 +40,9 @@ .Nm SLIST_ENTRY , .Nm SLIST_FIRST , .Nm SLIST_FOREACH , +.Nm SLIST_FOREACH_FROM , .Nm SLIST_FOREACH_SAFE , +.Nm SLIST_FOREACH_FROM_SAFE , .Nm SLIST_HEAD , .Nm SLIST_HEAD_INITIALIZER , .Nm SLIST_INIT , @@ -56,7 +58,9 @@ .Nm STAILQ_ENTRY , .Nm STAILQ_FIRST , .Nm STAILQ_FOREACH , +.Nm STAILQ_FOREACH_FROM , .Nm STAILQ_FOREACH_SAFE , +.Nm STAILQ_FOREACH_FROM_SAFE , .Nm STAILQ_HEAD , .Nm STAILQ_HEAD_INITIALIZER , .Nm STAILQ_INIT , @@ -73,7 +77,9 @@ .Nm LIST_ENTRY , .Nm LIST_FIRST , .Nm LIST_FOREACH , +.Nm LIST_FOREACH_FROM , .Nm LIST_FOREACH_SAFE , +.Nm LIST_FOREACH_FROM_SAFE , .Nm LIST_HEAD , .Nm LIST_HEAD_INITIALIZER , .Nm LIST_INIT , @@ -89,9 +95,13 @@ .Nm TAILQ_ENTRY , .Nm TAILQ_FIRST , .Nm TAILQ_FOREACH , +.Nm TAILQ_FOREACH_FROM , .Nm TAILQ_FOREACH_SAFE , +.Nm TAILQ_FOREACH_FROM_SAFE , .Nm TAILQ_FOREACH_REVERSE , +.Nm TAILQ_FOREACH_REVERSE_FROM , .Nm TAILQ_FOREACH_REVERSE_SAFE , +.Nm TAILQ_FOREACH_REVERSE_FROM_SAFE , .Nm TAILQ_HEAD , .Nm TAILQ_HEAD_INITIALIZER , .Nm TAILQ_INIT , @@ -113,7 +123,9 @@ lists and tail queues .Fn SLIST_ENTRY "TYPE" .Fn SLIST_FIRST "SLIST_HEAD *head" .Fn SLIST_FOREACH "TYPE *var" "SLIST_HEAD *head" "SLIST_ENTRY NAME" +.Fn SLIST_FOREACH_FROM "TYPE *var" "SLIST_HEAD *head" "SLIST_ENTRY NAME" .Fn SLIST_FOREACH_SAFE "TYPE *var" "SLIST_HEAD *head" "SLIST_ENTRY NAME" "TYPE *temp_var" +.Fn SLIST_FOREACH_FROM_SAFE "TYPE *var" "SLIST_HEAD *head" "SLIST_ENTRY NAME" "TYPE *temp_var" .Fn SLIST_HEAD "HEADNAME" "TYPE" .Fn SLIST_HEAD_INITIALIZER "SLIST_HEAD head" .Fn SLIST_INIT "SLIST_HEAD *head" @@ -130,7 +142,9 @@ lists and tail queues .Fn STAILQ_ENTRY "TYPE" .Fn STAILQ_FIRST "STAILQ_HEAD *head" .Fn STAILQ_FOREACH "TYPE *var" "STAILQ_HEAD *head" "STAILQ_ENTRY NAME" +.Fn STAILQ_FOREACH_FROM "TYPE *var" "STAILQ_HEAD *head" "STAILQ_ENTRY NAME" .Fn STAILQ_FOREACH_SAFE "TYPE *var" "STAILQ_HEAD *head" "STAILQ_ENTRY NAME" "TYPE *temp_var" +.Fn STAILQ_FOREACH_FROM_SAFE "TYPE *var" "STAILQ_HEAD *head" "STAILQ_ENTRY NAME" "TYPE *temp_var" .Fn STAILQ_HEAD "HEADNAME" "TYPE" .Fn STAILQ_HEAD_INITIALIZER "STAILQ_HEAD head" .Fn STAILQ_INIT "STAILQ_HEAD *head" @@ -148,7 +162,9 @@ lists and tail queues .Fn LIST_ENTRY "TYPE" .Fn LIST_FIRST "LIST_HEAD *head" .Fn LIST_FOREACH "TYPE *var" "LIST_HEAD *head" "LIST_ENTRY NAME" +.Fn LIST_FOREACH_FROM "TYPE *var" "LIST_HEAD *head" "LIST_ENTRY NAME" .Fn LIST_FOREACH_SAFE "TYPE *var" "LIST_HEAD *head" "LIST_ENTRY NAME" "TYPE *temp_var" +.Fn LIST_FOREACH_FROM_SAFE "TYPE *var" "LIST_HEAD *head" "LIST_ENTRY NAME" "TYPE *temp_var" .Fn LIST_HEAD "HEADNAME" "TYPE" .Fn LIST_HEAD_INITIALIZER "LIST_HEAD head" .Fn LIST_INIT "LIST_HEAD *head" @@ -165,9 +181,13 @@ lists and tail queues .Fn TAILQ_ENTRY "TYPE" .Fn TAILQ_FIRST "TAILQ_HEAD *head" .Fn TAILQ_FOREACH "TYPE *var" "TAILQ_HEAD *head" "TAILQ_ENTRY NAME" +.Fn TAILQ_FOREACH_FROM "TYPE *var" "TAILQ_HEAD *head" "TAILQ_ENTRY NAME" .Fn TAILQ_FOREACH_SAFE "TYPE *var" "TAILQ_HEAD *head" "TAILQ_ENTRY NAME" "TYPE *temp_var" +.Fn TAILQ_FOREACH_FROM_SAFE "TYPE *var" "TAILQ_HEAD *head" "TAILQ_ENTRY NAME" "TYPE *temp_var" .Fn TAILQ_FOREACH_REVERSE "TYPE *var" "TAILQ_HEAD *head" "HEADNAME" "TAILQ_ENTRY NAME" +.Fn TAILQ_FOREACH_REVERSE_FROM "TYPE *var" "TAILQ_HEAD *head" "HEADNAME" "TAILQ_ENTRY NAME" .Fn TAILQ_FOREACH_REVERSE_SAFE "TYPE *var" "TAILQ_HEAD *head" "HEADNAME" "TAILQ_ENTRY NAME" "TYPE *temp_var" +.Fn TAILQ_FOREACH_REVERSE_FROM_SAFE "TYPE *var" "TAILQ_HEAD *head" "HEADNAME" "TAILQ_ENTRY NAME" "TYPE *temp_var" .Fn TAILQ_HEAD "HEADNAME" "TYPE" .Fn TAILQ_HEAD_INITIALIZER "TAILQ_HEAD head" .Fn TAILQ_INIT "TAILQ_HEAD *head" @@ -365,6 +385,19 @@ turn to .Fa var . .Pp The macro +.Nm SLIST_FOREACH_FROM +behaves identically to +.Nm SLIST_FOREACH +when +.Fa var +is NULL, else it treats +.Fa var +as a previously found SLIST element and begins the loop at +.Fa var +instead of the first element in the SLIST referenced by +.Fa head . +.Pp +The macro .Nm SLIST_FOREACH_SAFE traverses the list referenced by .Fa head @@ -379,6 +412,19 @@ as well as free it from within the loop traversal. .Pp The macro +.Nm SLIST_FOREACH_FROM_SAFE +behaves identically to +.Nm SLIST_FOREACH_SAFE +when +.Fa var +is NULL, else it treats +.Fa var +as a previously found SLIST element and begins the loop at +.Fa var +instead of the first element in the SLIST referenced by +.Fa head . +.Pp +The macro .Nm SLIST_INIT initializes the list referenced by .Fa head . @@ -544,6 +590,19 @@ in turn to .Fa var . .Pp The macro +.Nm STAILQ_FOREACH_FROM +behaves identically to +.Nm STAILQ_FOREACH +when +.Fa var +is NULL, else it treats +.Fa var +as a previously found STAILQ element and begins the loop at +.Fa var +instead of the first element in the STAILQ referenced by +.Fa head . +.Pp +The macro .Nm STAILQ_FOREACH_SAFE traverses the tail queue referenced by .Fa head @@ -558,6 +617,19 @@ as well as free it from within the loop traversal. .Pp The macro +.Nm STAILQ_FOREACH_FROM_SAFE +behaves identically to +.Nm STAILQ_FOREACH_SAFE +when +.Fa var +is NULL, else it treats +.Fa var +as a previously found STAILQ element and begins the loop at +.Fa var +instead of the first element in the STAILQ referenced by +.Fa head . +.Pp +The macro .Nm STAILQ_INIT initializes the tail queue referenced by .Fa head . @@ -733,6 +805,19 @@ in the forward direction, assigning each .Fa var . .Pp The macro +.Nm LIST_FOREACH_FROM +behaves identically to +.Nm LIST_FOREACH +when +.Fa var +is NULL, else it treats +.Fa var +as a previously found LIST element and begins the loop at +.Fa var +instead of the first element in the LIST referenced by +.Fa head . +.Pp +The macro .Nm LIST_FOREACH_SAFE traverses the list referenced by .Fa head @@ -746,6 +831,19 @@ as well as free it from within the loop traversal. .Pp The macro +.Nm LIST_FOREACH_FROM_SAFE +behaves identically to +.Nm LIST_FOREACH_SAFE +when +.Fa var +is NULL, else it treats +.Fa var +as a previously found LIST element and begins the loop at +.Fa var +instead of the first element in the LIST referenced by +.Fa head . +.Pp +The macro .Nm LIST_INIT initializes the list referenced by .Fa head . @@ -918,12 +1016,38 @@ is set to if the loop completes normally, or if there were no elements. .Pp The macro +.Nm TAILQ_FOREACH_FROM +behaves identically to +.Nm TAILQ_FOREACH +when +.Fa var +is NULL, else it treats +.Fa var +as a previously found TAILQ element and begins the loop at +.Fa var +instead of the first element in the TAILQ referenced by +.Fa head . +.Pp +The macro .Nm TAILQ_FOREACH_REVERSE traverses the tail queue referenced by .Fa head in the reverse direction, assigning each element in turn to .Fa var . .Pp +The macro +.Nm TAILQ_FOREACH_REVERSE_FROM +behaves identically to +.Nm TAILQ_FOREACH_REVERSE +when +.Fa var +is NULL, else it treats +.Fa var +as a previously found TAILQ element and begins the reverse loop at +.Fa var +instead of the last element in the TAILQ referenced by +.Fa head . +.Pp The macros .Nm TAILQ_FOREACH_SAFE and @@ -943,6 +1067,32 @@ as well as free it from within the loop traversal. .Pp The macro +.Nm TAILQ_FOREACH_FROM_SAFE +behaves identically to +.Nm TAILQ_FOREACH_SAFE +when +.Fa var +is NULL, else it treats +.Fa var +as a previously found TAILQ element and begins the loop at +.Fa var +instead of the first element in the TAILQ referenced by +.Fa head . +.Pp +The macro +.Nm TAILQ_FOREACH_REVERSE_FROM_SAFE +behaves identically to +.Nm TAILQ_FOREACH_REVERSE_SAFE +when +.Fa var +is NULL, else it treats +.Fa var +as a previously found TAILQ element and begins the reverse loop at +.Fa var +instead of the last element in the TAILQ referenced by +.Fa head . +.Pp +The macro .Nm TAILQ_INIT initializes the tail queue referenced by .Fa head . Modified: stable/9/sys/sys/queue.h ============================================================================== --- stable/9/sys/sys/queue.h Sat Jun 29 01:35:28 2013 (r252364) +++ stable/9/sys/sys/queue.h Sat Jun 29 04:25:40 2013 (r252365) @@ -88,9 +88,13 @@ * _PREV - + - + * _LAST - - + + * _FOREACH + + + + + * _FOREACH_FROM + + + + * _FOREACH_SAFE + + + + + * _FOREACH_FROM_SAFE + + + + * _FOREACH_REVERSE - - - + + * _FOREACH_REVERSE_FROM - - - + * _FOREACH_REVERSE_SAFE - - - + + * _FOREACH_REVERSE_FROM_SAFE - - - + * _INSERT_HEAD + + + + * _INSERT_BEFORE - + - + * _INSERT_AFTER + + + + @@ -165,11 +169,21 @@ struct { \ (var); \ (var) = SLIST_NEXT((var), field)) +#define SLIST_FOREACH_FROM(var, head, field) \ + for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \ + (var); \ + (var) = SLIST_NEXT((var), field)) + #define SLIST_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = SLIST_FIRST((head)); \ (var) && ((tvar) = SLIST_NEXT((var), field), 1); \ (var) = (tvar)) +#define SLIST_FOREACH_FROM_SAFE(var, head, field, tvar) \ + for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \ + (var) && ((tvar) = SLIST_NEXT((var), field), 1); \ + (var) = (tvar)) + #define SLIST_FOREACH_PREVPTR(var, varp, head, field) \ for ((varp) = &SLIST_FIRST((head)); \ ((var) = *(varp)) != NULL; \ @@ -257,12 +271,21 @@ struct { \ (var); \ (var) = STAILQ_NEXT((var), field)) +#define STAILQ_FOREACH_FROM(var, head, field) \ + for ((var) = ((var) ? (var) : STAILQ_FIRST((head))); \ + (var); \ + (var) = STAILQ_NEXT((var), field)) #define STAILQ_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = STAILQ_FIRST((head)); \ (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \ (var) = (tvar)) +#define STAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \ + for ((var) = ((var) ? (var) : STAILQ_FIRST((head))); \ + (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \ + (var) = (tvar)) + #define STAILQ_INIT(head) do { \ STAILQ_FIRST((head)) = NULL; \ (head)->stqh_last = &STAILQ_FIRST((head)); \ @@ -387,11 +410,21 @@ struct { \ (var); \ (var) = LIST_NEXT((var), field)) +#define LIST_FOREACH_FROM(var, head, field) \ + for ((var) = ((var) ? (var) : LIST_FIRST((head))); \ + (var); \ + (var) = LIST_NEXT((var), field)) + #define LIST_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = LIST_FIRST((head)); \ (var) && ((tvar) = LIST_NEXT((var), field), 1); \ (var) = (tvar)) +#define LIST_FOREACH_FROM_SAFE(var, head, field, tvar) \ + for ((var) = ((var) ? (var) : LIST_FIRST((head))); \ + (var) && ((tvar) = LIST_NEXT((var), field), 1); \ + (var) = (tvar)) + #define LIST_INIT(head) do { \ LIST_FIRST((head)) = NULL; \ } while (0) @@ -524,21 +557,41 @@ struct { \ (var); \ (var) = TAILQ_NEXT((var), field)) +#define TAILQ_FOREACH_FROM(var, head, field) \ + for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \ + (var); \ + (var) = TAILQ_NEXT((var), field)) + #define TAILQ_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = TAILQ_FIRST((head)); \ (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \ (var) = (tvar)) +#define TAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \ + for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \ + (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \ + (var) = (tvar)) + #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ for ((var) = TAILQ_LAST((head), headname); \ (var); \ (var) = TAILQ_PREV((var), headname, field)) +#define TAILQ_FOREACH_REVERSE_FROM(var, head, headname, field) \ + for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname)); \ + (var); \ + (var) = TAILQ_PREV((var), headname, field)) + #define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \ for ((var) = TAILQ_LAST((head), headname); \ (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \ (var) = (tvar)) +#define TAILQ_FOREACH_REVERSE_FROM_SAFE(var, head, headname, field, tvar) \ + for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname)); \ + (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \ + (var) = (tvar)) + #define TAILQ_INIT(head) do { \ TAILQ_FIRST((head)) = NULL; \ (head)->tqh_last = &TAILQ_FIRST((head)); \ From owner-svn-src-stable@FreeBSD.ORG Sat Jun 29 04:27:05 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9ADABCF5; Sat, 29 Jun 2013 04:27:05 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 8C5661786; Sat, 29 Jun 2013 04:27:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5T4R5cT028505; Sat, 29 Jun 2013 04:27:05 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5T4R57t028503; Sat, 29 Jun 2013 04:27:05 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201306290427.r5T4R57t028503@svn.freebsd.org> From: Lawrence Stewart Date: Sat, 29 Jun 2013 04:27:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252366 - in stable/8: share/man/man3 sys/sys X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jun 2013 04:27:05 -0000 Author: lstewart Date: Sat Jun 29 04:27:04 2013 New Revision: 252366 URL: http://svnweb.freebsd.org/changeset/base/252366 Log: MFC r251887: Add new FOREACH_FROM variants of the queue(3) FOREACH macros which can optionally start the traversal from a previously found element by passing the element in as "var". Passing a NULL "var" retains the same semantics as the regular FOREACH macros. Reviewed by: jhb (previous version), rpaulo Modified: stable/8/share/man/man3/queue.3 stable/8/sys/sys/queue.h Directory Properties: stable/8/share/man/ (props changed) stable/8/share/man/man3/ (props changed) stable/8/sys/ (props changed) stable/8/sys/sys/ (props changed) Modified: stable/8/share/man/man3/queue.3 ============================================================================== --- stable/8/share/man/man3/queue.3 Sat Jun 29 04:25:40 2013 (r252365) +++ stable/8/share/man/man3/queue.3 Sat Jun 29 04:27:04 2013 (r252366) @@ -32,7 +32,7 @@ .\" @(#)queue.3 8.2 (Berkeley) 1/24/94 .\" $FreeBSD$ .\" -.Dd May 13, 2011 +.Dd June 17, 2013 .Dt QUEUE 3 .Os .Sh NAME @@ -40,7 +40,9 @@ .Nm SLIST_ENTRY , .Nm SLIST_FIRST , .Nm SLIST_FOREACH , +.Nm SLIST_FOREACH_FROM , .Nm SLIST_FOREACH_SAFE , +.Nm SLIST_FOREACH_FROM_SAFE , .Nm SLIST_HEAD , .Nm SLIST_HEAD_INITIALIZER , .Nm SLIST_INIT , @@ -56,7 +58,9 @@ .Nm STAILQ_ENTRY , .Nm STAILQ_FIRST , .Nm STAILQ_FOREACH , +.Nm STAILQ_FOREACH_FROM , .Nm STAILQ_FOREACH_SAFE , +.Nm STAILQ_FOREACH_FROM_SAFE , .Nm STAILQ_HEAD , .Nm STAILQ_HEAD_INITIALIZER , .Nm STAILQ_INIT , @@ -73,7 +77,9 @@ .Nm LIST_ENTRY , .Nm LIST_FIRST , .Nm LIST_FOREACH , +.Nm LIST_FOREACH_FROM , .Nm LIST_FOREACH_SAFE , +.Nm LIST_FOREACH_FROM_SAFE , .Nm LIST_HEAD , .Nm LIST_HEAD_INITIALIZER , .Nm LIST_INIT , @@ -88,9 +94,13 @@ .Nm TAILQ_ENTRY , .Nm TAILQ_FIRST , .Nm TAILQ_FOREACH , +.Nm TAILQ_FOREACH_FROM , .Nm TAILQ_FOREACH_SAFE , +.Nm TAILQ_FOREACH_FROM_SAFE , .Nm TAILQ_FOREACH_REVERSE , +.Nm TAILQ_FOREACH_REVERSE_FROM , .Nm TAILQ_FOREACH_REVERSE_SAFE , +.Nm TAILQ_FOREACH_REVERSE_FROM_SAFE , .Nm TAILQ_HEAD , .Nm TAILQ_HEAD_INITIALIZER , .Nm TAILQ_INIT , @@ -112,7 +122,9 @@ lists and tail queues .Fn SLIST_ENTRY "TYPE" .Fn SLIST_FIRST "SLIST_HEAD *head" .Fn SLIST_FOREACH "TYPE *var" "SLIST_HEAD *head" "SLIST_ENTRY NAME" +.Fn SLIST_FOREACH_FROM "TYPE *var" "SLIST_HEAD *head" "SLIST_ENTRY NAME" .Fn SLIST_FOREACH_SAFE "TYPE *var" "SLIST_HEAD *head" "SLIST_ENTRY NAME" "TYPE *temp_var" +.Fn SLIST_FOREACH_FROM_SAFE "TYPE *var" "SLIST_HEAD *head" "SLIST_ENTRY NAME" "TYPE *temp_var" .Fn SLIST_HEAD "HEADNAME" "TYPE" .Fn SLIST_HEAD_INITIALIZER "SLIST_HEAD head" .Fn SLIST_INIT "SLIST_HEAD *head" @@ -129,7 +141,9 @@ lists and tail queues .Fn STAILQ_ENTRY "TYPE" .Fn STAILQ_FIRST "STAILQ_HEAD *head" .Fn STAILQ_FOREACH "TYPE *var" "STAILQ_HEAD *head" "STAILQ_ENTRY NAME" +.Fn STAILQ_FOREACH_FROM "TYPE *var" "STAILQ_HEAD *head" "STAILQ_ENTRY NAME" .Fn STAILQ_FOREACH_SAFE "TYPE *var" "STAILQ_HEAD *head" "STAILQ_ENTRY NAME" "TYPE *temp_var" +.Fn STAILQ_FOREACH_FROM_SAFE "TYPE *var" "STAILQ_HEAD *head" "STAILQ_ENTRY NAME" "TYPE *temp_var" .Fn STAILQ_HEAD "HEADNAME" "TYPE" .Fn STAILQ_HEAD_INITIALIZER "STAILQ_HEAD head" .Fn STAILQ_INIT "STAILQ_HEAD *head" @@ -147,7 +161,9 @@ lists and tail queues .Fn LIST_ENTRY "TYPE" .Fn LIST_FIRST "LIST_HEAD *head" .Fn LIST_FOREACH "TYPE *var" "LIST_HEAD *head" "LIST_ENTRY NAME" +.Fn LIST_FOREACH_FROM "TYPE *var" "LIST_HEAD *head" "LIST_ENTRY NAME" .Fn LIST_FOREACH_SAFE "TYPE *var" "LIST_HEAD *head" "LIST_ENTRY NAME" "TYPE *temp_var" +.Fn LIST_FOREACH_FROM_SAFE "TYPE *var" "LIST_HEAD *head" "LIST_ENTRY NAME" "TYPE *temp_var" .Fn LIST_HEAD "HEADNAME" "TYPE" .Fn LIST_HEAD_INITIALIZER "LIST_HEAD head" .Fn LIST_INIT "LIST_HEAD *head" @@ -163,9 +179,13 @@ lists and tail queues .Fn TAILQ_ENTRY "TYPE" .Fn TAILQ_FIRST "TAILQ_HEAD *head" .Fn TAILQ_FOREACH "TYPE *var" "TAILQ_HEAD *head" "TAILQ_ENTRY NAME" +.Fn TAILQ_FOREACH_FROM "TYPE *var" "TAILQ_HEAD *head" "TAILQ_ENTRY NAME" .Fn TAILQ_FOREACH_SAFE "TYPE *var" "TAILQ_HEAD *head" "TAILQ_ENTRY NAME" "TYPE *temp_var" +.Fn TAILQ_FOREACH_FROM_SAFE "TYPE *var" "TAILQ_HEAD *head" "TAILQ_ENTRY NAME" "TYPE *temp_var" .Fn TAILQ_FOREACH_REVERSE "TYPE *var" "TAILQ_HEAD *head" "HEADNAME" "TAILQ_ENTRY NAME" +.Fn TAILQ_FOREACH_REVERSE_FROM "TYPE *var" "TAILQ_HEAD *head" "HEADNAME" "TAILQ_ENTRY NAME" .Fn TAILQ_FOREACH_REVERSE_SAFE "TYPE *var" "TAILQ_HEAD *head" "HEADNAME" "TAILQ_ENTRY NAME" "TYPE *temp_var" +.Fn TAILQ_FOREACH_REVERSE_FROM_SAFE "TYPE *var" "TAILQ_HEAD *head" "HEADNAME" "TAILQ_ENTRY NAME" "TYPE *temp_var" .Fn TAILQ_HEAD "HEADNAME" "TYPE" .Fn TAILQ_HEAD_INITIALIZER "TAILQ_HEAD head" .Fn TAILQ_INIT "TAILQ_HEAD *head" @@ -353,6 +373,19 @@ turn to .Fa var . .Pp The macro +.Nm SLIST_FOREACH_FROM +behaves identically to +.Nm SLIST_FOREACH +when +.Fa var +is NULL, else it treats +.Fa var +as a previously found SLIST element and begins the loop at +.Fa var +instead of the first element in the SLIST referenced by +.Fa head . +.Pp +The macro .Nm SLIST_FOREACH_SAFE traverses the list referenced by .Fa head @@ -367,6 +400,19 @@ as well as free it from within the loop traversal. .Pp The macro +.Nm SLIST_FOREACH_FROM_SAFE +behaves identically to +.Nm SLIST_FOREACH_SAFE +when +.Fa var +is NULL, else it treats +.Fa var +as a previously found SLIST element and begins the loop at +.Fa var +instead of the first element in the SLIST referenced by +.Fa head . +.Pp +The macro .Nm SLIST_INIT initializes the list referenced by .Fa head . @@ -532,6 +578,19 @@ in turn to .Fa var . .Pp The macro +.Nm STAILQ_FOREACH_FROM +behaves identically to +.Nm STAILQ_FOREACH +when +.Fa var +is NULL, else it treats +.Fa var +as a previously found STAILQ element and begins the loop at +.Fa var +instead of the first element in the STAILQ referenced by +.Fa head . +.Pp +The macro .Nm STAILQ_FOREACH_SAFE traverses the tail queue referenced by .Fa head @@ -546,6 +605,19 @@ as well as free it from within the loop traversal. .Pp The macro +.Nm STAILQ_FOREACH_FROM_SAFE +behaves identically to +.Nm STAILQ_FOREACH_SAFE +when +.Fa var +is NULL, else it treats +.Fa var +as a previously found STAILQ element and begins the loop at +.Fa var +instead of the first element in the STAILQ referenced by +.Fa head . +.Pp +The macro .Nm STAILQ_INIT initializes the tail queue referenced by .Fa head . @@ -721,6 +793,19 @@ in the forward direction, assigning each .Fa var . .Pp The macro +.Nm LIST_FOREACH_FROM +behaves identically to +.Nm LIST_FOREACH +when +.Fa var +is NULL, else it treats +.Fa var +as a previously found LIST element and begins the loop at +.Fa var +instead of the first element in the LIST referenced by +.Fa head . +.Pp +The macro .Nm LIST_FOREACH_SAFE traverses the list referenced by .Fa head @@ -734,6 +819,19 @@ as well as free it from within the loop traversal. .Pp The macro +.Nm LIST_FOREACH_FROM_SAFE +behaves identically to +.Nm LIST_FOREACH_SAFE +when +.Fa var +is NULL, else it treats +.Fa var +as a previously found LIST element and begins the loop at +.Fa var +instead of the first element in the LIST referenced by +.Fa head . +.Pp +The macro .Nm LIST_INIT initializes the list referenced by .Fa head . @@ -898,12 +996,38 @@ is set to if the loop completes normally, or if there were no elements. .Pp The macro +.Nm TAILQ_FOREACH_FROM +behaves identically to +.Nm TAILQ_FOREACH +when +.Fa var +is NULL, else it treats +.Fa var +as a previously found TAILQ element and begins the loop at +.Fa var +instead of the first element in the TAILQ referenced by +.Fa head . +.Pp +The macro .Nm TAILQ_FOREACH_REVERSE traverses the tail queue referenced by .Fa head in the reverse direction, assigning each element in turn to .Fa var . .Pp +The macro +.Nm TAILQ_FOREACH_REVERSE_FROM +behaves identically to +.Nm TAILQ_FOREACH_REVERSE +when +.Fa var +is NULL, else it treats +.Fa var +as a previously found TAILQ element and begins the reverse loop at +.Fa var +instead of the last element in the TAILQ referenced by +.Fa head . +.Pp The macros .Nm TAILQ_FOREACH_SAFE and @@ -923,6 +1047,32 @@ as well as free it from within the loop traversal. .Pp The macro +.Nm TAILQ_FOREACH_FROM_SAFE +behaves identically to +.Nm TAILQ_FOREACH_SAFE +when +.Fa var +is NULL, else it treats +.Fa var +as a previously found TAILQ element and begins the loop at +.Fa var +instead of the first element in the TAILQ referenced by +.Fa head . +.Pp +The macro +.Nm TAILQ_FOREACH_REVERSE_FROM_SAFE +behaves identically to +.Nm TAILQ_FOREACH_REVERSE_SAFE +when +.Fa var +is NULL, else it treats +.Fa var +as a previously found TAILQ element and begins the reverse loop at +.Fa var +instead of the last element in the TAILQ referenced by +.Fa head . +.Pp +The macro .Nm TAILQ_INIT initializes the tail queue referenced by .Fa head . Modified: stable/8/sys/sys/queue.h ============================================================================== --- stable/8/sys/sys/queue.h Sat Jun 29 04:25:40 2013 (r252365) +++ stable/8/sys/sys/queue.h Sat Jun 29 04:27:04 2013 (r252366) @@ -88,9 +88,13 @@ * _PREV - - - + * _LAST - - + + * _FOREACH + + + + + * _FOREACH_FROM + + + + * _FOREACH_SAFE + + + + + * _FOREACH_FROM_SAFE + + + + * _FOREACH_REVERSE - - - + + * _FOREACH_REVERSE_FROM - - - + * _FOREACH_REVERSE_SAFE - - - + + * _FOREACH_REVERSE_FROM_SAFE - - - + * _INSERT_HEAD + + + + * _INSERT_BEFORE - + - + * _INSERT_AFTER + + + + @@ -165,11 +169,21 @@ struct { \ (var); \ (var) = SLIST_NEXT((var), field)) +#define SLIST_FOREACH_FROM(var, head, field) \ + for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \ + (var); \ + (var) = SLIST_NEXT((var), field)) + #define SLIST_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = SLIST_FIRST((head)); \ (var) && ((tvar) = SLIST_NEXT((var), field), 1); \ (var) = (tvar)) +#define SLIST_FOREACH_FROM_SAFE(var, head, field, tvar) \ + for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \ + (var) && ((tvar) = SLIST_NEXT((var), field), 1); \ + (var) = (tvar)) + #define SLIST_FOREACH_PREVPTR(var, varp, head, field) \ for ((varp) = &SLIST_FIRST((head)); \ ((var) = *(varp)) != NULL; \ @@ -257,12 +271,21 @@ struct { \ (var); \ (var) = STAILQ_NEXT((var), field)) +#define STAILQ_FOREACH_FROM(var, head, field) \ + for ((var) = ((var) ? (var) : STAILQ_FIRST((head))); \ + (var); \ + (var) = STAILQ_NEXT((var), field)) #define STAILQ_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = STAILQ_FIRST((head)); \ (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \ (var) = (tvar)) +#define STAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \ + for ((var) = ((var) ? (var) : STAILQ_FIRST((head))); \ + (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \ + (var) = (tvar)) + #define STAILQ_INIT(head) do { \ STAILQ_FIRST((head)) = NULL; \ (head)->stqh_last = &STAILQ_FIRST((head)); \ @@ -389,11 +412,21 @@ struct { \ (var); \ (var) = LIST_NEXT((var), field)) +#define LIST_FOREACH_FROM(var, head, field) \ + for ((var) = ((var) ? (var) : LIST_FIRST((head))); \ + (var); \ + (var) = LIST_NEXT((var), field)) + #define LIST_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = LIST_FIRST((head)); \ (var) && ((tvar) = LIST_NEXT((var), field), 1); \ (var) = (tvar)) +#define LIST_FOREACH_FROM_SAFE(var, head, field, tvar) \ + for ((var) = ((var) ? (var) : LIST_FIRST((head))); \ + (var) && ((tvar) = LIST_NEXT((var), field), 1); \ + (var) = (tvar)) + #define LIST_INIT(head) do { \ LIST_FIRST((head)) = NULL; \ } while (0) @@ -522,21 +555,41 @@ struct { \ (var); \ (var) = TAILQ_NEXT((var), field)) +#define TAILQ_FOREACH_FROM(var, head, field) \ + for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \ + (var); \ + (var) = TAILQ_NEXT((var), field)) + #define TAILQ_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = TAILQ_FIRST((head)); \ (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \ (var) = (tvar)) +#define TAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \ + for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \ + (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \ + (var) = (tvar)) + #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ for ((var) = TAILQ_LAST((head), headname); \ (var); \ (var) = TAILQ_PREV((var), headname, field)) +#define TAILQ_FOREACH_REVERSE_FROM(var, head, headname, field) \ + for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname)); \ + (var); \ + (var) = TAILQ_PREV((var), headname, field)) + #define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \ for ((var) = TAILQ_LAST((head), headname); \ (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \ (var) = (tvar)) +#define TAILQ_FOREACH_REVERSE_FROM_SAFE(var, head, headname, field, tvar) \ + for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname)); \ + (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \ + (var) = (tvar)) + #define TAILQ_INIT(head) do { \ TAILQ_FIRST((head)) = NULL; \ (head)->tqh_last = &TAILQ_FIRST((head)); \