svn commit: r246143 - in head: contrib/ipfilter/ipsend libexec/bootpd sbin/route sys/net sys/netinet usr.sbin/arp usr.sbin/ndp usr.sbin/ppp usr.sbin/rarpd

2013-01-31 Thread Gleb Smirnoff
Author: glebius
Date: Thu Jan 31 08:55:21 2013
New Revision: 246143
URL: http://svnweb.freebsd.org/changeset/base/246143

Log:
  Retire struct sockaddr_inarp.
  
  Since ARP and routing are separated, "proxy only" entries
  don't have any meaning, thus we don't need additional field
  in sockaddr to pass SIN_PROXY flag.
  
  New kernel is binary compatible with old tools, since sizes
  of sockaddr_inarp and sockaddr_in match, and sa_family are
  filled with same value.
  
  The structure declaration is left for compatibility with
  third party software, but in tree code no longer use it.
  
  Reviewed by:  ru, andre, net@

Modified:
  head/contrib/ipfilter/ipsend/44arp.c
  head/libexec/bootpd/rtmsg.c
  head/sbin/route/route.c
  head/sys/net/if_llatbl.c
  head/sys/net/if_llatbl.h
  head/sys/netinet/if_ether.h
  head/sys/netinet/in.c
  head/usr.sbin/arp/arp.8
  head/usr.sbin/arp/arp.c
  head/usr.sbin/ndp/ndp.c
  head/usr.sbin/ppp/arp.c
  head/usr.sbin/rarpd/rarpd.c

Modified: head/contrib/ipfilter/ipsend/44arp.c
==
--- head/contrib/ipfilter/ipsend/44arp.cThu Jan 31 01:15:12 2013
(r246142)
+++ head/contrib/ipfilter/ipsend/44arp.cThu Jan 31 08:55:21 2013
(r246143)
@@ -72,7 +72,7 @@ char  *addr, *eaddr;
size_t  needed;
char*lim, *buf, *next;
struct  rt_msghdr   *rtm;
-   struct  sockaddr_inarp  *sin;
+   struct  sockaddr_in *sin;
struct  sockaddr_dl *sdl;
 
 #ifdef IPSEND
