svn commit: r277938 - head/sys/netinet

2015-01-30 Thread Hiren Panchasara
Author: hiren
Date: Fri Jan 30 17:29:07 2015
New Revision: 277938
URL: https://svnweb.freebsd.org/changeset/base/277938

Log:
  Make syncookie_mac() use 'tcp_seq irs' in computing hash.
  This fixes what seems like a simple oversight when the function was added in
  r253210.
  
  Reported by:Daniel Borkmann dbork...@redhat.com
  Florian Westphal f...@strlen.de
  Differential Revision:  https://reviews.freebsd.org/D1628
  Reviewed by:gnn
  MFC after:  1 month
  Sponsored by:   Limelight Networks

Modified:
  head/sys/netinet/tcp_syncache.c

Modified: head/sys/netinet/tcp_syncache.c
==
--- head/sys/netinet/tcp_syncache.c Fri Jan 30 15:42:52 2015
(r277937)
+++ head/sys/netinet/tcp_syncache.c Fri Jan 30 17:29:07 2015
(r277938)
@@ -1742,6 +1742,7 @@ syncookie_mac(struct in_conninfo *inc, t
}
SipHash_Update(ctx, inc-inc_fport, sizeof(inc-inc_fport));
SipHash_Update(ctx, inc-inc_lport, sizeof(inc-inc_lport));
+   SipHash_Update(ctx, irs, sizeof(irs));
SipHash_Update(ctx, flags, sizeof(flags));
SipHash_Update(ctx, secmod, sizeof(secmod));
SipHash_Final((u_int8_t *)siphash, ctx);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277937 - head/tools/tools/nanobsd/rescue

2015-01-30 Thread Michael Reifenberger
Author: mr
Date: Fri Jan 30 15:42:52 2015
New Revision: 277937
URL: https://svnweb.freebsd.org/changeset/base/277937

Log:
  Keep original images, dont compile tests,
  makefs for iso images translates labes to uppercase, so adopt fstab for this 
case.

Modified:
  head/tools/tools/nanobsd/rescue/build.sh
  head/tools/tools/nanobsd/rescue/common

Modified: head/tools/tools/nanobsd/rescue/build.sh
==
--- head/tools/tools/nanobsd/rescue/build.shFri Jan 30 15:32:35 2015
(r277936)
+++ head/tools/tools/nanobsd/rescue/build.shFri Jan 30 15:42:52 2015
(r277937)
@@ -23,20 +23,23 @@ fi
 
 sh ../nanobsd.sh $* -c ${CFG}
 
+if [ \! -d /usr/obj/Rescue ]; then
+  mkdir -p /usr/obj/Rescue
+fi
 F32=/usr/obj/Rescue/rescue_${today}_x32
 D32=/usr/obj/nanobsd.rescue_i386
 if [ -f ${D32}/_.disk.full ]; then
-  mv ${D32}/_.disk.full ${F32}.img
+  cp ${D32}/_.disk.full ${F32}.img
 fi
 if [ -f ${D32}/_.disk.iso ]; then
-  mv ${D32}/_.disk.iso ${F32}.iso
+  cp ${D32}/_.disk.iso ${F32}.iso
 fi
 
 F64=/usr/obj/Rescue/rescue_${today}_x64
 D64=/usr/obj/nanobsd.rescue_amd64
 if [ -f ${D64}/_.disk.full ]; then
-  mv ${D64}/_.disk.full ${F64}.img
+  cp ${D64}/_.disk.full ${F64}.img
 fi
 if [ -f ${D64}/_.disk.iso ]; then
-  mv ${D64}/_.disk.iso ${F64}.iso
+  cp ${D64}/_.disk.iso ${F64}.iso
 fi

Modified: head/tools/tools/nanobsd/rescue/common
==
--- head/tools/tools/nanobsd/rescue/common  Fri Jan 30 15:32:35 2015
(r277936)
+++ head/tools/tools/nanobsd/rescue/common  Fri Jan 30 15:42:52 2015
(r277937)
@@ -31,9 +31,19 @@ CONF_INSTALL='
 CONF_WORLD='   
 
 #TARGET_ARCH=i386
 CFLAGS=-O -pipe
+WITHOUT_TESTS=YES
 ALL_MODULES=YES
 '
 
+# Functions
+toLower() {
+  echo $1 | tr [:upper:] [:lower:]
+}
+
+toUpper() {
+  echo $1 | tr [:lower:] [:upper:]
+}
+
 #customize_cmd cust_comconsole
 customize_cmd cust_allow_ssh_root
 customize_cmd cust_install_files
@@ -93,16 +103,22 @@ last_orders () (
pprint 2 last orders
(
cd ${NANO_WORLDDIR}
-   echo /dev/iso9660/${NANO_LABEL} / cd9660 ro,noatime 0 0  etc/fstab
+   #makefs converts labels to uppercase anyways
+   BIGLABEL=`toUpper ${NANO_LABEL}`
+   echo /dev/iso9660/${BIGLABEL} / cd9660 ro,noatime 0 0  etc/fstab
echo tmpfs /boot/zfs tmpfs rw,size=1048576,mode=777 0 0  etc/fstab
echo ports:/usr/ports /usr/ports nfs 
rw,noauto,noatime,bg,soft,intr,nfsv3 0 0  etc/fstab
 #  echo /dev/ad1s1a /scratch ufs rw,noauto,noatime 0 0  etc/fstab
rm -f conf/default/etc/remount
touch conf/default/etc/.keepme
touch conf/default/var/.keepme
+   mkdir bootpool
+   mkdir mnt/a
+   mkdir mnt/b
+   mkdir mnt/c
cd ..
makefs -t cd9660 -o rockridge \
-   -o label=${NANO_LABEL} -o publisher=RMX \
+   -o label=${BIGLABEL} -o publisher=RMX \
-o bootimage=i386;_.w/boot/cdboot -o no-emul-boot _.disk.iso _.w/
)
 )
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277936 - head/libexec/rtld-elf

2015-01-30 Thread Konstantin Belousov
Author: kib
Date: Fri Jan 30 15:32:35 2015
New Revision: 277936
URL: https://svnweb.freebsd.org/changeset/base/277936

Log:
  Use powerof2().  Remove single-use variable.
  
  Submitted by: Conrad Meyer
  Differential Revision:https://reviews.freebsd.org/D1724
  MFC after:1 week

Modified:
  head/libexec/rtld-elf/rtld.c

Modified: head/libexec/rtld-elf/rtld.c
==
--- head/libexec/rtld-elf/rtld.cFri Jan 30 15:02:16 2015
(r277935)
+++ head/libexec/rtld-elf/rtld.cFri Jan 30 15:32:35 2015
(r277936)
@@ -876,7 +876,6 @@ digest_dynamic1(Obj_Entry *obj, int earl
 const Elf32_Word *hashval;
 Elf32_Word bkt, nmaskwords;
 int bloom_size32;
-bool nmw_power2;
 int plttype = DT_REL;
 
 *dyn_rpath = NULL;
@@ -986,16 +985,15 @@ digest_dynamic1(Obj_Entry *obj, int earl
obj-symndx_gnu = hashtab[1];
nmaskwords = hashtab[2];
bloom_size32 = (__ELF_WORD_SIZE / 32) * nmaskwords;
-   /* Number of bitmask words is required to be power of 2 */
-   nmw_power2 = ((nmaskwords  (nmaskwords - 1)) == 0);
obj-maskwords_bm_gnu = nmaskwords - 1;
obj-shift2_gnu = hashtab[3];
obj-bloom_gnu = (Elf_Addr *) (hashtab + 4);
obj-buckets_gnu = hashtab + 4 + bloom_size32;
obj-chain_zero_gnu = obj-buckets_gnu + obj-nbuckets_gnu -
  obj-symndx_gnu;
-   obj-valid_hash_gnu = nmw_power2  obj-nbuckets_gnu  0 
- obj-buckets_gnu != NULL;
+   /* Number of bitmask words is required to be power of 2 */
+   obj-valid_hash_gnu = powerof2(nmaskwords) 
+   obj-nbuckets_gnu  0  obj-buckets_gnu != NULL;
}
break;
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277950 - head/usr.sbin/bsdinstall/partedit

2015-01-30 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Fri Jan 30 21:22:18 2015
New Revision: 277950
URL: https://svnweb.freebsd.org/changeset/base/277950

Log:
  Use MBR by default on BIOS systems. An increasing number of motherboards
  assume that GPT means UEFI boot, resulting in the installation of
  uninstallable systems. This needs a little more work before MFC, in
  particular based on disk size ( 2 TB + BIOS + MBR is not workable). That
  will come soon.

Modified:
  head/usr.sbin/bsdinstall/partedit/partedit_x86.c

Modified: head/usr.sbin/bsdinstall/partedit/partedit_x86.c
==
--- head/usr.sbin/bsdinstall/partedit/partedit_x86.cFri Jan 30 19:47:25 
2015(r277949)
+++ head/usr.sbin/bsdinstall/partedit/partedit_x86.cFri Jan 30 21:22:18 
2015(r277950)
@@ -51,7 +51,10 @@ x86_bootmethod(void)
 const char *
 default_scheme(void)
 {
-   return (GPT);
+   if (strcmp(x86_bootmethod(), UEFI) == 0)
+   return (GPT);
+   else
+   return (MBR);
 }
 
 int
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277951 - head/sys/netgraph

2015-01-30 Thread Dimitry Andric
Author: dim
Date: Fri Jan 30 21:59:53 2015
New Revision: 277951
URL: https://svnweb.freebsd.org/changeset/base/277951

Log:
  Fix a bunch of -Wcast-qual warnings in netgraph's ng_parse.c, by using
  __DECONST.  No functional change.
  
  MFC after:3 days

Modified:
  head/sys/netgraph/ng_parse.c

Modified: head/sys/netgraph/ng_parse.c
==
--- head/sys/netgraph/ng_parse.cFri Jan 30 21:22:18 2015
(r277950)
+++ head/sys/netgraph/ng_parse.cFri Jan 30 21:59:53 2015
(r277951)
@@ -1122,7 +1122,7 @@ ng_bytearray_parse(const struct ng_parse
struct ng_parse_type subtype;
 
subtype = ng_parse_bytearray_subtype;
-   *(const void **)subtype.private = type-info;
+   subtype.private = __DECONST(void *, type-info);
return ng_array_parse(subtype, s, off, start, buf, buflen);
}
 }
