svn commit: r285125 - in head/sys: kern sys

2015-07-04 Thread Mateusz Guzik
Author: mjg
Date: Sat Jul  4 06:54:15 2015
New Revision: 285125
URL: https://svnweb.freebsd.org/changeset/base/285125

Log:
  sysctl: switch sysctllock to a sleepable rmlock
  
  The lock is almost never taken for writing.

Modified:
  head/sys/kern/kern_linker.c
  head/sys/kern/kern_sysctl.c
  head/sys/kern/vfs_init.c
  head/sys/sys/sysctl.h

Modified: head/sys/kern/kern_linker.c
==
--- head/sys/kern/kern_linker.c Sat Jul  4 05:43:45 2015(r285124)
+++ head/sys/kern/kern_linker.c Sat Jul  4 06:54:15 2015(r285125)
@@ -292,10 +292,10 @@ linker_file_register_sysctls(linker_file
return;
 
sx_xunlock(kld_sx);
-   sysctl_xlock();
+   sysctl_wlock();
for (oidp = start; oidp  stop; oidp++)
sysctl_register_oid(*oidp);
-   sysctl_xunlock();
+   sysctl_wunlock();
sx_xlock(kld_sx);
 }
 
@@ -313,10 +313,10 @@ linker_file_unregister_sysctls(linker_fi
return;
 
sx_xunlock(kld_sx);
-   sysctl_xlock();
+   sysctl_wlock();
for (oidp = start; oidp  stop; oidp++)
sysctl_unregister_oid(*oidp);
-   sysctl_xunlock();
+   sysctl_wunlock();
sx_xlock(kld_sx);
 }
 

Modified: head/sys/kern/kern_sysctl.c
==
--- head/sys/kern/kern_sysctl.c Sat Jul  4 05:43:45 2015(r285124)
+++ head/sys/kern/kern_sysctl.c Sat Jul  4 06:54:15 2015(r285125)
@@ -54,6 +54,7 @@ __FBSDID($FreeBSD$);
 #include sys/jail.h
 #include sys/lock.h
 #include sys/mutex.h
+#include sys/rmlock.h
 #include sys/sbuf.h
 #include sys/sx.h
 #include sys/sysproto.h
@@ -77,7 +78,7 @@ static MALLOC_DEFINE(M_SYSCTLTMP, sysct
  * The sysctllock protects the MIB tree.  It also protects sysctl
  * contexts used with dynamic sysctls.  The sysctl_register_oid() and
  * sysctl_unregister_oid() routines require the sysctllock to already
- * be held, so the sysctl_xlock() and sysctl_xunlock() routines are
+ * be held, so the sysctl_wlock() and sysctl_wunlock() routines are
  * provided for the few places in the kernel which need to use that
  * API rather than using the dynamic API.  Use of the dynamic API is
  * strongly encouraged for most code.
@@ -86,20 +87,21 @@ static MALLOC_DEFINE(M_SYSCTLTMP, sysct
  * sysctl requests.  This is implemented by serializing any userland
  * sysctl requests larger than a single page via an exclusive lock.
  */
-static struct sx sysctllock;
+static struct rmlock sysctllock;
 static struct sx sysctlmemlock;
 
-#defineSYSCTL_XLOCK()  sx_xlock(sysctllock)
-#defineSYSCTL_XUNLOCK()sx_xunlock(sysctllock)
-#defineSYSCTL_SLOCK()  sx_slock(sysctllock)
-#defineSYSCTL_SUNLOCK()sx_sunlock(sysctllock)
-#defineSYSCTL_XLOCKED()sx_xlocked(sysctllock)
-#defineSYSCTL_ASSERT_LOCKED()  sx_assert(sysctllock, SA_LOCKED)
-#defineSYSCTL_ASSERT_XLOCKED() sx_assert(sysctllock, SA_XLOCKED)
-#defineSYSCTL_ASSERT_SLOCKED() sx_assert(sysctllock, SA_SLOCKED)
-#defineSYSCTL_INIT()   sx_init(sysctllock, sysctl lock)
+#defineSYSCTL_WLOCK()  do { printf(wlocked!\n); 
rm_wlock(sysctllock); } while (0)
+#defineSYSCTL_WUNLOCK()rm_wunlock(sysctllock)
+#defineSYSCTL_RLOCK(tracker)   rm_rlock(sysctllock, (tracker))
+#defineSYSCTL_RUNLOCK(tracker) rm_runlock(sysctllock, (tracker))
+#defineSYSCTL_WLOCKED()rm_wowned(sysctllock)
+#defineSYSCTL_ASSERT_LOCKED()  rm_assert(sysctllock, RA_LOCKED)
+#defineSYSCTL_ASSERT_WLOCKED() rm_assert(sysctllock, RA_WLOCKED)
+#defineSYSCTL_ASSERT_RLOCKED() rm_assert(sysctllock, RA_RLOCKED)
+#defineSYSCTL_INIT()   rm_init_flags(sysctllock, sysctl 
lock, \
+   RM_SLEEPABLE)
 #defineSYSCTL_SLEEP(ch, wmesg, timo)   
\
-   sx_sleep(ch, sysctllock, 0, wmesg, timo)
+   rm_sleep(ch, sysctllock, 0, wmesg, timo)
 
 static int sysctl_root(SYSCTL_HANDLER_ARGS);
 
