svn commit: r243212 - head/etc/rc.d

2012-11-18 Thread Hiroki Sato
Author: hrs
Date: Sun Nov 18 11:22:15 2012
New Revision: 243212
URL: http://svnweb.freebsd.org/changeset/base/243212

Log:
  Fix condition to check if the maximum number of FIBs is greater than 0 or not.
  
  Spotted by:   zont

Modified:
  head/etc/rc.d/routing

Modified: head/etc/rc.d/routing
==
--- head/etc/rc.d/routing   Sun Nov 18 06:25:37 2012(r243211)
+++ head/etc/rc.d/routing   Sun Nov 18 11:22:15 2012(r243212)
@@ -144,7 +144,7 @@ static_inet6()
 
# get the number of FIBs supported.
fibs=$((`${SYSCTL_N} net.fibs` - 1))
-   if [ -n "$fibs" ]; then
+   if [ "$fibs" -gt 0 ]; then
fibmod="-fib 0-$fibs"
else
fibmod=
___
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: r243213 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2012-11-18 Thread Andriy Gapon
Author: avg
Date: Sun Nov 18 11:47:25 2012
New Revision: 243213
URL: http://svnweb.freebsd.org/changeset/base/243213

Log:
  spa_import_rootpool: fall back to use configuration from zpool.cache...
  
  if we fail to generate a proper root pool configuration based on disk
  probing.  Currently we can not properly generate the configuration for
  multi-vdev pools.  Make that explicit.
  
  Reported by:  madpilot, Bartosz Stec 
  Tested by:madpilot, Bartosz Stec 
  MFC after:4 days

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c   Sun Nov 18 
11:22:15 2012(r243212)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c   Sun Nov 18 
11:47:25 2012(r243213)
@@ -3763,12 +3763,23 @@ spa_generate_rootconf(const char *name)
 {
nvlist_t *config;
nvlist_t *nvtop, *nvroot;
+   uint64_t nchildren;
uint64_t pgid;
 
if (vdev_geom_read_pool_label(name, &config) != 0)
return (NULL);
 
/*
+* Multi-vdev root pool configuration discovery is not supported yet.
+*/
+   nchildren = 0;
+   nvlist_lookup_uint64(config, ZPOOL_CONFIG_VDEV_CHILDREN, &nchildren);
+   if (nchildren != 1) {
+   nvlist_free(config);
+   return (NULL);
+   }
+
+   /*
 * Add this top-level vdev to the child array.
 */
VERIFY(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE,
@@ -3810,25 +3821,30 @@ spa_import_rootpool(const char *name)
 * Read the label from the boot device and generate a configuration.
 */
config = spa_generate_rootconf(name);
-   if (config == NULL) {
+
+   mutex_enter(&spa_namespace_lock);
+   if (config != NULL) {
+   VERIFY(nvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME,
+   &pname) == 0 && strcmp(name, pname) == 0);
+   VERIFY(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_TXG, &txg)
+   == 0);
+
+   if ((spa = spa_lookup(pname)) != NULL) {
+   /*
+* Remove the existing root pool from the namespace so
+* that we can replace it with the correct config
+* we just read in.
+*/
+   spa_remove(spa);
+   }
+   spa = spa_add(pname, config, NULL);
+   } else if ((spa = spa_lookup(name)) == NULL) {
cmn_err(CE_NOTE, "Cannot find the pool label for '%s'",
name);
return (EIO);
+   } else {
+   VERIFY(nvlist_dup(spa->spa_config, &config, KM_SLEEP) == 0);
}
-
-   VERIFY(nvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME,
-   &pname) == 0 && strcmp(name, pname) == 0);
-   VERIFY(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_TXG, &txg) == 0);
-
-   mutex_enter(&spa_namespace_lock);
-   if ((spa = spa_lookup(pname)) != NULL) {
-   /*
-* Remove the existing root pool from the namespace so that we
-* can replace it with the correct config we just read in.
-*/
-   spa_remove(spa);
-   }
-   spa = spa_add(pname, config, NULL);
spa->spa_is_root = B_TRUE;
spa->spa_import_flags = ZFS_IMPORT_VERBATIM;
 
@@ -3849,15 +3865,15 @@ spa_import_rootpool(const char *name)
return (error);
}
 
-   error = 0;
spa_history_log_version(spa, LOG_POOL_IMPORT);
-out:
+
spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER);
vdev_free(rvd);
spa_config_exit(spa, SCL_ALL, FTAG);
mutex_exit(&spa_namespace_lock);
 
-   return (error);
+   nvlist_free(config);
+   return (0);
 }
 
 #endif /* sun */
___
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: r242767 - in head/tools/regression/bin/sh: builtins parser

2012-11-18 Thread Ulrich Spörlein
On Thu, 2012-11-08 at 13:36:19 +, Jilles Tjoelker wrote:
> Author: jilles
> Date: Thu Nov  8 13:36:19 2012
> New Revision: 242767
> URL: http://svnweb.freebsd.org/changeset/base/242767
> 
> Log:
>   sh: Add tests for modifying an alias (r242766).
>   
>   Note: parser/alias10.0 will eat a lot of memory/cpu time when it fails (with
>   the old sh).

Can't you run it with reduced ulimits to have it fail fast?

Cheers,
Uli
___
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: r243227 - head/sys/arm/conf

2012-11-18 Thread Adrian Chadd
Author: adrian
Date: Sun Nov 18 14:05:28 2012
New Revision: 243227
URL: http://svnweb.freebsd.org/changeset/base/243227

Log:
  Correctly use spaces here.
  
  Pointed out by:   pjd

Modified:
  head/sys/arm/conf/CAMBRIA

Modified: head/sys/arm/conf/CAMBRIA
==
--- head/sys/arm/conf/CAMBRIA   Sun Nov 18 14:00:03 2012(r243226)
+++ head/sys/arm/conf/CAMBRIA   Sun Nov 18 14:05:28 2012(r243227)
@@ -126,8 +126,8 @@ device  ath # Atheros NICs
 device ath_pci # Atheros pci/cardbus glue
 optionsATH_DEBUG
 optionsATH_DIAGAPI
-optionsATH_ENABLE_DFS
-optionsATH_ENABLE_11N
+optionsATH_ENABLE_DFS
+optionsATH_ENABLE_11N
 #options   ATH_TX99_DIAG
 device ath_rate_sample # SampleRate tx rate control for ath
 
___
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: r242847 - in head/sys: i386/include kern

2012-11-18 Thread Andrey Zonov
On 11/11/12 3:04 AM, Andre Oppermann wrote:
> On 10.11.2012 23:24, Alfred Perlstein wrote:
>> On 11/10/12 11:18 AM, Andre Oppermann wrote:
>>> On 10.11.2012 19:04, Peter Wemm wrote:
 This is complicated but we need a simple user visible view of it.  It
 really needs to be something like "nmbclusters defaults to 6% of
 physical ram, with machine dependent limits".  The MD limits are bad
 enough, and using bogo-units like "maxusers" just makes it worse.
>>>
>>> Yes, that would be optimal.
>>>
>> No it would not.
>>
>> I used to be able to tell people "hey just try increasing maxusers"
>> and they would and suddenly the
>> box would be OK.
>>
>> Now I'll have to remember 3,4,5,10,20x tunable to increase?
> 
> No.  The whole mbuf and cluster stuff isn't allocated or reserved
> at boot time.  We simply need a limit to prevent it from exhausting
> all available kvm / physical memory whichever is less.
> 

For now, we have limit which does not allow to run even one igb(4) NIC
in 9k jumbo configuration.

> Other than that there is no relation to maxusers except historic
> behavior.
> 
> So the ideal mbuf limit is just short of keeling the kernel over
> no matter what maxusers says.  There also isn't much to tune then
> as the only fix would be to add more physical ram.
> 


-- 
Andrey Zonov



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r242847 - in head/sys: i386/include kern

2012-11-18 Thread Andre Oppermann

On 18.11.2012 15:05, Andrey Zonov wrote:

On 11/11/12 3:04 AM, Andre Oppermann wrote:

On 10.11.2012 23:24, Alfred Perlstein wrote:

On 11/10/12 11:18 AM, Andre Oppermann wrote:

On 10.11.2012 19:04, Peter Wemm wrote:

This is complicated but we need a simple user visible view of it.  It
really needs to be something like "nmbclusters defaults to 6% of
physical ram, with machine dependent limits".  The MD limits are bad
enough, and using bogo-units like "maxusers" just makes it worse.


Yes, that would be optimal.


No it would not.

I used to be able to tell people "hey just try increasing maxusers"
and they would and suddenly the
box would be OK.

Now I'll have to remember 3,4,5,10,20x tunable to increase?


No.  The whole mbuf and cluster stuff isn't allocated or reserved
at boot time.  We simply need a limit to prevent it from exhausting
all available kvm / physical memory whichever is less.



For now, we have limit which does not allow to run even one igb(4) NIC
in 9k jumbo configuration.


My patch for mbuf* zone auto-sizing does fix that, or not?

--
Andre

___
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: r243228 - head/etc

2012-11-18 Thread Chris Rees
Author: crees (ports committer)
Date: Sun Nov 18 14:21:05 2012
New Revision: 243228
URL: http://svnweb.freebsd.org/changeset/base/243228

Log:
  cp -R misses out dotfiles; use pax instead to copy file hierarchies
  
  PR:   conf/99721 (based on)
  Submitted by: Florian Zavatzki 
  Approved by:  hrs
  MFC after:1 month

Modified:
  head/etc/rc.initdiskless

