svn commit: r236139 - head/crypto/openssh

2012-05-27 Thread Eygene Ryabinkin
Author: rea (ports committer)
Date: Sun May 27 06:53:35 2012
New Revision: 236139
URL: http://svn.freebsd.org/changeset/base/236139

Log:
  OpenSSH: allow VersionAddendum to be used again
  
  Prior to this, setting VersionAddendum will be a no-op: one will
  always have BASE_VERSION +   + VERSION_HPN for VersionAddendum
  set in the config and a bare BASE_VERSION + VERSION_HPN when there
  is no VersionAddendum is set.
  
  HPN patch requires both parties to have the hpn inside their
  advertized versions, so we add VERSION_HPN to the VERSION_BASE
  if HPN is enabled and omitting it if HPN is disabled.
  
  VersionAddendum now uses the following logics:
   * unset (default value): append   and VERSION_ADDENDUM;
   * VersionAddendum is set and isn't empty: append  
 and VersionAddendum;
   * VersionAddendum is set and empty: don't append anything.
  
  Approved by: des
  Reviewed by: bz
  MFC after: 3 days

Modified:
  head/crypto/openssh/ssh.c
  head/crypto/openssh/sshconnect.c
  head/crypto/openssh/sshd.c
  head/crypto/openssh/version.c
  head/crypto/openssh/version.h

Modified: head/crypto/openssh/ssh.c
==
--- head/crypto/openssh/ssh.c   Sun May 27 06:11:09 2012(r236138)
+++ head/crypto/openssh/ssh.c   Sun May 27 06:53:35 2012(r236139)
@@ -437,7 +437,8 @@ main(int ac, char **av)
/* FALLTHROUGH */
case 'V':
fprintf(stderr, %s, %s\n,
-   SSH_RELEASE, SSLeay_version(SSLEAY_VERSION));
+   ssh_version_get(options.hpn_disabled),
+   SSLeay_version(SSLEAY_VERSION));
if (opt == 'V')
exit(0);
break;

Modified: head/crypto/openssh/sshconnect.c
==
--- head/crypto/openssh/sshconnect.cSun May 27 06:11:09 2012
(r236138)
+++ head/crypto/openssh/sshconnect.cSun May 27 06:53:35 2012
(r236139)
@@ -585,7 +585,7 @@ ssh_exchange_identification(int timeout_
snprintf(buf, sizeof buf, SSH-%d.%d-%.100s%s,
compat20 ? PROTOCOL_MAJOR_2 : PROTOCOL_MAJOR_1,
compat20 ? PROTOCOL_MINOR_2 : minor1,
-   SSH_RELEASE, compat20 ? \r\n : \n);
+   ssh_version_get(options.hpn_disabled), compat20 ? \r\n : \n);
if (roaming_atomicio(vwrite, connection_out, buf, strlen(buf))
!= strlen(buf))
fatal(write: %.100s, strerror(errno));

Modified: head/crypto/openssh/sshd.c
==
--- head/crypto/openssh/sshd.c  Sun May 27 06:11:09 2012(r236138)
+++ head/crypto/openssh/sshd.c  Sun May 27 06:53:35 2012(r236139)
@@ -431,7 +431,7 @@ sshd_exchange_identification(int sock_in
minor = PROTOCOL_MINOR_1;
}
snprintf(buf, sizeof buf, SSH-%d.%d-%.100s%s, major, minor,
-   SSH_RELEASE, newline);
+   ssh_version_get(options.hpn_disabled), newline);
server_version_string = xstrdup(buf);
 
/* Send our protocol version identification. */
@@ -894,7 +894,7 @@ static void
 usage(void)
 {
fprintf(stderr, %s, %s\n,
-   SSH_RELEASE, SSLeay_version(SSLEAY_VERSION));
+   ssh_version_get(0), SSLeay_version(SSLEAY_VERSION));
fprintf(stderr,
 usage: sshd [-46DdeiqTt] [-b bits] [-C connection_spec] [-c host_cert_file]\n
 [-f config_file] [-g login_grace_time] [-h host_key_file]\n
@@ -1583,7 +1583,7 @@ main(int ac, char **av)
exit(1);
}
 
-   debug(sshd version %.100s, SSH_RELEASE);
+   debug(sshd version %.100s, ssh_version_get(options.hpn_disabled));
 
/* Store privilege separation user for later use if required. */
if ((privsep_pw = getpwnam(SSH_PRIVSEP_USER)) == NULL) {

Modified: head/crypto/openssh/version.c
==
--- head/crypto/openssh/version.c   Sun May 27 06:11:09 2012
(r236138)
+++ head/crypto/openssh/version.c   Sun May 27 06:53:35 2012
(r236139)
@@ -1,5 +1,6 @@
 /*-
  * Copyright (c) 2001 Brian Fundakowski Feldman
+ * Copyright (c) 2012 Eygene Ryabinkin r...@freebsd.org
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -35,30 +36,60 @@ __RCSID($FreeBSD$);
 
 
 static char *version = NULL;
+/* NULL means use default value, empty string means unset */
+static const char *addendum = NULL;
+static unsigned char update_version = 1;
 
+/*
+ * Constructs the version string if it is empty or needs updating.
+ *
+ * HPN patch we're running requires both parties
+ * to have the hpn string inside the advertized version
+ * (see compat.c::compat_datafellows), so we should
+ * include it to the generated 

Re: svn commit: r236026 - in head/sys: amd64/linux32 compat/freebsd32 kern

2012-05-27 Thread Bruce Evans

On Sun, 27 May 2012, Bruce Evans wrote:


On Sat, 26 May 2012, Konstantin Belousov wrote:


On Sat, May 26, 2012 at 10:21:25PM +1000, Bruce Evans wrote:

...
All the non-indirect char *s for pathnames and other things seem to be
completely wrong on amd64 too.  These pointers start as 32 bits, and it
takes more than a bad type pun to turn then into kernel 64-bit pointers.
The magic for this seems to be:
- all args are converted to 64 bits (by zero-extension?) at a low level
...

The 'low level' AKA magic happens in several *_fetch_syscall_args()
functions. For both linux32 and freebsd32, the magic code automatically
zero-extends the arguments into 64bit entities. Linux passes args in
registers, while FreeBSD uses words on stack.


Actually, the amd64 linux_fetch32_fetch_syscall_args() just copies from
64-bit registers frame-tf_r* to 64-bit sa-args[*].  I can't see how
this gives anything except garbage in the top bits.  Is there magic in
the switch to 64-bit mode that sets the top bits?  Anyway, sign extension
would give garbage for unsigned args, and zero-extension would give
garbage for negative signed args.


I checked what actually happens.  There is no magic.  The registers
just have garbage in the top bits.  Mostly this is 0.  Sometimes it
is all top bits 1.  Sometimes it is some top bits 1 (starting at the
top).  I traced a bit of the execution of ld-linux.so...  The first
syscall was an linux_mmap.  It had all top bits 1 in tf_rbx, then some
top bits 1 in a later register, and all top bits 0 in 4 registers.
Then there were several syscalls with all top bits in all 6 syscall
arg registers 0.  Then there was a linux_write syscall with 1's back
in some top bits.  Then there were many syscalls with all top bits in
all arg registers 0.

This behaviour is probably due to the initial state being more random
(but why doesn't exec clear all top bits?).  Then normal activity
like xorl %ebx,%ebx tends to clear top bits (does this xorl clear top
bits even in 32-bit mode?).  Then something occasionally sets top bits
to 1.


The amd64 ia32_fetch_syscall_args() is quite different.  Now the args
...


Bruce
___
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: r236140 - head/sys/fs/ntfs

2012-05-27 Thread Ed Schouten
Author: ed
Date: Sun May 27 09:34:47 2012
New Revision: 236140
URL: http://svn.freebsd.org/changeset/base/236140

Log:
  Fix style and consistency:
  
  - Use tabs, not spaces.
  - Add tab after #define.
  - Don't mix the use of BSD and ISO C unsigned integer types. Prefer the
ISO C ones.

Modified:
  head/sys/fs/ntfs/ntfs.h

Modified: head/sys/fs/ntfs/ntfs.h
==
--- head/sys/fs/ntfs/ntfs.h Sun May 27 06:53:35 2012(r236139)
+++ head/sys/fs/ntfs/ntfs.h Sun May 27 09:34:47 2012(r236140)
@@ -30,11 +30,11 @@
 
 /*#define NTFS_DEBUG 1*/
 
-typedef u_int64_t cn_t;
-typedef u_int16_t wchar;
+typedef uint64_t cn_t;
+typedef uint16_t wchar;
 
 #pragma pack(1)
-#define BBSIZE 1024
+#defineBBSIZE  1024
 #defineBBOFF   ((off_t)(0))
 #defineBBLOCK  0
 #defineNTFS_MFTINO 0
@@ -45,157 +45,157 @@ typedef u_int16_t wchar;
 #defineNTFS_BOOTINO7
 #defineNTFS_BADCLUSINO 8
 #defineNTFS_UPCASEINO  10
-#define NTFS_MAXFILENAME   255
+#defineNTFS_MAXFILENAME255
 
 struct fixuphdr {
-   u_int32_t   fh_magic;
-   u_int16_t   fh_foff;
-   u_int16_t   fh_fnum;
+   uint32_tfh_magic;
+   uint16_tfh_foff;
+   uint16_tfh_fnum;
 };
 
-#define NTFS_AF_INRUN  0x0001
+#defineNTFS_AF_INRUN   0x0001
 struct attrhdr {
-   u_int32_t   a_type;
-   u_int32_t   reclen;
-   u_int8_ta_flag;
-   u_int8_ta_namelen;
-   u_int8_ta_nameoff;
-   u_int8_treserved1;
-   u_int8_ta_compression;
-   u_int8_treserved2;
-   u_int16_t   a_index;
-};
-#define NTFS_A_STD 0x10
-#define NTFS_A_ATTRLIST0x20
-#define NTFS_A_NAME0x30
-#define NTFS_A_VOLUMENAME  0x60
-#define NTFS_A_DATA0x80
+   uint32_ta_type;
+   uint32_treclen;
+   uint8_t a_flag;
+   uint8_t a_namelen;
+   uint8_t a_nameoff;
+   uint8_t reserved1;
+   uint8_t a_compression;
+   uint8_t reserved2;
+   uint16_ta_index;
+};
+#defineNTFS_A_STD  0x10
+#defineNTFS_A_ATTRLIST 0x20
+#defineNTFS_A_NAME 0x30
+#defineNTFS_A_VOLUMENAME   0x60
+#defineNTFS_A_DATA 0x80
 #defineNTFS_A_INDXROOT 0x90
 #defineNTFS_A_INDX 0xA0