@@ -1134,7 +1134,7 @@ ng_bytearray_unparse(const struct ng_par
struct ng_parse_type subtype;
 
subtype = ng_parse_bytearray_subtype;
-   *(const void **)subtype.private = type-info;
+   subtype.private = __DECONST(void *, type-info);
return ng_array_unparse(subtype, data, off, cbuf, cbuflen);
 }
 
@@ -1145,7 +1145,7 @@ ng_bytearray_getDefault(const struct ng_
struct ng_parse_type subtype;
 
subtype = ng_parse_bytearray_subtype;
-   *(const void **)subtype.private = type-info;
+   subtype.private = __DECONST(void *, type-info);
return ng_array_getDefault(subtype, start, buf, buflen);
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277952 - head/sys/fs/udf

2015-01-30 Thread Dimitry Andric
Author: dim
Date: Fri Jan 30 22:01:45 2015
New Revision: 277952
URL: https://svnweb.freebsd.org/changeset/base/277952

Log:
  Fix a -Wcast-qual warning in udf_vnops.c, by using __DECONST.  No
  functional change.
  
  MFC after:3 days

Modified:
  head/sys/fs/udf/udf_vnops.c

Modified: head/sys/fs/udf/udf_vnops.c
==
--- head/sys/fs/udf/udf_vnops.c Fri Jan 30 21:59:53 2015(r277951)
+++ head/sys/fs/udf/udf_vnops.c Fri Jan 30 22:01:45 2015(r277952)
@@ -526,8 +526,9 @@ udf_transname(char *cs0string, char *des
}
 
while (unilen  0  destleft  0) {
-   udf_iconv-conv(udfmp-im_d2l, (const char **)unibuf,
-   (size_t *)unilen, (char **)destname, 
destleft);
+   udf_iconv-conv(udfmp-im_d2l, __DECONST(const char **,
+   unibuf), (size_t *)unilen, (char **)destname,
+   destleft);
/* Unconverted character found */
if (unilen  0  destleft  0) {
*destname++ = '?';
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277953 - head/sys/fs/smbfs

2015-01-30 Thread Dimitry Andric
Author: dim
Date: Fri Jan 30 22:02:32 2015
New Revision: 277953
URL: https://svnweb.freebsd.org/changeset/base/277953

Log:
  Fix a -Wcast-qual warning in smbfs_subr.c, by using __DECONST.  No
  functional change.
  
  MFC after:3 days

Modified:
  head/sys/fs/smbfs/smbfs_subr.c

Modified: head/sys/fs/smbfs/smbfs_subr.c
==
--- head/sys/fs/smbfs/smbfs_subr.c  Fri Jan 30 22:01:45 2015
(r277952)
+++ head/sys/fs/smbfs/smbfs_subr.c  Fri Jan 30 22:02:32 2015
(r277953)
@@ -170,8 +170,8 @@ smbfs_fname_tolocal(struct smb_vc *vcp, 
if (error) return error;
*/
 
-   error = iconv_conv_case
-   (vcp-vc_tolocal, (const char **)ibuf, ilen, obuf, 
olen, copt);
+   error = iconv_conv_case(vcp-vc_tolocal,
+   __DECONST(const char **, ibuf), ilen, obuf, olen, copt);
if (error  SMB_UNICODE_STRINGS(vcp)) {
/*
 * If using unicode, leaving a file name as it was when
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277940 - in head/sys: conf modules/aesni

2015-01-30 Thread Dimitry Andric
Author: dim
Date: Fri Jan 30 18:17:17 2015
New Revision: 277940
URL: https://svnweb.freebsd.org/changeset/base/277940

Log:
  For clang, disable -Wcast-qual warnings for specific aesni files, since
  clang 3.6.0 will emit a number of such warnings for those files, and
  they are partially contributed code.

Modified:
  head/sys/conf/files.amd64
  head/sys/conf/kern.mk
  head/sys/modules/aesni/Makefile

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Fri Jan 30 18:07:46 2015(r277939)
+++ head/sys/conf/files.amd64   Fri Jan 30 18:17:17 2015(r277940)
@@ -131,12 +131,12 @@ crypto/aesni/aeskeys_amd64.S  optional ae
 crypto/aesni/aesni.c   optional aesni
 aesni_ghash.o  optional aesni  \
dependency  $S/crypto/aesni/aesni_ghash.c \
-   compile-with${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} 
${PROF} -mmmx -msse -msse4 -maes -mpclmul ${.IMPSRC} \
+   compile-with${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} 
${NO_WCAST_QUAL} ${PROF} -mmmx -msse -msse4 -maes -mpclmul ${.IMPSRC} \
no-implicit-rule\
clean   aesni_ghash.o
 aesni_wrap.o   optional aesni  \
dependency  $S/crypto/aesni/aesni_wrap.c  \
-   compile-with${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} 
${PROF} -mmmx -msse -msse4 -maes ${.IMPSRC} \
+   compile-with${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} 
${NO_WCAST_QUAL} ${PROF} -mmmx -msse -msse4 -maes ${.IMPSRC} \
no-implicit-rule\
clean   aesni_wrap.o
 crypto/blowfish/bf_enc.c   optionalcrypto | ipsec

Modified: head/sys/conf/kern.mk
==
--- head/sys/conf/kern.mk   Fri Jan 30 18:07:46 2015(r277939)
+++ head/sys/conf/kern.mk   Fri Jan 30 18:17:17 2015(r277940)
@@ -23,6 +23,7 @@ NO_WSHIFT_COUNT_OVERFLOW= -Wno-shift-cou
 NO_WSELF_ASSIGN=   -Wno-self-assign
 NO_WUNNEEDED_INTERNAL_DECL=-Wno-unneeded-internal-declaration
 NO_WSOMETIMES_UNINITIALIZED=   -Wno-error-sometimes-uninitialized
+NO_WCAST_QUAL= -Wno-cast-qual
 # Several other warnings which might be useful in some cases, but not severe
 # enough to error out the whole kernel build.  Display them anyway, so there is
 # some incentive to fix them eventually.

Modified: head/sys/modules/aesni/Makefile
==
--- head/sys/modules/aesni/Makefile Fri Jan 30 18:07:46 2015
(r277939)
+++ head/sys/modules/aesni/Makefile Fri Jan 30 18:17:17 2015
(r277940)
@@ -22,3 +22,6 @@ aesni_wrap.o: aesni_wrap.c
${CTFCONVERT_CMD}
 
 .include bsd.kmod.mk
+
+CWARNFLAGS.aesni_ghash.c=  ${NO_WCAST_QUAL}
+CWARNFLAGS.aesni_wrap.c=   ${NO_WCAST_QUAL}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277941 - head/sys/arm/broadcom/bcm2835

2015-01-30 Thread Luiz Otavio O Souza
Author: loos
Date: Fri Jan 30 18:18:09 2015
New Revision: 277941
URL: https://svnweb.freebsd.org/changeset/base/277941

Log:
  The BCM2835 GPIO controller uses has interrupt lines and not only one.
  Allocate all four, we will use them soon.
  
  Simplificate the allocation of memory and interrupt resources with a single
  bus_alloc_resources() call instead of doing them separately.
  
  Destroy the mutex in case of errors.

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_gpio.cFri Jan 30 18:17:17 
2015(r277940)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_gpio.cFri Jan 30 18:18:09 
2015(r277941)
@@ -62,10 +62,20 @@ __FBSDID($FreeBSD$);
 #define dprintf(fmt, args...)
 #endif
 
+#defineBCM_GPIO_IRQS   4
 #defineBCM_GPIO_PINS   54
 #defineBCM_GPIO_DEFAULT_CAPS   (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | 
\
 GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN)
 
+static struct resource_spec bcm_gpio_res_spec[] = {
+   { SYS_RES_MEMORY, 0, RF_ACTIVE },
+   { SYS_RES_IRQ, 0, RF_ACTIVE },
+   { SYS_RES_IRQ, 1, RF_ACTIVE },
+   { SYS_RES_IRQ, 2, RF_ACTIVE },
+   { SYS_RES_IRQ, 3, RF_ACTIVE },
+   { -1, 0, 0 }
+};
+
 struct bcm_gpio_sysctl {
struct bcm_gpio_softc   *sc;
uint32_tpin;
@@ -74,8 +84,7 @@ struct bcm_gpio_sysctl {
 struct bcm_gpio_softc {
device_tsc_dev;
struct mtx  sc_mtx;
-   struct resource *   sc_mem_res;
-   struct resource *   sc_irq_res;
+   struct resource *   sc_res[BCM_GPIO_IRQS + 1];
bus_space_tag_t sc_bst;
bus_space_handle_t  sc_bsh;
void *  sc_intrhand;
@@ -660,34 +669,20 @@ bcm_gpio_probe(device_t dev)
 static int
 bcm_gpio_attach(device_t dev)
 {
-   struct bcm_gpio_softc *sc = device_get_softc(dev);
-   uint32_t func;
-   int i, j, rid;
+   int i, j;
phandle_t gpio;
+   struct bcm_gpio_softc *sc;
+   uint32_t func;
 
+   sc = device_get_softc(dev);
sc-sc_dev = dev;
-
mtx_init(sc-sc_mtx, bcm gpio, gpio, MTX_DEF);
-
-   rid = 0;
-   sc-sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, rid,
-   RF_ACTIVE);
-   if (!sc-sc_mem_res) {
-   device_printf(dev, cannot allocate memory window\n);
-   return (ENXIO);
-   }
-
-   sc-sc_bst = rman_get_bustag(sc-sc_mem_res);
-   sc-sc_bsh = rman_get_bushandle(sc-sc_mem_res);
-
-   rid = 0;
-   sc-sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, rid,
-   RF_ACTIVE);
-   if (!sc-sc_irq_res) {
-   bus_release_resource(dev, SYS_RES_MEMORY, 0, sc-sc_mem_res);
-   device_printf(dev, cannot allocate interrupt\n);
-   return (ENXIO);
+   if (bus_alloc_resources(dev, bcm_gpio_res_spec, sc-sc_res) != 0) {
+   device_printf(dev, cannot allocate resources\n);
+   goto fail;
}
+   sc-sc_bst = rman_get_bustag(sc-sc_res[0]);
+   sc-sc_bsh = rman_get_bushandle(sc-sc_res[0]);
 
/* Find our node. */
gpio = ofw_bus_get_node(sc-sc_dev);
@@ -723,10 +718,9 @@ bcm_gpio_attach(device_t dev)
return (bus_generic_attach(dev));
 
 fail:
-   if (sc-sc_irq_res)
-   bus_release_resource(dev, SYS_RES_IRQ, 0, sc-sc_irq_res);
-   if (sc-sc_mem_res)
-   bus_release_resource(dev, SYS_RES_MEMORY, 0, sc-sc_mem_res);
+   bus_release_resources(dev, bcm_gpio_res_spec, sc-sc_res);
+   mtx_destroy(sc-sc_mtx);
+
return (ENXIO);
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277948 - head/lib/msun/src

2015-01-30 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Jan 30 19:19:03 2015
New Revision: 277948
URL: https://svnweb.freebsd.org/changeset/base/277948

Log:
  msun: use previously ignored value.
  
  This fixes evaluation of exceptional values in scalblnl().
  While here, simplify the code as suggested by Bruce Evans.
  
  Reported by:  clang static analyzer
  MFC after:1 week

Modified:
  head/lib/msun/src/s_scalbln.c

Modified: head/lib/msun/src/s_scalbln.c
==
--- head/lib/msun/src/s_scalbln.c   Fri Jan 30 18:55:16 2015
(r277947)
+++ head/lib/msun/src/s_scalbln.c   Fri Jan 30 19:19:03 2015
(r277948)
@@ -35,13 +35,7 @@ scalbln (double x, long n)
 {
int in;
 
-   in = (int)n;
-   if (in != n) {
-   if (n  0)
-   in = INT_MAX;
-   else
-   in = INT_MIN;
-   }
+   in = (n  INT_MAX) ? INT_MAX : (n  INT_MIN) ? INT_MIN : n;
return (scalbn(x, in));
 }
 
@@ -50,13 +44,7 @@ scalblnf (float x, long n)
 {
int in;
 
-   in = (int)n;
-   if (in != n) {
-   if (n  0)
-   in = INT_MAX;
-   else
-   in = INT_MIN;
-   }
+   in = (n  INT_MAX) ? INT_MAX : (n  INT_MIN) ? INT_MIN : n;
return (scalbnf(x, in));
 }
 
@@ -65,12 +53,6 @@ scalblnl (long double x, long n)
 {
int in;
 
-   in = (int)n;
-   if (in != n) {
-   if (n  0)
-   in = INT_MAX;
-   else
-   in = INT_MIN;
-   }
-   return (scalbnl(x, (int)n));
+   in = (n  INT_MAX) ? INT_MAX : (n  INT_MIN) ? INT_MIN : n; 
+   return (scalbnl(x, in));
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r277908 - head/share/man/man9

2015-01-30 Thread Ed Maste
On 29 January 2015 at 22:34, Benjamin Kaduk bjkf...@gmail.com wrote:

 Wouldn't it be like a two-line patch to change contigfree(9) to permit NULL
 as an argument?

It would.

 Would it be better to do that?

Perhaps, although contigmalloc / contigfree have a smallish set of
distinct use cases and existing code does not expect it can pass NULL.
I didn't want to add the test just for consistency with free().
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277939 - head/usr.bin/grep

2015-01-30 Thread Garrett Cooper
Author: ngie
Date: Fri Jan 30 18:07:46 2015
New Revision: 277939
URL: https://svnweb.freebsd.org/changeset/base/277939

Log:
  Create MANLINKS for lzgrep, etc when MK_LZMA_SUPPORT != no
  
  MFC after: 3 days
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/usr.bin/grep/Makefile

Modified: head/usr.bin/grep/Makefile
==
--- head/usr.bin/grep/Makefile  Fri Jan 30 17:29:07 2015(r277938)
+++ head/usr.bin/grep/Makefile  Fri Jan 30 18:07:46 2015(r277939)
@@ -31,13 +31,7 @@ MLINKS= grep.1 egrep.1 \
grep.1 fgrep.1 \
grep.1 zgrep.1 \
grep.1 zegrep.1 \
-   grep.1 zfgrep.1 \
-   grep.1 xzgrep.1 \
-   grep.1 xzegrep.1 \
-   grep.1 xzfgrep.1 \
-   grep.1 lzgrep.1 \
-   grep.1 lzegrep.1 \
-   grep.1 lzfgrep.1
+   grep.1 zfgrep.1
 .endif
 
 LIBADD=z
@@ -51,6 +45,13 @@ LINKS+=  ${BINDIR}/${PROG} ${BINDIR}/xzgr
${BINDIR}/${PROG} ${BINDIR}/lzgrep \
${BINDIR}/${PROG} ${BINDIR}/lzegrep \
${BINDIR}/${PROG} ${BINDIR}/lzfgrep
+
+MLINKS+= grep.1 xzgrep.1 \
+grep.1 xzegrep.1 \
+grep.1 xzfgrep.1 \
+grep.1 lzgrep.1 \
+grep.1 lzegrep.1 \
+grep.1 lzfgrep.1
 .else
 CFLAGS+= -DWITHOUT_LZMA
 .endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277949 - head/sys/boot/i386/libi386

2015-01-30 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Fri Jan 30 19:47:25 2015
New Revision: 277949
URL: https://svnweb.freebsd.org/changeset/base/277949

Log:
  New function smbios_match to detect BIOS versions during boot
  
  Motivation is to introduce BIOS specific quirks early in the boot
  process. smbios_match can be called before malloc is avaible, that's
  why parts of smbios_detect have been moved into a separate function
  smbios_probe that will be called by smbios_detect as well as
  smbios_match.
  
  Reviewed by:  jhb
  Approved by:  jhb
  Differential Revision:https://reviews.freebsd.org/D1679

Modified:
  head/sys/boot/i386/libi386/libi386.h
  head/sys/boot/i386/libi386/smbios.c

Modified: head/sys/boot/i386/libi386/libi386.h
==
--- head/sys/boot/i386/libi386/libi386.hFri Jan 30 19:19:03 2015
(r277948)
+++ head/sys/boot/i386/libi386/libi386.hFri Jan 30 19:47:25 2015
(r277949)
@@ -114,6 +114,8 @@ uint32_t biospci_locator(int8_t bus, uin
 void   biosacpi_detect(void);
 
 void   smbios_detect(void);
+intsmbios_match(const char* bios_vendor, const char* maker,
+   const char* product);
 
 inti386_autoload(void);
 

Modified: head/sys/boot/i386/libi386/smbios.c
==
--- head/sys/boot/i386/libi386/smbios.c Fri Jan 30 19:19:03 2015
(r277948)
+++ head/sys/boot/i386/libi386/smbios.c Fri Jan 30 19:47:25 2015
(r277949)
@@ -64,10 +64,24 @@ __FBSDID($FreeBSD$);
 #defineSMBIOS_GETLEN(base) SMBIOS_GET8(base, 0x01)
 #defineSMBIOS_GETSTR(base) ((base) + SMBIOS_GETLEN(base))
 
-static uint32_tsmbios_enabled_memory = 0;
-static uint32_tsmbios_old_enabled_memory = 0;
-static uint8_t smbios_enabled_sockets = 0;
-static uint8_t smbios_populated_sockets = 0;
+struct smbios_attr {
+   int probed;
+   caddr_t addr;
+   size_t  length;
+   size_t  count;
+   int major;
+   int minor;
+   int ver;
+   const char* bios_vendor;
+   const char* maker;
+   const char* product;
+   uint32_tenabled_memory;
+   uint32_told_enabled_memory;
+   uint8_t enabled_sockets;
+   uint8_t populated_sockets;
+};
+
+static struct smbios_attr smbios;
 
 static uint8_t
 smbios_checksum(const caddr_t addr, const uint8_t len)
@@ -95,8 +109,8 @@ smbios_sigsearch(const caddr_t addr, con
return (NULL);
 }
 
-static void
-smbios_setenv(const char *name, caddr_t addr, const int offset)
+static const char*
+smbios_getstring(caddr_t addr, const int offset)
 {
caddr_t cp;
int i, idx;
@@ -106,8 +120,19 @@ smbios_setenv(const char *name, caddr_t 
cp = SMBIOS_GETSTR(addr);
for (i = 1; i  idx; i++)
cp += strlen(cp) + 1;
-   setenv(name, cp, 1);
+   return cp;
}
+   return (NULL);
+}
+
+static void
+smbios_setenv(const char *name, caddr_t addr, const int offset)
+{
+   const char* val;
+
+   val = smbios_getstring(addr, offset);
+   if (val != NULL)
+   setenv(name, val, 1);
 }
 
 #ifdef SMBIOS_SERIAL_NUMBERS
@@ -187,7 +212,7 @@ smbios_setuuid(const char *name, const c
 #endif
 
 static caddr_t
-smbios_parse_table(const caddr_t addr, const int ver)
+smbios_parse_table(const caddr_t addr)
 {
caddr_t cp;
int proc, size, osize, type;
@@ -206,7 +231,7 @@ smbios_parse_table(const caddr_t addr, c
smbios_setenv(smbios.system.version, addr, 0x06);
 #ifdef SMBIOS_SERIAL_NUMBERS
smbios_setenv(smbios.system.serial, addr, 0x07);
-   smbios_setuuid(smbios.system.uuid, addr + 0x08, ver);
+   smbios_setuuid(smbios.system.uuid, addr + 0x08, smbios.ver);
 #endif
break;
 
@@ -248,9 +273,9 @@ smbios_parse_table(const caddr_t addr, c
 */
proc = SMBIOS_GET8(addr, 0x18);
if ((proc  0x07) == 1)
-   smbios_enabled_sockets++;
+   smbios.enabled_sockets++;
if ((proc  0x40) != 0)
-   smbios_populated_sockets++;
+   smbios.populated_sockets++;
break;
 
case 6: /* 3.3.7 Memory Module Information (Type 6, Obsolete) */
@@ -268,7 +293,7 @@ smbios_parse_table(const caddr_t addr, c
 */
osize = SMBIOS_GET8(addr, 0x0a)  0x7f;
if (osize  0  osize  22)
-   smbios_old_enabled_memory += 1  (osize + 10);
+   smbios.old_enabled_memory += 1  (osize + 10);
break;
 
case 17:/* 3.3.18 Memory Device (Type 17) */
@@ -282,7 +307,7 

svn commit: r277942 - head/share/misc

2015-01-30 Thread Eric Joyner
Author: erj
Date: Fri Jan 30 18:19:22 2015
New Revision: 277942
URL: https://svnweb.freebsd.org/changeset/base/277942

Log:
  Add myself (erj) to committers-src.dot.
  
  Approved by:  gnn (mentor), jfv (mentor)

Modified:
  head/share/misc/committers-src.dot

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Fri Jan 30 18:18:09 2015
(r277941)
+++ head/share/misc/committers-src.dot  Fri Jan 30 18:19:22 2015
(r277942)
@@ -153,6 +153,7 @@ eivind [label=Eivind Eklund\neivind@Fre
 emaste [label=Ed Maste\nema...@freebsd.org\n2005/10/04]
 emax [label=Maksim Yevmenkin\ne...@freebsd.org\n2003/10/12]
 eri [label=Ermal Luci\n...@freebsd.org\n2008/06/11]
+erj [label=Eric Joyner\n...@freebsd.org\n2014/12/14]
 fabient [label=Fabien Thomas\nfabi...@freebsd.org\n2009/03/16]
 fanf [label=Tony Finch\nf...@freebsd.org\n2002/05/05]
 fjoe [label=Max Khon\nf...@freebsd.org\n2001/08/06]
@@ -440,6 +441,7 @@ gnn - lstewart
 gnn - np
 gnn - davide
 gnn - arybchik
+gnn - erj
 
 grehan - bryanv
 
@@ -485,6 +487,8 @@ jb - sson
 
 jdp - fjoe
 
+jfv - erj
+
 jhb - arr
 jhb - avg
 jhb - jch
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277943 - head/sys/boot/efi/libefi

2015-01-30 Thread Doug Ambrisko
Author: ambrisko
Date: Fri Jan 30 18:25:53 2015
New Revision: 277943
URL: https://svnweb.freebsd.org/changeset/base/277943

Log:
  Fix UEFI PXE boot on a NIC that isn't the first NIC.
  
  In UEFI it appears all available NICS are present to pass network traffic.
  This gives the capability to load the loader.efi from disk then set
  currdev=net3: and then all I/O will over over the 2nd NIC.  On this
  machine is appears the first handle is the first NIC in IPv4 mode and
  then the 2nd handle is the first NIC in IPv6 mode.  The 3rd handle is
  the 2nd NIC in IPv4 mode.  The fix is to index into the handle based
  on the unit cached from boot device passed into the loader.
  
  Some testing info from a test boot via kenv:
currdev=net3:
loaddev=net3:
boot.netif.name=igb1

Modified:
  head/sys/boot/efi/libefi/efinet.c

Modified: head/sys/boot/efi/libefi/efinet.c
==
--- head/sys/boot/efi/libefi/efinet.c   Fri Jan 30 18:19:22 2015
(r277942)
+++ head/sys/boot/efi/libefi/efinet.c   Fri Jan 30 18:25:53 2015
(r277943)
@@ -99,8 +99,11 @@ dump_mode(EFI_SIMPLE_NETWORK_MODE *mode)
 static int
 efinet_match(struct netif *nif, void *machdep_hint)
 {
+   struct devdesc *dev = machdep_hint;
 
-   return (1);
+   if (dev-d_unit - 1 == nif-nif_unit)
+   return (1);
+   return(0);
 }
 
 static int
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277944 - head/contrib/libcxxrt

2015-01-30 Thread Dimitry Andric
Author: dim
Date: Fri Jan 30 18:26:38 2015
New Revision: 277944
URL: https://svnweb.freebsd.org/changeset/base/277944

Log:
  Partially revert r273382, to reduce diffs against upstream.  This was a
  temporary fix to solve a conflict with an older version of libc++, and
  it is no longer relevant.
  
  MFC after:3 days

Modified:
  head/contrib/libcxxrt/stdexcept.cc

Modified: head/contrib/libcxxrt/stdexcept.cc
==
--- head/contrib/libcxxrt/stdexcept.cc  Fri Jan 30 18:25:53 2015
(r277943)
+++ head/contrib/libcxxrt/stdexcept.cc  Fri Jan 30 18:26:38 2015
(r277944)
@@ -82,19 +82,14 @@ const char* bad_typeid::what() const thr
return std::bad_typeid;
 }
 
-__attribute__((weak))
 bad_array_new_length::bad_array_new_length() throw() {}
-__attribute__((weak))
 bad_array_new_length::~bad_array_new_length() {}
-__attribute__((weak))
 bad_array_new_length::bad_array_new_length(const bad_array_new_length) 
throw() {}
-__attribute__((weak))
 bad_array_new_length bad_array_new_length::operator=(const 
bad_array_new_length) throw()
 {
return *this;
 }
 
-__attribute__((weak))
 const char* bad_array_new_length::what() const throw()
 {
return std::bad_array_new_length;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277959 - head/sys/dev/drm2/i915

2015-01-30 Thread Adrian Chadd
Author: adrian
Date: Sat Jan 31 02:13:25 2015
New Revision: 277959
URL: https://svnweb.freebsd.org/changeset/base/277959

Log:
  Fix backlight for ivybridge based laptops (and whatever else comes through
  this codepath.)
  
  (130) is documented as BLM_PCH_OVERRIDE_ENABLE, which the current
  i915 driver in Linux only sets for broadwell chips.
  
  This fixes the backlight control on the Lenovo X230.
  
  Approved by:  kib
  Obtained from:Linux 7aa1e7f06d6ea1bce3b27630d50769d13da28b1a

Modified:
  head/sys/dev/drm2/i915/intel_display.c

Modified: head/sys/dev/drm2/i915/intel_display.c
==
--- head/sys/dev/drm2/i915/intel_display.c  Sat Jan 31 02:12:57 2015
(r277958)
+++ head/sys/dev/drm2/i915/intel_display.c  Sat Jan 31 02:13:25 2015
(r277959)
@@ -6995,7 +6995,7 @@ static void ivb_pch_pwm_override(struct 
 */
I915_WRITE(BLC_PWM_CPU_CTL2, PWM_ENABLE);
I915_WRITE(BLC_PWM_CPU_CTL, 0);
-   I915_WRITE(BLC_PWM_PCH_CTL1, PWM_ENABLE | (130));
+   I915_WRITE(BLC_PWM_PCH_CTL1, PWM_ENABLE);
 }
 
 void intel_modeset_init_hw(struct drm_device *dev)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277958 - head/sys/arm/ti

2015-01-30 Thread Rui Paulo
Author: rpaulo
Date: Sat Jan 31 02:12:57 2015
New Revision: 277958
URL: https://svnweb.freebsd.org/changeset/base/277958

Log:
  ti_pruss: make sure the mmap'ed memory region is uncacheable.
  
  MFC after:1 week

Modified:
  head/sys/arm/ti/ti_pruss.c

Modified: head/sys/arm/ti/ti_pruss.c
==
--- head/sys/arm/ti/ti_pruss.c  Sat Jan 31 00:06:05 2015(r277957)
+++ head/sys/arm/ti/ti_pruss.c  Sat Jan 31 02:12:57 2015(r277958)
@@ -258,6 +258,7 @@ ti_pruss_mmap(struct cdev *cdev, vm_ooff
if (offset  rman_get_size(sc-sc_mem_res))
return (-1);
*paddr = rman_get_start(sc-sc_mem_res) + offset;
+   *memattr = VM_MEMATTR_UNCACHEABLE;
 
return (0);
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277960 - head/sys/sys

2015-01-30 Thread John Baldwin
Author: jhb
Date: Sat Jan 31 02:15:16 2015
New Revision: 277960
URL: https://svnweb.freebsd.org/changeset/base/277960

Log:
  Add a WITNESS_WARN check to STOPEVENT() to match the one in _STOPEVENT().

Modified:
  head/sys/sys/proc.h

Modified: head/sys/sys/proc.h
==
--- head/sys/sys/proc.h Sat Jan 31 02:13:25 2015(r277959)
+++ head/sys/sys/proc.h Sat Jan 31 02:15:16 2015(r277960)
@@ -752,6 +752,8 @@ extern pid_t pid_max;
 
 
 #defineSTOPEVENT(p, e, v) do { 
\
+   WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, \
+   checking stopevent %d, (e));  \
if ((p)-p_stops  (e)) {   \
PROC_LOCK(p);   \
stopevent((p), (e), (v));   \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277957 - head/sys/boot/i386/libi386

2015-01-30 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Sat Jan 31 00:06:05 2015
New Revision: 277957
URL: https://svnweb.freebsd.org/changeset/base/277957

Log:
  Fix order of functions in smbios.c (corrects r277949), since this corrects
  a build error I committed this directly, sorry.

Modified:
  head/sys/boot/i386/libi386/smbios.c

Modified: head/sys/boot/i386/libi386/smbios.c
==
--- head/sys/boot/i386/libi386/smbios.c Fri Jan 30 23:57:39 2015
(r277956)
+++ head/sys/boot/i386/libi386/smbios.c Sat Jan 31 00:06:05 2015
(r277957)
@@ -323,6 +323,29 @@ smbios_parse_table(const caddr_t addr)
return (cp + 2);
 }
 
+static caddr_t
+smbios_find_struct(int type)
+{
+   caddr_t dmi;
+   int i;
+
+   if (smbios.addr == NULL)
+   return (NULL);
+
+   for (dmi = smbios.addr, i = 0;
+dmi  smbios.addr + smbios.length  i  smbios.count; i++) {
+   if (SMBIOS_GET8(dmi, 0) == type)
+   return dmi;
+   /* Find structure terminator. */
+   dmi = SMBIOS_GETSTR(dmi);
+   while (SMBIOS_GET16(dmi, 0) != 0)
+   dmi++;
+   dmi += 2;
+   }
+
+   return (NULL);
+}
+
 static void
 smbios_probe(void)
 {
@@ -368,29 +391,6 @@ smbios_probe(void)
}
 }
 
-static caddr_t
-smbios_find_struct(int type)
-{
-   caddr_t dmi;
-   int i;
-
-   if (smbios.addr == NULL)
-   return (NULL);
-
-   for (dmi = smbios.addr, i = 0;
-dmi  smbios.addr + smbios.length  i  smbios.count; i++) {
-   if (SMBIOS_GET8(dmi, 0) == type)
-   return dmi;
-   /* Find structure terminator. */
-   dmi = SMBIOS_GETSTR(dmi);
-   while (SMBIOS_GET16(dmi, 0) != 0)
-   dmi++;
-   dmi += 2;
-   }
-
-   return (NULL);
-}
-
 void
 smbios_detect(void)
 {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277961 - head/lib/libproc

2015-01-30 Thread Mark Johnston
Author: markj
Date: Sat Jan 31 03:22:00 2015
New Revision: 277961
URL: https://svnweb.freebsd.org/changeset/base/277961

Log:
  Stop iterating and return if the caller-supplied callback function returns
  a non-zero value.
  
  MFC after:1 week

Modified:
  head/lib/libproc/proc_sym.c

Modified: head/lib/libproc/proc_sym.c
==
--- head/lib/libproc/proc_sym.c Sat Jan 31 02:15:16 2015(r277960)
+++ head/lib/libproc/proc_sym.c Sat Jan 31 03:22:00 2015(r277961)
@@ -153,9 +153,12 @@ proc_iter_objs(struct proc_handle *p, pr
prmap_t map;
char path[MAXPATHLEN];
char last[MAXPATHLEN];
+   int error;
 
if (p-nobjs == 0)
return (-1);
+
+   error = 0;
memset(last, 0, sizeof(last));
for (i = 0; i  p-nobjs; i++) {
rdl = p-rdobjs[i];
@@ -169,11 +172,11 @@ proc_iter_objs(struct proc_handle *p, pr
 */
if (strcmp(path, last) == 0)
continue;
-   (*func)(cd, map, path);
+   if ((error = (*func)(cd, map, path)) != 0)
+   break;
strlcpy(last, path, sizeof(last));
}
-
-   return (0);
+   return (error);
 }
 
 prmap_t *
@@ -599,7 +602,8 @@ proc_iter_symbyaddr(struct proc_handle *
s = elf_strptr(e, stridx, sym.st_name);
if (ehdr.e_type != ET_EXEC)
sym.st_value += map-pr_vaddr;
-   (*func)(cd, sym, s);
+   if ((error = (*func)(cd, sym, s)) != 0)
+   goto err2;
}
error = 0;
 err2:
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277963 - in head/sys: cam/ctl conf dev/iscsi modules/ctl modules/iscsi

2015-01-30 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Jan 31 07:49:50 2015
New Revision: 277963
URL: https://svnweb.freebsd.org/changeset/base/277963

Log:
  Add kobj interface between ICL and the rest of the iSCSI stack.
  Review note - icl.c was moved to icl_soft.c.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Added:
  head/sys/dev/iscsi/icl_soft.c
 - copied, changed from r277931, head/sys/dev/iscsi/icl.c
Replaced:
  head/sys/dev/iscsi/icl.c   (contents, props changed)
Modified:
  head/sys/cam/ctl/ctl_frontend_iscsi.c
  head/sys/conf/files
  head/sys/dev/iscsi/icl.h
  head/sys/dev/iscsi/iscsi.c
  head/sys/modules/ctl/Makefile
  head/sys/modules/iscsi/Makefile

Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c
==
--- head/sys/cam/ctl/ctl_frontend_iscsi.c   Sat Jan 31 07:22:29 2015
(r277962)
+++ head/sys/cam/ctl/ctl_frontend_iscsi.c   Sat Jan 31 07:49:50 2015
(r277963)
@@ -68,6 +68,7 @@ __FBSDID($FreeBSD$);
 #include cam/ctl/ctl_private.h
 
 #include dev/iscsi/icl.h
+#include dev/iscsi/icl_wrappers.h
 #include dev/iscsi/iscsi_proto.h
 #include cam/ctl/ctl_frontend_iscsi.h
 
@@ -1241,7 +1242,7 @@ cfiscsi_session_new(struct cfiscsi_softc
cv_init(cs-cs_login_cv, cfiscsi_login);
 #endif
 
-   cs-cs_conn = icl_conn_new(cfiscsi, cs-cs_lock);
+   cs-cs_conn = icl_new_conn(NULL, cfiscsi, cs-cs_lock);
cs-cs_conn-ic_receive = cfiscsi_receive_callback;
cs-cs_conn-ic_error = cfiscsi_error_callback;
cs-cs_conn-ic_prv0 = cs;
@@ -2013,6 +2014,7 @@ cfiscsi_ioctl_port_create(struct ctl_req
return;
}
port = ct-ct_port;
+   // WAT
if (ct-ct_state == CFISCSI_TARGET_STATE_DYING)
goto done;
 

Modified: head/sys/conf/files
==
--- head/sys/conf/files Sat Jan 31 07:22:29 2015(r277962)
+++ head/sys/conf/files Sat Jan 31 07:49:50 2015(r277963)
@@ -1521,6 +1521,7 @@ ipw_monitor.fwoptional ipwmonitorfw |
clean   ipw_monitor.fw
 dev/iscsi/icl.coptional iscsi | ctl 
 dev/iscsi/icl_proxy.c  optional iscsi | ctl
+dev/iscsi/icl_soft.c   optional iscsi | ctl 
 dev/iscsi/iscsi.c  optional iscsi scbus
 dev/iscsi_initiator/iscsi.coptional iscsi_initiator scbus
 dev/iscsi_initiator/iscsi_subr.c   optional iscsi_initiator scbus

Added: head/sys/dev/iscsi/icl.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/iscsi/icl.cSat Jan 31 07:49:50 2015(r277963)
@@ -0,0 +1,247 @@
+/*-
+ * Copyright (c) 2012 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Edward Tomasz Napierala under sponsorship
+ * from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/*
+ * iSCSI Common Layer.  It's used by both the initiator and target to send
+ * and receive iSCSI PDUs.
+ */
+
+#include sys/cdefs.h
+__FBSDID($FreeBSD$);
+
+#include sys/param.h
+#include sys/condvar.h
+#include sys/conf.h
+#include sys/lock.h
+#include sys/kernel.h
+#include sys/malloc.h
+#include sys/mutex.h
+#include sys/module.h
+#include sys/queue.h
+#include sys/sysctl.h
+#include sys/systm.h
+#include sys/sx.h
+
+#include dev/iscsi/icl.h
+#include icl_conn_if.h
+
+struct icl_module {
+   TAILQ_ENTRY(icl_module) im_next;
+   char*im_name;
+   int im_priority;
+   int 

svn commit: r277962 - head/sys/boot/common

2015-01-30 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Sat Jan 31 07:22:29 2015
New Revision: 277962
URL: https://svnweb.freebsd.org/changeset/base/277962

Log:
  Add support for booting relocatable kernels on PowerPC.

Modified:
  head/sys/boot/common/load_elf.c

Modified: head/sys/boot/common/load_elf.c
==
--- head/sys/boot/common/load_elf.c Sat Jan 31 03:22:00 2015
(r277961)
+++ head/sys/boot/common/load_elf.c Sat Jan 31 07:22:29 2015
(r277962)
@@ -175,7 +175,33 @@ __elfN(loadfile_raw)(char *filename, u_i
  * Check to see what sort of module we are.
  */
 kfp = file_findfile(NULL, __elfN(kerneltype));
-if (ehdr-e_type == ET_DYN) {
+#ifdef __powerpc__
+/*
+ * Kernels can be ET_DYN, so just assume the first loaded object is the
+ * kernel. This assumption will be checked later.
+ */
+if (kfp == NULL)
+ef.kernel = 1;
+#endif
+if (ef.kernel || ehdr-e_type == ET_EXEC) {
+   /* Looks like a kernel */
+   if (kfp != NULL) {
+   printf(elf __XSTRING(__ELF_WORD_SIZE) _loadfile: kernel already 
loaded\n);
+   err = EPERM;
+   goto oerr;
+   }
+   /* 
+* Calculate destination address based on kernel entrypoint 
+*/
+   dest = (ehdr-e_entry  ~PAGE_MASK);
+   if (dest == 0) {
+   printf(elf __XSTRING(__ELF_WORD_SIZE) _loadfile: not a kernel 
(maybe static binary?)\n);
+   err = EPERM;
+   goto oerr;
+   }
+   ef.kernel = 1;
+
+} else if (ehdr-e_type == ET_DYN) {
/* Looks like a kld module */
if (multiboot != 0) {
printf(elf __XSTRING(__ELF_WORD_SIZE) _loadfile: can't load 
module as multiboot\n);
@@ -195,24 +221,6 @@ __elfN(loadfile_raw)(char *filename, u_i
/* Looks OK, got ahead */
ef.kernel = 0;
 
-} else if (ehdr-e_type == ET_EXEC) {
-   /* Looks like a kernel */
-   if (kfp != NULL) {
-   printf(elf __XSTRING(__ELF_WORD_SIZE) _loadfile: kernel already 
loaded\n);
-   err = EPERM;
-   goto oerr;
-   }
-   /* 
-* Calculate destination address based on kernel entrypoint 
-*/
-   dest = (ehdr-e_entry  ~PAGE_MASK);
-   if (dest == 0) {
-   printf(elf __XSTRING(__ELF_WORD_SIZE) _loadfile: not a kernel 
(maybe static binary?)\n);
-   err = EPERM;
-   goto oerr;
-   }
-   ef.kernel = 1;
-
 } else {
err = EFTYPE;
goto oerr;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277954 - head/games/fortune/fortune

2015-01-30 Thread Colin Percival
Author: cperciva
Date: Fri Jan 30 23:26:03 2015
New Revision: 277954
URL: https://svnweb.freebsd.org/changeset/base/277954

Log:
  Fix 7-year-old typo: The default directory searched for fortunes is
  /usr/share/games/fortune, not /usr/games/fortune (which is the path
  to the fortune binary itself).

Modified:
  head/games/fortune/fortune/fortune.6

Modified: head/games/fortune/fortune/fortune.6
==
--- head/games/fortune/fortune/fortune.6Fri Jan 30 22:02:32 2015
(r277953)
+++ head/games/fortune/fortune/fortune.6Fri Jan 30 23:26:03 2015
(r277954)
@@ -168,7 +168,7 @@ It is a colon-separated list of director
 .Nm
 looks for data files.
 If not set it will default to
-.Pa /usr/games/fortune .
+.Pa /usr/share/games/fortune .
 If none of the directories specified exist, it will print a warning and exit.
 .It Ev FORTUNE_SAVESTATE
 If set, fortune will save some state about what fortune
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277928 - head/sys/dev/ofw

2015-01-30 Thread Luiz Otavio O Souza
Author: loos
Date: Fri Jan 30 14:09:07 2015
New Revision: 277928
URL: https://svnweb.freebsd.org/changeset/base/277928

Log:
  Do not leak the OFW memory when the result does not satisfy our alignment
  requirement.
  
  While here, fix style(9) issues.

Modified:
  head/sys/dev/ofw/openfirm.c

Modified: head/sys/dev/ofw/openfirm.c
==
--- head/sys/dev/ofw/openfirm.c Fri Jan 30 13:03:36 2015(r277927)
+++ head/sys/dev/ofw/openfirm.c Fri Jan 30 14:09:07 2015(r277928)
@@ -459,11 +459,16 @@ OF_getencprop_alloc(phandle_t package, c
int i;
 
retval = OF_getprop_alloc(package, name, elsz, buf);
-   if (retval == -1 || retval*elsz % 4 != 0)
+   if (retval == -1)
return (-1);
+   if (retval * elsz % 4 != 0) {
+   free(*buf, M_OFWPROP);
+   *buf = NULL;
+   return (-1);
+   }
 
cell = *buf;
-   for (i = 0; i  retval*elsz/4; i++)
+   for (i = 0; i  retval * elsz / 4; i++)
cell[i] = be32toh(cell[i]);
 
return (retval);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277932 - head/sys/arm/broadcom/bcm2835

2015-01-30 Thread Luiz Otavio O Souza
Author: loos
Date: Fri Jan 30 14:35:04 2015
New Revision: 277932
URL: https://svnweb.freebsd.org/changeset/base/277932

Log:
  Allow the retrieving of the reserved pins state.
  
  With this change, it is now possible to verify the pin function and level
  of reserved pins (but not set them).
  
  The use of reserved pins on Raspberry pi can lead to short circuits and
  real damage to the SoC.
  
  While here, remove duplicated code, make use of OF_getencprop_alloc()
  instead of using fixed sized variables and reduce the dmesg spam by
  printing reserved pin ranges (when possible) instead of printing each pin
  in the range.

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_gpio.cFri Jan 30 14:22:15 
2015(r277931)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_gpio.cFri Jan 30 14:35:04 
2015(r277932)
@@ -494,39 +494,6 @@ bcm_gpio_pin_toggle(device_t dev, uint32
 }
 
 static int
-bcm_gpio_get_ro_pins(struct bcm_gpio_softc *sc)
-{
-   int i, len;
-   pcell_t pins[BCM_GPIO_PINS];
-   phandle_t gpio;
-
-   /* Find the gpio node to start. */
-   gpio = ofw_bus_get_node(sc-sc_dev);
-
-   len = OF_getproplen(gpio, broadcom,read-only);
-   if (len  0 || len  sizeof(pins))
-   return (-1);
-
-   if (OF_getprop(gpio, broadcom,read-only, pins, len)  0)
-   return (-1);
-
-   sc-sc_ro_npins = len / sizeof(pcell_t);
-
-   device_printf(sc-sc_dev, read-only pins: );
-   for (i = 0; i  sc-sc_ro_npins; i++) {
-   sc-sc_ro_pins[i] = fdt32_to_cpu(pins[i]);
-   if (i  0)
-   printf(,);
-   printf(%d, sc-sc_ro_pins[i]);
-   }
-   if (i  0)
-   printf(.);
-   printf(\n);
-
-   return (0);
-}
-
-static int
 bcm_gpio_func_proc(SYSCTL_HANDLER_ARGS)
 {
char buf[16];
@@ -545,7 +512,9 @@ bcm_gpio_func_proc(SYSCTL_HANDLER_ARGS)
error = sysctl_handle_string(oidp, buf, sizeof(buf), req);
if (error != 0 || req-newptr == NULL)
return (error);
-
+   /* Ignore changes on read-only pins. */
+   if (bcm_gpio_pin_is_ro(sc, sc_sysctl-pin))
+   return (0);
/* Parse the user supplied string and check for a valid pin function. */
if (bcm_gpio_str_func(buf, nfunc) != 0)
return (EINVAL);
@@ -595,63 +564,82 @@ bcm_gpio_sysctl_init(struct bcm_gpio_sof
 }
 
 static int
+bcm_gpio_get_ro_pins(struct bcm_gpio_softc *sc, phandle_t node,
+   const char *propname, const char *label)
+{
+   int i, need_comma, npins, range_start, range_stop;
+   pcell_t *pins;
+
+   /* Get the property data. */
+   npins = OF_getencprop_alloc(node, propname, sizeof(*pins),
+   (void **)pins);
+   if (npins  0)
+   return (-1);
+   if (npins == 0) {
+   free(pins, M_OFWPROP);
+   return (0);
+   }
+   for (i = 0; i  npins; i++)
+   sc-sc_ro_pins[i + sc-sc_ro_npins] = pins[i];
+   sc-sc_ro_npins += npins;
+   need_comma = 0;
+   device_printf(sc-sc_dev, %s pins: , label);
+   range_start = range_stop = pins[0];
+   for (i = 1; i  npins; i++) {
+   if (pins[i] != range_stop + 1) {
+   if (need_comma)
+   printf(,);
+   if (range_start != range_stop)
+   printf(%d-%d, range_start, range_stop);
+   else
+   printf(%d, range_start);
+   range_start = range_stop = pins[i];
+   need_comma = 1;
+   } else
+   range_stop++;
+   }
+   if (need_comma)
+   printf(,);
+   if (range_start != range_stop)
+   printf(%d-%d.\n, range_start, range_stop);
+   else
+   printf(%d.\n, range_start);
+   free(pins, M_OFWPROP);
+
+   return (0);
+}
+
+static int
 bcm_gpio_get_reserved_pins(struct bcm_gpio_softc *sc)
 {
-   int i, j, len, npins;
-   pcell_t pins[BCM_GPIO_PINS];
+   char *name;
phandle_t gpio, node, reserved;
-   char name[32];
+   ssize_t len;
 
/* Get read-only pins. */
-   if (bcm_gpio_get_ro_pins(sc) != 0)
-   return (-1);
-
-   /* Find the gpio/reserved pins node to start. */
gpio = ofw_bus_get_node(sc-sc_dev);
-   node = OF_child(gpio);
-   
-   /*
-* Find reserved node
-*/
+   if (bcm_gpio_get_ro_pins(sc, gpio, broadcom,read-only,
+   read-only) != 0)
+   return (-1);
+   /* Traverse the GPIO subnodes to find the reserved pins node. */
reserved = 0;
+   node = OF_child(gpio);
while ((node != 0)  

Re: svn commit: r277900 - head/sys/x86/x86

2015-01-30 Thread John Baldwin
On 1/29/15 10:51 PM, Ryan Stone wrote:
 On Thu, Jan 29, 2015 at 3:45 PM, John Baldwin j...@freebsd.org wrote:
 Also, note that we always use the TSC as the cpu ticker, even if it is not 
 the
 timecounter.  Thus, if C2+ is enabled on the systems, the kernel idle threads
 will have an artificially low runtime since their idle time is not properly
 accounted for.  This does not affect any other threads as only the idle
 threads run while the CPU is in C2+ with the TSC effectively paused.  The
 new default means that the idle threads will now have the proper runtime,
 however.
 
 However in a VM environment this means that runtimes for all threads
 can be very wrong (regardless of whether we enter C2 or lower or not).
 I have a coworker looking at using kvmclock in preference to TSC for
 the cpu ticker when the kvmclock is available.

I think that is orthogonal to older Core 2 CPUs which the above mail was
about. :)  However, yes, that sounds sensible.  You might want to talk
to bryanv@.  He has a branch in projects (projects/paravirt I think?)
that provides a framework for hypervisor drivers that would be a good
place to plug this into.

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


svn commit: r277921 - head/lib/libnv

2015-01-30 Thread Pawel Jakub Dawidek
Author: pjd
Date: Fri Jan 30 10:08:38 2015
New Revision: 277921
URL: https://svnweb.freebsd.org/changeset/base/277921

Log:
  Modify nvlist_get_parent() API to take additional cookie argument.
  This allow for non-recursive iteration over nested nvlists, as in documented
  example.
  
  Submitted by: Mariusz Zaborski osho...@freebsd.org

Modified:
  head/lib/libnv/nv.3
  head/lib/libnv/nv.h
  head/lib/libnv/nvlist.c

Modified: head/lib/libnv/nv.3
==
--- head/lib/libnv/nv.3 Fri Jan 30 09:44:29 2015(r277920)
+++ head/lib/libnv/nv.3 Fri Jan 30 10:08:38 2015(r277921)
@@ -28,7 +28,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd September 25, 2014
+.Dd January 30, 2015
 .Dt NV 3
 .Os
 .Sh NAME
@@ -151,7 +151,7 @@
 .Ft const void *
 .Fn nvlist_get_binary const nvlist_t *nvl const char *name size_t *sizep
 .Ft const nvlist_t *
-.Fn nvlist_get_parent const nvlist_t *nvl
+.Fn nvlist_get_parent const nvlist_t *nvl void **cookiep
 .\
 .Ft bool
 .Fn nvlist_take_bool nvlist_t *nvl const char *name
@@ -588,6 +588,28 @@ while ((name = nvlist_next(nvl, type, 
printf(\\n);
 }
 .Ed
+.Pp
+Iterating over every nested nvlist:
+.Bd -literal
+nvlist_t *nvl;
+const char *name;
+void *cookie;
+int type;
+
+nvl = nvlist_recv(sock);
+if (nvl == NULL)
+   err(1, nvlist_recv() failed);
+
+cookie = NULL;
+do {
+   while ((name = nvlist_next(nvl, type, cookie)) != NULL) {
+   if (type == NV_TYPE_NVLIST) {
+   nvl = nvlist_get_nvlist(nvl, name);
+   cookie = NULL;
+   }
+   }
+} while ((nvl = nvlist_get_parent(nvl, cookie)) != NULL);
+.Ed
 .Sh SEE ALSO
 .Xr close 2 ,
 .Xr dup 2 ,

Modified: head/lib/libnv/nv.h
==
--- head/lib/libnv/nv.h Fri Jan 30 09:44:29 2015(r277920)
+++ head/lib/libnv/nv.h Fri Jan 30 10:08:38 2015(r277921)
@@ -83,7 +83,7 @@ nvlist_t *nvlist_xfer(int sock, nvlist_t
 
 const char *nvlist_next(const nvlist_t *nvl, int *typep, void **cookiep);
 
-const nvlist_t *nvlist_get_parent(const nvlist_t *nvl);
+const nvlist_t *nvlist_get_parent(const nvlist_t *nvl, void **cookiep);
 
 /*
  * The nvlist_exists functions check if the given name (optionally of the given

Modified: head/lib/libnv/nvlist.c
==
--- head/lib/libnv/nvlist.c Fri Jan 30 09:44:29 2015(r277920)
+++ head/lib/libnv/nvlist.c Fri Jan 30 10:08:38 2015(r277921)
@@ -159,15 +159,19 @@ nvlist_get_nvpair_parent(const nvlist_t 
 }
 
 const nvlist_t *
-nvlist_get_parent(const nvlist_t *nvl)
+nvlist_get_parent(const nvlist_t *nvl, void **cookiep)
 {
+   nvpair_t *nvp;
 
NVLIST_ASSERT(nvl);
 
-   if (nvl-nvl_parent == NULL)
+   nvp = nvl-nvl_parent;
+   if (cookiep != NULL)
+   *cookiep = nvp;
+   if (nvp == NULL)
return (NULL);
 
-   return (nvpair_nvlist(nvl-nvl_parent));
+   return (nvpair_nvlist(nvp));
 }
 
 void
@@ -384,11 +388,10 @@ nvlist_dump(const nvlist_t *nvl, int fd)
dprintf(fd, \n);
nvl = nvpair_get_nvlist(nvp);
if (nvlist_dump_error_check(nvl, fd, level + 1)) {
-   nvl = nvlist_get_parent(nvl);
+   nvl = nvlist_get_parent(nvl, (void **)nvp);
break;
}
-   level += 1;
-   nvp = nvlist_first_nvpair(nvl);
+   level++;
continue;
case NV_TYPE_DESCRIPTOR:
dprintf(fd,  %d\n, nvpair_get_descriptor(nvp));
@@ -411,11 +414,10 @@ nvlist_dump(const nvlist_t *nvl, int fd)
}
 
while ((nvp = nvlist_next_nvpair(nvl, nvp)) == NULL) {
-   nvp = nvlist_get_nvpair_parent(nvl);
-   if (nvp == NULL)
+   nvl = nvlist_get_parent(nvl, (void **)nvp);
+   if (nvl == NULL)
return;
-   nvl = nvlist_get_parent(nvl);
-   level --;
+   level--;
}
}
 }
@@ -457,10 +459,9 @@ nvlist_size(const nvlist_t *nvl)
}
 
while ((nvp = nvlist_next_nvpair(nvl, nvp)) == NULL) {
-   nvp = nvlist_get_nvpair_parent(nvl);
-   if (nvp == NULL)
+   nvl = nvlist_get_parent(nvl, (void **)nvp);
+   if (nvl == NULL)
goto out;
-   nvl = nvlist_get_parent(nvl);
}
}
 
@@ -635,13 +636,12 @@ nvlist_xpack(const nvlist_t *nvl, int64_
return (NULL);
}

svn commit: r277920 - head/lib/libnv

2015-01-30 Thread Pawel Jakub Dawidek
Author: pjd
Date: Fri Jan 30 09:44:29 2015
New Revision: 277920
URL: https://svnweb.freebsd.org/changeset/base/277920

Log:
  If moving descriptor or binary data to an nvlist fails, we need to close the
  descriptor or free the memory before returning.
  
  Submitted by: Mariusz Zaborski osho...@freebsd.org
  
  While here, protect errno, so it won't be overwritted by close(2) or free(3).

Modified:
  head/lib/libnv/nvpair.c

Modified: head/lib/libnv/nvpair.c
==
--- head/lib/libnv/nvpair.c Fri Jan 30 09:05:43 2015(r277919)
+++ head/lib/libnv/nvpair.c Fri Jan 30 09:44:29 2015(r277920)
@@ -1100,6 +1100,7 @@ nvpair_t *
 nvpair_movev_string(char *value, const char *namefmt, va_list nameap)
 {
nvpair_t *nvp;
+   int serrno;
 
if (value == NULL) {
errno = EINVAL;
@@ -1108,8 +1109,11 @@ nvpair_movev_string(char *value, const c
 
nvp = nvpair_allocv(NV_TYPE_STRING, (uint64_t)(uintptr_t)value,
strlen(value) + 1, namefmt, nameap);
-   if (nvp == NULL)
+   if (nvp == NULL) {
+   serrno = errno;
free(value);
+   errno = serrno;
+   }
 
return (nvp);
 }
@@ -1137,28 +1141,46 @@ nvpair_movev_nvlist(nvlist_t *value, con
 nvpair_t *
 nvpair_movev_descriptor(int value, const char *namefmt, va_list nameap)
 {
+   nvpair_t *nvp;
+   int serrno;
 
if (value  0 || !fd_is_valid(value)) {
errno = EBADF;
return (NULL);
}
 
-   return (nvpair_allocv(NV_TYPE_DESCRIPTOR, (uint64_t)value,
-   sizeof(int64_t), namefmt, nameap));
+   nvp = nvpair_allocv(NV_TYPE_DESCRIPTOR, (uint64_t)value,
+   sizeof(int64_t), namefmt, nameap);
+   if (nvp == NULL) {
+   serrno = errno;
+   close(value);
+   errno = serrno;
+   }
+
+   return (nvp);
 }
 
 nvpair_t *
 nvpair_movev_binary(void *value, size_t size, const char *namefmt,
 va_list nameap)
 {
+   nvpair_t *nvp;
+   int serrno;
 
if (value == NULL || size == 0) {
errno = EINVAL;
return (NULL);
}
 
-   return (nvpair_allocv(NV_TYPE_BINARY, (uint64_t)(uintptr_t)value, size,
-   namefmt, nameap));
+   nvp = nvpair_allocv(NV_TYPE_BINARY, (uint64_t)(uintptr_t)value, size,
+   namefmt, nameap);
+   if (nvp == NULL) {
+   serrno = errno;
+   free(value);
+   errno = serrno;
+   }
+
+   return (nvp);
 }
 
 bool
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277927 - head/lib/libnv

2015-01-30 Thread Pawel Jakub Dawidek
Author: pjd
Date: Fri Jan 30 13:03:36 2015
New Revision: 277927
URL: https://svnweb.freebsd.org/changeset/base/277927

Log:
  Make gcc happy.
  
  Reported by:  bz

Modified:
  head/lib/libnv/nvlist.c

Modified: head/lib/libnv/nvlist.c
==
--- head/lib/libnv/nvlist.c Fri Jan 30 12:57:35 2015(r277926)
+++ head/lib/libnv/nvlist.c Fri Jan 30 13:03:36 2015(r277927)
@@ -358,6 +358,7 @@ nvlist_dump(const nvlist_t *nvl, int fd)
 {
const nvlist_t *tmpnvl;
nvpair_t *nvp, *tmpnvp;
+   void *cookie;
int level;
 
level = 0;
@@ -419,9 +420,11 @@ nvlist_dump(const nvlist_t *nvl, int fd)
}
 
while ((nvp = nvlist_next_nvpair(nvl, nvp)) == NULL) {
-   nvl = nvlist_get_parent(nvl, (void **)nvp);
+   cookie = NULL;
+   nvl = nvlist_get_parent(nvl, cookie);
if (nvl == NULL)
return;
+   nvp = cookie;
level--;
}
}
@@ -443,6 +446,7 @@ nvlist_size(const nvlist_t *nvl)
 {
const nvlist_t *tmpnvl;
const nvpair_t *nvp, *tmpnvp;
+   void *cookie;
size_t size;
 
NVLIST_ASSERT(nvl);
@@ -469,9 +473,11 @@ nvlist_size(const nvlist_t *nvl)
}
 
while ((nvp = nvlist_next_nvpair(nvl, nvp)) == NULL) {
-   nvl = nvlist_get_parent(nvl, (void **)nvp);
+   cookie = NULL;
+   nvl = nvlist_get_parent(nvl, cookie);
if (nvl == NULL)
goto out;
+   nvp = cookie;
}
}
 
@@ -587,6 +593,7 @@ nvlist_xpack(const nvlist_t *nvl, int64_
size_t left, size;
const nvlist_t *tmpnvl;
nvpair_t *nvp, *tmpnvp;
+   void *cookie;
 
NVLIST_ASSERT(nvl);
 
@@ -655,9 +662,11 @@ nvlist_xpack(const nvlist_t *nvl, int64_
return (NULL);
}
while ((nvp = nvlist_next_nvpair(nvl, nvp)) == NULL) {
-   nvl = nvlist_get_parent(nvl, (void **)nvp);
+   cookie = NULL;
+   nvl = nvlist_get_parent(nvl, cookie);
if (nvl == NULL)
goto out;
+   nvp = cookie;
ptr = nvpair_pack_nvlist_up(ptr, left);
if (ptr == NULL)
goto out;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277926 - head/lib/libnv

2015-01-30 Thread Pawel Jakub Dawidek
Author: pjd
Date: Fri Jan 30 12:57:35 2015
New Revision: 277926
URL: https://svnweb.freebsd.org/changeset/base/277926

Log:
  Add missing nvlist_get_parent(3) link.
  
  Submitted by: Mariusz Zaborski osho...@freebsd.org

Modified:
  head/lib/libnv/Makefile

Modified: head/lib/libnv/Makefile
==
--- head/lib/libnv/Makefile Fri Jan 30 12:31:29 2015(r277925)
+++ head/lib/libnv/Makefile Fri Jan 30 12:57:35 2015(r277926)
@@ -61,6 +61,7 @@ MLINKS+=nv.3 nvlist_create.3 \
nv.3 nvlist_get_nvlist.3 \
nv.3 nvlist_get_descriptor.3 \
nv.3 nvlist_get_binary.3 \
+   nv.3 nvlist_get_parent.3 \
nv.3 nvlist_take_bool.3 \
nv.3 nvlist_take_number.3 \
nv.3 nvlist_take_string.3 \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277925 - head/lib/libnv

2015-01-30 Thread Pawel Jakub Dawidek
Author: pjd
Date: Fri Jan 30 12:31:29 2015
New Revision: 277925
URL: https://svnweb.freebsd.org/changeset/base/277925

Log:
  Handle empty nvlists correctly.
  
  Submitted by: Mariusz Zaborski osho...@freebsd.org

Modified:
  head/lib/libnv/nvlist.c

Modified: head/lib/libnv/nvlist.c
==
--- head/lib/libnv/nvlist.c Fri Jan 30 12:07:43 2015(r277924)
+++ head/lib/libnv/nvlist.c Fri Jan 30 12:31:29 2015(r277925)
@@ -356,7 +356,8 @@ nvlist_dump_error_check(const nvlist_t *
 void
 nvlist_dump(const nvlist_t *nvl, int fd)
 {
-   nvpair_t *nvp;
+   const nvlist_t *tmpnvl;
+   nvpair_t *nvp, *tmpnvp;
int level;
 
level = 0;
@@ -386,13 +387,17 @@ nvlist_dump(const nvlist_t *nvl, int fd)
break;
case NV_TYPE_NVLIST:
dprintf(fd, \n);
-   nvl = nvpair_get_nvlist(nvp);
-   if (nvlist_dump_error_check(nvl, fd, level + 1)) {
-   nvl = nvlist_get_parent(nvl, (void **)nvp);
+   tmpnvl = nvpair_get_nvlist(nvp);
+   if (nvlist_dump_error_check(tmpnvl, fd, level + 1))
break;
+   tmpnvp = nvlist_first_nvpair(tmpnvl);
+   if (tmpnvp != NULL) {
+   nvl = tmpnvl;
+   nvp = tmpnvp;
+   level++;
+   continue;
}
-   level++;
-   continue;
+   break;
case NV_TYPE_DESCRIPTOR:
dprintf(fd,  %d\n, nvpair_get_descriptor(nvp));
break;
@@ -436,7 +441,8 @@ nvlist_fdump(const nvlist_t *nvl, FILE *
 size_t
 nvlist_size(const nvlist_t *nvl)
 {
-   const nvpair_t *nvp;
+   const nvlist_t *tmpnvl;
+   const nvpair_t *nvp, *tmpnvp;
size_t size;
 
NVLIST_ASSERT(nvl);
@@ -450,10 +456,14 @@ nvlist_size(const nvlist_t *nvl)
if (nvpair_type(nvp) == NV_TYPE_NVLIST) {
size += sizeof(struct nvlist_header);
size += nvpair_header_size() + 1;
-   nvl = nvpair_get_nvlist(nvp);
-   PJDLOG_ASSERT(nvl-nvl_error == 0);
-   nvp = nvlist_first_nvpair(nvl);
-   continue;
+   tmpnvl = nvpair_get_nvlist(nvp);
+   PJDLOG_ASSERT(tmpnvl-nvl_error == 0);
+   tmpnvp = nvlist_first_nvpair(tmpnvl);
+   if (tmpnvp != NULL) {
+   nvl = tmpnvl;
+   nvp = tmpnvp;
+   continue;
+   }
} else {
size += nvpair_size(nvp);
}
@@ -575,7 +585,8 @@ nvlist_xpack(const nvlist_t *nvl, int64_
 {
unsigned char *buf, *ptr;
size_t left, size;
-   nvpair_t *nvp;
+   const nvlist_t *tmpnvl;
+   nvpair_t *nvp, *tmpnvp;
 
NVLIST_ASSERT(nvl);
 
@@ -618,10 +629,18 @@ nvlist_xpack(const nvlist_t *nvl, int64_
ptr = nvpair_pack_string(nvp, ptr, left);
break;
case NV_TYPE_NVLIST:
-   nvl = nvpair_get_nvlist(nvp);
-   nvp = nvlist_first_nvpair(nvl);
-   ptr = nvlist_pack_header(nvl, ptr, left);
-   continue;
+   tmpnvl = nvpair_get_nvlist(nvp);
+   ptr = nvlist_pack_header(tmpnvl, ptr, left);
+   if (ptr == NULL)
+   goto out;
+   tmpnvp = nvlist_first_nvpair(tmpnvl);
+   if (tmpnvp != NULL) {
+   nvl = tmpnvl;
+   nvp = tmpnvp;
+   continue;
+   }
+   ptr = nvpair_pack_nvlist_up(ptr, left);
+   break;
case NV_TYPE_DESCRIPTOR:
ptr = nvpair_pack_descriptor(nvp, ptr, fdidxp, left);
break;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r277922 - head/sys/ufs/ffs

2015-01-30 Thread Konstantin Belousov
Author: kib
Date: Fri Jan 30 11:41:46 2015
New Revision: 277922
URL: https://svnweb.freebsd.org/changeset/base/277922

Log:
  When mounting SU-enabled mount point, wait until the softdep_flush()
  thread started and incremented the stat_flush_threads [1].
  
  Unconditionally wakeup softdep_flush threads when needed, do not try
  to check wchan, which is racy and breaks abstraction.
  
  Reported by and discussed with:   glebius, neel
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/ufs/ffs/ffs_softdep.c
  head/sys/ufs/ffs/softdep.h

Modified: head/sys/ufs/ffs/ffs_softdep.c
==
--- head/sys/ufs/ffs/ffs_softdep.c  Fri Jan 30 10:08:38 2015
(r277921)
+++ head/sys/ufs/ffs/ffs_softdep.c  Fri Jan 30 11:41:46 2015
(r277922)
@@ -1377,6 +1377,10 @@ softdep_flush(addr)
mp = (struct mount *)addr;
ump = VFSTOUFS(mp);
atomic_add_int(stat_flush_threads, 1);
+   ACQUIRE_LOCK(ump);
+   ump-softdep_flags = ~FLUSH_STARTING;
+   wakeup(ump-softdep_flushtd);
+   FREE_LOCK(ump);
if (print_threads) {
if (stat_flush_threads == 1)
printf(Running %s at pid %d\n, bufdaemonproc-p_comm,
@@ -1389,7 +1393,7 @@ softdep_flush(addr)
VFSTOUFS(mp)-softdep_jblocks-jb_suspended))
kthread_suspend_check();
ACQUIRE_LOCK(ump);
-   if ((ump-softdep_flags  FLUSH_CLEANUP) == 0)
+   while ((ump-softdep_flags  (FLUSH_CLEANUP | FLUSH_EXIT)) == 0)
msleep(ump-softdep_flushtd, LOCK_PTR(ump), PVM,
sdflush, hz / 2);
ump-softdep_flags = ~FLUSH_CLEANUP;
@@ -1421,8 +1425,7 @@ worklist_speedup(mp)
LOCK_OWNED(ump);
if ((ump-softdep_flags  (FLUSH_CLEANUP | FLUSH_EXIT)) == 0) {
ump-softdep_flags |= FLUSH_CLEANUP;
-   if (ump-softdep_flushtd-td_wchan == ump-softdep_flushtd)
-   wakeup(ump-softdep_flushtd);
+   wakeup(ump-softdep_flushtd);
}
 }
 
@@ -1471,10 +1474,7 @@ softdep_speedup(ump)
(FLUSH_CLEANUP | FLUSH_EXIT)) == 0) {
altump-softdep_flags |= FLUSH_CLEANUP;
altump-um_softdep-sd_cleanups++;
-   if (altump-softdep_flushtd-td_wchan ==
-   altump-softdep_flushtd) {
-   wakeup(altump-softdep_flushtd);
-   }
+   wakeup(altump-softdep_flushtd);
}
FREE_LOCK(altump);
}
@@ -2491,9 +2491,18 @@ softdep_mount(devvp, mp, fs, cred)
/*
 * Start our flushing thread in the bufdaemon process.
 */
+   ACQUIRE_LOCK(ump);
+   ump-softdep_flags |= FLUSH_STARTING;
+   FREE_LOCK(ump);
kproc_kthread_add(softdep_flush, mp, bufdaemonproc,
ump-softdep_flushtd, 0, 0, softdepflush, %s worker,
mp-mnt_stat.f_mntonname);
+   ACQUIRE_LOCK(ump);
+   while ((ump-softdep_flags  FLUSH_STARTING) != 0) {
+   msleep(ump-softdep_flushtd, LOCK_PTR(ump), PVM, sdstart,
+   hz / 2);
+   }
+   FREE_LOCK(ump);
/*
 * When doing soft updates, the counters in the
 * superblock may have gotten out of sync. Recomputation

Modified: head/sys/ufs/ffs/softdep.h
==
--- head/sys/ufs/ffs/softdep.h  Fri Jan 30 10:08:38 2015(r277921)
+++ head/sys/ufs/ffs/softdep.h  Fri Jan 30 11:41:46 2015(r277922)
@@ -1063,6 +1063,8 @@ struct mount_softdeps {
  */
 #define FLUSH_EXIT 0x0001  /* time to exit */
 #define FLUSH_CLEANUP  0x0002  /* need to clear out softdep structures */
+#defineFLUSH_STARTING  0x0004  /* flush thread not yet started */
+
 /*
  * Keep the old names from when these were in the ufsmount structure.
  */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org