@@ -112,26 +114,23 @@ static intsysctl_old_kernel(struct sysc
 static int sysctl_new_kernel(struct sysctl_req *, void *, size_t);
 
 static void
-sysctl_lock(bool xlock)
+sysctl_lock(struct rm_priotracker *tracker)
 {
 
-   if (xlock)
-   SYSCTL_XLOCK();
+   if (tracker != NULL)
+   SYSCTL_RLOCK(tracker);
else
-   SYSCTL_SLOCK();
+   SYSCTL_WLOCK();
 }
 
-static bool
-sysctl_unlock(void)
+static void
+sysctl_unlock(struct rm_priotracker *tracker)
 {
-   bool xlocked;
 
-   xlocked = SYSCTL_XLOCKED();
-   if (xlocked)
-   SYSCTL_XUNLOCK();
+   if (tracker != NULL)
+   SYSCTL_RUNLOCK(tracker);
else
-   

svn commit: r285127 - head/sys/modules/aesni

2015-07-04 Thread John-Mark Gurney
Author: jmg
Date: Sat Jul  4 08:16:32 2015
New Revision: 285127
URL: https://svnweb.freebsd.org/changeset/base/285127

Log:
  improve dependencies for this module a bit...  not great, but at
  least gives some basics...  I would add them to DPSRC, but due to the
  intrinsics headers, they can't be added...

Modified:
  head/sys/modules/aesni/Makefile

Modified: head/sys/modules/aesni/Makefile
==
--- head/sys/modules/aesni/Makefile Sat Jul  4 07:01:43 2015
(r285126)
+++ head/sys/modules/aesni/Makefile Sat Jul  4 08:16:32 2015
(r285127)
@@ -21,6 +21,9 @@ aesni_wrap.o: aesni_wrap.c
 -mmmx -msse -msse4 -maes ${.IMPSRC}
${CTFCONVERT_CMD}
 
+aesni_ghash.o: aesni.h
+aesni_wrap.o: aesni.h
+
 .include bsd.kmod.mk
 
 CWARNFLAGS.aesni_ghash.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: r285126 - head/sys/kern

2015-07-04 Thread Mateusz Guzik
Author: mjg
Date: Sat Jul  4 07:01:43 2015
New Revision: 285126
URL: https://svnweb.freebsd.org/changeset/base/285126

Log:
  sysctl: remove a debugging printf which crept in with r285125

Modified:
  head/sys/kern/kern_sysctl.c

Modified: head/sys/kern/kern_sysctl.c
==
--- head/sys/kern/kern_sysctl.c Sat Jul  4 06:54:15 2015(r285125)
+++ head/sys/kern/kern_sysctl.c Sat Jul  4 07:01:43 2015(r285126)
@@ -90,7 +90,7 @@ static MALLOC_DEFINE(M_SYSCTLTMP, sysct
 static struct rmlock sysctllock;
 static struct sx sysctlmemlock;
 
-#defineSYSCTL_WLOCK()  do { printf(wlocked!\n); 
rm_wlock(sysctllock); } while (0)
+#defineSYSCTL_WLOCK()  rm_wlock(sysctllock)
 #defineSYSCTL_WUNLOCK()rm_wunlock(sysctllock)
 #defineSYSCTL_RLOCK(tracker)   rm_rlock(sysctllock, (tracker))
 #defineSYSCTL_RUNLOCK(tracker) rm_runlock(sysctllock, (tracker))
___
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: r285128 - head/usr.sbin/mountd

2015-07-04 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Jul  4 08:40:48 2015
New Revision: 285128
URL: https://svnweb.freebsd.org/changeset/base/285128

Log:
  Staticize some stuff in mountd(8); no functional changes.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.sbin/mountd/mountd.c

Modified: head/usr.sbin/mountd/mountd.c
==
--- head/usr.sbin/mountd/mountd.c   Sat Jul  4 08:16:32 2015
(r285127)
+++ head/usr.sbin/mountd/mountd.c   Sat Jul  4 08:40:48 2015
(r285128)
@@ -165,97 +165,98 @@ struct fhreturn {
 #defineGETPORT_MAXTRY  20  /* Max tries to get a port # */
 
 /* Global defs */
-char   *add_expdir(struct dirlist **, char *, int);
-void   add_dlist(struct dirlist **, struct dirlist *,
-   struct grouplist *, int, struct exportlist *);
-void   add_mlist(char *, char *);
-intcheck_dirpath(char *);
-intcheck_options(struct dirlist *);
-intcheckmask(struct sockaddr *sa);
-intchk_host(struct dirlist *, struct sockaddr *, int *, int *, int *,
-int **);
+static char*add_expdir(struct dirlist **, char *, int);
+static voidadd_dlist(struct dirlist **, struct dirlist *,
+   struct grouplist *, int, struct exportlist *);
+static voidadd_mlist(char *, char *);
+static int check_dirpath(char *);
+static int check_options(struct dirlist *);
+static int checkmask(struct sockaddr *sa);
+static int chk_host(struct dirlist *, struct sockaddr *, int *, int *,
+   int *, int **);
 static int create_service(struct netconfig *nconf);
 static voidcomplete_service(struct netconfig *nconf, char *port_str);
 static voidclearout_service(void);
-void   del_mlist(char *hostp, char *dirp);
-struct dirlist *dirp_search(struct dirlist *, char *);
-intdo_mount(struct exportlist *, struct grouplist *, int,
-   struct xucred *, char *, int, struct statfs *);
-intdo_opt(char **, char **, struct exportlist *, struct grouplist *,
-   int *, int *, struct xucred *);
-struct exportlist *ex_search(fsid_t *);
-struct exportlist *get_exp(void);
-void   free_dir(struct dirlist *);
-void   free_exp(struct exportlist *);
-void   free_grp(struct grouplist *);
-void   free_host(struct hostlist *);
-void   get_exportlist(void);
-intget_host(char *, struct grouplist *, struct grouplist *);
-struct hostlist *get_ht(void);
-intget_line(void);
-void   get_mountlist(void);
-intget_net(char *, struct netmsk *, int);
-void   getexp_err(struct exportlist *, struct grouplist *);
-struct grouplist *get_grp(void);
-void   hang_dirp(struct dirlist *, struct grouplist *,
+static voiddel_mlist(char *hostp, char *dirp);
+static struct dirlist  *dirp_search(struct dirlist *, char *);
+static int do_mount(struct exportlist *, struct grouplist *, int,
+   struct xucred *, char *, int, struct statfs *);
+static int do_opt(char **, char **, struct exportlist *,
+   struct grouplist *, int *, int *, struct xucred *);
+static struct exportlist   *ex_search(fsid_t *);
+static struct exportlist   *get_exp(void);
+static voidfree_dir(struct dirlist *);
+static voidfree_exp(struct exportlist *);
+static voidfree_grp(struct grouplist *);
+static voidfree_host(struct hostlist *);
+static voidget_exportlist(void);
+static int get_host(char *, struct grouplist *, struct grouplist *);
+static struct hostlist *get_ht(void);
+static int get_line(void);
+static voidget_mountlist(void);
+static int get_net(char *, struct netmsk *, int);
+static voidgetexp_err(struct exportlist *, struct grouplist *);
+static struct grouplist*get_grp(void);
+static voidhang_dirp(struct dirlist *, struct grouplist *,
struct exportlist *, int);
-void   huphandler(int sig);
-intmakemask(struct sockaddr_storage *ssp, int bitlen);
-void   mntsrv(struct svc_req *, SVCXPRT *);
-void   nextfield(char **, char **);
-void   out_of_mem(void);
-void   parsecred(char *, struct xucred *);
-intparsesec(char *, struct exportlist *);
-intput_exlist(struct dirlist *, XDR *, struct dirlist *, int *, int);
-void   *sa_rawaddr(struct sockaddr *sa, int *nbytes);
-intsacmp(struct sockaddr *sa1, struct sockaddr *sa2,
-struct sockaddr *samask);
-intscan_tree(struct dirlist *, struct sockaddr *);
-static void usage(void);
-intxdr_dir(XDR *, char *);
-intxdr_explist(XDR *, caddr_t);
-intxdr_explist_brief(XDR *, caddr_t);
-intxdr_explist_common(XDR *, caddr_t, int);
-intxdr_fhs(XDR *, caddr_t);
-intxdr_mlist(XDR *, caddr_t);
-void   terminate(int);
-
-struct exportlist *exphead;
-struct mountlist *mlhead;
-struct grouplist *grphead;
-char *exnames_default[2] = { _PATH_EXPORTS, NULL };
-char **exnames;
-char **hosts = NULL;

svn commit: r285139 - in head: lib/libnv sys/conf sys/contrib/libnv sys/kern sys/sys

2015-07-04 Thread Mariusz Zaborski
Author: oshogbo
Date: Sat Jul  4 16:33:37 2015
New Revision: 285139
URL: https://svnweb.freebsd.org/changeset/base/285139

Log:
  Move the nvlist source and private includes from sys/kern to seperate
  directory sys/contrib/libnv.
  
  The goal of this operation is to NOT install header files which shouldn't
  be used outside the nvlist library.
  
  Approved by:  pjd (mentor)

Added:
  head/sys/contrib/libnv/
  head/sys/contrib/libnv/dnvlist.c
 - copied, changed from r285138, head/sys/kern/subr_dnvlist.c
  head/sys/contrib/libnv/nv_impl.h
 - copied unchanged from r285128, head/sys/sys/nv_impl.h
  head/sys/contrib/libnv/nvlist.c
 - copied, changed from r285128, head/sys/kern/subr_nvlist.c
  head/sys/contrib/libnv/nvlist_impl.h
 - copied, changed from r285128, head/sys/sys/nvlist_impl.h
  head/sys/contrib/libnv/nvpair.c
 - copied, changed from r285128, head/sys/kern/subr_nvpair.c
  head/sys/contrib/libnv/nvpair_impl.h
 - copied, changed from r285128, head/sys/sys/nvpair_impl.h
Deleted:
  head/sys/kern/subr_dnvlist.c
  head/sys/kern/subr_nvlist.c
  head/sys/kern/subr_nvpair.c
  head/sys/sys/nv_impl.h
  head/sys/sys/nvlist_impl.h
  head/sys/sys/nvpair_impl.h
Modified:
  head/lib/libnv/Makefile
  head/sys/conf/files

Modified: head/lib/libnv/Makefile
==
--- head/lib/libnv/Makefile Sat Jul  4 16:19:38 2015(r285138)
+++ head/lib/libnv/Makefile Sat Jul  4 16:33:37 2015(r285139)
@@ -7,13 +7,13 @@ SHLIBDIR?= /lib
 LIB=   nv
 SHLIB_MAJOR= 0
 
-.PATH: ${.CURDIR}/../../sys/kern ${.CURDIR}/../../sys/sys
+.PATH: ${.CURDIR}/../../sys/contrib/libnv ${.CURDIR}/../../sys/sys
 CFLAGS+=-I${.CURDIR}/../../sys -I${.CURDIR}
 
-SRCS=  subr_dnvlist.c
+SRCS=  dnvlist.c
 SRCS+= msgio.c
-SRCS+= subr_nvlist.c
-SRCS+= subr_nvpair.c
+SRCS+= nvlist.c
+SRCS+= nvpair.c
 
 WARNS?=6
 

Modified: head/sys/conf/files
==
--- head/sys/conf/files Sat Jul  4 16:19:38 2015(r285138)
+++ head/sys/conf/files Sat Jul  4 16:33:37 2015(r285139)
@@ -476,6 +476,9 @@ contrib/libfdt/fdt_rw.c optional fdt
 contrib/libfdt/fdt_strerror.c  optional fdt
 contrib/libfdt/fdt_sw.coptional fdt
 contrib/libfdt/fdt_wip.c   optional fdt
+contrib/libnv/dnvlist.cstandard
+contrib/libnv/nvlist.c standard
+contrib/libnv/nvpair.c standard
 contrib/ngatm/netnatm/api/cc_conn.c optional ngatm_ccatm \
compile-with ${NORMAL_C_NOWERROR} -I$S/contrib/ngatm
 contrib/ngatm/netnatm/api/cc_data.c optional ngatm_ccatm \
@@ -3054,7 +3057,6 @@ kern/subr_clock.c standard
 kern/subr_counter.cstandard
 kern/subr_devstat.cstandard
 kern/subr_disk.c   standard
-kern/subr_dnvlist.cstandard
 kern/subr_eventhandler.c   standard
 kern/subr_fattime.cstandard
 kern/subr_firmware.c   optional firmware
@@ -3068,8 +3070,6 @@ kern/subr_mbpool.coptional libmbpool
 kern/subr_mchain.c optional libmchain
 kern/subr_module.c standard
 kern/subr_msgbuf.c standard
-kern/subr_nvlist.c standard
-kern/subr_nvpair.c standard
 kern/subr_param.c  standard
 kern/subr_pcpu.c   standard
 kern/subr_pctrie.c standard

Copied and modified: head/sys/contrib/libnv/dnvlist.c (from r285138, 
head/sys/kern/subr_dnvlist.c)
==
--- head/sys/kern/subr_dnvlist.cSat Jul  4 16:19:38 2015
(r285138, copy source)
+++ head/sys/contrib/libnv/dnvlist.cSat Jul  4 16:33:37 2015
(r285139)
@@ -47,10 +47,10 @@ __FBSDID($FreeBSD$);
 #include stdlib.h
 #endif
 
+#include sys/dnv.h
 #include sys/nv.h
-#include sys/nv_impl.h
 
-#include sys/dnv.h
+#include nv_impl.h
 
 #defineDNVLIST_GET(ftype, type)
\
 ftype  \

Copied: head/sys/contrib/libnv/nv_impl.h (from r285128, head/sys/sys/nv_impl.h)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/contrib/libnv/nv_impl.hSat Jul  4 16:33:37 2015
(r285139, copy of r285128, head/sys/sys/nv_impl.h)
@@ -0,0 +1,138 @@
+/*-
+ * Copyright (c) 2013 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Pawel Jakub Dawidek 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. 

Re: svn commit: r285140 - in head: include lib/libc/stdio

2015-07-04 Thread Tijl Coosemans
On Sat, 4 Jul 2015 16:42:15 + (UTC) Mariusz Zaborski osho...@freebsd.org 
wrote:
 Author: oshogbo
 Date: Sat Jul  4 16:42:14 2015
 New Revision: 285140
 URL: https://svnweb.freebsd.org/changeset/base/285140
 
 Log:
   Add fdclose(3) function.
   
   This function is equivalent to fclose(3) function except that it
   does not close the underlying file descriptor.
   fdclose(3) is step forward to make FILE structure private.

You can probably close this bug now:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=75767
___
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: r285144 - in head/sys/powerpc: include powerpc

2015-07-04 Thread Justin Hibbits
Author: jhibbits
Date: Sat Jul  4 18:16:41 2015
New Revision: 285144
URL: https://svnweb.freebsd.org/changeset/base/285144

Log:
  Add machine check register printing
  
  This will print out the Memory Subsystem Status Register on MPC745x (G4+ 
class),
  and the Machine Check Status Register on Book-E class CPUs, to aid in 
debugging
  machine checks.  Other relevant registers, for other CPUs, can be added in the
  future.

Modified:
  head/sys/powerpc/include/spr.h
  head/sys/powerpc/powerpc/trap.c

Modified: head/sys/powerpc/include/spr.h
==
--- head/sys/powerpc/include/spr.h  Sat Jul  4 17:38:56 2015
(r285143)
+++ head/sys/powerpc/include/spr.h  Sat Jul  4 18:16:41 2015
(r285144)
@@ -527,6 +527,14 @@
 #define  MSSCR0_ABD  0x0010 /* 11: address bus driven 
(read-only) */
 #define  MSSCR0_MBZ  0x000f /* 12-31: must be zero */
 #define  MSSCR0_L2PFE0x0003 /* 30-31: L2 prefetch 
enable */
+#defineSPR_MSSSR0  0x3f7   /* .6. Memory Subsystem Status 
Register (MPC745x) */
+#define  MSSSR0_L2TAG0x0004 /* 13: L2 tag parity error 
*/
+#define  MSSSR0_L2DAT0x0002 /* 14: L2 data parity 
error */
+#define  MSSSR0_L3TAG0x0001 /* 15: L3 tag parity error 
*/
+#define  MSSSR0_L3DAT0x8000 /* 16: L3 data parity 
error */
+#define  MSSSR0_APE  0x4000 /* 17: Address parity 
error */
+#define  MSSSR0_DPE  0x2000 /* 18: Data parity error */
+#define  MSSSR0_TEA  0x1000 /* 19: Bus transfer error 
acknowledge */
 #defineSPR_LDSTCR  0x3f8   /* .6. Load/Store Control 
Register */
 #defineSPR_L2PM0x3f8   /* .6. L2 Private Memory 
Control Register */
 #defineSPR_L2CR0x3f9   /* .6. L2 Control Register */

Modified: head/sys/powerpc/powerpc/trap.c
==
--- head/sys/powerpc/powerpc/trap.c Sat Jul  4 17:38:56 2015
(r285143)
+++ head/sys/powerpc/powerpc/trap.c Sat Jul  4 18:16:41 2015
(r285144)
@@ -400,6 +400,7 @@ trap_fatal(struct trapframe *frame)
 static void
 printtrap(u_int vector, struct trapframe *frame, int isfatal, int user)
 {
+   uint16_t ver;
 
printf(\n);
printf(%s %s trap:\n, isfatal ? fatal : handled,
@@ -421,6 +422,17 @@ printtrap(u_int vector, struct trapframe
case EXC_ITMISS:
printf(   virtual address = 0x% PRIxPTR \n, frame-srr0);
break;
+   case EXC_MCHK:
+   ver = mfpvr()  16;
+#if defined(AIM)
+   if (MPC745X_P(ver))
+   printf(msssr0 = 0x%x\n,
+   mfspr(SPR_MSSSR0));
+#elif defined(BOOKE)
+   printf(mcsr   = 0x%x\n,
+   mfspr(SPR_MCSR));
+#endif
+   break;
}
 #ifdef BOOKE
printf(   esr = 0x% PRIxPTR \n,
___
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: r285149 - in head/contrib/llvm/lib/Transforms: Scalar Utils

2015-07-04 Thread Dimitry Andric
Author: dim
Date: Sat Jul  4 20:07:37 2015
New Revision: 285149
URL: https://svnweb.freebsd.org/changeset/base/285149

Log:
  Pull in r241142 from upstream llvm trunk (by David Majnemer):
  
[SCCP] Turn loads of null into undef instead of zero initialized values
  
Surprisingly, this is a correctness issue: the mmx type exists for
calling convention purposes, LLVM doesn't have a zero representation for
them.
  
This partially fixes PR23999.
  
  Pull in r241143 from upstream llvm trunk (by David Majnemer):
  
[LoopUnroll] Use undef for phis with no value live
  
We would create a phi node with a zero initialized operand instead of
undef in the case where no value was originally available.  This was
problematic for x86_mmx which has no null value.
  
  These fix a Cannot create a null constant of that type! error when
  compiling the graphics/sdl2_gfx port with MMX enabled.
  
  Reported by:  amdmi3

Modified:
  head/contrib/llvm/lib/Transforms/Scalar/SCCP.cpp
  head/contrib/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp

Modified: head/contrib/llvm/lib/Transforms/Scalar/SCCP.cpp
==
--- head/contrib/llvm/lib/Transforms/Scalar/SCCP.cppSat Jul  4 19:00:38 
2015(r285148)
+++ head/contrib/llvm/lib/Transforms/Scalar/SCCP.cppSat Jul  4 20:07:37 
2015(r285149)
@@ -1054,7 +1054,7 @@ void SCCPSolver::visitLoadInst(LoadInst 
 
   // load null - null
   if (isaConstantPointerNull(Ptr)  I.getPointerAddressSpace() == 0)
-return markConstant(IV, I, Constant::getNullValue(I.getType()));
+return markConstant(IV, I, UndefValue::get(I.getType()));
 
   // Transform load (constant global) into the value loaded.
   if (GlobalVariable *GV = dyn_castGlobalVariable(Ptr)) {

Modified: head/contrib/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
==
--- head/contrib/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cppSat Jul 
 4 19:00:38 2015(r285148)
+++ head/contrib/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cppSat Jul 
 4 20:07:37 2015(r285149)
@@ -81,7 +81,7 @@ static void ConnectProlog(Loop *L, Value
   if (L-contains(PN)) {
 NewPN-addIncoming(PN-getIncomingValueForBlock(NewPH), OrigPH);
   } else {
-NewPN-addIncoming(Constant::getNullValue(PN-getType()), OrigPH);
+NewPN-addIncoming(UndefValue::get(PN-getType()), OrigPH);
   }
 
   Value *V = PN-getIncomingValueForBlock(Latch);
___
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: r285134 - head/sys/kern

2015-07-04 Thread Mateusz Guzik
Author: mjg
Date: Sat Jul  4 15:42:03 2015
New Revision: 285134
URL: https://svnweb.freebsd.org/changeset/base/285134

Log:
  fd: de-kr-ify functions + some whitespace fixes
  
  No functional changes.

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cSat Jul  4 15:27:04 2015
(r285133)
+++ head/sys/kern/kern_descrip.cSat Jul  4 15:42:03 2015
(r285134)
@@ -424,24 +424,24 @@ kern_fcntl_freebsd(struct thread *td, in
 
switch (cmd) {
case F_OGETLK:
-   cmd = F_GETLK;
-   break;
+   cmd = F_GETLK;
+   break;
case F_OSETLK:
-   cmd = F_SETLK;
-   break;
+   cmd = F_SETLK;
+   break;
case F_OSETLKW:
-   cmd = F_SETLKW;
-   break;
+   cmd = F_SETLKW;
+   break;
}
arg1 = (intptr_t)fl;
break;
-case F_GETLK:
-case F_SETLK:
-case F_SETLKW:
+   case F_GETLK:
+   case F_SETLK:
+   case F_SETLKW:
case F_SETLK_REMOTE:
-error = copyin((void *)(intptr_t)arg, fl, sizeof(fl));
-arg1 = (intptr_t)fl;
-break;
+   error = copyin((void *)(intptr_t)arg, fl, sizeof(fl));
+   arg1 = (intptr_t)fl;
+   break;
default:
arg1 = arg;
break;
@@ -729,7 +729,7 @@ kern_fcntl(struct thread *td, int fd, in
if ((flp-l_start  0 
foffset  OFF_MAX - flp-l_start) ||
(flp-l_start  0 
-foffset  OFF_MIN - flp-l_start)) {
+   foffset  OFF_MIN - flp-l_start)) {
error = EOVERFLOW;
fdrop(fp, td);
break;
@@ -931,13 +931,13 @@ funsetown(struct sigio **sigiop)
struct pgrp *pg = (sigio)-sio_pgrp;
PGRP_LOCK(pg);
SLIST_REMOVE(sigio-sio_pgrp-pg_sigiolst, sigio,
-sigio, sio_pgsigio);
+   sigio, sio_pgsigio);
PGRP_UNLOCK(pg);
} else {
struct proc *p = (sigio)-sio_proc;
PROC_LOCK(p);
SLIST_REMOVE(sigio-sio_proc-p_sigiolst, sigio,
-sigio, sio_pgsigio);
+   sigio, sio_pgsigio);
PROC_UNLOCK(p);
}
SIGIO_UNLOCK();
@@ -1191,18 +1191,14 @@ struct close_args {
 #endif
 /* ARGSUSED */
 int
-sys_close(td, uap)
-   struct thread *td;
-   struct close_args *uap;
+sys_close(struct thread *td, struct close_args *uap)
 {
 
return (kern_close(td, uap-fd));
 }
 
 int
-kern_close(td, fd)
-   struct thread *td;
-   int fd;
+kern_close(struct thread *td, int fd)
 {
struct filedesc *fdp;
struct file *fp;
@@ -2281,10 +2277,10 @@ closef(struct file *fp, struct thread *t
fdp = td-td_proc-p_fd;
FILEDESC_XLOCK(fdp);
for (fdtol = fdtol-fdl_next;
-fdtol != td-td_proc-p_fdtol;
-fdtol = fdtol-fdl_next) {
+   fdtol != td-td_proc-p_fdtol;
+   fdtol = fdtol-fdl_next) {
if ((fdtol-fdl_leader-p_flag 
-P_ADVLOCK) == 0)
+   P_ADVLOCK) == 0)
continue;
fdtol-fdl_holdcount++;
FILEDESC_XUNLOCK(fdp);
@@ -2934,8 +2930,7 @@ filedesc_to_leader_alloc(struct filedesc
struct filedesc_to_leader *fdtol;
 
fdtol = malloc(sizeof(struct filedesc_to_leader),
-  M_FILEDESC_TO_LEADER,
-  M_WAITOK);
+   M_FILEDESC_TO_LEADER, M_WAITOK);
fdtol-fdl_refcount = 1;
fdtol-fdl_holdcount = 0;
fdtol-fdl_wakeup = 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: r285137 - head/usr.sbin/pw

2015-07-04 Thread Baptiste Daroussin
Author: bapt
Date: Sat Jul  4 15:56:59 2015
New Revision: 285137
URL: https://svnweb.freebsd.org/changeset/base/285137

Log:
  Fix validation of crypted password
  Small cleanups

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

Modified: head/usr.sbin/pw/pw_user.c
==
--- head/usr.sbin/pw/pw_user.c  Sat Jul  4 15:54:11 2015(r285136)
+++ head/usr.sbin/pw/pw_user.c  Sat Jul  4 15:56:59 2015(r285137)
@@ -87,7 +87,7 @@ create_and_populate_homedir(int mode, st
 }
 
 static int
-set_passwd(struct passwd *pwd, struct carg *arg, bool update)
+set_passwd(struct passwd *pwd, bool update)
 {
int  b, istty;
struct termios   t, n;
@@ -107,6 +107,7 @@ set_passwd(struct passwd *pwd, struct ca
if (tcgetattr(conf.fd, t) == -1)
istty = 0;
else {
+   n = t;
n.c_lflag = ~(ECHO);
tcsetattr(conf.fd, TCSANOW, n);
printf(%s%spassword for user %s:,
@@ -134,7 +135,7 @@ set_passwd(struct passwd *pwd, struct ca
conf.fd);
if (conf.precrypted) {
if (strchr(line, ':') != NULL)
-   return EX_DATAERR;
+   errx(EX_DATAERR, bad encrypted password);
pwd-pw_passwd = line;
} else {
lc = login_getpwclass(pwd);
@@ -531,8 +532,7 @@ pw_user(int mode, char *name, long id, s
warnx(WARNING: home `%s' is not a directory, 
pwd-pw_dir);
}
 
-   if ((arg = getarg(args, 'w')) != NULL 
-   getarg(args, 'h') == NULL  getarg(args, 'H') == NULL) {
+   if ((arg = getarg(args, 'w')) != NULL  conf.fd == -1) {
login_cap_t *lc;
 
lc = login_getpwclass(pwd);
@@ -591,7 +591,7 @@ pw_user(int mode, char *name, long id, s
}
 
if (conf.fd != -1)
-   edited = set_passwd(pwd, arg, mode == M_UPDATE);
+   edited = set_passwd(pwd, mode == M_UPDATE);
 
/*
 * Special case: -N only displays  exits
@@ -1004,8 +1004,7 @@ pw_password(struct userconf * cnf, struc
/*
 * We give this information back to the user
 */
-   if (getarg(args, 'h') == NULL  getarg(args, 'H') == NULL 
-   !conf.dryrun) {
+   if (conf.fd == -1  !conf.dryrun) {
if (isatty(STDOUT_FILENO))
printf(Password for '%s' is: , user);
printf(%s\n, pwbuf);
___
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: r285150 - head/contrib/llvm/patches

2015-07-04 Thread Dimitry Andric
Author: dim
Date: Sat Jul  4 20:09:24 2015
New Revision: 285150
URL: https://svnweb.freebsd.org/changeset/base/285150

Log:
  Add llvm patch corresponding to r285149.

Added:
  head/contrib/llvm/patches/patch-10-llvm-r241142-r241143-mmx-undef.diff

Added: head/contrib/llvm/patches/patch-10-llvm-r241142-r241143-mmx-undef.diff
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/llvm/patches/patch-10-llvm-r241142-r241143-mmx-undef.diff  
Sat Jul  4 20:09:24 2015(r285150)
@@ -0,0 +1,88 @@
+Pull in r241142 from upstream llvm trunk (by David Majnemer):
+
+  [SCCP] Turn loads of null into undef instead of zero initialized values
+
+  Surprisingly, this is a correctness issue: the mmx type exists for
+  calling convention purposes, LLVM doesn't have a zero representation for
+  them.
+
+  This partially fixes PR23999.
+
+Pull in r241143 from upstream llvm trunk (by David Majnemer):
+
+  [LoopUnroll] Use undef for phis with no value live
+
+  We would create a phi node with a zero initialized operand instead of
+  undef in the case where no value was originally available.  This was
+  problematic for x86_mmx which has no null value.
+
+These fix a Cannot create a null constant of that type! error when
+compiling the graphics/sdl2_gfx port with MMX enabled.
+
+Introduced here: http://svnweb.freebsd.org/changeset/base/285149
+
+Index: lib/Transforms/Scalar/SCCP.cpp
+===
+--- lib/Transforms/Scalar/SCCP.cpp
 lib/Transforms/Scalar/SCCP.cpp
+@@ -1054,7 +1054,7 @@
+ 
+   // load null - null
+   if (isaConstantPointerNull(Ptr)  I.getPointerAddressSpace() == 0)
+-return markConstant(IV, I, Constant::getNullValue(I.getType()));
++return markConstant(IV, I, UndefValue::get(I.getType()));
+ 
+   // Transform load (constant global) into the value loaded.
+   if (GlobalVariable *GV = dyn_castGlobalVariable(Ptr)) {
+Index: lib/Transforms/Utils/LoopUnrollRuntime.cpp
+===
+--- lib/Transforms/Utils/LoopUnrollRuntime.cpp
 lib/Transforms/Utils/LoopUnrollRuntime.cpp
+@@ -81,7 +81,7 @@
+   if (L-contains(PN)) {
+ NewPN-addIncoming(PN-getIncomingValueForBlock(NewPH), OrigPH);
+   } else {
+-NewPN-addIncoming(Constant::getNullValue(PN-getType()), OrigPH);
++NewPN-addIncoming(UndefValue::get(PN-getType()), OrigPH);
+   }
+ 
+   Value *V = PN-getIncomingValueForBlock(Latch);
+Index: test/Transforms/LoopUnroll/X86/mmx.ll
+===
+--- test/Transforms/LoopUnroll/X86/mmx.ll
 test/Transforms/LoopUnroll/X86/mmx.ll
+@@ -0,0 +1,21 @@
++; RUN: opt  %s -S -loop-unroll | FileCheck %s
++target datalayout = e-m:e-i64:64-f80:128-n8:16:32:64-S128
++target triple = x86_64-unknown-linux-gnu
++
++define x86_mmx @f() #0 {
++entry:
++  br label %for.body
++
++for.body: ; preds = %for.body, %entry
++  %phi = phi i32 [ 1, %entry ], [ %add, %for.body ]
++  %add = add i32 %phi, 1
++  %cmp = icmp eq i32 %phi, 0
++  br i1 %cmp, label %exit, label %for.body
++
++exit: ; preds = %for.body
++  %ret = phi x86_mmx [ undef, %for.body ]
++  ; CHECK: ret x86_mmx %ret
++  ret x86_mmx %ret
++}
++
++attributes #0 = { target-cpu=x86-64 }
+Index: test/Transforms/SCCP/crash.ll
+===
+--- test/Transforms/SCCP/crash.ll
 test/Transforms/SCCP/crash.ll
+@@ -27,3 +27,8 @@
+   %B = extractvalue [4 x i32] %A, 1
+   ret i32 %B
+ }
++
++define x86_mmx @test3() {
++  %load = load x86_mmx* null
++  ret x86_mmx %load
++}
___
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: r285140 - in head: include lib/libc/stdio

2015-07-04 Thread Mariusz Zaborski
Author: oshogbo
Date: Sat Jul  4 16:42:14 2015
New Revision: 285140
URL: https://svnweb.freebsd.org/changeset/base/285140

Log:
  Add fdclose(3) function.
  
  This function is equivalent to fclose(3) function except that it
  does not close the underlying file descriptor.
  fdclose(3) is step forward to make FILE structure private.
  
  Reviewed by:  wblock, jilles, jhb, pjd
  Approved by:  pjd (mentor)
  Differential Revision:https://reviews.freebsd.org/D2697

Modified:
  head/include/stdio.h
  head/lib/libc/stdio/Symbol.map
  head/lib/libc/stdio/fclose.3
  head/lib/libc/stdio/fclose.c

Modified: head/include/stdio.h
==
--- head/include/stdio.hSat Jul  4 16:33:37 2015(r285139)
+++ head/include/stdio.hSat Jul  4 16:42:14 2015(r285140)
@@ -396,6 +396,7 @@ int  (dprintf)(int, const char * __restr
 int asprintf(char **, const char *, ...) __printflike(2, 3);
 char   *ctermid_r(char *);
 voidfcloseall(void);
+int fdclose(FILE *, int *);
 char   *fgetln(FILE *, size_t *);
 const char *fmtcheck(const char *, const char *) __format_arg(2);
 int fpurge(FILE *);

Modified: head/lib/libc/stdio/Symbol.map
==
--- head/lib/libc/stdio/Symbol.map  Sat Jul  4 16:33:37 2015
(r285139)
+++ head/lib/libc/stdio/Symbol.map  Sat Jul  4 16:42:14 2015
(r285140)
@@ -162,6 +162,10 @@ FBSD_1.3 {
mkostemps;
 };
 
+FBSD_1.4 {
+   fdclose;
+};
+
 FBSDprivate_1.0 {
_flockfile;
_flockfile_debug_stub;

Modified: head/lib/libc/stdio/fclose.3
==
--- head/lib/libc/stdio/fclose.3Sat Jul  4 16:33:37 2015
(r285139)
+++ head/lib/libc/stdio/fclose.3Sat Jul  4 16:42:14 2015
(r285140)
@@ -1,5 +1,6 @@
-.\ Copyright (c) 1990, 1991, 1993
-.\The Regents of the University of California.  All rights reserved.
+.\ Copyright (c) 1990, 1991, 1993 The Regents of the University of California.
+.\ Copyright (c) 2015 Mariusz Zaborski osho...@freebsd.org
+.\ All rights reserved.
 .\
 .\ This code is derived from software contributed to Berkeley by
 .\ Chris Torek and the American National Standards Committee X3,
@@ -32,11 +33,12 @@
 .\ @(#)fclose.3   8.1 (Berkeley) 6/4/93
 .\ $FreeBSD$
 .\
-.Dd April 22, 2006
+.Dd July 4, 2015
 .Dt FCLOSE 3
 .Os
 .Sh NAME
 .Nm fclose ,
+.Nm fdclose ,
 .Nm fcloseall
 .Nd close a stream
 .Sh LIBRARY
@@ -45,6 +47,8 @@
 .In stdio.h
 .Ft int
 .Fn fclose FILE *stream
+.Ft int
+.Fn fdclose FILE *stream int *fdp
 .Ft void
 .Fn fcloseall void
 .Sh DESCRIPTION
@@ -59,36 +63,77 @@ first, using
 .Xr fflush 3 .
 .Pp
 The
+.Fn fdclose
+function is equivalent to
+.Fn fclose
+except that it does not close the underlying file descriptor.
+If
+.Fa fdp
+is not
+.Dv NULL ,
+the file descriptor will be written to it.
+If the
+.Fa fdp
+argument will be different then NULL the file descriptor will be returned in 
it,
+If the stream does not have an associated file descriptor,
+.Fa fdp
+will be set to -1.
+This type of stream is created with functions such as
+.Xr fmemopen 3 ,
+.Xr funopen 3 ,
+or
+.Xr open_memstream 3 .
+.Pp
+The
 .Fn fcloseall
 function calls
 .Fn fclose
 on all open streams.
 .Sh RETURN VALUES
-Upon successful completion 0 is returned.
+.Fn fcloseall
+does not return a value.
+.Pp
+Upon successful completion the
+.Fn fclose
+and
+.Fn fdclose
+functions return 0.
 Otherwise,
 .Dv EOF
 is returned and the global variable
 .Va errno
 is set to indicate the error.
-In either case no further access to the stream is possible.
 .Sh ERRORS
+.Fn fdclose
+fails if:
+.Bl -tag -width Er
+.It Bq Er EOPNOTSUPP
+The stream does not have an associated file descriptor.
+.El
+.Pp
 The
 .Fn fclose
-function
-may also fail and set
+and
+.Fn fdclose
+functions may also fail and set
 .Va errno
-for any of the errors specified for the routines
-.Xr close 2
-or
+for any of the errors specified for
 .Xr fflush 3 .
+.Pp
+The
+.Fn fclose
+function may also fail and set errno for any of the errors specified for
+.Xr close 2 .
 .Sh NOTES
 The
 .Fn fclose
-function
-does not handle NULL arguments; they will result in a segmentation
-violation.
-This is intentional - it makes it easier to make sure programs written
-under
+and
+.Fn fdclose
+functions do not handle NULL arguments in the
+.Fa stream
+variable; this will result in a segmentation violation.
+This is intentional.
+It makes it easier to make sure programs written under
 .Fx
 are bug free.
 This behaviour is an implementation detail, and programs should not
@@ -104,8 +149,13 @@ The
 function
 conforms to
 .St -isoC .
-.Pp
+.Sh HISTORY
 The
 .Fn fcloseall
 function first appeared in
 .Fx 7.0 .
+.Pp
+The
+.Fn fdclose
+function first appeared in
+.Fx 11.0 .

Modified: head/lib/libc/stdio/fclose.c

svn commit: r285146 - head/sys/dev/isp

2015-07-04 Thread Alexander Motin
Author: mav
Date: Sat Jul  4 18:38:46 2015
New Revision: 285146
URL: https://svnweb.freebsd.org/changeset/base/285146

Log:
  Drop discovered targets when initiator role is disabled.

Modified:
  head/sys/dev/isp/isp.c
  head/sys/dev/isp/isp_freebsd.c
  head/sys/dev/isp/isp_library.c
  head/sys/dev/isp/ispvar.h

Modified: head/sys/dev/isp/isp.c
==
--- head/sys/dev/isp/isp.c  Sat Jul  4 18:36:02 2015(r285145)
+++ head/sys/dev/isp/isp.c  Sat Jul  4 18:38:46 2015(r285146)
@@ -2223,6 +2223,36 @@ isp_fibre_init_2400(ispsoftc_t *isp)
 }
 
 static void
+isp_del_all_init_entries(ispsoftc_t *isp, int chan)
+{
+   fcparam *fcp = FCPARAM(isp, chan);
+   fcportdb_t *lp;
+   int i;
+
+   for (i = 0; i  MAX_FC_TARG; i++) {
+   lp = fcp-portdb[i];
+   if (lp-state == FC_PORTDB_STATE_NIL || lp-target_mode)
+   continue;
+   /*
+* It's up to the outer layers to clear isp_dev_map.
+*/
+   lp-state = FC_PORTDB_STATE_NIL;
+   isp_async(isp, ISPASYNC_DEV_GONE, chan, lp, 1);
+   if (lp-autologin == 0) {
+   (void) isp_plogx(isp, chan, lp-handle,
+   lp-portid,
+   PLOGX_FLG_CMD_LOGO |
+   PLOGX_FLG_IMPLICIT |
+   PLOGX_FLG_FREE_NPHDL, 0);
+   } else {
+   lp-autologin = 0;
+   }
+   lp-new_prli_word3 = 0;
+   lp-new_portid = 0;
+   }
+}
+
+static void
 isp_mark_portdb(ispsoftc_t *isp, int chan, int disposition)
 {
fcparam *fcp = FCPARAM(isp, chan);
@@ -2981,7 +3011,7 @@ isp_pdb_sync(ispsoftc_t *isp, int chan)
 * It's up to the outer layers to clear isp_dev_map.
 */
lp-state = FC_PORTDB_STATE_NIL;
-   isp_async(isp, ISPASYNC_DEV_GONE, chan, lp);
+   isp_async(isp, ISPASYNC_DEV_GONE, chan, lp, 0);
if (lp-autologin == 0) {
(void) isp_plogx(isp, chan, lp-handle,
lp-portid,
@@ -4990,6 +5020,28 @@ isp_control(ispsoftc_t *isp, ispctl_t ct
} while ((r  0x) == MBOX_LOOP_ID_USED);
return (r);
}
+   case ISPCTL_CHANGE_ROLE:
+   {
+   int role, r;
+
+   va_start(ap, ctl);
+   chan = va_arg(ap, int);
+   role = va_arg(ap, int);
+   va_end(ap);
+   if (IS_FC(isp)) {
+#ifdef ISP_TARGET_MODE
+   if ((role  ISP_ROLE_TARGET) == 0)
+   isp_del_all_wwn_entries(isp, chan);
+#endif
+   if ((role  ISP_ROLE_INITIATOR) == 0)
+   isp_del_all_init_entries(isp, chan);
+   r = isp_fc_change_role(isp, chan, role);
+   } else {
+   SDPARAM(isp, chan)-role = role;
+   r = 0;
+   }
+   return (r);
+   }
default:
isp_prt(isp, ISP_LOGERR, Unknown Control Opcode 0x%x, ctl);
break;

Modified: head/sys/dev/isp/isp_freebsd.c
==
--- head/sys/dev/isp/isp_freebsd.c  Sat Jul  4 18:36:02 2015
(r285145)
+++ head/sys/dev/isp/isp_freebsd.c  Sat Jul  4 18:38:46 2015
(r285146)
@@ -115,7 +115,7 @@ isp_role_sysctl(SYSCTL_HANDLER_ARGS)
}
 
/* Actually change the role. */
-   error = isp_fc_change_role(isp, chan, value);
+   error = isp_control(isp, ISPCTL_CHANGE_ROLE, chan, value);
ISP_UNLOCK(isp);
return (error);
 }
@@ -474,18 +474,14 @@ ispioctl(struct cdev *dev, u_long c, cad
retval = EINVAL;
break;
}
-   *(int *)addr = FCPARAM(isp, chan)-role;
-#ifdef ISP_INTERNAL_TARGET
ISP_LOCK(isp);
-   retval = isp_fc_change_role(isp, chan, nr);
-   ISP_UNLOCK(isp);
-#else
-   FCPARAM(isp, chan)-role = nr;
-#endif
+   *(int *)addr = FCPARAM(isp, chan)-role;
} else {
+   ISP_LOCK(isp);
*(int *)addr = SDPARAM(isp, chan)-role;
-   SDPARAM(isp, chan)-role = nr;
}
+   retval = isp_control(isp, ISPCTL_CHANGE_ROLE, chan, nr);
+   ISP_UNLOCK(isp);
retval = 0;
break;
 
@@ -5478,7 +5474,8 @@ isp_action(struct cam_sim *sim, union cc
ISP_SET_PC(isp, bus, tm_enabled, 0);
   

svn commit: r285145 - head/usr.sbin/bhyvectl

2015-07-04 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Sat Jul  4 18:36:02 2015
New Revision: 285145
URL: https://svnweb.freebsd.org/changeset/base/285145

Log:
  Remove duplicate header string.h.

Modified:
  head/usr.sbin/bhyvectl/bhyvectl.c

Modified: head/usr.sbin/bhyvectl/bhyvectl.c
==
--- head/usr.sbin/bhyvectl/bhyvectl.c   Sat Jul  4 18:16:41 2015
(r285144)
+++ head/usr.sbin/bhyvectl/bhyvectl.c   Sat Jul  4 18:36:02 2015
(r285145)
@@ -44,7 +44,6 @@ __FBSDID($FreeBSD$);
 #include libgen.h
 #include libutil.h
 #include fcntl.h
-#include string.h
 #include getopt.h
 #include time.h
 #include assert.h
___
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: r285151 - in head/sys: arm64/conf i386/conf pc98/conf powerpc/conf sparc64/conf

2015-07-04 Thread George V. Neville-Neil
Author: gnn
Date: Sat Jul  4 20:31:06 2015
New Revision: 285151
URL: https://svnweb.freebsd.org/changeset/base/285151

Log:
  Fix up tabs vs. spaces

Modified:
  head/sys/arm64/conf/GENERIC
  head/sys/i386/conf/GENERIC
  head/sys/pc98/conf/GENERIC
  head/sys/powerpc/conf/GENERIC
  head/sys/sparc64/conf/GENERIC

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Sat Jul  4 20:09:24 2015(r285150)
+++ head/sys/arm64/conf/GENERIC Sat Jul  4 20:31:06 2015(r285151)
@@ -28,7 +28,7 @@ options   SCHED_ULE   # ULE scheduler
 optionsPREEMPTION  # Enable kernel thread preemption
 optionsINET# InterNETworking
 optionsINET6   # IPv6 communications protocols
-options IPSEC   # IP (v4/v6) security
+optionsIPSEC   # IP (v4/v6) security
 optionsTCP_OFFLOAD # TCP offload
 optionsSCTP# Stream Control Transmission Protocol
 optionsFFS # Berkeley Fast Filesystem

Modified: head/sys/i386/conf/GENERIC
==
--- head/sys/i386/conf/GENERIC  Sat Jul  4 20:09:24 2015(r285150)
+++ head/sys/i386/conf/GENERIC  Sat Jul  4 20:31:06 2015(r285151)
@@ -30,7 +30,7 @@ options   SCHED_ULE   # ULE scheduler
 optionsPREEMPTION  # Enable kernel thread preemption
 optionsINET# InterNETworking
 optionsINET6   # IPv6 communications protocols
-options IPSEC   # IP (v4/v6) security
+optionsIPSEC   # IP (v4/v6) security
 optionsTCP_OFFLOAD # TCP offload
 optionsSCTP# Stream Control Transmission Protocol
 optionsFFS # Berkeley Fast Filesystem

Modified: head/sys/pc98/conf/GENERIC
==
--- head/sys/pc98/conf/GENERIC  Sat Jul  4 20:09:24 2015(r285150)
+++ head/sys/pc98/conf/GENERIC  Sat Jul  4 20:31:06 2015(r285151)
@@ -29,7 +29,7 @@ options   SCHED_4BSD  # 4BSD scheduler
 #options   PREEMPTION  # Enable kernel thread preemption
 optionsINET# InterNETworking
 optionsINET6   # IPv6 communications protocols
-options IPSEC   # IP (v4/v6) security
+optionsIPSEC   # IP (v4/v6) security
 optionsSCTP# Stream Control Transmission Protocol
 optionsFFS # Berkeley Fast Filesystem
 optionsSOFTUPDATES # Enable FFS soft updates support

Modified: head/sys/powerpc/conf/GENERIC
==
--- head/sys/powerpc/conf/GENERIC   Sat Jul  4 20:09:24 2015
(r285150)
+++ head/sys/powerpc/conf/GENERIC   Sat Jul  4 20:31:06 2015
(r285151)
@@ -37,7 +37,7 @@ options   SCHED_ULE   #ULE scheduler
 optionsPREEMPTION  #Enable kernel thread preemption
 optionsINET#InterNETworking
 optionsINET6   #IPv6 communications protocols
-options IPSEC   # IP (v4/v6) security
+optionsIPSEC   # IP (v4/v6) security
 optionsSCTP#Stream Control Transmission Protocol
 optionsFFS #Berkeley Fast Filesystem
 optionsSOFTUPDATES #Enable FFS soft updates support

Modified: head/sys/sparc64/conf/GENERIC
==
--- head/sys/sparc64/conf/GENERIC   Sat Jul  4 20:09:24 2015
(r285150)
+++ head/sys/sparc64/conf/GENERIC   Sat Jul  4 20:31:06 2015
(r285151)
@@ -30,7 +30,7 @@ options   SCHED_ULE   # ULE scheduler
 optionsPREEMPTION  # Enable kernel thread preemption
 optionsINET# InterNETworking
 optionsINET6   # IPv6 communications protocols
-options IPSEC   # IP (v4/v6) security
+optionsIPSEC   # IP (v4/v6) security
 optionsSCTP# Stream Control Transmission Protocol
 optionsFFS # Berkeley Fast Filesystem
 optionsSOFTUPDATES # Enable FFS soft updates support
___
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: r285148 - in head/sys/powerpc: aim booke include powerpc

2015-07-04 Thread Justin Hibbits
Author: jhibbits
Date: Sat Jul  4 19:00:38 2015
New Revision: 285148
URL: https://svnweb.freebsd.org/changeset/base/285148

Log:
  Use the correct type for physical addresses.
  
  On Book-E, physical addresses are actually 36-bits, not 32-bits.  This is
  currently worked around by ignoring the top bits.  However, in some cases, the
  boot loader configures CCSR to something above the 32-bit mark.  This is 
stage 1
  in updating the pmap to handle 36-bit physaddr.

Modified:
  head/sys/powerpc/aim/mmu_oea.c
  head/sys/powerpc/aim/mmu_oea64.c
  head/sys/powerpc/booke/pmap.c
  head/sys/powerpc/include/pte.h
  head/sys/powerpc/powerpc/mmu_if.m

Modified: head/sys/powerpc/aim/mmu_oea.c
==
--- head/sys/powerpc/aim/mmu_oea.c  Sat Jul  4 18:51:54 2015
(r285147)
+++ head/sys/powerpc/aim/mmu_oea.c  Sat Jul  4 19:00:38 2015
(r285148)
@@ -250,7 +250,7 @@ static int  moea_pte_insert(u_int, struc
  * PVO calls.
  */
 static int moea_pvo_enter(pmap_t, uma_zone_t, struct pvo_head *,
-   vm_offset_t, vm_offset_t, u_int, int);
+   vm_offset_t, vm_paddr_t, u_int, int);
 static voidmoea_pvo_remove(struct pvo_entry *, int);
 static struct  pvo_entry *moea_pvo_find_va(pmap_t, vm_offset_t, int *);
 static struct  pte *moea_pvo_to_pte(const struct pvo_entry *, int);
@@ -260,7 +260,7 @@ static struct   pte *moea_pvo_to_pte(const
  */
 static int moea_enter_locked(pmap_t, vm_offset_t, vm_page_t,
vm_prot_t, u_int, int8_t);
-static voidmoea_syncicache(vm_offset_t, vm_size_t);
+static voidmoea_syncicache(vm_paddr_t, vm_size_t);
 static boolean_t   moea_query_bit(vm_page_t, int);
 static u_int   moea_clear_bit(vm_page_t, int);
 static voidmoea_kremove(mmu_t, vm_offset_t);
@@ -306,10 +306,10 @@ void moea_deactivate(mmu_t, struct threa
 void moea_cpu_bootstrap(mmu_t, int);
 void moea_bootstrap(mmu_t, vm_offset_t, vm_offset_t);
 void *moea_mapdev(mmu_t, vm_paddr_t, vm_size_t);
-void *moea_mapdev_attr(mmu_t, vm_offset_t, vm_size_t, vm_memattr_t);
+void *moea_mapdev_attr(mmu_t, vm_paddr_t, vm_size_t, vm_memattr_t);
 void moea_unmapdev(mmu_t, vm_offset_t, vm_size_t);
 vm_paddr_t moea_kextract(mmu_t, vm_offset_t);
-void moea_kenter_attr(mmu_t, vm_offset_t, vm_offset_t, vm_memattr_t);
+void moea_kenter_attr(mmu_t, vm_offset_t, vm_paddr_t, vm_memattr_t);
 void moea_kenter(mmu_t, vm_offset_t, vm_paddr_t);
 void moea_page_set_memattr(mmu_t mmu, vm_page_t m, vm_memattr_t ma);
 boolean_t moea_dev_direct_mapped(mmu_t, vm_paddr_t, vm_size_t);
@@ -371,7 +371,7 @@ static mmu_method_t moea_methods[] = {
 MMU_DEF(oea_mmu, MMU_TYPE_OEA, moea_methods, 0);
 
 static __inline uint32_t
-moea_calc_wimg(vm_offset_t pa, vm_memattr_t ma)
+moea_calc_wimg(vm_paddr_t pa, vm_memattr_t ma)
 {
uint32_t pte_lo;
int i;
@@ -1472,7 +1472,7 @@ moea_kenter(mmu_t mmu, vm_offset_t va, v
 }
 
 void
-moea_kenter_attr(mmu_t mmu, vm_offset_t va, vm_offset_t pa, vm_memattr_t ma)
+moea_kenter_attr(mmu_t mmu, vm_offset_t va, vm_paddr_t pa, vm_memattr_t ma)
 {
u_int   pte_lo;
int error;
@@ -1877,14 +1877,14 @@ moea_bootstrap_alloc(vm_size_t size, u_i
 }
 
 static void
-moea_syncicache(vm_offset_t pa, vm_size_t len)
+moea_syncicache(vm_paddr_t pa, vm_size_t len)
 {
__syncicache((void *)pa, len);
 }
 
 static int
 moea_pvo_enter(pmap_t pm, uma_zone_t zone, struct pvo_head *pvo_head,
-vm_offset_t va, vm_offset_t pa, u_int pte_lo, int flags)
+vm_offset_t va, vm_paddr_t pa, u_int pte_lo, int flags)
 {
struct  pvo_entry *pvo;
u_int   sr;
@@ -2472,7 +2472,7 @@ moea_clear_bit(vm_page_t m, int ptebit)
  * Return true if the physical range is encompassed by the battable[idx]
  */
 static int
-moea_bat_mapped(int idx, vm_offset_t pa, vm_size_t size)
+moea_bat_mapped(int idx, vm_paddr_t pa, vm_size_t size)
 {
u_int prot;
u_int32_t start;
@@ -2539,7 +2539,7 @@ moea_mapdev(mmu_t mmu, vm_paddr_t pa, vm
 }
 
 void *
-moea_mapdev_attr(mmu_t mmu, vm_offset_t pa, vm_size_t size, vm_memattr_t ma)
+moea_mapdev_attr(mmu_t mmu, vm_paddr_t pa, vm_size_t size, vm_memattr_t ma)
 {
vm_offset_t va, tmpva, ppa, offset;
int i;

Modified: head/sys/powerpc/aim/mmu_oea64.c
==
--- head/sys/powerpc/aim/mmu_oea64.cSat Jul  4 18:51:54 2015
(r285147)
+++ head/sys/powerpc/aim/mmu_oea64.cSat Jul  4 19:00:38 2015
(r285148)
@@ -226,7 +226,7 @@ static boolean_tmoea64_query_bit(mmu_t,
 static u_int   moea64_clear_bit(mmu_t, vm_page_t, uint64_t);
 static voidmoea64_kremove(mmu_t, vm_offset_t);
 static voidmoea64_syncicache(mmu_t, pmap_t pmap, vm_offset_t va, 
-   vm_offset_t pa, vm_size_t sz);
+  

svn commit: r285152 - head/sys/conf

2015-07-04 Thread George V. Neville-Neil
Author: gnn
Date: Sat Jul  4 21:32:44 2015
New Revision: 285152
URL: https://svnweb.freebsd.org/changeset/base/285152

Log:
  Summary: Add missing files necessary to build with IPSEC and crypto

Modified:
  head/sys/conf/files.arm64

Modified: head/sys/conf/files.arm64
==
--- head/sys/conf/files.arm64   Sat Jul  4 20:31:06 2015(r285151)
+++ head/sys/conf/files.arm64   Sat Jul  4 21:32:44 2015(r285152)
@@ -46,6 +46,8 @@ arm64/arm64/uio_machdep.c standard
 arm64/arm64/unwind.c   optionalddb | kdtrace_hooks
 arm64/arm64/vfp.c  standard
 arm64/arm64/vm_machdep.c   standard
+crypto/blowfish/bf_enc.c   optionalcrypto | ipsec
+crypto/des/des_enc.c   optionalcrypto | ipsec | netsmb
 dev/acpica/acpi_if.m   optionalacpi
 dev/fdt/fdt_arm64.coptionalfdt
 dev/hwpmc/hwpmc_arm64.coptionalhwpmc
___
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: r285136 - head/usr.sbin/pw

2015-07-04 Thread Baptiste Daroussin
Author: bapt
Date: Sat Jul  4 15:54:11 2015
New Revision: 285136
URL: https://svnweb.freebsd.org/changeset/base/285136

Log:
  Also validate inputs of pw groupmod -h and groupmod -H

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

Modified: head/usr.sbin/pw/pw_group.c
==
--- head/usr.sbin/pw/pw_group.c Sat Jul  4 15:46:39 2015(r285135)
+++ head/usr.sbin/pw/pw_group.c Sat Jul  4 15:54:11 2015(r285136)
@@ -47,6 +47,50 @@ static void  delete_members(char ***membe
 static int print_group(struct group * grp);
 static gid_tgr_gidpolicy(struct userconf * cnf, long id);
 
+static void
+set_passwd(struct group *grp, bool update)
+{
+   int  b;
+   int  istty;
+   struct termios   t, n;
+   char*p, line[256];
+
+   if (conf.fd == '-') {
+   grp-gr_passwd = *;   /* No access */
+   return;
+   }
+   
+   if ((istty = isatty(conf.fd))) {
+   n = t;
+   /* Disable echo */
+   n.c_lflag = ~(ECHO);
+   tcsetattr(conf.fd, TCSANOW, n);
+   printf(%sassword for group %s:, update ? New p : P,
+   grp-gr_name);
+   fflush(stdout);
+   }
+   b = read(conf.fd, line, sizeof(line) - 1);
+   if (istty) {/* Restore state */
+   tcsetattr(conf.fd, TCSANOW, t);
+   fputc('\n', stdout);
+   fflush(stdout);
+   }
+   if (b  0)
+   err(EX_OSERR, -h file descriptor);
+   line[b] = '\0';
+   if ((p = strpbrk(line,  \t\r\n)) != NULL)
+   *p = '\0';
+   if (!*line)
+   errx(EX_DATAERR, empty password read on file descriptor %d,
+   conf.fd);
+   if (conf.precrypted) {
+   if (strchr(line, ':') != 0)
+   errx(EX_DATAERR, wrong encrypted passwrd);
+   grp-gr_passwd = line;
+   } else
+   grp-gr_passwd = pw_pwcrypt(line);
+}
+
 int
 pw_group(int mode, char *name, long id, struct cargs * args)
 {
@@ -156,52 +200,8 @@ pw_group(int mode, char *name, long id, 
 * software.
 */
 
-   if ((arg = getarg(args, 'h')) != NULL ||
-   (arg = getarg(args, 'H')) != NULL) {
-   if (strcmp(arg-val, -) == 0)
-   grp-gr_passwd = *;   /* No access */
-   else {
-   int fd = atoi(arg-val);
-   int precrypt = (arg-ch == 'H');
-   int b;
-   int istty = isatty(fd);
-   struct termios  t;
-   char   *p, line[256];
-
-   if (istty) {
-   if (tcgetattr(fd, t) == -1)
-   istty = 0;
-   else {
-   struct termios  n = t;
-
-   /* Disable echo */
-   n.c_lflag = ~(ECHO);
-   tcsetattr(fd, TCSANOW, n);
-   printf(%sassword for group %s:, (mode 
== M_UPDATE) ? New p : P, grp-gr_name);
-   fflush(stdout);
-   }
-   }
-   b = read(fd, line, sizeof(line) - 1);
-   if (istty) {/* Restore state */
-   tcsetattr(fd, TCSANOW, t);
-   fputc('\n', stdout);
-   fflush(stdout);
-   }
-   if (b  0)
-   err(EX_OSERR, -h file descriptor);
-   line[b] = '\0';
-   if ((p = strpbrk(line,  \t\r\n)) != NULL)
-   *p = '\0';
-   if (!*line)
-   errx(EX_DATAERR, empty password read on file 
descriptor %d, fd);
-   if (precrypt) {
-   if (strchr(line, ':') != NULL)
-   return EX_DATAERR;
-   grp-gr_passwd = line;
-   } else
-   grp-gr_passwd = pw_pwcrypt(line);
-   }
-   }
+   if (conf.fd != -1)
+   set_passwd(grp, mode == M_UPDATE);
 
if (((arg = getarg(args, 'M')) != NULL ||
(arg = getarg(args, 'd')) != NULL ||
___
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: r285138 - head/sys/boot/arm/uboot

2015-07-04 Thread Luiz Otavio O Souza
Author: loos
Date: Sat Jul  4 16:19:38 2015
New Revision: 285138
URL: https://svnweb.freebsd.org/changeset/base/285138

Log:
  Install loader.rc with ARM u-boot loader (ubldr).
  
  loader.rc is the responsible to read and process loader.conf variables.
  
  This fix the issue of loader.conf being silently ignored.
  
  MFC after:3 days

Modified:
  head/sys/boot/arm/uboot/Makefile

Modified: head/sys/boot/arm/uboot/Makefile
==
--- head/sys/boot/arm/uboot/MakefileSat Jul  4 15:56:59 2015
(r285137)
+++ head/sys/boot/arm/uboot/MakefileSat Jul  4 16:19:38 2015
(r285138)
@@ -149,10 +149,9 @@ CLEANFILES+=   ldscript.abs ldscript.pie u
 .PATH: ${.CURDIR}/../../forth
 .include   ${.CURDIR}/../../forth/Makefile.inc
 
-# Put sample loader.rc and menu.rc on disk but don't enable them
-# by default.
+# Install loader.rc.
 FILES+=loader.rc
-FILESNAME_loader.rc=   loader.rc.sample
+# Put sample menu.rc on disk but don't enable it by default.
 FILES+=menu.rc
 FILESNAME_menu.rc= menu.rc.sample
 .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


Re: svn commit: r285140 - in head: include lib/libc/stdio

2015-07-04 Thread Mariusz Zaborski
On Sat, Jul 04, 2015 at 07:33:55PM +0200, Tijl Coosemans wrote:
 On Sat, 4 Jul 2015 16:42:15 + (UTC) Mariusz Zaborski 
 osho...@freebsd.org wrote:
  Author: oshogbo
  Date: Sat Jul  4 16:42:14 2015
  New Revision: 285140
  URL: https://svnweb.freebsd.org/changeset/base/285140
  
  Log:
Add fdclose(3) function.

This function is equivalent to fclose(3) function except that it
does not close the underlying file descriptor.
fdclose(3) is step forward to make FILE structure private.
 
 You can probably close this bug now:
 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=75767

Oh, thanks! I didn't know that there was such PR.
I will close it.

Cheers,
Mariusz


pgpUixgjmOogH.pgp
Description: PGP signature


svn commit: r285131 - head/sys/kern

2015-07-04 Thread Mateusz Guzik
Author: mjg
Date: Sat Jul  4 14:44:39 2015
New Revision: 285131
URL: https://svnweb.freebsd.org/changeset/base/285131

Log:
  sysctl: get rid of sysctl_lock/unlock
  
  Inline their contents into the only consumer.

Modified:
  head/sys/kern/kern_sysctl.c

Modified: head/sys/kern/kern_sysctl.c
==
--- head/sys/kern/kern_sysctl.c Sat Jul  4 10:33:33 2015(r285130)
+++ head/sys/kern/kern_sysctl.c Sat Jul  4 14:44:39 2015(r285131)
@@ -113,26 +113,6 @@ static int sysctl_remove_oid_locked(stru
 static int sysctl_old_kernel(struct sysctl_req *, const void *, size_t);
 static int sysctl_new_kernel(struct sysctl_req *, void *, size_t);
 
-static void
-sysctl_lock(struct rm_priotracker *tracker)
-{
-
-   if (tracker != NULL)
-   SYSCTL_RLOCK(tracker);
-   else
-   SYSCTL_WLOCK();
-}
-
-static void
-sysctl_unlock(struct rm_priotracker *tracker)
-{
-
-   if (tracker != NULL)
-   SYSCTL_RUNLOCK(tracker);
-   else
-   SYSCTL_WUNLOCK();
-}
-
 static struct sysctl_oid *
 sysctl_find_oidname(const char *name, struct sysctl_oid_list *list)
 {
@@ -174,7 +154,11 @@ sysctl_root_handler_locked(struct sysctl
 
if (oid-oid_kind  CTLFLAG_DYN)
atomic_add_int(oid-oid_running, 1);
-   sysctl_unlock(tracker);
+
+   if (tracker != NULL)
+   SYSCTL_RUNLOCK(tracker);
+   else
+   SYSCTL_WUNLOCK();
 
if (!(oid-oid_kind  CTLFLAG_MPSAFE))
mtx_lock(Giant);
@@ -182,7 +166,11 @@ sysctl_root_handler_locked(struct sysctl
if (!(oid-oid_kind  CTLFLAG_MPSAFE))
mtx_unlock(Giant);
 
-   sysctl_lock(tracker);
+   if (tracker != NULL)
+   SYSCTL_RLOCK(tracker);
+   else
+   SYSCTL_WLOCK();
+
if (oid-oid_kind  CTLFLAG_DYN) {
if (atomic_fetchadd_int(oid-oid_running, -1) == 1 
(oid-oid_kind  CTLFLAG_DYING) != 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: r285141 - head/lib/libfetch

2015-07-04 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Sat Jul  4 17:22:07 2015
New Revision: 285141
URL: https://svnweb.freebsd.org/changeset/base/285141

Log:
  Remove unused variable to silence clang warning.
  
  Differential Revision:D2683
  Reviewed by:  rodrigc, bapt

Modified:
  head/lib/libfetch/http.c

Modified: head/lib/libfetch/http.c
==
--- head/lib/libfetch/http.cSat Jul  4 16:42:14 2015(r285140)
+++ head/lib/libfetch/http.cSat Jul  4 17:22:07 2015(r285141)
@@ -1330,7 +1330,6 @@ static int
 http_authorize(conn_t *conn, const char *hdr, http_auth_challenges_t *cs,
   http_auth_params_t *parms, struct url *url)
 {
-   http_auth_challenge_t *basic = NULL;
http_auth_challenge_t *digest = NULL;
int i;
 
@@ -1340,10 +1339,8 @@ http_authorize(conn_t *conn, const char 
return (-1);
}
 
-   /* Look for a Digest and a Basic challenge */
+   /* Look for a Digest */
for (i = 0; i  cs-count; i++) {
-   if (cs-challenges[i]-scheme == HTTPAS_BASIC)
-   basic = cs-challenges[i];
if (cs-challenges[i]-scheme == HTTPAS_DIGEST)
digest = cs-challenges[i];
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r285135 - head/sys/kern

2015-07-04 Thread Mateusz Guzik
Author: mjg
Date: Sat Jul  4 15:46:39 2015
New Revision: 285135
URL: https://svnweb.freebsd.org/changeset/base/285135

Log:
  vfs: use shared vnode locking when looking up .. in vop_stdvptocnp
  
  Briefly discussed with: kib

Modified:
  head/sys/kern/vfs_default.c

Modified: head/sys/kern/vfs_default.c
==
--- head/sys/kern/vfs_default.c Sat Jul  4 15:42:03 2015(r285134)
+++ head/sys/kern/vfs_default.c Sat Jul  4 15:46:39 2015(r285135)
@@ -810,7 +810,7 @@ vop_stdvptocnp(struct vop_vptocnp_args *
VREF(vp);
locked = VOP_ISLOCKED(vp);
VOP_UNLOCK(vp, 0);
-   NDINIT_ATVP(nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE,
+   NDINIT_ATVP(nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF, UIO_SYSSPACE,
.., vp, td);
flags = FREAD;
error = vn_open_cred(nd, flags, 0, VN_OPEN_NOAUDIT, cred, NULL);
@@ -830,7 +830,7 @@ vop_stdvptocnp(struct vop_vptocnp_args *
VOP_UNLOCK(mvp, 0);
vn_close(mvp, FREAD, cred, td);
VREF(*dvp);
-   vn_lock(*dvp, LK_EXCLUSIVE | LK_RETRY);
+   vn_lock(*dvp, LK_SHARED | LK_RETRY);
covered = 1;
}
 
@@ -859,15 +859,15 @@ vop_stdvptocnp(struct vop_vptocnp_args *
(dp-d_fileno == fileno)) {
if (covered) {
VOP_UNLOCK(*dvp, 0);
-   vn_lock(mvp, LK_EXCLUSIVE | LK_RETRY);
+   vn_lock(mvp, LK_SHARED | LK_RETRY);
if (dirent_exists(mvp, dp-d_name, td)) {
error = ENOENT;
VOP_UNLOCK(mvp, 0);
-   vn_lock(*dvp, LK_EXCLUSIVE | LK_RETRY);
+   vn_lock(*dvp, LK_SHARED | LK_RETRY);
goto out;
}
VOP_UNLOCK(mvp, 0);
-   vn_lock(*dvp, LK_EXCLUSIVE | LK_RETRY);
+   vn_lock(*dvp, LK_SHARED | LK_RETRY);
}
i -= dp-d_namlen;
 
___
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: r285142 - in head/sys: amd64/conf arm64/conf i386/conf pc98/conf powerpc/conf sparc64/conf

2015-07-04 Thread George V. Neville-Neil
Author: gnn
Date: Sat Jul  4 17:37:00 2015
New Revision: 285142
URL: https://svnweb.freebsd.org/changeset/base/285142

Log:
  Enable IPSEC in all GENERIC kernels.
  
  Universe and kernel build tests passed 4 July 2015
  
  PR:   128030
  Sponsored by: Rubicon Communications (Netgate)

Modified:
  head/sys/amd64/conf/GENERIC
  head/sys/arm64/conf/GENERIC
  head/sys/i386/conf/GENERIC
  head/sys/pc98/conf/GENERIC
  head/sys/powerpc/conf/GENERIC
  head/sys/sparc64/conf/GENERIC

Modified: head/sys/amd64/conf/GENERIC
==
--- head/sys/amd64/conf/GENERIC Sat Jul  4 17:22:07 2015(r285141)
+++ head/sys/amd64/conf/GENERIC Sat Jul  4 17:37:00 2015(r285142)
@@ -28,6 +28,7 @@ options   SCHED_ULE   # ULE scheduler
 optionsPREEMPTION  # Enable kernel thread preemption
 optionsINET# InterNETworking
 optionsINET6   # IPv6 communications protocols
+optionsIPSEC   # IP (v4/v6) security
 optionsTCP_OFFLOAD # TCP offload
 optionsSCTP# Stream Control Transmission Protocol
 optionsFFS # Berkeley Fast Filesystem
@@ -363,3 +364,5 @@ device  vmx # VMware 
VMXNET3 Ethernet
 # Netmap provides direct access to TX/RX rings on supported NICs
 device netmap  # netmap(4) support
 
+# The cypto framework is required by IPSEC
+device crypto  # Required by IPSEC

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Sat Jul  4 17:22:07 2015(r285141)
+++ head/sys/arm64/conf/GENERIC Sat Jul  4 17:37:00 2015(r285142)
@@ -28,6 +28,7 @@ options   SCHED_ULE   # ULE scheduler
 optionsPREEMPTION  # Enable kernel thread preemption
 optionsINET# InterNETworking
 optionsINET6   # IPv6 communications protocols
+options IPSEC   # IP (v4/v6) security
 optionsTCP_OFFLOAD # TCP offload
 optionsSCTP# Stream Control Transmission Protocol
 optionsFFS # Berkeley Fast Filesystem
@@ -109,3 +110,6 @@ device  bpf # Berkeley packet filter
 
 optionsFDT
 device acpi
+
+# The cypto framework is required by IPSEC
+device crypto  # Required by IPSEC

Modified: head/sys/i386/conf/GENERIC
==
--- head/sys/i386/conf/GENERIC  Sat Jul  4 17:22:07 2015(r285141)
+++ head/sys/i386/conf/GENERIC  Sat Jul  4 17:37:00 2015(r285142)
@@ -30,6 +30,7 @@ options   SCHED_ULE   # ULE scheduler
 optionsPREEMPTION  # Enable kernel thread preemption
 optionsINET# InterNETworking
 optionsINET6   # IPv6 communications protocols
+options IPSEC   # IP (v4/v6) security
 optionsTCP_OFFLOAD # TCP offload
 optionsSCTP# Stream Control Transmission Protocol
 optionsFFS # Berkeley Fast Filesystem
@@ -377,3 +378,6 @@ device  xenpci  # Xen HVM 
Hypervisor se
 
 # VMware support
 device vmx # VMware VMXNET3 Ethernet
+
+# The cypto framework is required by IPSEC
+device crypto  # Required by IPSEC

Modified: head/sys/pc98/conf/GENERIC
==
--- head/sys/pc98/conf/GENERIC  Sat Jul  4 17:22:07 2015(r285141)
+++ head/sys/pc98/conf/GENERIC  Sat Jul  4 17:37:00 2015(r285142)
@@ -29,6 +29,7 @@ options   SCHED_4BSD  # 4BSD scheduler
 #options   PREEMPTION  # Enable kernel thread preemption
 optionsINET# InterNETworking
 optionsINET6   # IPv6 communications protocols
+options IPSEC   # IP (v4/v6) security
 optionsSCTP# Stream Control Transmission Protocol
 optionsFFS # Berkeley Fast Filesystem
 optionsSOFTUPDATES # Enable FFS soft updates support
@@ -255,3 +256,6 @@ device  bpf # Berkeley 
packet filter
 #devicesnd_mss # Microsoft Sound System
 #devicesnd_sb16  # Sound Blaster 16
 #devicesnd_sbc # Sound Blaster
+
+# The cypto framework is required by IPSEC
+device crypto  # Required by IPSEC

Modified: 

svn commit: r285143 - head/sbin/casperd

2015-07-04 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Sat Jul  4 17:38:56 2015
New Revision: 285143
URL: https://svnweb.freebsd.org/changeset/base/285143

Log:
  Remove unused variable flags reported by clang. The function zygote_clone()
  always receive the flags with value 0 and this flags is never checked on
  zygote_main().
  
  Differential Revision:D2689
  Reviewed by:  rodrigc, oshogbo

Modified:
  head/sbin/casperd/casperd.c
  head/sbin/casperd/zygote.c
  head/sbin/casperd/zygote.h

Modified: head/sbin/casperd/casperd.c
==
--- head/sbin/casperd/casperd.c Sat Jul  4 17:37:00 2015(r285142)
+++ head/sbin/casperd/casperd.c Sat Jul  4 17:38:56 2015(r285143)
@@ -253,7 +253,7 @@ casper_command(const char *cmd, const nv
return (error);
}
 
-   if (zygote_clone(service_external_execute, 0, chanfd, procfd) == -1) {
+   if (zygote_clone(service_external_execute, chanfd, procfd) == -1) {
error = errno;
close(execfd);
return (error);

Modified: head/sbin/casperd/zygote.c
==
--- head/sbin/casperd/zygote.c  Sat Jul  4 17:37:00 2015(r285142)
+++ head/sbin/casperd/zygote.c  Sat Jul  4 17:38:56 2015(r285143)
@@ -77,7 +77,7 @@ stdnull(void)
 }
 
 int
-zygote_clone(zygote_func_t *func, int flags, int *chanfdp, int *procfdp)
+zygote_clone(zygote_func_t *func, int *chanfdp, int *procfdp)
 {
nvlist_t *nvl;
int error;
@@ -90,7 +90,6 @@ zygote_clone(zygote_func_t *func, int fl
 
nvl = nvlist_create(0);
nvlist_add_number(nvl, func, (uint64_t)(uintptr_t)func);
-   nvlist_add_number(nvl, flags, (uint64_t)flags);
nvl = nvlist_xfer(zygote_sock, nvl, 0);
if (nvl == NULL)
return (-1);
@@ -117,7 +116,7 @@ zygote_clone(zygote_func_t *func, int fl
 static void
 zygote_main(int sock)
 {
-   int error, fd, flags, procfd;
+   int error, fd, procfd;
int chanfd[2];
nvlist_t *nvlin, *nvlout;
zygote_func_t *func;
@@ -144,7 +143,6 @@ zygote_main(int sock)
}
func = (zygote_func_t *)(uintptr_t)nvlist_get_number(nvlin,
func);
-   flags = (int)nvlist_get_number(nvlin, flags);
nvlist_destroy(nvlin);
 
/*

Modified: head/sbin/casperd/zygote.h
==
--- head/sbin/casperd/zygote.h  Sat Jul  4 17:37:00 2015(r285142)
+++ head/sbin/casperd/zygote.h  Sat Jul  4 17:38:56 2015(r285143)
@@ -35,6 +35,6 @@
 typedef void zygote_func_t(int);
 
 int zygote_init(void);
-int zygote_clone(zygote_func_t *func, int flags, int *chanfdp, int *procfdp);
+int zygote_clone(zygote_func_t *func, int *chanfdp, int *procfdp);
 
 #endif /* !_ZYGOTE_H_ */
___
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: r285147 - head/sys/dev/isp

2015-07-04 Thread Alexander Motin
Author: mav
Date: Sat Jul  4 18:51:54 2015
New Revision: 285147
URL: https://svnweb.freebsd.org/changeset/base/285147

Log:
  Change comment added in r284540.
  
  This appeared to be not card's issue, but driver's, though solution is
  the same so far.

Modified:
  head/sys/dev/isp/isp_freebsd.c

Modified: head/sys/dev/isp/isp_freebsd.c
==
--- head/sys/dev/isp/isp_freebsd.c  Sat Jul  4 18:38:46 2015
(r285146)
+++ head/sys/dev/isp/isp_freebsd.c  Sat Jul  4 18:51:54 2015
(r285147)
@@ -2965,9 +2965,9 @@ isp_handle_platform_ctio(ispsoftc_t *isp
}
if (atp == NULL) {
/*
-* In case of target mode disable at least ISP2532 return
-* invalid zero ct_rxid value.  Try to workaround that using
-* tag_id from the CCB, pointed by valid ct_syshandle.
+* XXX: isp_clear_commands() generates fake CTIO with zero
+* ct_rxid value, filling only ct_syshandle.  Workaround
+* that using tag_id from the CCB, pointed by ct_syshandle.
 */
atp = isp_find_atpd(isp, tptr, ccb-csio.tag_id);
}
___
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: r285155 - in head/sys: cam/ctl dev/isp

2015-07-04 Thread Alexander Motin
Author: mav
Date: Sun Jul  5 03:38:58 2015
New Revision: 285155
URL: https://svnweb.freebsd.org/changeset/base/285155

Log:
  Make first step toward supporting target and initiator roles same time.
  
  To avoid conflicts between target and initiator devices in CAM, make
  CTL use target ID reported by HBA as its initiator_id in XPT_PATH_INQ.
  That target ID is known to never be used for initiator role, so it won't
  conflict.  For Fibre Channel and FireWire HBAs this specific ID choice
  is irrelevant since all target IDs there are virtual. Same time for SPI
  HBAs it seems could be even requirement to use same target ID for both
  initiator and target roles.
  
  While there are some more things to polish in isp(4) driver, first tests
  of using both roles same time on the same port appeared successfull:
  
  # camcontrol devlist -v
  scbus0 on isp0 bus 0:
  FREEBSD CTLDISK 0001 at scbus0 target 1 lun 0 (da20,pass21)
   at scbus0 target 256 lun 0 (ctl0)
   at scbus0 target -1 lun  (ctl1)

Modified:
  head/sys/cam/ctl/scsi_ctl.c
  head/sys/dev/isp/isp_freebsd.c

Modified: head/sys/cam/ctl/scsi_ctl.c
==
--- head/sys/cam/ctl/scsi_ctl.c Sun Jul  5 02:09:46 2015(r285154)
+++ head/sys/cam/ctl/scsi_ctl.c Sun Jul  5 03:38:58 2015(r285155)
@@ -75,6 +75,7 @@ __FBSDID($FreeBSD$);
 struct ctlfe_softc {
struct ctl_port port;
path_id_t path_id;
+   target_id_t target_id;
u_int   maxio;
struct cam_sim *sim;
char port_name[DEV_IDLEN];
@@ -357,6 +358,7 @@ ctlfeasync(void *callback_arg, uint32_t 
}
 
softc-path_id = cpi-ccb_h.path_id;
+   softc-target_id = cpi-initiator_id;
softc-sim = xpt_path_sim(path);
if (cpi-maxio != 0)
softc-maxio = cpi-maxio;
@@ -1557,6 +1559,8 @@ ctlfe_onoffline(void *arg, int online)
}
ccb = xpt_alloc_ccb();
xpt_setup_ccb(ccb-ccb_h, path, CAM_PRIORITY_NONE);
+   ccb-ccb_h.func_code = XPT_GET_SIM_KNOB;
+   xpt_action(ccb);
 
/*
 * Copan WWN format:
@@ -1570,15 +1574,7 @@ ctlfe_onoffline(void *arg, int online)
 *  3 == NL-Port
 * Bits 7-0:0 == Node Name, 0 == Port Number
 */
-
if (online != 0) {
-
-   ccb-ccb_h.func_code = XPT_GET_SIM_KNOB;
-
-
-   xpt_action(ccb);
-
-
if ((ccb-knob.xport_specific.valid  KNOB_VALID_ADDRESS) != 0){
 #ifdef RANDOM_WWNN
uint64_t random_bits;
@@ -1677,9 +1673,9 @@ ctlfe_onoffline(void *arg, int online)
ccb-knob.xport_specific.valid |= KNOB_VALID_ADDRESS;
 
if (online != 0)
-   ccb-knob.xport_specific.fc.role = KNOB_ROLE_TARGET;
+   ccb-knob.xport_specific.fc.role |= KNOB_ROLE_TARGET;
else
-   ccb-knob.xport_specific.fc.role = KNOB_ROLE_NONE;
+   ccb-knob.xport_specific.fc.role = ~KNOB_ROLE_TARGET;
 
xpt_action(ccb);
 
@@ -1809,7 +1805,7 @@ ctlfe_lun_enable(void *arg, int lun_id)
bus_softc = (struct ctlfe_softc *)arg;
 
status = xpt_create_path(path, /*periph*/ NULL,
- bus_softc-path_id, 0, lun_id);
+ bus_softc-path_id, bus_softc-target_id, 
lun_id);
/* XXX KDM need some way to return status to CTL here? */
if (status != CAM_REQ_CMP) {
printf(%s: could not create path, status %#x\n, __func__,

Modified: head/sys/dev/isp/isp_freebsd.c
==
--- head/sys/dev/isp/isp_freebsd.c  Sun Jul  5 02:09:46 2015
(r285154)
+++ head/sys/dev/isp/isp_freebsd.c  Sun Jul  5 03:38:58 2015
(r285155)
@@ -462,24 +462,11 @@ ispioctl(struct cdev *dev, u_long c, cad
retval = EINVAL;
break;
}
-   if (IS_FC(isp)) {
-   /*
-* We don't really support dual role at present on FC 
cards.
-*
-* We should, but a bunch of things are currently 
broken,
-* so don't allow it.
-*/
-   if (nr == ISP_ROLE_BOTH) {
-   isp_prt(isp, ISP_LOGERR, cannot support dual 
role at present);
-   retval = EINVAL;
-   break;
-   }
-   ISP_LOCK(isp);
+   ISP_LOCK(isp);
+   if (IS_FC(isp))
*(int *)addr = FCPARAM(isp, chan)-role;
-   } else {
-   ISP_LOCK(isp);
+   else

svn commit: r285154 - head/sys/dev/isp

2015-07-04 Thread Alexander Motin
Author: mav
Date: Sun Jul  5 02:09:46 2015
New Revision: 285154
URL: https://svnweb.freebsd.org/changeset/base/285154

Log:
  Remove extra level of target ID indirection (isp_dev_map).
  
  FreeBSD never had limitation on number of target IDs, and there is no
  any other requirement to allocate them densely.  Since slots of port
  database already populated just sequentially, there is no much need
  for another indirection to allocate sequentially too.

Modified:
  head/sys/dev/isp/isp.c
  head/sys/dev/isp/isp_freebsd.c
  head/sys/dev/isp/ispvar.h

Modified: head/sys/dev/isp/isp.c
==
--- head/sys/dev/isp/isp.c  Sat Jul  4 21:50:39 2015(r285153)
+++ head/sys/dev/isp/isp.c  Sun Jul  5 02:09:46 2015(r285154)
@@ -2233,9 +2233,6 @@ isp_del_all_init_entries(ispsoftc_t *isp
lp = fcp-portdb[i];
if (lp-state == FC_PORTDB_STATE_NIL || lp-target_mode)
continue;
-   /*
-* It's up to the outer layers to clear isp_dev_map.
-*/
lp-state = FC_PORTDB_STATE_NIL;
isp_async(isp, ISPASYNC_DEV_GONE, chan, lp, 1);
if (lp-autologin == 0) {
@@ -3007,9 +3004,6 @@ isp_pdb_sync(ispsoftc_t *isp, int chan)
switch (lp-state) {
case FC_PORTDB_STATE_PROBATIONAL:
case FC_PORTDB_STATE_DEAD:
-   /*
-* It's up to the outer layers to clear isp_dev_map.
-*/
lp-state = FC_PORTDB_STATE_NIL;
isp_async(isp, ISPASYNC_DEV_GONE, chan, lp, 0);
if (lp-autologin == 0) {
@@ -3029,10 +3023,6 @@ isp_pdb_sync(ispsoftc_t *isp, int chan)
 */
break;
case FC_PORTDB_STATE_NEW:
-   /*
-* It's up to the outer layers to assign a virtual
-* target id in isp_dev_map (if any).
-*/
lp-portid = lp-new_portid;
lp-prli_word3 = lp-new_prli_word3;
lp-state = FC_PORTDB_STATE_VALID;
@@ -3054,10 +3044,6 @@ isp_pdb_sync(ispsoftc_t *isp, int chan)
case FC_PORTDB_STATE_PENDING_VALID:
lp-portid = lp-new_portid;
lp-prli_word3 = lp-new_prli_word3;
-   if (lp-dev_map_idx) {
-   int t = lp-dev_map_idx - 1;
-   fcp-isp_dev_map[t] = dbidx + 1;
-   }
lp-state = FC_PORTDB_STATE_VALID;
isp_async(isp, ISPASYNC_DEV_STAYED, chan, lp);
if (dbidx != FL_ID) {
@@ -4354,7 +4340,8 @@ isp_start(XS_T *xs)
ispreq_t *reqp;
void *cdbp, *qep;
uint16_t *tptr;
-   int target, dmaresult, hdlidx = 0;
+   fcportdb_t *lp;
+   int target, dmaresult;
 
XS_INITERR(xs);
isp = XS_ISP(xs);
@@ -4403,29 +4390,23 @@ isp_start(XS_T *xs)
return (CMD_RQLATER);
}
 
-   if (XS_TGT(xs) = MAX_FC_TARG) {
-   isp_prt(isp, ISP_LOG_WARN1, %d.%d.%d target too big, 
XS_CHANNEL(xs), target, XS_LUN(xs));
+   isp_prt(isp, ISP_LOGDEBUG2, XS_TGT(xs)=%d, target);
+   lp = fcp-portdb[target];
+   if (target  0 || target = MAX_FC_TARG ||
+   lp-dev_map_idx == 0) {
XS_SETERR(xs, HBA_SELTIMEOUT);
return (CMD_COMPLETE);
}
-
-   hdlidx = fcp-isp_dev_map[XS_TGT(xs)] - 1;
-   isp_prt(isp, ISP_LOGDEBUG2, XS_TGT(xs)=%d- hdlidx value %d, 
XS_TGT(xs), hdlidx);
-   if (hdlidx  0 || hdlidx = MAX_FC_TARG) {
-   XS_SETERR(xs, HBA_SELTIMEOUT);
-   return (CMD_COMPLETE);
-   }
-   if (fcp-portdb[hdlidx].state == FC_PORTDB_STATE_ZOMBIE) {
+   if (lp-state == FC_PORTDB_STATE_ZOMBIE) {
isp_prt(isp, ISP_LOGDEBUG1, %d.%d.%d target zombie, 
XS_CHANNEL(xs), target, XS_LUN(xs));
return (CMD_RQLATER);
}
-   if (fcp-portdb[hdlidx].state != FC_PORTDB_STATE_VALID) {
-   isp_prt(isp, ISP_LOGDEBUG1, %d.%d.%d bad db port state 
0x%x, XS_CHANNEL(xs), target, XS_LUN(xs), fcp-portdb[hdlidx].state);
+   if (lp-state != FC_PORTDB_STATE_VALID) {
+   isp_prt(isp, ISP_LOGDEBUG1, %d.%d.%d bad db port state 
0x%x, XS_CHANNEL(xs), target, XS_LUN(xs), lp-state);
XS_SETERR(xs, HBA_SELTIMEOUT);
return (CMD_COMPLETE);
}
-   target = fcp-portdb[hdlidx].handle;
- 

svn commit: r285133 - in head/usr.sbin/pw: . tests

2015-07-04 Thread Baptiste Daroussin
Author: bapt
Date: Sat Jul  4 15:27:04 2015
New Revision: 285133
URL: https://svnweb.freebsd.org/changeset/base/285133

Log:
  Validate input of pw usermod -h and pwusermod -H
  
  Push the code that set the password into a separate function to improve
  readability
  
  Add regression tests about pw usermod -h and pw usermod -H

Modified:
  head/usr.sbin/pw/pw.c
  head/usr.sbin/pw/pw_user.c
  head/usr.sbin/pw/pwupd.h
  head/usr.sbin/pw/tests/pw_usermod.sh

Modified: head/usr.sbin/pw/pw.c
==
--- head/usr.sbin/pw/pw.c   Sat Jul  4 14:50:32 2015(r285132)
+++ head/usr.sbin/pw/pw.c   Sat Jul  4 15:27:04 2015(r285133)
@@ -137,6 +137,7 @@ main(int argc, char *argv[])
relocated = nis = false;
memset(conf, 0, sizeof(conf));
strlcpy(conf.etcpath, _PATH_PWD, sizeof(conf.etcpath));
+   conf.fd = -1;
 
LIST_INIT(arglist);
 
@@ -280,6 +281,35 @@ main(int argc, char *argv[])
errx(EX_USAGE, Bad id '%s': %s, optarg,
errstr);
break;
+   case 'H':
+   if (conf.fd != -1)
+   errx(EX_USAGE, '-h' and '-H' are mutually 
+   exclusive options);
+   conf.precrypted = true;
+   if (strspn(optarg, 0123456789) != strlen(optarg))
+   errx(EX_USAGE, '-H' expects a file 
descriptor);
+
+   conf.fd = strtonum(optarg, 0, INT_MAX, errstr);
+   if (errstr != NULL)
+   errx(EX_USAGE, Bad file descriptor '%s': %s,
+   optarg, errstr);
+   break;
+   case 'h':
+   if (conf.fd != -1)
+   errx(EX_USAGE, '-h' and '-H' are mutually 
+   exclusive options);
+
+   if (strcmp(optarg, -) == 0)
+   conf.fd = '-';
+   else if (strspn(optarg, 0123456789) == 
strlen(optarg)) {
+   conf.fd = strtonum(optarg, 0, INT_MAX, errstr);
+   if (errstr != NULL)
+   errx(EX_USAGE, '-h' expects a 
+   file descriptor or '-');
+   } else
+   errx(EX_USAGE, '-h' expects a file 
+   descriptor or '-');
+   break;
case 'o':
conf.checkduplicate = true;
break;

Modified: head/usr.sbin/pw/pw_user.c
==
--- head/usr.sbin/pw/pw_user.c  Sat Jul  4 14:50:32 2015(r285132)
+++ head/usr.sbin/pw/pw_user.c  Sat Jul  4 15:27:04 2015(r285133)
@@ -86,6 +86,67 @@ create_and_populate_homedir(int mode, st
pwd-pw_uid, pwd-pw_dir);
 }
 
+static int
+set_passwd(struct passwd *pwd, struct carg *arg, bool update)
+{
+   int  b, istty;
+   struct termios   t, n;
+   login_cap_t *lc;
+   charline[_PASSWORD_LEN+1];
+   char*p;
+
+   if (conf.fd == '-') {
+   if (!pwd-pw_passwd || *pwd-pw_passwd != '*') {
+   pwd-pw_passwd = *;   /* No access */
+   return (1);
+   }
+   return (0);
+   }
+
+   if ((istty = isatty(conf.fd))) {
+   if (tcgetattr(conf.fd, t) == -1)
+   istty = 0;
+   else {
+   n.c_lflag = ~(ECHO);
+   tcsetattr(conf.fd, TCSANOW, n);
+   printf(%s%spassword for user %s:,
+   update ? new  : ,
+   conf.precrypted ? encrypted  : ,
+   pwd-pw_name);
+   fflush(stdout);
+   }
+   }
+   b = read(conf.fd, line, sizeof(line) - 1);
+   if (istty) {/* Restore state */
+   tcsetattr(conf.fd, TCSANOW, t);
+   fputc('\n', stdout);
+   fflush(stdout);
+   }
+
+   if (b  0)
+   err(EX_IOERR, -%c file descriptor,
+   conf.precrypted ? 'H' : 'h');
+   line[b] = '\0';
+   if ((p = strpbrk(line, \r\n)) != NULL)
+   *p = '\0';
+   if (!*line)
+   errx(EX_DATAERR, empty password read on file descriptor %d,
+   conf.fd);
+   if (conf.precrypted) {
+   if (strchr(line, ':') != NULL)
+   return EX_DATAERR;
+   pwd-pw_passwd = line;
+   } else {
+   lc = login_getpwclass(pwd);
+   if (lc == NULL 

svn commit: r285129 - in head: . lib/libnv share/man/man9

2015-07-04 Thread Mariusz Zaborski
Author: oshogbo
Date: Sat Jul  4 10:27:30 2015
New Revision: 285129
URL: https://svnweb.freebsd.org/changeset/base/285129

Log:
  Move nvlist documentation to the FreeBSD Kernel Developer's sections.
  
  Approved by:  pjd (mentor)

Added:
  head/share/man/man9/nv.9
 - copied, changed from r285128, head/lib/libnv/nv.3
Deleted:
  head/lib/libnv/nv.3
Modified:
  head/ObsoleteFiles.inc
  head/lib/libnv/Makefile
  head/share/man/man9/Makefile

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Sat Jul  4 08:40:48 2015(r285128)
+++ head/ObsoleteFiles.inc  Sat Jul  4 10:27:30 2015(r285129)
@@ -38,6 +38,69 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20150604: Move nvlist man pages to section 9.
+OLD_FILES+=usr/share/man/man3/libnv.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_add_binary.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_add_bool.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_add_descriptor.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_add_null.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_add_number.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_add_nvlist.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_add_string.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_add_stringf.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_add_stringv.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_clone.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_create.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_destroy.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_dump.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_empty.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_error.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_exists.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_exists_binary.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_exists_bool.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_exists_descriptor.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_exists_null.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_exists_number.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_exists_nvlist.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_exists_string.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_exists_type.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_fdump.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_flags.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_free.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_free_binary.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_free_bool.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_free_descriptor.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_free_null.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_free_number.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_free_nvlist.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_free_string.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_free_type.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_get_binary.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_get_bool.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_get_descriptor.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_get_number.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_get_nvlist.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_get_parent.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_get_string.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_move_binary.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_move_descriptor.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_move_nvlist.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_move_string.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_next.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_pack.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_recv.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_send.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_set_error.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_size.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_take_binary.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_take_bool.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_take_descriptor.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_take_number.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_take_nvlist.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_take_string.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_unpack.3.gz
+OLD_FILES+=usr/share/man/man3/nvlist_xfer.3.gz
 # 20150702: Remove duplicated nvlist includes.
 OLD_FILES+=usr/include/dnv.h
 OLD_FILES+=usr/include/nv.h

Modified: head/lib/libnv/Makefile
==
--- head/lib/libnv/Makefile Sat Jul  4 08:40:48 2015(r285128)
+++ head/lib/libnv/Makefile Sat Jul  4 10:27:30 2015(r285129)
@@ -15,71 +15,6 @@ SRCS+=   msgio.c
 SRCS+= subr_nvlist.c
 SRCS+= subr_nvpair.c
 
-MAN+=  nv.3
-
-MLINKS+=nv.3 libnv.3 \
-   nv.3 nvlist.3
-MLINKS+=nv.3 nvlist_add_binary.3 \
-   nv.3 nvlist_add_bool.3 \
-   nv.3 nvlist_add_descriptor.3 \
-   nv.3 nvlist_add_null.3 \
-   nv.3 nvlist_add_number.3 \
-   nv.3 nvlist_add_nvlist.3 \
-   nv.3 nvlist_add_string.3 \
-   nv.3 nvlist_add_stringf.3 \
-   nv.3 nvlist_add_stringv.3 \
-   nv.3 nvlist_clone.3 \
-   nv.3 nvlist_create.3 \

svn commit: r285130 - head/sys/sys

2015-07-04 Thread Mariusz Zaborski
Author: oshogbo
Date: Sat Jul  4 10:33:33 2015
New Revision: 285130
URL: https://svnweb.freebsd.org/changeset/base/285130

Log:
  Remove non-existent dnvlist functions.
  
  Approved by:  pjd (mentor)

Modified:
  head/sys/sys/dnv.h

Modified: head/sys/sys/dnv.h
==
--- head/sys/sys/dnv.h  Sat Jul  4 10:27:30 2015(r285129)
+++ head/sys/sys/dnv.h  Sat Jul  4 10:33:33 2015(r285130)
@@ -65,22 +65,6 @@ const nvlist_t *dnvlist_get_nvlist(const
 int dnvlist_get_descriptor(const nvlist_t *nvl, const char *name, int defval);
 const void *dnvlist_get_binary(const nvlist_t *nvl, const char *name, size_t 
*sizep, const void *defval, size_t defsize);
 
-#ifndef _KERNEL
-bool dnvlist_getf_bool(const nvlist_t *nvl, bool defval, const char *namefmt, 
...) __printflike(3, 4);
-uint64_t dnvlist_getf_number(const nvlist_t *nvl, uint64_t defval, const char 
*namefmt, ...) __printflike(3, 4);
-const char *dnvlist_getf_string(const nvlist_t *nvl, const char *defval, const 
char *namefmt, ...) __printflike(3, 4);
-const nvlist_t *dnvlist_getf_nvlist(const nvlist_t *nvl, const nvlist_t 
*defval, const char *namefmt, ...) __printflike(3, 4);
-int dnvlist_getf_descriptor(const nvlist_t *nvl, int defval, const char 
*namefmt, ...) __printflike(3, 4);
-const void *dnvlist_getf_binary(const nvlist_t *nvl, size_t *sizep, const void 
*defval, size_t defsize, const char *namefmt, ...) __printflike(5, 6);
-
-bool dnvlist_getv_bool(const nvlist_t *nvl, bool defval, const char *namefmt, 
va_list nameap) __printflike(3, 0);
-uint64_t dnvlist_getv_number(const nvlist_t *nvl, uint64_t defval, const char 
*namefmt, va_list nameap) __printflike(3, 0);
-const char *dnvlist_getv_string(const nvlist_t *nvl, const char *defval, const 
char *namefmt, va_list nameap) __printflike(3, 0);
-const nvlist_t *dnvlist_getv_nvlist(const nvlist_t *nvl, const nvlist_t 
*defval, const char *namefmt, va_list nameap) __printflike(3, 0);
-int dnvlist_getv_descriptor(const nvlist_t *nvl, int defval, const char 
*namefmt, va_list nameap) __printflike(3, 0);
-const void *dnvlist_getv_binary(const nvlist_t *nvl, size_t *sizep, const void 
*defval, size_t defsize, const char *namefmt, va_list nameap) __printflike(5, 
0);
-#endif
-
 /*
  * The dnvlist_take functions returns value associated with the given name and
  * remove corresponding nvpair.
@@ -96,22 +80,6 @@ nvlist_t *dnvlist_take_nvlist(nvlist_t *
 int dnvlist_take_descriptor(nvlist_t *nvl, const char *name, int defval);
 void *dnvlist_take_binary(nvlist_t *nvl, const char *name, size_t *sizep, void 
*defval, size_t defsize);
 
-#ifndef _KERNEL
-bool dnvlist_takef_bool(nvlist_t *nvl, bool defval, const char *namefmt, ...) 
__printflike(3, 4);
-uint64_t dnvlist_takef_number(nvlist_t *nvl, uint64_t defval, const char 
*namefmt, ...) __printflike(3, 4);
-char *dnvlist_takef_string(nvlist_t *nvl, char *defval, const char *namefmt, 
...) __printflike(3, 4);
-nvlist_t *dnvlist_takef_nvlist(nvlist_t *nvl, nvlist_t *defval, const char 
*namefmt, ...) __printflike(3, 4);
-int dnvlist_takef_descriptor(nvlist_t *nvl, int defval, const char *namefmt, 
...) __printflike(3, 4);
-void *dnvlist_takef_binary(nvlist_t *nvl, size_t *sizep, void *defval, size_t 
defsize, const char *namefmt, ...) __printflike(5, 6);
-
-bool dnvlist_takev_bool(nvlist_t *nvl, bool defval, const char *namefmt, 
va_list nameap) __printflike(3, 0);
-uint64_t dnvlist_takev_number(nvlist_t *nvl, uint64_t defval, const char 
*namefmt, va_list nameap) __printflike(3, 0);
-char *dnvlist_takev_string(nvlist_t *nvl, char *defval, const char *namefmt, 
va_list nameap) __printflike(3, 0);
-nvlist_t *dnvlist_takev_nvlist(nvlist_t *nvl, nvlist_t *defval, const char 
*namefmt, va_list nameap) __printflike(3, 0);
-int dnvlist_takev_descriptor(nvlist_t *nvl, int defval, const char *namefmt, 
va_list nameap) __printflike(3, 0);
-void *dnvlist_takev_binary(nvlist_t *nvl, size_t *sizep, void *defval, size_t 
defsize, const char *namefmt, va_list nameap) __printflike(5, 0);
-#endif
-
 __END_DECLS
 
 #endif /* !_DNV_H_ */
___
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