-#define NTFS_A_INDXBITMAP 0xB0
+#defineNTFS_A_INDXBITMAP 0xB0
 
-#define NTFS_MAXATTRNAME   255
+#defineNTFS_MAXATTRNAME255
 struct attr {
-   struct attrhdr  a_hdr;
+   struct attrhdr  a_hdr;
union {
struct {
-   u_int16_t   a_datalen;
-   u_int16_t   reserved1;
-   u_int16_t   a_dataoff;
-   u_int16_t   a_indexed;
-   }   a_S_r;
+   uint16_ta_datalen;
+   uint16_treserved1;
+   uint16_ta_dataoff;
+   uint16_ta_indexed;
+   } a_S_r;
struct {
-   cn_ta_vcnstart;
-   cn_ta_vcnend;
-   u_int16_t   a_dataoff;
-   u_int16_t   a_compressalg;
-   u_int32_t   reserved1;
-   u_int64_t   a_allocated;
-   u_int64_t   a_datalen;
-   u_int64_t   a_initialized;
-   }   a_S_nr;
-   }   a_S;
+   cn_ta_vcnstart;
+   cn_ta_vcnend;
+   uint16_ta_dataoff;
+   uint16_ta_compressalg;
+   uint32_treserved1;
+   uint64_ta_allocated;
+   uint64_ta_datalen;
+   uint64_ta_initialized;
+   } a_S_nr;
+   } a_S;
 };
-#define a_ra_S.a_S_r
-#define a_nr   a_S.a_S_nr
+#definea_r a_S.a_S_r
+#definea_nra_S.a_S_nr
 
 typedef struct {
-   u_int64_t   t_create;
-   u_int64_t   t_write;
-   u_int64_t   t_mftwrite;
-   u_int64_t   t_access;
-}   ntfs_times_t;
-
-#define NTFS_FFLAG_RDONLY  0x01LL
-#define NTFS_FFLAG_HIDDEN  0x02LL
-#define NTFS_FFLAG_SYSTEM  0x04LL
-#define NTFS_FFLAG_ARCHIVE 0x20LL
-#define NTFS_FFLAG_COMPRESSED  0x0800LL
-#define NTFS_FFLAG_DIR 0x1000LL
+   uint64_tt_create;
+   uint64_tt_write;
+   uint64_tt_mftwrite;
+   

svn commit: r236141 - in head/sys: conf kern powerpc/booke powerpc/conf powerpc/include powerpc/powerpc

2012-05-27 Thread Rafal Jaworowski
Author: raj
Date: Sun May 27 10:25:20 2012
New Revision: 236141
URL: http://svn.freebsd.org/changeset/base/236141

Log:
  Let us manage differences of Book-E PowerPC variations i.e. vendor /
  implementation specific vs. the common architecture definition.
  
  Bring PPC4XX defines (PSL, SPR, TLB). Note the new definitions under
  BOOKE_PPC4XX are not used in the code yet.
  
  This change set is not supposed to affect existing E500 support, it's just
  another reorg step before bringing support for E500mc, E5500 and PPC465.
  
  Obtained from:AppliedMicro, Freescale, Semihalf

Modified:
  head/sys/conf/files.powerpc
  head/sys/conf/options.powerpc
  head/sys/kern/sched_ule.c
  head/sys/powerpc/booke/locore.S
  head/sys/powerpc/booke/machdep.c
  head/sys/powerpc/conf/MPC85XX
  head/sys/powerpc/conf/NOTES
  head/sys/powerpc/include/pcpu.h
  head/sys/powerpc/include/profile.h
  head/sys/powerpc/include/psl.h
  head/sys/powerpc/include/pte.h
  head/sys/powerpc/include/spr.h
  head/sys/powerpc/include/tlb.h
  head/sys/powerpc/include/trap.h
  head/sys/powerpc/include/vmparam.h
  head/sys/powerpc/powerpc/cpu.c
  head/sys/powerpc/powerpc/db_trace.c
  head/sys/powerpc/powerpc/gdb_machdep.c
  head/sys/powerpc/powerpc/genassym.c

Modified: head/sys/conf/files.powerpc
==
--- head/sys/conf/files.powerpc Sun May 27 09:34:47 2012(r236140)
+++ head/sys/conf/files.powerpc Sun May 27 10:25:20 2012(r236141)
@@ -97,17 +97,17 @@ powerpc/aim/swtch64.S   optionalaim powe
 powerpc/aim/trap.c optionalaim
 powerpc/aim/uma_machdep.c  optionalaim
 powerpc/aim/vm_machdep.c   optionalaim
-powerpc/booke/clock.c  optionale500
-powerpc/booke/copyinout.c  optionale500
-powerpc/booke/interrupt.c  optionale500
-powerpc/booke/locore.S optionale500 no-obj
-powerpc/booke/machdep.coptionale500
-powerpc/booke/mp_cpudep.c  optionale500 smp
+powerpc/booke/clock.c  optionalbooke
+powerpc/booke/copyinout.c  optionalbooke
+powerpc/booke/interrupt.c  optionalbooke
+powerpc/booke/locore.S optionalbooke no-obj
+powerpc/booke/machdep.coptionalbooke
+powerpc/booke/mp_cpudep.c  optionalbooke smp
 powerpc/booke/platform_bare.c  optionalmpc85xx
-powerpc/booke/pmap.c   optionale500
-powerpc/booke/swtch.S  optionale500
-powerpc/booke/trap.c   optionale500
-powerpc/booke/vm_machdep.c optionale500
+powerpc/booke/pmap.c   optionalbooke
+powerpc/booke/swtch.S  optionalbooke
+powerpc/booke/trap.c   optionalbooke
+powerpc/booke/vm_machdep.c optionalbooke
 powerpc/cpufreq/dfs.c  optionalcpufreq
 powerpc/cpufreq/pcr.c  optionalcpufreq aim
 powerpc/fpu/fpu_add.c  optionalfpu_emu powerpc