@@ -113,7 +113,7 @@ char*addr, *eaddr;
for (next = buf; next < lim; next += rtm->rtm_msglen)
{
rtm = (struct rt_msghdr *)next;
-   sin = (struct sockaddr_inarp *)(rtm + 1);
+   sin = (struct sockaddr_in *)(rtm + 1);
sdl = (struct sockaddr_dl *)(sin + 1);
if (!bcmp(addr, (char *)&sin->sin_addr,
  sizeof(struct in_addr)))

Modified: head/libexec/bootpd/rtmsg.c
==
--- head/libexec/bootpd/rtmsg.c Thu Jan 31 01:15:12 2013(r246142)
+++ head/libexec/bootpd/rtmsg.c Thu Jan 31 08:55:21 2013(r246143)
@@ -106,9 +106,9 @@ static void getsocket () {
 }
 
 static struct  sockaddr_in so_mask = {8, 0, 0, { 0x}};
-static struct  sockaddr_inarp blank_sin = {sizeof(blank_sin), AF_INET }, sin_m;
+static struct  sockaddr_in blank_sin = {sizeof(blank_sin), AF_INET }, sin_m;
 static struct  sockaddr_dl blank_sdl = {sizeof(blank_sdl), AF_LINK }, sdl_m;
-static int expire_time, flags, export_only, doing_proxy;
+static int expire_time, flags, doing_proxy;
 static struct  {
struct  rt_msghdr m_rtm;
charm_space[512];
@@ -122,7 +122,7 @@ int bsd_arp_set(ia, eaddr, len)
char *eaddr;
int len;
 {
-   register struct sockaddr_inarp *sin = &sin_m;
+   register struct sockaddr_in *sin = &sin_m;
register struct sockaddr_dl *sdl;
register struct rt_msghdr *rtm = &(m_rtmsg.m_rtm);
u_char *ea;
@@ -137,7 +137,7 @@ int bsd_arp_set(ia, eaddr, len)
ea = (u_char *)LLADDR(&sdl_m);
bcopy(eaddr, ea, len);
sdl_m.sdl_alen = len;
-   doing_proxy = flags = export_only = expire_time = 0;
+   doing_proxy = flags = expire_time = 0;
 
/* make arp entry temporary */
clock_gettime(CLOCK_MONOTONIC, &tp);
@@ -148,7 +148,7 @@ tryagain:
report(LOG_WARNING, "rtmget: %s", strerror(errno));
return (1);
}
-   sin = (struct sockaddr_inarp *)(rtm + 1);
+   sin = (struct sockaddr_in *)(rtm + 1);
sdl = (struct sockaddr_dl *)(sin->sin_len + (char *)sin);
if (sin->sin_addr.s_addr == sin_m.sin_addr.s_addr) {
if (sdl->sdl_family == AF_LINK &&
@@ -163,13 +163,6 @@ tryagain:
inet_ntoa(sin->sin_addr));
return (1);
}
-   if (sin_m.sin_other & SIN_PROXY) {
-   report(LOG_WARNING,
-   "set: proxy entry exists for non 802 device\n");
-   return(1);
-   }
-   sin_m.sin_other = SIN_PROXY;
-   export_only = 1;
goto tryagain;
}
 overwrite:
@@ -209,14 +202,9 @@ static int rtmsg(cmd)
rtm->rtm_rmx.rmx_expire = expire_time;
rtm->rtm_inits = RTV_EXPIRE;
rtm->rtm_flags |= (RTF_HOST | RTF_STATIC | RTF_LLDATA);
-   sin_m.sin_other = 0;
if (doing_proxy) {
-   if (export_only)
-   sin_m.sin_other = SIN_PROXY;
-   else {
-   rtm->rtm_addrs |= RTA_NETMASK;
-   rtm->rtm_flags &= ~RTF_HOST;
-   }
+   rtm->rtm_addrs 

svn commit: r246144 - head/sys/netinet/libalias

2013-01-31 Thread Gleb Smirnoff
Author: glebius
Date: Thu Jan 31 10:29:22 2013
New Revision: 246144
URL: http://svnweb.freebsd.org/changeset/base/246144

Log:
  - Move AUTHORS and ACKNOWLEDGEMENTS to the end of the page.
  - Add myself to list of authors.

Modified:
  head/sys/netinet/libalias/libalias.3

Modified: head/sys/netinet/libalias/libalias.3
==
--- head/sys/netinet/libalias/libalias.3Thu Jan 31 08:55:21 2013
(r246143)
+++ head/sys/netinet/libalias/libalias.3Thu Jan 31 10:29:22 2013
(r246144)
@@ -901,39 +901,6 @@ is provided for error checking purposes.
 This function can be used if an already-aliased packet needs to have its
 original IP header restored for further processing (e.g.\& logging).
 .Ed
-.Sh AUTHORS
-.An Charles Mott Aq c...@linktel.net ,
-versions 1.0 - 1.8, 2.0 - 2.4.
-.An Eivind Eklund Aq eiv...@freebsd.org ,
-versions 1.8b, 1.9 and 2.5.
-Added IRC DCC support as well as contributing a number of architectural
-improvements; added the firewall bypass for FTP/IRC DCC.
-.An Erik Salander Aq e...@whistle.com
-added support for PPTP and RTSP.
-.An Junichi Satoh Aq juni...@junichi.org
-added support for RTSP/PNA.
-.An Ruslan Ermilov Aq r...@freebsd.org
-added support for PPTP and LSNAT as well as general hacking.
-.An Paolo Pisati Aq p...@freebsd.org
-made the library modular, moving support for all
-protocols (except for IP, TCP and UDP) to external modules.
-.Sh ACKNOWLEDGEMENTS
-Listed below, in approximate chronological order, are individuals who
-have provided valuable comments and/or debugging assistance.
-.Bd -ragged -offset indent
-.An -split
-.An Gary Roberts
-.An Tom Torrance
-.An Reto Burkhalter
-.An Martin Renters
-.An Brian Somers
-.An Paul Traina
-.An Ari Suutari
-.An Dave Remien
-.An J. Fortes
-.An Andrzej Bialecki
-.An Gordon Burditt
-.Ed
 .Sh CONCEPTUAL BACKGROUND
 This section is intended for those who are planning to modify the source
 code or want to create somewhat esoteric applications using the packet
@@ -1475,3 +1442,38 @@ with the
 facility and the
 .Dv LOG_INFO
 level.
+.Sh AUTHORS
+.An Charles Mott Aq c...@linktel.net ,
+versions 1.0 - 1.8, 2.0 - 2.4.
+.An Eivind Eklund Aq eiv...@freebsd.org ,
+versions 1.8b, 1.9 and 2.5.
+Added IRC DCC support as well as contributing a number of architectural
+improvements; added the firewall bypass for FTP/IRC DCC.
+.An Erik Salander Aq e...@whistle.com
+added support for PPTP and RTSP.
+.An Junichi Satoh Aq juni...@junichi.org
+added support for RTSP/PNA.
+.An Ruslan Ermilov Aq r...@freebsd.org
+added support for PPTP and LSNAT as well as general hacking.
+.An Gleb Smirnoff Aq gleb...@freebsd.org
+ported the library to kernel space.
+.An Paolo Pisati Aq p...@freebsd.org
+made the library modular, moving support for all
+protocols (except for IP, TCP and UDP) to external modules.
+.Sh ACKNOWLEDGEMENTS
+Listed below, in approximate chronological order, are individuals who
+have provided valuable comments and/or debugging assistance.
+.Bd -ragged -offset indent
+.An -split
+.An Gary Roberts
+.An Tom Torrance
+.An Reto Burkhalter
+.An Martin Renters
+.An Brian Somers
+.An Paul Traina
+.An Ari Suutari
+.An Dave Remien
+.An J. Fortes
+.An Andrzej Bialecki
+.An Gordon Burditt
+.Ed
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246145 - in head/sys/boot/usb: . tools

2013-01-31 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Jan 31 11:00:57 2013
New Revision: 246145
URL: http://svnweb.freebsd.org/changeset/base/246145

Log:
  Initial version of libusbboot, a fully stand-alone, single threaded and
  functional compilation of the FreeBSD USB stack for use with boot loaders
  and such.
  
  Discussed with:   Hiroki Sato, hrs @ EuroBSDCon

Added:
  head/sys/boot/usb/
  head/sys/boot/usb/Makefile   (contents, props changed)
  head/sys/boot/usb/Makefile.test   (contents, props changed)
  head/sys/boot/usb/bsd_busspace.c   (contents, props changed)
  head/sys/boot/usb/bsd_global.h   (contents, props changed)
  head/sys/boot/usb/bsd_kernel.c   (contents, props changed)
  head/sys/boot/usb/bsd_kernel.h   (contents, props changed)
  head/sys/boot/usb/bsd_usbloader_test.c   (contents, props changed)
  head/sys/boot/usb/tools/
  head/sys/boot/usb/tools/sysinit.c   (contents, props changed)
  head/sys/boot/usb/tools/sysinit.h   (contents, props changed)
  head/sys/boot/usb/usb_busdma_loader.c   (contents, props changed)

Added: head/sys/boot/usb/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/boot/usb/Makefile  Thu Jan 31 11:00:57 2013(r246145)
@@ -0,0 +1,150 @@
+#
+# $FreeBSD$
+#
+# Copyright (c) 2013 Hans Petter Selasky. 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.
+#
+
+T=${.CURDIR}/tools
+S=${.CURDIR}/../..
+
+.PATH: \
+   ${.CURDIR} \
+   ${S}/dev/usb \
+   ${S}/dev/usb/controller \
+   ${S}/dev/usb/serial \
+   ${S}/dev/usb/storage \
+   ${S}/dev/usb/template
+
+LIB=   usbboot
+INTERNALLIB=
+OBJCOPY?=  objcopy
+SYSCC?=cc
+
+CFLAGS+=   -DBOOTPROG=\"usbloader\"
+CFLAGS+=   -DUSB_GLOBAL_INCLUDE_FILE="\"bsd_global.h\""
+CFLAGS+=   -ffunction-sections -fdata-sections
+CFLAGS+=   -ffreestanding
+CFLAGS+=   -Wformat -Wall
+CFLAGS+=   -I ${S}
+CFLAGS+=   -I ${T}
+CFLAGS+=   -I ${.CURDIR}
+CFLAGS+=   -g
+
+.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
+CFLAGS+=   -march=i386
+CFLAGS+=   -mpreferred-stack-boundary=2
+.endif
+.if ${MACHINE_CPUARCH} == "amd64"
+CFLAGS+=   -m32
+.endif
+
+#
+# Single threaded BSD kernel
+#
+SRCS+= bsd_kernel.c
+
+#
+# BUSSPACE implementation
+#
+SRCS+= bsd_busspace.c
+
+#
+# BUSDMA implementation
+#
+SRCS+= usb_busdma_loader.c
+
+#
+# USB controller drivers
+#
+SRCS+= at91dci.c
+SRCS+= atmegadci.c
+SRCS+= avr32dci.c
+SRCS+= dwc_otg.c
+SRCS+= ehci.c
+SRCS+= musb_otg.c
+SRCS+= ohci.c
+SRCS+= uhci.c
+SRCS+= uss820dci.c
+SRCS+= xhci.c
+SRCS+= usb_controller.c
+
+CFLAGS += -DUSB_PROBE_LIST="\"xhci\", \"ehci\", \"uhci\", \"ohci\""
+
+#
+# USB core and templates
+#
+SRCS+= usb_core.c
+SRCS+= usb_debug.c
+SRCS+= usb_device.c
+SRCS+= usb_dynamic.c
+SRCS+= usb_error.c
+SRCS+= usb_handle_request.c
+SRCS+= usb_hid.c
+SRCS+= usb_hub.c
+SRCS+= usb_lookup.c
+SRCS+= usb_msctest.c
+SRCS+= usb_parse.c
+SRCS+= usb_request.c
+SRCS+= usb_transfer.c
+SRCS+= usb_util.c
+SRCS+= usb_template.c
+SRCS+= usb_template_cdce.c
+SRCS+= usb_template_msc.c
+SRCS+= usb_template_mtp.c
+SRCS+= usb_template_modem.c
+SRCS+= usb_template_mouse.c
+SRCS+= usb_template_kbd.c
+SRCS+= usb_template_audio.c
+SRCS+= sysinit_data.c
+SRCS+= sysuninit_data.c
+
+CLEANFILES+= sysinit
+CLEANFILES+= sysinit.bin
+CLEANFILES+= sysinit_data.c
+CLEANFILES+= sysuninit_data.c
+
+CLEANFILES+= ${SRCS:C/\.c/.osys/g}
+
+.include 
+
+#
+# SYSINIT() and SYSUNINIT() handling
+#
+sysinit: ${T}/sysinit.c
+   ${SYSCC} -Wall -o ${.TARGET} ${.ALLSRC}
+
+sysinit_data.c: sysinit.bin sysinit
+   ${.OBJDIR}/sysinit -i sysinit.bin -o ${.TARGET} -k sysinit -s 

svn commit: r246146 - head/sys/cam/scsi

2013-01-31 Thread Steven Hartland
Author: smh
Date: Thu Jan 31 14:07:24 2013
New Revision: 246146
URL: http://svnweb.freebsd.org/changeset/base/246146

Log:
  Format CDB output as 2 digit hex correcting the length
  
  Approved by:  pjd (mentor)
  MFC after:1 week

Modified:
  head/sys/cam/scsi/scsi_all.c

Modified: head/sys/cam/scsi/scsi_all.c
==
--- head/sys/cam/scsi/scsi_all.cThu Jan 31 11:00:57 2013
(r246145)
+++ head/sys/cam/scsi/scsi_all.cThu Jan 31 14:07:24 2013
(r246146)
@@ -3139,7 +3139,7 @@ scsi_cdb_string(u_int8_t *cdb_ptr, char 
*cdb_string = '\0';
for (i = 0; i < cdb_len; i++)
snprintf(cdb_string + strlen(cdb_string),
-len - strlen(cdb_string), "%x ", cdb_ptr[i]);
+len - strlen(cdb_string), "%02hhx ", cdb_ptr[i]);
 
return(cdb_string);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246147 - head/usr.bin/xinstall

2013-01-31 Thread Brooks Davis
Author: brooks
Date: Thu Jan 31 16:04:40 2013
New Revision: 246147
URL: http://svnweb.freebsd.org/changeset/base/246147

Log:
  When in -U mode do avoid setting SUID bits, but do not modify the mode
  variable so the intended mode can be logged correctly if -M is specified.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/usr.bin/xinstall/xinstall.c

Modified: head/usr.bin/xinstall/xinstall.c
==
--- head/usr.bin/xinstall/xinstall.cThu Jan 31 14:07:24 2013
(r246146)
+++ head/usr.bin/xinstall/xinstall.cThu Jan 31 16:04:40 2013
(r246147)
@@ -953,9 +953,8 @@ install(const char *from_name, const cha
}
 
if (mode != (to_sb.st_mode & ALLPERMS)) {
-   if (dounpriv)
-   mode &= S_IRWXU|S_IRWXG|S_IRWXO;
-   if (fchmod(to_fd, mode)) {
+   if (fchmod(to_fd,
+dounpriv ? mode & (S_IRWXU|S_IRWXG|S_IRWXO) : mode)) {
serrno = errno;
(void)unlink(to_name);
errno = serrno;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246148 - in head: lib/libc/stdio tools/regression/lib/libc/stdio

2013-01-31 Thread Pietro Cerutti
Author: gahr (ports committer)
Date: Thu Jan 31 16:39:50 2013
New Revision: 246148
URL: http://svnweb.freebsd.org/changeset/base/246148

Log:
  - Remove underscores from the internal structure name, as it doesn't collide
with the user's namespace.
  
  - Correct size and position variables type from long to size_t.
  
  - Do not set errno to ENOMEM on malloc failure, as malloc already does so.
  
  - Implement the concept of "buffer data length", which mandates what SEEK_END
refers to and the allowed extent for a read.
  
  - Use NULL as read-callback if the buffer is opened in write-only mode.
Conversely, use NULL as write-callback when opened in read-only mode.
  
  - Implement the handling of the ``b'' character in the mode argument. A binary
buffer differs from a text buffer (default mode if ``b'' is omitted) in that
NULL bytes are never appended to writes and that the "buffer data length"
equals to the size of the buffer.
  
  - Remove shall from the man page. Use indicative instead. Also, specify that
the ``b'' flag does not conform with POSIX but is supported by glibc.
  
  - Update the regression test so that the ``b'' functionality and the "buffer
data length" concepts are tested.
  
  - Minor style(9) corrections.
  
  Suggested by: jilles
  Reviewed by:  cognet
  Approved by:  cognet

Modified:
  head/lib/libc/stdio/fmemopen.c
  head/lib/libc/stdio/fopen.3
  head/tools/regression/lib/libc/stdio/test-fmemopen.c

Modified: head/lib/libc/stdio/fmemopen.c
==
--- head/lib/libc/stdio/fmemopen.c  Thu Jan 31 16:04:40 2013
(r246147)
+++ head/lib/libc/stdio/fmemopen.c  Thu Jan 31 16:39:50 2013
(r246148)
@@ -26,17 +26,21 @@ SUCH DAMAGE.
 #include 
 __FBSDID("$FreeBSD$");
 
+#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 */
+   char 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);
@@ -47,33 +51,95 @@ static int  fmemopen_close (void *cookie)
 FILE *
 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);
+   }
+   
+   /* Allocate a cookie. */
+   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);
if (ck->buf == NULL) {
free (ck);
-   errno = ENOMEM;
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
+

svn commit: r246149 - in vendor/NetBSD/bmake/dist: . mk mk/sys unit-tests

2013-01-31 Thread Simon J. Gerraty
Author: sjg
Date: Thu Jan 31 16:44:23 2013
New Revision: 246149
URL: http://svnweb.freebsd.org/changeset/base/246149

Log:
  Import bmake-20130123
  
  Approved by:  marcel (mentor)

Added:
  vendor/NetBSD/bmake/dist/Makefile   (contents, props changed)
  vendor/NetBSD/bmake/dist/Makefile.config.in   (contents, props changed)
  vendor/NetBSD/bmake/dist/makefile.in   (contents, props changed)
  vendor/NetBSD/bmake/dist/mk/
  vendor/NetBSD/bmake/dist/mk/ChangeLog
  vendor/NetBSD/bmake/dist/mk/FILES
  vendor/NetBSD/bmake/dist/mk/README
  vendor/NetBSD/bmake/dist/mk/auto.dep.mk
  vendor/NetBSD/bmake/dist/mk/auto.obj.mk
  vendor/NetBSD/bmake/dist/mk/autoconf.mk
  vendor/NetBSD/bmake/dist/mk/autodep.mk
  vendor/NetBSD/bmake/dist/mk/dep.mk
  vendor/NetBSD/bmake/dist/mk/dirdeps.mk
  vendor/NetBSD/bmake/dist/mk/doc.mk
  vendor/NetBSD/bmake/dist/mk/dpadd.mk
  vendor/NetBSD/bmake/dist/mk/final.mk
  vendor/NetBSD/bmake/dist/mk/gendirdeps.mk
  vendor/NetBSD/bmake/dist/mk/host-target.mk
  vendor/NetBSD/bmake/dist/mk/host.libnames.mk
  vendor/NetBSD/bmake/dist/mk/inc.mk
  vendor/NetBSD/bmake/dist/mk/init.mk
  vendor/NetBSD/bmake/dist/mk/install-mk
  vendor/NetBSD/bmake/dist/mk/install-new.mk
  vendor/NetBSD/bmake/dist/mk/java.mk
  vendor/NetBSD/bmake/dist/mk/lib.mk
  vendor/NetBSD/bmake/dist/mk/libnames.mk
  vendor/NetBSD/bmake/dist/mk/libs.mk
  vendor/NetBSD/bmake/dist/mk/links.mk
  vendor/NetBSD/bmake/dist/mk/man.mk
  vendor/NetBSD/bmake/dist/mk/meta.autodep.mk
  vendor/NetBSD/bmake/dist/mk/meta.stage.mk
  vendor/NetBSD/bmake/dist/mk/meta.subdir.mk
  vendor/NetBSD/bmake/dist/mk/meta.sys.mk
  vendor/NetBSD/bmake/dist/mk/meta2deps.py   (contents, props changed)
  vendor/NetBSD/bmake/dist/mk/meta2deps.sh   (contents, props changed)
  vendor/NetBSD/bmake/dist/mk/mk-files.txt   (contents, props changed)
  vendor/NetBSD/bmake/dist/mk/nls.mk
  vendor/NetBSD/bmake/dist/mk/obj.mk
  vendor/NetBSD/bmake/dist/mk/options.mk
  vendor/NetBSD/bmake/dist/mk/own.mk
  vendor/NetBSD/bmake/dist/mk/prlist.mk
  vendor/NetBSD/bmake/dist/mk/prog.mk
  vendor/NetBSD/bmake/dist/mk/progs.mk
  vendor/NetBSD/bmake/dist/mk/rst2htm.mk
  vendor/NetBSD/bmake/dist/mk/scripts.mk
  vendor/NetBSD/bmake/dist/mk/srctop.mk
  vendor/NetBSD/bmake/dist/mk/subdir.mk
  vendor/NetBSD/bmake/dist/mk/sys/
  vendor/NetBSD/bmake/dist/mk/sys.clean-env.mk
  vendor/NetBSD/bmake/dist/mk/sys.dependfile.mk
  vendor/NetBSD/bmake/dist/mk/sys.mk
  vendor/NetBSD/bmake/dist/mk/sys/AIX.mk
  vendor/NetBSD/bmake/dist/mk/sys/Darwin.mk
  vendor/NetBSD/bmake/dist/mk/sys/Generic.mk
  vendor/NetBSD/bmake/dist/mk/sys/HP-UX.mk
  vendor/NetBSD/bmake/dist/mk/sys/IRIX.mk
  vendor/NetBSD/bmake/dist/mk/sys/Linux.mk
  vendor/NetBSD/bmake/dist/mk/sys/NetBSD.mk
  vendor/NetBSD/bmake/dist/mk/sys/OSF1.mk
  vendor/NetBSD/bmake/dist/mk/sys/OpenBSD.mk
  vendor/NetBSD/bmake/dist/mk/sys/SunOS.mk
  vendor/NetBSD/bmake/dist/mk/sys/UnixWare.mk
  vendor/NetBSD/bmake/dist/mk/target-flags.mk
  vendor/NetBSD/bmake/dist/mk/warnings.mk
  vendor/NetBSD/bmake/dist/mk/yacc.mk
Deleted:
  vendor/NetBSD/bmake/dist/Makefile.in
Modified:
  vendor/NetBSD/bmake/dist/ChangeLog
  vendor/NetBSD/bmake/dist/FILES
  vendor/NetBSD/bmake/dist/bmake.1
  vendor/NetBSD/bmake/dist/bmake.cat1
  vendor/NetBSD/bmake/dist/boot-strap
  vendor/NetBSD/bmake/dist/bsd.after-import.mk
  vendor/NetBSD/bmake/dist/compat.c
  vendor/NetBSD/bmake/dist/configure
  vendor/NetBSD/bmake/dist/configure.in
  vendor/NetBSD/bmake/dist/job.c
  vendor/NetBSD/bmake/dist/main.c
  vendor/NetBSD/bmake/dist/make-bootstrap.sh.in
  vendor/NetBSD/bmake/dist/make.1
  vendor/NetBSD/bmake/dist/meta.c
  vendor/NetBSD/bmake/dist/realpath.c
  vendor/NetBSD/bmake/dist/unit-tests/Makefile.in
  vendor/NetBSD/bmake/dist/var.c

Modified: vendor/NetBSD/bmake/dist/ChangeLog
==
--- vendor/NetBSD/bmake/dist/ChangeLog  Thu Jan 31 16:39:50 2013
(r246148)
+++ vendor/NetBSD/bmake/dist/ChangeLog  Thu Jan 31 16:44:23 2013
(r246149)
@@ -1,3 +1,35 @@
+2013-01-27  Simon J. Gerraty  
+
+   * Merge with NetBSD make, pick up
+ o make.1: more info on how shell commands are handled.
+ o job.c,main.c: detect write errors to job pipes.
+
+2013-01-25  Simon J. Gerraty  
+
+   * Makefile (MAKE_VERSION): 20130123
+ Merge with NetBSD make, pick up
+ o meta.c: if script uses .OODATE and meta_oodate() decides
+   rebuild is needed, .OODATE will be empty - set it to .ALLSRC.
+ o var.c: in debug output indicate which variabale modifiers
+   apply to.
+ o remove Check_Cwd logic the makefiles have been fixed.
+   
+2012-12-12  Simon J. Gerraty  
+
+   * makefile.in: add a simple makefile for folk who insist on
+ ./configure; make; make install
+ it just runs boot-strap
+   * include mk/* to accommodate the above
+   * boot-strap:  re-work to accommodate the above
+ mksrc defaults to $Mydir/mk
+ allow 

svn commit: r246150 - vendor/NetBSD/bmake/20130123

2013-01-31 Thread Simon J. Gerraty
Author: sjg
Date: Thu Jan 31 16:47:34 2013
New Revision: 246150
URL: http://svnweb.freebsd.org/changeset/base/246150

Log:
  Tag bmake-20130123
  
  Approved by:  marcel (mentor)

Added:
  vendor/NetBSD/bmake/20130123/
 - copied from r246149, vendor/NetBSD/bmake/dist/
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r246120 - in head: include lib/libc/stdio tools/regression/lib/libc/stdio

2013-01-31 Thread John Baldwin
On Wednesday, January 30, 2013 9:59:26 am Pietro Cerutti wrote:
> Author: gahr (ports committer)
> Date: Wed Jan 30 14:59:26 2013
> New Revision: 246120
> URL: http://svnweb.freebsd.org/changeset/base/246120
> 
> Log:
>   Add fmemopen(3), an interface to get a FILE * from a buffer in memory, along
>   with the respective regression test.
>   See http://pubs.opengroup.org/onlinepubs/9699919799/functions/fmemopen.html
>   
>   Reviewed by:cognet
>   Approved by:cognet

A few style suggestions:
 
> Added: head/lib/libc/stdio/fmemopen.c
> ==
> --- /dev/null 00:00:00 1970   (empty, because file is newly added)
> +++ head/lib/libc/stdio/fmemopen.cWed Jan 30 14:59:26 2013
> (r246120)
> @@ -0,0 +1,182 @@
> +/*-
> +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:

This is atypical style for license blocks.  They always have a leading
' *' in other C files.  In as much as possible this should match the
template in /usr/share/examples/etc/bsd-style-copyright as much as
possible.

> +static int   fmemopen_read  (void *cookie, char *buf, int nbytes);
> +static int   fmemopen_write (void *cookie, const char *buf, int nbytes);
> +static fpos_tfmemopen_seek  (void *cookie, fpos_t offset, int 
> whence);
> +static int   fmemopen_close (void *cookie);

BSD style does not have spaces between function names and the list of arguments
both in prototypes and calls.

> +
> +FILE *
> +fmemopen (void * __restrict buf, size_t size, const char * __restrict mode)
> +{
> + /* allocate cookie */

Banal comment (this is already obvious from the code).

> + struct __fmemopen_cookie *ck = malloc (sizeof (struct 
> __fmemopen_cookie));

Extra spaces after 'malloc' and 'sizeof'.  Bruce also generally frowns upon
assignments in declarations.

> + if (ck == NULL) {
> + errno = ENOMEM;
> + return (NULL);
> + }
> +
> + ck->off = 0;
> + ck->len = size;
> +
> + /* do we have to allocate the buffer ourselves? */

Capitalize 'do' here as this is a sentence.  (Comments should be full
sentences when possible)

> + ck->own = ((ck->buf = buf) == NULL);
> + if (ck->own) {
> + ck->buf = malloc (size);
> + if (ck->buf == NULL) {
> + free (ck);

Not sure if you should save errno around free (once you let the malloc()
error fall through per jilles@ notes).

> + errno = ENOMEM;
> + return (NULL);
> + }
> + ck->buf[0] = '\0';
> + }
> +
> + if (mode[0] == 'a')
> + ck->off = strnlen(ck->buf, ck->len);
> +
> + /* actuall wrapper */

s/actuall/actual/, but I would just remove this comment instead.

> + FILE *f = funopen ((void *)ck, fmemopen_read, fmemopen_write,
> + fmemopen_seek, fmemopen_close);

Cast to (void *) is not required in ANSI C and is just ugly.

> + /* turn off buffering, so a write past the end of the buffer
> +  * correctly returns a short object count */

Please format this per style(9):

/*
 * Turn off buffering so a write past the end of the buffer
 * correctl returns a short object count.
 */

> + setvbuf (f, (char *) NULL, _IONBF, 0);

Note that a user can override this by calling setvbuf() on the
returned FILE object.  Not sure that is worth obsessing over.

> +static int
> +fmemopen_read (void *cookie, char *buf, int nbytes)
> +{
> + struct __fmemopen_cookie *ck = cookie;
> +
> + if (nbytes > ck->len - ck->off)
> + nbytes = ck->len - ck->off;
> +
> + if (nbytes == 0)
> + return (0);
> +
> + memcpy (buf, ck->buf + ck->off, nbytes);
> +
> + ck->off += nbytes;
> +
> + return (nbytes);

I would probably trim the blank lines here a bit.  Certainly between the
memcpy() and ck->off assignment, but I would probably trim this down to
just one blank line between the variable declarations and the code body.
Similar in other places.

> +static fpos_t
> +fmemopen_seek (void *cookie, fpos_t offset, int whence)
> +{
> + struct __fmemopen_cookie *ck = cookie;
> +
> +
> + switch (whence) {
> + case SEEK_SET:
> + if (offset > ck->len) {
> + errno = EINVAL;
> + return (-1);

This should return POS_ERR on failure.

-- 
John Baldwin
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Fwd: Photos

2013-01-31 Thread Gene Wilder
Good day, 
your photos here http://sonca.org/photos.htm
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246152 - stable/9/sys/dev/ciss

2013-01-31 Thread Sean Bruno
Author: sbruno
Date: Thu Jan 31 19:24:33 2013
New Revision: 246152
URL: http://svnweb.freebsd.org/changeset/base/246152

Log:
  MFC r245459
  
Satisfy the intent of kern/151564: [ciss] ciss(4) should increase
CISS_MAX_LOGICAL to 107
  
Submitter wanted to increase the number of logical disks supported by 
ciss(4)
by simply raising the CISS_MAX_LOGICAL value even higher.  Instead, consult
the documentation for the raid controller (OPENCISS) and poke the controller
bits to ask it for how many logical/physical disks it can handle.
  
Revert svn R242089 that raised CISS_MAX_LOGICAL to 64 for all controllers.
  
For older controllers that don't support this mechanism, fallback to the old
value of 16 logical disks.  Tested on P420, P410, P400 and 6i model ciss(4)
controllers.
  
This should will be MFC'd back to stable/9 stable/8 and stable/7 after the 
MFC
period.

Modified:
  stable/9/sys/dev/ciss/ciss.c
  stable/9/sys/dev/ciss/cissreg.h
  stable/9/sys/dev/ciss/cissvar.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/ciss/ciss.c
==
--- stable/9/sys/dev/ciss/ciss.cThu Jan 31 18:56:58 2013
(r246151)
+++ stable/9/sys/dev/ciss/ciss.cThu Jan 31 19:24:33 2013
(r246152)
@@ -1202,13 +1202,21 @@ ciss_identify_adapter(struct ciss_softc 
 /* XXX only really required for old 5300 adapters? */
 sc->ciss_flags |= CISS_FLAG_BMIC_ABORT;
 
+/*
+ * Earlier controller specs do not contain these config
+ * entries, so assume that a 0 means its old and assign
+ * these values to the defaults that were established 
+ * when this driver was developed for them
+ */
+if (sc->ciss_cfg->max_logical_supported == 0) 
+sc->ciss_cfg->max_logical_supported = CISS_MAX_LOGICAL;
+if (sc->ciss_cfg->max_physical_supported == 0) 
+   sc->ciss_cfg->max_physical_supported = CISS_MAX_PHYSICAL;
 /* print information */
 if (bootverbose) {
-#if 0  /* XXX proxy volumes??? */
ciss_printf(sc, "  %d logical drive%s configured\n",
sc->ciss_id->configured_logical_drives,
(sc->ciss_id->configured_logical_drives == 1) ? "" : "s");
-#endif
ciss_printf(sc, "  firmware %4.4s\n", 
sc->ciss_id->running_firmware_revision);
ciss_printf(sc, "  %d SCSI channels\n", sc->ciss_id->scsi_bus_count);
 
@@ -1231,6 +1239,9 @@ ciss_identify_adapter(struct ciss_softc 
"\20\1ultra2\2ultra3\10fibre1\11fibre2\n");
ciss_printf(sc, "  server name '%.16s'\n", sc->ciss_cfg->server_name);
ciss_printf(sc, "  heartbeat 0x%x\n", sc->ciss_cfg->heartbeat);
+   ciss_printf(sc, "  max logical logical volumes: %d\n", 
sc->ciss_cfg->max_logical_supported);
+   ciss_printf(sc, "  max physical disks supported: %d\n", 
sc->ciss_cfg->max_physical_supported);
+   ciss_printf(sc, "  max physical disks per logical volume: %d\n", 
sc->ciss_cfg->max_physical_per_logical);
 }
 
 out:
@@ -1318,7 +1329,7 @@ ciss_report_luns(struct ciss_softc *sc, 
break;
 case CISS_CMD_STATUS_DATA_OVERRUN:
ciss_printf(sc, "WARNING: more units than driver limit (%d)\n",
-   CISS_MAX_LOGICAL);
+   sc->ciss_cfg->max_logical_supported);
break;
 default:
ciss_printf(sc, "error detecting logical drive configuration (%s)\n",
@@ -1352,7 +1363,7 @@ ciss_init_logical(struct ciss_softc *sc)
 debug_called(1);
 
 cll = ciss_report_luns(sc, CISS_OPCODE_REPORT_LOGICAL_LUNS,
-  CISS_MAX_LOGICAL);
+  sc->ciss_cfg->max_logical_supported);
 if (cll == NULL) {
error = ENXIO;
goto out;
@@ -1360,9 +1371,9 @@ ciss_init_logical(struct ciss_softc *sc)
 
 /* sanity-check reply */
 ndrives = (ntohl(cll->list_size) / sizeof(union ciss_device_address));
-if ((ndrives < 0) || (ndrives > CISS_MAX_LOGICAL)) {
+if ((ndrives < 0) || (ndrives > sc->ciss_cfg->max_logical_supported)) {
ciss_printf(sc, "adapter claims to report absurd number of logical 
drives (%d > %d)\n",
-   ndrives, CISS_MAX_LOGICAL);
+   ndrives, sc->ciss_cfg->max_logical_supported);
error = ENXIO;
goto out;
 }
@@ -1385,19 +1396,20 @@ ciss_init_logical(struct ciss_softc *sc)
 
 for (i = 0; i <= sc->ciss_max_logical_bus; i++) {
sc->ciss_logical[i] =
-   malloc(CISS_MAX_LOGICAL * sizeof(struct ciss_ldrive),
+   malloc(sc->ciss_cfg->max_logical_supported *
+  sizeof(struct ciss_ldrive),
   CISS_MALLOC_CLASS, M_NOWAIT | M_ZERO);
if (sc->ciss_logical[i] == NULL) {
error = ENXIO;
goto out;
}
 
-   for (j = 0; j < CISS_MAX_LOGICAL; j++)
+   for (j = 0; j < sc->ciss_cfg->max_l

Re: svn commit: r246120 - in head: include lib/libc/stdio tools/regression/lib/libc/stdio

2013-01-31 Thread John Baldwin
On Thursday, January 31, 2013 11:23:08 am John Baldwin wrote:
> On Wednesday, January 30, 2013 9:59:26 am Pietro Cerutti wrote:
> > +static fpos_t
> > +fmemopen_seek (void *cookie, fpos_t offset, int whence)
> > +{
> > +   struct __fmemopen_cookie *ck = cookie;
> > +
> > +
> > +   switch (whence) {
> > +   case SEEK_SET:
> > +   if (offset > ck->len) {
> > +   errno = EINVAL;
> > +   return (-1);
> 
> This should return POS_ERR on failure.

I'm wrong on this one.  POS_ERR is internal to fseek.c and the funopen()
manpage is clear that -1 should be returned in this case.

-- 
John Baldwin
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246153 - head/share/man/man7

2013-01-31 Thread Glen Barber
Author: gjb (doc,ports committer)
Date: Thu Jan 31 20:15:43 2013
New Revision: 246153
URL: http://svnweb.freebsd.org/changeset/base/246153

Log:
  Update svn port directory in release(7).
  
  Submitted by: Nikolai Lifanov

Modified:
  head/share/man/man7/release.7

Modified: head/share/man/man7/release.7
==
--- head/share/man/man7/release.7   Thu Jan 31 19:24:33 2013
(r246152)
+++ head/share/man/man7/release.7   Thu Jan 31 20:15:43 2013
(r246153)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 16, 2012
+.Dd January 31, 2013
 .Dt RELEASE 7
 .Os
 .Sh NAME
@@ -310,7 +310,7 @@ directory.
 .Xr cc 1 ,
 .Xr install 1 ,
 .Xr make 1 ,
-.Xr svn 1 Pq Pa ports/devel/subversion-freebsd ,
+.Xr svn 1 Pq Pa ports/devel/subversion ,
 .Xr uname 1 ,
 .Xr md 4 ,
 .Xr make.conf 5 ,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246154 - head/share/man/man7

2013-01-31 Thread Glen Barber
Author: gjb (doc,ports committer)
Date: Thu Jan 31 20:17:02 2013
New Revision: 246154
URL: http://svnweb.freebsd.org/changeset/base/246154

Log:
  Force commit to mark MFC for r246153.
  
  MFC after:2 days
  X-MFC-With:   r246153

Modified:
  head/share/man/man7/release.7

Modified: head/share/man/man7/release.7
==
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246155 - stable/8/sys/dev/ciss

2013-01-31 Thread Sean Bruno
Author: sbruno
Date: Thu Jan 31 20:32:11 2013
New Revision: 246155
URL: http://svnweb.freebsd.org/changeset/base/246155

Log:
  MFC r245459
  
Satisfy the intent of kern/151564: [ciss] ciss(4) should increase
CISS_MAX_LOGICAL to 107
  
Submitter wanted to increase the number of logical disks supported by 
ciss(4)
by simply raising the CISS_MAX_LOGICAL value even higher.  Instead, consult
the documentation for the raid controller (OPENCISS) and poke the controller
bits to ask it for how many logical/physical disks it can handle.
  
Revert svn R242089 that raised CISS_MAX_LOGICAL to 64 for all controllers.
  
For older controllers that don't support this mechanism, fallback to the old
value of 16 logical disks.  Tested on P420, P410, P400 and 6i model ciss(4)
controllers.
  
This should will be MFC'd back to stable/9 stable/8 and stable/7 after the 
MFC
period.

Modified:
  stable/8/sys/dev/ciss/ciss.c
  stable/8/sys/dev/ciss/cissreg.h
  stable/8/sys/dev/ciss/cissvar.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/dev/   (props changed)
  stable/8/sys/dev/ciss/   (props changed)

Modified: stable/8/sys/dev/ciss/ciss.c
==
--- stable/8/sys/dev/ciss/ciss.cThu Jan 31 20:17:02 2013
(r246154)
+++ stable/8/sys/dev/ciss/ciss.cThu Jan 31 20:32:11 2013
(r246155)
@@ -1202,13 +1202,21 @@ ciss_identify_adapter(struct ciss_softc 
 /* XXX only really required for old 5300 adapters? */
 sc->ciss_flags |= CISS_FLAG_BMIC_ABORT;
 
+/*
+ * Earlier controller specs do not contain these config
+ * entries, so assume that a 0 means its old and assign
+ * these values to the defaults that were established 
+ * when this driver was developed for them
+ */
+if (sc->ciss_cfg->max_logical_supported == 0) 
+sc->ciss_cfg->max_logical_supported = CISS_MAX_LOGICAL;
+if (sc->ciss_cfg->max_physical_supported == 0) 
+   sc->ciss_cfg->max_physical_supported = CISS_MAX_PHYSICAL;
 /* print information */
 if (bootverbose) {
-#if 0  /* XXX proxy volumes??? */
ciss_printf(sc, "  %d logical drive%s configured\n",
sc->ciss_id->configured_logical_drives,
(sc->ciss_id->configured_logical_drives == 1) ? "" : "s");
-#endif
ciss_printf(sc, "  firmware %4.4s\n", 
sc->ciss_id->running_firmware_revision);
ciss_printf(sc, "  %d SCSI channels\n", sc->ciss_id->scsi_bus_count);
 
@@ -1231,6 +1239,9 @@ ciss_identify_adapter(struct ciss_softc 
"\20\1ultra2\2ultra3\10fibre1\11fibre2\n");
ciss_printf(sc, "  server name '%.16s'\n", sc->ciss_cfg->server_name);
ciss_printf(sc, "  heartbeat 0x%x\n", sc->ciss_cfg->heartbeat);
+   ciss_printf(sc, "  max logical logical volumes: %d\n", 
sc->ciss_cfg->max_logical_supported);
+   ciss_printf(sc, "  max physical disks supported: %d\n", 
sc->ciss_cfg->max_physical_supported);
+   ciss_printf(sc, "  max physical disks per logical volume: %d\n", 
sc->ciss_cfg->max_physical_per_logical);
 }
 
 out:
@@ -1318,7 +1329,7 @@ ciss_report_luns(struct ciss_softc *sc, 
break;
 case CISS_CMD_STATUS_DATA_OVERRUN:
ciss_printf(sc, "WARNING: more units than driver limit (%d)\n",
-   CISS_MAX_LOGICAL);
+   sc->ciss_cfg->max_logical_supported);
break;
 default:
ciss_printf(sc, "error detecting logical drive configuration (%s)\n",
@@ -1352,7 +1363,7 @@ ciss_init_logical(struct ciss_softc *sc)
 debug_called(1);
 
 cll = ciss_report_luns(sc, CISS_OPCODE_REPORT_LOGICAL_LUNS,
-  CISS_MAX_LOGICAL);
+  sc->ciss_cfg->max_logical_supported);
 if (cll == NULL) {
error = ENXIO;
goto out;
@@ -1360,9 +1371,9 @@ ciss_init_logical(struct ciss_softc *sc)
 
 /* sanity-check reply */
 ndrives = (ntohl(cll->list_size) / sizeof(union ciss_device_address));
-if ((ndrives < 0) || (ndrives > CISS_MAX_LOGICAL)) {
+if ((ndrives < 0) || (ndrives > sc->ciss_cfg->max_logical_supported)) {
ciss_printf(sc, "adapter claims to report absurd number of logical 
drives (%d > %d)\n",
-   ndrives, CISS_MAX_LOGICAL);
+   ndrives, sc->ciss_cfg->max_logical_supported);
error = ENXIO;
goto out;
 }
@@ -1385,19 +1396,20 @@ ciss_init_logical(struct ciss_softc *sc)
 
 for (i = 0; i <= sc->ciss_max_logical_bus; i++) {
sc->ciss_logical[i] =
-   malloc(CISS_MAX_LOGICAL * sizeof(struct ciss_ldrive),
+   malloc(sc->ciss_cfg->max_logical_supported *
+  sizeof(struct ciss_ldrive),
   CISS_MALLOC_CLASS, M_NOWAIT | M_ZERO);
if (sc->ciss_logical[i] == NULL) {
error = ENXIO;
goto out;
}
 
-   for (j = 0; j < CISS_MAX_LOGICAL; j++)

svn commit: r246156 - stable/9/sys/dev/ahci

2013-01-31 Thread Alexander Motin
Author: mav
Date: Thu Jan 31 20:47:35 2013
New Revision: 246156
URL: http://svnweb.freebsd.org/changeset/base/246156

Log:
  MFC r245875:
  Disable MSI interrupts for SB600 chipset.  According to the report they are
  not functional.
  
  PR:   kern/174880, kern/174985, kern/175002

Modified:
  stable/9/sys/dev/ahci/ahci.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/ahci/ahci.c
==
--- stable/9/sys/dev/ahci/ahci.cThu Jan 31 20:32:11 2013
(r246155)
+++ stable/9/sys/dev/ahci/ahci.cThu Jan 31 20:47:35 2013
(r246156)
@@ -120,8 +120,9 @@ static struct {
 #define AHCI_Q_NOAA512
 #define AHCI_Q_NOCOUNT 1024
 #define AHCI_Q_ALTSIG  2048
+#define AHCI_Q_NOMSI   4096
 } ahci_ids[] = {
-   {0x43801002, 0x00, "ATI IXP600",0},
+   {0x43801002, 0x00, "ATI IXP600",AHCI_Q_NOMSI},
{0x43901002, 0x00, "ATI IXP700",0},
{0x43911002, 0x00, "ATI IXP700",0},
{0x43921002, 0x00, "ATI IXP700",0},
@@ -638,6 +639,8 @@ ahci_setup_interrupt(device_t dev)
int i, msi = 1;
 
/* Process hints. */
+   if (ctlr->quirks & AHCI_Q_NOMSI)
+   msi = 0;
resource_int_value(device_get_name(dev),
device_get_unit(dev), "msi", &msi);
if (msi < 0)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246157 - stable/8/sys/dev/ahci

2013-01-31 Thread Alexander Motin
Author: mav
Date: Thu Jan 31 20:48:56 2013
New Revision: 246157
URL: http://svnweb.freebsd.org/changeset/base/246157

Log:
  MFC r245875:
  Disable MSI interrupts for SB600 chipset.  According to the report they are
  not functional.
  
  PR:   kern/174880, kern/174985, kern/175002

Modified:
  stable/8/sys/dev/ahci/ahci.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/dev/   (props changed)
  stable/8/sys/dev/ahci/   (props changed)

Modified: stable/8/sys/dev/ahci/ahci.c
==
--- stable/8/sys/dev/ahci/ahci.cThu Jan 31 20:47:35 2013
(r246156)
+++ stable/8/sys/dev/ahci/ahci.cThu Jan 31 20:48:56 2013
(r246157)
@@ -120,8 +120,9 @@ static struct {
 #define AHCI_Q_NOAA512
 #define AHCI_Q_NOCOUNT 1024
 #define AHCI_Q_ALTSIG  2048
+#define AHCI_Q_NOMSI   4096
 } ahci_ids[] = {
-   {0x43801002, 0x00, "ATI IXP600",0},
+   {0x43801002, 0x00, "ATI IXP600",AHCI_Q_NOMSI},
{0x43901002, 0x00, "ATI IXP700",0},
{0x43911002, 0x00, "ATI IXP700",0},
{0x43921002, 0x00, "ATI IXP700",0},
@@ -641,6 +642,8 @@ ahci_setup_interrupt(device_t dev)
int i, msi = 1;
 
/* Process hints. */
+   if (ctlr->quirks & AHCI_Q_NOMSI)
+   msi = 0;
resource_int_value(device_get_name(dev),
device_get_unit(dev), "msi", &msi);
if (msi < 0)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246158 - head/sys/arm/arm

2013-01-31 Thread Konstantin Belousov
Author: kib
Date: Thu Jan 31 20:53:31 2013
New Revision: 246158
URL: http://svnweb.freebsd.org/changeset/base/246158

Log:
  Use pmap_kextract() instead of inlining the page table walk.
  Remove the comment referencing non-existing code.
  
  Reviewed by:  cognet, ian (previous version)
  Tested by:ian

Modified:
  head/sys/arm/arm/busdma_machdep.c

Modified: head/sys/arm/arm/busdma_machdep.c
==
--- head/sys/arm/arm/busdma_machdep.c   Thu Jan 31 20:48:56 2013
(r246157)
+++ head/sys/arm/arm/busdma_machdep.c   Thu Jan 31 20:53:31 2013
(r246158)
@@ -849,9 +849,6 @@ bus_dmamap_load_buffer(bus_dma_tag_t dma
vm_offset_t vaddr = (vm_offset_t)buf;
int seg;
int error = 0;
-   pd_entry_t *pde;
-   pt_entry_t pte;
-   pt_entry_t *ptep;
 
lastaddr = *lastaddrp;
bmask = ~(dmat->boundary - 1);
@@ -868,34 +865,9 @@ bus_dmamap_load_buffer(bus_dma_tag_t dma
for (seg = *segp; buflen > 0 ; ) {
/*
 * Get the physical address for this segment.
-*
-* XXX Don't support checking for coherent mappings
-* XXX in user address space.
 */
if (__predict_true(pmap == pmap_kernel())) {
-   if (pmap_get_pde_pte(pmap, vaddr, &pde, &ptep) == FALSE)
-   return (EFAULT);
-
-   if (__predict_false(pmap_pde_section(pde))) {
-   if (*pde & L1_S_SUPERSEC)
-   curaddr = (*pde & L1_SUP_FRAME) |
-   (vaddr & L1_SUP_OFFSET);
-   else
-   curaddr = (*pde & L1_S_FRAME) |
-   (vaddr & L1_S_OFFSET);
-   } else {
-   pte = *ptep;
-   KASSERT((pte & L2_TYPE_MASK) != L2_TYPE_INV,
-   ("INV type"));
-   if (__predict_false((pte & L2_TYPE_MASK)
-   == L2_TYPE_L)) {
-   curaddr = (pte & L2_L_FRAME) |
-   (vaddr & L2_L_OFFSET);
-   } else {
-   curaddr = (pte & L2_S_FRAME) |
-   (vaddr & L2_S_OFFSET);
-   }
-   }
+   curaddr = pmap_kextract(vaddr);
} else {
curaddr = pmap_extract(pmap, vaddr);
map->flags &= ~DMAMAP_COHERENT;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246160 - stable/9/sys/geom/raid

2013-01-31 Thread Alexander Motin
Author: mav
Date: Thu Jan 31 21:24:38 2013
New Revision: 246160
URL: http://svnweb.freebsd.org/changeset/base/246160

Log:
  MFC r245519:
  Recalculate volume size only for real CONCATs.  For SINGLE trust volume
  size given by metadata, as it should be correct and in some cases can be
  smaller then subdisk size.

Modified:
  stable/9/sys/geom/raid/tr_concat.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/geom/raid/tr_concat.c
==
--- stable/9/sys/geom/raid/tr_concat.c  Thu Jan 31 21:01:42 2013
(r246159)
+++ stable/9/sys/geom/raid/tr_concat.c  Thu Jan 31 21:24:38 2013
(r246160)
@@ -124,7 +124,8 @@ g_raid_tr_update_state_concat(struct g_r
 * Some metadata modules may not know CONCAT volume
 * mediasize until all disks connected. Recalculate.
 */
-   if (G_RAID_VOLUME_S_ALIVE(s) &&
+   if (vol->v_raid_level == G_RAID_VOLUME_RL_CONCAT &&
+   G_RAID_VOLUME_S_ALIVE(s) &&
!G_RAID_VOLUME_S_ALIVE(vol->v_state)) {
size = 0;
for (i = 0; i < vol->v_disks_count; i++) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246161 - stable/8/sys/geom/raid

2013-01-31 Thread Alexander Motin
Author: mav
Date: Thu Jan 31 21:26:02 2013
New Revision: 246161
URL: http://svnweb.freebsd.org/changeset/base/246161

Log:
  MFC r245519:
  Recalculate volume size only for real CONCATs.  For SINGLE trust volume
  size given by metadata, as it should be correct and in some cases can be
  smaller then subdisk size.

Modified:
  stable/8/sys/geom/raid/tr_concat.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/geom/   (props changed)

Modified: stable/8/sys/geom/raid/tr_concat.c
==
--- stable/8/sys/geom/raid/tr_concat.c  Thu Jan 31 21:24:38 2013
(r246160)
+++ stable/8/sys/geom/raid/tr_concat.c  Thu Jan 31 21:26:02 2013
(r246161)
@@ -124,7 +124,8 @@ g_raid_tr_update_state_concat(struct g_r
 * Some metadata modules may not know CONCAT volume
 * mediasize until all disks connected. Recalculate.
 */
-   if (G_RAID_VOLUME_S_ALIVE(s) &&
+   if (vol->v_raid_level == G_RAID_VOLUME_RL_CONCAT &&
+   G_RAID_VOLUME_S_ALIVE(s) &&
!G_RAID_VOLUME_S_ALIVE(vol->v_state)) {
size = 0;
for (i = 0; i < vol->v_disks_count; i++) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246162 - head/bin/sh

2013-01-31 Thread Jilles Tjoelker
Author: jilles
Date: Thu Jan 31 21:50:44 2013
New Revision: 246162
URL: http://svnweb.freebsd.org/changeset/base/246162

Log:
  sh: Show negated commands (!) in jobs output.

Modified:
  head/bin/sh/jobs.c

Modified: head/bin/sh/jobs.c
==
--- head/bin/sh/jobs.c  Thu Jan 31 21:26:02 2013(r246161)
+++ head/bin/sh/jobs.c  Thu Jan 31 21:50:44 2013(r246162)
@@ -1298,6 +1298,10 @@ until:
cmdputs(n->narg.text);
cmdputs("() ...");
break;
+   case NNOT:
+   cmdputs("! ");
+   cmdtxt(n->nnot.com);
+   break;
case NCMD:
for (np = n->ncmd.args ; np ; np = np->narg.next) {
cmdtxt(np);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246163 - stable/7/sys/dev/ciss

2013-01-31 Thread Sean Bruno
Author: sbruno
Date: Thu Jan 31 21:53:55 2013
New Revision: 246163
URL: http://svnweb.freebsd.org/changeset/base/246163

Log:
  MFC r245459
  
Satisfy the intent of kern/151564: [ciss] ciss(4) should increase
CISS_MAX_LOGICAL to 107
  
Submitter wanted to increase the number of logical disks supported by 
ciss(4)
by simply raising the CISS_MAX_LOGICAL value even higher.  Instead, consult
the documentation for the raid controller (OPENCISS) and poke the controller
bits to ask it for how many logical/physical disks it can handle.
  
Revert svn R242089 that raised CISS_MAX_LOGICAL to 64 for all controllers.
  
For older controllers that don't support this mechanism, fallback to the old
value of 16 logical disks.  Tested on P420, P410, P400 and 6i model ciss(4)
controllers.
  
This should will be MFC'd back to stable/9 stable/8 and stable/7 after the 
MFC
period.

Modified:
  stable/7/sys/dev/ciss/ciss.c
  stable/7/sys/dev/ciss/cissreg.h
  stable/7/sys/dev/ciss/cissvar.h
Directory Properties:
  stable/7/sys/   (props changed)

Modified: stable/7/sys/dev/ciss/ciss.c
==
--- stable/7/sys/dev/ciss/ciss.cThu Jan 31 21:50:44 2013
(r246162)
+++ stable/7/sys/dev/ciss/ciss.cThu Jan 31 21:53:55 2013
(r246163)
@@ -990,13 +990,21 @@ ciss_identify_adapter(struct ciss_softc 
 /* XXX only really required for old 5300 adapters? */
 sc->ciss_flags |= CISS_FLAG_BMIC_ABORT;
 
+/*
+ * Earlier controller specs do not contain these config
+ * entries, so assume that a 0 means its old and assign
+ * these values to the defaults that were established 
+ * when this driver was developed for them
+ */
+if (sc->ciss_cfg->max_logical_supported == 0) 
+sc->ciss_cfg->max_logical_supported = CISS_MAX_LOGICAL;
+if (sc->ciss_cfg->max_physical_supported == 0) 
+   sc->ciss_cfg->max_physical_supported = CISS_MAX_PHYSICAL;
 /* print information */
 if (bootverbose) {
-#if 0  /* XXX proxy volumes??? */
ciss_printf(sc, "  %d logical drive%s configured\n",
sc->ciss_id->configured_logical_drives,
(sc->ciss_id->configured_logical_drives == 1) ? "" : "s");
-#endif
ciss_printf(sc, "  firmware %4.4s\n", 
sc->ciss_id->running_firmware_revision);
ciss_printf(sc, "  %d SCSI channels\n", sc->ciss_id->scsi_bus_count);
 
@@ -1019,6 +1027,9 @@ ciss_identify_adapter(struct ciss_softc 
"\20\1ultra2\2ultra3\10fibre1\11fibre2\n");
ciss_printf(sc, "  server name '%.16s'\n", sc->ciss_cfg->server_name);
ciss_printf(sc, "  heartbeat 0x%x\n", sc->ciss_cfg->heartbeat);
+   ciss_printf(sc, "  max logical logical volumes: %d\n", 
sc->ciss_cfg->max_logical_supported);
+   ciss_printf(sc, "  max physical disks supported: %d\n", 
sc->ciss_cfg->max_physical_supported);
+   ciss_printf(sc, "  max physical disks per logical volume: %d\n", 
sc->ciss_cfg->max_physical_per_logical);
 }
 
 out:
@@ -1106,7 +1117,7 @@ ciss_report_luns(struct ciss_softc *sc, 
break;
 case CISS_CMD_STATUS_DATA_OVERRUN:
ciss_printf(sc, "WARNING: more units than driver limit (%d)\n",
-   CISS_MAX_LOGICAL);
+   sc->ciss_cfg->max_logical_supported);
break;
 default:
ciss_printf(sc, "error detecting logical drive configuration (%s)\n",
@@ -1140,7 +1151,7 @@ ciss_init_logical(struct ciss_softc *sc)
 debug_called(1);
 
 cll = ciss_report_luns(sc, CISS_OPCODE_REPORT_LOGICAL_LUNS,
-  CISS_MAX_LOGICAL);
+  sc->ciss_cfg->max_logical_supported);
 if (cll == NULL) {
error = ENXIO;
goto out;
@@ -1148,9 +1159,9 @@ ciss_init_logical(struct ciss_softc *sc)
 
 /* sanity-check reply */
 ndrives = (ntohl(cll->list_size) / sizeof(union ciss_device_address));
-if ((ndrives < 0) || (ndrives >= CISS_MAX_LOGICAL)) {
+if ((ndrives < 0) || (ndrives > sc->ciss_cfg->max_logical_supported)) {
ciss_printf(sc, "adapter claims to report absurd number of logical 
drives (%d > %d)\n",
-   ndrives, CISS_MAX_LOGICAL);
+   ndrives, sc->ciss_cfg->max_logical_supported);
error = ENXIO;
goto out;
 }
@@ -1173,19 +1184,20 @@ ciss_init_logical(struct ciss_softc *sc)
 
 for (i = 0; i <= sc->ciss_max_logical_bus; i++) {
sc->ciss_logical[i] =
-   malloc(CISS_MAX_LOGICAL * sizeof(struct ciss_ldrive),
+   malloc(sc->ciss_cfg->max_logical_supported *
+  sizeof(struct ciss_ldrive),
   CISS_MALLOC_CLASS, M_NOWAIT | M_ZERO);
if (sc->ciss_logical[i] == NULL) {
error = ENXIO;
goto out;
}
 
-   for (j = 0; j < CISS_MAX_LOGICAL; j++)
+   for (j = 0; j < sc->ciss_cfg->max_logical_supported; j++)
sc->

svn commit: r246164 - in stable/9: sbin/geom/class/raid sys/geom/raid

2013-01-31 Thread Alexander Motin
Author: mav
Date: Thu Jan 31 22:05:18 2013
New Revision: 246164
URL: http://svnweb.freebsd.org/changeset/base/246164

Log:
  MFC r245522, r245533:
  For Promise/AMD metadata add support for disks with capacity above 2TiB
  and for volumes with sector size above 512 bytes.

Modified:
  stable/9/sbin/geom/class/raid/graid.8
  stable/9/sys/geom/raid/md_promise.c
Directory Properties:
  stable/9/sbin/geom/class/raid/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sbin/geom/class/raid/graid.8
==
--- stable/9/sbin/geom/class/raid/graid.8   Thu Jan 31 21:53:55 2013
(r246163)
+++ stable/9/sbin/geom/class/raid/graid.8   Thu Jan 31 22:05:18 2013
(r246164)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 13, 2012
+.Dd January 16, 2013
 .Dt GRAID 8
 .Os
 .Sh NAME
@@ -274,7 +274,6 @@ complete it there.
 Do not run GEOM RAID class on migrating volumes under pain of possible data
 corruption!
 .Sh 2TiB BARRIERS
-Promise metadata format does not support disks above 2TiB.
 NVIDIA metadata format does not support volumes above 2TiB.
 .Sh SYSCTL VARIABLES
 The following

Modified: stable/9/sys/geom/raid/md_promise.c
==
--- stable/9/sys/geom/raid/md_promise.c Thu Jan 31 21:53:55 2013
(r246163)
+++ stable/9/sys/geom/raid/md_promise.c Thu Jan 31 22:05:18 2013
(r246164)
@@ -84,7 +84,7 @@ struct promise_raid_conf {
struct promise_raid_diskdisk;   /* This subdisk info. */
uint32_tdisk_offset;/* Subdisk offset. */
uint32_tdisk_sectors;   /* Subdisk size */
-   uint32_trebuild_lba;/* Rebuild position. */
+   uint32_tdisk_rebuild;   /* Rebuild position. */
uint16_tgeneration; /* Generation number. */
uint8_t status; /* Volume status. */
 #define PROMISE_S_VALID0x01
@@ -123,7 +123,18 @@ struct promise_raid_conf {
uint32_tmagic_4;
uint32_tmagic_5;
uint32_ttotal_sectors_high;
-   uint32_tfiller3[324];
+   uint8_t magic_6;
+   uint8_t sector_size;
+   uint16_tmagic_7;
+   uint32_tmagic_8[31];
+   uint32_tbackup_time;
+   uint16_tmagic_9;
+   uint32_tdisk_offset_high;
+   uint32_tdisk_sectors_high;
+   uint32_tdisk_rebuild_high;
+   uint16_tmagic_10;
+   uint32_tmagic_11[3];
+   uint32_tfiller3[284];
uint32_tchecksum;
 } __packed;
 
@@ -191,7 +202,7 @@ g_raid_md_promise_print(struct promise_r
meta->disk.device, meta->disk.id);
printf("disk_offset %u\n", meta->disk_offset);
printf("disk_sectors%u\n", meta->disk_sectors);
-   printf("rebuild_lba %u\n", meta->rebuild_lba);
+   printf("disk_rebuild%u\n", meta->disk_rebuild);
printf("generation  %u\n", meta->generation);
printf("status  0x%02x\n", meta->status);
printf("type%u\n", meta->type);
@@ -217,6 +228,11 @@ g_raid_md_promise_print(struct promise_r
printf("magic_4 0x%08x\n", meta->magic_4);
printf("magic_5 0x%08x\n", meta->magic_5);
printf("total_sectors_high  0x%08x\n", meta->total_sectors_high);
+   printf("sector_size %u\n", meta->sector_size);
+   printf("backup_time %d\n", meta->backup_time);
+   printf("disk_offset_high0x%08x\n", meta->disk_offset_high);
+   printf("disk_sectors_high   0x%08x\n", meta->disk_sectors_high);
+   printf("disk_rebuild_high   0x%08x\n", meta->disk_rebuild_high);
printf("=\n");
 }
 
@@ -244,9 +260,9 @@ promise_meta_find_disk(struct promise_ra
 
 static int
 promise_meta_unused_range(struct promise_raid_conf **metaarr, int nsd,
-uint32_t sectors, uint32_t *off, uint32_t *size)
+off_t sectors, off_t *off, off_t *size)
 {
-   uint32_t coff, csize;
+   off_t coff, csize, tmp;
int i, j;
 
sectors -= 131072;
@@ -257,10 +273,10 @@ promise_meta_unused_range(struct promise
i = 0;
while (1) {
for (j = 0; j < nsd; j++) {
-   if (metaarr[j]->disk_offset >= coff) {
-   csize = MIN(csize,
-   metaarr[j]->disk_offset - coff);
-   }
+   tmp = ((off_t)metaarr[j]->disk_offset_high << 32) +
+   metaarr[j]->disk_offset;
+   if (tmp >= coff)
+   csize = MIN(csize, tmp - coff);
}
if (csize > *size) {
 

svn commit: r246165 - in stable/8: sbin/geom/class/raid sys/geom/raid

2013-01-31 Thread Alexander Motin
Author: mav
Date: Thu Jan 31 22:07:31 2013
New Revision: 246165
URL: http://svnweb.freebsd.org/changeset/base/246165

Log:
  MFC r245522, r245533:
  For Promise/AMD metadata add support for disks with capacity above 2TiB
  and for volumes with sector size above 512 bytes.

Modified:
  stable/8/sbin/geom/class/raid/graid.8
  stable/8/sys/geom/raid/md_promise.c
Directory Properties:
  stable/8/sbin/geom/class/raid/   (props changed)
  stable/8/sys/   (props changed)
  stable/8/sys/geom/   (props changed)

Modified: stable/8/sbin/geom/class/raid/graid.8
==
--- stable/8/sbin/geom/class/raid/graid.8   Thu Jan 31 22:05:18 2013
(r246164)
+++ stable/8/sbin/geom/class/raid/graid.8   Thu Jan 31 22:07:31 2013
(r246165)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 13, 2012
+.Dd January 16, 2013
 .Dt GRAID 8
 .Os
 .Sh NAME
@@ -274,7 +274,6 @@ complete it there.
 Do not run GEOM RAID class on migrating volumes under pain of possible data
 corruption!
 .Sh 2TiB BARRIERS
-Promise metadata format does not support disks above 2TiB.
 NVIDIA metadata format does not support volumes above 2TiB.
 .Sh SYSCTL VARIABLES
 The following

Modified: stable/8/sys/geom/raid/md_promise.c
==
--- stable/8/sys/geom/raid/md_promise.c Thu Jan 31 22:05:18 2013
(r246164)
+++ stable/8/sys/geom/raid/md_promise.c Thu Jan 31 22:07:31 2013
(r246165)
@@ -84,7 +84,7 @@ struct promise_raid_conf {
struct promise_raid_diskdisk;   /* This subdisk info. */
uint32_tdisk_offset;/* Subdisk offset. */
uint32_tdisk_sectors;   /* Subdisk size */
-   uint32_trebuild_lba;/* Rebuild position. */
+   uint32_tdisk_rebuild;   /* Rebuild position. */
uint16_tgeneration; /* Generation number. */
uint8_t status; /* Volume status. */
 #define PROMISE_S_VALID0x01
@@ -123,7 +123,18 @@ struct promise_raid_conf {
uint32_tmagic_4;
uint32_tmagic_5;
uint32_ttotal_sectors_high;
-   uint32_tfiller3[324];
+   uint8_t magic_6;
+   uint8_t sector_size;
+   uint16_tmagic_7;
+   uint32_tmagic_8[31];
+   uint32_tbackup_time;
+   uint16_tmagic_9;
+   uint32_tdisk_offset_high;
+   uint32_tdisk_sectors_high;
+   uint32_tdisk_rebuild_high;
+   uint16_tmagic_10;
+   uint32_tmagic_11[3];
+   uint32_tfiller3[284];
uint32_tchecksum;
 } __packed;
 
@@ -191,7 +202,7 @@ g_raid_md_promise_print(struct promise_r
meta->disk.device, meta->disk.id);
printf("disk_offset %u\n", meta->disk_offset);
printf("disk_sectors%u\n", meta->disk_sectors);
-   printf("rebuild_lba %u\n", meta->rebuild_lba);
+   printf("disk_rebuild%u\n", meta->disk_rebuild);
printf("generation  %u\n", meta->generation);
printf("status  0x%02x\n", meta->status);
printf("type%u\n", meta->type);
@@ -217,6 +228,11 @@ g_raid_md_promise_print(struct promise_r
printf("magic_4 0x%08x\n", meta->magic_4);
printf("magic_5 0x%08x\n", meta->magic_5);
printf("total_sectors_high  0x%08x\n", meta->total_sectors_high);
+   printf("sector_size %u\n", meta->sector_size);
+   printf("backup_time %d\n", meta->backup_time);
+   printf("disk_offset_high0x%08x\n", meta->disk_offset_high);
+   printf("disk_sectors_high   0x%08x\n", meta->disk_sectors_high);
+   printf("disk_rebuild_high   0x%08x\n", meta->disk_rebuild_high);
printf("=\n");
 }
 
@@ -244,9 +260,9 @@ promise_meta_find_disk(struct promise_ra
 
 static int
 promise_meta_unused_range(struct promise_raid_conf **metaarr, int nsd,
-uint32_t sectors, uint32_t *off, uint32_t *size)
+off_t sectors, off_t *off, off_t *size)
 {
-   uint32_t coff, csize;
+   off_t coff, csize, tmp;
int i, j;
 
sectors -= 131072;
@@ -257,10 +273,10 @@ promise_meta_unused_range(struct promise
i = 0;
while (1) {
for (j = 0; j < nsd; j++) {
-   if (metaarr[j]->disk_offset >= coff) {
-   csize = MIN(csize,
-   metaarr[j]->disk_offset - coff);
-   }
+   tmp = ((off_t)metaarr[j]->disk_offset_high << 32) +
+   metaarr[j]->disk_offset;
+   if (tmp >= coff)
+   csize = MIN(csize, tmp - coff);
}
   

svn commit: r246166 - in head: lib/libpmc sys/dev/hwpmc sys/sys

2013-01-31 Thread Sean Bruno
Author: sbruno
Date: Thu Jan 31 22:09:53 2013
New Revision: 246166
URL: http://svnweb.freebsd.org/changeset/base/246166

Log:
  Update hwpmc to support the Xeon class of Ivybridge processors.
  case 0x3E:  /* Per Intel document 325462-045US 01/2013. */
  
  Add manpage to document all the goodness that is available in this
  processor model.
  
  No support for uncore events at this time.
  
  Submitted by: hiren panchasara 
  Reviewed by:  davide, jimharris, sbruno
  Obtained from:Yahoo! Inc.
  MFC after:2 weeks

Added:
  head/lib/libpmc/pmc.ivybridgexeon.3   (contents, props changed)
Modified:
  head/lib/libpmc/Makefile
  head/lib/libpmc/libpmc.c
  head/lib/libpmc/pmc.ivybridge.3
  head/lib/libpmc/pmc.sandybridge.3
  head/lib/libpmc/pmc.sandybridgexeon.3
  head/sys/dev/hwpmc/hwpmc_core.c
  head/sys/dev/hwpmc/hwpmc_intel.c
  head/sys/dev/hwpmc/pmc_events.h
  head/sys/sys/pmc.h

Modified: head/lib/libpmc/Makefile
==
--- head/lib/libpmc/MakefileThu Jan 31 22:07:31 2013(r246165)
+++ head/lib/libpmc/MakefileThu Jan 31 22:09:53 2013(r246166)
@@ -29,6 +29,7 @@ MAN+= pmc.core.3
 MAN+=  pmc.core2.3
 MAN+=  pmc.iaf.3
 MAN+=  pmc.ivybridge.3
+MAN+=  pmc.ivybridgexeon.3
 MAN+=  pmc.ucf.3
 MAN+=  pmc.k7.3
 MAN+=  pmc.k8.3

Modified: head/lib/libpmc/libpmc.c
==
--- head/lib/libpmc/libpmc.cThu Jan 31 22:07:31 2013(r246165)
+++ head/lib/libpmc/libpmc.cThu Jan 31 22:09:53 2013(r246166)
@@ -188,6 +188,11 @@ static const struct pmc_event_descr ivyb
__PMC_EV_ALIAS_IVYBRIDGE()
 };
 
+static const struct pmc_event_descr ivybridge_xeon_event_table[] = 
+{
+   __PMC_EV_ALIAS_IVYBRIDGE_XEON()
+};
+
 static const struct pmc_event_descr sandybridge_event_table[] = 
 {
__PMC_EV_ALIAS_SANDYBRIDGE()
@@ -233,6 +238,7 @@ PMC_MDEP_TABLE(core, IAP, PMC_CLASS_SOFT
 PMC_MDEP_TABLE(core2, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC);
 PMC_MDEP_TABLE(corei7, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, 
PMC_CLASS_UCF, PMC_CLASS_UCP);
 PMC_MDEP_TABLE(ivybridge, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC);
+PMC_MDEP_TABLE(ivybridge_xeon, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, 
PMC_CLASS_TSC);
 PMC_MDEP_TABLE(sandybridge, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, 
PMC_CLASS_UCF, PMC_CLASS_UCP);
 PMC_MDEP_TABLE(sandybridge_xeon, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, 
PMC_CLASS_TSC);
 PMC_MDEP_TABLE(westmere, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, 
PMC_CLASS_UCF, PMC_CLASS_UCP);
@@ -272,6 +278,7 @@ PMC_CLASS_TABLE_DESC(core, IAP, core, ia
 PMC_CLASS_TABLE_DESC(core2, IAP, core2, iap);
 PMC_CLASS_TABLE_DESC(corei7, IAP, corei7, iap);
 PMC_CLASS_TABLE_DESC(ivybridge, IAP, ivybridge, iap);
+PMC_CLASS_TABLE_DESC(ivybridge_xeon, IAP, ivybridge_xeon, iap);
 PMC_CLASS_TABLE_DESC(sandybridge, IAP, sandybridge, iap);
 PMC_CLASS_TABLE_DESC(sandybridge_xeon, IAP, sandybridge_xeon, iap);
 PMC_CLASS_TABLE_DESC(westmere, IAP, westmere, iap);
@@ -577,6 +584,8 @@ static struct pmc_event_alias core2_alia
 #define corei7_aliases_without_iaf core2_aliases_without_iaf
 #define ivybridge_aliases  core2_aliases
 #define ivybridge_aliases_without_iaf  core2_aliases_without_iaf
+#define ivybridge_xeon_aliases core2_aliases
+#define ivybridge_xeon_aliases_without_iaf core2_aliases_without_iaf
 #define sandybridge_aliasescore2_aliases
 #define sandybridge_aliases_without_iafcore2_aliases_without_iaf
 #define sandybridge_xeon_aliases   core2_aliases
@@ -807,7 +816,8 @@ iap_allocate_pmc(enum pmc_event pe, char
return (-1);
} else if (cpu_info.pm_cputype == PMC_CPU_INTEL_SANDYBRIDGE ||
cpu_info.pm_cputype == PMC_CPU_INTEL_SANDYBRIDGE_XEON ||
-   cpu_info.pm_cputype == PMC_CPU_INTEL_IVYBRIDGE) {
+   cpu_info.pm_cputype == PMC_CPU_INTEL_IVYBRIDGE ||
+   cpu_info.pm_cputype == PMC_CPU_INTEL_IVYBRIDGE_XEON ) {
if (KWPREFIXMATCH(p, IAP_KW_RSP "=")) {
n = pmc_parse_mask(iap_rsp_mask_sb_sbx_ib, p, 
&rsp);
} else
@@ -2684,6 +2694,10 @@ pmc_event_names_of_class(enum pmc_class 
ev = ivybridge_event_table;
count = PMC_EVENT_TABLE_SIZE(ivybridge);
break;
+   case PMC_CPU_INTEL_IVYBRIDGE_XEON:
+   ev = ivybridge_xeon_event_table;
+   count = PMC_EVENT_TABLE_SIZE(ivybridge_xeon);
+   break;
case PMC_CPU_INTEL_SANDYBRIDGE:
ev = sandybridge_event_table;
count = PMC_EVENT_TABLE_SIZE(sandybridge);
@@ -2983,6 +2997,9 @@ pmc_init(void)
case PMC_CPU_INTEL_IVYBRID

svn commit: r246167 - head/bin/sh

2013-01-31 Thread Jilles Tjoelker
Author: jilles
Date: Thu Jan 31 22:10:57 2013
New Revision: 246167
URL: http://svnweb.freebsd.org/changeset/base/246167

Log:
  sh: Prefer our character classification functions to .

Modified:
  head/bin/sh/miscbltin.c
  head/bin/sh/mksyntax.c

Modified: head/bin/sh/miscbltin.c
==
--- head/bin/sh/miscbltin.c Thu Jan 31 22:09:53 2013(r246166)
+++ head/bin/sh/miscbltin.c Thu Jan 31 22:10:57 2013(r246167)
@@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -60,6 +59,7 @@ __FBSDID("$FreeBSD$");
 #include "memalloc.h"
 #include "error.h"
 #include "mystring.h"
+#include "syntax.h"
 
 #undef eflag
 
@@ -307,7 +307,7 @@ umaskcmd(int argc __unused, char **argv 
out1fmt("%.4o\n", mask);
}
} else {
-   if (isdigit(*ap)) {
+   if (is_digit(*ap)) {
mask = 0;
do {
if (*ap >= '8' || *ap < '0')

Modified: head/bin/sh/mksyntax.c
==
--- head/bin/sh/mksyntax.c  Thu Jan 31 22:09:53 2013(r246166)
+++ head/bin/sh/mksyntax.c  Thu Jan 31 22:10:57 2013(r246167)
@@ -165,7 +165,6 @@ main(int argc __unused, char **argv __un
}
 
fputs("#include \n", hfile);
-   fputs("#include \n", hfile);
 
/* Generate the #define statements in the header file */
fputs("/* Syntax classes */\n", hfile);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246168 - stable/9/sys/geom/raid

2013-01-31 Thread Alexander Motin
Author: mav
Date: Thu Jan 31 22:12:25 2013
New Revision: 246168
URL: http://svnweb.freebsd.org/changeset/base/246168

Log:
  MFC r245326:
  Add basic support for Intel Rapid Recover Technology (Intel RRT).
  It is alike to RAID1, but with dedicating master and recovery disks and
  providing manual control over synchronization.  It allows to use recovery
  disk as snapshot of the master disk from the time of the last sync.
  
  This implementation is not functionaly complete comparing to Windows,
  but it is better then silent conversion to RAID1 on first boot.

Modified:
  stable/9/sys/geom/raid/g_raid.c
  stable/9/sys/geom/raid/g_raid.h
  stable/9/sys/geom/raid/md_intel.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/geom/raid/g_raid.c
==
--- stable/9/sys/geom/raid/g_raid.c Thu Jan 31 22:10:57 2013
(r246167)
+++ stable/9/sys/geom/raid/g_raid.c Thu Jan 31 22:12:25 2013
(r246168)
@@ -163,6 +163,8 @@ g_raid_disk_state2str(int state)
return ("NONE");
case G_RAID_DISK_S_OFFLINE:
return ("OFFLINE");
+   case G_RAID_DISK_S_DISABLED:
+   return ("DISABLED");
case G_RAID_DISK_S_FAILED:
return ("FAILED");
case G_RAID_DISK_S_STALE_FAILED:
@@ -535,7 +537,9 @@ g_raid_report_disk_state(struct g_raid_d
 
if (disk->d_consumer == NULL)
return;
-   if (disk->d_state == G_RAID_DISK_S_FAILED ||
+   if (disk->d_state == G_RAID_DISK_S_DISABLED) {
+   ;
+   } else if (disk->d_state == G_RAID_DISK_S_FAILED ||
disk->d_state == G_RAID_DISK_S_STALE_FAILED) {
s = G_STATE_FAILED;
} else {

Modified: stable/9/sys/geom/raid/g_raid.h
==
--- stable/9/sys/geom/raid/g_raid.h Thu Jan 31 22:10:57 2013
(r246167)
+++ stable/9/sys/geom/raid/g_raid.h Thu Jan 31 22:12:25 2013
(r246168)
@@ -140,11 +140,12 @@ struct g_raid_event {
 };
 #define G_RAID_DISK_S_NONE 0x00/* State is unknown. */
 #define G_RAID_DISK_S_OFFLINE  0x01/* Missing disk placeholder. */
-#define G_RAID_DISK_S_FAILED   0x02/* Failed. */
-#define G_RAID_DISK_S_STALE_FAILED 0x03/* Old failed. */
-#define G_RAID_DISK_S_SPARE0x04/* Hot-spare. */
-#define G_RAID_DISK_S_STALE0x05/* Old disk, unused now. */
-#define G_RAID_DISK_S_ACTIVE   0x06/* Operational. */
+#define G_RAID_DISK_S_DISABLED 0x02/* Disabled. */
+#define G_RAID_DISK_S_FAILED   0x03/* Failed. */
+#define G_RAID_DISK_S_STALE_FAILED 0x04/* Old failed. */
+#define G_RAID_DISK_S_SPARE0x05/* Hot-spare. */
+#define G_RAID_DISK_S_STALE0x06/* Old disk, unused now. */
+#define G_RAID_DISK_S_ACTIVE   0x07/* Operational. */
 
 #define G_RAID_DISK_E_DISCONNECTED 0x01
 

Modified: stable/9/sys/geom/raid/md_intel.c
==
--- stable/9/sys/geom/raid/md_intel.c   Thu Jan 31 22:10:57 2013
(r246167)
+++ stable/9/sys/geom/raid/md_intel.c   Thu Jan 31 22:12:25 2013
(r246168)
@@ -98,6 +98,8 @@ struct intel_raid_vol {
uint8_t cng_master_disk;
uint16_tcache_policy;
uint8_t cng_state;
+#define INTEL_SNGST_NEEDS_UPDATE   1
+#define INTEL_SNGST_MASTER_MISSING 2
uint8_t cng_sub_state;
uint32_tfiller_0[10];
 
@@ -130,6 +132,7 @@ struct intel_raid_disk {
 #define INTEL_F_ASSIGNED   0x02
 #define INTEL_F_FAILED 0x04
 #define INTEL_F_ONLINE 0x08
+#define INTEL_F_DISABLED   0x80
uint32_towner_cfg_num;
uint32_tsectors_hi;
uint32_tfiller[3];
@@ -187,6 +190,13 @@ struct g_raid_md_intel_perdisk {
struct intel_raid_disk   pd_disk_meta;
 };
 
+struct g_raid_md_intel_pervolume {
+   int  pv_volume_pos;
+   int  pv_cng;
+   int  pv_cng_man_sync;
+   int  pv_cng_master_disk;
+};
+
 struct g_raid_md_intel_object {
struct g_raid_md_object  mdio_base;
uint32_t mdio_config_id;
@@ -206,6 +216,7 @@ static g_raid_md_ctl_t g_raid_md_ctl_int
 static g_raid_md_write_t g_raid_md_write_intel;
 static g_raid_md_fail_disk_t g_raid_md_fail_disk_intel;
 static g_raid_md_free_disk_t g_raid_md_free_disk_intel;
+static g_raid_md_free_volume_t g_raid_md_free_volume_intel;
 static g_raid_md_free_t g_raid_md_free_intel;
 
 static kobj_method_t g_raid_md_intel_methods[] = {
@@ -216,6 +227,7 @@ static kobj_method_t g_raid_md_intel_met
KOBJMETHOD(g_raid_md_write, g_raid_md_write_intel),
KOBJMETHOD(g_raid_md_fail_disk, g_ra

svn commit: r246169 - head/sys/kern

2013-01-31 Thread Pawel Jakub Dawidek
Author: pjd
Date: Thu Jan 31 22:12:48 2013
New Revision: 246169
URL: http://svnweb.freebsd.org/changeset/base/246169

Log:
  Simplify code a bit. This is leftover after Giant removal from VFS.

Modified:
  head/sys/kern/vfs_vnops.c

Modified: head/sys/kern/vfs_vnops.c
==
--- head/sys/kern/vfs_vnops.c   Thu Jan 31 22:12:25 2013(r246168)
+++ head/sys/kern/vfs_vnops.c   Thu Jan 31 22:12:48 2013(r246169)
@@ -1683,10 +1683,8 @@ vfs_write_resume(struct mount *mp, int f
 static int
 vn_kqfilter(struct file *fp, struct knote *kn)
 {
-   int error;
 
-   error = VOP_KQFILTER(fp->f_vnode, kn);
-   return (error);
+   return (VOP_KQFILTER(fp->f_vnode, kn));
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246170 - stable/8/sys/geom/raid

2013-01-31 Thread Alexander Motin
Author: mav
Date: Thu Jan 31 22:13:36 2013
New Revision: 246170
URL: http://svnweb.freebsd.org/changeset/base/246170

Log:
  MFC r245326:
  Add basic support for Intel Rapid Recover Technology (Intel RRT).
  It is alike to RAID1, but with dedicating master and recovery disks and
  providing manual control over synchronization.  It allows to use recovery
  disk as snapshot of the master disk from the time of the last sync.
  
  This implementation is not functionaly complete comparing to Windows,
  but it is better then silent conversion to RAID1 on first boot.

Modified:
  stable/8/sys/geom/raid/g_raid.c
  stable/8/sys/geom/raid/g_raid.h
  stable/8/sys/geom/raid/md_intel.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/geom/   (props changed)

Modified: stable/8/sys/geom/raid/g_raid.c
==
--- stable/8/sys/geom/raid/g_raid.c Thu Jan 31 22:12:48 2013
(r246169)
+++ stable/8/sys/geom/raid/g_raid.c Thu Jan 31 22:13:36 2013
(r246170)
@@ -162,6 +162,8 @@ g_raid_disk_state2str(int state)
return ("NONE");
case G_RAID_DISK_S_OFFLINE:
return ("OFFLINE");
+   case G_RAID_DISK_S_DISABLED:
+   return ("DISABLED");
case G_RAID_DISK_S_FAILED:
return ("FAILED");
case G_RAID_DISK_S_STALE_FAILED:
@@ -532,7 +534,9 @@ g_raid_report_disk_state(struct g_raid_d
 
if (disk->d_consumer == NULL)
return;
-   if (disk->d_state == G_RAID_DISK_S_FAILED ||
+   if (disk->d_state == G_RAID_DISK_S_DISABLED) {
+   ;
+   } else if (disk->d_state == G_RAID_DISK_S_FAILED ||
disk->d_state == G_RAID_DISK_S_STALE_FAILED) {
s = G_STATE_FAILED;
} else {

Modified: stable/8/sys/geom/raid/g_raid.h
==
--- stable/8/sys/geom/raid/g_raid.h Thu Jan 31 22:12:48 2013
(r246169)
+++ stable/8/sys/geom/raid/g_raid.h Thu Jan 31 22:13:36 2013
(r246170)
@@ -140,11 +140,12 @@ struct g_raid_event {
 };
 #define G_RAID_DISK_S_NONE 0x00/* State is unknown. */
 #define G_RAID_DISK_S_OFFLINE  0x01/* Missing disk placeholder. */
-#define G_RAID_DISK_S_FAILED   0x02/* Failed. */
-#define G_RAID_DISK_S_STALE_FAILED 0x03/* Old failed. */
-#define G_RAID_DISK_S_SPARE0x04/* Hot-spare. */
-#define G_RAID_DISK_S_STALE0x05/* Old disk, unused now. */
-#define G_RAID_DISK_S_ACTIVE   0x06/* Operational. */
+#define G_RAID_DISK_S_DISABLED 0x02/* Disabled. */
+#define G_RAID_DISK_S_FAILED   0x03/* Failed. */
+#define G_RAID_DISK_S_STALE_FAILED 0x04/* Old failed. */
+#define G_RAID_DISK_S_SPARE0x05/* Hot-spare. */
+#define G_RAID_DISK_S_STALE0x06/* Old disk, unused now. */
+#define G_RAID_DISK_S_ACTIVE   0x07/* Operational. */
 
 #define G_RAID_DISK_E_DISCONNECTED 0x01
 

Modified: stable/8/sys/geom/raid/md_intel.c
==
--- stable/8/sys/geom/raid/md_intel.c   Thu Jan 31 22:12:48 2013
(r246169)
+++ stable/8/sys/geom/raid/md_intel.c   Thu Jan 31 22:13:36 2013
(r246170)
@@ -98,6 +98,8 @@ struct intel_raid_vol {
uint8_t cng_master_disk;
uint16_tcache_policy;
uint8_t cng_state;
+#define INTEL_SNGST_NEEDS_UPDATE   1
+#define INTEL_SNGST_MASTER_MISSING 2
uint8_t cng_sub_state;
uint32_tfiller_0[10];
 
@@ -130,6 +132,7 @@ struct intel_raid_disk {
 #define INTEL_F_ASSIGNED   0x02
 #define INTEL_F_FAILED 0x04
 #define INTEL_F_ONLINE 0x08
+#define INTEL_F_DISABLED   0x80
uint32_towner_cfg_num;
uint32_tsectors_hi;
uint32_tfiller[3];
@@ -187,6 +190,13 @@ struct g_raid_md_intel_perdisk {
struct intel_raid_disk   pd_disk_meta;
 };
 
+struct g_raid_md_intel_pervolume {
+   int  pv_volume_pos;
+   int  pv_cng;
+   int  pv_cng_man_sync;
+   int  pv_cng_master_disk;
+};
+
 struct g_raid_md_intel_object {
struct g_raid_md_object  mdio_base;
uint32_t mdio_config_id;
@@ -206,6 +216,7 @@ static g_raid_md_ctl_t g_raid_md_ctl_int
 static g_raid_md_write_t g_raid_md_write_intel;
 static g_raid_md_fail_disk_t g_raid_md_fail_disk_intel;
 static g_raid_md_free_disk_t g_raid_md_free_disk_intel;
+static g_raid_md_free_volume_t g_raid_md_free_volume_intel;
 static g_raid_md_free_t g_raid_md_free_intel;
 
 static kobj_method_t g_raid_md_intel_methods[] = {
@@ -216,6 +227,7 @@ static kobj_method_t g_raid_md_intel_met
KOBJMETHOD(g_raid_md_write, g_raid_md_write_intel),
 

svn commit: r246171 - head/sys/kern

2013-01-31 Thread Pawel Jakub Dawidek
Author: pjd
Date: Thu Jan 31 22:14:16 2013
New Revision: 246171
URL: http://svnweb.freebsd.org/changeset/base/246171

Log:
  Remove label that was accidentally moved during Giant removal from VFS.

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cThu Jan 31 22:13:36 2013
(r246170)
+++ head/sys/kern/kern_descrip.cThu Jan 31 22:14:16 2013
(r246171)
@@ -779,8 +779,10 @@ kern_fcntl(struct thread *td, int fd, in
if (arg != 0) {
vp = fp->f_vnode;
error = vn_lock(vp, LK_SHARED);
-   if (error != 0)
-   goto readahead_vnlock_fail;
+   if (error != 0) {
+   fdrop(fp, td);
+   break;
+   }
bsize = fp->f_vnode->v_mount->mnt_stat.f_iosize;
VOP_UNLOCK(vp, 0);
fp->f_seqcount = (arg + bsize - 1) / bsize;
@@ -788,7 +790,6 @@ kern_fcntl(struct thread *td, int fd, in
new = old = fp->f_flag;
new |= FRDAHEAD;
} while (!atomic_cmpset_rel_int(&fp->f_flag, old, new));
-   readahead_vnlock_fail:;
} else {
do {
new = old = fp->f_flag;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246172 - head/sys/kern

2013-01-31 Thread Pawel Jakub Dawidek
Author: pjd
Date: Thu Jan 31 22:15:41 2013
New Revision: 246172
URL: http://svnweb.freebsd.org/changeset/base/246172

Log:
  Remove leftover label after Giant removal from VFS.

Modified:
  head/sys/kern/vfs_syscalls.c

Modified: head/sys/kern/vfs_syscalls.c
==
--- head/sys/kern/vfs_syscalls.cThu Jan 31 22:14:16 2013
(r246171)
+++ head/sys/kern/vfs_syscalls.cThu Jan 31 22:15:41 2013
(r246172)
@@ -1108,7 +1108,7 @@ kern_openat(struct thread *td, int fd, c
 
if (error == ERESTART)
error = EINTR;
-   goto bad_unlocked;
+   goto bad;
}
td->td_dupfd = 0;
NDFREE(&nd, NDF_ONLY_PNBUF);
@@ -1150,12 +1150,11 @@ success:
 */
if ((error = kern_capwrap(td, fp, nd.ni_baserights,
&indx)) != 0)
-   goto bad_unlocked;
+   goto bad;
} else
 #endif
if ((error = finstall(td, fp, &indx, flags)) != 0)
-   goto bad_unlocked;
-
+   goto bad;
}
 
/*
@@ -1166,7 +1165,6 @@ success:
td->td_retval[0] = indx;
return (0);
 bad:
-bad_unlocked:
KASSERT(indx == -1, ("indx=%d, should be -1", indx));
fdrop(fp, td);
return (error);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246173 - stable/9/sys/geom/raid

2013-01-31 Thread Alexander Motin
Author: mav
Date: Thu Jan 31 22:15:47 2013
New Revision: 246173
URL: http://svnweb.freebsd.org/changeset/base/246173

Log:
  MFC r245338:
  Implement migration from single disk to RAID1/IRRT for Intel metadata.
  Windows driver uses such migration when it creates new arrays.  While GEOM
  RAID has no mechanism to implement migration in general case, this specifc
  case still can be handled easily via degraded RAID1 creation followed by
  regular rebuild.

Modified:
  stable/9/sys/geom/raid/md_intel.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/geom/raid/md_intel.c
==
--- stable/9/sys/geom/raid/md_intel.c   Thu Jan 31 22:15:41 2013
(r246172)
+++ stable/9/sys/geom/raid/md_intel.c   Thu Jan 31 22:15:47 2013
(r246173)
@@ -171,8 +171,13 @@ struct intel_raid_conf {
 
uint8_t total_disks;
uint8_t total_volumes;
-   uint8_t dummy_2[2];
-   uint32_tfiller_0[39];
+   uint8_t error_log_pos;
+   uint8_t dummy_2[1];
+   uint32_tcache_size;
+   uint32_torig_family_num;
+   uint32_tpwr_cycle_count;
+   uint32_tbbm_log_size;
+   uint32_tfiller_0[35];
struct intel_raid_disk  disk[1];/* total_disks entries. */
/* Here goes total_volumes of struct intel_raid_vol. */
 } __packed;
@@ -366,9 +371,12 @@ g_raid_md_intel_print(struct intel_raid_
printf("config_size 0x%08x\n", meta->config_size);
printf("config_id   0x%08x\n", meta->config_id);
printf("generation  0x%08x\n", meta->generation);
+   printf("error_log_size  %d\n", meta->error_log_size);
printf("attributes  0x%08x\n", meta->attributes);
printf("total_disks %u\n", meta->total_disks);
printf("total_volumes   %u\n", meta->total_volumes);
+   printf("orig_family_num 0x%08x\n", meta->orig_family_num);
+   printf("bbm_log_size%u\n", meta->bbm_log_size);
printf("DISK#   serial disk_sectors disk_sectors_hi disk_id flags\n");
for (i = 0; i < meta->total_disks; i++ ) {
printf("%d   <%.16s> %u %u 0x%08x 0x%08x\n", i,
@@ -451,7 +459,7 @@ intel_meta_read(struct g_consumer *cp)
struct g_provider *pp;
struct intel_raid_conf *meta;
struct intel_raid_vol *mvol;
-   struct intel_raid_map *mmap;
+   struct intel_raid_map *mmap, *mmap1;
char *buf;
int error, i, j, k, left, size;
uint32_t checksum, *ptr;
@@ -544,6 +552,8 @@ badsize:
}
}
 
+   g_raid_md_intel_print(meta);
+
/* Validate disk indexes. */
for (i = 0; i < meta->total_volumes; i++) {
mvol = intel_get_volume(meta, i);
@@ -566,16 +576,39 @@ badsize:
/* Validate migration types. */
for (i = 0; i < meta->total_volumes; i++) {
mvol = intel_get_volume(meta, i);
+   /* Deny unknown migration types. */
if (mvol->migr_state &&
mvol->migr_type != INTEL_MT_INIT &&
mvol->migr_type != INTEL_MT_REBUILD &&
mvol->migr_type != INTEL_MT_VERIFY &&
+   mvol->migr_type != INTEL_MT_GEN_MIGR &&
mvol->migr_type != INTEL_MT_REPAIR) {
G_RAID_DEBUG(1, "Intel metadata has unsupported"
" migration type %d", mvol->migr_type);
free(meta, M_MD_INTEL);
return (NULL);
}
+   /* Deny general migrations except SINGLE->RAID1. */
+   if (mvol->migr_state &&
+   mvol->migr_type == INTEL_MT_GEN_MIGR) {
+   mmap = intel_get_map(mvol, 0);
+   mmap1 = intel_get_map(mvol, 1);
+   if (mmap1->total_disks != 1 ||
+   mmap->type != INTEL_T_RAID1 ||
+   mmap->total_disks != 2 ||
+   mmap->offset != mmap1->offset ||
+   mmap->disk_sectors != mmap1->disk_sectors ||
+   mmap->total_domains != mmap->total_disks ||
+   mmap->offset_hi != mmap1->offset_hi ||
+   mmap->disk_sectors_hi != mmap1->disk_sectors_hi ||
+   (mmap->disk_idx[0] != mmap1->disk_idx[0] &&
+mmap->disk_idx[0] != mmap1->disk_idx[1])) {
+   G_RAID_DEBUG(1, "Intel metadata has unsupported"
+   " variant of general migration");
+   free(meta, M_MD_INTEL);
+   return (NULL);
+   }
+   }
}
 
return (meta);
@@ -957,6 +990,16 @@

svn commit: r246174 - stable/8/sys/geom/raid

2013-01-31 Thread Alexander Motin
Author: mav
Date: Thu Jan 31 22:16:52 2013
New Revision: 246174
URL: http://svnweb.freebsd.org/changeset/base/246174

Log:
  MFC r245338:
  Implement migration from single disk to RAID1/IRRT for Intel metadata.
  Windows driver uses such migration when it creates new arrays.  While GEOM
  RAID has no mechanism to implement migration in general case, this specifc
  case still can be handled easily via degraded RAID1 creation followed by
  regular rebuild.

Modified:
  stable/8/sys/geom/raid/md_intel.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/geom/   (props changed)

Modified: stable/8/sys/geom/raid/md_intel.c
==
--- stable/8/sys/geom/raid/md_intel.c   Thu Jan 31 22:15:47 2013
(r246173)
+++ stable/8/sys/geom/raid/md_intel.c   Thu Jan 31 22:16:52 2013
(r246174)
@@ -171,8 +171,13 @@ struct intel_raid_conf {
 
uint8_t total_disks;
uint8_t total_volumes;
-   uint8_t dummy_2[2];
-   uint32_tfiller_0[39];
+   uint8_t error_log_pos;
+   uint8_t dummy_2[1];
+   uint32_tcache_size;
+   uint32_torig_family_num;
+   uint32_tpwr_cycle_count;
+   uint32_tbbm_log_size;
+   uint32_tfiller_0[35];
struct intel_raid_disk  disk[1];/* total_disks entries. */
/* Here goes total_volumes of struct intel_raid_vol. */
 } __packed;
@@ -366,9 +371,12 @@ g_raid_md_intel_print(struct intel_raid_
printf("config_size 0x%08x\n", meta->config_size);
printf("config_id   0x%08x\n", meta->config_id);
printf("generation  0x%08x\n", meta->generation);
+   printf("error_log_size  %d\n", meta->error_log_size);
printf("attributes  0x%08x\n", meta->attributes);
printf("total_disks %u\n", meta->total_disks);
printf("total_volumes   %u\n", meta->total_volumes);
+   printf("orig_family_num 0x%08x\n", meta->orig_family_num);
+   printf("bbm_log_size%u\n", meta->bbm_log_size);
printf("DISK#   serial disk_sectors disk_sectors_hi disk_id flags\n");
for (i = 0; i < meta->total_disks; i++ ) {
printf("%d   <%.16s> %u %u 0x%08x 0x%08x\n", i,
@@ -451,7 +459,7 @@ intel_meta_read(struct g_consumer *cp)
struct g_provider *pp;
struct intel_raid_conf *meta;
struct intel_raid_vol *mvol;
-   struct intel_raid_map *mmap;
+   struct intel_raid_map *mmap, *mmap1;
char *buf;
int error, i, j, k, left, size;
uint32_t checksum, *ptr;
@@ -544,6 +552,8 @@ badsize:
}
}
 
+   g_raid_md_intel_print(meta);
+
/* Validate disk indexes. */
for (i = 0; i < meta->total_volumes; i++) {
mvol = intel_get_volume(meta, i);
@@ -566,16 +576,39 @@ badsize:
/* Validate migration types. */
for (i = 0; i < meta->total_volumes; i++) {
mvol = intel_get_volume(meta, i);
+   /* Deny unknown migration types. */
if (mvol->migr_state &&
mvol->migr_type != INTEL_MT_INIT &&
mvol->migr_type != INTEL_MT_REBUILD &&
mvol->migr_type != INTEL_MT_VERIFY &&
+   mvol->migr_type != INTEL_MT_GEN_MIGR &&
mvol->migr_type != INTEL_MT_REPAIR) {
G_RAID_DEBUG(1, "Intel metadata has unsupported"
" migration type %d", mvol->migr_type);
free(meta, M_MD_INTEL);
return (NULL);
}
+   /* Deny general migrations except SINGLE->RAID1. */
+   if (mvol->migr_state &&
+   mvol->migr_type == INTEL_MT_GEN_MIGR) {
+   mmap = intel_get_map(mvol, 0);
+   mmap1 = intel_get_map(mvol, 1);
+   if (mmap1->total_disks != 1 ||
+   mmap->type != INTEL_T_RAID1 ||
+   mmap->total_disks != 2 ||
+   mmap->offset != mmap1->offset ||
+   mmap->disk_sectors != mmap1->disk_sectors ||
+   mmap->total_domains != mmap->total_disks ||
+   mmap->offset_hi != mmap1->offset_hi ||
+   mmap->disk_sectors_hi != mmap1->disk_sectors_hi ||
+   (mmap->disk_idx[0] != mmap1->disk_idx[0] &&
+mmap->disk_idx[0] != mmap1->disk_idx[1])) {
+   G_RAID_DEBUG(1, "Intel metadata has unsupported"
+   " variant of general migration");
+   free(meta, M_MD_INTEL);
+   return (NULL);
+   }
+   }
}
 

svn commit: r246175 - stable/9/sys/geom/raid

2013-01-31 Thread Alexander Motin
Author: mav
Date: Thu Jan 31 22:18:40 2013
New Revision: 246175
URL: http://svnweb.freebsd.org/changeset/base/246175

Log:
  MFC r245341:
  Windows handles INIT and VERIFY as array-wide and it doesn't specify which
  disks should be rebuilt. Our rebuild code is same time disk-centric.  To
  handle this situation  properly check all disks for RBLD flags, and if no
  disk specified try rebuild/resync all of them except newly inserted.

Modified:
  stable/9/sys/geom/raid/md_intel.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/geom/raid/md_intel.c
==
--- stable/9/sys/geom/raid/md_intel.c   Thu Jan 31 22:16:52 2013
(r246174)
+++ stable/9/sys/geom/raid/md_intel.c   Thu Jan 31 22:18:40 2013
(r246175)
@@ -774,7 +774,7 @@ g_raid_md_intel_start_disk(struct g_raid
struct intel_raid_conf *meta;
struct intel_raid_vol *mvol;
struct intel_raid_map *mmap0, *mmap1;
-   int disk_pos, resurrection = 0;
+   int disk_pos, resurrection = 0, migr_global, i;
 
sc = disk->d_softc;
md = sc->sc_md;
@@ -903,6 +903,13 @@ nofit:
else
mmap1 = mmap0;
 
+   migr_global = 1;
+   for (i = 0; i < mmap0->total_disks; i++) {
+   if ((mmap0->disk_idx[i] & INTEL_DI_RBLD) == 0 &&
+   (mmap1->disk_idx[i] & INTEL_DI_RBLD) != 0)
+   migr_global = 0;
+   }
+
if (resurrection) {
/* Stale disk, almost same as new. */
g_raid_change_subdisk_state(sd,
@@ -953,6 +960,11 @@ nofit:
sd->sd_volume->v_strip_size *
mmap0->total_domains;
}
+   } else if (mvol->migr_type == INTEL_MT_INIT &&
+   migr_global) {
+   /* Freshly created uninitialized volume. */
+   g_raid_change_subdisk_state(sd,
+   G_RAID_SUBDISK_S_UNINITIALIZED);
} else if (mvol->dirty && (!pv->pv_cng ||
pv->pv_cng_master_disk != disk_pos)) {
/* Dirty volume (unclean shutdown). */
@@ -969,7 +981,8 @@ nofit:
/* Freshly inserted disk. */
g_raid_change_subdisk_state(sd,
G_RAID_SUBDISK_S_NEW);
-   } else if (mmap1->disk_idx[sd->sd_pos] & INTEL_DI_RBLD) 
{
+   } else if ((mmap1->disk_idx[sd->sd_pos] & 
INTEL_DI_RBLD) ||
+   migr_global) {
/* Resyncing disk. */
g_raid_change_subdisk_state(sd,
G_RAID_SUBDISK_S_RESYNC);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246176 - stable/8/sys/geom/raid

2013-01-31 Thread Alexander Motin
Author: mav
Date: Thu Jan 31 22:19:39 2013
New Revision: 246176
URL: http://svnweb.freebsd.org/changeset/base/246176

Log:
  MFC r245341:
  Windows handles INIT and VERIFY as array-wide and it doesn't specify which
  disks should be rebuilt. Our rebuild code is same time disk-centric.  To
  handle this situation  properly check all disks for RBLD flags, and if no
  disk specified try rebuild/resync all of them except newly inserted.

Modified:
  stable/8/sys/geom/raid/md_intel.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/geom/   (props changed)

Modified: stable/8/sys/geom/raid/md_intel.c
==
--- stable/8/sys/geom/raid/md_intel.c   Thu Jan 31 22:18:40 2013
(r246175)
+++ stable/8/sys/geom/raid/md_intel.c   Thu Jan 31 22:19:39 2013
(r246176)
@@ -774,7 +774,7 @@ g_raid_md_intel_start_disk(struct g_raid
struct intel_raid_conf *meta;
struct intel_raid_vol *mvol;
struct intel_raid_map *mmap0, *mmap1;
-   int disk_pos, resurrection = 0;
+   int disk_pos, resurrection = 0, migr_global, i;
 
sc = disk->d_softc;
md = sc->sc_md;
@@ -903,6 +903,13 @@ nofit:
else
mmap1 = mmap0;
 
+   migr_global = 1;
+   for (i = 0; i < mmap0->total_disks; i++) {
+   if ((mmap0->disk_idx[i] & INTEL_DI_RBLD) == 0 &&
+   (mmap1->disk_idx[i] & INTEL_DI_RBLD) != 0)
+   migr_global = 0;
+   }
+
if (resurrection) {
/* Stale disk, almost same as new. */
g_raid_change_subdisk_state(sd,
@@ -953,6 +960,11 @@ nofit:
sd->sd_volume->v_strip_size *
mmap0->total_domains;
}
+   } else if (mvol->migr_type == INTEL_MT_INIT &&
+   migr_global) {
+   /* Freshly created uninitialized volume. */
+   g_raid_change_subdisk_state(sd,
+   G_RAID_SUBDISK_S_UNINITIALIZED);
} else if (mvol->dirty && (!pv->pv_cng ||
pv->pv_cng_master_disk != disk_pos)) {
/* Dirty volume (unclean shutdown). */
@@ -969,7 +981,8 @@ nofit:
/* Freshly inserted disk. */
g_raid_change_subdisk_state(sd,
G_RAID_SUBDISK_S_NEW);
-   } else if (mmap1->disk_idx[sd->sd_pos] & INTEL_DI_RBLD) 
{
+   } else if ((mmap1->disk_idx[sd->sd_pos] & 
INTEL_DI_RBLD) ||
+   migr_global) {
/* Resyncing disk. */
g_raid_change_subdisk_state(sd,
G_RAID_SUBDISK_S_RESYNC);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246177 - head/sys/kern

2013-01-31 Thread Pawel Jakub Dawidek
Author: pjd
Date: Thu Jan 31 22:20:05 2013
New Revision: 246177
URL: http://svnweb.freebsd.org/changeset/base/246177

Log:
  Now that MPSAFE flag is gone, we can arrange code a bit better.

Modified:
  head/sys/kern/vfs_syscalls.c

Modified: head/sys/kern/vfs_syscalls.c
==
--- head/sys/kern/vfs_syscalls.cThu Jan 31 22:19:39 2013
(r246176)
+++ head/sys/kern/vfs_syscalls.cThu Jan 31 22:20:05 2013
(r246177)
@@ -187,8 +187,8 @@ sys_quotactl(td, uap)
AUDIT_ARG_UID(uap->uid);
if (!prison_allow(td->td_ucred, PR_ALLOW_QUOTAS))
return (EPERM);
-   NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1,
-  UIO_USERSPACE, uap->path, td);
+   NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, UIO_USERSPACE,
+   uap->path, td);
if ((error = namei(&nd)) != 0)
return (error);
NDFREE(&nd, NDF_ONLY_PNBUF);
@@ -293,8 +293,8 @@ kern_statfs(struct thread *td, char *pat
int error;
struct nameidata nd;
 
-   NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF |
-   AUDITVNODE1, pathseg, path, td);
+   NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1,
+   pathseg, path, td);
error = namei(&nd);
if (error)
return (error);
@@ -871,8 +871,8 @@ sys_chroot(td, uap)
error = priv_check(td, PRIV_VFS_CHROOT);
if (error)
return (error);
-   NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF |
-   AUDITVNODE1, UIO_USERSPACE, uap->path, td);
+   NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1,
+   UIO_USERSPACE, uap->path, td);
error = namei(&nd);
if (error)
goto error;
@@ -1077,8 +1077,8 @@ kern_openat(struct thread *td, int fd, c
/* Set the flags early so the finit in devfs can pick them up. */
fp->f_flag = flags & FMASK;
cmode = ((mode &~ fdp->fd_cmask) & ALLPERMS) &~ S_ISTXT;
-   NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | AUDITVNODE1, pathseg,
-   path, fd, rights_needed, td);
+   NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | AUDITVNODE1, pathseg, path, fd,
+   rights_needed, td);
td->td_dupfd = -1;  /* XXX check for fdopen */
error = vn_open(&nd, &flags, cmode, fp);
if (error) {
@@ -1277,9 +1277,8 @@ kern_mknodat(struct thread *td, int fd, 
return (error);
 restart:
bwillwrite();
-   NDINIT_ATRIGHTS(&nd, CREATE,
-   LOCKPARENT | SAVENAME | AUDITVNODE1, pathseg, path, fd,
-   CAP_MKNOD, td);
+   NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1,
+   pathseg, path, fd, CAP_MKNOD, td);
if ((error = namei(&nd)) != 0)
return (error);
vp = nd.ni_vp;
@@ -1398,9 +1397,8 @@ kern_mkfifoat(struct thread *td, int fd,
AUDIT_ARG_MODE(mode);
 restart:
bwillwrite();
-   NDINIT_ATRIGHTS(&nd, CREATE,
-   LOCKPARENT | SAVENAME | AUDITVNODE1, pathseg, path, fd,
-   CAP_MKFIFO, td);
+   NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1,
+   pathseg, path, fd, CAP_MKFIFO, td);
if ((error = namei(&nd)) != 0)
return (error);
if (nd.ni_vp != NULL) {
@@ -1539,8 +1537,7 @@ kern_linkat(struct thread *td, int fd1, 
int error;
 
bwillwrite();
-   NDINIT_AT(&nd, LOOKUP, follow | AUDITVNODE1, segflg, path1,
-   fd1, td);
+   NDINIT_AT(&nd, LOOKUP, follow | AUDITVNODE1, segflg, path1, fd1, td);
 
if ((error = namei(&nd)) != 0)
return (error);
@@ -1554,8 +1551,8 @@ kern_linkat(struct thread *td, int fd1, 
vrele(vp);
return (error);
}
-   NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME |
-   AUDITVNODE2, segflg, path2, fd2, CAP_CREATE, td);
+   NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE2,
+   segflg, path2, fd2, CAP_CREATE, td);
if ((error = namei(&nd)) == 0) {
if (nd.ni_vp != NULL) {
if (nd.ni_dvp == nd.ni_vp)
@@ -1647,8 +1644,8 @@ kern_symlinkat(struct thread *td, char *
AUDIT_ARG_TEXT(syspath);
 restart:
bwillwrite();
-   NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME |
-   AUDITVNODE1, segflg, path2, fd, CAP_CREATE, td);
+   NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1,
+   segflg, path2, fd, CAP_CREATE, td);
if ((error = namei(&nd)) != 0)
goto out;
if (nd.ni_vp) {
@@ -1799,8 +1796,8 @@ kern_unlinkat(struct thread *td, int fd,
 
 restart:
bwillwrite();
-   NDINIT_ATRIGHTS(&nd, DELETE, LOCKPARENT | LOCKLEAF |
-   AUDITVNODE1, pathseg, path, fd, CAP_DELETE, td);
+   NDINIT_ATRIGHTS(&nd, DELETE, LOCKPARENT | LOCKLEAF | 

svn commit: r246178 - stable/9/sys/geom/raid

2013-01-31 Thread Alexander Motin
Author: mav
Date: Thu Jan 31 22:21:39 2013
New Revision: 246178
URL: http://svnweb.freebsd.org/changeset/base/246178

Log:
  MFC r245363:
  Improve support for disabled disks. If disabled disk disconnected and then
  reconnected back, leave it as disabled. If new disk inserted instead of
  disabled, rebuild it and leave as enabled.

Modified:
  stable/9/sys/geom/raid/g_raid.c
  stable/9/sys/geom/raid/md_intel.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/geom/raid/g_raid.c
==
--- stable/9/sys/geom/raid/g_raid.c Thu Jan 31 22:20:05 2013
(r246177)
+++ stable/9/sys/geom/raid/g_raid.c Thu Jan 31 22:21:39 2013
(r246178)
@@ -538,7 +538,7 @@ g_raid_report_disk_state(struct g_raid_d
if (disk->d_consumer == NULL)
return;
if (disk->d_state == G_RAID_DISK_S_DISABLED) {
-   ;
+   s = G_STATE_ACTIVE; /* XXX */
} else if (disk->d_state == G_RAID_DISK_S_FAILED ||
disk->d_state == G_RAID_DISK_S_STALE_FAILED) {
s = G_STATE_FAILED;

Modified: stable/9/sys/geom/raid/md_intel.c
==
--- stable/9/sys/geom/raid/md_intel.c   Thu Jan 31 22:20:05 2013
(r246177)
+++ stable/9/sys/geom/raid/md_intel.c   Thu Jan 31 22:21:39 2013
(r246178)
@@ -787,13 +787,9 @@ g_raid_md_intel_start_disk(struct g_raid
disk_pos = intel_meta_find_disk(meta, pd->pd_disk_meta.serial);
if (disk_pos < 0) {
G_RAID_DEBUG1(1, sc, "Unknown, probably new or stale disk");
-   /* Disabled disk is useless for us. */
-   if (pd->pd_disk_meta.flags & INTEL_F_DISABLED) {
-   g_raid_change_disk_state(disk, G_RAID_DISK_S_DISABLED);
-   return (0);
-   }
/* Failed stale disk is useless for us. */
-   if (pd->pd_disk_meta.flags & INTEL_F_FAILED) {
+   if ((pd->pd_disk_meta.flags & INTEL_F_FAILED) &&
+   !(pd->pd_disk_meta.flags & INTEL_F_DISABLED)) {
g_raid_change_disk_state(disk, 
G_RAID_DISK_S_STALE_FAILED);
return (0);
}
@@ -884,10 +880,11 @@ nofit:
}
 
/* Welcome the new disk. */
-   if (resurrection)
-   g_raid_change_disk_state(disk, G_RAID_DISK_S_ACTIVE);
-   else if (meta->disk[disk_pos].flags & INTEL_F_DISABLED)
+   if ((meta->disk[disk_pos].flags & INTEL_F_DISABLED) &&
+   !(pd->pd_disk_meta.flags & INTEL_F_SPARE))
g_raid_change_disk_state(disk, G_RAID_DISK_S_DISABLED);
+   else if (resurrection)
+   g_raid_change_disk_state(disk, G_RAID_DISK_S_ACTIVE);
else if (meta->disk[disk_pos].flags & INTEL_F_FAILED)
g_raid_change_disk_state(disk, G_RAID_DISK_S_FAILED);
else if (meta->disk[disk_pos].flags & INTEL_F_SPARE)
@@ -910,14 +907,15 @@ nofit:
migr_global = 0;
}
 
-   if (resurrection) {
-   /* Stale disk, almost same as new. */
-   g_raid_change_subdisk_state(sd,
-   G_RAID_SUBDISK_S_NEW);
-   } else if (meta->disk[disk_pos].flags & INTEL_F_DISABLED) {
+   if ((meta->disk[disk_pos].flags & INTEL_F_DISABLED) &&
+   !(pd->pd_disk_meta.flags & INTEL_F_SPARE)) {
/* Disabled disk, useless. */
g_raid_change_subdisk_state(sd,
G_RAID_SUBDISK_S_NONE);
+   } else if (resurrection) {
+   /* Stale disk, almost same as new. */
+   g_raid_change_subdisk_state(sd,
+   G_RAID_SUBDISK_S_NEW);
} else if (meta->disk[disk_pos].flags & INTEL_F_FAILED) {
/* Failed disk, almost useless. */
g_raid_change_subdisk_state(sd,
@@ -1021,7 +1019,8 @@ nofit:
/* Update status of our need for spare. */
if (mdi->mdio_started) {
mdi->mdio_incomplete =
-   (g_raid_ndisks(sc, G_RAID_DISK_S_ACTIVE) <
+   (g_raid_ndisks(sc, G_RAID_DISK_S_ACTIVE) +
+g_raid_ndisks(sc, G_RAID_DISK_S_DISABLED) <
 meta->total_disks);
}
 
@@ -1053,7 +1052,8 @@ g_raid_md_intel_refill(struct g_raid_sof
update = 0;
do {
/* Make sure we miss anything. */
-   na = g_raid_ndisks(sc, G_RAID_DISK_S_ACTIVE);
+   na = g_raid_ndisks(sc, G_RAID_DISK_S_ACTIVE) +
+   g_raid_ndisks(sc, G_RAID_DISK_S_DISABLED);
if (na == meta->total_disks)
break;
 
@@ -1065,7 +1065,8 @@ g_raid_md_intel_refill(struct g_raid_

svn commit: r246179 - stable/8/sys/geom/raid

2013-01-31 Thread Alexander Motin
Author: mav
Date: Thu Jan 31 22:22:22 2013
New Revision: 246179
URL: http://svnweb.freebsd.org/changeset/base/246179

Log:
  MFC r245363:
  Improve support for disabled disks. If disabled disk disconnected and then
  reconnected back, leave it as disabled. If new disk inserted instead of
  disabled, rebuild it and leave as enabled.

Modified:
  stable/8/sys/geom/raid/g_raid.c
  stable/8/sys/geom/raid/md_intel.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/geom/   (props changed)

Modified: stable/8/sys/geom/raid/g_raid.c
==
--- stable/8/sys/geom/raid/g_raid.c Thu Jan 31 22:21:39 2013
(r246178)
+++ stable/8/sys/geom/raid/g_raid.c Thu Jan 31 22:22:22 2013
(r246179)
@@ -535,7 +535,7 @@ g_raid_report_disk_state(struct g_raid_d
if (disk->d_consumer == NULL)
return;
if (disk->d_state == G_RAID_DISK_S_DISABLED) {
-   ;
+   s = G_STATE_ACTIVE; /* XXX */
} else if (disk->d_state == G_RAID_DISK_S_FAILED ||
disk->d_state == G_RAID_DISK_S_STALE_FAILED) {
s = G_STATE_FAILED;

Modified: stable/8/sys/geom/raid/md_intel.c
==
--- stable/8/sys/geom/raid/md_intel.c   Thu Jan 31 22:21:39 2013
(r246178)
+++ stable/8/sys/geom/raid/md_intel.c   Thu Jan 31 22:22:22 2013
(r246179)
@@ -787,13 +787,9 @@ g_raid_md_intel_start_disk(struct g_raid
disk_pos = intel_meta_find_disk(meta, pd->pd_disk_meta.serial);
if (disk_pos < 0) {
G_RAID_DEBUG1(1, sc, "Unknown, probably new or stale disk");
-   /* Disabled disk is useless for us. */
-   if (pd->pd_disk_meta.flags & INTEL_F_DISABLED) {
-   g_raid_change_disk_state(disk, G_RAID_DISK_S_DISABLED);
-   return (0);
-   }
/* Failed stale disk is useless for us. */
-   if (pd->pd_disk_meta.flags & INTEL_F_FAILED) {
+   if ((pd->pd_disk_meta.flags & INTEL_F_FAILED) &&
+   !(pd->pd_disk_meta.flags & INTEL_F_DISABLED)) {
g_raid_change_disk_state(disk, 
G_RAID_DISK_S_STALE_FAILED);
return (0);
}
@@ -884,10 +880,11 @@ nofit:
}
 
/* Welcome the new disk. */
-   if (resurrection)
-   g_raid_change_disk_state(disk, G_RAID_DISK_S_ACTIVE);
-   else if (meta->disk[disk_pos].flags & INTEL_F_DISABLED)
+   if ((meta->disk[disk_pos].flags & INTEL_F_DISABLED) &&
+   !(pd->pd_disk_meta.flags & INTEL_F_SPARE))
g_raid_change_disk_state(disk, G_RAID_DISK_S_DISABLED);
+   else if (resurrection)
+   g_raid_change_disk_state(disk, G_RAID_DISK_S_ACTIVE);
else if (meta->disk[disk_pos].flags & INTEL_F_FAILED)
g_raid_change_disk_state(disk, G_RAID_DISK_S_FAILED);
else if (meta->disk[disk_pos].flags & INTEL_F_SPARE)
@@ -910,14 +907,15 @@ nofit:
migr_global = 0;
}
 
-   if (resurrection) {
-   /* Stale disk, almost same as new. */
-   g_raid_change_subdisk_state(sd,
-   G_RAID_SUBDISK_S_NEW);
-   } else if (meta->disk[disk_pos].flags & INTEL_F_DISABLED) {
+   if ((meta->disk[disk_pos].flags & INTEL_F_DISABLED) &&
+   !(pd->pd_disk_meta.flags & INTEL_F_SPARE)) {
/* Disabled disk, useless. */
g_raid_change_subdisk_state(sd,
G_RAID_SUBDISK_S_NONE);
+   } else if (resurrection) {
+   /* Stale disk, almost same as new. */
+   g_raid_change_subdisk_state(sd,
+   G_RAID_SUBDISK_S_NEW);
} else if (meta->disk[disk_pos].flags & INTEL_F_FAILED) {
/* Failed disk, almost useless. */
g_raid_change_subdisk_state(sd,
@@ -1021,7 +1019,8 @@ nofit:
/* Update status of our need for spare. */
if (mdi->mdio_started) {
mdi->mdio_incomplete =
-   (g_raid_ndisks(sc, G_RAID_DISK_S_ACTIVE) <
+   (g_raid_ndisks(sc, G_RAID_DISK_S_ACTIVE) +
+g_raid_ndisks(sc, G_RAID_DISK_S_DISABLED) <
 meta->total_disks);
}
 
@@ -1053,7 +1052,8 @@ g_raid_md_intel_refill(struct g_raid_sof
update = 0;
do {
/* Make sure we miss anything. */
-   na = g_raid_ndisks(sc, G_RAID_DISK_S_ACTIVE);
+   na = g_raid_ndisks(sc, G_RAID_DISK_S_ACTIVE) +
+   g_raid_ndisks(sc, G_RAID_DISK_S_DISABLED);
if (na == meta->total_disks)
break;
 
@@ -1065,7 +1065,8 @

svn commit: r246180 - stable/9/sys/geom/raid

2013-01-31 Thread Alexander Motin
Author: mav
Date: Thu Jan 31 22:24:05 2013
New Revision: 246180
URL: http://svnweb.freebsd.org/changeset/base/246180

Log:
  MFC r245398:
   - Add checks for Intel metadata version and attributes. Ignore disks with
  unsupported metadata types like Intel Smart Response to not corrupt them.
   - Improve setting of these things during metadata writing to protect from
  incapable BIOS'es and other implementations.

Modified:
  stable/9/sys/geom/raid/md_intel.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/geom/raid/md_intel.c
==
--- stable/9/sys/geom/raid/md_intel.c   Thu Jan 31 22:22:22 2013
(r246179)
+++ stable/9/sys/geom/raid/md_intel.c   Thu Jan 31 22:24:05 2013
(r246180)
@@ -165,6 +165,11 @@ struct intel_raid_conf {
 #define INTEL_ATTR_RAID1E  0x0008
 #define INTEL_ATTR_RAID5   0x0010
 #define INTEL_ATTR_RAIDCNG 0x0020
+#define INTEL_ATTR_EXT_STRIP   0x0040
+#define INTEL_ATTR_NVM_CACHE   0x0200
+#define INTEL_ATTR_2TB_DISK0x0400
+#define INTEL_ATTR_BBM 0x0800
+#define INTEL_ATTR_NVM_CACHE2  0x1000
 #define INTEL_ATTR_2TB 0x2000
 #define INTEL_ATTR_PM  0x4000
 #define INTEL_ATTR_CHECKSUM0x8000
@@ -182,6 +187,11 @@ struct intel_raid_conf {
/* Here goes total_volumes of struct intel_raid_vol. */
 } __packed;
 
+#define INTEL_ATTR_SUPPORTED   ( INTEL_ATTR_RAID0 | INTEL_ATTR_RAID1 | \
+INTEL_ATTR_RAID10 | INTEL_ATTR_RAID1E | INTEL_ATTR_RAID5 | \
+INTEL_ATTR_RAIDCNG | INTEL_ATTR_EXT_STRIP | INTEL_ATTR_2TB_DISK |  \
+INTEL_ATTR_2TB | INTEL_ATTR_PM | INTEL_ATTR_CHECKSUM )
+
 #define INTEL_MAX_MD_SIZE(ndisks)  \
 (sizeof(struct intel_raid_conf) +  \
  sizeof(struct intel_raid_disk) * (ndisks - 1) +   \
@@ -554,6 +564,21 @@ badsize:
 
g_raid_md_intel_print(meta);
 
+   if (strncmp(meta->version, INTEL_VERSION_1300, 6) > 0) {
+   G_RAID_DEBUG(1, "Intel unsupported version: '%.6s'",
+   meta->version);
+   free(meta, M_MD_INTEL);
+   return (NULL);
+   }
+
+   if (strncmp(meta->version, INTEL_VERSION_1300, 6) >= 0 &&
+   (meta->attributes & ~INTEL_ATTR_SUPPORTED) != 0) {
+   G_RAID_DEBUG(1, "Intel unsupported attributes: 0x%08x",
+   meta->attributes & ~INTEL_ATTR_SUPPORTED);
+   free(meta, M_MD_INTEL);
+   return (NULL);
+   }
+
/* Validate disk indexes. */
for (i = 0; i < meta->total_volumes; i++) {
mvol = intel_get_volume(meta, i);
@@ -2268,6 +2293,8 @@ g_raid_md_write_intel(struct g_raid_md_o
if (pd->pd_disk_pos < 0)
continue;
meta->disk[pd->pd_disk_pos] = pd->pd_disk_meta;
+   if (pd->pd_disk_meta.sectors_hi != 0)
+   meta->attributes |= INTEL_ATTR_2TB_DISK;
}
 
/* Fill volumes and maps. */
@@ -2297,12 +2324,16 @@ g_raid_md_write_intel(struct g_raid_md_o
meta->attributes |= INTEL_ATTR_RAID1;
else if (vol->v_raid_level == G_RAID_VOLUME_RL_RAID5)
meta->attributes |= INTEL_ATTR_RAID5;
-   else
+   else if ((vol->v_disks_count & 1) == 0)
meta->attributes |= INTEL_ATTR_RAID10;
+   else
+   meta->attributes |= INTEL_ATTR_RAID1E;
+   if (pv->pv_cng)
+   meta->attributes |= INTEL_ATTR_RAIDCNG;
+   if (vol->v_strip_size > 131072)
+   meta->attributes |= INTEL_ATTR_EXT_STRIP;
 
-   if (meta->attributes & INTEL_ATTR_2TB)
-   cv = INTEL_VERSION_1300;
-   else if (pv->pv_cng)
+   if (pv->pv_cng)
cv = INTEL_VERSION_1206;
else if (vol->v_disks_count > 4)
cv = INTEL_VERSION_1204;
@@ -2310,8 +2341,6 @@ g_raid_md_write_intel(struct g_raid_md_o
cv = INTEL_VERSION_1202;
else if (vol->v_disks_count > 2)
cv = INTEL_VERSION_1201;
-   else if (vi > 0)
-   cv = INTEL_VERSION_1200;
else if (vol->v_raid_level == G_RAID_VOLUME_RL_RAID1)
cv = INTEL_VERSION_1100;
else
@@ -2321,6 +2350,8 @@ g_raid_md_write_intel(struct g_raid_md_o
 
strlcpy(&mvol->name[0], vol->v_name, sizeof(mvol->name));
mvol->total_sectors = vol->v_mediasize / sectorsize;
+   mvol->state = (INTEL_ST_READ_COALESCING |
+   INTEL_ST_WRITE_COALESCING);
if (pv->pv_cng) {
mvol->state |= INTEL_ST_CLONE_N_GO;
if (pv

svn commit: r246181 - stable/8/sys/geom/raid

2013-01-31 Thread Alexander Motin
Author: mav
Date: Thu Jan 31 22:24:46 2013
New Revision: 246181
URL: http://svnweb.freebsd.org/changeset/base/246181

Log:
  MFC r245398:
   - Add checks for Intel metadata version and attributes. Ignore disks with
  unsupported metadata types like Intel Smart Response to not corrupt them.
   - Improve setting of these things during metadata writing to protect from
  incapable BIOS'es and other implementations.

Modified:
  stable/8/sys/geom/raid/md_intel.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/geom/   (props changed)

Modified: stable/8/sys/geom/raid/md_intel.c
==
--- stable/8/sys/geom/raid/md_intel.c   Thu Jan 31 22:24:05 2013
(r246180)
+++ stable/8/sys/geom/raid/md_intel.c   Thu Jan 31 22:24:46 2013
(r246181)
@@ -165,6 +165,11 @@ struct intel_raid_conf {
 #define INTEL_ATTR_RAID1E  0x0008
 #define INTEL_ATTR_RAID5   0x0010
 #define INTEL_ATTR_RAIDCNG 0x0020
+#define INTEL_ATTR_EXT_STRIP   0x0040
+#define INTEL_ATTR_NVM_CACHE   0x0200
+#define INTEL_ATTR_2TB_DISK0x0400
+#define INTEL_ATTR_BBM 0x0800
+#define INTEL_ATTR_NVM_CACHE2  0x1000
 #define INTEL_ATTR_2TB 0x2000
 #define INTEL_ATTR_PM  0x4000
 #define INTEL_ATTR_CHECKSUM0x8000
@@ -182,6 +187,11 @@ struct intel_raid_conf {
/* Here goes total_volumes of struct intel_raid_vol. */
 } __packed;
 
+#define INTEL_ATTR_SUPPORTED   ( INTEL_ATTR_RAID0 | INTEL_ATTR_RAID1 | \
+INTEL_ATTR_RAID10 | INTEL_ATTR_RAID1E | INTEL_ATTR_RAID5 | \
+INTEL_ATTR_RAIDCNG | INTEL_ATTR_EXT_STRIP | INTEL_ATTR_2TB_DISK |  \
+INTEL_ATTR_2TB | INTEL_ATTR_PM | INTEL_ATTR_CHECKSUM )
+
 #define INTEL_MAX_MD_SIZE(ndisks)  \
 (sizeof(struct intel_raid_conf) +  \
  sizeof(struct intel_raid_disk) * (ndisks - 1) +   \
@@ -554,6 +564,21 @@ badsize:
 
g_raid_md_intel_print(meta);
 
+   if (strncmp(meta->version, INTEL_VERSION_1300, 6) > 0) {
+   G_RAID_DEBUG(1, "Intel unsupported version: '%.6s'",
+   meta->version);
+   free(meta, M_MD_INTEL);
+   return (NULL);
+   }
+
+   if (strncmp(meta->version, INTEL_VERSION_1300, 6) >= 0 &&
+   (meta->attributes & ~INTEL_ATTR_SUPPORTED) != 0) {
+   G_RAID_DEBUG(1, "Intel unsupported attributes: 0x%08x",
+   meta->attributes & ~INTEL_ATTR_SUPPORTED);
+   free(meta, M_MD_INTEL);
+   return (NULL);
+   }
+
/* Validate disk indexes. */
for (i = 0; i < meta->total_volumes; i++) {
mvol = intel_get_volume(meta, i);
@@ -2268,6 +2293,8 @@ g_raid_md_write_intel(struct g_raid_md_o
if (pd->pd_disk_pos < 0)
continue;
meta->disk[pd->pd_disk_pos] = pd->pd_disk_meta;
+   if (pd->pd_disk_meta.sectors_hi != 0)
+   meta->attributes |= INTEL_ATTR_2TB_DISK;
}
 
/* Fill volumes and maps. */
@@ -2297,12 +2324,16 @@ g_raid_md_write_intel(struct g_raid_md_o
meta->attributes |= INTEL_ATTR_RAID1;
else if (vol->v_raid_level == G_RAID_VOLUME_RL_RAID5)
meta->attributes |= INTEL_ATTR_RAID5;
-   else
+   else if ((vol->v_disks_count & 1) == 0)
meta->attributes |= INTEL_ATTR_RAID10;
+   else
+   meta->attributes |= INTEL_ATTR_RAID1E;
+   if (pv->pv_cng)
+   meta->attributes |= INTEL_ATTR_RAIDCNG;
+   if (vol->v_strip_size > 131072)
+   meta->attributes |= INTEL_ATTR_EXT_STRIP;
 
-   if (meta->attributes & INTEL_ATTR_2TB)
-   cv = INTEL_VERSION_1300;
-   else if (pv->pv_cng)
+   if (pv->pv_cng)
cv = INTEL_VERSION_1206;
else if (vol->v_disks_count > 4)
cv = INTEL_VERSION_1204;
@@ -2310,8 +2341,6 @@ g_raid_md_write_intel(struct g_raid_md_o
cv = INTEL_VERSION_1202;
else if (vol->v_disks_count > 2)
cv = INTEL_VERSION_1201;
-   else if (vi > 0)
-   cv = INTEL_VERSION_1200;
else if (vol->v_raid_level == G_RAID_VOLUME_RL_RAID1)
cv = INTEL_VERSION_1100;
else
@@ -2321,6 +2350,8 @@ g_raid_md_write_intel(struct g_raid_md_o
 
strlcpy(&mvol->name[0], vol->v_name, sizeof(mvol->name));
mvol->total_sectors = vol->v_mediasize / sectorsize;
+   mvol->state = (INTEL_ST_READ_COALESCING |
+   INTEL_ST_WRITE_COALESCING);
if (pv->pv_cng) {
mvol->state |= INTEL_ST_CLO

svn commit: r246182 - stable/9/sys/geom/raid

2013-01-31 Thread Alexander Motin
Author: mav
Date: Thu Jan 31 22:26:48 2013
New Revision: 246182
URL: http://svnweb.freebsd.org/changeset/base/246182

Log:
  MFC r245400:
  Windows driver writes relative volume IDs to metadata field.  Use that value
  as a hint for raid/rX device number to make it persistent across reboots.

Modified:
  stable/9/sys/geom/raid/md_intel.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/geom/raid/md_intel.c
==
--- stable/9/sys/geom/raid/md_intel.c   Thu Jan 31 22:24:46 2013
(r246181)
+++ stable/9/sys/geom/raid/md_intel.c   Thu Jan 31 22:26:48 2013
(r246182)
@@ -1150,7 +1150,7 @@ g_raid_md_intel_start(struct g_raid_soft
for (i = 0; i < meta->total_volumes; i++) {
mvol = intel_get_volume(meta, i);
mmap = intel_get_map(mvol, 0);
-   vol = g_raid_create_volume(sc, mvol->name, -1);
+   vol = g_raid_create_volume(sc, mvol->name, mvol->tid - 1);
pv = malloc(sizeof(*pv), M_MD_INTEL, M_WAITOK | M_ZERO);
pv->pv_volume_pos = i;
pv->pv_cng = (mvol->state & INTEL_ST_CLONE_N_GO) != 0;
@@ -2352,6 +2352,7 @@ g_raid_md_write_intel(struct g_raid_md_o
mvol->total_sectors = vol->v_mediasize / sectorsize;
mvol->state = (INTEL_ST_READ_COALESCING |
INTEL_ST_WRITE_COALESCING);
+   mvol->tid = vol->v_global_id + 1;
if (pv->pv_cng) {
mvol->state |= INTEL_ST_CLONE_N_GO;
if (pv->pv_cng_man_sync)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246183 - stable/8/sys/geom/raid

2013-01-31 Thread Alexander Motin
Author: mav
Date: Thu Jan 31 22:27:31 2013
New Revision: 246183
URL: http://svnweb.freebsd.org/changeset/base/246183

Log:
  MFC r245400:
  Windows driver writes relative volume IDs to metadata field.  Use that value
  as a hint for raid/rX device number to make it persistent across reboots.

Modified:
  stable/8/sys/geom/raid/md_intel.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/geom/   (props changed)

Modified: stable/8/sys/geom/raid/md_intel.c
==
--- stable/8/sys/geom/raid/md_intel.c   Thu Jan 31 22:26:48 2013
(r246182)
+++ stable/8/sys/geom/raid/md_intel.c   Thu Jan 31 22:27:31 2013
(r246183)
@@ -1150,7 +1150,7 @@ g_raid_md_intel_start(struct g_raid_soft
for (i = 0; i < meta->total_volumes; i++) {
mvol = intel_get_volume(meta, i);
mmap = intel_get_map(mvol, 0);
-   vol = g_raid_create_volume(sc, mvol->name, -1);
+   vol = g_raid_create_volume(sc, mvol->name, mvol->tid - 1);
pv = malloc(sizeof(*pv), M_MD_INTEL, M_WAITOK | M_ZERO);
pv->pv_volume_pos = i;
pv->pv_cng = (mvol->state & INTEL_ST_CLONE_N_GO) != 0;
@@ -2352,6 +2352,7 @@ g_raid_md_write_intel(struct g_raid_md_o
mvol->total_sectors = vol->v_mediasize / sectorsize;
mvol->state = (INTEL_ST_READ_COALESCING |
INTEL_ST_WRITE_COALESCING);
+   mvol->tid = vol->v_global_id + 1;
if (pv->pv_cng) {
mvol->state |= INTEL_ST_CLONE_N_GO;
if (pv->pv_cng_man_sync)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246184 - stable/9/sys/geom/raid

2013-01-31 Thread Alexander Motin
Author: mav
Date: Thu Jan 31 22:30:23 2013
New Revision: 246184
URL: http://svnweb.freebsd.org/changeset/base/246184

Log:
  MFC r245423, r245425, r245433:
  - Print some more metadata fields.
  - Small cosmetic tuning of the IRRT status constants.
  - Keep value of orig_config_id metadata field.  Windows driver writes there
  previous value of config_id when it is changed in some cases.  I guess it
  may be used do avoid some split-brain conditions.

Modified:
  stable/9/sys/geom/raid/md_intel.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/geom/raid/md_intel.c
==
--- stable/9/sys/geom/raid/md_intel.c   Thu Jan 31 22:27:31 2013
(r246183)
+++ stable/9/sys/geom/raid/md_intel.c   Thu Jan 31 22:30:23 2013
(r246184)
@@ -98,8 +98,9 @@ struct intel_raid_vol {
uint8_t cng_master_disk;
uint16_tcache_policy;
uint8_t cng_state;
-#define INTEL_SNGST_NEEDS_UPDATE   1
-#define INTEL_SNGST_MASTER_MISSING 2
+#define INTEL_CNGST_UPDATED0
+#define INTEL_CNGST_NEEDS_UPDATE   1
+#define INTEL_CNGST_MASTER_MISSING 2
uint8_t cng_sub_state;
uint32_tfiller_0[10];
 
@@ -179,7 +180,7 @@ struct intel_raid_conf {
uint8_t error_log_pos;
uint8_t dummy_2[1];
uint32_tcache_size;
-   uint32_torig_family_num;
+   uint32_torig_config_id;
uint32_tpwr_cycle_count;
uint32_tbbm_log_size;
uint32_tfiller_0[35];
@@ -215,6 +216,7 @@ struct g_raid_md_intel_pervolume {
 struct g_raid_md_intel_object {
struct g_raid_md_object  mdio_base;
uint32_t mdio_config_id;
+   uint32_t mdio_orig_config_id;
uint32_t mdio_generation;
struct intel_raid_conf  *mdio_meta;
struct callout   mdio_start_co; /* STARTING state timer. */
@@ -385,14 +387,17 @@ g_raid_md_intel_print(struct intel_raid_
printf("attributes  0x%08x\n", meta->attributes);
printf("total_disks %u\n", meta->total_disks);
printf("total_volumes   %u\n", meta->total_volumes);
-   printf("orig_family_num 0x%08x\n", meta->orig_family_num);
+   printf("error_log_pos   %u\n", meta->error_log_pos);
+   printf("cache_size  %u\n", meta->cache_size);
+   printf("orig_config_id  0x%08x\n", meta->orig_config_id);
+   printf("pwr_cycle_count %u\n", meta->pwr_cycle_count);
printf("bbm_log_size%u\n", meta->bbm_log_size);
-   printf("DISK#   serial disk_sectors disk_sectors_hi disk_id flags\n");
+   printf("DISK#   serial disk_sectors disk_sectors_hi disk_id flags 
owner\n");
for (i = 0; i < meta->total_disks; i++ ) {
-   printf("%d   <%.16s> %u %u 0x%08x 0x%08x\n", i,
+   printf("%d   <%.16s> %u %u 0x%08x 0x%08x %08x\n", i,
meta->disk[i].serial, meta->disk[i].sectors,
-   meta->disk[i].sectors_hi,
-   meta->disk[i].id, meta->disk[i].flags);
+   meta->disk[i].sectors_hi, meta->disk[i].id,
+   meta->disk[i].flags, meta->disk[i].owner_cfg_num);
}
for (i = 0; i < meta->total_volumes; i++) {
mvol = intel_get_volume(meta, i);
@@ -414,6 +419,9 @@ g_raid_md_intel_print(struct intel_raid_
printf(" migr_state %u\n", mvol->migr_state);
printf(" migr_type  %u\n", mvol->migr_type);
printf(" dirty  %u\n", mvol->dirty);
+   printf(" fs_state   %u\n", mvol->fs_state);
+   printf(" verify_errors  %u\n", mvol->verify_errors);
+   printf(" bad_blocks %u\n", mvol->bad_blocks);
 
for (j = 0; j < (mvol->migr_state ? 2 : 1); j++) {
printf("  *** Map %d ***\n", j);
@@ -710,7 +718,7 @@ intel_meta_write_spare(struct g_consumer
memcpy(&meta->version[0], INTEL_VERSION_1000,
sizeof(INTEL_VERSION_1000) - 1);
meta->config_size = INTEL_MAX_MD_SIZE(1);
-   meta->config_id = arc4random();
+   meta->config_id = meta->orig_config_id = arc4random();
meta->generation = 1;
meta->total_disks = 1;
meta->disk[0] = *d;
@@ -1311,7 +1319,7 @@ g_raid_md_create_intel(struct g_raid_md_
char name[16];
 
mdi = (struct g_raid_md_intel_object *)md;
-   mdi->mdio_config_id = arc4random();
+   mdi->mdio_config_id = mdi->mdio_orig_config_id = arc4random();
mdi->mdio_generation = 0;
snprintf(name, sizeof(name), "Intel-%08x", mdi->mdio_config_id);
sc = g_raid_create_node(mp, name, md);
@@ -1456,6 +1464,7 @@ search:
} else { /* Not found matching node -- create one. */

svn commit: r246185 - stable/8/sys/geom/raid

2013-01-31 Thread Alexander Motin
Author: mav
Date: Thu Jan 31 22:31:25 2013
New Revision: 246185
URL: http://svnweb.freebsd.org/changeset/base/246185

Log:
  MFC r245423, r245425, r245433:
  - Print some more metadata fields.
  - Small cosmetic tuning of the IRRT status constants.
  - Keep value of orig_config_id metadata field.  Windows driver writes there
  previous value of config_id when it is changed in some cases.  I guess it
  may be used do avoid some split-brain conditions.

Modified:
  stable/8/sys/geom/raid/md_intel.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/geom/   (props changed)

Modified: stable/8/sys/geom/raid/md_intel.c
==
--- stable/8/sys/geom/raid/md_intel.c   Thu Jan 31 22:30:23 2013
(r246184)
+++ stable/8/sys/geom/raid/md_intel.c   Thu Jan 31 22:31:25 2013
(r246185)
@@ -98,8 +98,9 @@ struct intel_raid_vol {
uint8_t cng_master_disk;
uint16_tcache_policy;
uint8_t cng_state;
-#define INTEL_SNGST_NEEDS_UPDATE   1
-#define INTEL_SNGST_MASTER_MISSING 2
+#define INTEL_CNGST_UPDATED0
+#define INTEL_CNGST_NEEDS_UPDATE   1
+#define INTEL_CNGST_MASTER_MISSING 2
uint8_t cng_sub_state;
uint32_tfiller_0[10];
 
@@ -179,7 +180,7 @@ struct intel_raid_conf {
uint8_t error_log_pos;
uint8_t dummy_2[1];
uint32_tcache_size;
-   uint32_torig_family_num;
+   uint32_torig_config_id;
uint32_tpwr_cycle_count;
uint32_tbbm_log_size;
uint32_tfiller_0[35];
@@ -215,6 +216,7 @@ struct g_raid_md_intel_pervolume {
 struct g_raid_md_intel_object {
struct g_raid_md_object  mdio_base;
uint32_t mdio_config_id;
+   uint32_t mdio_orig_config_id;
uint32_t mdio_generation;
struct intel_raid_conf  *mdio_meta;
struct callout   mdio_start_co; /* STARTING state timer. */
@@ -385,14 +387,17 @@ g_raid_md_intel_print(struct intel_raid_
printf("attributes  0x%08x\n", meta->attributes);
printf("total_disks %u\n", meta->total_disks);
printf("total_volumes   %u\n", meta->total_volumes);
-   printf("orig_family_num 0x%08x\n", meta->orig_family_num);
+   printf("error_log_pos   %u\n", meta->error_log_pos);
+   printf("cache_size  %u\n", meta->cache_size);
+   printf("orig_config_id  0x%08x\n", meta->orig_config_id);
+   printf("pwr_cycle_count %u\n", meta->pwr_cycle_count);
printf("bbm_log_size%u\n", meta->bbm_log_size);
-   printf("DISK#   serial disk_sectors disk_sectors_hi disk_id flags\n");
+   printf("DISK#   serial disk_sectors disk_sectors_hi disk_id flags 
owner\n");
for (i = 0; i < meta->total_disks; i++ ) {
-   printf("%d   <%.16s> %u %u 0x%08x 0x%08x\n", i,
+   printf("%d   <%.16s> %u %u 0x%08x 0x%08x %08x\n", i,
meta->disk[i].serial, meta->disk[i].sectors,
-   meta->disk[i].sectors_hi,
-   meta->disk[i].id, meta->disk[i].flags);
+   meta->disk[i].sectors_hi, meta->disk[i].id,
+   meta->disk[i].flags, meta->disk[i].owner_cfg_num);
}
for (i = 0; i < meta->total_volumes; i++) {
mvol = intel_get_volume(meta, i);
@@ -414,6 +419,9 @@ g_raid_md_intel_print(struct intel_raid_
printf(" migr_state %u\n", mvol->migr_state);
printf(" migr_type  %u\n", mvol->migr_type);
printf(" dirty  %u\n", mvol->dirty);
+   printf(" fs_state   %u\n", mvol->fs_state);
+   printf(" verify_errors  %u\n", mvol->verify_errors);
+   printf(" bad_blocks %u\n", mvol->bad_blocks);
 
for (j = 0; j < (mvol->migr_state ? 2 : 1); j++) {
printf("  *** Map %d ***\n", j);
@@ -710,7 +718,7 @@ intel_meta_write_spare(struct g_consumer
memcpy(&meta->version[0], INTEL_VERSION_1000,
sizeof(INTEL_VERSION_1000) - 1);
meta->config_size = INTEL_MAX_MD_SIZE(1);
-   meta->config_id = arc4random();
+   meta->config_id = meta->orig_config_id = arc4random();
meta->generation = 1;
meta->total_disks = 1;
meta->disk[0] = *d;
@@ -1311,7 +1319,7 @@ g_raid_md_create_intel(struct g_raid_md_
char name[16];
 
mdi = (struct g_raid_md_intel_object *)md;
-   mdi->mdio_config_id = arc4random();
+   mdi->mdio_config_id = mdi->mdio_orig_config_id = arc4random();
mdi->mdio_generation = 0;
snprintf(name, sizeof(name), "Intel-%08x", mdi->mdio_config_id);
sc = g_raid_create_node(mp, name, md);
@@ -1456,6 +1464,7 @@ search:
} else { /* Not found match

svn commit: r246187 - stable/9/sys/fs/nfsserver

2013-01-31 Thread Xin LI
Author: delphij
Date: Fri Feb  1 00:32:01 2013
New Revision: 246187
URL: http://svnweb.freebsd.org/changeset/base/246187

Log:
  MFC r245613:
  
  Make it possible to force async at server side on new NFS server, similar
  to the old one's nfs.nfsrv.async.
  
  Please note that by enabling this option (default is disabled), the system
  could potentionally have silent data corruption if the server crashes
  before write is committed to non-volatile storage, as the client side have
  no way to tell if the data is already written.
  
  Submitted by: rmacklem

Modified:
  stable/9/sys/fs/nfsserver/nfs_nfsdserv.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/fs/   (props changed)

Modified: stable/9/sys/fs/nfsserver/nfs_nfsdserv.c
==
--- stable/9/sys/fs/nfsserver/nfs_nfsdserv.cThu Jan 31 22:43:38 2013
(r246186)
+++ stable/9/sys/fs/nfsserver/nfs_nfsdserv.cFri Feb  1 00:32:01 2013
(r246187)
@@ -55,6 +55,11 @@ extern int nfs_rootfhset;
 extern int nfsrv_enable_crossmntpt;
 #endif /* !APPLEKEXT */
 
+static int nfs_async = 0;
+SYSCTL_DECL(_vfs_nfsd);
+SYSCTL_INT(_vfs_nfsd, OID_AUTO, async, CTLFLAG_RW, &nfs_async, 0,
+"Tell client that writes were synced even though they were not");
+
 /*
  * This list defines the GSS mechanisms supported.
  * (Don't ask me how you get these strings from the RFC stuff like
@@ -912,7 +917,13 @@ nfsrvd_write(struct nfsrv_descript *nd, 
goto out;
NFSM_BUILD(tl, u_int32_t *, 4 * NFSX_UNSIGNED);
*tl++ = txdr_unsigned(retlen);
-   if (stable == NFSWRITE_UNSTABLE)
+   /*
+* If nfs_async is set, then pretend the write was FILESYNC.
+* Warning: Doing this violates RFC1813 and runs a risk
+* of data written by a client being lost when the server
+* crashes/reboots.
+*/
+   if (stable == NFSWRITE_UNSTABLE && nfs_async == 0)
*tl++ = txdr_unsigned(stable);
else
*tl++ = txdr_unsigned(NFSWRITE_FILESYNC);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246188 - in head/sys/amd64/vmm: . io

2013-01-31 Thread Neel Natu
Author: neel
Date: Fri Feb  1 01:16:26 2013
New Revision: 246188
URL: http://svnweb.freebsd.org/changeset/base/246188

Log:
  Increase the number of passthru devices supported by bhyve.
  
  The maximum length of an environment variable puts a limitation on the
  number of passthru devices that can be specified via a single variable.
  The workaround is to allow user to specify passthru devices via multiple
  environment variables instead of a single one.
  
  Obtained from:NetApp

Modified:
  head/sys/amd64/vmm/io/ppt.c
  head/sys/amd64/vmm/vmm.c

Modified: head/sys/amd64/vmm/io/ppt.c
==
--- head/sys/amd64/vmm/io/ppt.c Fri Feb  1 00:32:01 2013(r246187)
+++ head/sys/amd64/vmm/io/ppt.c Fri Feb  1 01:16:26 2013(r246188)
@@ -89,7 +89,7 @@ static struct pptdev {
void **cookie;
struct pptintr_arg *arg;
} msix;
-} pptdevs[32];
+} pptdevs[64];
 
 static int num_pptdevs;
 

Modified: head/sys/amd64/vmm/vmm.c
==
--- head/sys/amd64/vmm/vmm.cFri Feb  1 00:32:01 2013(r246187)
+++ head/sys/amd64/vmm/vmm.cFri Feb  1 01:16:26 2013(r246188)
@@ -862,30 +862,42 @@ vm_lapic(struct vm *vm, int cpu)
 boolean_t
 vmm_is_pptdev(int bus, int slot, int func)
 {
-   int found, b, s, f, n;
+   int found, i, n;
+   int b, s, f;
char *val, *cp, *cp2;
 
/*
-* setenv pptdevs "1/2/3 4/5/6 7/8/9 10/11/12"
+* XXX
+* The length of an environment variable is limited to 128 bytes which
+* puts an upper limit on the number of passthru devices that may be
+* specified using a single environment variable.
+*
+* Work around this by scanning multiple environment variable
+* names instead of a single one - yuck!
 */
+   const char *names[] = { "pptdevs", "pptdevs2", "pptdevs3", NULL };
+
+   /* set pptdevs="1/2/3 4/5/6 7/8/9 10/11/12" */
found = 0;
-   cp = val = getenv("pptdevs");
-   while (cp != NULL && *cp != '\0') {
-   if ((cp2 = strchr(cp, ' ')) != NULL)
-   *cp2 = '\0';
-
-   n = sscanf(cp, "%d/%d/%d", &b, &s, &f);
-   if (n == 3 && bus == b && slot == s && func == f) {
-   found = 1;
-   break;
-   }
+   for (i = 0; names[i] != NULL && !found; i++) {
+   cp = val = getenv(names[i]);
+   while (cp != NULL && *cp != '\0') {
+   if ((cp2 = strchr(cp, ' ')) != NULL)
+   *cp2 = '\0';
+
+   n = sscanf(cp, "%d/%d/%d", &b, &s, &f);
+   if (n == 3 && bus == b && slot == s && func == f) {
+   found = 1;
+   break;
+   }

-   if (cp2 != NULL)
-   *cp2++ = ' ';
+   if (cp2 != NULL)
+   *cp2++ = ' ';
 
-   cp = cp2;
+   cp = cp2;
+   }
+   freeenv(val);
}
-   freeenv(val);
return (found);
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246190 - head/usr.sbin/bhyve

2013-01-31 Thread Neel Natu
Author: neel
Date: Fri Feb  1 02:41:47 2013
New Revision: 246190
URL: http://svnweb.freebsd.org/changeset/base/246190

Log:
  Fix a bug in the passthru implementation where it would assume that all
  devices are MSI-X capable. This in turn would lead it to treat bar 0 as
  the MSI-X table bar even if the underlying device did not support MSI-X.
  
  Fix this by providing an API to query the MSI-X table index of the emulated
  device. If the underlying device does not support MSI-X then this API will
  return -1.
  
  Obtained from:NetApp

Modified:
  head/usr.sbin/bhyve/pci_emul.c
  head/usr.sbin/bhyve/pci_emul.h
  head/usr.sbin/bhyve/pci_passthru.c
  head/usr.sbin/bhyve/pci_virtio_net.c

Modified: head/usr.sbin/bhyve/pci_emul.c
==
--- head/usr.sbin/bhyve/pci_emul.c  Fri Feb  1 01:34:59 2013
(r246189)
+++ head/usr.sbin/bhyve/pci_emul.c  Fri Feb  1 02:41:47 2013
(r246190)
@@ -254,6 +254,26 @@ pci_emul_msix_tread(struct pci_devinst *
return (retval);
 }
 
+int
+pci_msix_table_bar(struct pci_devinst *pi)
+{
+
+   if (pi->pi_msix.table != NULL)
+   return (pi->pi_msix.table_bar);
+   else
+   return (-1);
+}
+
+int
+pci_msix_pba_bar(struct pci_devinst *pi)
+{
+
+   if (pi->pi_msix.table != NULL)
+   return (pi->pi_msix.pba_bar);
+   else
+   return (-1);
+}
+
 static int
 pci_emul_io_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes,
uint32_t *eax, void *arg)

Modified: head/usr.sbin/bhyve/pci_emul.h
==
--- head/usr.sbin/bhyve/pci_emul.h  Fri Feb  1 01:34:59 2013
(r246189)
+++ head/usr.sbin/bhyve/pci_emul.h  Fri Feb  1 02:41:47 2013
(r246190)
@@ -169,6 +169,8 @@ voidpci_lintr_deassert(struct pci_devin
 intpci_lintr_request(struct pci_devinst *pi, int ivec);
 intpci_msi_enabled(struct pci_devinst *pi);
 intpci_msix_enabled(struct pci_devinst *pi);
+intpci_msix_table_bar(struct pci_devinst *pi);
+intpci_msix_pba_bar(struct pci_devinst *pi);
 intpci_msi_msgnum(struct pci_devinst *pi);
 void   pci_parse_slot(char *opt, int legacy);
 void   pci_populate_msicap(struct msicap *cap, int msgs, int nextptr);

Modified: head/usr.sbin/bhyve/pci_passthru.c
==
--- head/usr.sbin/bhyve/pci_passthru.c  Fri Feb  1 01:34:59 2013
(r246189)
+++ head/usr.sbin/bhyve/pci_passthru.c  Fri Feb  1 02:41:47 2013
(r246190)
@@ -361,6 +361,8 @@ init_msix_table(struct vmctx *ctx, struc
size_t len;
struct pci_devinst *pi = sc->psc_pi;
 
+   assert(pci_msix_table_bar(pi) >= 0 && pci_msix_pba_bar(pi) >= 0);
+
/* 
 * If the MSI-X table BAR maps memory intended for
 * other uses, it is at least assured that the table 
@@ -370,7 +372,9 @@ init_msix_table(struct vmctx *ctx, struc
if (pi->pi_msix.pba_bar == pi->pi_msix.table_bar && 
((pi->pi_msix.pba_offset - pi->pi_msix.table_offset) < 4096)) {
/* Need to also emulate the PBA, not supported yet */
-   printf("Unsupported MSI-X table and PBA in same page\n");
+   printf("Unsupported MSI-X configuration: %d/%d/%d\n",
+  sc->psc_sel.pc_bus, sc->psc_sel.pc_dev,
+  sc->psc_sel.pc_func);
return (-1);
}
 
@@ -447,7 +451,7 @@ cfginitbar(struct vmctx *ctx, struct pas
return (-1);
 
/* The MSI-X table needs special handling */
-   if (i == pi->pi_msix.table_bar) {
+   if (i == pci_msix_table_bar(pi)) {
error = init_msix_table(ctx, sc, base);
if (error) 
return (-1);
@@ -688,7 +692,7 @@ passthru_write(struct vmctx *ctx, int vc
 
sc = pi->pi_arg;
 
-   if (pi->pi_msix.table_bar == baridx) {
+   if (baridx == pci_msix_table_bar(pi)) {
msix_table_write(ctx, vcpu, sc, offset, size, value);
} else {
assert(pi->pi_bar[baridx].type == PCIBAR_IO);
@@ -712,7 +716,7 @@ passthru_read(struct vmctx *ctx, int vcp
 
sc = pi->pi_arg;
 
-   if (pi->pi_msix.table_bar == baridx) {
+   if (baridx == pci_msix_table_bar(pi)) {
val = msix_table_read(sc, offset, size);
} else {
assert(pi->pi_bar[baridx].type == PCIBAR_IO);

Modified: head/usr.sbin/bhyve/pci_virtio_net.c
==
--- head/usr.sbin/bhyve/pci_virtio_net.cFri Feb  1 01:34:59 2013
(r246189)
+++ head/usr.sbin/bhyve/pci_virtio_net.cFri Feb  1 02:41:47 2013
(r246190)
@@ -685,8 +685,8 @@ pci_vtnet_write(struct vmctx *ctx, int v
 

svn commit: r246191 - in head: sys/amd64/vmm/io usr.sbin/bhyve

2013-01-31 Thread Neel Natu
Author: neel
Date: Fri Feb  1 03:49:09 2013
New Revision: 246191
URL: http://svnweb.freebsd.org/changeset/base/246191

Log:
  Fix a broken assumption in the passthru implementation that the MSI-X table
  can only be located at the beginning or the end of the BAR.
  
  If the MSI-table is located in the middle of a BAR then we will split the
  BAR into two and create two mappings - one before the table and one after
  the table - leaving a hole in place of the table so accesses to it can be
  trapped and emulated.
  
  Obtained from:NetApp

Modified:
  head/sys/amd64/vmm/io/ppt.c
  head/usr.sbin/bhyve/pci_passthru.c

Modified: head/sys/amd64/vmm/io/ppt.c
==
--- head/sys/amd64/vmm/io/ppt.c Fri Feb  1 02:41:47 2013(r246190)
+++ head/sys/amd64/vmm/io/ppt.c Fri Feb  1 03:49:09 2013(r246191)
@@ -56,9 +56,18 @@ __FBSDID("$FreeBSD$");
 /* XXX locking */
 
 #defineMAX_PPTDEVS (sizeof(pptdevs) / sizeof(pptdevs[0]))
-#defineMAX_MMIOSEGS(PCIR_MAX_BAR_0 + 1)
 #defineMAX_MSIMSGS 32
 
+/*
+ * If the MSI-X table is located in the middle of a BAR then that MMIO
+ * region gets split into two segments - one segment above the MSI-X table
+ * and the other segment below the MSI-X table - with a hole in place of
+ * the MSI-X table so accesses to it can be trapped and emulated.
+ *
+ * So, allocate a MMIO segment for each BAR register + 1 additional segment.
+ */
+#defineMAX_MMIOSEGS((PCIR_MAX_BAR_0 + 1) + 1)
+
 MALLOC_DEFINE(M_PPTMSIX, "pptmsix", "Passthru MSI-X resources");
 
 struct pptintr_arg {   /* pptintr(pptintr_arg) */

Modified: head/usr.sbin/bhyve/pci_passthru.c
==
--- head/usr.sbin/bhyve/pci_passthru.c  Fri Feb  1 02:41:47 2013
(r246190)
+++ head/usr.sbin/bhyve/pci_passthru.c  Fri Feb  1 03:49:09 2013
(r246191)
@@ -355,14 +355,18 @@ msix_table_write(struct vmctx *ctx, int 
 static int
 init_msix_table(struct vmctx *ctx, struct passthru_softc *sc, uint64_t base)
 {
-   int idx;
-   size_t table_size;
+   int b, s, f;
+   int error, idx;
+   size_t len, remaining, table_size;
vm_paddr_t start;
-   size_t len;
struct pci_devinst *pi = sc->psc_pi;
 
assert(pci_msix_table_bar(pi) >= 0 && pci_msix_pba_bar(pi) >= 0);
 
+   b = sc->psc_sel.pc_bus;
+   s = sc->psc_sel.pc_dev;
+   f = sc->psc_sel.pc_func;
+
/* 
 * If the MSI-X table BAR maps memory intended for
 * other uses, it is at least assured that the table 
@@ -372,34 +376,44 @@ init_msix_table(struct vmctx *ctx, struc
if (pi->pi_msix.pba_bar == pi->pi_msix.table_bar && 
((pi->pi_msix.pba_offset - pi->pi_msix.table_offset) < 4096)) {
/* Need to also emulate the PBA, not supported yet */
-   printf("Unsupported MSI-X configuration: %d/%d/%d\n",
-  sc->psc_sel.pc_bus, sc->psc_sel.pc_dev,
-  sc->psc_sel.pc_func);
+   printf("Unsupported MSI-X configuration: %d/%d/%d\n", b, s, f);
return (-1);
}
 
-   /* 
-* May need to split the BAR into 3 regions:
-* Before the MSI-X table, the MSI-X table, and after it
-* XXX for now, assume that the table is not in the middle
-*/
+   /* Compute the MSI-X table size */
table_size = pi->pi_msix.table_count * MSIX_TABLE_ENTRY_SIZE;
+   table_size = roundup2(table_size, 4096);
+
idx = pi->pi_msix.table_bar;
+   start = pi->pi_bar[idx].addr;
+   remaining = pi->pi_bar[idx].size;
 
-   /* Round up to page size */
-   table_size = roundup2(table_size, 4096);
-   if (pi->pi_msix.table_offset == 0) {
-   /* Map everything after the MSI-X table */
-   start = pi->pi_bar[idx].addr + table_size;
-   len = pi->pi_bar[idx].size - table_size;
-   } else {
-/* Map everything before the MSI-X table */
-   start = pi->pi_bar[idx].addr;
+   /* Map everything before the MSI-X table */
+   if (pi->pi_msix.table_offset > 0) {
len = pi->pi_msix.table_offset;
+   error = vm_map_pptdev_mmio(ctx, b, s, f, start, len, base);
+   if (error)
+   return (error);
+
+   base += len;
+   start += len;
+   remaining -= len;
+   }
+
+   /* Skip the MSI-X table */
+   base += table_size;
+   start += table_size;
+   remaining -= table_size;
+
+   /* Map everything beyond the end of the MSI-X table */
+   if (remaining > 0) {
+   len = remaining;
+   error = vm_map_pptdev_mmio(ctx, b, s, f, start, len, base);
+   if (error)
+   return (error);
}
-   retur

svn commit: r246192 - head/usr.sbin/pw

2013-01-31 Thread Daniel Eischen
Author: deischen
Date: Fri Feb  1 05:19:49 2013
New Revision: 246192
URL: http://svnweb.freebsd.org/changeset/base/246192

Log:
  Prevent a null pointer dereference in pw userdel when deleting
  a user whose group != username.

Modified:
  head/usr.sbin/pw/pw_user.c

Modified: head/usr.sbin/pw/pw_user.c
==
--- head/usr.sbin/pw/pw_user.c  Fri Feb  1 03:49:09 2013(r246191)
+++ head/usr.sbin/pw/pw_user.c  Fri Feb  1 05:19:49 2013(r246192)
@@ -425,7 +425,7 @@ pw_user(struct userconf * cnf, int mode,
}
 
grp = GETGRNAM(a_name->val);
-   if (*grp->gr_mem == NULL)
+   if (grp != NULL && *grp->gr_mem == NULL)
delgrent(GETGRNAM(a_name->val));
SETGRENT();
while ((grp = GETGRENT()) != NULL) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246193 - in head/sys: dev/blackhole modules modules/blackhole

2013-01-31 Thread Neel Natu
Author: neel
Date: Fri Feb  1 06:40:53 2013
New Revision: 246193
URL: http://svnweb.freebsd.org/changeset/base/246193

Log:
  Delete the "blackhole" driver - it is not needed anymore.
  
  The "blackhole" driver was used in conjunction with bhyve to sequester
  pci devices intended for passthru until vmm.ko was loaded. This was
  useful at one point because vmm.ko could not be loaded at boot time.
  
  The same functionality can now be achieved by loading vmm.ko via the
  loader along with the kernel.
  
  Discussed with:   grehan
  Obtained from:NetApp

Deleted:
  head/sys/dev/blackhole/
  head/sys/modules/blackhole/
Modified:
  head/sys/modules/Makefile

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Fri Feb  1 05:19:49 2013(r246192)
+++ head/sys/modules/Makefile   Fri Feb  1 06:40:53 2013(r246193)
@@ -48,7 +48,6 @@ SUBDIR=   \
${_bxe} \
${_bios} \
${_bktr} \
-   ${_blackhole} \
${_bm} \
bridgestp \
bwi \
@@ -626,7 +625,6 @@ _amdtemp=   amdtemp
 _arcmsr=   arcmsr
 _asmc= asmc
 _bktr= bktr
-_blackhole=blackhole
 _bxe=  bxe
 _cardbus=  cardbus
 _cbb=  cbb
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246194 - head/sys/dev/usb

2013-01-31 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Feb  1 07:05:43 2013
New Revision: 246194
URL: http://svnweb.freebsd.org/changeset/base/246194

Log:
  Make use of USB ID sections configurable.

Modified:
  head/sys/dev/usb/usb_freebsd.h
  head/sys/dev/usb/usb_freebsd_loader.h
  head/sys/dev/usb/usb_lookup.c
  head/sys/dev/usb/usbdi.h

Modified: head/sys/dev/usb/usb_freebsd.h
==
--- head/sys/dev/usb/usb_freebsd.h  Fri Feb  1 06:40:53 2013
(r246193)
+++ head/sys/dev/usb/usb_freebsd.h  Fri Feb  1 07:05:43 2013
(r246194)
@@ -43,6 +43,7 @@
 #defineUSB_HAVE_MSCTEST 1
 #defineUSB_HAVE_PF 1
 #defineUSB_HAVE_ROOT_MOUNT_HOLD 1
+#defineUSB_HAVE_ID_SECTION 1
 
 #defineUSB_TD_GET_PROC(td) (td)->td_proc
 #defineUSB_PROC_GET_GID(td) (td)->p_pgid

Modified: head/sys/dev/usb/usb_freebsd_loader.h
==
--- head/sys/dev/usb/usb_freebsd_loader.h   Fri Feb  1 06:40:53 2013
(r246193)
+++ head/sys/dev/usb/usb_freebsd_loader.h   Fri Feb  1 07:05:43 2013
(r246194)
@@ -43,6 +43,7 @@
 #defineUSB_HAVE_MSCTEST 0
 #defineUSB_HAVE_PF 0
 #defineUSB_HAVE_ROOT_MOUNT_HOLD 0
+#defineUSB_HAVE_ID_SECTION 0
 
 #defineUSB_TD_GET_PROC(td) (td)->td_proc
 #defineUSB_PROC_GET_GID(td) (td)->p_pgid

Modified: head/sys/dev/usb/usb_lookup.c
==
--- head/sys/dev/usb/usb_lookup.c   Fri Feb  1 06:40:53 2013
(r246193)
+++ head/sys/dev/usb/usb_lookup.c   Fri Feb  1 07:05:43 2013
(r246194)
@@ -178,7 +178,7 @@ usbd_lookup_id_by_uaa(const struct usb_d
 #defineMFL_SIZE "0"
 #endif
 
-#ifdef KLD_MODULE
+#if defined(KLD_MODULE) && (USB_HAVE_ID_SECTION != 0)
 static const char __section("bus_autoconf_format") __used usb_id_format[] = {
 
/* Declare that three different sections use the same format */

Modified: head/sys/dev/usb/usbdi.h
==
--- head/sys/dev/usb/usbdi.hFri Feb  1 06:40:53 2013(r246193)
+++ head/sys/dev/usb/usbdi.hFri Feb  1 07:05:43 2013(r246194)
@@ -241,12 +241,21 @@ struct usb_config {
  * have your driver module automatically loaded in host, device or
  * both modes respectivly:
  */
+#if USB_HAVE_ID_SECTION
 #defineSTRUCT_USB_HOST_ID \
 struct usb_device_id __section("usb_host_id")
 #defineSTRUCT_USB_DEVICE_ID \
 struct usb_device_id __section("usb_device_id")
 #defineSTRUCT_USB_DUAL_ID \
 struct usb_device_id __section("usb_dual_id")
+#else
+#defineSTRUCT_USB_HOST_ID \
+struct usb_device_id
+#defineSTRUCT_USB_DEVICE_ID \
+struct usb_device_id
+#defineSTRUCT_USB_DUAL_ID \
+struct usb_device_id
+#endif /* USB_HAVE_ID_SECTION */
 
 /*
  * The following structure is used when looking up an USB driver for
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246195 - in head/sys/modules/usb: . smsc

2013-01-31 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Feb  1 07:19:19 2013
New Revision: 246195
URL: http://svnweb.freebsd.org/changeset/base/246195

Log:
  Include SMSC driver into default kernel build.

Modified:
  head/sys/modules/usb/Makefile
  head/sys/modules/usb/smsc/Makefile

Modified: head/sys/modules/usb/Makefile
==
--- head/sys/modules/usb/Makefile   Fri Feb  1 07:05:43 2013
(r246194)
+++ head/sys/modules/usb/Makefile   Fri Feb  1 07:19:19 2013
(r246195)
@@ -36,7 +36,7 @@ SUBDIR += ${_rum} run ${_uath} upgt usie
 SUBDIR += atp uhid ukbd ums udbp ufm uep
 SUBDIR += ucom u3g uark ubsa ubser uchcom ucycom ufoma uftdi ugensa uipaq ulpt 
\
  umct umcs umodem umoscom uplcom uslcom uvisor uvscom
-SUBDIR += uether aue axe cdce cue ${_kue} mos rue udav uhso ipheth
+SUBDIR += uether aue axe cdce cue ${_kue} mos rue smsc udav uhso ipheth
 SUBDIR += usfs umass urio
 SUBDIR += quirk template
 

Modified: head/sys/modules/usb/smsc/Makefile
==
--- head/sys/modules/usb/smsc/Makefile  Fri Feb  1 07:05:43 2013
(r246194)
+++ head/sys/modules/usb/smsc/Makefile  Fri Feb  1 07:19:19 2013
(r246195)
@@ -31,7 +31,7 @@ S= ${.CURDIR}/../../..
 
 KMOD=  if_smsc
 SRCS=  opt_bus.h opt_usb.h device_if.h bus_if.h usb_if.h usbdevs.h \
-   miibus_if.h opt_inet.h \
+   miibus_if.h opt_inet.h opt_platform.h \
if_smsc.c
 
 .include 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246196 - head/sys/dev/usb/net

2013-01-31 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Feb  1 07:26:25 2013
New Revision: 246196
URL: http://svnweb.freebsd.org/changeset/base/246196

Log:
  Fix for hardware checksum offloading in SMSC driver.
  This also fixes IPv6 support for this particular hardware.
  
  Submitted by: Daisuke Aoyama

Modified:
  head/sys/dev/usb/net/if_smsc.c

Modified: head/sys/dev/usb/net/if_smsc.c
==
--- head/sys/dev/usb/net/if_smsc.c  Fri Feb  1 07:19:19 2013
(r246195)
+++ head/sys/dev/usb/net/if_smsc.c  Fri Feb  1 07:26:25 2013
(r246196)
@@ -1009,6 +1009,10 @@ smsc_bulk_read_callback(struct usb_xfer 
 
/* Check if RX TCP/UDP checksumming is being 
offloaded */
if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) {
+
+   struct ether_header *eh;
+
+   eh = mtod(m, struct ether_header *);

/* Remove the extra 2 bytes of the csum 
*/
pktlen -= 2;
@@ -1020,8 +1024,10 @@ smsc_bulk_read_callback(struct usb_xfer 
 * the padding bytes as well. Therefore 
to be safe we
 * ignore the H/W csum on frames less 
than or equal to
 * 64 bytes.
+*
+* Ignore H/W csum for non-IPv4 packets.
 */
-   if (pktlen > ETHER_MIN_LEN) {
+   if (be16toh(eh->ether_type) == 
ETHERTYPE_IP && pktlen > ETHER_MIN_LEN) {

/* Indicate the UDP/TCP csum 
has been calculated */
m->m_pkthdr.csum_flags |= 
CSUM_DATA_VALID;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246197 - stable/9/lib/libc/gen

2013-01-31 Thread Xin LI
Author: delphij
Date: Fri Feb  1 07:36:22 2013
New Revision: 246197
URL: http://svnweb.freebsd.org/changeset/base/246197

Log:
  MFC r244568:
  
   - Reduce buffer size from LINE_MAX to PATH_MAX, there is no point to store
 path longer than this.
   - Fix an unreached case of check against sizeof buf, which in turn leads
 to an off-by-one nul byte write on the stack.  The original condition
 can never be satisfied because the passed boundary is the maximum value
 that can be returned, so code was harmless.

Modified:
  stable/9/lib/libc/gen/check_utility_compat.c
Directory Properties:
  stable/9/lib/libc/   (props changed)

Modified: stable/9/lib/libc/gen/check_utility_compat.c
==
--- stable/9/lib/libc/gen/check_utility_compat.cFri Feb  1 07:26:25 
2013(r246196)
+++ stable/9/lib/libc/gen/check_utility_compat.cFri Feb  1 07:36:22 
2013(r246197)
@@ -35,32 +35,28 @@ __FBSDID("$FreeBSD$");
  * are threaded, so I'm not concerned about cancellation points or other
  * niceties.
  */
+#include 
+
 #include 
 #include 
 #include 
 #include 
 
-#ifndef LINE_MAX
-#defineLINE_MAX _POSIX2_LINE_MAX
-#endif
-
 #define_PATH_UTIL_COMPAT   "/etc/compat-FreeBSD-4-util"
 #define_ENV_UTIL_COMPAT"_COMPAT_FreeBSD_4"
 
 int
 check_utility_compat(const char *utility)
 {
-   char buf[LINE_MAX];
+   char buf[PATH_MAX];
char *p, *bp;
int len;
 
if ((p = getenv(_ENV_UTIL_COMPAT)) != NULL) {
strlcpy(buf, p, sizeof buf);
} else {
-   if ((len = readlink(_PATH_UTIL_COMPAT, buf, sizeof buf)) < 0)
+   if ((len = readlink(_PATH_UTIL_COMPAT, buf, sizeof(buf) - 1)) < 
0)
return 0;
-   if (len > sizeof buf)
-   len = sizeof buf;
buf[len] = '\0';
}
if (buf[0] == '\0')
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246198 - stable/8/lib/libc/gen

2013-01-31 Thread Xin LI
Author: delphij
Date: Fri Feb  1 07:38:26 2013
New Revision: 246198
URL: http://svnweb.freebsd.org/changeset/base/246198

Log:
  MFC r244568:
  
   - Reduce buffer size from LINE_MAX to PATH_MAX, there is no point to store
 path longer than this.
   - Fix an unreached case of check against sizeof buf, which in turn leads
 to an off-by-one nul byte write on the stack.  The original condition
 can never be satisfied because the passed boundary is the maximum value
 that can be returned, so code was harmless.

Modified:
  stable/8/lib/libc/gen/check_utility_compat.c
Directory Properties:
  stable/8/lib/libc/   (props changed)

Modified: stable/8/lib/libc/gen/check_utility_compat.c
==
--- stable/8/lib/libc/gen/check_utility_compat.cFri Feb  1 07:36:22 
2013(r246197)
+++ stable/8/lib/libc/gen/check_utility_compat.cFri Feb  1 07:38:26 
2013(r246198)
@@ -35,32 +35,28 @@ __FBSDID("$FreeBSD$");
  * are threaded, so I'm not concerned about cancellation points or other
  * niceties.
  */
+#include 
+
 #include 
 #include 
 #include 
 #include 
 
-#ifndef LINE_MAX
-#defineLINE_MAX _POSIX2_LINE_MAX
-#endif
-
 #define_PATH_UTIL_COMPAT   "/etc/compat-FreeBSD-4-util"
 #define_ENV_UTIL_COMPAT"_COMPAT_FreeBSD_4"
 
 int
 check_utility_compat(const char *utility)
 {
-   char buf[LINE_MAX];
+   char buf[PATH_MAX];
char *p, *bp;
int len;
 
if ((p = getenv(_ENV_UTIL_COMPAT)) != NULL) {
strlcpy(buf, p, sizeof buf);
} else {
-   if ((len = readlink(_PATH_UTIL_COMPAT, buf, sizeof buf)) < 0)
+   if ((len = readlink(_PATH_UTIL_COMPAT, buf, sizeof(buf) - 1)) < 
0)
return 0;
-   if (len > sizeof buf)
-   len = sizeof buf;
buf[len] = '\0';
}
if (buf[0] == '\0')
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246199 - stable/9/usr.bin/apply

2013-01-31 Thread Xin LI
Author: delphij
Date: Fri Feb  1 07:40:46 2013
New Revision: 246199
URL: http://svnweb.freebsd.org/changeset/base/246199

Log:
  MFC r245048:
  
  Constify arguments.  While I'm there, also add a static for usage().

Modified:
  stable/9/usr.bin/apply/apply.c
Directory Properties:
  stable/9/usr.bin/apply/   (props changed)

Modified: stable/9/usr.bin/apply/apply.c
==
--- stable/9/usr.bin/apply/apply.c  Fri Feb  1 07:38:26 2013
(r246198)
+++ stable/9/usr.bin/apply/apply.c  Fri Feb  1 07:40:46 2013
(r246199)
@@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$");
 
 #define EXEC   "exec "
 
-static int exec_shell(const char *, char *, char *);
+static int exec_shell(const char *, const char *, const char *);
 static voidusage(void);
 
 int
@@ -222,7 +222,7 @@ main(int argc, char *argv[])
  * arguments.
  */
 static int
-exec_shell(const char *command, char *use_shell, char *use_name)
+exec_shell(const char *command, const char *use_shell, const char *use_name)
 {
pid_t pid;
int omask, pstat;
@@ -250,7 +250,7 @@ exec_shell(const char *command, char *us
return(pid == -1 ? -1 : pstat);
 }
 
-void
+static void
 usage(void)
 {
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r246200 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2013-01-31 Thread Xin LI
Author: delphij
Date: Fri Feb  1 07:48:13 2013
New Revision: 246200
URL: http://svnweb.freebsd.org/changeset/base/246200

Log:
  MFC r245511:
  
  Improve the comment in txg.c
  
  Obtained from:Illumos (13910:f3454e0a097c)

Modified:
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.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/txg.c
==
--- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c   Fri Feb 
 1 07:40:46 2013(r246199)
+++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c   Fri Feb 
 1 07:48:13 2013(r246200)
@@ -21,7 +21,7 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Portions Copyright 2011 Martin Matuska 
- * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
  */
 
 #include 
@@ -33,7 +33,76 @@
 #include 
 
 /*
- * Pool-wide transaction groups.
+ * ZFS Transaction Groups
+ * --
+ *
+ * ZFS transaction groups are, as the name implies, groups of transactions
+ * that act on persistent state. ZFS asserts consistency at the granularity of
+ * these transaction groups. Each successive transaction group (txg) is
+ * assigned a 64-bit consecutive identifier. There are three active
+ * transaction group states: open, quiescing, or syncing. At any given time,
+ * there may be an active txg associated with each state; each active txg may
+ * either be processing, or blocked waiting to enter the next state. There may
+ * be up to three active txgs, and there is always a txg in the open state
+ * (though it may be blocked waiting to enter the quiescing state). In broad
+ * strokes, transactions — operations that change in-memory structures — are
+ * accepted into the txg in the open state, and are completed while the txg is
+ * in the open or quiescing states. The accumulated changes are written to
+ * disk in the syncing state.
+ *
+ * Open
+ *
+ * When a new txg becomes active, it first enters the open state. New
+ * transactions — updates to in-memory structures — are assigned to the
+ * currently open txg. There is always a txg in the open state so that ZFS can
+ * accept new changes (though the txg may refuse new changes if it has hit
+ * some limit). ZFS advances the open txg to the next state for a variety of
+ * reasons such as it hitting a time or size threshold, or the execution of an
+ * administrative action that must be completed in the syncing state.
+ *
+ * Quiescing
+ *
+ * After a txg exits the open state, it enters the quiescing state. The
+ * quiescing state is intended to provide a buffer between accepting new
+ * transactions in the open state and writing them out to stable storage in
+ * the syncing state. While quiescing, transactions can continue their
+ * operation without delaying either of the other states. Typically, a txg is
+ * in the quiescing state very briefly since the operations are bounded by
+ * software latencies rather than, say, slower I/O latencies. After all
+ * transactions complete, the txg is ready to enter the next state.
+ *
+ * Syncing
+ *
+ * In the syncing state, the in-memory state built up during the open and (to
+ * a lesser degree) the quiescing states is written to stable storage. The
+ * process of writing out modified data can, in turn modify more data. For
+ * example when we write new blocks, we need to allocate space for them; those
+ * allocations modify metadata (space maps)... which themselves must be
+ * written to stable storage. During the sync state, ZFS iterates, writing out
+ * data until it converges and all in-memory changes have been written out.
+ * The first such pass is the largest as it encompasses all the modified user
+ * data (as opposed to filesystem metadata). Subsequent passes typically have
+ * far less data to write as they consist exclusively of filesystem metadata.
+ *
+ * To ensure convergence, after a certain number of passes ZFS begins
+ * overwriting locations on stable storage that had been allocated earlier in
+ * the syncing state (and subsequently freed). ZFS usually allocates new
+ * blocks to optimize for large, continuous, writes. For the syncing state to
+ * converge however it must complete a pass where no new blocks are allocated
+ * since each allocation requires a modification of persistent metadata.
+ * Further, to hasten convergence, after a prescribed number of passes, ZFS
+ * also defers frees, and stops compressing.
+ *
+ * In addition to writing out user data, we must also execute synctasks during
+ * the syncing context. A synctask is the mechanism by which some
+ * administrative activities work such as creating and destroying snapshots or
+ * datasets. Note that when a synctask is initiated it enters