Modified: head/etc/rc.initdiskless
==
--- head/etc/rc.initdisklessSun Nov 18 14:05:28 2012(r243227)
+++ head/etc/rc.initdisklessSun Nov 18 14:21:05 2012(r243228)
@@ -354,7 +354,7 @@ for i in ${templates} ; do
subdir=${j##*/}
if [ -d $j -a ! -f $j.cpio.gz  ]; then
create_md $subdir
-   cp -Rp $j/ /$subdir
+   (cd $j && pax -rw . /$subdir)
fi
 done
 for j in /conf/$i/*.cpio.gz ; do
___
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: r243231 - head/usr.sbin/route6d

2012-11-18 Thread Hiroki Sato
Author: hrs
Date: Sun Nov 18 15:11:47 2012
New Revision: 243231
URL: http://svnweb.freebsd.org/changeset/base/243231

Log:
  Use sin6_scope_id instead of KAME-specific embedded scope id.

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

Modified: head/usr.sbin/route6d/route6d.c
==
--- head/usr.sbin/route6d/route6d.c Sun Nov 18 14:58:50 2012
(r243230)
+++ head/usr.sbin/route6d/route6d.c Sun Nov 18 15:11:47 2012
(r243231)
@@ -90,18 +90,6 @@ static char _rcsid[] = "$KAME: route6d.c
((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
 #define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
 
-/*
- * Following two macros are highly depending on KAME Release
- */
-#defineIN6_LINKLOCAL_IFINDEX(addr) \
-   ((addr).s6_addr[2] << 8 | (addr).s6_addr[3])
-
-#defineSET_IN6_LINKLOCAL_IFINDEX(addr, index) \
-   do { \
-   (addr).s6_addr[2] = ((index) >> 8) & 0xff; \
-   (addr).s6_addr[3] = (index) & 0xff; \
-   } while (0)
-
 struct ifc {   /* Configuration of an interface */
char*ifc_name;  /* if name */
struct  ifc *ifc_next;
@@ -122,6 +110,7 @@ struct  ifac {  /* Adddress associated t
struct  ifac *ifa_next;
struct  in6_addr ifa_addr;  /* address */
struct  in6_addr ifa_raddr; /* remote address, valid in p2p */
+   int ifa_scope_id;   /* scope id */
int ifa_plen;   /* prefix length */
 };
 
@@ -883,8 +872,6 @@ ripsend(ifcp, sin6, flag)
if (nrt == maxrte - 2)
ripflush(ifcp, sin6);
np->rip6_dest = rrt->rrt_gw;
-   if (IN6_IS_ADDR_LINKLOCAL(&np->rip6_dest))
-   
SET_IN6_LINKLOCAL_IFINDEX(np->rip6_dest, 0);
np->rip6_plen = 0;
np->rip6_tag = 0;
np->rip6_metric = NEXTHOP_METRIC;
@@ -1036,12 +1023,9 @@ sendpacket(sin6, len)
sin6 = &sincopy;
 
if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) ||
-   IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) {
-   /* XXX: do not mix the interface index and link index */
-   idx = IN6_LINKLOCAL_IFINDEX(sin6->sin6_addr);
-   SET_IN6_LINKLOCAL_IFINDEX(sin6->sin6_addr, 0);
-   sin6->sin6_scope_id = idx;
-   } else
+   IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
+   idx = sin6->sin6_scope_id;
+   else
idx = 0;
 
m.msg_name = (caddr_t)sin6;
@@ -1144,8 +1128,6 @@ riprecv()
break;
}
}
-   if (idx && IN6_IS_ADDR_LINKLOCAL(&fsock.sin6_addr))
-   SET_IN6_LINKLOCAL_IFINDEX(fsock.sin6_addr, idx);
 
if (len < sizeof(struct rip6)) {
trace(1, "Packet too short\n");
@@ -1221,7 +1203,7 @@ riprecv()
return;
}
 