Modified: head/sys/conf/options.powerpc
==
--- head/sys/conf/options.powerpc   Sun May 27 09:34:47 2012
(r236140)
+++ head/sys/conf/options.powerpc   Sun May 27 10:25:20 2012
(r236141)
@@ -2,7 +2,9 @@
 # Options specific to the powerpc platform kernels
 
 AIMopt_global.h
-E500   opt_global.h
+BOOKE  opt_global.h
+BOOKE_E500 opt_global.h
+BOOKE_PPC4XX   opt_global.h
 CELL
 
 POWERPC

Modified: head/sys/kern/sched_ule.c
==
--- head/sys/kern/sched_ule.c   Sun May 27 09:34:47 2012(r236140)
+++ head/sys/kern/sched_ule.c   Sun May 27 10:25:20 2012(r236141)
@@ -77,7 +77,7 @@ dtrace_vtime_switch_func_tdtrace_vtime_
 #include machine/cpu.h
 #include machine/smp.h
 
-#if defined(__powerpc__)  defined(E500)
+#if defined(__powerpc__)  defined(BOOKE_E500)
 #error This architecture is not currently compatible with ULE
 #endif
 

Modified: head/sys/powerpc/booke/locore.S
==
--- head/sys/powerpc/booke/locore.S Sun May 27 09:34:47 2012
(r236140)
+++ head/sys/powerpc/booke/locore.S Sun May 27 10:25:20 2012
(r236141)
@@ -218,7 +218,7 @@ done_mapping:
mr  %r3, %r30
mr  %r4, %r31
 
-   /* Prepare e500 core */
+   /* Prepare core */
bl  booke_init
 
/* Switch to thread0.td_kstack now */

Modified: head/sys/powerpc/booke/machdep.c
==
--- head/sys/powerpc/booke/machdep.cSun May 27 09:34:47 2012
(r236140)
+++ head/sys/powerpc/booke/machdep.cSun May 27 10:25:20 2012
(r236141)
@@ -392,6 

svn commit: r236143 - head/cddl/contrib/opensolaris/cmd/ztest

2012-05-27 Thread Martin Matuska
Author: mm
Date: Sun May 27 11:37:24 2012
New Revision: 236143
URL: http://svn.freebsd.org/changeset/base/236143

Log:
  Import illumos changeset 13571:a5771a96228c
  1950 ztest backwards compatibility testing option
  
  References:
  https://www.illumos.org/issues/1950
  
  Obtained from:illumos (issue #1950)
  MFC after:2 weeks

Modified:
  head/cddl/contrib/opensolaris/cmd/ztest/ztest.c

Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c
==
--- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sun May 27 10:32:10 
2012(r236142)
+++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sun May 27 11:37:24 
2012(r236143)
@@ -20,8 +20,9 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ * Copyright (c) 2012 Martin Matuska m...@freebsd.org.  All rights reserved.
  */
 
 /*
@@ -51,7 +52,9 @@
  * At random times, the child self-immolates with a SIGKILL.
  * This is the software equivalent of pulling the power cord.
  * The parent then runs the test again, using the existing
- * storage pool, as many times as desired.
+ * storage pool, as many times as desired. If backwards compatability
+ * testing is enabled ztest will sometimes run the older version
+ * of ztest after a SIGKILL.
  *
  * (6) To verify that we don't have future leaks or temporal incursions,
  * many of the functional tests record the transaction group number
@@ -68,9 +71,15 @@
  * You can ask more more vdevs [-v], datasets [-d], or threads [-t]
  * to increase the pool capacity, fanout, and overall stress level.
  *
- * The -N(okill) option will suppress kills, so each child runs to completion.
- * This can be useful when you're trying to distinguish temporal incursions
- * from plain old race conditions.
+ * Use the -k option to set the desired frequency of kills.
+ *
+ * When ztest invokes itself it passes all relevant information through a
+ * temporary file which is mmap-ed in the child process. This allows shared
+ * memory to survive the exec syscall. The ztest_shared_hdr_t struct is always
+ * stored at offset 0 of this file and contains information on the size and
+ * number of shared structures in the file. The information stored in this file
+ * must remain backwards compatible with older versions of ztest so that
+ * ztest can invoke them during backwards compatibility testing (-B).
  */
 
 #include sys/zfs_context.h
@@ -111,29 +120,82 @@
 #include sys/fs/zfs.h
 #include libnvpair.h
 
-static char cmdname[] = ztest;
-static char *zopt_pool = cmdname;
-static char *progname;
-
-static uint64_t zopt_vdevs = 5;
-static uint64_t zopt_vdevtime;
-static int zopt_ashift = SPA_MINBLOCKSHIFT;
-static int zopt_mirrors = 2;
-static int zopt_raidz = 4;
-static int zopt_raidz_parity = 1;
-static size_t zopt_vdev_size = SPA_MINDEVSIZE;
-static int zopt_datasets = 7;
-static int zopt_threads = 23;
-static uint64_t zopt_passtime = 60;/* 60 seconds */
-static uint64_t zopt_killrate = 70;/* 70% kill rate */
-static int zopt_verbose = 0;
-static int zopt_init = 1;
-static char *zopt_dir = /tmp;
-static uint64_t zopt_time = 300;   /* 5 minutes */
-static uint64_t zopt_maxloops = 50;/* max loops during spa_freeze() */
+#defineZTEST_FD_DATA 3
+#defineZTEST_FD_RAND 4
+
+typedef struct ztest_shared_hdr {
+   uint64_tzh_hdr_size;
+   uint64_tzh_opts_size;
+   uint64_tzh_size;
+   uint64_tzh_stats_size;
+   uint64_tzh_stats_count;
+   uint64_tzh_ds_size;
+   uint64_tzh_ds_count;
+} ztest_shared_hdr_t;
+
+static ztest_shared_hdr_t *ztest_shared_hdr;
+
+typedef struct ztest_shared_opts {
+   char zo_pool[MAXNAMELEN];
+   char zo_dir[MAXNAMELEN];
+   char zo_alt_ztest[MAXNAMELEN];
+   char zo_alt_libpath[MAXNAMELEN];
+   uint64_t zo_vdevs;
+   uint64_t zo_vdevtime;
+   size_t zo_vdev_size;
+   int zo_ashift;
+   int zo_mirrors;
+   int zo_raidz;
+   int zo_raidz_parity;
+   int zo_datasets;
+   int zo_threads;
+   uint64_t zo_passtime;
+   uint64_t zo_killrate;
+   int zo_verbose;
+   int zo_init;
+   uint64_t zo_time;
+   uint64_t zo_maxloops;
+   uint64_t zo_metaslab_gang_bang;
+} ztest_shared_opts_t;
+
+static const ztest_shared_opts_t ztest_opts_defaults = {
+   .zo_pool = { 'z', 't', 'e', 's', 't', '\0' },
+   .zo_dir = { '/', 't', 'm', 'p', '\0' },
+   .zo_alt_ztest = { '\0' },
+   .zo_alt_libpath = { '\0' },
+   .zo_vdevs = 5,
+   .zo_ashift = SPA_MINBLOCKSHIFT,
+   .zo_mirrors = 2,
+   .zo_raidz = 4,
+   .zo_raidz_parity = 1,
+   .zo_vdev_size = SPA_MINDEVSIZE,
+  

svn commit: r236145 - head/cddl/contrib/opensolaris/cmd/zpool

2012-05-27 Thread Martin Matuska
Author: mm
Date: Sun May 27 12:22:15 2012
New Revision: 236145
URL: http://svn.freebsd.org/changeset/base/236145

Log:
  Import illumos changeset 13564:cf89c0c60496
  1946 incorrect formatting when listing output of multiple pools with
  zpool iostat -v
  
  References:
  https://www.illumos.org/issues/1946
  
  Obtained from:illumos (issue #1946)
  MFC after:1 week

Modified:
  head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c

Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
==
--- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.cSun May 27 
12:01:04 2012(r236144)
+++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.cSun May 27 
12:22:15 2012(r236145)
@@ -23,6 +23,7 @@
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
  * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012 by Frederik Wessels. All rights reserved.
  * Copyright (c) 2011 Martin Matuska m...@freebsd.org. All rights reserved.
  */
 
@@ -2351,7 +2352,8 @@ get_namewidth(zpool_handle_t *zhp, void 
if (!cb-cb_verbose)
cb-cb_namewidth = strlen(zpool_get_name(zhp));
else
-   cb-cb_namewidth = max_width(zhp, nvroot, 0, 0);
+   cb-cb_namewidth = max_width(zhp, nvroot, 0,
+   cb-cb_namewidth);
}
 
/*
___
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: r236138 - head/sys/cam/scsi

2012-05-27 Thread Bruce Evans

On Sun, 27 May 2012, Kenneth D. Merry wrote:


Log:
 Work around a race condition in devfs by changing the way closes
 are handled in most CAM peripheral drivers that are not handled by
 GEOM's disk class.


Sigh.  I was trying to get kib to fix last close properly and remove
a previous D_TRACKCLOSE fix.  The geom case is quite broken too.


 The usual character driver open and close semantics are that the
 driver gets N open calls, but only one close, when the last caller
 closes the device.


vfs+devfs doesn't understand its own state well enough to get this
right.  It's impossible for individual drivers to fix this (except
in a few simple cases where access is basically exclusive), since to
do so they would have to understand vfs+devfs better than vfs+devfs
understands itself, and inspect and maybe modify its entrails...


 CAM peripheral drivers expect that behavior to be honored to the
 letter, and the CAM peripheral driver code (specifically
 cam_periph_release_locked_busses()) panics if it is done incorrectly.


The old way to determine whether the device is already open and whether
it should actually be closed in last-close is to use count_dev().  This
almost worked.  It is still used in the ata tape driver, and I used
it in a couple of other pre-geom and de-geomed ata drivers (mainly to
fix eject in acd).  It is more broken than originally mainly in the
case of multiple devfs mounts, due to lossage in aliasing code.  Its
locking is inadequate, especially when it is called from drivers.  But
devfs has no better way to determine the lastness of a close.  Devfs
close uses count_dev(), and just has better locking for its call.  Even
driver close calls for D_TRACKCLOSE can go missing when count_dev()
is lower than it should be.  But most problems occur when count_dev()
is higher than it should be when devfs close calls it.  Last-close
calls go missing in this case.  Drivers can trust it even less.  For
example, if the driver attempts to track last closes using D_TRACKCLOSE,
then the driver close should do less when this is not the last close.
But if count_dev() is higher than it should be (now at the time of the
finalization of the driver close instead of earlier in devfs close)
then a driver that trusts count_dev() will do less than it should.
OTOH, counting things in drivers takes a lot of work and still cannot
work, since wrong vfs+devfs counts result in closes not matching opens
even with D_TRACKCLOSE.  All a driver can do is:
- count things well enough not to panic went vfs+devfs messes up its
  counts
- use D_TRACKCLOSE to handle missing last closes if necessary.  Most
  drivers don't want the complexity of handling all closes, but some
  are more broken than others by missing last closes, and it may be
  necessary to count all closes to avoid the panics.


 Since devfs has to drop its locks while it calls a driver's close
 routine, and it does not have a way to delay or prevent open calls
 while it is calling the close routine, there is a race.


Indeed.  Note that the race window is unbounded and any number of {
open, i/o, close } sequences may occur (and work!) while the original
last-close is running.  This cannot be fixed in general by holding a
lock throughout the original last-close, since that may want to take
aritrarily long and the lock would deadlock it.  You need to be able
to do { open, ioctl, close } sequences to tell the device not to block.

Dropping the locks is also what makes count_dev() more broken in drivers
than in devfs close:
- originally, count_dev() was spelled vcount() and all vnodes for a device
  were aliased to a single vnode.  This vnode was locked by the kernel
  not being preemptive and/or by SMP not existing and/or by Giant
  locking, even after the vnode exlusive lock was dropped in
  specfs/devfs, unless the driver operation sleeps.  Sleeping gives
  normal races, so for example after a driver close sleeps it should
  have called vcount() to detect state changes while sleeping.  This
  was done by few or no drivers.  But vcount was reliable() after
  waking up, even without the vnode exclusive lock, due to the Giant/etc
  locking.
- the aliasing code regressed to allowing multiple vnodes active on a
  device (with devfs, this takes multiple mounts).  The count is still
  per-device.  There is dev locking to protect the count, but no interlocking
  of this with the vnodes.  This would mostly still work without SMP.  But
  with SMP, you can have 2 active vnodes for a device, and 1 process
  holding the vnode (now non-exclusive) lock for stat() and incrementing
  the device count, while another process tries to last-close the device;
  then in devfs close, although both vnodes are locked the count is 1 too
  high due to the stat() and the last close goes missing; worse, if you
  use D_TRACKCLOSE to try to fix this, you may or may not see the count as
  1 too high and have no way to tell if it is, and no way to fix the locking
  (count_dev() will acquire a dev 

svn commit: r236146 - in head: cddl/contrib/opensolaris/cmd/zpool sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2012-05-27 Thread Martin Matuska
Author: mm
Date: Sun May 27 12:31:57 2012
New Revision: 236146
URL: http://svn.freebsd.org/changeset/base/236146

Log:
  Import illumos changeset 13605:b5c2b5db80d6 (partial)
  763 FMD msg URLs should refer to something visible
  
  Replace sun.com URL's with illumos.org
  
  References:
  https://www.illumos.org/issues/763
  
  Obtained from:illumos (issue #763)
  MFC after:1 week

Modified:
  head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c

Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
==
--- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.cSun May 27 
12:22:15 2012(r236145)
+++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.cSun May 27 
12:31:57 2012(r236146)
@@ -1617,7 +1617,7 @@ show_import(nvlist_t *config)
}
 
if (msgid != NULL)
-   (void) printf(gettext(   see: http://www.sun.com/msg/%s\n;),
+   (void) printf(gettext(   see: http://illumos.org/msg/%s\n;),
msgid);
 
(void) printf(gettext( config:\n\n));
@@ -3685,7 +3685,7 @@ print_dedup_stats(nvlist_t *config)
  *pool: tank
  * status: DEGRADED
  * reason: One or more devices ...
- * see: http://www.sun.com/msg/ZFS--01
+ * see: http://illumos.org/msg/ZFS--01
  * config:
  * mirror  DEGRADED
  *c1t0d0   OK
@@ -3893,7 +3893,7 @@ status_callback(zpool_handle_t *zhp, voi
}
 
if (msgid != NULL)
-   (void) printf(gettext(   see: http://www.sun.com/msg/%s\n;),
+   (void) printf(gettext(   see: http://illumos.org/msg/%s\n;),
msgid);
 
if (config != NULL) {

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c   Sun May 27 
12:22:15 2012(r236145)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c   Sun May 27 
12:31:57 2012(r236146)
@@ -2050,7 +2050,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_
cmn_err(CE_WARN, pool '%s' could not be 
loaded as it was last accessed by 
another system (host: %s hostid: 0x%lx). 
-   See: http://www.sun.com/msg/ZFS-8000-EY;,
+   See: http://illumos.org/msg/ZFS-8000-EY;,
spa_name(spa), hostname,
(unsigned long)hostid);
return (EBADF);
___
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: r236148 - head/lib/msun/src

2012-05-27 Thread David Chisnall
Author: theraven
Date: Sun May 27 12:54:41 2012
New Revision: 236148
URL: http://svn.freebsd.org/changeset/base/236148

Log:
  Allow inclusion of libc++ cmath to work after including math.h
  
  Submitted by: Yamaya Takashi
  Reviewed by:  das
  MFC after:1 week

Modified:
  head/lib/msun/src/math.h

Modified: head/lib/msun/src/math.h
==
--- head/lib/msun/src/math.hSun May 27 12:47:35 2012(r236147)
+++ head/lib/msun/src/math.hSun May 27 12:54:41 2012(r236148)
@@ -395,35 +395,15 @@ float significandf(float);
  * long double versions of ISO/POSIX math functions
  */
 #if __ISO_C_VISIBLE = 1999
-#if _DECLARE_C99_LDBL_MATH
-long doubleacoshl(long double);
-#endif
 long doubleacosl(long double);
-#if _DECLARE_C99_LDBL_MATH
-long doubleasinhl(long double);
-#endif
 long doubleasinl(long double);
 long doubleatan2l(long double, long double);
-#if _DECLARE_C99_LDBL_MATH
-long doubleatanhl(long double);
-#endif
 long doubleatanl(long double);
 long doublecbrtl(long double);
 long doubleceill(long double);
 long doublecopysignl(long double, long double) __pure2;
-#if _DECLARE_C99_LDBL_MATH
-long doublecoshl(long double);
-#endif
 long doublecosl(long double);
-#if _DECLARE_C99_LDBL_MATH
-long doubleerfcl(long double);
-long doubleerfl(long double);
-#endif
 long doubleexp2l(long double);
-#if _DECLARE_C99_LDBL_MATH
-long doubleexpl(long double);
-long doubleexpm1l(long double);
-#endif
 long doublefabsl(long double) __pure2;
 long doublefdiml(long double, long double);
 long doublefloorl(long double);
@@ -435,20 +415,9 @@ long doublefrexpl(long double value, in
 long doublehypotl(long double, long double);
 intilogbl(long double) __pure2;
 long doubleldexpl(long double, int);
-#if _DECLARE_C99_LDBL_MATH
-long doublelgammal(long double);
-#endif
 long long  llrintl(long double);
 long long  llroundl(long double);
-#if _DECLARE_C99_LDBL_MATH
-long doublelog10l(long double);
-long doublelog1pl(long double);
-long doublelog2l(long double);
-#endif
 long doublelogbl(long double);
-#if _DECLARE_C99_LDBL_MATH
-long doublelogl(long double);
-#endif
 long   lrintl(long double);
 long   lroundl(long double);
 long doublemodfl(long double, long double *); /* fundamentally !__pure2 */
@@ -458,30 +427,54 @@ long double   nextafterl(long double, long
 double nexttoward(double, long double);
 float  nexttowardf(float, long double);
 long doublenexttowardl(long double, long double);
-#if _DECLARE_C99_LDBL_MATH
-long doublepowl(long double, long double);
-#endif
 long doubleremainderl(long double, long double);
 long doubleremquol(long double, long double, int *);
 long doublerintl(long double);
 long doubleroundl(long double);
 long doublescalblnl(long double, long);
 long doublescalbnl(long double, int);
-#if _DECLARE_C99_LDBL_MATH
-long doublesinhl(long double);
-#endif
 long doublesinl(long double);
 long doublesqrtl(long double);
-#if _DECLARE_C99_LDBL_MATH
-long doubletanhl(long double);
-#endif
 long doubletanl(long double);
-#if _DECLARE_C99_LDBL_MATH
-long doubletgammal(long double);
-#endif
 long doubletruncl(long double);
 
 #endif /* __ISO_C_VISIBLE = 1999 */
 __END_DECLS
 
 #endif /* !_MATH_H_ */
+
+/* separate header for cmath */
+#ifndef _MATH_EXTRA_H_
+#if __ISO_C_VISIBLE = 1999
+#if _DECLARE_C99_LDBL_MATH
+
+#define _MATH_EXTRA_H_
+
+/*
+ * extra long double versions of math functions for C99 and cmath
+ */
+__BEGIN_DECLS
+
+long doubleacoshl(long double);
+long doubleasinhl(long double);
+long doubleatanhl(long double);
+long doublecoshl(long double);
+long doubleerfcl(long double);
+long doubleerfl(long double);
+long doubleexpl(long double);
+long doubleexpm1l(long double);
+long doublelgammal(long double);
+long doublelog10l(long double);
+long doublelog1pl(long double);
+long doublelog2l(long double);
+long doublelogl(long double);
+long doublepowl(long double, long double);
+long doublesinhl(long double);
+long doubletanhl(long double);
+long doubletgammal(long double);
+
+__END_DECLS
+
+#endif /* !_DECLARE_C99_LDBL_MATH */
+#endif /* __ISO_C_VISIBLE = 1999 */
+#endif /* !_MATH_EXTRA_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: r236149 - head/contrib/llvm/tools/clang/lib/CodeGen

2012-05-27 Thread Dimitry Andric
Author: dim
Date: Sun May 27 13:33:54 2012
New Revision: 236149
URL: http://svn.freebsd.org/changeset/base/236149

Log:
  Pull in r157212 from upstream clang trunk:
  
Revert r115805. An array type is required to have a range type,
however, the range can be unknown for the upper bound.
  
Testcase to follow.
  
Part of rdar://11457152
  
  This should fix ctfconvert producing error messages during kernel
  builds, similar to:
  
ERROR: scsi_all.c: die 24561: failed to retrieve array bounds
  
  These were caused by incorrect debug information for flexible array
  members of structs.
  
  MFC after:3 days

Modified:
  head/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp

Modified: head/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp
==
--- head/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp   Sun May 27 
12:54:41 2012(r236148)
+++ head/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp   Sun May 27 
13:33:54 2012(r236149)
@@ -1479,25 +1479,21 @@ llvm::DIType CGDebugInfo::CreateType(con
   // obvious/recursive way?
   SmallVectorllvm::Value *, 8 Subscripts;
   QualType EltTy(Ty, 0);
-  if (Ty-isIncompleteArrayType())
+  while ((Ty = dyn_castArrayType(EltTy))) {
+int64_t UpperBound = 0;
+int64_t LowerBound = 0;
+if (const ConstantArrayType *CAT = dyn_castConstantArrayType(Ty)) {
+  if (CAT-getSize().getZExtValue())
+UpperBound = CAT-getSize().getZExtValue() - 1;
+} else
+  // This is an unbounded array. Use Low = 1, Hi = 0 to express such 
+  // arrays.
+  LowerBound = 1;
+
+// FIXME: Verify this is right for VLAs.
+Subscripts.push_back(DBuilder.getOrCreateSubrange(LowerBound,
+  UpperBound));
 EltTy = Ty-getElementType();
-  else {
-while ((Ty = dyn_castArrayType(EltTy))) {
-  int64_t UpperBound = 0;
-  int64_t LowerBound = 0;
-  if (const ConstantArrayType *CAT = dyn_castConstantArrayType(Ty)) {
-if (CAT-getSize().getZExtValue())
-  UpperBound = CAT-getSize().getZExtValue() - 1;
-  } else
-// This is an unbounded array. Use Low = 1, Hi = 0 to express such 
-// arrays.
-LowerBound = 1;
-
-  // FIXME: Verify this is right for VLAs.
-  Subscripts.push_back(DBuilder.getOrCreateSubrange(LowerBound,
-UpperBound));
-  EltTy = Ty-getElementType();
-}
   }
 
   llvm::DIArray SubscriptArray = DBuilder.getOrCreateArray(Subscripts);
___
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: r236155 - in head: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs s...

2012-05-27 Thread Martin Matuska
Author: mm
Date: Sun May 27 16:00:00 2012
New Revision: 236155
URL: http://svn.freebsd.org/changeset/base/236155

Log:
  Import illumos changeset 13570:3411fd5f1589
  1948 zpool list should show more detailed pool information
  
  Display per-vdev information with zpool list -v.
  The added expandsize property has currently no value on FreeBSD.
  This changeset allows adding expansion support to individual vdevs
  in the future.
  
  References:
  https://www.illumos.org/issues/1948
  
  Obtained from:illumos (issue #1948)
  MFC after:2 weeks

Modified:
  head/cddl/contrib/opensolaris/cmd/zpool/zpool.8
  head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
  head/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
  head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h

Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8
==
--- head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Sun May 27 15:48:25 
2012(r236154)
+++ head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Sun May 27 16:00:00 
2012(r236155)
@@ -537,6 +537,8 @@ value of 1.76 indicates that 1.76 units 
 for a description of the deduplication feature.
 .It Sy free
 Number of blocks within the pool that are not allocated.
+.It Sy expandsize
+This property has currently no value on FreeBSD.
 .It Sy guid
 A unique identifier for the pool.
 .It Sy health
@@ -1275,7 +1277,7 @@ Treat exported or foreign devices as ina
 .It Xo
 .Nm
 .Cm list
-.Op Fl H
+.Op Fl Hv
 .Op Fl o Ar property Ns Op , Ns Ar ...
 .Op Fl T Cm d Ns | Ns Cm u
 .Op Ar pool

Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
==
--- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.cSun May 27 
15:48:25 2012(r236154)
+++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.cSun May 27 
16:00:00 2012(r236155)
@@ -22,9 +22,9 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
- * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
  * Copyright (c) 2012 by Frederik Wessels. All rights reserved.
- * Copyright (c) 2011 Martin Matuska m...@freebsd.org. All rights reserved.
+ * Copyright (c) 2012 Martin Matuska m...@freebsd.org. All rights reserved.
  */
 
 #include solaris.h
@@ -46,6 +46,7 @@
 #include pwd.h
 #include zone.h
 #include sys/time.h
+#include zfs_prop.h
 #include sys/fs/zfs.h
 #include sys/stat.h
 
@@ -70,6 +71,7 @@ static int zpool_do_status(int, char **)
 static int zpool_do_online(int, char **);
 static int zpool_do_offline(int, char **);
 static int zpool_do_clear(int, char **);
+static int zpool_do_reopen(int, char **);
 
 static int zpool_do_reguid(int, char **);
 
@@ -132,7 +134,8 @@ typedef enum {
HELP_GET,
HELP_SET,
HELP_SPLIT,
-   HELP_REGUID
+   HELP_REGUID,
+   HELP_REOPEN
 } zpool_help_t;
 
 
@@ -167,6 +170,7 @@ static zpool_command_t command_table[] =
{ online, zpool_do_online,HELP_ONLINE },
{ offline,zpool_do_offline,   HELP_OFFLINE},
{ clear,  zpool_do_clear, HELP_CLEAR  },
+   { reopen, zpool_do_reopen,HELP_REOPEN },
{ NULL },
{ attach, zpool_do_attach,HELP_ATTACH },
{ detach, zpool_do_detach,HELP_DETACH },
@@ -241,6 +245,8 @@ get_usage(zpool_help_t idx) {
[new-device]\n));
case HELP_REMOVE:
return (gettext(\tremove pool device ...\n));
+   case HELP_REOPEN:
+   return (); /* Undocumented command */
case HELP_SCRUB:
return (gettext(\tscrub [-s] pool ...\n));
case HELP_STATUS:
@@ -2109,10 +2115,10 @@ error:
 }
 
 typedef struct iostat_cbdata {
-   zpool_list_t *cb_list;
-   int cb_verbose;
-   int cb_iteration;
+   

svn commit: r236156 - head/sys/dev/mmc

2012-05-27 Thread Marius Strobl
Author: marius
Date: Sun May 27 16:08:58 2012
New Revision: 236156
URL: http://svn.freebsd.org/changeset/base/236156

Log:
  - Fix some typos in mmc_acquire_bus() and mmc_send_csd().
  - Fix some math errors in mmc_decode_csd_sd().
  - Fix incorrect arguments to mmc_send_app_op_cond() in mmc_go_discovery().
  - Add reporting of CSD for debug purposes.
  - Add detection (and skipping) of password-locked cards.
  - Add setting of block length on card if necessary.
  
  Submitted by: Patrick Kelsey
  MFC after:3 days

Modified:
  head/sys/dev/mmc/mmc.c

Modified: head/sys/dev/mmc/mmc.c
==
--- head/sys/dev/mmc/mmc.c  Sun May 27 16:00:00 2012(r236155)
+++ head/sys/dev/mmc/mmc.c  Sun May 27 16:08:58 2012(r236156)
@@ -224,7 +224,7 @@ mmc_acquire_bus(device_t busdev, device_
sc = device_get_softc(busdev);
MMC_LOCK(sc);
if (sc-owner)
-   panic(mmc: host bridge didn't seralize us.);
+   panic(mmc: host bridge didn't serialize us.);
sc-owner = dev;
MMC_UNLOCK(sc);
 
@@ -859,7 +859,7 @@ mmc_decode_csd_sd(uint32_t *raw_csd, str
if (v == 0) {
m = mmc_get_bits(raw_csd, 128, 115, 4);
e = mmc_get_bits(raw_csd, 128, 112, 3);
-   csd-tacc = exp[e] * mant[m] + 9 / 10;
+   csd-tacc = (exp[e] * mant[m] + 9) / 10;
csd-nsac = mmc_get_bits(raw_csd, 128, 104, 8) * 100;
m = mmc_get_bits(raw_csd, 128, 99, 4);
e = mmc_get_bits(raw_csd, 128, 96, 3);
@@ -887,7 +887,7 @@ mmc_decode_csd_sd(uint32_t *raw_csd, str
} else if (v == 1) {
m = mmc_get_bits(raw_csd, 128, 115, 4);
e = mmc_get_bits(raw_csd, 128, 112, 3);
-   csd-tacc = exp[e] * mant[m] + 9 / 10;
+   csd-tacc = (exp[e] * mant[m] + 9) / 10;
csd-nsac = mmc_get_bits(raw_csd, 128, 104, 8) * 100;
m = mmc_get_bits(raw_csd, 128, 99, 4);
e = mmc_get_bits(raw_csd, 128, 96, 3);
@@ -1002,7 +1002,7 @@ mmc_all_send_cid(struct mmc_softc *sc, u
 }
 
 static int
-mmc_send_csd(struct mmc_softc *sc, uint16_t rca, uint32_t *rawcid)
+mmc_send_csd(struct mmc_softc *sc, uint16_t rca, uint32_t *rawcsd)
 {
struct mmc_command cmd;
int err;
@@ -1012,7 +1012,7 @@ mmc_send_csd(struct mmc_softc *sc, uint1
cmd.flags = MMC_RSP_R2 | MMC_CMD_BCR;
cmd.data = NULL;
err = mmc_wait_for_cmd(sc, cmd, 0);
-   memcpy(rawcid, cmd.resp, 4 * sizeof(uint32_t));
+   memcpy(rawcsd, cmd.resp, 4 * sizeof(uint32_t));
return (err);
 }
 
@@ -1121,6 +1121,35 @@ mmc_send_relative_addr(struct mmc_softc 
return (err);
 }
 
+static int
+mmc_send_status(struct mmc_softc *sc, uint16_t rca, uint32_t *status)
+{
+   struct mmc_command cmd;
+   int err;
+
+   cmd.opcode = MMC_SEND_STATUS;
+   cmd.arg = rca  16;
+   cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
+   cmd.data = NULL;
+   err = mmc_wait_for_cmd(sc, cmd, 0);
+   *status = cmd.resp[0];
+   return (err);
+}
+
+static int
+mmc_set_blocklen(struct mmc_softc *sc, uint32_t len)
+{
+   struct mmc_command cmd;
+   int err;
+
+   cmd.opcode = MMC_SET_BLOCKLEN;
+   cmd.arg = len;
+   cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
+   cmd.data = NULL;
+   err = mmc_wait_for_cmd(sc, cmd, 0);
+   return (err);
+}
+
 static void
 mmc_log_card(device_t dev, struct mmc_ivars *ivar, int newcard)
 {
@@ -1144,8 +1173,7 @@ mmc_discover_cards(struct mmc_softc *sc)
struct mmc_ivars *ivar = NULL;
device_t *devlist;
int err, i, devcount, newcard;
-   uint32_t raw_cid[4];
-   uint32_t resp, sec_count;
+   uint32_t raw_cid[4], resp, sec_count, status;
device_t child;
uint16_t rca = 2;
u_char switch_res[64];
@@ -1194,6 +1222,12 @@ mmc_discover_cards(struct mmc_softc *sc)
ivar-rca = resp  16;
/* Get card CSD. */
mmc_send_csd(sc, ivar-rca, ivar-raw_csd);
+   if (bootverbose || mmc_debug)
+   device_printf(sc-dev,
+   %sard detected (CSD %08x%08x%08x%08x)\n,
+   newcard ? New c : C, ivar-raw_csd[0],
+   ivar-raw_csd[1], ivar-raw_csd[2],
+   ivar-raw_csd[3]);
mmc_decode_csd_sd(ivar-raw_csd, ivar-csd);
ivar-sec_count = ivar-csd.capacity / MMC_SECTOR_SIZE;
if (ivar-csd.csd_structure  0)
@@ -1201,6 +1235,19 @@ mmc_discover_cards(struct mmc_softc *sc)
ivar-tran_speed = ivar-csd.tran_speed;
ivar-erase_sector = ivar-csd.erase_sector * 
ivar-csd.write_bl_len / 

svn commit: r236157 - head/sys/netinet

2012-05-27 Thread Ed Maste
Author: emaste
Date: Sun May 27 16:16:28 2012
New Revision: 236157
URL: http://svn.freebsd.org/changeset/base/236157

Log:
  Add IPPROTO_MPLS (rfc4023) IP protocol definition
  
  There are currently no in-tree consumers; I'm adding it now for use by
  vendor code.  This matches the change OpenBSD made while implementing
  MPLS in gif(4).

Modified:
  head/sys/netinet/in.h

Modified: head/sys/netinet/in.h
==
--- head/sys/netinet/in.h   Sun May 27 16:08:58 2012(r236156)
+++ head/sys/netinet/in.h   Sun May 27 16:16:28 2012(r236157)
@@ -241,6 +241,7 @@ __END_DECLS
 #defineIPPROTO_PIM 103 /* Protocol Independent 
Mcast */
 #defineIPPROTO_CARP112 /* CARP */
 #defineIPPROTO_PGM 113 /* PGM */
+#defineIPPROTO_MPLS137 /* MPLS-in-IP */
 #defineIPPROTO_PFSYNC  240 /* PFSYNC */
 /* 255: Reserved */
 /* BSD Private, local use, namespace incursion, no longer used */
___
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: r236158 - head/sys/i386/i386

2012-05-27 Thread Alan Cox
Author: alc
Date: Sun May 27 16:24:00 2012
New Revision: 236158
URL: http://svn.freebsd.org/changeset/base/236158

Log:
  Replace all uses of the vm page queues lock by a r/w lock that is private
  to this pmap.c.  This new r/w lock is used primarily to synchronize access
  to the PV lists.  However, it will be used in a somewhat unconventional
  way.  As finer-grained PV list locking is added to each of the pmap
  functions that acquire this r/w lock, its acquisition will be changed from
  write to read, enabling concurrent execution of the pmap functions with
  finer-grained locking.
  
  X-MFC after:  r236045

Modified:
  head/sys/i386/i386/pmap.c

Modified: head/sys/i386/i386/pmap.c
==
--- head/sys/i386/i386/pmap.c   Sun May 27 16:16:28 2012(r236157)
+++ head/sys/i386/i386/pmap.c   Sun May 27 16:24:00 2012(r236158)
@@ -118,6 +118,7 @@ __FBSDID($FreeBSD$);
 #include sys/msgbuf.h
 #include sys/mutex.h
 #include sys/proc.h
+#include sys/rwlock.h
 #include sys/sf_buf.h
 #include sys/sx.h
 #include sys/vmmeter.h
@@ -236,6 +237,7 @@ static int pat_index[PAT_INDEX_SIZE];   /*
 static TAILQ_HEAD(pch, pv_chunk) pv_chunks = TAILQ_HEAD_INITIALIZER(pv_chunks);
 static int pv_entry_count = 0, pv_entry_max = 0, pv_entry_high_water = 0;
 static struct md_page *pv_table;
+static struct rwlock pvh_global_lock;
 static int shpgperproc = PMAP_SHPGPERPROC;
 
 struct pv_chunk *pv_chunkbase; /* KVA block for pv_chunks */
@@ -392,6 +394,12 @@ pmap_bootstrap(vm_paddr_t firstaddr)
kernel_pmap-pm_root = NULL;
CPU_FILL(kernel_pmap-pm_active);  /* don't allow deactivation */
TAILQ_INIT(kernel_pmap-pm_pvchunk);
+
+   /*
+* Initialize the global pv list lock.
+*/
+   rw_init(pvh_global_lock, pvh global);
+
LIST_INIT(allpmaps);
 
/*
@@ -1276,7 +1284,7 @@ invlcaddr(void *caddr)
  * scans are across different pmaps.  It is very wasteful
  * to do an entire invltlb for checking a single mapping.
  *
- * If the given pmap is not the current pmap, vm_page_queue_mtx
+ * If the given pmap is not the current pmap, pvh_global_lock
  * must be held and curthread pinned to a CPU.
  */
 static pt_entry_t *
@@ -1292,7 +1300,7 @@ pmap_pte_quick(pmap_t pmap, vm_offset_t 
/* are we current address space or kernel? */
if (pmap_is_current(pmap))
return (vtopte(va));
-   mtx_assert(vm_page_queue_mtx, MA_OWNED);
+   rw_assert(pvh_global_lock, RA_WLOCKED);
KASSERT(curthread-td_pinned  0, (curthread not pinned));
newpf = *pde  PG_FRAME;
if ((*PMAP1  PG_FRAME) != newpf) {
@@ -1841,9 +1849,9 @@ _pmap_allocpte(pmap_t pmap, u_int ptepin
VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) {
if (flags  M_WAITOK) {
PMAP_UNLOCK(pmap);
-   vm_page_unlock_queues();
+   rw_wunlock(pvh_global_lock);
VM_WAIT;
-   vm_page_lock_queues();
+   rw_wlock(pvh_global_lock);
PMAP_LOCK(pmap);
}
 
@@ -2339,7 +2347,7 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv
struct pv_chunk *pc;
int idx, field, bit;
 
-   mtx_assert(vm_page_queue_mtx, MA_OWNED);
+   rw_assert(pvh_global_lock, RA_WLOCKED);
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
PV_STAT(pv_entry_frees++);
PV_STAT(pv_entry_spare++);
@@ -2382,8 +2390,8 @@ get_pv_entry(pmap_t pmap, int try)
struct pv_chunk *pc;
vm_page_t m;
 
+   rw_assert(pvh_global_lock, RA_WLOCKED);
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
-   mtx_assert(vm_page_queue_mtx, MA_OWNED);
PV_STAT(pv_entry_allocs++);
pv_entry_count++;
if (pv_entry_count  pv_entry_high_water)
@@ -2455,7 +2463,7 @@ pmap_pvh_remove(struct md_page *pvh, pma
 {
pv_entry_t pv;
 
-   mtx_assert(vm_page_queue_mtx, MA_OWNED);
+   rw_assert(pvh_global_lock, RA_WLOCKED);
TAILQ_FOREACH(pv, pvh-pv_list, pv_list) {
if (pmap == PV_PMAP(pv)  va == pv-pv_va) {
TAILQ_REMOVE(pvh-pv_list, pv, pv_list);
@@ -2473,7 +2481,7 @@ pmap_pv_demote_pde(pmap_t pmap, vm_offse
vm_offset_t va_last;
vm_page_t m;
 
-   mtx_assert(vm_page_queue_mtx, MA_OWNED);
+   rw_assert(pvh_global_lock, RA_WLOCKED);
KASSERT((pa  PDRMASK) == 0,
(pmap_pv_demote_pde: pa is not 4mpage aligned));
 
@@ -2506,7 +2514,7 @@ pmap_pv_promote_pde(pmap_t pmap, vm_offs
vm_offset_t va_last;
vm_page_t m;
 
-   mtx_assert(vm_page_queue_mtx, MA_OWNED);
+   rw_assert(pvh_global_lock, RA_WLOCKED);
KASSERT((pa  PDRMASK) == 0,
(pmap_pv_promote_pde: pa is not 4mpage aligned));
 
@@ -2547,7 +2555,7 @@ pmap_remove_entry(pmap_t pmap, 

svn commit: r236159 - head/sys/boot/arm/uboot

2012-05-27 Thread Tim Kientzle
Author: kientzle
Date: Sun May 27 16:27:04 2012
New Revision: 236159
URL: http://svn.freebsd.org/changeset/base/236159

Log:
  Allow the load address used by ARM ubldr to be set via Make argument.
  
  In particular, this simplifies scripts that build system
  images.

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

Modified: head/sys/boot/arm/uboot/Makefile
==
--- head/sys/boot/arm/uboot/MakefileSun May 27 16:24:00 2012
(r236158)
+++ head/sys/boot/arm/uboot/MakefileSun May 27 16:27:04 2012
(r236159)
@@ -7,6 +7,9 @@ NEWVERSWHAT=U-Boot loader ${MACHINE_A
 BINDIR?=   /boot
 INSTALLFLAGS=  -b
 WARNS?=1
+# Address at which ubldr will be loaded.
+# This varies for different boards and SOCs.
+UBLDR_LOADADDR?=   0x100
 
 # Architecture-specific loader code
 SRCS=  start.S conf.c vers.c
@@ -85,7 +88,9 @@ CLEANFILES+=  vers.c loader.help
 
 CFLAGS+=   -ffreestanding
 
-LDFLAGS=   -nostdlib -static -T ${.CURDIR}/ldscript.${MACHINE_CPUARCH}
+LDFLAGS=   -nostdlib -static
+LDFLAGS+=  -T ldscript.generated
+LDFLAGS+=  -T ${.CURDIR}/ldscript.${MACHINE_CPUARCH}
 
 # Pull in common loader code
 .PATH: ${.CURDIR}/../../uboot/common
@@ -110,6 +115,18 @@ loader.help: help.common help.uboot
cat ${.ALLSRC} | \
awk -f ${.CURDIR}/../../common/merge_help.awk  ${.TARGET}
 
+${PROG}: ldscript.generated ${.CURDIR}/ldscript.${MACHINE_CPUARCH}
+
+ldscript.generated::
+   rm -f ldscript.generated.tmp
+   echo UBLDR_LOADADDR = ${UBLDR_LOADADDR}; ldscript.generated.tmp
+   if diff ldscript.generated ldscript.generated.tmp  /dev/null; then \
+   true; \
+   else \
+   rm -f ldscript.generated; \
+   mv ldscript.generated.tmp ldscript.generated; \
+   fi
+
 .PATH: ${.CURDIR}/../../forth
 FILES= loader.help
 

Modified: head/sys/boot/arm/uboot/ldscript.arm
==
--- head/sys/boot/arm/uboot/ldscript.armSun May 27 16:24:00 2012
(r236158)
+++ head/sys/boot/arm/uboot/ldscript.armSun May 27 16:27:04 2012
(r236159)
@@ -5,7 +5,7 @@ ENTRY(_start)
 SECTIONS
 {
   /* Read-only sections, merged into text segment: */
-  . = 0x100 + SIZEOF_HEADERS;
+  . = UBLDR_LOADADDR + SIZEOF_HEADERS;
   .interp : { *(.interp)   }
   .hash  : { *(.hash)  }
   .dynsym: { *(.dynsym)}
___
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: r236028 - head/lib/libkiconv

2012-05-27 Thread Jan Beich
Gabor Kovesdan ga...@freebsd.org writes:

 Author: gabor
 Date: Fri May 25 22:07:13 2012
 New Revision: 236028
 URL: http://svn.freebsd.org/changeset/base/236028

 Log:
   - Add support for BSD iconv when it is build into libc
[...]
 +.if !defined(MK_ICONV)
 +CFLAGS+= -DICONV_DLOPEN
 +.endif

This doesn't work unless you include bsd.own.mk before.

  $ make WITH_ICONV= -C lib/libkiconv
  Warning: Object directory not changed from original /a/freebsd/lib/libkiconv
  clang ... -DICONV_DLOPEN ... -o kiconv_sysctl.o
  [...]
___
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: r236137 - head/contrib/gcc/config/i386

2012-05-27 Thread Roman Divacky
Fwiw, to enable the same thing in clang you want this simple patch:

===
--- Tools.cpp   (revision 157545)
+++ Tools.cpp   (working copy)
@@ -4794,6 +4794,7 @@
   if (Args.hasArg(options::OPT_static)) {
 CmdArgs.push_back(-Bstatic);
   } else {
+CmdArgs.push_back(--hash-style=both);
 if (Args.hasArg(options::OPT_rdynamic))
   CmdArgs.push_back(-export-dynamic);
 CmdArgs.push_back(--eh-frame-hdr);



I cant commit this upstream as this option doesn't work with ld 2.15. What
should be done here? Commit this to local FreeBSD version? Commit it upstream
making it not work with old ld? Leave it out completely?

On Sun, May 27, 2012 at 05:27:48AM +, Konstantin Belousov wrote:
 Author: kib
 Date: Sun May 27 05:27:47 2012
 New Revision: 236137
 URL: http://svn.freebsd.org/changeset/base/236137
 
 Log:
   Enable gnu hash generation for dynamic ELF binaries on x86.
   
   Reviewed by:kan
 
 Modified:
   head/contrib/gcc/config/i386/freebsd.h
   head/contrib/gcc/config/i386/freebsd64.h
 
 Modified: head/contrib/gcc/config/i386/freebsd.h
 ==
 --- head/contrib/gcc/config/i386/freebsd.hSun May 27 05:24:53 2012
 (r236136)
 +++ head/contrib/gcc/config/i386/freebsd.hSun May 27 05:27:47 2012
 (r236137)
 @@ -49,6 +49,7 @@ Boston, MA 02110-1301, USA.  */
   %{rdynamic: -export-dynamic} \
   %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \
%{static:-Bstatic}} \
 +%{!static:--hash-style=both} \
  %{symbolic:-Bsymbolic}
  
  /* Reset our STARTFILE_SPEC which was properly set in config/freebsd.h
 
 Modified: head/contrib/gcc/config/i386/freebsd64.h
 ==
 --- head/contrib/gcc/config/i386/freebsd64.h  Sun May 27 05:24:53 2012
 (r236136)
 +++ head/contrib/gcc/config/i386/freebsd64.h  Sun May 27 05:27:47 2012
 (r236137)
 @@ -54,4 +54,5 @@ Boston, MA 02110-1301, USA.  */
  %{rdynamic:-export-dynamic} \
   %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \
  %{static:-Bstatic}} \
 +  %{!static:--hash-style=both} \
%{symbolic:-Bsymbolic}
___
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: r236137 - head/contrib/gcc/config/i386

2012-05-27 Thread Konstantin Belousov
On Sun, May 27, 2012 at 10:31:00PM +0200, Roman Divacky wrote:
 Fwiw, to enable the same thing in clang you want this simple patch:
 
 ===
 --- Tools.cpp   (revision 157545)
 +++ Tools.cpp   (working copy)
 @@ -4794,6 +4794,7 @@
if (Args.hasArg(options::OPT_static)) {
  CmdArgs.push_back(-Bstatic);
} else {
 +CmdArgs.push_back(--hash-style=both);
  if (Args.hasArg(options::OPT_rdynamic))
CmdArgs.push_back(-export-dynamic);
  CmdArgs.push_back(--eh-frame-hdr);
 
 
 
 I cant commit this upstream as this option doesn't work with ld 2.15. What
 should be done here? Commit this to local FreeBSD version? Commit it upstream
 making it not work with old ld? Leave it out completely?
I cannot answer this question.

This should be discussed with our in-tree clang maintainers.

 
 On Sun, May 27, 2012 at 05:27:48AM +, Konstantin Belousov wrote:
  Author: kib
  Date: Sun May 27 05:27:47 2012
  New Revision: 236137
  URL: http://svn.freebsd.org/changeset/base/236137
  
  Log:
Enable gnu hash generation for dynamic ELF binaries on x86.

Reviewed by:  kan
  
  Modified:
head/contrib/gcc/config/i386/freebsd.h
head/contrib/gcc/config/i386/freebsd64.h
  
  Modified: head/contrib/gcc/config/i386/freebsd.h
  ==
  --- head/contrib/gcc/config/i386/freebsd.h  Sun May 27 05:24:53 2012
  (r236136)
  +++ head/contrib/gcc/config/i386/freebsd.h  Sun May 27 05:27:47 2012
  (r236137)
  @@ -49,6 +49,7 @@ Boston, MA 02110-1301, USA.  */
  %{rdynamic: -export-dynamic} \
  %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \
 %{static:-Bstatic}} \
  +%{!static:--hash-style=both} \
   %{symbolic:-Bsymbolic}
   
   /* Reset our STARTFILE_SPEC which was properly set in config/freebsd.h
  
  Modified: head/contrib/gcc/config/i386/freebsd64.h
  ==
  --- head/contrib/gcc/config/i386/freebsd64.hSun May 27 05:24:53 
  2012(r236136)
  +++ head/contrib/gcc/config/i386/freebsd64.hSun May 27 05:27:47 
  2012(r236137)
  @@ -54,4 +54,5 @@ Boston, MA 02110-1301, USA.  */
   %{rdynamic:-export-dynamic} \
  %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \
   %{static:-Bstatic}} \
  +  %{!static:--hash-style=both} \
 %{symbolic:-Bsymbolic}


pgppNeHCNRWfD.pgp
Description: PGP signature