-   idx = IN6_LINKLOCAL_IFINDEX(fsock.sin6_addr);
+   idx = fsock.sin6_scope_id;
ifcp = (idx < nindex2ifc) ? index2ifc[idx] : NULL;
if (!ifcp) {
trace(1, "Packets to unknown interface index %d\n", idx);
@@ -1248,7 +1230,6 @@ riprecv()
/* modify neighbor address */
if (IN6_IS_ADDR_LINKLOCAL(&np->rip6_dest)) {
nh = np->rip6_dest;
-   SET_IN6_LINKLOCAL_IFINDEX(nh, idx);
trace(1, "\tNexthop: %s\n", inet6_n2p(&nh));
} else if (IN6_IS_ADDR_UNSPECIFIED(&np->rip6_dest)) {
nh = fsock.sin6_addr;
@@ -1603,6 +1584,7 @@ ifconfig1(name, sa, ifcp, s)
ifcp->ifc_addr = ifa;
ifa->ifa_addr = sin6->sin6_addr;
ifa->ifa_plen = plen;
+   ifa->ifa_scope_id= sin6->sin6_scope_id;
if (ifcp->ifc_flags & IFF_POINTOPOINT) {
ifr.ifr_addr = *sin6;
if (ioctl(s, SIOCGIFDSTADDR_IN6, (char *)&ifr) < 0) {
@@ -1619,10 +1601,9 @@ ifconfig1(name, sa, ifcp, s)
}
if (ifcp->ifc_index < 0 && IN6_IS_ADDR_LINKLOCAL(&ifa->ifa_addr)) {
ifcp->ifc_mylladdr = ifa->ifa_addr;
-   ifcp->ifc_index = IN6_LINKLOCAL_IFINDEX(ifa->ifa_addr);
+   ifcp->ifc_index = ifa->ifa_scope_id;
memcpy(&ifcp->ifc_ripsin, &ripsin, ripsin.ss_len);
-   SET_IN6_LINKLOCAL_IFINDEX(ifcp->ifc_ripsin.sin6_addr,
-   ifcp->ifc_index);
+   ifcp->ifc_ripsin.sin6_scope_id = ifcp->ifc_index;
setindex2ifc(ifcp->ifc_index, ifcp);
ifcp->ifc_mtu = getifmtu(ifcp->ifc_index);
if (ifcp->ifc_mtu > RIP6_MAXMTU)
_

svn commit: r243232 - head/usr.sbin/route6d

2012-11-18 Thread Hiroki Sato
Author: hrs
Date: Sun Nov 18 15:37:27 2012
New Revision: 243232
URL: http://svnweb.freebsd.org/changeset/base/243232

Log:
  Overhaul of route6d(8):
  
  - Use queue(3) for linked-list.
  - Use a consistent naming scheme for struct members.
  - Use ANSI C style function declaration.
  - Add check of RTM_VERSION mismatch.
  
  There is no functional change.

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

Modified: head/usr.sbin/route6d/route6d.c
==
--- head/usr.sbin/route6d/route6d.c Sun Nov 18 15:11:47 2012
(r243231)
+++ head/usr.sbin/route6d/route6d.c Sun Nov 18 15:37:27 2012
(r243232)
@@ -31,7 +31,7 @@
  */
 
 #ifndeflint
-static char _rcsid[] = "$KAME: route6d.c,v 1.104 2003/10/31 00:30:20 itojun 
Exp $";
+static const char _rcsid[] = "$KAME: route6d.c,v 1.104 2003/10/31 00:30:20 
itojun Exp $";
 #endif
 
 #include 
@@ -90,9 +90,10 @@ static char _rcsid[] = "$KAME: route6d.c
((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
 #define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
 
-struct ifc {   /* Configuration of an interface */
-   char*ifc_name;  /* if name */
-   struct  ifc *ifc_next;
+struct ifc {   /* Configuration of an interface */
+   TAILQ_ENTRY(ifc) ifc_next;
+
+   charifc_name[IFNAMSIZ]; /* if name */
int ifc_index;  /* if index */
int ifc_mtu;/* if mtu */
int ifc_metric; /* if metric */
@@ -100,31 +101,32 @@ structifc {   /* Configuration of an 
in
short   ifc_cflags; /* IFC_XXX */
struct  in6_addr ifc_mylladdr;  /* my link-local address */
struct  sockaddr_in6 ifc_ripsin;/* rip multicast address */
-   struct  iff *ifc_filter;/* filter structure */
-   struct  ifac *ifc_addr; /* list of AF_INET6 addresses */
+   TAILQ_HEAD(, ifac) ifc_ifac_head;   /* list of AF_INET6 addrs */
+   TAILQ_HEAD(, iff) ifc_iff_head; /* list of filters */
int ifc_joined; /* joined to ff02::9 */
 };
+TAILQ_HEAD(, ifc) ifc_head = TAILQ_HEAD_INITIALIZER(ifc_head);
+
+struct ifac {  /* Adddress associated to an interface */ 
+   TAILQ_ENTRY(ifac) ifac_next;
 
-struct ifac {  /* Adddress associated to an interface */ 
-   struct  ifc *ifa_conf;  /* back pointer */
-   struct  ifac *ifa_next;
-   struct  in6_addr ifa_addr;  /* address */
-   struct  in6_addr ifa_raddr; /* remote address, valid in p2p */
-   int ifa_scope_id;   /* scope id */
-   int ifa_plen;   /* prefix length */
+   struct  ifc *ifac_ifc;  /* back pointer */
+   struct  in6_addr ifac_addr; /* address */
+   struct  in6_addr ifac_raddr;/* remote address, valid in p2p */
+   int ifac_scope_id;  /* scope id */
+   int ifac_plen;  /* prefix length */
 };
 
-struct iff {
+struct iff {   /* Filters for an interface */
+   TAILQ_ENTRY(iff) iff_next;
+
int iff_type;
struct  in6_addr iff_addr;
int iff_plen;
-   struct  iff *iff_next;
 };
 
-struct ifc *ifc;
-intnifc;   /* number of valid ifc's */
 struct ifc **index2ifc;
-intnindex2ifc;
+unsigned int   nindex2ifc;
 struct ifc *loopifcp = NULL;   /* pointing to loopback */
 #ifdef HAVE_POLL_H
 struct pollfd set[2];
@@ -151,8 +153,9 @@ struct  rip6 *ripbuf;   /* packet buffer fo
  * suppressing the specifics covered by the aggregate.
  */
 
-struct riprt {
-   struct  riprt *rrt_next;/* next destination */
+struct riprt {
+   TAILQ_ENTRY(riprt) rrt_next;/* next destination */
+
struct  riprt *rrt_same;/* same destination - future use */
struct  netinfo6 rrt_info;  /* network info */
struct  in6_addr rrt_gw;/* gateway */
@@ -161,8 +164,7 @@ struct  riprt {
time_t  rrt_t;  /* when the route validated */
int rrt_index;  /* ifindex from which this route got */
 };
-
-struct riprt *riprt = 0;
+TAILQ_HEAD(, riprt) riprt_head = TAILQ_HEAD_INITIALIZER(riprt_head);
 
 intdflag = 0;  /* debug flag */
 intqflag = 0;  /* quiet flag */
@@ -211,7 +213,7 @@ int out_filter(struct riprt *, struct if
 void init(void);
 void sockopt(struct ifc *);
 void ifconfig(void);
-void ifconfig1(const char *, const struct sockaddr *, struct ifc *, int);
+int ifconfig1(const char *, const struct sockaddr *, struct ifc *, int);
 void rtrecv(void);
 int rt_del(const struct sockaddr_in6 *, const struct sockaddr_in6 *,
const struct sockaddr_in6 *);
@@ -234,7 +236,7 @@ void rt_entry(struct 

Re: svn commit: r243130 - head/etc/root

2012-11-18 Thread Ulrich Spörlein
On Fri, 2012-11-16 at 04:25:35 +, Eitan Adler wrote:
> Author: eadler
> Date: Fri Nov 16 04:25:35 2012
> New Revision: 243130
> URL: http://svnweb.freebsd.org/changeset/base/243130
> 
> Log:
>   dot.login is supposed to be for bourne shell, not csh
>   
>   Pointyhat to: me
>   Approved by: cperciva (implicit)
> 
> Modified:
>   head/etc/root/dot.login
> 
> Modified: head/etc/root/dot.login
> ==
> --- head/etc/root/dot.login   Fri Nov 16 03:33:34 2012(r243129)
> +++ head/etc/root/dot.login   Fri Nov 16 04:25:35 2012(r243130)
> @@ -6,4 +6,4 @@
>  #
>  
>  # Uncomment to display a random cookie each login:
> -# if ( -x /usr/games/fortune ) /usr/games/fortune -s
> +# [ -x /usr/games/fortune ] && /usr/games/fortune -s

Please add || true to that line, so that when it is enabled and
/usr/games/fortune doesn't exist or is not executable, the shell startup
doesn't return with $? set to something non-zero.

This is especially annoying if you have $? somewhere in your prompt.

Thanks
Uli
___
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: r243233 - head/usr.sbin/route6d

2012-11-18 Thread Hiroki Sato
Author: hrs
Date: Sun Nov 18 15:48:02 2012
New Revision: 243233
URL: http://svnweb.freebsd.org/changeset/base/243233

Log:
  - Increase the number of retry for NET_RT_DUMP from 5 to 15.
  - Use 2001:db8:: as an example instead of deprecated 3ffe:: address block.
  - Add check for connected routes.
  - Add support of RTM_IFANNOUNCE for dyanmically-added/removed interfaces.
  - Add support of *, ?, and [ in the interface list.
  - Add -P number to specify route flag which will never expire.
  - Add -Q number to specify route flag which route6d will add to routes via 
RIP.
  - Add -p pidfile to specify the process ID file.

Modified:
  head/usr.sbin/route6d/route6d.8
  head/usr.sbin/route6d/route6d.c

Modified: head/usr.sbin/route6d/route6d.8
==
--- head/usr.sbin/route6d/route6d.8 Sun Nov 18 15:37:27 2012
(r243232)
+++ head/usr.sbin/route6d/route6d.8 Sun Nov 18 15:48:02 2012
(r243233)
@@ -16,7 +16,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 31, 1997
+.Dd November 18, 2012
 .Dt ROUTE6D 8
 .Os
 .Sh NAME
@@ -41,6 +41,15 @@
 .Op Fl O Ar prefix/preflen,if1[,if2...\&]
 .Ek
 .Bk -words
+.Op Fl P Ar number
+.Ek
+.Bk -words
+.Op Fl p Ar pidfile
+.Ek
+.Bk -words
+.Op Fl Q Ar number
+.Ek
+.Bk -words
 .Op Fl T Ar if1[,if2...\&]
 .Ek
 .Bk -words
@@ -80,6 +89,12 @@ and advertises the aggregated route
 .Ar prefix/preflen ,
 to the interfaces specified in the comma-separated interface list,
 .Ar if1[,if2...] .
+The characters
+.Qq Li * ,
+.Qq Li \&? ,
+and
+.Qq Li [
+in the interface list will be interpreted as shell-style pattern.
 The
 .Nm
 utility creates a static route to
@@ -143,7 +158,7 @@ option.
 For example, with
 .Do
 .Fl L
-.Li 3ffe::/16,if1
+.Li 2001:db8::/16,if1
 .Fl L
 .Li ::/0,if1
 .Dc
@@ -164,6 +179,33 @@ With this option
 .Nm
 will only advertise routes that matches
 .Ar prefix/preflen .
+.It Fl P Ar number
+Specifies routes to be ignored in calculation of expiration timer.
+The
+.Ar number
+must be
+.Li 1 ,
+.Li 2 ,
+or
+.Li 3
+and it means route flags of
+.Li RTF_PROTO1 ,
+.Li RTF_PROTO2 ,
+or
+.Li RTF_PROTO3 .
+When
+.Li 1
+is specified, routes with
+.Li RTF_PROTO1
+will never expire.
+.It Fl p Ar pidfile
+Specifies an alternative file in which to store the process ID.
+The default is
+.Pa /var/run/route6d.pid .
+.It Fl Q Ar number
+Specifies flag which will be used for routes added by RIP protocol.
+The default is
+.Li 2 Pq Li RTF_PROTO2 .
 .\"
 .It Fl q
 Makes

Modified: head/usr.sbin/route6d/route6d.c
==
--- head/usr.sbin/route6d/route6d.c Sun Nov 18 15:37:27 2012
(r243232)
+++ head/usr.sbin/route6d/route6d.c Sun Nov 18 15:48:02 2012
(r243233)
@@ -38,6 +38,7 @@ static const char _rcsid[] = "$KAME: rou
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -78,6 +79,7 @@ static const char _rcsid[] = "$KAME: rou
 #include "route6d.h"
 
 #defineMAXFILTER   40
+#define RT_DUMP_MAXRETRY   15
 
 #ifdef DEBUG
 #defineINIT_INTERVAL6  6
@@ -172,6 +174,8 @@ int nflag = 0;  /* don't update kernel ro
 intaflag = 0;  /* age out even the statically defined routes */
 inthflag = 0;  /* don't split horizon */
 intlflag = 0;  /* exchange site local routes */
+intPflag = 0;  /* don't age out routes with RTF_PROTO[123] */
+intQflag = RTF_PROTO2; /* set RTF_PROTO[123] flag to routes by RIPng */
 intsflag = 0;  /* announce static routes w/ split horizon */
 intSflag = 0;  /* announce static routes to every interface */
 unsigned long routetag = 0;/* route tag attached on originating case */
@@ -231,6 +235,7 @@ void applyplen(struct in6_addr *, int);
 void ifrtdump(int);
 void ifdump(int);
 void ifdump0(FILE *, const struct ifc *);
+void ifremove(int);
 void rtdump(int);
 void rt_entry(struct rt_msghdr *, int);
 void rtdexit(void);
@@ -279,9 +284,11 @@ main(int argc, char *argv[])
 {
int ch;
int error = 0;
+   unsigned long proto;
struct  ifc *ifcp;
sigset_t mask, omask;
-   FILE*pidfile;
+   const char *pidfile = ROUTE6D_PID;
+   FILE *pidfh;
char *progname;
char *ep;
 
@@ -292,7 +299,7 @@ main(int argc, char *argv[])
progname = *argv;
 
pid = getpid();
-   while ((ch = getopt(argc, argv, "A:N:O:R:T:L:t:adDhlnqsS")) != -1) {
+   while ((ch = getopt(argc, argv, "A:N:O:R:T:L:t:adDhlnp:P:Q:qsS")) != 
-1) {
switch (ch) {
case 'A':
case 'N':
@@ -314,6 +321,41 @@ main(int argc, char *argv[])
/*NOTREACHED*/
}
break;
+   case 'p':
+   pidfile = optarg;
+   break;
+   case 'P':
+   ep = NULL;
+   prot

svn commit: r243234 - head/sys/kern

2012-11-18 Thread Mateusz Guzik
Author: mjg
Date: Sun Nov 18 15:48:34 2012
New Revision: 243234
URL: http://svnweb.freebsd.org/changeset/base/243234

Log:
  Fix possible fp reference leak in posix_openpt
  
  Reviewed by:  ed
  Approved by:  trasz (mentor)
  MFC after:3 days

Modified:
  head/sys/kern/tty_pts.c

Modified: head/sys/kern/tty_pts.c
==
--- head/sys/kern/tty_pts.c Sun Nov 18 15:48:02 2012(r243233)
+++ head/sys/kern/tty_pts.c Sun Nov 18 15:48:34 2012(r243234)
@@ -836,6 +836,7 @@ sys_posix_openpt(struct thread *td, stru
error = pts_alloc(FFLAGS(uap->flags & O_ACCMODE), td, fp);
if (error != 0) {
fdclose(td->td_proc->p_fd, fp, fd, td);
+   fdrop(fp, td);
return (error);
}
 
___
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: r243235 - head/sys/netinet6

2012-11-18 Thread Hiroki Sato
Author: hrs
Date: Sun Nov 18 16:06:51 2012
New Revision: 243235
URL: http://svnweb.freebsd.org/changeset/base/243235

Log:
  Check if an extracted zoneid is equal to the non-zero sin6_scope_id only when
  it is link-local or MC interface-local.

Modified:
  head/sys/netinet6/scope6.c

Modified: head/sys/netinet6/scope6.c
==
--- head/sys/netinet6/scope6.c  Sun Nov 18 15:48:34 2012(r243234)
+++ head/sys/netinet6/scope6.c  Sun Nov 18 16:06:51 2012(r243235)
@@ -369,12 +369,6 @@ sa6_recoverscope(struct sockaddr_in6 *si
char ip6buf[INET6_ADDRSTRLEN];
u_int32_t zoneid;
 
-   if (sin6->sin6_scope_id != 0) {
-   log(LOG_NOTICE,
-   "sa6_recoverscope: assumption failure (non 0 ID): %s%%%d\n",
-   ip6_sprintf(ip6buf, &sin6->sin6_addr), sin6->sin6_scope_id);
-   /* XXX: proceed anyway... */
-   }
if (IN6_IS_SCOPE_LINKLOCAL(&sin6->sin6_addr) ||
IN6_IS_ADDR_MC_INTFACELOCAL(&sin6->sin6_addr)) {
/*
@@ -387,6 +381,14 @@ sa6_recoverscope(struct sockaddr_in6 *si
return (ENXIO);
if (!ifnet_byindex(zoneid))
return (ENXIO);
+   if (sin6->sin6_scope_id != 0 &&
+   zoneid != sin6->sin6_scope_id) {
+   log(LOG_NOTICE,
+   "%s: embedded scope mismatch: %s%%%d. "
+   "sin6_scope_id was overridden.", __func__,
+   ip6_sprintf(ip6buf, &sin6->sin6_addr),
+   sin6->sin6_scope_id);
+   }
sin6->sin6_addr.s6_addr16[1] = 0;
sin6->sin6_scope_id = zoneid;
}
___
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: r243238 - in head: usr.bin/pr usr.bin/seq usr.sbin/nfscbd

2012-11-18 Thread Eitan Adler
Author: eadler
Date: Sun Nov 18 16:33:51 2012
New Revision: 243238
URL: http://svnweb.freebsd.org/changeset/base/243238

Log:
  Standardize EXIT STATUS instructions in man pages when possible.
  
  Approved by:  bcr (mentor)
  MFC after:3 days

Modified:
  head/usr.bin/pr/pr.1
  head/usr.bin/seq/seq.1
  head/usr.sbin/nfscbd/nfscbd.8

Modified: head/usr.bin/pr/pr.1
==
--- head/usr.bin/pr/pr.1Sun Nov 18 16:13:36 2012(r243237)
+++ head/usr.bin/pr/pr.1Sun Nov 18 16:33:51 2012(r243238)
@@ -361,9 +361,7 @@ and
 require that both arguments, if present, not be separated from the option
 letter.
 .Sh EXIT STATUS
-The
-.Nm
-utility exits 0 on success, and 1 if an error occurs.
+.Ex -std
 .Sh DIAGNOSTICS
 If
 .Nm

Modified: head/usr.bin/seq/seq.1
==
--- head/usr.bin/seq/seq.1  Sun Nov 18 16:13:36 2012(r243237)
+++ head/usr.bin/seq/seq.1  Sun Nov 18 16:33:51 2012(r243238)
@@ -127,10 +127,8 @@ If any sequence numbers will be printed 
 the default conversion is changed to
 .Cm %e .
 .El
-.Pp
-The
-.Nm
-utility exits 0 on success and non-zero if an error occurs.
+.Sh EXIT STATUS
+.Ex -std
 .Sh EXAMPLES
 .Bd -literal -offset indent
 # seq 1 3

Modified: head/usr.sbin/nfscbd/nfscbd.8
==
--- head/usr.sbin/nfscbd/nfscbd.8   Sun Nov 18 16:13:36 2012
(r243237)
+++ head/usr.sbin/nfscbd/nfscbd.8   Sun Nov 18 16:33:51 2012
(r243238)
@@ -77,10 +77,8 @@ has been specified.
 For more information on what callbacks and Open Delegations do, see
 .%T "Network File System (NFS) Version 4 Protocol" ,
 RFC3530.
-.Pp
-The
-.Nm
-utility exits 0 on success or >0 if an error occurred.
+.Sh EXIT STATUS
+.Ex -std
 .Sh SEE ALSO
 .Xr nfsv4 4 ,
 .Xr mount_nfs 8
___
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: r243239 - head/usr.bin/find

2012-11-18 Thread Eitan Adler
Author: eadler
Date: Sun Nov 18 16:34:03 2012
New Revision: 243239
URL: http://svnweb.freebsd.org/changeset/base/243239

Log:
  Make it clear that amin and friends take + and - options.
  
  PR:   docs/173265
  Submitted by: Anton Shterenlikht 
  Approved by:  bcr (mentor)
  MFC after:3 days

Modified:
  head/usr.bin/find/find.1

Modified: head/usr.bin/find/find.1
==
--- head/usr.bin/find/find.1Sun Nov 18 16:33:51 2012(r243238)
+++ head/usr.bin/find/find.1Sun Nov 18 16:34:03 2012(r243239)
@@ -31,7 +31,7 @@
 .\"@(#)find.1  8.7 (Berkeley) 5/9/95
 .\" $FreeBSD$
 .\"
-.Dd September 9, 2012
+.Dd November 18, 2012
 .Dt FIND 1
 .Os
 .Sh NAME
@@ -203,12 +203,19 @@ files with extended ACLs.
 See
 .Xr acl 3
 for more information.
-.It Ic -amin Ar n
+.It Ic -amin Oo Cm - Ns | Ns Cm + Oc Ns Ar n
 True if the difference between the file last access time and the time
 .Nm
 was started, rounded up to the next full minute, is
+more than
 .Ar n
-minutes.
+.Pq + Ns Ar n ,
+less than
+.Ar n
+.Pq - Ns Ar n ,
+or exactly
+.Ar n
+minutes ago.
 .It Ic -anewer Ar file
 Same as
 .Ic -neweram .
@@ -250,13 +257,20 @@ Units are probably only useful when used
 or
 .Cm -
 modifier.
-.It Ic -cmin Ar n
+.It Ic -cmin Oo Cm - Ns | Ns Cm + Oc Ns Ar n
 True if the difference between the time of last change of file status
 information and the time
 .Nm
 was started, rounded up to the next full minute, is
+more than
 .Ar n
-minutes.
+.Pq + Ns Ar n ,
+less than
+.Ar n
+.Pq - Ns Ar n ,
+or exactly
+.Ar n
+minutes ago.
 .It Ic -cnewer Ar file
 Same as
 .Ic -newercm .
@@ -540,12 +554,18 @@ primary is specified, it applies to the 
 not normally be evaluated.
 .Dq Ic -mindepth Li 1
 processes all but the command line arguments.
-.It Ic -mmin Ar n
+.It Ic -mmin Oo Cm - Ns | Ns Cm + Oc Ns Ar n
 True if the difference between the file last modification time and the time
 .Nm
 was started, rounded up to the next full minute, is
 .Ar n
-minutes.
+.Pq + Ns Ar n ,
+less than
+.Ar n
+.Pq - Ns Ar n ,
+or exactly
+.Ar n
+minutes ago.
 .It Ic -mnewer Ar file
 Same as
 .Ic -newer .
___
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: r243240 - head/usr.bin/mktemp

2012-11-18 Thread Eitan Adler
Author: eadler
Date: Sun Nov 18 16:34:06 2012
New Revision: 243240
URL: http://svnweb.freebsd.org/changeset/base/243240

Log:
  Use the macro for standard error return values.
  
  .Dd not bumped because there is no important content change.
  
  Approved by:  bcr (mentor)
  MFC after:3 days
  Obtained from:DragonflyBSD

Modified:
  head/usr.bin/mktemp/mktemp.1

Modified: head/usr.bin/mktemp/mktemp.1
==
--- head/usr.bin/mktemp/mktemp.1Sun Nov 18 16:34:03 2012
(r243239)
+++ head/usr.bin/mktemp/mktemp.1Sun Nov 18 16:34:06 2012
(r243240)
@@ -158,10 +158,7 @@ Use of this
 option is not encouraged.
 .El
 .Sh EXIT STATUS
-The
-.Nm
-utility
-exits 0 on success, and 1 if an error occurs.
+.Ex -std
 .Sh EXAMPLES
 The following
 .Xr sh 1
___
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: r243241 - head/share/man/man7

2012-11-18 Thread Eitan Adler
Author: eadler
Date: Sun Nov 18 16:34:09 2012
New Revision: 243241
URL: http://svnweb.freebsd.org/changeset/base/243241

Log:
  Modernize parts of the ports.7 manual page.
  
  Approved by:  bcr (mentor)
  MFC after:3 days

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

Modified: head/share/man/man7/ports.7
==
--- head/share/man/man7/ports.7 Sun Nov 18 16:34:06 2012(r243240)
+++ head/share/man/man7/ports.7 Sun Nov 18 16:34:09 2012(r243241)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 9, 2012
+.Dd November 18, 2012
 .Dt PORTS 7
 .Os
 .Sh NAME
@@ -41,7 +41,7 @@ Each
 .Em port
 contains any patches necessary to make the original
 application source code compile and run on
-.Bx .
+.Fx .
 Compiling an
 application is as simple as typing
 .Nm make Cm build
@@ -56,19 +56,6 @@ simply type
 .Nm make Cm install
 to install the application.
 .Pp
-It is possible to download and use ports from the
-.Fx
-repository
-that are newer than the installed system; however it is important to
-install the appropriate
-.Dq "Upgrade Kit"
-from
-.Pa http://www.FreeBSD.org/ports/
-first!
-The
-.Xr portcheckout 1 Pq Pa ports/ports-mgmt/portcheckout
-script (also a port, of course!) will help to download new ports.
-.Pp
 For more information about using ports, see
 .Dq "Packages and Ports"
 in
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r243242 - head/usr.sbin/route6d

2012-11-18 Thread Joel Dahl
Author: joel (doc committer)
Date: Sun Nov 18 16:58:08 2012
New Revision: 243242
URL: http://svnweb.freebsd.org/changeset/base/243242

Log:
  Minor mdoc fix.

Modified:
  head/usr.sbin/route6d/route6d.8

Modified: head/usr.sbin/route6d/route6d.8
==
--- head/usr.sbin/route6d/route6d.8 Sun Nov 18 16:34:09 2012
(r243241)
+++ head/usr.sbin/route6d/route6d.8 Sun Nov 18 16:58:08 2012
(r243242)
@@ -93,7 +93,7 @@ The characters
 .Qq Li * ,
 .Qq Li \&? ,
 and
-.Qq Li [
+.Qq Li \&[
 in the interface list will be interpreted as shell-style pattern.
 The
 .Nm
___
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: r243245 - in head/sys: conf ufs/ffs ufs/ufs

2012-11-18 Thread Edward Tomasz Napierala
Author: trasz
Date: Sun Nov 18 18:57:19 2012
New Revision: 243245
URL: http://svnweb.freebsd.org/changeset/base/243245

Log:
  Add UFS writesuspension mechanism, designed to allow userland processes
  to modify on-disk metadata for filesystems mounted for write.
  
  Reviewed by:  kib, mckusick
  Sponsored by: FreeBSD Foundation

Added:
  head/sys/ufs/ffs/ffs_suspend.c   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/ufs/ffs/ffs_extern.h
  head/sys/ufs/ffs/ffs_vfsops.c
  head/sys/ufs/ffs/fs.h
  head/sys/ufs/ufs/ufsmount.h

Modified: head/sys/conf/files
==
--- head/sys/conf/files Sun Nov 18 17:27:10 2012(r243244)
+++ head/sys/conf/files Sun Nov 18 18:57:19 2012(r243245)
@@ -3578,6 +3578,7 @@ ufs/ffs/ffs_tables.c  optional ffs
 ufs/ffs/ffs_vfsops.c   optional ffs
 ufs/ffs/ffs_vnops.coptional ffs
 ufs/ffs/ffs_rawread.c  optional directio
+ufs/ffs/ffs_suspend.c  optional ffs
 ufs/ufs/ufs_acl.c  optional ffs
 ufs/ufs/ufs_bmap.c optional ffs
 ufs/ufs/ufs_dirhash.c  optional ffs

Modified: head/sys/ufs/ffs/ffs_extern.h
==
--- head/sys/ufs/ffs/ffs_extern.h   Sun Nov 18 17:27:10 2012
(r243244)
+++ head/sys/ufs/ffs/ffs_extern.h   Sun Nov 18 18:57:19 2012
(r243245)
@@ -79,9 +79,11 @@ int  ffs_isfreeblock(struct fs *, u_char 
 void   ffs_load_inode(struct buf *, struct inode *, struct fs *, ino_t);
 intffs_mountroot(void);
 void   ffs_oldfscompat_write(struct fs *, struct ufsmount *);
+intffs_own_mount(const struct mount *mp);
 intffs_reallocblks(struct vop_reallocblks_args *);
 intffs_realloccg(struct inode *, ufs2_daddr_t, ufs2_daddr_t,
ufs2_daddr_t, int, int, int, struct ucred *, struct buf **);
+intffs_reload(struct mount *, struct thread *, int);
 intffs_sbupdate(struct ufsmount *, int, int);
 void   ffs_setblock(struct fs *, u_char *, ufs1_daddr_t);
 intffs_snapblkfree(struct fs *, struct vnode *, ufs2_daddr_t, long, ino_t,
@@ -100,6 +102,8 @@ int ffs_valloc(struct vnode *, int, stru
 intffs_vfree(struct vnode *, ino_t, int);
 vfs_vget_t ffs_vget;
 intffs_vgetf(struct mount *, ino_t, int, struct vnode **, int);
+void   ffs_susp_initialize(void);
+void   ffs_susp_uninitialize(void);
 
 #defineFFSV_FORCEINSMQ 0x0001
 

Added: head/sys/ufs/ffs/ffs_suspend.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/ufs/ffs/ffs_suspend.c  Sun Nov 18 18:57:19 2012
(r243245)
@@ -0,0 +1,338 @@
+/*-
+ * Copyright (c) 2012 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Edward Tomasz Napierala under sponsorship
+ * from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+static d_open_t ffs_susp_open;
+static d_write_t ffs_susp_rdwr;
+static d_ioctl_t ffs_susp_ioctl;
+
+static struct cdevsw ffs_susp_cdevsw = {
+   .d_version =D_VERSION,
+   .d_open =   ffs_susp_open,
+   .d_read =   ffs_susp_rdwr,
+   .d_write =  ffs_susp_rdwr,
+   .d_ioctl =  ffs_susp_ioctl,
+   .d_name =   "ffs_susp",
+};
+
+static struct cdev *ffs_susp_dev;
+static struct sx ffs_susp_lock;
+
+static int
+ffs_susp_suspended(s

svn commit: r243246 - head/sbin/growfs

2012-11-18 Thread Edward Tomasz Napierala
Author: trasz
Date: Sun Nov 18 19:01:00 2012
New Revision: 243246
URL: http://svnweb.freebsd.org/changeset/base/243246

Log:
  Make it possible to resize filesystems mounted read-write, using newly
  introduced UFS write suspension mechanism.
  
  Reviewed by:  kib, mckusick
  Sponsored by: FreeBSD Foundation

Modified:
  head/sbin/growfs/growfs.8
  head/sbin/growfs/growfs.c

Modified: head/sbin/growfs/growfs.8
==
--- head/sbin/growfs/growfs.8   Sun Nov 18 18:57:19 2012(r243245)
+++ head/sbin/growfs/growfs.8   Sun Nov 18 19:01:00 2012(r243246)
@@ -115,11 +115,17 @@ The
 .Nm
 utility first appeared in
 .Fx 4.4 .
+The ability to resize mounted filesystems was added in
+.Fx 10.0 .
 .Sh AUTHORS
 .An Christoph Herrmann Aq c...@freebsd.org
 .An Thomas-Henning von Kamptz Aq toms...@freebsd.org
 .An The GROWFS team Aq gro...@tomsoft.com
 .An Edward Tomasz Napierala Aq tr...@freebsd.org
+.Sh CAVEATS
+.Pp
+When expanding a file system mounted read-write, any writes to that file system
+will be temporarily suspended until the expansion is finished.
 .Sh BUGS
 Normally
 .Nm

Modified: head/sbin/growfs/growfs.c
==
--- head/sbin/growfs/growfs.c   Sun Nov 18 18:57:19 2012(r243245)
+++ head/sbin/growfs/growfs.c   Sun Nov 18 19:01:00 2012(r243246)
@@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1525,8 +1526,9 @@ main(int argc, char **argv)
 
if (yflag == 0 && Nflag == 0) {
if (statfsp != NULL && (statfsp->f_flags & MNT_RDONLY) == 0)
-   errx(1, "%s is mounted read-write on %s",
-   statfsp->f_mntfromname, statfsp->f_mntonname);
+   printf("Device is mounted read-write; resizing will "
+   "result in temporary write suspension for %s.\n",
+   statfsp->f_mntonname);
printf("It's strongly recommended to make a backup "
"before growing the file system.\n"
"OK to grow filesystem on %s", device);
@@ -1555,9 +1557,18 @@ main(int argc, char **argv)
if (Nflag) {
fso = -1;
} else {
-   fso = open(device, O_WRONLY);
-   if (fso < 0)
-   err(1, "%s", device);
+   if (statfsp != NULL && (statfsp->f_flags & MNT_RDONLY) == 0) {
+   fso = open(_PATH_UFSSUSPEND, O_RDWR);
+   if (fso == -1)
+   err(1, "unable to open %s", _PATH_UFSSUSPEND);
+   error = ioctl(fso, UFSSUSPEND, &statfsp->f_fsid);
+   if (error != 0)
+   err(1, "UFSSUSPEND");
+   } else {
+   fso = open(device, O_WRONLY);
+   if (fso < 0)
+   err(1, "%s", device);
+   }
}
 
/*
@@ -1627,12 +1638,17 @@ main(int argc, char **argv)
 
close(fsi);
if (fso > -1) {
+   if (statfsp != NULL && (statfsp->f_flags & MNT_RDONLY) == 0) {
+   error = ioctl(fso, UFSRESUME);
+   if (error != 0)
+   err(1, "UFSRESUME");
+   }
error = close(fso);
if (error != 0)
err(1, "close");
+   if (statfsp != NULL && (statfsp->f_flags & MNT_RDONLY) != 0)
+   mount_reload(statfsp);
}
-   if (statfsp != NULL)
-   mount_reload(statfsp);
 
DBG_CLOSE;
 
___
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: r243247 - head/include

2012-11-18 Thread Edward Tomasz Napierala
Author: trasz
Date: Sun Nov 18 19:16:10 2012
New Revision: 243247
URL: http://svnweb.freebsd.org/changeset/base/243247

Log:
  Add change missed in 243245.

Modified:
  head/include/paths.h

Modified: head/include/paths.h
==
--- head/include/paths.hSun Nov 18 19:01:00 2012(r243246)
+++ head/include/paths.hSun Nov 18 19:16:10 2012(r243247)
@@ -85,6 +85,7 @@
 #define_PATH_SHELLS"/etc/shells"
 #define_PATH_TTY   "/dev/tty"
 #define_PATH_UNIX  "don't use _PATH_UNIX"
+#define_PATH_UFSSUSPEND"/dev/ufssuspend"
 #define_PATH_VI"/usr/bin/vi"
 #define_PATH_WALL  "/usr/bin/wall"
 
___
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: r243246 - head/sbin/growfs

2012-11-18 Thread Gavin Atkinson
On Sun, 18 Nov 2012, Edward Tomasz Napierala wrote:

> Author: trasz
> Date: Sun Nov 18 19:01:00 2012
> New Revision: 243246
> URL: http://svnweb.freebsd.org/changeset/base/243246
> 
> Log:
>   Make it possible to resize filesystems mounted read-write, using newly
>   introduced UFS write suspension mechanism.
> 
> Modified: head/sbin/growfs/growfs.c
> ==
> --- head/sbin/growfs/growfs.c Sun Nov 18 18:57:19 2012(r243245)
> +++ head/sbin/growfs/growfs.c Sun Nov 18 19:01:00 2012(r243246)
> @@ -1555,9 +1557,18 @@ main(int argc, char **argv)
>   if (Nflag) {
>   fso = -1;
>   } else {
> - fso = open(device, O_WRONLY);
> - if (fso < 0)
> - err(1, "%s", device);
> + if (statfsp != NULL && (statfsp->f_flags & MNT_RDONLY) == 0) {
> + fso = open(_PATH_UFSSUSPEND, O_RDWR);
> + if (fso == -1)
> + err(1, "unable to open %s", _PATH_UFSSUSPEND);
> + error = ioctl(fso, UFSSUSPEND, &statfsp->f_fsid);
> + if (error != 0)
> + err(1, "UFSSUSPEND");
> + } else {
> + fso = open(device, O_WRONLY);
> + if (fso < 0)
> + err(1, "%s", device);
> + }
>   }

It is excellent to see this functionality, and it will be very much 
appreciated especially for people using virtual machines.

All the way through later code there are calls to err() on failure.  
What happens to the suspended filesystem if that happens and growfs exits 
before the matching UFSRESUME?

Thanks,

Gavin
___
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: r243246 - head/sbin/growfs

2012-11-18 Thread Edward Tomasz Napierała
Wiadomość napisana przez Gavin Atkinson w dniu 18 lis 2012, o godz. 20:25:
> On Sun, 18 Nov 2012, Edward Tomasz Napierala wrote:
> 
>> Author: trasz
>> Date: Sun Nov 18 19:01:00 2012
>> New Revision: 243246
>> URL: http://svnweb.freebsd.org/changeset/base/243246
>> 
>> Log:
>>  Make it possible to resize filesystems mounted read-write, using newly
>>  introduced UFS write suspension mechanism.
>> 
>> Modified: head/sbin/growfs/growfs.c
>> ==
>> --- head/sbin/growfs/growfs.cSun Nov 18 18:57:19 2012
>> (r243245)
>> +++ head/sbin/growfs/growfs.cSun Nov 18 19:01:00 2012
>> (r243246)
>> @@ -1555,9 +1557,18 @@ main(int argc, char **argv)
>>  if (Nflag) {
>>  fso = -1;
>>  } else {
>> -fso = open(device, O_WRONLY);
>> -if (fso < 0)
>> -err(1, "%s", device);
>> +if (statfsp != NULL && (statfsp->f_flags & MNT_RDONLY) == 0) {
>> +fso = open(_PATH_UFSSUSPEND, O_RDWR);
>> +if (fso == -1)
>> +err(1, "unable to open %s", _PATH_UFSSUSPEND);
>> +error = ioctl(fso, UFSSUSPEND, &statfsp->f_fsid);
>> +if (error != 0)
>> +err(1, "UFSSUSPEND");
>> +} else {
>> +fso = open(device, O_WRONLY);
>> +if (fso < 0)
>> +err(1, "%s", device);
>> +}
>>  }
> 
> It is excellent to see this functionality, and it will be very much 
> appreciated especially for people using virtual machines.

Thanks!

> All the way through later code there are calls to err() on failure.  
> What happens to the suspended filesystem if that happens and growfs exits 
> before the matching UFSRESUME?

Kernel releases the suspension when the process keeping the filedescriptor
exits.  It could be said that the UFSRESUME ioctl is there mostly
for completeness.  And the changes performed by growfs(8) are ordered in
a way that keeps the filesystem consistent, so it should be safe to ^C
growfs execution without breaking things.

-- 
If you cut off my head, what would I say?  Me and my head, or me and my body?

___
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: r243248 - head/sbin/growfs

2012-11-18 Thread Joel Dahl
Author: joel (doc committer)
Date: Sun Nov 18 19:39:42 2012
New Revision: 243248
URL: http://svnweb.freebsd.org/changeset/base/243248

Log:
  Remove superfluous paragraph macro.

Modified:
  head/sbin/growfs/growfs.8

Modified: head/sbin/growfs/growfs.8
==
--- head/sbin/growfs/growfs.8   Sun Nov 18 19:16:10 2012(r243247)
+++ head/sbin/growfs/growfs.8   Sun Nov 18 19:39:42 2012(r243248)
@@ -123,7 +123,6 @@ The ability to resize mounted filesystem
 .An The GROWFS team Aq gro...@tomsoft.com
 .An Edward Tomasz Napierala Aq tr...@freebsd.org
 .Sh CAVEATS
-.Pp
 When expanding a file system mounted read-write, any writes to that file system
 will be temporarily suspended until the expansion is finished.
 .Sh BUGS
___
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: r243228 - head/etc

2012-11-18 Thread Ed Schouten
Hi Chris,

2012/11/18 Chris Rees :
> Modified: head/etc/rc.initdiskless
> ==
> --- head/etc/rc.initdisklessSun Nov 18 14:05:28 2012(r243227)
> +++ head/etc/rc.initdisklessSun Nov 18 14:21:05 2012(r243228)
> @@ -354,7 +354,7 @@ for i in ${templates} ; do
> subdir=${j##*/}
> if [ -d $j -a ! -f $j.cpio.gz  ]; then
> create_md $subdir
> -   cp -Rp $j/ /$subdir
> +   (cd $j && pax -rw . /$subdir)
> fi
>  done
>  for j in /conf/$i/*.cpio.gz ; do

Are you sure that this bug wasn't already fixed? The original version
of the code in the bug report used the following line:

-   cp -Rp $j/* /$subdir

The old version of the code you changed didn't have this asterisk,
meaning dotfiles would already be copied. Still, you could argue that
your version is nicer, as our behaviour of cp with the trailing slash
contradicts POSIX.

Thanks,
-- 
Ed Schouten 
___
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: r243249 - head/sys/dev/ath/ath_hal/ar5211

2012-11-18 Thread Adrian Chadd
Author: adrian
Date: Sun Nov 18 20:41:46 2012
New Revision: 243249
URL: http://svnweb.freebsd.org/changeset/base/243249

Log:
  Remove this include, it isn't needed.

Modified:
  head/sys/dev/ath/ath_hal/ar5211/ar5211desc.h

Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211desc.h
==
--- head/sys/dev/ath/ath_hal/ar5211/ar5211desc.hSun Nov 18 19:39:42 
2012(r243248)
+++ head/sys/dev/ath/ath_hal/ar5211/ar5211desc.hSun Nov 18 20:41:46 
2012(r243249)
@@ -19,8 +19,6 @@
 #ifndef _DEV_ATH_AR5211DESC_H
 #define _DEV_ATH_AR5211DESC_H
 
-#include "ah_desc.h"
-
 /*
  * Defintions for the DMA descriptors used by the Atheros
  * AR5211 and AR5110 Wireless Lan controller parts.
___
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: r243228 - head/etc

2012-11-18 Thread Chris Rees
On 18 Nov 2012 20:39, "Ed Schouten"  wrote:
>
> Hi Chris,
>
> 2012/11/18 Chris Rees :
> > Modified: head/etc/rc.initdiskless
> >
==
> > --- head/etc/rc.initdisklessSun Nov 18 14:05:28 2012
 (r243227)
> > +++ head/etc/rc.initdisklessSun Nov 18 14:21:05 2012
 (r243228)
> > @@ -354,7 +354,7 @@ for i in ${templates} ; do
> > subdir=${j##*/}
> > if [ -d $j -a ! -f $j.cpio.gz  ]; then
> > create_md $subdir
> > -   cp -Rp $j/ /$subdir
> > +   (cd $j && pax -rw . /$subdir)
> > fi
> >  done
> >  for j in /conf/$i/*.cpio.gz ; do
>
> Are you sure that this bug wasn't already fixed? The original version
> of the code in the bug report used the following line:
>
> -   cp -Rp $j/* /$subdir
>
> The old version of the code you changed didn't have this asterisk,
> meaning dotfiles would already be copied. Still, you could argue that
> your version is nicer, as our behaviour of cp with the trailing slash
> contradicts POSIX.
>

You are correct, and the second to point it out :)

As you say however, pax is technically how it should be done anyway, and
has the nice effect of also preserving hard links.  If no-one objects I
think it should stay in.

This is unfortunately another example of many in rc of where something was
fixed ages ago and no-one checked GNATS :(  Of course, this is still my
fault.

Chris
___
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: r243250 - head/sys/ufs/ffs

2012-11-18 Thread Edward Tomasz Napierala
Author: trasz
Date: Sun Nov 18 22:03:31 2012
New Revision: 243250
URL: http://svnweb.freebsd.org/changeset/base/243250

Log:
  Fix build of kdump(1).

Modified:
  head/sys/ufs/ffs/fs.h

Modified: head/sys/ufs/ffs/fs.h
==
--- head/sys/ufs/ffs/fs.h   Sun Nov 18 20:41:46 2012(r243249)
+++ head/sys/ufs/ffs/fs.h   Sun Nov 18 22:03:31 2012(r243250)
@@ -34,6 +34,7 @@
 #define _UFS_FFS_FS_H_
 
 #include 
+#include 
 
 /*
  * Each disk drive contains some number of filesystems.
___
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: r243251 - head/share/man/man9

2012-11-18 Thread Benjamin Kaduk
Author: bjk (doc committer)
Date: Sun Nov 18 22:52:17 2012
New Revision: 243251
URL: http://svnweb.freebsd.org/changeset/base/243251

Log:
  Improve grammar.
  
  Approved by:  hrs (mentor)

Modified:
  head/share/man/man9/sleep.9

Modified: head/share/man/man9/sleep.9
==
--- head/share/man/man9/sleep.9 Sun Nov 18 22:03:31 2012(r243250)
+++ head/share/man/man9/sleep.9 Sun Nov 18 22:52:17 2012(r243251)
@@ -102,7 +102,8 @@ If
 .Fa priority
 includes the
 .Dv PCATCH
-flag, signals are checked before and after sleeping, otherwise signals are
+flag, pending
+signals are checked before and after sleeping, otherwise signals are
 not checked.
 If
 .Dv PCATCH
@@ -114,17 +115,18 @@ possible, and
 is returned if the system call should be interrupted by the signal
 (return
 .Er EINTR ) .
-If
+If the
 .Dv PBDRY
 flag is specified in addition to
 .Dv PCATCH ,
-then the sleeping thread is not stopped while sleeping upon delivery of
+then the sleeping thread is not stopped upon delivery of
 .Dv SIGSTOP
-or other stop action.
-Instead, it is waken up, assuming that stop occurs on reaching a stop
+or other stop action while it is sleeping.
+Instead, it is woken up, with the assumption
+that the stop will occur on reaching a stop
 point when returning to usermode.
-The flag should be used when sleeping thread owns resources, for instance
-vnode locks, that should be freed timely.
+The flag should be used when the sleeping thread owns resources, for instance
+vnode locks, that should be released in a timely fashion.
 .Pp
 The parameter
 .Fa wmesg
___
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: r243252 - head/tools/regression/bin/sh/parser

2012-11-18 Thread Jilles Tjoelker
Author: jilles
Date: Sun Nov 18 23:15:22 2012
New Revision: 243252
URL: http://svnweb.freebsd.org/changeset/base/243252

Log:
  sh: Apply rlimits to parser/alias10.0 so it fails fast.
  
  Requested by: uqs

Modified:
  head/tools/regression/bin/sh/parser/alias10.0

Modified: head/tools/regression/bin/sh/parser/alias10.0
==
--- head/tools/regression/bin/sh/parser/alias10.0   Sun Nov 18 22:52:17 
2012(r243251)
+++ head/tools/regression/bin/sh/parser/alias10.0   Sun Nov 18 23:15:22 
2012(r243252)
@@ -1,5 +1,9 @@
 # $FreeBSD$
 
+# This test may start consuming memory indefinitely if it fails.
+ulimit -t 5 2>/dev/null
+ulimit -v 10 2>/dev/null
+
 alias echo='echo'
 alias echo='echo'
 [ "`eval echo b`" = b ]
___
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: r243228 - head/etc

2012-11-18 Thread Ian Lepore
On Sun, 2012-11-18 at 21:59 +, Chris Rees wrote:
> On 18 Nov 2012 20:39, "Ed Schouten"  wrote:
> >
> > Hi Chris,
> >
> > 2012/11/18 Chris Rees :
> > > Modified: head/etc/rc.initdiskless
> > >
> ==
> > > --- head/etc/rc.initdisklessSun Nov 18 14:05:28 2012
>  (r243227)
> > > +++ head/etc/rc.initdisklessSun Nov 18 14:21:05 2012
>  (r243228)
> > > @@ -354,7 +354,7 @@ for i in ${templates} ; do
> > > subdir=${j##*/}
> > > if [ -d $j -a ! -f $j.cpio.gz  ]; then
> > > create_md $subdir
> > > -   cp -Rp $j/ /$subdir
> > > +   (cd $j && pax -rw . /$subdir)
> > > fi
> > >  done
> > >  for j in /conf/$i/*.cpio.gz ; do
> >
> > Are you sure that this bug wasn't already fixed? The original version
> > of the code in the bug report used the following line:
> >
> > -   cp -Rp $j/* /$subdir
> >
> > The old version of the code you changed didn't have this asterisk,
> > meaning dotfiles would already be copied. Still, you could argue that
> > your version is nicer, as our behaviour of cp with the trailing slash
> > contradicts POSIX.
> >
> 
> You are correct, and the second to point it out :)
> 
> As you say however, pax is technically how it should be done anyway, and
> has the nice effect of also preserving hard links.  If no-one objects I
> think it should stay in.
> 
> This is unfortunately another example of many in rc of where something was
> fixed ages ago and no-one checked GNATS :(  Of course, this is still my
> fault.

I would vote against yet another pointlessly different program required
to boot the system.  At work, we don't put pax (or anything else we
don't need) onto a product image (although if this change sticks, I
guess we will be some day).

-- Ian


___
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: r243253 - head/sys/mips/cavium

2012-11-18 Thread Juli Mallett
Author: jmallett
Date: Mon Nov 19 00:19:27 2012
New Revision: 243253
URL: http://svnweb.freebsd.org/changeset/base/243253

Log:
  o) Do boot descriptor parsing before console setup so that we can use a 
console
 other than UART 0 from the outset.
  o) Print board information from sysinfo after consoles have been initialized
 rather than doing it during boot descriptor parsing.
  o) Use cvmx_safe_printf and platform_reset rather than panic when doing very
 early boot descriptor parsing before the console is set up.
  o) Get rid of the global octeon_bootinfo.

Modified:
  head/sys/mips/cavium/octeon_machdep.c

Modified: head/sys/mips/cavium/octeon_machdep.c
==
--- head/sys/mips/cavium/octeon_machdep.c   Sun Nov 18 23:15:22 2012
(r243252)
+++ head/sys/mips/cavium/octeon_machdep.c   Mon Nov 19 00:19:27 2012
(r243253)
@@ -88,14 +88,11 @@ __FBSDID("$FreeBSD$");
 #define MAX_APP_DESC_ADDR 0xafff
 #endif
 
-#define OCTEON_CLOCK_DEFAULT (500 * 1000 * 1000)
-
 struct octeon_feature_description {
octeon_feature_t ofd_feature;
const char *ofd_string;
 };
 
-extern int *edata;
 extern int *end;
 extern char cpu_model[];
 extern char cpu_board[];
@@ -280,26 +277,51 @@ platform_start(__register_t a0, __regist
const struct octeon_feature_description *ofd;
uint64_t platform_counter_freq;
 
+   mips_postboot_fixup();
+
/*
-* XXX
-* octeon_boot_params_init() should be called before anything else,
-* certainly before any output; we may find out from the boot
-* descriptor's flags that we're supposed to use the PCI or UART1
-* consoles rather than UART0.  No point doing that reorganization
-* until we actually intercept UART_DEV_CONSOLE for the UART1 case
-* and somehow handle the PCI console, which we lack code for
-* entirely.
+* Initialize boot parameters so that we can determine things like
+* which console we shoud use, etc.
 */
-
-   mips_postboot_fixup();
+   octeon_boot_params_init(a3);
 
/* Initialize pcpu stuff */
mips_pcpu0_init();
-   mips_timer_early_init(OCTEON_CLOCK_DEFAULT);
+   mips_timer_early_init(cvmx_sysinfo_get()->cpu_clock_hz);
+
+   /* Initialize console.  */
cninit();
 
+   /*
+* Display information about the board/CPU.
+*/
+   printf("CPU clock: %uMHz  Core Mask: %#x\n",
+  cvmx_sysinfo_get()->cpu_clock_hz / 100,
+  cvmx_sysinfo_get()->core_mask);
+   printf("Board Type: %u  Revision: %u/%u\n",
+  cvmx_sysinfo_get()->board_type,
+  cvmx_sysinfo_get()->board_rev_major,
+  cvmx_sysinfo_get()->board_rev_minor);
+   printf("MAC address base: %6D (%u configured)\n",
+  cvmx_sysinfo_get()->mac_addr_base, ":",
+  cvmx_sysinfo_get()->mac_addr_count);
+
+#if defined(OCTEON_BOARD_CAPK_0100ND)
+   strcpy(cpu_board, "CAPK-0100ND");
+   if (cvmx_sysinfo_get()->board_type != CVMX_BOARD_TYPE_CN3010_EVB_HS5) {
+   panic("Compiled for %s, but board type is %s.", cpu_board,
+  
cvmx_board_type_to_string(cvmx_sysinfo_get()->board_type));
+   }
+#else
+   strcpy(cpu_board,
+  cvmx_board_type_to_string(cvmx_sysinfo_get()->board_type));
+#endif
+   printf("Board: %s\n", cpu_board);
+   strcpy(cpu_model, octeon_model_get_string(cvmx_get_proc_id()));
+   printf("Model: %s\n", cpu_model);
+   printf("Serial number: %s\n", cvmx_sysinfo_get()->board_serial_number);
+
octeon_ciu_reset();
-   octeon_boot_params_init(a3);
/*
 * XXX
 * We can certainly parse command line arguments or U-Boot environment
@@ -514,26 +536,26 @@ typedef struct {
uint64_t cvmx_desc_vaddr;
 } octeon_boot_descriptor_t;
 
-cvmx_bootinfo_t *octeon_bootinfo;
-
-static octeon_boot_descriptor_t *app_desc_ptr;
-
-static void
-octeon_process_app_desc_ver_6(void)
+static cvmx_bootinfo_t *
+octeon_process_app_desc_ver_6(octeon_boot_descriptor_t *app_desc_ptr)
 {
+   cvmx_bootinfo_t *octeon_bootinfo;
+
/* XXX Why is 0xULL a bad value?  */
if (app_desc_ptr->cvmx_desc_vaddr == 0 ||
-   app_desc_ptr->cvmx_desc_vaddr == 0xul)
-   panic("Bad octeon_bootinfo %p", octeon_bootinfo);
+   app_desc_ptr->cvmx_desc_vaddr == 0xul) {
+   cvmx_safe_printf("Bad octeon_bootinfo %#jx\n",
+   (uintmax_t)app_desc_ptr->cvmx_desc_vaddr);
+   return (NULL);
+   }
 
-   octeon_bootinfo =
-   (cvmx_bootinfo_t *)(intptr_t)app_desc_ptr->cvmx_desc_vaddr;
-octeon_bootinfo =
-   (cvmx_bootinfo_t *) ((intptr_t)octeon_bootinfo | MIPS_KSEG0_START);
-if (octeon_bootinfo->major_version != 1)
-   pan

svn commit: r243254 - head/sys/boot/powerpc/boot1.chrp

2012-11-18 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Nov 19 01:15:32 2012
New Revision: 243254
URL: http://svnweb.freebsd.org/changeset/base/243254

Log:
  Fix build on powerpc.
  
  Reviewed by:  nwhitehorn

Modified:
  head/sys/boot/powerpc/boot1.chrp/boot1.c

Modified: head/sys/boot/powerpc/boot1.chrp/boot1.c
==
--- head/sys/boot/powerpc/boot1.chrp/boot1.cMon Nov 19 00:19:27 2012
(r243253)
+++ head/sys/boot/powerpc/boot1.chrp/boot1.cMon Nov 19 01:15:32 2012
(r243254)
@@ -61,7 +61,7 @@ static void usage(void);
 static void bcopy(const void *src, void *dst, size_t len);
 static void bzero(void *b, size_t len);
 
-static int mount(const char *device, int quiet);
+static int domount(const char *device, int quiet);
 
 static void panic(const char *fmt, ...) __dead2;
 static int printf(const char *fmt, ...);
@@ -431,7 +431,7 @@ main(int ac, char **av)
bootpath_full[len+2] = '\0';
}

-   if (mount(bootpath_full,1) >= 0)
+   if (domount(bootpath_full,1) >= 0)
break;
 
if (bootdev > 0)
@@ -439,10 +439,10 @@ main(int ac, char **av)
}
 
if (i >= 16)
-   panic("mount");
+   panic("domount");
} else {
-   if (mount(bootpath_full,0) == -1)
-   panic("mount");
+   if (domount(bootpath_full,0) == -1)
+   panic("domount");
}
 
printf("   Boot volume:   %s\n",bootpath_full);
@@ -469,17 +469,17 @@ exit(int code)
 static struct dmadat __dmadat;
 
 static int
-mount(const char *device, int quiet)
+domount(const char *device, int quiet)
 {
 
dmadat = &__dmadat;
if ((bootdev = ofw_open(device)) == -1) {
-   printf("mount: can't open device\n");
+   printf("domount: can't open device\n");
return (-1);
}
if (fsread(0, NULL, 0)) {
if (!quiet)
-   printf("mount: can't read superblock\n");
+   printf("domount: can't read superblock\n");
return (-1);
}
return (0);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r243255 - head/sys/mips/cavium

2012-11-18 Thread Juli Mallett
Author: jmallett
Date: Mon Nov 19 01:58:20 2012
New Revision: 243255
URL: http://svnweb.freebsd.org/changeset/base/243255

Log:
  Add basic support for the Radisys-specific PCI console mechanism found on the
  Radisys ATCA-7220.

Modified:
  head/sys/mips/cavium/octeon_pci_console.c

Modified: head/sys/mips/cavium/octeon_pci_console.c
==
--- head/sys/mips/cavium/octeon_pci_console.c   Mon Nov 19 01:15:32 2012
(r243254)
+++ head/sys/mips/cavium/octeon_pci_console.c   Mon Nov 19 01:58:20 2012
(r243255)
@@ -39,8 +39,22 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 
+#ifdef OCTEON_VENDOR_RADISYS
+#defineOPCIC_FLAG_RSYS (0x0001)
+
+#defineOPCIC_RSYS_FIFO_SIZE(0x2000)
+#endif
+
+struct opcic_softc {
+   unsigned sc_flags;
+   uint64_t sc_base_addr;
+};
+
+static struct opcic_softc opcic_instance;
+
 static cn_probe_t opcic_cnprobe;
 static cn_init_t opcic_cninit;
 static cn_term_t opcic_cnterm;
@@ -49,20 +63,46 @@ static cn_putc_t opcic_cnputc;
 static cn_grab_t opcic_cngrab;
 static cn_ungrab_t opcic_cnungrab;
 
+#ifdef OCTEON_VENDOR_RADISYS
+static int opcic_rsys_cngetc(struct opcic_softc *);
+static void opcic_rsys_cnputc(struct opcic_softc *, int);
+#endif
+
 CONSOLE_DRIVER(opcic);
 
 static void
 opcic_cnprobe(struct consdev *cp)
 {
const struct cvmx_bootmem_named_block_desc *pci_console_block;
+   struct opcic_softc *sc;
+
+   sc = &opcic_instance;
+   sc->sc_flags = 0;
+   sc->sc_base_addr = 0;
 
cp->cn_pri = CN_DEAD;
 
-   pci_console_block = 
cvmx_bootmem_find_named_block(OCTEON_PCI_CONSOLE_BLOCK_NAME);
-   if (pci_console_block == NULL)
-   return;
+   switch (cvmx_sysinfo_get()->board_type) {
+#ifdef OCTEON_VENDOR_RADISYS
+   case CVMX_BOARD_TYPE_CUST_RADISYS_RSYS4GBE:
+   pci_console_block =
+   cvmx_bootmem_find_named_block("rsys_gbl_memory");
+   if (pci_console_block != NULL) {
+   sc->sc_flags |= OPCIC_FLAG_RSYS;
+   sc->sc_base_addr = pci_console_block->base_addr;
+   break;
+   }
+#endif
+   default:
+   pci_console_block =
+   
cvmx_bootmem_find_named_block(OCTEON_PCI_CONSOLE_BLOCK_NAME);
+   if (pci_console_block == NULL)
+   return;
+   sc->sc_base_addr = pci_console_block->base_addr;
+   break;
+   }
 
-   cp->cn_arg = (void *)(uintptr_t)pci_console_block->base_addr;
+   cp->cn_arg = sc;
snprintf(cp->cn_name, sizeof cp->cn_name, "opcic@%p", cp->cn_arg);
cp->cn_pri = (boothowto & RB_SERIAL) ? CN_REMOTE : CN_NORMAL;
 }
@@ -82,13 +122,19 @@ opcic_cnterm(struct consdev *cp)
 static int
 opcic_cngetc(struct consdev *cp)
 {
-   uint64_t console_desc_addr;
+   struct opcic_softc *sc;
char ch;
int rv;
 
-   console_desc_addr = (uintptr_t)cp->cn_arg;
+   sc = cp->cn_arg;
 
-   rv = octeon_pci_console_read(console_desc_addr, 0, &ch, 1, 
OCT_PCI_CON_FLAG_NONBLOCK);
+#ifdef OCTEON_VENDOR_RADISYS
+   if ((sc->sc_flags & OPCIC_FLAG_RSYS) != 0)
+   return (opcic_rsys_cngetc(sc));
+#endif
+
+   rv = octeon_pci_console_read(sc->sc_base_addr, 0, &ch, 1,
+   OCT_PCI_CON_FLAG_NONBLOCK);
if (rv != 1)
return (-1);
return (ch);
@@ -97,14 +143,21 @@ opcic_cngetc(struct consdev *cp)
 static void
 opcic_cnputc(struct consdev *cp, int c)
 {
-   uint64_t console_desc_addr;
+   struct opcic_softc *sc;
char ch;
int rv;
 
-   console_desc_addr = (uintptr_t)cp->cn_arg;
+   sc = cp->cn_arg;
ch = c;
 
-   rv = octeon_pci_console_write(console_desc_addr, 0, &ch, 1, 0);
+#ifdef OCTEON_VENDOR_RADISYS
+   if ((sc->sc_flags & OPCIC_FLAG_RSYS) != 0) {
+   opcic_rsys_cnputc(sc, c);
+   return;
+   }
+#endif
+
+   rv = octeon_pci_console_write(sc->sc_base_addr, 0, &ch, 1, 0);
if (rv == -1)
panic("%s: octeon_pci_console_write failed.", __func__);
 }
@@ -120,3 +173,64 @@ opcic_cnungrab(struct consdev *cp)
 {
(void)cp;
 }
+
+#ifdef OCTEON_VENDOR_RADISYS
+static int
+opcic_rsys_cngetc(struct opcic_softc *sc)
+{
+   uint64_t gbl_base;
+   uint64_t console_base;
+   uint64_t console_rbuf;
+   uint64_t console_rcnt[2];
+   uint16_t rcnt[2];
+   uint16_t roff;
+   int c;
+
+   gbl_base = CVMX_ADD_IO_SEG(sc->sc_base_addr);
+   console_base = gbl_base + 0x10;
+
+   console_rbuf = console_base + 0x2018;
+   console_rcnt[0] = console_base + 0x08;
+   console_rcnt[1] = console_base + 0x0a;
+
+   /* Check if there is anything new in the FIFO.  */
+   rcnt[0] = cvmx_read64_uint16(console_rcnt[0]);
+   rcnt[1] = cvmx_read64_uint16(console_rcnt[1]

svn commit: r243260 - head/sys/contrib/octeon-sdk

2012-11-18 Thread Juli Mallett
Author: jmallett
Date: Mon Nov 19 05:24:33 2012
New Revision: 243260
URL: http://svnweb.freebsd.org/changeset/base/243260

Log:
  Fix packet receive on the ATCA-7220 by disabling FCS-related checks, since the
  FCS is stripped by the underlying hardware before it reaches the Octeon.

Modified:
  head/sys/contrib/octeon-sdk/cvmx-helper-spi.c
  head/sys/contrib/octeon-sdk/cvmx-spi.c

Modified: head/sys/contrib/octeon-sdk/cvmx-helper-spi.c
==
--- head/sys/contrib/octeon-sdk/cvmx-helper-spi.c   Mon Nov 19 04:10:23 
2012(r243259)
+++ head/sys/contrib/octeon-sdk/cvmx-helper-spi.c   Mon Nov 19 05:24:33 
2012(r243260)
@@ -164,6 +164,13 @@ int __cvmx_helper_spi_enable(int interfa
 cvmx_pip_prt_cfgx_t port_config;
 port_config.u64 = cvmx_read_csr(CVMX_PIP_PRT_CFGX(ipd_port));
 port_config.s.crc_en = 1;
+#ifdef OCTEON_VENDOR_RADISYS
+   /*
+* Incoming packets on the RSYS4GBE have the FCS stripped.
+*/
+   if (cvmx_sysinfo_get()->board_type == 
CVMX_BOARD_TYPE_CUST_RADISYS_RSYS4GBE)
+   port_config.s.crc_en = 0;
+#endif
 cvmx_write_csr(CVMX_PIP_PRT_CFGX(ipd_port), port_config.u64);
 }
 

Modified: head/sys/contrib/octeon-sdk/cvmx-spi.c
==
--- head/sys/contrib/octeon-sdk/cvmx-spi.c  Mon Nov 19 04:10:23 2012
(r243259)
+++ head/sys/contrib/octeon-sdk/cvmx-spi.c  Mon Nov 19 05:24:33 2012
(r243260)
@@ -652,6 +652,13 @@ int cvmx_spi_interface_up_cb(int interfa
 
 gmxx_rxx_frm_min.u64 = 0;
 gmxx_rxx_frm_min.s.len = 64;
+#ifdef OCTEON_VENDOR_RADISYS
+/*
+ * Incoming packets on the RSYS4GBE have the FCS stripped.
+ */
+if (cvmx_sysinfo_get()->board_type == 
CVMX_BOARD_TYPE_CUST_RADISYS_RSYS4GBE)
+   gmxx_rxx_frm_min.s.len -= 4;
+#endif
 cvmx_write_csr(CVMX_GMXX_RXX_FRM_MIN(0,interface), gmxx_rxx_frm_min.u64);
 gmxx_rxx_frm_max.u64 = 0;
 gmxx_rxx_frm_max.s.len = 64*1024 - 4;
___
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: r243251 - head/share/man/man9

2012-11-18 Thread Konstantin Belousov
On Sun, Nov 18, 2012 at 10:52:17PM +, Benjamin Kaduk wrote:
> Author: bjk (doc committer)
> Date: Sun Nov 18 22:52:17 2012
> New Revision: 243251
> URL: http://svnweb.freebsd.org/changeset/base/243251
> 
> Log:
>   Improve grammar.
>   
>   Approved by:hrs (mentor)
> 
> Modified:
>   head/share/man/man9/sleep.9
> 
> Modified: head/share/man/man9/sleep.9
> ==
> --- head/share/man/man9/sleep.9   Sun Nov 18 22:03:31 2012
> (r243250)
> +++ head/share/man/man9/sleep.9   Sun Nov 18 22:52:17 2012
> (r243251)
> @@ -102,7 +102,8 @@ If
>  .Fa priority
>  includes the
>  .Dv PCATCH
> -flag, signals are checked before and after sleeping, otherwise signals are
> +flag, pending
> +signals are checked before and after sleeping, otherwise signals are
>  not checked.
There, both old and new formulations are strange. The PCATCH flag causes
the signal enqueuing to interrupt sleep, so saying that signals are
checked before and after, although not wrong, is also confusing.

>  If
>  .Dv PCATCH
> @@ -114,17 +115,18 @@ possible, and
>  is returned if the system call should be interrupted by the signal
>  (return
>  .Er EINTR ) .
> -If
> +If the
>  .Dv PBDRY
>  flag is specified in addition to
>  .Dv PCATCH ,
> -then the sleeping thread is not stopped while sleeping upon delivery of
> +then the sleeping thread is not stopped upon delivery of
>  .Dv SIGSTOP
> -or other stop action.
> -Instead, it is waken up, assuming that stop occurs on reaching a stop
> +or other stop action while it is sleeping.
> +Instead, it is woken up, with the assumption
> +that the stop will occur on reaching a stop
>  point when returning to usermode.
> -The flag should be used when sleeping thread owns resources, for instance
> -vnode locks, that should be freed timely.
> +The flag should be used when the sleeping thread owns resources, for instance
> +vnode locks, that should be released in a timely fashion.
>  .Pp
>  The parameter
>  .Fa wmesg
I think the changes are good.


pgph9Hu8JQ94M.pgp
Description: PGP signature