From owner-svn-src-stable-10@FreeBSD.ORG Sun Aug 10 05:58:43 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 898FA93A for ; Sun, 10 Aug 2014 05:58:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 711EC28E1 for ; Sun, 10 Aug 2014 05:58:43 +0000 (UTC) Received: from delphij (uid 1035) (envelope-from delphij@FreeBSD.org) id 2f21 by svn.freebsd.org (DragonFly Mail Agent v0.9+); Sun, 10 Aug 2014 05:58:42 +0000 From: Xin LI Date: Sun, 10 Aug 2014 05:58:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269773 - in stable/10: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/common/zfs sys/cddl/c... X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53e70a12.2f21.44896eca@svn.freebsd.org> X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Aug 2014 05:58:43 -0000 Author: delphij Date: Sun Aug 10 05:58:41 2014 New Revision: 269773 URL: http://svnweb.freebsd.org/changeset/base/269773 Log: MFC r269118: MFV r269010: Import Illumos changes to address the following Illumos issues: 4976 zfs should only avoid writing to a failing non-redundant top-level vdev 4978 ztest fails in get_metaslab_refcount() 4979 extend free space histogram to device and pool 4980 metaslabs should have a fragmentation metric 4981 remove fragmented ops vector from block allocator 4982 space_map object should proactively upgrade when feature is enabled 4984 device selection should use fragmentation metric Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.8 stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool.8 stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c stable/10/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/range_tree.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_debug.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.8 ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Sun Aug 10 03:09:35 2014 (r269772) +++ stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Sun Aug 10 05:58:41 2014 (r269773) @@ -19,7 +19,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 1, 2014 +.Dd July 26, 2014 .Dt ZDB 8 .Os .Sh NAME @@ -27,11 +27,11 @@ .Nd Display zpool debugging and consistency information .Sh SYNOPSIS .Nm -.Op Fl CumdibcsDvhLXFPA +.Op Fl CumdibcsDvhLMXFPA .Op Fl e Op Fl p Ar path... .Op Fl t Ar txg .Op Fl U Ar cache -.Op Fl M Ar inflight I/Os +.Op Fl I Ar inflight I/Os .Op Fl x Ar dumpdir .Ar poolname .Op Ar object ... @@ -42,7 +42,7 @@ .Ar dataset .Op Ar object ... .Nm -.Fl m Op Fl LXFPA +.Fl m Op Fl MLXFPA .Op Fl t Ar txg .Op Fl e Op Fl p Ar path... .Op Fl U Ar cache @@ -155,6 +155,13 @@ By default, verifies that all non-free blocks are referenced, which can be very expensive. .It Fl m Display the offset, spacemap, and free space of each metaslab. +When specified twice, also display information about the on-disk free +space histogram associated with each metaslab. When specified three time, +display the maximum contiguous free space, the in-core free space histogram, +and the percentage of free space in each space map. When specified +four times display every spacemap record. +.It Fl M +Display the offset, spacemap, and free space of each metaslab. When specified twice, also display information about the maximum contiguous free space and the percentage of free space in each space map. When specified three times display every spacemap record. @@ -229,7 +236,7 @@ all metadata on the pool. .It Fl F Attempt to make an unreadable pool readable by trying progressively older transactions. -.It Fl M Ar inflight I/Os +.It Fl I Ar inflight I/Os Limit the number of outstanding checksum I/Os to the specified value. The default value is 200. This option affects the performance of the .Fl c Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Sun Aug 10 03:09:35 2014 (r269772) +++ stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Sun Aug 10 05:58:41 2014 (r269773) @@ -111,11 +111,11 @@ static void usage(void) { (void) fprintf(stderr, - "Usage: %s [-CumdibcsDvhLXFPA] [-t txg] [-e [-p path...]] " - "[-U config] [-M inflight I/Os] [-x dumpdir] poolname [object...]\n" + "Usage: %s [-CumMdibcsDvhLXFPA] [-t txg] [-e [-p path...]] " + "[-U config] [-I inflight I/Os] [-x dumpdir] poolname [object...]\n" " %s [-divPA] [-e -p path...] [-U config] dataset " "[object...]\n" - " %s -m [-LXFPA] [-t txg] [-e [-p path...]] [-U config] " + " %s -mM [-LXFPA] [-t txg] [-e [-p path...]] [-U config] " "poolname [vdev [metaslab...]]\n" " %s -R [-A] [-e [-p path...]] poolname " "vdev:offset:size[:flags]\n" @@ -138,6 +138,7 @@ usage(void) (void) fprintf(stderr, " -h pool history\n"); (void) fprintf(stderr, " -b block statistics\n"); (void) fprintf(stderr, " -m metaslabs\n"); + (void) fprintf(stderr, " -M metaslab groups\n"); (void) fprintf(stderr, " -c checksum all metadata (twice for " "all data) blocks\n"); (void) fprintf(stderr, " -s report stats on zdb's I/O\n"); @@ -168,7 +169,7 @@ usage(void) (void) fprintf(stderr, " -P print numbers in parseable form\n"); (void) fprintf(stderr, " -t -- highest txg to use when " "searching for uberblocks\n"); - (void) fprintf(stderr, " -M -- " + (void) fprintf(stderr, " -I -- " "specify the maximum number of " "checksumming I/Os [default is 200]\n"); (void) fprintf(stderr, "Specify an option more than once (e.g. -bb) " @@ -548,7 +549,7 @@ get_metaslab_refcount(vdev_t *vd) { int refcount = 0; - if (vd->vdev_top == vd) { + if (vd->vdev_top == vd && !vd->vdev_removing) { for (int m = 0; m < vd->vdev_ms_count; m++) { space_map_t *sm = vd->vdev_ms[m]->ms_sm; @@ -686,9 +687,10 @@ dump_metaslab(metaslab_t *msp) * The space map histogram represents free space in chunks * of sm_shift (i.e. bucket 0 refers to 2^sm_shift). */ - (void) printf("\tOn-disk histogram:\n"); + (void) printf("\tOn-disk histogram:\t\tfragmentation %llu\n", + (u_longlong_t)msp->ms_fragmentation); dump_histogram(sm->sm_phys->smp_histogram, - SPACE_MAP_HISTOGRAM_SIZE(sm), sm->sm_shift); + SPACE_MAP_HISTOGRAM_SIZE, sm->sm_shift); } if (dump_opt['d'] > 5 || dump_opt['m'] > 3) { @@ -713,6 +715,47 @@ print_vdev_metaslab_header(vdev_t *vd) } static void +dump_metaslab_groups(spa_t *spa) +{ + vdev_t *rvd = spa->spa_root_vdev; + metaslab_class_t *mc = spa_normal_class(spa); + uint64_t fragmentation; + + metaslab_class_histogram_verify(mc); + + for (int c = 0; c < rvd->vdev_children; c++) { + vdev_t *tvd = rvd->vdev_child[c]; + metaslab_group_t *mg = tvd->vdev_mg; + + if (mg->mg_class != mc) + continue; + + metaslab_group_histogram_verify(mg); + mg->mg_fragmentation = metaslab_group_fragmentation(mg); + + (void) printf("\tvdev %10llu\t\tmetaslabs%5llu\t\t" + "fragmentation", + (u_longlong_t)tvd->vdev_id, + (u_longlong_t)tvd->vdev_ms_count); + if (mg->mg_fragmentation == ZFS_FRAG_INVALID) { + (void) printf("%3s\n", "-"); + } else { + (void) printf("%3llu%%\n", + (u_longlong_t)mg->mg_fragmentation); + } + dump_histogram(mg->mg_histogram, RANGE_TREE_HISTOGRAM_SIZE, 0); + } + + (void) printf("\tpool %s\tfragmentation", spa_name(spa)); + fragmentation = metaslab_class_fragmentation(mc); + if (fragmentation == ZFS_FRAG_INVALID) + (void) printf("\t%3s\n", "-"); + else + (void) printf("\t%3llu%%\n", (u_longlong_t)fragmentation); + dump_histogram(mc->mc_histogram, RANGE_TREE_HISTOGRAM_SIZE, 0); +} + +static void dump_metaslabs(spa_t *spa) { vdev_t *vd, *rvd = spa->spa_root_vdev; @@ -2369,8 +2412,7 @@ zdb_leak(void *arg, uint64_t start, uint } static metaslab_ops_t zdb_metaslab_ops = { - NULL, /* alloc */ - NULL /* fragmented */ + NULL /* alloc */ }; static void @@ -2865,6 +2907,8 @@ dump_zpool(spa_t *spa) if (dump_opt['d'] > 2 || dump_opt['m']) dump_metaslabs(spa); + if (dump_opt['M']) + dump_metaslab_groups(spa); if (dump_opt['d'] || dump_opt['i']) { dump_dir(dp->dp_meta_objset); @@ -3360,7 +3404,7 @@ main(int argc, char **argv) dprintf_setup(&argc, argv); while ((c = getopt(argc, argv, - "bcdhilmM:suCDRSAFLXx:evp:t:U:P")) != -1) { + "bcdhilmMI:suCDRSAFLXx:evp:t:U:P")) != -1) { switch (c) { case 'b': case 'c': @@ -3373,6 +3417,7 @@ main(int argc, char **argv) case 'u': case 'C': case 'D': + case 'M': case 'R': case 'S': dump_opt[c]++; @@ -3386,10 +3431,7 @@ main(int argc, char **argv) case 'P': dump_opt[c]++; break; - case 'v': - verbose++; - break; - case 'M': + case 'I': max_inflight = strtoull(optarg, NULL, 0); if (max_inflight == 0) { (void) fprintf(stderr, "maximum number " @@ -3413,9 +3455,6 @@ main(int argc, char **argv) } searchdirs[nsearch++] = optarg; break; - case 'x': - vn_dumpdir = optarg; - break; case 't': max_txg = strtoull(optarg, NULL, 0); if (max_txg < TXG_INITIAL) { @@ -3427,6 +3466,12 @@ main(int argc, char **argv) case 'U': spa_config_path = optarg; break; + case 'v': + verbose++; + break; + case 'x': + vn_dumpdir = optarg; + break; default: usage(); break; Modified: stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Sun Aug 10 03:09:35 2014 (r269772) +++ stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Sun Aug 10 05:58:41 2014 (r269773) @@ -21,12 +21,12 @@ .\" Copyright (c) 2010, Sun Microsystems, Inc. All Rights Reserved. .\" Copyright 2011, Nexenta Systems, Inc. All Rights Reserved. .\" Copyright (c) 2011, Justin T. Gibbs -.\" Copyright (c) 2012 by Delphix. All Rights Reserved. +.\" Copyright (c) 2013 by Delphix. All Rights Reserved. .\" Copyright (c) 2012, Glen Barber .\" .\" $FreeBSD$ .\" -.Dd July 25, 2014 +.Dd July 26, 2014 .Dt ZPOOL 8 .Os .Sh NAME @@ -543,6 +543,15 @@ For example, a value of 1.76 indicates that 1.76 units of data were stored but only 1 unit of disk space was actually consumed. See .Xr zfs 8 for a description of the deduplication feature. +.It Sy expandsize +Amount of uninitialized space within the pool or device that can be used to +increase the total capacity of the pool. +Uninitialized space consists of +any space on an EFI labeled vdev which has not been brought online +.Pq i.e. zpool online -e . +This space occurs when a LUN is dynamically expanded. +.It Sy fragmentation +The amount of fragmentation in the pool. .It Sy free Number of blocks within the pool that are not allocated. .It Sy freeing @@ -555,13 +564,6 @@ Over time will decrease while .Sy free increases. -.It Sy expandsize -Amount of uninitialized space within the pool or device that can be used to -increase the total capacity of the pool. -Uninitialized space consists of -any space on an EFI labeled vdev which has not been brought online -.Pq i.e. zpool online -e . -This space occurs when a LUN is dynamically expanded. .It Sy guid A unique identifier for the pool. .It Sy health @@ -1408,6 +1410,7 @@ section for a list of valid properties. .Sy size , .Sy used , .Sy available , +.Sy fragmentation , .Sy expandsize , .Sy capacity , .Sy health , @@ -1794,9 +1797,9 @@ is immediately available to any datasets The following command lists all available pools on the system. .Bd -literal -offset 2n .Li # Ic zpool list -NAME SIZE ALLOC FREE EXPANDSZ CAP DEDUP HEALTH ALTROOT -pool 2.70T 473G 2.24T - 17% 1.00x ONLINE - -test 1.98G 89.5K 1.98G - 0% 1.00x ONLINE - +NAME SIZE ALLOC FREE FRAG EXPANDSZ CAP DEDUP HEALTH ALTROOT +pool 2.70T 473G 2.24T 33% - 17% 1.00x ONLINE - +test 1.98G 89.5K 1.98G 48% - 0% 1.00x ONLINE - .Ed .It Sy Example 7 No Listing All Properties for a Pool .Pp @@ -1924,7 +1927,35 @@ subcommand as follows: .Bd -literal -offset 2n .Li # Ic zpool iostat -v pool 5 .Ed -.It Sy Example 15 No Removing a Mirrored Log Device +.It Xo +.Sy Example 15 +Displaying expanded space on a device +.Xc +.Pp +The following command dipslays the detailed information for the +.Em data +pool. +This pool is comprised of a single +.Em raidz +vdev where one of its +devices increased its capacity by 10GB. +In this example, the pool will not +be able to utilized this extra capacity until all the devices under the +.Em raidz +vdev have been expanded. +.Bd -literal -offset 2n +.Li # Ic zpool list -v data +NAME SIZE ALLOC FREE FRAG EXPANDSZ CAP DEDUP HEALTH ALTROOT +data 23.9G 14.6G 9.30G 48% - 61% 1.00x ONLINE - + raidz1 23.9G 14.6G 9.30G 48% - + ada0 - - - - - + ada1 - - - - 10G + ada2 - - - - - +.Ed +.It Xo +.Sy Example 16 +Removing a Mirrored Log Device +.Xc .Pp The following command removes the mirrored log device .Em mirror-2 . @@ -1956,7 +1987,12 @@ is: .Bd -literal -offset 2n .Li # Ic zpool remove tank mirror-2 .Ed -.It Sy Example 16 No Recovering a Faulted Tn ZFS No Pool +.It Xo +.Sy Example 17 +Recovering a Faulted +.Tn ZFS +Pool +.Xc .Pp If a pool is faulted but recoverable, a message indicating this state is provided by Modified: stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Sun Aug 10 03:09:35 2014 (r269772) +++ stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Sun Aug 10 05:58:41 2014 (r269773) @@ -2900,10 +2900,15 @@ print_one_column(zpool_prop_t prop, uint boolean_t fixed; size_t width = zprop_width(prop, &fixed, ZFS_TYPE_POOL); - zfs_nicenum(value, propval, sizeof (propval)); if (prop == ZPOOL_PROP_EXPANDSZ && value == 0) (void) strlcpy(propval, "-", sizeof (propval)); + else if (prop == ZPOOL_PROP_FRAGMENTATION && value == ZFS_FRAG_INVALID) + (void) strlcpy(propval, "-", sizeof (propval)); + else if (prop == ZPOOL_PROP_FRAGMENTATION) + (void) snprintf(propval, sizeof (propval), "%llu%%", value); + else + zfs_nicenum(value, propval, sizeof (propval)); if (scripted) (void) printf("\t%s", propval); @@ -2936,9 +2941,9 @@ print_list_stats(zpool_handle_t *zhp, co /* only toplevel vdevs have capacity stats */ if (vs->vs_space == 0) { if (scripted) - (void) printf("\t-\t-\t-"); + (void) printf("\t-\t-\t-\t-"); else - (void) printf(" - - -"); + (void) printf(" - - - -"); } else { print_one_column(ZPOOL_PROP_SIZE, vs->vs_space, scripted); @@ -2946,6 +2951,8 @@ print_list_stats(zpool_handle_t *zhp, co scripted); print_one_column(ZPOOL_PROP_FREE, vs->vs_space - vs->vs_alloc, scripted); + print_one_column(ZPOOL_PROP_FRAGMENTATION, + vs->vs_fragmentation, scripted); } print_one_column(ZPOOL_PROP_EXPANDSZ, vs->vs_esize, scripted); @@ -3031,8 +3038,8 @@ zpool_do_list(int argc, char **argv) int ret; list_cbdata_t cb = { 0 }; static char default_props[] = - "name,size,allocated,free,expandsize,capacity,dedupratio," - "health,altroot"; + "name,size,allocated,free,fragmentation,expandsize,capacity," + "dedupratio,health,altroot"; char *props = default_props; unsigned long interval = 0, count = 0; zpool_list_t *list; Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Sun Aug 10 03:09:35 2014 (r269772) +++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Sun Aug 10 05:58:41 2014 (r269773) @@ -322,6 +322,14 @@ zpool_get_prop(zpool_handle_t *zhp, zpoo (u_longlong_t)intval); } break; + case ZPOOL_PROP_FRAGMENTATION: + if (intval == UINT64_MAX) { + (void) strlcpy(buf, "-", len); + } else { + (void) snprintf(buf, len, "%llu%%", + (u_longlong_t)intval); + } + break; case ZPOOL_PROP_DEDUPRATIO: (void) snprintf(buf, len, "%llu.%02llux", Modified: stable/10/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c Sun Aug 10 03:09:35 2014 (r269772) +++ stable/10/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c Sun Aug 10 05:58:41 2014 (r269773) @@ -21,7 +21,7 @@ /* * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #include @@ -87,6 +87,8 @@ zpool_prop_init(void) PROP_READONLY, ZFS_TYPE_POOL, "", "ALLOC"); zprop_register_number(ZPOOL_PROP_EXPANDSZ, "expandsize", 0, PROP_READONLY, ZFS_TYPE_POOL, "", "EXPANDSZ"); + zprop_register_number(ZPOOL_PROP_FRAGMENTATION, "fragmentation", 0, + PROP_READONLY, ZFS_TYPE_POOL, "", "FRAG"); zprop_register_number(ZPOOL_PROP_CAPACITY, "capacity", 0, PROP_READONLY, ZFS_TYPE_POOL, "", "CAP"); zprop_register_number(ZPOOL_PROP_GUID, "guid", 0, PROP_READONLY, Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Sun Aug 10 03:09:35 2014 (r269772) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Sun Aug 10 05:58:41 2014 (r269773) @@ -32,6 +32,7 @@ #include #include #include +#include SYSCTL_DECL(_vfs_zfs); SYSCTL_NODE(_vfs_zfs, OID_AUTO, metaslab, CTLFLAG_RW, 0, "ZFS metaslab"); @@ -91,7 +92,7 @@ int zfs_metaslab_condense_block_threshol /* * The zfs_mg_noalloc_threshold defines which metaslab groups should * be eligible for allocation. The value is defined as a percentage of - * a free space. Metaslab groups that have more free space than + * free space. Metaslab groups that have more free space than * zfs_mg_noalloc_threshold are always eligible for allocations. Once * a metaslab group's free space is less than or equal to the * zfs_mg_noalloc_threshold the allocator will avoid allocating to that @@ -109,6 +110,23 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, mg_noallo " to make it eligible for allocation"); /* + * Metaslab groups are considered eligible for allocations if their + * fragmenation metric (measured as a percentage) is less than or equal to + * zfs_mg_fragmentation_threshold. If a metaslab group exceeds this threshold + * then it will be skipped unless all metaslab groups within the metaslab + * class have also crossed this threshold. + */ +int zfs_mg_fragmentation_threshold = 85; + +/* + * Allow metaslabs to keep their active state as long as their fragmentation + * percentage is less than or equal to zfs_metaslab_fragmentation_threshold. An + * active metaslab that exceeds this threshold will no longer keep its active + * status allowing better metaslabs to be selected. + */ +int zfs_metaslab_fragmentation_threshold = 70; + +/* * When set will load all metaslabs when pool is first opened. */ int metaslab_debug_load = 0; @@ -183,14 +201,6 @@ SYSCTL_INT(_vfs_zfs_metaslab, OID_AUTO, "Number of TXGs that an unused metaslab can be kept in memory"); /* - * Should we be willing to write data to degraded vdevs? - */ -boolean_t zfs_write_to_degraded = B_FALSE; -SYSCTL_INT(_vfs_zfs, OID_AUTO, write_to_degraded, CTLFLAG_RWTUN, - &zfs_write_to_degraded, 0, "Allow writing data to degraded vdevs"); -TUNABLE_INT("vfs.zfs.write_to_degraded", &zfs_write_to_degraded); - -/* * Max number of metaslabs per group to preload. */ int metaslab_preload_limit = SPA_DVAS_PER_BP; @@ -209,15 +219,36 @@ SYSCTL_INT(_vfs_zfs_metaslab, OID_AUTO, "Max number of metaslabs per group to preload"); /* - * Enable/disable additional weight factor for each metaslab. + * Enable/disable fragmentation weighting on metaslabs. + */ +boolean_t metaslab_fragmentation_factor_enabled = B_TRUE; +TUNABLE_INT("vfs.zfs.metaslab_fragmentation_factor_enabled", + &metaslab_fragmentation_factor_enabled); +SYSCTL_INT(_vfs_zfs_metaslab, OID_AUTO, fragmentation_factor_enabled, CTLFLAG_RWTUN, + &metaslab_fragmentation_factor_enabled, 0, + "Enable fragmentation weighting on metaslabs"); + +/* + * Enable/disable lba weighting (i.e. outer tracks are given preference). + */ +boolean_t metaslab_lba_weighting_enabled = B_TRUE; +TUNABLE_INT("vfs.zfs.metaslab.lba_weighting_enabled", + &metaslab_lba_weighting_enabled); +SYSCTL_INT(_vfs_zfs_metaslab, OID_AUTO, lba_weighting_enabled, CTLFLAG_RWTUN, + &metaslab_lba_weighting_enabled, 0, + "Enable LBA weighting (i.e. outer tracks are given preference)"); + +/* + * Enable/disable metaslab group biasing. */ -boolean_t metaslab_weight_factor_enable = B_FALSE; -TUNABLE_INT("vfs.zfs.metaslab.weight_factor_enable", - &metaslab_weight_factor_enable); -SYSCTL_INT(_vfs_zfs_metaslab, OID_AUTO, weight_factor_enable, CTLFLAG_RWTUN, - &metaslab_weight_factor_enable, 0, - "Enable additional weight factor for each metaslab"); +boolean_t metaslab_bias_enabled = B_TRUE; +TUNABLE_INT("vfs.zfs.metaslab.bias_enabled", + &metaslab_bias_enabled); +SYSCTL_INT(_vfs_zfs_metaslab, OID_AUTO, bias_enabled, CTLFLAG_RWTUN, + &metaslab_bias_enabled, 0, + "Enable metaslab group biasing"); +static uint64_t metaslab_fragmentation(metaslab_t *); /* * ========================================================================== @@ -337,6 +368,121 @@ metaslab_class_get_minblocksize(metaslab return (mc->mc_minblocksize); } +void +metaslab_class_histogram_verify(metaslab_class_t *mc) +{ + vdev_t *rvd = mc->mc_spa->spa_root_vdev; + uint64_t *mc_hist; + int i; + + if ((zfs_flags & ZFS_DEBUG_HISTOGRAM_VERIFY) == 0) + return; + + mc_hist = kmem_zalloc(sizeof (uint64_t) * RANGE_TREE_HISTOGRAM_SIZE, + KM_SLEEP); + + for (int c = 0; c < rvd->vdev_children; c++) { + vdev_t *tvd = rvd->vdev_child[c]; + metaslab_group_t *mg = tvd->vdev_mg; + + /* + * Skip any holes, uninitialized top-levels, or + * vdevs that are not in this metalab class. + */ + if (tvd->vdev_ishole || tvd->vdev_ms_shift == 0 || + mg->mg_class != mc) { + continue; + } + + for (i = 0; i < RANGE_TREE_HISTOGRAM_SIZE; i++) + mc_hist[i] += mg->mg_histogram[i]; + } + + for (i = 0; i < RANGE_TREE_HISTOGRAM_SIZE; i++) + VERIFY3U(mc_hist[i], ==, mc->mc_histogram[i]); + + kmem_free(mc_hist, sizeof (uint64_t) * RANGE_TREE_HISTOGRAM_SIZE); +} + +/* + * Calculate the metaslab class's fragmentation metric. The metric + * is weighted based on the space contribution of each metaslab group. + * The return value will be a number between 0 and 100 (inclusive), or + * ZFS_FRAG_INVALID if the metric has not been set. See comment above the + * zfs_frag_table for more information about the metric. + */ +uint64_t +metaslab_class_fragmentation(metaslab_class_t *mc) +{ + vdev_t *rvd = mc->mc_spa->spa_root_vdev; + uint64_t fragmentation = 0; + + spa_config_enter(mc->mc_spa, SCL_VDEV, FTAG, RW_READER); + + for (int c = 0; c < rvd->vdev_children; c++) { + vdev_t *tvd = rvd->vdev_child[c]; + metaslab_group_t *mg = tvd->vdev_mg; + + /* + * Skip any holes, uninitialized top-levels, or + * vdevs that are not in this metalab class. + */ + if (tvd->vdev_ishole || tvd->vdev_ms_shift == 0 || + mg->mg_class != mc) { + continue; + } + + /* + * If a metaslab group does not contain a fragmentation + * metric then just bail out. + */ + if (mg->mg_fragmentation == ZFS_FRAG_INVALID) { + spa_config_exit(mc->mc_spa, SCL_VDEV, FTAG); + return (ZFS_FRAG_INVALID); + } + + /* + * Determine how much this metaslab_group is contributing + * to the overall pool fragmentation metric. + */ + fragmentation += mg->mg_fragmentation * + metaslab_group_get_space(mg); + } + fragmentation /= metaslab_class_get_space(mc); + + ASSERT3U(fragmentation, <=, 100); + spa_config_exit(mc->mc_spa, SCL_VDEV, FTAG); + return (fragmentation); +} + +/* + * Calculate the amount of expandable space that is available in + * this metaslab class. If a device is expanded then its expandable + * space will be the amount of allocatable space that is currently not + * part of this metaslab class. + */ +uint64_t +metaslab_class_expandable_space(metaslab_class_t *mc) +{ + vdev_t *rvd = mc->mc_spa->spa_root_vdev; + uint64_t space = 0; + + spa_config_enter(mc->mc_spa, SCL_VDEV, FTAG, RW_READER); + for (int c = 0; c < rvd->vdev_children; c++) { + vdev_t *tvd = rvd->vdev_child[c]; + metaslab_group_t *mg = tvd->vdev_mg; + + if (tvd->vdev_ishole || tvd->vdev_ms_shift == 0 || + mg->mg_class != mc) { + continue; + } + + space += tvd->vdev_max_asize - tvd->vdev_asize; + } + spa_config_exit(mc->mc_spa, SCL_VDEV, FTAG); + return (space); +} + /* * ========================================================================== * Metaslab groups @@ -389,7 +535,15 @@ metaslab_group_alloc_update(metaslab_gro mg->mg_free_capacity = ((vs->vs_space - vs->vs_alloc) * 100) / (vs->vs_space + 1); - mg->mg_allocatable = (mg->mg_free_capacity > zfs_mg_noalloc_threshold); + /* + * A metaslab group is considered allocatable if it has plenty + * of free space or is not heavily fragmented. We only take + * fragmentation into account if the metaslab group has a valid + * fragmentation metric (i.e. a value between 0 and 100). + */ + mg->mg_allocatable = (mg->mg_free_capacity > zfs_mg_noalloc_threshold && + (mg->mg_fragmentation == ZFS_FRAG_INVALID || + mg->mg_fragmentation <= zfs_mg_fragmentation_threshold)); /* * The mc_alloc_groups maintains a count of the number of @@ -410,6 +564,7 @@ metaslab_group_alloc_update(metaslab_gro mc->mc_alloc_groups--; else if (!was_allocatable && mg->mg_allocatable) mc->mc_alloc_groups++; + mutex_exit(&mg->mg_lock); } @@ -500,6 +655,7 @@ metaslab_group_passivate(metaslab_group_ } taskq_wait(mg->mg_taskq); + metaslab_group_alloc_update(mg); mgprev = mg->mg_prev; mgnext = mg->mg_next; @@ -517,20 +673,113 @@ metaslab_group_passivate(metaslab_group_ metaslab_class_minblocksize_update(mc); } +uint64_t +metaslab_group_get_space(metaslab_group_t *mg) +{ + return ((1ULL << mg->mg_vd->vdev_ms_shift) * mg->mg_vd->vdev_ms_count); +} + +void +metaslab_group_histogram_verify(metaslab_group_t *mg) +{ + uint64_t *mg_hist; + vdev_t *vd = mg->mg_vd; + uint64_t ashift = vd->vdev_ashift; + int i; + + if ((zfs_flags & ZFS_DEBUG_HISTOGRAM_VERIFY) == 0) + return; + + mg_hist = kmem_zalloc(sizeof (uint64_t) * RANGE_TREE_HISTOGRAM_SIZE, + KM_SLEEP); + + ASSERT3U(RANGE_TREE_HISTOGRAM_SIZE, >=, + SPACE_MAP_HISTOGRAM_SIZE + ashift); + + for (int m = 0; m < vd->vdev_ms_count; m++) { + metaslab_t *msp = vd->vdev_ms[m]; + + if (msp->ms_sm == NULL) + continue; + + for (i = 0; i < SPACE_MAP_HISTOGRAM_SIZE; i++) + mg_hist[i + ashift] += + msp->ms_sm->sm_phys->smp_histogram[i]; + } + + for (i = 0; i < RANGE_TREE_HISTOGRAM_SIZE; i ++) + VERIFY3U(mg_hist[i], ==, mg->mg_histogram[i]); + + kmem_free(mg_hist, sizeof (uint64_t) * RANGE_TREE_HISTOGRAM_SIZE); +} + static void -metaslab_group_add(metaslab_group_t *mg, metaslab_t *msp) +metaslab_group_histogram_add(metaslab_group_t *mg, metaslab_t *msp) { + metaslab_class_t *mc = mg->mg_class; + uint64_t ashift = mg->mg_vd->vdev_ashift; + + ASSERT(MUTEX_HELD(&msp->ms_lock)); + if (msp->ms_sm == NULL) + return; + mutex_enter(&mg->mg_lock); + for (int i = 0; i < SPACE_MAP_HISTOGRAM_SIZE; i++) { + mg->mg_histogram[i + ashift] += + msp->ms_sm->sm_phys->smp_histogram[i]; + mc->mc_histogram[i + ashift] += + msp->ms_sm->sm_phys->smp_histogram[i]; + } + mutex_exit(&mg->mg_lock); +} + +void +metaslab_group_histogram_remove(metaslab_group_t *mg, metaslab_t *msp) +{ + metaslab_class_t *mc = mg->mg_class; + uint64_t ashift = mg->mg_vd->vdev_ashift; + + ASSERT(MUTEX_HELD(&msp->ms_lock)); + if (msp->ms_sm == NULL) + return; + + mutex_enter(&mg->mg_lock); + for (int i = 0; i < SPACE_MAP_HISTOGRAM_SIZE; i++) { + ASSERT3U(mg->mg_histogram[i + ashift], >=, + msp->ms_sm->sm_phys->smp_histogram[i]); + ASSERT3U(mc->mc_histogram[i + ashift], >=, + msp->ms_sm->sm_phys->smp_histogram[i]); + + mg->mg_histogram[i + ashift] -= + msp->ms_sm->sm_phys->smp_histogram[i]; + mc->mc_histogram[i + ashift] -= + msp->ms_sm->sm_phys->smp_histogram[i]; + } + mutex_exit(&mg->mg_lock); +} + +static void +metaslab_group_add(metaslab_group_t *mg, metaslab_t *msp) +{ ASSERT(msp->ms_group == NULL); + mutex_enter(&mg->mg_lock); msp->ms_group = mg; msp->ms_weight = 0; avl_add(&mg->mg_metaslab_tree, msp); mutex_exit(&mg->mg_lock); + + mutex_enter(&msp->ms_lock); + metaslab_group_histogram_add(mg, msp); + mutex_exit(&msp->ms_lock); } static void metaslab_group_remove(metaslab_group_t *mg, metaslab_t *msp) { + mutex_enter(&msp->ms_lock); + metaslab_group_histogram_remove(mg, msp); + mutex_exit(&msp->ms_lock); + mutex_enter(&mg->mg_lock); ASSERT(msp->ms_group == mg); avl_remove(&mg->mg_metaslab_tree, msp); @@ -543,9 +792,9 @@ metaslab_group_sort(metaslab_group_t *mg { /* * Although in principle the weight can be any value, in - * practice we do not use values in the range [1, 510]. + * practice we do not use values in the range [1, 511]. */ - ASSERT(weight >= SPA_MINBLOCKSIZE-1 || weight == 0); + ASSERT(weight >= SPA_MINBLOCKSIZE || weight == 0); ASSERT(MUTEX_HELD(&msp->ms_lock)); mutex_enter(&mg->mg_lock); @@ -557,9 +806,42 @@ metaslab_group_sort(metaslab_group_t *mg } /* + * Calculate the fragmentation for a given metaslab group. We can use + * a simple average here since all metaslabs within the group must have + * the same size. The return value will be a value between 0 and 100 + * (inclusive), or ZFS_FRAG_INVALID if less than half of the metaslab in this + * group have a fragmentation metric. + */ +uint64_t +metaslab_group_fragmentation(metaslab_group_t *mg) +{ + vdev_t *vd = mg->mg_vd; + uint64_t fragmentation = 0; + uint64_t valid_ms = 0; + + for (int m = 0; m < vd->vdev_ms_count; m++) { + metaslab_t *msp = vd->vdev_ms[m]; + + if (msp->ms_fragmentation == ZFS_FRAG_INVALID) + continue; + + valid_ms++; + fragmentation += msp->ms_fragmentation; + } + + if (valid_ms <= vd->vdev_ms_count / 2) + return (ZFS_FRAG_INVALID); + + fragmentation /= valid_ms; + ASSERT3U(fragmentation, <=, 100); + return (fragmentation); +} + +/* * Determine if a given metaslab group should skip allocations. A metaslab - * group should avoid allocations if its used capacity has crossed the - * zfs_mg_noalloc_threshold and there is at least one metaslab group + * group should avoid allocations if its free capacity is less than the + * zfs_mg_noalloc_threshold or its fragmentation metric is greater than + * zfs_mg_fragmentation_threshold and there is at least one metaslab group * that can still handle allocations. */ static boolean_t @@ -570,12 +852,19 @@ metaslab_group_allocatable(metaslab_grou metaslab_class_t *mc = mg->mg_class; /* - * A metaslab group is considered allocatable if its free capacity - * is greater than the set value of zfs_mg_noalloc_threshold, it's - * associated with a slog, or there are no other metaslab groups - * with free capacity greater than zfs_mg_noalloc_threshold. - */ - return (mg->mg_free_capacity > zfs_mg_noalloc_threshold || + * We use two key metrics to determine if a metaslab group is + * considered allocatable -- free space and fragmentation. If + * the free space is greater than the free space threshold and + * the fragmentation is less than the fragmentation threshold then + * consider the group allocatable. There are two case when we will + * not consider these key metrics. The first is if the group is + * associated with a slog device and the second is if all groups + * in this metaslab class have already been consider ineligible + * for allocations. + */ + return ((mg->mg_free_capacity > zfs_mg_noalloc_threshold && + (mg->mg_fragmentation == ZFS_FRAG_INVALID || + mg->mg_fragmentation <= zfs_mg_fragmentation_threshold)) || mc != spa_normal_class(spa) || mc->mc_alloc_groups == 0); } @@ -799,16 +1088,8 @@ metaslab_ff_alloc(metaslab_t *msp, uint6 return (metaslab_block_picker(t, cursor, size, align)); } -/* ARGSUSED */ -static boolean_t -metaslab_ff_fragmented(metaslab_t *msp) -{ - return (B_TRUE); -} - static metaslab_ops_t metaslab_ff_ops = { - metaslab_ff_alloc, - metaslab_ff_fragmented + metaslab_ff_alloc }; /* @@ -855,23 +1136,8 @@ metaslab_df_alloc(metaslab_t *msp, uint6 return (metaslab_block_picker(t, cursor, size, 1ULL)); } -static boolean_t -metaslab_df_fragmented(metaslab_t *msp) -{ - range_tree_t *rt = msp->ms_tree; - uint64_t max_size = metaslab_block_maxsize(msp); - int free_pct = range_tree_space(rt) * 100 / msp->ms_size; - - if (max_size >= metaslab_df_alloc_threshold && - free_pct >= metaslab_df_free_pct) - return (B_FALSE); - - return (B_TRUE); -} - static metaslab_ops_t metaslab_df_ops = { - metaslab_df_alloc, - metaslab_df_fragmented + metaslab_df_alloc }; /* @@ -914,15 +1180,8 @@ metaslab_cf_alloc(metaslab_t *msp, uint6 return (offset); } -static boolean_t -metaslab_cf_fragmented(metaslab_t *msp) -{ - return (metaslab_block_maxsize(msp) < metaslab_min_alloc_size); -} - static metaslab_ops_t metaslab_cf_ops = { - metaslab_cf_alloc, - metaslab_cf_fragmented + metaslab_cf_alloc }; /* @@ -979,16 +1238,8 @@ metaslab_ndf_alloc(metaslab_t *msp, uint return (-1ULL); } -static boolean_t -metaslab_ndf_fragmented(metaslab_t *msp) -{ - return (metaslab_block_maxsize(msp) <= - (metaslab_min_alloc_size << metaslab_ndf_clump_shift)); -} - static metaslab_ops_t metaslab_ndf_ops = { - metaslab_ndf_alloc, - metaslab_ndf_fragmented + metaslab_ndf_alloc }; metaslab_ops_t *zfs_metaslab_ops = &metaslab_df_ops; @@ -1090,6 +1341,7 @@ metaslab_init(metaslab_group_t *mg, uint msp->ms_tree = range_tree_create(&metaslab_rt_ops, msp, &msp->ms_lock); metaslab_group_add(mg, msp); + msp->ms_fragmentation = metaslab_fragmentation(msp); msp->ms_ops = mg->mg_class->mc_ops; /* @@ -1155,69 +1407,113 @@ metaslab_fini(metaslab_t *msp) kmem_free(msp, sizeof (metaslab_t)); } +#define FRAGMENTATION_TABLE_SIZE 17 + /* - * Apply a weighting factor based on the histogram information for this - * metaslab. The current weighting factor is somewhat arbitrary and requires - * additional investigation. The implementation provides a measure of - * "weighted" free space and gives a higher weighting for larger contiguous - * regions. The weighting factor is determined by counting the number of - * sm_shift sectors that exist in each region represented by the histogram. - * That value is then multiplied by the power of 2 exponent and the sm_shift - * value. + * This table defines a segment size based fragmentation metric that will + * allow each metaslab to derive its own fragmentation value. This is done + * by calculating the space in each bucket of the spacemap histogram and + * multiplying that by the fragmetation metric in this table. Doing + * this for all buckets and dividing it by the total amount of free *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@FreeBSD.ORG Sun Aug 10 06:10:22 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4DB17CBD for ; Sun, 10 Aug 2014 06:10:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 370002A65 for ; Sun, 10 Aug 2014 06:10:22 +0000 (UTC) Received: from delphij (uid 1035) (envelope-from delphij@FreeBSD.org) id 2908 by svn.freebsd.org (DragonFly Mail Agent v0.9+); Sun, 10 Aug 2014 06:10:22 +0000 From: Xin LI Date: Sun, 10 Aug 2014 06:10:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269774 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53e70cce.2908.3ddc718d@svn.freebsd.org> X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Aug 2014 06:10:22 -0000 Author: delphij Date: Sun Aug 10 06:10:21 2014 New Revision: 269774 URL: http://svnweb.freebsd.org/changeset/base/269774 Log: MFC r269138: Add two sysctls for newly added tunables. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Sun Aug 10 05:58:41 2014 (r269773) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Sun Aug 10 06:10:21 2014 (r269774) @@ -117,6 +117,12 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, mg_noallo * class have also crossed this threshold. */ int zfs_mg_fragmentation_threshold = 85; +TUNABLE_INT("vfs.zfs.mg_fragmentation_threshold", &zfs_mg_fragmentation_threshold); +SYSCTL_INT(_vfs_zfs, OID_AUTO, mg_fragmentation_threshold, CTLFLAG_RWTUN, + &zfs_mg_fragmentation_threshold, 0, + "Percentage of metaslab group size that should be considered " + "eligible for allocations unless all metaslab groups within the metaslab class " + "have also crossed this threshold"); /* * Allow metaslabs to keep their active state as long as their fragmentation @@ -125,6 +131,11 @@ int zfs_mg_fragmentation_threshold = 85; * status allowing better metaslabs to be selected. */ int zfs_metaslab_fragmentation_threshold = 70; +TUNABLE_INT("vfs.zfs.metaslab.fragmentation_threshold", + &zfs_metaslab_fragmentation_threshold); +SYSCTL_INT(_vfs_zfs_metaslab, OID_AUTO, fragmentation_threshold, CTLFLAG_RWTUN, + &zfs_metaslab_fragmentation_threshold, 0, + "Maximum percentage of metaslab fragmentation level to keep their active state"); /* * When set will load all metaslabs when pool is first opened. From owner-svn-src-stable-10@FreeBSD.ORG Sun Aug 10 21:45:58 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E2C0ED4D for ; Sun, 10 Aug 2014 21:45:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BE18823D8 for ; Sun, 10 Aug 2014 21:45:58 +0000 (UTC) Received: from sbruno (uid 1179) (envelope-from sbruno@FreeBSD.org) id 225d by svn.freebsd.org (DragonFly Mail Agent v0.9+); Sun, 10 Aug 2014 21:45:58 +0000 From: Sean Bruno Date: Sun, 10 Aug 2014 21:45:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269790 - stable/10/sys/dev/drm2/radeon X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53e7e816.225d.2dfec8dd@svn.freebsd.org> X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Aug 2014 21:45:59 -0000 Author: sbruno Date: Sun Aug 10 21:45:58 2014 New Revision: 269790 URL: http://svnweb.freebsd.org/changeset/base/269790 Log: MFC r268954 Merge change from upstream linux kernel submitted by OpenBSD: drm/radeon: fix-up some float to fixed conversion thinkos Remove #ifdef DUMBBELL_WIP in favor of upstream fix. Modified: stable/10/sys/dev/drm2/radeon/rs690.c stable/10/sys/dev/drm2/radeon/rv515.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/drm2/radeon/rs690.c ============================================================================== --- stable/10/sys/dev/drm2/radeon/rs690.c Sun Aug 10 21:17:19 2014 (r269789) +++ stable/10/sys/dev/drm2/radeon/rs690.c Sun Aug 10 21:45:58 2014 (r269790) @@ -308,12 +308,11 @@ static void rs690_crtc_bandwidth_compute if (rdev->pm.max_bandwidth.full > rdev->pm.sideport_bandwidth.full && rdev->pm.sideport_bandwidth.full) rdev->pm.max_bandwidth = rdev->pm.sideport_bandwidth; -#ifdef DUMBBELL_WIP - read_delay_latency.full = dfixed_const(370 * 800 * 1000); -#endif /* DUMBBELL_WIP */ - read_delay_latency.full = UINT_MAX; - read_delay_latency.full = dfixed_div(read_delay_latency, - rdev->pm.igp_sideport_mclk); + read_delay_latency.full = dfixed_const(370 * 800); + a.full = dfixed_const(1000); + b.full = dfixed_div(rdev->pm.igp_sideport_mclk, a); + read_delay_latency.full = dfixed_div(read_delay_latency, b); + read_delay_latency.full = dfixed_mul(read_delay_latency, a); } else { if (rdev->pm.max_bandwidth.full > rdev->pm.k8_bandwidth.full && rdev->pm.k8_bandwidth.full) @@ -488,14 +487,10 @@ void rs690_bandwidth_update(struct radeo } if (wm0.priority_mark.full > priority_mark02.full) priority_mark02.full = wm0.priority_mark.full; - if (dfixed_trunc(priority_mark02) < 0) - priority_mark02.full = 0; if (wm0.priority_mark_max.full > priority_mark02.full) priority_mark02.full = wm0.priority_mark_max.full; if (wm1.priority_mark.full > priority_mark12.full) priority_mark12.full = wm1.priority_mark.full; - if (dfixed_trunc(priority_mark12) < 0) - priority_mark12.full = 0; if (wm1.priority_mark_max.full > priority_mark12.full) priority_mark12.full = wm1.priority_mark_max.full; d1mode_priority_a_cnt = dfixed_trunc(priority_mark02); @@ -526,8 +521,6 @@ void rs690_bandwidth_update(struct radeo } if (wm0.priority_mark.full > priority_mark02.full) priority_mark02.full = wm0.priority_mark.full; - if (dfixed_trunc(priority_mark02) < 0) - priority_mark02.full = 0; if (wm0.priority_mark_max.full > priority_mark02.full) priority_mark02.full = wm0.priority_mark_max.full; d1mode_priority_a_cnt = dfixed_trunc(priority_mark02); @@ -555,8 +548,6 @@ void rs690_bandwidth_update(struct radeo } if (wm1.priority_mark.full > priority_mark12.full) priority_mark12.full = wm1.priority_mark.full; - if (dfixed_trunc(priority_mark12) < 0) - priority_mark12.full = 0; if (wm1.priority_mark_max.full > priority_mark12.full) priority_mark12.full = wm1.priority_mark_max.full; d2mode_priority_a_cnt = dfixed_trunc(priority_mark12); Modified: stable/10/sys/dev/drm2/radeon/rv515.c ============================================================================== --- stable/10/sys/dev/drm2/radeon/rv515.c Sun Aug 10 21:17:19 2014 (r269789) +++ stable/10/sys/dev/drm2/radeon/rv515.c Sun Aug 10 21:45:58 2014 (r269790) @@ -1087,14 +1087,10 @@ void rv515_bandwidth_avivo_update(struct } if (wm0.priority_mark.full > priority_mark02.full) priority_mark02.full = wm0.priority_mark.full; - if (dfixed_trunc(priority_mark02) < 0) - priority_mark02.full = 0; if (wm0.priority_mark_max.full > priority_mark02.full) priority_mark02.full = wm0.priority_mark_max.full; if (wm1.priority_mark.full > priority_mark12.full) priority_mark12.full = wm1.priority_mark.full; - if (dfixed_trunc(priority_mark12) < 0) - priority_mark12.full = 0; if (wm1.priority_mark_max.full > priority_mark12.full) priority_mark12.full = wm1.priority_mark_max.full; d1mode_priority_a_cnt = dfixed_trunc(priority_mark02); @@ -1125,8 +1121,6 @@ void rv515_bandwidth_avivo_update(struct } if (wm0.priority_mark.full > priority_mark02.full) priority_mark02.full = wm0.priority_mark.full; - if (dfixed_trunc(priority_mark02) < 0) - priority_mark02.full = 0; if (wm0.priority_mark_max.full > priority_mark02.full) priority_mark02.full = wm0.priority_mark_max.full; d1mode_priority_a_cnt = dfixed_trunc(priority_mark02); @@ -1154,8 +1148,6 @@ void rv515_bandwidth_avivo_update(struct } if (wm1.priority_mark.full > priority_mark12.full) priority_mark12.full = wm1.priority_mark.full; - if (dfixed_trunc(priority_mark12) < 0) - priority_mark12.full = 0; if (wm1.priority_mark_max.full > priority_mark12.full) priority_mark12.full = wm1.priority_mark_max.full; d2mode_priority_a_cnt = dfixed_trunc(priority_mark12); From owner-svn-src-stable-10@FreeBSD.ORG Sun Aug 10 22:26:31 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4656EBD8 for ; Sun, 10 Aug 2014 22:26:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 33EEF2721 for ; Sun, 10 Aug 2014 22:26:31 +0000 (UTC) Received: from ian (uid 1311) (envelope-from ian@FreeBSD.org) id 2402 by svn.freebsd.org (DragonFly Mail Agent v0.9+); Sun, 10 Aug 2014 22:26:29 +0000 From: Ian Lepore Date: Sun, 10 Aug 2014 22:26:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269792 - in stable/10: contrib/libstdc++/libsupc++ lib/libc lib/libc/arm lib/libc/arm/aeabi sys/arm/include sys/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53e7f196.2402.5912252@svn.freebsd.org> X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Aug 2014 22:26:31 -0000 Author: ian Date: Sun Aug 10 22:26:29 2014 New Revision: 269792 URL: http://svnweb.freebsd.org/changeset/base/269792 Log: MFC r268993, r268893, r268994, plus partial r264070, r264082 Fix C++ exception handling for ARM EABI. Just the part of r264070 that creates the FBSD_1.4 namespace in libc is hand-applied, and then r264082 which creates the Versions.def entry is MFC'd. Added: stable/10/lib/libc/arm/aeabi/aeabi_unwind_exidx.c - copied unchanged from r268893, head/lib/libc/arm/aeabi/aeabi_unwind_exidx.c Modified: stable/10/contrib/libstdc++/libsupc++/unwind-cxx.h stable/10/lib/libc/Versions.def stable/10/lib/libc/arm/Symbol.map stable/10/lib/libc/arm/aeabi/Makefile.inc stable/10/sys/arm/include/elf.h stable/10/sys/sys/link_elf.h Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/libstdc++/libsupc++/unwind-cxx.h ============================================================================== --- stable/10/contrib/libstdc++/libsupc++/unwind-cxx.h Sun Aug 10 22:24:14 2014 (r269791) +++ stable/10/contrib/libstdc++/libsupc++/unwind-cxx.h Sun Aug 10 22:26:29 2014 (r269792) @@ -142,9 +142,9 @@ typedef enum { ctm_succeeded = 1, ctm_succeeded_with_ptr_to_base = 2 } __cxa_type_match_result; -extern "C" bool __cxa_type_match(_Unwind_Exception*, const std::type_info*, +extern "C" __cxa_type_match_result __cxa_type_match(_Unwind_Exception*, const std::type_info*, bool, void**); -extern "C" void __cxa_begin_cleanup (_Unwind_Exception*); +extern "C" bool __cxa_begin_cleanup (_Unwind_Exception*); extern "C" void __cxa_end_cleanup (void); #endif Modified: stable/10/lib/libc/Versions.def ============================================================================== --- stable/10/lib/libc/Versions.def Sun Aug 10 22:24:14 2014 (r269791) +++ stable/10/lib/libc/Versions.def Sun Aug 10 22:26:29 2014 (r269792) @@ -23,6 +23,11 @@ FBSD_1.2 { FBSD_1.3 { } FBSD_1.2; +# This version was first added to 11.0-current. +FBSD_1.4 { +} FBSD_1.3; + + # This is our private namespace. Any global interfaces that are # strictly for use only by other FreeBSD applications and libraries # are listed here. We use a separate namespace so we can write @@ -30,4 +35,4 @@ FBSD_1.3 { # # Please do NOT increment the version of this namespace. FBSDprivate_1.0 { -} FBSD_1.3; +} FBSD_1.4; Modified: stable/10/lib/libc/arm/Symbol.map ============================================================================== --- stable/10/lib/libc/arm/Symbol.map Sun Aug 10 22:24:14 2014 (r269791) +++ stable/10/lib/libc/arm/Symbol.map Sun Aug 10 22:26:29 2014 (r269792) @@ -37,6 +37,11 @@ FBSD_1.3 { __flt_rounds; }; +FBSD_1.4 { + __gnu_Unwind_Find_exidx; + dl_unwind_find_exidx; +}; + FBSDprivate_1.0 { /* PSEUDO syscalls */ __sys_getlogin; Modified: stable/10/lib/libc/arm/aeabi/Makefile.inc ============================================================================== --- stable/10/lib/libc/arm/aeabi/Makefile.inc Sun Aug 10 22:24:14 2014 (r269791) +++ stable/10/lib/libc/arm/aeabi/Makefile.inc Sun Aug 10 22:26:29 2014 (r269792) @@ -5,7 +5,8 @@ SRCS+= aeabi_atexit.c \ aeabi_double.c \ aeabi_float.c \ - aeabi_unwind_cpp.c + aeabi_unwind_cpp.c \ + aeabi_unwind_exidx.c .if ${MACHINE_ARCH:Marmv6*} SRCS+= aeabi_vfp_double.S \ aeabi_vfp_float.S Copied: stable/10/lib/libc/arm/aeabi/aeabi_unwind_exidx.c (from r268893, head/lib/libc/arm/aeabi/aeabi_unwind_exidx.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libc/arm/aeabi/aeabi_unwind_exidx.c Sun Aug 10 22:26:29 2014 (r269792, copy of r268893, head/lib/libc/arm/aeabi/aeabi_unwind_exidx.c) @@ -0,0 +1,104 @@ +/*- + * Copyright (c) 2014 Ian Lepore + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +/* + * ARM EABI unwind helper. + * + * This finds the exidx section address and size associated with a given code + * address. There are separate implementations for static and dynamic code. + * + * GCC expects this function to exist as __gnu_Unwind_Find_exidx(), clang and + * BSD tools expect it to be dl_unwind_find_exidx(). Both have the same API, so + * we set up an alias for GCC. + */ +__strong_reference(dl_unwind_find_exidx, __gnu_Unwind_Find_exidx); + +/* + * Each entry in the exidx section is a pair of 32-bit words. We don't + * interpret the contents of the entries here; this typedef is just a local + * convenience for using sizeof() and doing pointer math. + */ +typedef struct exidx_entry { + uint32_t data[2]; +} exidx_entry; + +#ifdef __PIC__ + +/* + * Unwind helper for dynamically linked code. + * + * This finds the shared object that contains the given address, and returns the + * address of the exidx section in that shared object along with the number of + * entries in that section, or NULL if it wasn't found. + */ +void * +dl_unwind_find_exidx(const void *pc, int *pcount) +{ + const Elf_Phdr *hdr; + struct dl_phdr_info info; + int i; + + if (_rtld_addr_phdr(pc, &info)) { + hdr = info.dlpi_phdr; + for (i = 0; i < info.dlpi_phnum; i++, hdr++) { + if (hdr->p_type == PT_ARM_EXIDX) { + *pcount = hdr->p_memsz / sizeof(exidx_entry); + return ((void *)(info.dlpi_addr + hdr->p_vaddr)); + } + } + } + return (NULL); +} + +#else /* !__PIC__ */ + +/* + * Unwind helper for statically linked code. + * + * In a statically linked program, the linker populates a pair of symbols with + * the addresses of the start and end of the exidx table, so returning the + * address and count of elements is pretty straighforward. + */ +void * +dl_unwind_find_exidx(const void *pc, int *pcount) +{ + extern struct exidx_entry __exidx_start; + extern struct exidx_entry __exidx_end; + + *pcount = (int)(&__exidx_end - &__exidx_start); + return (&__exidx_start); +} + +#endif /* __PIC__ */ + Modified: stable/10/sys/arm/include/elf.h ============================================================================== --- stable/10/sys/arm/include/elf.h Sun Aug 10 22:24:14 2014 (r269791) +++ stable/10/sys/arm/include/elf.h Sun Aug 10 22:26:29 2014 (r269792) @@ -55,6 +55,9 @@ __ElfType(Auxinfo); #define ELF_MACHINE_OK(x) ((x) == EM_ARM) +/* Unwind info section type */ +#define PT_ARM_EXIDX (PT_LOPROC + 1) + /* * Relocation types. */ Modified: stable/10/sys/sys/link_elf.h ============================================================================== --- stable/10/sys/sys/link_elf.h Sun Aug 10 22:24:14 2014 (r269791) +++ stable/10/sys/sys/link_elf.h Sun Aug 10 22:26:29 2014 (r269792) @@ -95,6 +95,10 @@ extern int dl_iterate_phdr(__dl_iterate_ int _rtld_addr_phdr(const void *, struct dl_phdr_info *); int _rtld_get_stack_prot(void); +#ifdef __ARM_EABI__ +void * dl_unwind_find_exidx(const void *, int *); +#endif + __END_DECLS #endif /* _SYS_LINK_ELF_H_ */ From owner-svn-src-stable-10@FreeBSD.ORG Mon Aug 11 01:10:16 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 82022635 for ; Mon, 11 Aug 2014 01:10:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6FA5D25A1 for ; Mon, 11 Aug 2014 01:10:16 +0000 (UTC) Received: from ian (uid 1311) (envelope-from ian@FreeBSD.org) id 2b97 by svn.freebsd.org (DragonFly Mail Agent v0.9+); Mon, 11 Aug 2014 01:10:16 +0000 From: Ian Lepore Date: Mon, 11 Aug 2014 01:10:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269794 - stable/10/sys/arm/arm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53e817f8.2b97.d400ca7@svn.freebsd.org> X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Aug 2014 01:10:16 -0000 Author: ian Date: Mon Aug 11 01:10:15 2014 New Revision: 269794 URL: http://svnweb.freebsd.org/changeset/base/269794 Log: MFC r269206, r269207, r269208, r269209, r269210, r269211, r269212, r269213, r269214, r269215, r269216, r269217, r269221: busdma-v6 improvements, primarily: - Allocate the temporary segments array per-map rather than per-tag. - Avoid needlessly bouncing IO for mbufs and buffers allocated by bus_dmamem_alloc() (in both situations we known they're allocated on cacheline boundaries and don't need bouncing). - Various minor reformatting and cleanups. Modified: stable/10/sys/arm/arm/busdma_machdep-v6.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- stable/10/sys/arm/arm/busdma_machdep-v6.c Mon Aug 11 00:03:50 2014 (r269793) +++ stable/10/sys/arm/arm/busdma_machdep-v6.c Mon Aug 11 01:10:15 2014 (r269794) @@ -64,7 +64,10 @@ __FBSDID("$FreeBSD$"); #include #define MAX_BPAGES 64 -#define BUS_DMA_COULD_BOUNCE BUS_DMA_BUS3 +#define MAX_DMA_SEGMENTS 4096 +#define BUS_DMA_EXCL_BOUNCE BUS_DMA_BUS2 +#define BUS_DMA_ALIGN_BOUNCE BUS_DMA_BUS3 +#define BUS_DMA_COULD_BOUNCE (BUS_DMA_EXCL_BOUNCE | BUS_DMA_ALIGN_BOUNCE) #define BUS_DMA_MIN_ALLOC_COMP BUS_DMA_BUS4 struct bounce_zone; @@ -94,15 +97,6 @@ struct bus_dma_tag { */ struct arm32_dma_range *ranges; int _nranges; - /* - * Most tags need one or two segments, and can use the local tagsegs - * array. For tags with a larger limit, we'll allocate a bigger array - * on first use. - */ - bus_dma_segment_t *segments; - bus_dma_segment_t tagsegs[2]; - - }; struct bounce_page { @@ -143,9 +137,40 @@ struct bounce_zone { static struct mtx bounce_lock; static int total_bpages; static int busdma_zonecount; +static uint32_t tags_total; +static uint32_t maps_total; +static uint32_t maps_dmamem; +static uint32_t maps_coherent; +static uint64_t maploads_total; +static uint64_t maploads_bounced; +static uint64_t maploads_coherent; +static uint64_t maploads_dmamem; +static uint64_t maploads_mbuf; +static uint64_t maploads_physmem; + static STAILQ_HEAD(, bounce_zone) bounce_zone_list; SYSCTL_NODE(_hw, OID_AUTO, busdma, CTLFLAG_RD, 0, "Busdma parameters"); +SYSCTL_UINT(_hw_busdma, OID_AUTO, tags_total, CTLFLAG_RD, &tags_total, 0, + "Number of active tags"); +SYSCTL_UINT(_hw_busdma, OID_AUTO, maps_total, CTLFLAG_RD, &maps_total, 0, + "Number of active maps"); +SYSCTL_UINT(_hw_busdma, OID_AUTO, maps_dmamem, CTLFLAG_RD, &maps_dmamem, 0, + "Number of active maps for bus_dmamem_alloc buffers"); +SYSCTL_UINT(_hw_busdma, OID_AUTO, maps_coherent, CTLFLAG_RD, &maps_coherent, 0, + "Number of active maps with BUS_DMA_COHERENT flag set"); +SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_total, CTLFLAG_RD, &maploads_total, 0, + "Number of load operations performed"); +SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_bounced, CTLFLAG_RD, &maploads_bounced, 0, + "Number of load operations that used bounce buffers"); +SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_coherent, CTLFLAG_RD, &maploads_dmamem, 0, + "Number of load operations on BUS_DMA_COHERENT memory"); +SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_dmamem, CTLFLAG_RD, &maploads_dmamem, 0, + "Number of load operations on bus_dmamem_alloc buffers"); +SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_mbuf, CTLFLAG_RD, &maploads_mbuf, 0, + "Number of load operations for mbufs"); +SYSCTL_UQUAD(_hw_busdma, OID_AUTO, maploads_physmem, CTLFLAG_RD, &maploads_physmem, 0, + "Number of load operations on physical buffers"); SYSCTL_INT(_hw_busdma, OID_AUTO, total_bpages, CTLFLAG_RD, &total_bpages, 0, "Total bounce pages"); @@ -160,7 +185,10 @@ struct bus_dmamap { void *callback_arg; int flags; #define DMAMAP_COHERENT (1 << 0) +#define DMAMAP_DMAMEM_ALLOC (1 << 1) +#define DMAMAP_MBUF (1 << 2) STAILQ_ENTRY(bus_dmamap) links; + bus_dma_segment_t *segments; int sync_count; struct sync_list slist[]; }; @@ -177,7 +205,6 @@ static bus_addr_t add_bounce_page(bus_dm vm_offset_t vaddr, bus_addr_t addr, bus_size_t size); static void free_bounce_page(bus_dma_tag_t dmat, struct bounce_page *bpage); -int run_filter(bus_dma_tag_t dmat, bus_addr_t paddr, bus_size_t size, int coherent); static void _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf, bus_size_t buflen, int flags); static void _bus_dmamap_count_phys(bus_dma_tag_t dmat, bus_dmamap_t map, @@ -229,62 +256,135 @@ busdma_init(void *dummy) */ SYSINIT(busdma, SI_SUB_KMEM, SI_ORDER_THIRD, busdma_init, NULL); -static __inline int -_bus_dma_can_bounce(vm_offset_t lowaddr, vm_offset_t highaddr) +static int +exclusion_bounce_check(vm_offset_t lowaddr, vm_offset_t highaddr) { int i; for (i = 0; phys_avail[i] && phys_avail[i + 1]; i += 2) { - if ((lowaddr >= phys_avail[i] && lowaddr <= phys_avail[i + 1]) - || (lowaddr < phys_avail[i] && - highaddr > phys_avail[i])) + if ((lowaddr >= phys_avail[i] && lowaddr < phys_avail[i + 1]) || + (lowaddr < phys_avail[i] && highaddr >= phys_avail[i])) return (1); } return (0); } -static __inline struct arm32_dma_range * -_bus_dma_inrange(struct arm32_dma_range *ranges, int nranges, - bus_addr_t curaddr) +/* + * Return true if the tag has an exclusion zone that could lead to bouncing. + */ +static __inline int +exclusion_bounce(bus_dma_tag_t dmat) { - struct arm32_dma_range *dr; - int i; - for (i = 0, dr = ranges; i < nranges; i++, dr++) { - if (curaddr >= dr->dr_sysbase && - round_page(curaddr) <= (dr->dr_sysbase + dr->dr_len)) - return (dr); - } + return (dmat->flags & BUS_DMA_EXCL_BOUNCE); +} - return (NULL); +/* + * Return true if the given address does not fall on the alignment boundary. + */ +static __inline int +alignment_bounce(bus_dma_tag_t dmat, bus_addr_t addr) +{ + + return (addr & (dmat->alignment - 1)); +} + +/* + * Return true if the DMA should bounce because the start or end does not fall + * on a cacheline boundary (which would require a partial cacheline flush). + * COHERENT memory doesn't trigger cacheline flushes. Memory allocated by + * bus_dmamem_alloc() is always aligned to cacheline boundaries, and there's a + * strict rule that such memory cannot be accessed by the CPU while DMA is in + * progress (or by multiple DMA engines at once), so that it's always safe to do + * full cacheline flushes even if that affects memory outside the range of a + * given DMA operation that doesn't involve the full allocated buffer. If we're + * mapping an mbuf, that follows the same rules as a buffer we allocated. + */ +static __inline int +cacheline_bounce(bus_dmamap_t map, bus_addr_t addr, bus_size_t size) +{ + + if (map->flags & (DMAMAP_DMAMEM_ALLOC | DMAMAP_COHERENT | DMAMAP_MBUF)) + return (0); + return ((addr | size) & arm_dcache_align_mask); } /* - * Return true if a match is made. + * Return true if we might need to bounce the DMA described by addr and size. * - * To find a match walk the chain of bus_dma_tag_t's looking for 'paddr'. + * This is used to quick-check whether we need to do the more expensive work of + * checking the DMA page-by-page looking for alignment and exclusion bounces. * - * If paddr is within the bounds of the dma tag then call the filter callback - * to check for a match, if there is no filter callback then assume a match. + * Note that the addr argument might be either virtual or physical. It doesn't + * matter because we only look at the low-order bits, which are the same in both + * address spaces. */ -int -run_filter(bus_dma_tag_t dmat, bus_addr_t paddr, bus_size_t size, int coherent) +static __inline int +might_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t addr, + bus_size_t size) { - int retval; + return ((dmat->flags & BUS_DMA_EXCL_BOUNCE) || + alignment_bounce(dmat, addr) || + cacheline_bounce(map, addr, size)); +} - retval = 0; +/* + * Return true if we must bounce the DMA described by paddr and size. + * + * Bouncing can be triggered by DMA that doesn't begin and end on cacheline + * boundaries, or doesn't begin on an alignment boundary, or falls within the + * exclusion zone of any tag in the ancestry chain. + * + * For exclusions, walk the chain of tags comparing paddr to the exclusion zone + * within each tag. If the tag has a filter function, use it to decide whether + * the DMA needs to bounce, otherwise any DMA within the zone bounces. + */ +static int +must_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t paddr, + bus_size_t size) +{ - do { - if (((paddr > dmat->lowaddr && paddr <= dmat->highaddr) - || ((paddr & (dmat->alignment - 1)) != 0) || - (!coherent && (size & arm_dcache_align_mask)) || - (!coherent && (paddr & arm_dcache_align_mask))) - && (dmat->filter == NULL - || (*dmat->filter)(dmat->filterarg, paddr) != 0)) - retval = 1; + if (cacheline_bounce(map, paddr, size)) + return (1); + /* + * The tag already contains ancestors' alignment restrictions so this + * check doesn't need to be inside the loop. + */ + if (alignment_bounce(dmat, paddr)) + return (1); + + /* + * Even though each tag has an exclusion zone that is a superset of its + * own and all its ancestors' exclusions, the exclusion zone of each tag + * up the chain must be checked within the loop, because the busdma + * rules say the filter function is called only when the address lies + * within the low-highaddr range of the tag that filterfunc belongs to. + */ + while (dmat != NULL && exclusion_bounce(dmat)) { + if ((paddr >= dmat->lowaddr && paddr <= dmat->highaddr) && + (dmat->filter == NULL || + dmat->filter(dmat->filterarg, paddr) != 0)) + return (1); dmat = dmat->parent; - } while (retval == 0 && dmat != NULL); - return (retval); + } + + return (0); +} + +static __inline struct arm32_dma_range * +_bus_dma_inrange(struct arm32_dma_range *ranges, int nranges, + bus_addr_t curaddr) +{ + struct arm32_dma_range *dr; + int i; + + for (i = 0, dr = ranges; i < nranges; i++, dr++) { + if (curaddr >= dr->dr_sysbase && + round_page(curaddr) <= (dr->dr_sysbase + dr->dr_len)) + return (dr); + } + + return (NULL); } /* @@ -384,34 +484,21 @@ bus_dma_tag_create(bus_dma_tag_t parent, newtag->lockfunc = dflt_lock; newtag->lockfuncarg = NULL; } - /* - * If all the segments we need fit into the local tagsegs array, set the - * pointer now. Otherwise NULL the pointer and an array of segments - * will be allocated later, on first use. We don't pre-allocate now - * because some tags exist just to pass contraints to children in the - * device hierarchy, and they tend to use BUS_SPACE_UNRESTRICTED and we - * sure don't want to try to allocate an array for that. - */ - if (newtag->nsegments <= nitems(newtag->tagsegs)) - newtag->segments = newtag->tagsegs; - else - newtag->segments = NULL; /* Take into account any restrictions imposed by our parent tag */ if (parent != NULL) { newtag->lowaddr = MIN(parent->lowaddr, newtag->lowaddr); newtag->highaddr = MAX(parent->highaddr, newtag->highaddr); + newtag->alignment = MAX(parent->alignment, newtag->alignment); + newtag->flags |= parent->flags & BUS_DMA_COULD_BOUNCE; if (newtag->boundary == 0) newtag->boundary = parent->boundary; else if (parent->boundary != 0) newtag->boundary = MIN(parent->boundary, newtag->boundary); - if ((newtag->filter != NULL) || - ((parent->flags & BUS_DMA_COULD_BOUNCE) != 0)) - newtag->flags |= BUS_DMA_COULD_BOUNCE; if (newtag->filter == NULL) { /* - * Short circuit looking at our parent directly + * Short circuit to looking at our parent directly * since we have encapsulated all of its information */ newtag->filter = parent->filter; @@ -422,9 +509,10 @@ bus_dma_tag_create(bus_dma_tag_t parent, atomic_add_int(&parent->ref_count, 1); } - if (_bus_dma_can_bounce(newtag->lowaddr, newtag->highaddr) - || newtag->alignment > 1) - newtag->flags |= BUS_DMA_COULD_BOUNCE; + if (exclusion_bounce_check(newtag->lowaddr, newtag->highaddr)) + newtag->flags |= BUS_DMA_EXCL_BOUNCE; + if (alignment_bounce(newtag, 1)) + newtag->flags |= BUS_DMA_ALIGN_BOUNCE; /* * Any request can auto-bounce due to cacheline alignment, in addition @@ -463,6 +551,7 @@ bus_dma_tag_create(bus_dma_tag_t parent, if (error != 0) { free(newtag, M_DEVBUF); } else { + atomic_add_32(&tags_total, 1); *dmat = newtag; } CTR4(KTR_BUSDMA, "%s returned tag %p tag flags 0x%x error %d", @@ -492,9 +581,7 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat) parent = dmat->parent; atomic_subtract_int(&dmat->ref_count, 1); if (dmat->ref_count == 0) { - if (dmat->segments != NULL && - dmat->segments != dmat->tagsegs) - free(dmat->segments, M_DEVBUF); + atomic_subtract_32(&tags_total, 1); free(dmat, M_DEVBUF); /* * Last reference count, so @@ -534,8 +621,8 @@ static int allocate_bz_and_pages(bus_dma maxpages = MAX_BPAGES; else maxpages = 2 * bz->map_count; - if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0 - || (bz->map_count > 0 && bz->total_bpages < maxpages)) { + if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0 || + (bz->map_count > 0 && bz->total_bpages < maxpages)) { int pages; pages = atop(roundup2(dmat->maxsize, PAGE_SIZE)) + 1; @@ -551,6 +638,31 @@ static int allocate_bz_and_pages(bus_dma return (0); } +static bus_dmamap_t +allocate_map(bus_dma_tag_t dmat, int mflags) +{ + int mapsize, segsize; + bus_dmamap_t map; + + /* + * Allocate the map. The map structure ends with an embedded + * variable-sized array of sync_list structures. Following that + * we allocate enough extra space to hold the array of bus_dma_segments. + */ + KASSERT(dmat->nsegments <= MAX_DMA_SEGMENTS, + ("cannot allocate %u dma segments (max is %u)", + dmat->nsegments, MAX_DMA_SEGMENTS)); + segsize = sizeof(struct bus_dma_segment) * dmat->nsegments; + mapsize = sizeof(*map) + sizeof(struct sync_list) * dmat->nsegments; + map = malloc(mapsize + segsize, M_DEVBUF, mflags | M_ZERO); + if (map == NULL) { + CTR3(KTR_BUSDMA, "%s: tag %p error %d", __func__, dmat, ENOMEM); + return (NULL); + } + map->segments = (bus_dma_segment_t *)((uintptr_t)map + mapsize); + return (map); +} + /* * Allocate a handle for mapping from kva/uva/physical * address space into bus device space. @@ -558,41 +670,32 @@ static int allocate_bz_and_pages(bus_dma int bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) { - int mapsize; + bus_dmamap_t map; int error = 0; - mapsize = sizeof(**mapp) + (sizeof(struct sync_list) * dmat->nsegments); - *mapp = (bus_dmamap_t)malloc(mapsize, M_DEVBUF, M_NOWAIT | M_ZERO); - if (*mapp == NULL) { + *mapp = map = allocate_map(dmat, M_NOWAIT); + if (map == NULL) { CTR3(KTR_BUSDMA, "%s: tag %p error %d", __func__, dmat, ENOMEM); return (ENOMEM); } - (*mapp)->sync_count = 0; - if (dmat->segments == NULL) { - dmat->segments = (bus_dma_segment_t *)malloc( - sizeof(bus_dma_segment_t) * dmat->nsegments, M_DEVBUF, - M_NOWAIT); - if (dmat->segments == NULL) { - CTR3(KTR_BUSDMA, "%s: tag %p error %d", - __func__, dmat, ENOMEM); - free(*mapp, M_DEVBUF); - *mapp = NULL; - return (ENOMEM); - } - } /* - * Bouncing might be required if the driver asks for an active - * exclusion region, a data alignment that is stricter than 1, and/or - * an active address boundary. + * Bouncing might be required if the driver asks for an exclusion + * region, a data alignment that is stricter than 1, or DMA that begins + * or ends with a partial cacheline. Whether bouncing will actually + * happen can't be known until mapping time, but we need to pre-allocate + * resources now because we might not be allowed to at mapping time. */ - error = allocate_bz_and_pages(dmat, *mapp); + error = allocate_bz_and_pages(dmat, map); if (error != 0) { - free(*mapp, M_DEVBUF); + free(map, M_DEVBUF); *mapp = NULL; return (error); } - return (error); + if (map->flags & DMAMAP_COHERENT) + atomic_add_32(&maps_coherent, 1); + atomic_add_32(&maps_total, 1); + return (0); } /* @@ -609,6 +712,9 @@ bus_dmamap_destroy(bus_dma_tag_t dmat, b } if (dmat->bounce_zone) dmat->bounce_zone->map_count--; + if (map->flags & DMAMAP_COHERENT) + atomic_subtract_32(&maps_coherent, 1); + atomic_subtract_32(&maps_total, 1); free(map, M_DEVBUF); dmat->map_count--; CTR2(KTR_BUSDMA, "%s: tag %p error 0", __func__, dmat); @@ -627,58 +733,33 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi { busdma_bufalloc_t ba; struct busdma_bufzone *bufzone; + bus_dmamap_t map; vm_memattr_t memattr; int mflags; - int mapsize; - int error; if (flags & BUS_DMA_NOWAIT) mflags = M_NOWAIT; else mflags = M_WAITOK; + if (flags & BUS_DMA_ZERO) + mflags |= M_ZERO; - /* ARM non-snooping caches need a map for the VA cache sync structure */ - - mapsize = sizeof(**mapp) + (sizeof(struct sync_list) * dmat->nsegments); - *mapp = (bus_dmamap_t)malloc(mapsize, M_DEVBUF, M_NOWAIT | M_ZERO); - if (*mapp == NULL) { + *mapp = map = allocate_map(dmat, mflags); + if (map == NULL) { CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", __func__, dmat, dmat->flags, ENOMEM); return (ENOMEM); } + map->flags = DMAMAP_DMAMEM_ALLOC; - (*mapp)->sync_count = 0; - /* We may need bounce pages, even for allocated memory */ - error = allocate_bz_and_pages(dmat, *mapp); - if (error != 0) { - free(*mapp, M_DEVBUF); - *mapp = NULL; - return (error); - } - - if (dmat->segments == NULL) { - dmat->segments = (bus_dma_segment_t *)malloc( - sizeof(bus_dma_segment_t) * dmat->nsegments, M_DEVBUF, - mflags); - if (dmat->segments == NULL) { - CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", - __func__, dmat, dmat->flags, ENOMEM); - free(*mapp, M_DEVBUF); - *mapp = NULL; - return (ENOMEM); - } - } - - if (flags & BUS_DMA_ZERO) - mflags |= M_ZERO; + /* Choose a busdma buffer allocator based on memory type flags. */ if (flags & BUS_DMA_COHERENT) { memattr = VM_MEMATTR_UNCACHEABLE; ba = coherent_allocator; - (*mapp)->flags |= DMAMAP_COHERENT; + map->flags |= DMAMAP_COHERENT; } else { memattr = VM_MEMATTR_DEFAULT; ba = standard_allocator; - (*mapp)->flags = 0; } /* @@ -702,7 +783,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi * constraints is something that only the contig allocator can fulfill. */ if (bufzone != NULL && dmat->alignment <= bufzone->size && - !_bus_dma_can_bounce(dmat->lowaddr, dmat->highaddr)) { + !exclusion_bounce(dmat)) { *vaddr = uma_zalloc(bufzone->umazone, mflags); } else if (dmat->nsegments >= btoc(dmat->maxsize) && dmat->alignment <= PAGE_SIZE && dmat->boundary == 0) { @@ -718,12 +799,16 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi if (*vaddr == NULL) { CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", __func__, dmat, dmat->flags, ENOMEM); - free(*mapp, M_DEVBUF); + free(map, M_DEVBUF); *mapp = NULL; return (ENOMEM); } else if ((uintptr_t)*vaddr & (dmat->alignment - 1)) { printf("bus_dmamem_alloc failed to align memory properly.\n"); } + if (map->flags & DMAMAP_COHERENT) + atomic_add_32(&maps_coherent, 1); + atomic_add_32(&maps_dmamem, 1); + atomic_add_32(&maps_total, 1); dmat->map_count++; CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", @@ -751,12 +836,16 @@ bus_dmamem_free(bus_dma_tag_t dmat, void bufzone = busdma_bufalloc_findzone(ba, dmat->maxsize); if (bufzone != NULL && dmat->alignment <= bufzone->size && - !_bus_dma_can_bounce(dmat->lowaddr, dmat->highaddr)) + !exclusion_bounce(dmat)) uma_zfree(bufzone->umazone, vaddr); else kmem_free(kernel_arena, (vm_offset_t)vaddr, dmat->maxsize); dmat->map_count--; + if (map->flags & DMAMAP_COHERENT) + atomic_subtract_32(&maps_coherent, 1); + atomic_subtract_32(&maps_total, 1); + atomic_subtract_32(&maps_dmamem, 1); free(map, M_DEVBUF); CTR3(KTR_BUSDMA, "%s: tag %p flags 0x%x", __func__, dmat, dmat->flags); } @@ -780,8 +869,7 @@ _bus_dmamap_count_phys(bus_dma_tag_t dma curaddr = buf; while (buflen != 0) { sgsize = MIN(buflen, dmat->maxsegsz); - if (run_filter(dmat, curaddr, sgsize, - map->flags & DMAMAP_COHERENT) != 0) { + if (must_bounce(dmat, map, curaddr, sgsize) != 0) { sgsize = MIN(sgsize, PAGE_SIZE); map->pagesneeded++; } @@ -817,10 +905,9 @@ _bus_dmamap_count_pages(bus_dma_tag_t dm paddr = pmap_kextract(vaddr); else paddr = pmap_extract(map->pmap, vaddr); - if (run_filter(dmat, paddr, - min(vendaddr - vaddr, - (PAGE_SIZE - ((vm_offset_t)vaddr & PAGE_MASK))), - map->flags & DMAMAP_COHERENT) != 0) { + if (must_bounce(dmat, map, paddr, + min(vendaddr - vaddr, (PAGE_SIZE - ((vm_offset_t)vaddr & + PAGE_MASK)))) != 0) { map->pagesneeded++; } vaddr += (PAGE_SIZE - ((vm_offset_t)vaddr & PAGE_MASK)); @@ -934,12 +1021,15 @@ _bus_dmamap_load_phys(bus_dma_tag_t dmat int error; if (segs == NULL) - segs = dmat->segments; + segs = map->segments; + + maploads_total++; + maploads_physmem++; - if (((map->flags & DMAMAP_COHERENT) == 0) || - (dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) { + if (might_bounce(dmat, map, buflen, buflen)) { _bus_dmamap_count_phys(dmat, map, buf, buflen, flags); if (map->pagesneeded != 0) { + maploads_bounced++; error = _bus_dmamap_reserve_pages(dmat, map, flags); if (error) return (error); @@ -949,10 +1039,8 @@ _bus_dmamap_load_phys(bus_dma_tag_t dmat while (buflen > 0) { curaddr = buf; sgsize = MIN(buflen, dmat->maxsegsz); - if ((((map->flags & DMAMAP_COHERENT) == 0) || - ((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0)) && - map->pagesneeded != 0 && run_filter(dmat, curaddr, - sgsize, map->flags & DMAMAP_COHERENT)) { + if (map->pagesneeded != 0 && must_bounce(dmat, map, curaddr, + sgsize)) { sgsize = MIN(sgsize, PAGE_SIZE); curaddr = add_bounce_page(dmat, map, 0, curaddr, sgsize); @@ -1004,15 +1092,26 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm struct sync_list *sl; int error; + maploads_total++; + if (map->flags & DMAMAP_COHERENT) + maploads_coherent++; + if (map->flags & DMAMAP_DMAMEM_ALLOC) + maploads_dmamem++; + if (segs == NULL) - segs = dmat->segments; + segs = map->segments; + + if (flags & BUS_DMA_LOAD_MBUF) { + maploads_mbuf++; + map->flags |= DMAMAP_MBUF; + } map->pmap = pmap; - if (!(map->flags & DMAMAP_COHERENT) || - (dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) { + if (might_bounce(dmat, map, (bus_addr_t)buf, buflen)) { _bus_dmamap_count_pages(dmat, map, buf, buflen, flags); if (map->pagesneeded != 0) { + maploads_bounced++; error = _bus_dmamap_reserve_pages(dmat, map, flags); if (error) return (error); @@ -1040,10 +1139,8 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm if (buflen < sgsize) sgsize = buflen; - if ((((map->flags & DMAMAP_COHERENT) == 0) || - ((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0)) && - map->pagesneeded != 0 && run_filter(dmat, curaddr, - sgsize, map->flags & DMAMAP_COHERENT)) { + if (map->pagesneeded != 0 && must_bounce(dmat, map, curaddr, + sgsize)) { curaddr = add_bounce_page(dmat, map, vaddr, curaddr, sgsize); } else { @@ -1100,7 +1197,7 @@ _bus_dmamap_complete(bus_dma_tag_t dmat, { if (segs == NULL) - segs = dmat->segments; + segs = map->segments; return (segs); } @@ -1126,6 +1223,7 @@ _bus_dmamap_unload(bus_dma_tag_t dmat, b map->pagesneeded = 0; } map->sync_count = 0; + map->flags &= ~DMAMAP_MBUF; } #ifdef notyetbounceuser @@ -1204,12 +1302,12 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus while (bpage != NULL) { if (bpage->datavaddr != 0) bcopy((void *)bpage->datavaddr, - (void *)bpage->vaddr, - bpage->datacount); + (void *)bpage->vaddr, + bpage->datacount); else physcopyout(bpage->dataaddr, - (void *)bpage->vaddr, - bpage->datacount); + (void *)bpage->vaddr, + bpage->datacount); cpu_dcache_wb_range((vm_offset_t)bpage->vaddr, bpage->datacount); l2cache_wb_range((vm_offset_t)bpage->vaddr, @@ -1251,12 +1349,12 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus l2cache_inv_range(startv, startp, len); if (bpage->datavaddr != 0) bcopy((void *)bpage->vaddr, - (void *)bpage->datavaddr, - bpage->datacount); + (void *)bpage->datavaddr, + bpage->datacount); else physcopyin((void *)bpage->vaddr, - bpage->dataaddr, - bpage->datacount); + bpage->dataaddr, + bpage->datacount); bpage = STAILQ_NEXT(bpage, links); } dmat->bounce_zone->total_bounced++; @@ -1345,8 +1443,8 @@ alloc_bounce_zone(bus_dma_tag_t dmat) /* Check to see if we already have a suitable zone */ STAILQ_FOREACH(bz, &bounce_zone_list, links) { - if ((dmat->alignment <= bz->alignment) - && (dmat->lowaddr >= bz->lowaddr)) { + if ((dmat->alignment <= bz->alignment) && + (dmat->lowaddr >= bz->lowaddr)) { dmat->bounce_zone = bz; return (0); } @@ -1397,7 +1495,7 @@ alloc_bounce_zone(bus_dma_tag_t dmat) SYSCTL_ADD_INT(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, "total_bounced", CTLFLAG_RD, &bz->total_bounced, 0, - "Total bounce requests"); + "Total bounce requests (pages bounced)"); SYSCTL_ADD_INT(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, "total_deferred", CTLFLAG_RD, &bz->total_deferred, 0, @@ -1424,15 +1522,12 @@ alloc_bounce_pages(bus_dma_tag_t dmat, u struct bounce_page *bpage; bpage = (struct bounce_page *)malloc(sizeof(*bpage), M_DEVBUF, - M_NOWAIT | M_ZERO); + M_NOWAIT | M_ZERO); if (bpage == NULL) break; bpage->vaddr = (vm_offset_t)contigmalloc(PAGE_SIZE, M_DEVBUF, - M_NOWAIT, 0ul, - bz->lowaddr, - PAGE_SIZE, - 0); + M_NOWAIT, 0ul, bz->lowaddr, PAGE_SIZE, 0); if (bpage->vaddr == 0) { free(bpage, M_DEVBUF); break; @@ -1538,7 +1633,7 @@ free_bounce_page(bus_dma_tag_t dmat, str if (reserve_bounce_pages(map->dmat, map, 1) == 0) { STAILQ_REMOVE_HEAD(&bounce_map_waitinglist, links); STAILQ_INSERT_TAIL(&bounce_map_callbacklist, - map, links); + map, links); busdma_swi_pending = 1; bz->total_deferred++; swi_sched(vm_ih, 0); @@ -1558,10 +1653,10 @@ busdma_swi(void) STAILQ_REMOVE_HEAD(&bounce_map_callbacklist, links); mtx_unlock(&bounce_lock); dmat = map->dmat; - (dmat->lockfunc)(dmat->lockfuncarg, BUS_DMA_LOCK); + dmat->lockfunc(dmat->lockfuncarg, BUS_DMA_LOCK); bus_dmamap_load_mem(map->dmat, map, &map->mem, map->callback, - map->callback_arg, BUS_DMA_WAITOK); - (dmat->lockfunc)(dmat->lockfuncarg, BUS_DMA_UNLOCK); + map->callback_arg, BUS_DMA_WAITOK); + dmat->lockfunc(dmat->lockfuncarg, BUS_DMA_UNLOCK); mtx_lock(&bounce_lock); } mtx_unlock(&bounce_lock); From owner-svn-src-stable-10@FreeBSD.ORG Mon Aug 11 01:22:11 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1CB8ABC9 for ; Mon, 11 Aug 2014 01:22:11 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F28ED2700 for ; Mon, 11 Aug 2014 01:22:10 +0000 (UTC) Received: from ian (uid 1311) (envelope-from ian@FreeBSD.org) id 2efa by svn.freebsd.org (DragonFly Mail Agent v0.9+); Mon, 11 Aug 2014 01:22:10 +0000 From: Ian Lepore Date: Mon, 11 Aug 2014 01:22:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269795 - stable/10/sys/dev/mmc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53e81ac2.2efa.2b4eb541@svn.freebsd.org> X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Aug 2014 01:22:11 -0000 Author: ian Date: Mon Aug 11 01:22:10 2014 New Revision: 269795 URL: http://svnweb.freebsd.org/changeset/base/269795 Log: MFC r269341: Populate disk->d_ident with the sd or mmc card's serial number. Modified: stable/10/sys/dev/mmc/mmc.c stable/10/sys/dev/mmc/mmcsd.c stable/10/sys/dev/mmc/mmcvar.h Modified: stable/10/sys/dev/mmc/mmc.c ============================================================================== --- stable/10/sys/dev/mmc/mmc.c Mon Aug 11 01:10:15 2014 (r269794) +++ stable/10/sys/dev/mmc/mmc.c Mon Aug 11 01:22:10 2014 (r269795) @@ -102,6 +102,7 @@ struct mmc_ivars { uint32_t hs_tran_speed; /* Max speed in high speed mode */ uint32_t erase_sector; /* Card native erase sector size */ char card_id_string[64];/* Formatted CID info (serial, MFG, etc) */ + char card_sn_string[16];/* Formatted serial # for disk->d_ident */ }; #define CMD_RETRIES 3 @@ -887,6 +888,9 @@ mmc_format_card_id_string(struct mmc_iva * mmcsd0: 968MB at mmc0 * 22.5MHz/4bit/128-block * + * Also format just the card serial number, which the mmcsd driver will + * use as the disk->d_ident string. + * * The card_id_string in mmc_ivars is currently allocated as 64 bytes, * and our max formatted length is currently 55 bytes if every field * contains the largest value. @@ -900,8 +904,10 @@ mmc_format_card_id_string(struct mmc_iva snprintf(oidstr, sizeof(oidstr), "%c%c", c1, c2); else snprintf(oidstr, sizeof(oidstr), "0x%04x", ivar->cid.oid); + snprintf(ivar->card_sn_string, sizeof(ivar->card_sn_string), + "%08X", ivar->cid.psn); snprintf(ivar->card_id_string, sizeof(ivar->card_id_string), - "%s%s %s %d.%d SN %u MFG %02d/%04d by %d %s", + "%s%s %s %d.%d SN %08X MFG %02d/%04d by %d %s", ivar->mode == mode_sd ? "SD" : "MMC", ivar->high_cap ? "HC" : "", ivar->cid.pnm, ivar->cid.prv >> 4, ivar->cid.prv & 0x0f, ivar->cid.psn, ivar->cid.mdt_month, ivar->cid.mdt_year, @@ -1698,6 +1704,9 @@ mmc_read_ivar(device_t bus, device_t chi case MMC_IVAR_CARD_ID_STRING: *(char **)result = ivar->card_id_string; break; + case MMC_IVAR_CARD_SN_STRING: + *(char **)result = ivar->card_sn_string; + break; } return (0); } Modified: stable/10/sys/dev/mmc/mmcsd.c ============================================================================== --- stable/10/sys/dev/mmc/mmcsd.c Mon Aug 11 01:10:15 2014 (r269794) +++ stable/10/sys/dev/mmc/mmcsd.c Mon Aug 11 01:22:10 2014 (r269795) @@ -163,6 +163,9 @@ mmcsd_attach(device_t dev) d->d_unit = device_get_unit(dev); d->d_flags = DISKFLAG_CANDELETE; d->d_delmaxsize = mmc_get_erase_sector(dev) * d->d_sectorsize * 1; /* conservative */ + strlcpy(d->d_ident, mmc_get_card_sn_string(dev), sizeof(d->d_ident)); + strlcpy(d->d_descr, mmc_get_card_id_string(dev), sizeof(d->d_descr)); + /* * Display in most natural units. There's no cards < 1MB. The SD * standard goes to 2GiB due to its reliance on FAT, but the data @@ -188,7 +191,7 @@ mmcsd_attach(device_t dev) speed = mmcbr_get_clock(device_get_parent(dev)); maxblocks = mmc_get_max_data(dev); device_printf(dev, "%ju%cB <%s>%s at %s %d.%01dMHz/%dbit/%d-block\n", - mb, unit, mmc_get_card_id_string(dev), + mb, unit, d->d_descr, mmc_get_read_only(dev) ? " (read-only)" : "", device_get_nameunit(device_get_parent(dev)), speed / 1000000, (speed / 100000) % 10, Modified: stable/10/sys/dev/mmc/mmcvar.h ============================================================================== --- stable/10/sys/dev/mmc/mmcvar.h Mon Aug 11 01:10:15 2014 (r269794) +++ stable/10/sys/dev/mmc/mmcvar.h Mon Aug 11 01:22:10 2014 (r269795) @@ -69,11 +69,12 @@ enum mmc_device_ivars { MMC_IVAR_BUS_WIDTH, MMC_IVAR_ERASE_SECTOR, MMC_IVAR_MAX_DATA, - MMC_IVAR_CARD_ID_STRING + MMC_IVAR_CARD_ID_STRING, + MMC_IVAR_CARD_SN_STRING, }; /* - * Simplified accessors for pci devices + * Simplified accessors for mmc devices */ #define MMC_ACCESSOR(var, ivar, type) \ __BUS_ACCESSOR(mmc, var, MMC, ivar, type) @@ -90,5 +91,6 @@ MMC_ACCESSOR(bus_width, BUS_WIDTH, int) MMC_ACCESSOR(erase_sector, ERASE_SECTOR, int) MMC_ACCESSOR(max_data, MAX_DATA, int) MMC_ACCESSOR(card_id_string, CARD_ID_STRING, const char *) +MMC_ACCESSOR(card_sn_string, CARD_SN_STRING, const char *) #endif /* DEV_MMC_MMCVAR_H */ From owner-svn-src-stable-10@FreeBSD.ORG Mon Aug 11 01:29:32 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F2538DB8 for ; Mon, 11 Aug 2014 01:29:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E0A8D2764 for ; Mon, 11 Aug 2014 01:29:31 +0000 (UTC) Received: from ian (uid 1311) (envelope-from ian@FreeBSD.org) id 2f47 by svn.freebsd.org (DragonFly Mail Agent v0.9+); Mon, 11 Aug 2014 01:29:29 +0000 From: Ian Lepore Date: Mon, 11 Aug 2014 01:29:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269796 - in stable/10/sys: arm/arm arm/include libkern/arm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53e81c79.2f47.107c3798@svn.freebsd.org> X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Aug 2014 01:29:32 -0000 Author: ian Date: Mon Aug 11 01:29:28 2014 New Revision: 269796 URL: http://svnweb.freebsd.org/changeset/base/269796 Log: MFC r269390: Fix unwind info in hand-written asm (avoid nested functions). Modified: stable/10/sys/arm/arm/cpufunc_asm_arm10.S stable/10/sys/arm/arm/cpufunc_asm_arm9.S stable/10/sys/arm/arm/cpufunc_asm_armv5.S stable/10/sys/arm/arm/cpufunc_asm_armv6.S stable/10/sys/arm/arm/cpufunc_asm_armv7.S stable/10/sys/arm/arm/cpufunc_asm_xscale.S stable/10/sys/arm/arm/cpufunc_asm_xscale_c3.S stable/10/sys/arm/arm/exception.S stable/10/sys/arm/arm/fusu.S stable/10/sys/arm/arm/locore.S stable/10/sys/arm/arm/setstack.s stable/10/sys/arm/arm/support.S stable/10/sys/arm/include/asm.h stable/10/sys/libkern/arm/divsi3.S Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/arm/cpufunc_asm_arm10.S ============================================================================== --- stable/10/sys/arm/arm/cpufunc_asm_arm10.S Mon Aug 11 01:22:10 2014 (r269795) +++ stable/10/sys/arm/arm/cpufunc_asm_arm10.S Mon Aug 11 01:29:28 2014 (r269796) @@ -209,7 +209,7 @@ ENTRY_NP(arm10_idcache_wbinv_all) mcr p15, 0, r0, c7, c5, 0 /* Flush I cache */ /* Fall through to purge Dcache. */ -ENTRY(arm10_dcache_wbinv_all) +EENTRY(arm10_dcache_wbinv_all) .Larm10_dcache_wbinv_all: ldr ip, .Larm10_cache_data ldmia ip, {s_max, i_max, s_inc, i_inc} @@ -223,8 +223,8 @@ ENTRY(arm10_dcache_wbinv_all) bhs .Lnext_set_inv /* Next set */ mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer */ bx lr +EEND(arm10_dcache_wbinv_all) END(arm10_idcache_wbinv_all) -END(arm10_dcache_wbinv_all) .Larm10_cache_data: .word _C_LABEL(arm10_dcache_sets_max) Modified: stable/10/sys/arm/arm/cpufunc_asm_arm9.S ============================================================================== --- stable/10/sys/arm/arm/cpufunc_asm_arm9.S Mon Aug 11 01:22:10 2014 (r269795) +++ stable/10/sys/arm/arm/cpufunc_asm_arm9.S Mon Aug 11 01:29:28 2014 (r269796) @@ -197,7 +197,7 @@ ENTRY_NP(arm9_idcache_wbinv_all) mcr p15, 0, r0, c7, c5, 0 /* Flush I cache */ /* Fall through */ -ENTRY(arm9_dcache_wbinv_all) +EENTRY(arm9_dcache_wbinv_all) .Larm9_dcache_wbinv_all: ldr ip, .Larm9_cache_data ldmia ip, {s_max, i_max, s_inc, i_inc} @@ -210,8 +210,8 @@ ENTRY(arm9_dcache_wbinv_all) subs s_max, s_max, s_inc bhs .Lnext_set_inv /* Next set */ mov pc, lr +EEND(arm9_dcache_wbinv_all) END(arm9_idcache_wbinv_all) -END(arm9_dcache_wbinv_all) .Larm9_cache_data: .word _C_LABEL(arm9_dcache_sets_max) Modified: stable/10/sys/arm/arm/cpufunc_asm_armv5.S ============================================================================== --- stable/10/sys/arm/arm/cpufunc_asm_armv5.S Mon Aug 11 01:22:10 2014 (r269795) +++ stable/10/sys/arm/arm/cpufunc_asm_armv5.S Mon Aug 11 01:29:28 2014 (r269796) @@ -194,6 +194,7 @@ ENTRY(armv5_idcache_wbinv_range) END(armv5_idcache_wbinv_range) ENTRY_NP(armv5_idcache_wbinv_all) +armv5_idcache_wbinv_all: .Larmv5_idcache_wbinv_all: /* * We assume that the code here can never be out of sync with the @@ -203,7 +204,7 @@ ENTRY_NP(armv5_idcache_wbinv_all) mcr p15, 0, r0, c7, c5, 0 /* Flush I cache */ /* Fall through to purge Dcache. */ -ENTRY(armv5_dcache_wbinv_all) +EENTRY(armv5_dcache_wbinv_all) .Larmv5_dcache_wbinv_all: ldr ip, .Larmv5_cache_data ldmia ip, {s_max, i_max, s_inc, i_inc} @@ -219,8 +220,8 @@ ENTRY(armv5_dcache_wbinv_all) bpl 1b /* Next set */ mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer */ RET +EEND(armv5_dcache_wbinv_all) END(armv5_idcache_wbinv_all) -END(armv5_dcache_wbinv_all) .Larmv5_cache_data: .word _C_LABEL(armv5_dcache_sets_max) Modified: stable/10/sys/arm/arm/cpufunc_asm_armv6.S ============================================================================== --- stable/10/sys/arm/arm/cpufunc_asm_armv6.S Mon Aug 11 01:22:10 2014 (r269795) +++ stable/10/sys/arm/arm/cpufunc_asm_armv6.S Mon Aug 11 01:29:28 2014 (r269796) @@ -137,12 +137,12 @@ ENTRY_NP(armv6_idcache_wbinv_all) /* Fall through to purge Dcache. */ /* LINTSTUB: void armv6_dcache_wbinv_all(void); */ -ENTRY(armv6_dcache_wbinv_all) +EENTRY(armv6_dcache_wbinv_all) mcr p15, 0, r0, c7, c14, 0 /* clean & invalidate D cache */ mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer */ RET +EEND(armv6_dcache_wbinv_all) END(armv6_idcache_wbinv_all) -END(armv6_dcache_wbinv_all) ENTRY(armv6_idcache_inv_all) mov r0, #0 Modified: stable/10/sys/arm/arm/cpufunc_asm_armv7.S ============================================================================== --- stable/10/sys/arm/arm/cpufunc_asm_armv7.S Mon Aug 11 01:22:10 2014 (r269795) +++ stable/10/sys/arm/arm/cpufunc_asm_armv7.S Mon Aug 11 01:29:28 2014 (r269796) @@ -358,7 +358,7 @@ ENTRY(armv7_idcache_inv_all) mcr p15, 0, r0, c7, c5, 0 @ invalidate instruction+branch cache isb @ instruction sync barrier bx lr @ return -END(armv7_l1cache_inv_all) +END(armv7_idcache_inv_all) ENTRY_NP(armv7_sleep) dsb Modified: stable/10/sys/arm/arm/cpufunc_asm_xscale.S ============================================================================== --- stable/10/sys/arm/arm/cpufunc_asm_xscale.S Mon Aug 11 01:22:10 2014 (r269795) +++ stable/10/sys/arm/arm/cpufunc_asm_xscale.S Mon Aug 11 01:29:28 2014 (r269796) @@ -306,11 +306,12 @@ _C_LABEL(xscale_minidata_clean_size): XSCALE_CACHE_CLEAN_UNBLOCK ENTRY_NP(xscale_cache_syncI) -ENTRY_NP(xscale_cache_purgeID) + +EENTRY_NP(xscale_cache_purgeID) mcr p15, 0, r0, c7, c5, 0 /* flush I cache (D cleaned below) */ -ENTRY_NP(xscale_cache_cleanID) -ENTRY_NP(xscale_cache_purgeD) -ENTRY(xscale_cache_cleanD) +EENTRY_NP(xscale_cache_cleanID) +EENTRY_NP(xscale_cache_purgeD) +EENTRY(xscale_cache_cleanD) XSCALE_CACHE_CLEAN_PROLOGUE 1: subs r0, r0, #32 @@ -326,11 +327,11 @@ ENTRY(xscale_cache_cleanD) XSCALE_CACHE_CLEAN_EPILOGUE RET +EEND(xscale_cache_cleanD) +EEND(xscale_cache_purgeD) +EEND(xscale_cache_cleanID) +EEND(xscale_cache_purgeID) END(xscale_cache_syncI) -END(xscale_cache_purgeID) -END(xscale_cache_cleanID) -END(xscale_cache_purgeD) -END(xscale_cache_cleanD) /* * Clean the mini-data cache. @@ -374,7 +375,7 @@ END(xscale_cache_purgeD_E) */ /* xscale_cache_syncI is identical to xscale_cache_purgeID */ -ENTRY(xscale_cache_cleanID_rng) +EENTRY(xscale_cache_cleanID_rng) ENTRY(xscale_cache_cleanD_rng) cmp r1, #0x4000 bcs _C_LABEL(xscale_cache_cleanID) @@ -393,7 +394,7 @@ ENTRY(xscale_cache_cleanD_rng) mcr p15, 0, r0, c7, c10, 4 /* drain write buffer */ CPWAIT_AND_RETURN(r0) -END(xscale_cache_cleanID_rng) +/*END(xscale_cache_cleanID_rng)*/ END(xscale_cache_cleanD_rng) ENTRY(xscale_cache_purgeID_rng) Modified: stable/10/sys/arm/arm/cpufunc_asm_xscale_c3.S ============================================================================== --- stable/10/sys/arm/arm/cpufunc_asm_xscale_c3.S Mon Aug 11 01:22:10 2014 (r269795) +++ stable/10/sys/arm/arm/cpufunc_asm_xscale_c3.S Mon Aug 11 01:29:28 2014 (r269796) @@ -143,11 +143,12 @@ __FBSDID("$FreeBSD$"); ENTRY_NP(xscalec3_cache_syncI) -ENTRY_NP(xscalec3_cache_purgeID) +xscalec3_cache_purgeID: +EENTRY_NP(xscalec3_cache_purgeID) mcr p15, 0, r0, c7, c5, 0 /* flush I cache (D cleaned below) */ -ENTRY_NP(xscalec3_cache_cleanID) -ENTRY_NP(xscalec3_cache_purgeD) -ENTRY(xscalec3_cache_cleanD) +EENTRY_NP(xscalec3_cache_cleanID) +EENTRY_NP(xscalec3_cache_purgeD) +EENTRY(xscalec3_cache_cleanD) XSCALE_CACHE_CLEAN_BLOCK mov r0, #0 @@ -168,11 +169,11 @@ ENTRY(xscalec3_cache_cleanD) mcr p15, 0, r0, c7, c10, 4 /* drain write buffer */ RET +EEND(xscalec3_cache_purgeID) +EEND(xscalec3_cache_cleanID) +EEND(xscalec3_cache_purgeD) +EEND(xscalec3_cache_cleanD) END(xscalec3_cache_syncI) -END(xscalec3_cache_purgeID) -END(xscalec3_cache_cleanID) -END(xscalec3_cache_purgeD) -END(xscalec3_cache_cleanD) ENTRY(xscalec3_cache_purgeID_rng) @@ -238,7 +239,7 @@ ENTRY(xscalec3_cache_purgeD_rng) END(xscalec3_cache_purgeD_rng) ENTRY(xscalec3_cache_cleanID_rng) -ENTRY(xscalec3_cache_cleanD_rng) +EENTRY(xscalec3_cache_cleanD_rng) cmp r1, #0x4000 bcs _C_LABEL(xscalec3_cache_cleanID) @@ -257,8 +258,8 @@ ENTRY(xscalec3_cache_cleanD_rng) mcr p15, 0, r0, c7, c10, 4 /* drain write buffer */ CPWAIT_AND_RETURN(r0) +EEND(xscalec3_cache_cleanD_rng) END(xscalec3_cache_cleanID_rng) -END(xscalec3_cache_cleanD_rng) ENTRY(xscalec3_l2cache_purge) /* Clean-up the L2 cache */ Modified: stable/10/sys/arm/arm/exception.S ============================================================================== --- stable/10/sys/arm/arm/exception.S Mon Aug 11 01:22:10 2014 (r269795) +++ stable/10/sys/arm/arm/exception.S Mon Aug 11 01:29:28 2014 (r269796) @@ -280,12 +280,12 @@ ASENTRY_NP(swi_entry) * that a newly created thread appears to return from a SWI just like * the parent thread that created it. */ -ASENTRY_NP(swi_exit) +ASEENTRY_NP(swi_exit) DO_AST /* Handle pending signals. */ PULLFRAME /* Deallocate trapframe. */ movs pc, lr /* Return to userland. */ STOP_UNWINDING /* Don't unwind into user mode. */ -END(swi_exit) +EEND(swi_exit) END(swi_entry) /* Modified: stable/10/sys/arm/arm/fusu.S ============================================================================== --- stable/10/sys/arm/arm/fusu.S Mon Aug 11 01:22:10 2014 (r269795) +++ stable/10/sys/arm/arm/fusu.S Mon Aug 11 01:29:28 2014 (r269796) @@ -54,8 +54,8 @@ __FBSDID("$FreeBSD$"); * Fetch an int from the user's address space. */ -ENTRY_NP(casuword32) ENTRY(casuword) +EENTRY_NP(casuword32) GET_PCB(r3) ldr r3, [r3] @@ -91,7 +91,7 @@ ENTRY(casuword) mov r1, #0x00000000 str r1, [r3, #PCB_ONFAULT] RET -END(casuword32) +EEND(casuword32) END(casuword) /* @@ -110,8 +110,8 @@ END(casuword) * Fetch an int from the user's address space. */ -ENTRY_NP(fuword32) ENTRY(fuword) +EENTRY_NP(fuword32) GET_PCB(r2) ldr r2, [r2] @@ -277,8 +277,8 @@ fusupcbfaulttext: * Store an int in the user's address space. */ -ENTRY_NP(suword32) ENTRY(suword) +EENTRY_NP(suword32) GET_PCB(r2) ldr r2, [r2] @@ -390,4 +390,3 @@ ENTRY(subyte) str r0, [r2, #PCB_ONFAULT] RET END(subyte) - Modified: stable/10/sys/arm/arm/locore.S ============================================================================== --- stable/10/sys/arm/arm/locore.S Mon Aug 11 01:22:10 2014 (r269795) +++ stable/10/sys/arm/arm/locore.S Mon Aug 11 01:29:28 2014 (r269796) @@ -75,7 +75,8 @@ __FBSDID("$FreeBSD$"); * For both types of boot we gather up the args, put them in a struct arm_boot_params * structure and pass that to initarm. */ -ENTRY_NP(btext) + .globl btext +btext: ASENTRY_NP(_start) STOP_UNWINDING /* Can't unwind into the bootloader! */ @@ -261,7 +262,6 @@ virt_done: adr r0, .Lmainreturned b _C_LABEL(panic) /* NOTREACHED */ -END(btext) END(_start) /* @@ -524,7 +524,7 @@ ENTRY_NP(sigcode) /* Branch back to retry SYS_sigreturn */ b . - 16 - +END(sigcode) .word SYS_sigreturn .word SYS_exit @@ -536,5 +536,5 @@ ENTRY_NP(sigcode) .global szsigcode szsigcode: .long esigcode-sigcode -END(sigcode) + /* End of locore.S */ Modified: stable/10/sys/arm/arm/setstack.s ============================================================================== --- stable/10/sys/arm/arm/setstack.s Mon Aug 11 01:22:10 2014 (r269795) +++ stable/10/sys/arm/arm/setstack.s Mon Aug 11 01:29:28 2014 (r269796) @@ -71,7 +71,7 @@ ENTRY(set_stackptr) msr cpsr_fsxc, r3 /* Restore the old mode */ mov pc, lr /* Exit */ - +END(set_stackptr) /* To get the stack pointer for a particular mode we must switch * to that mode copy the banked r13 and then switch back. * This routine provides an easy way of doing this for any mode @@ -90,5 +90,5 @@ ENTRY(get_stackptr) msr cpsr_fsxc, r3 /* Restore the old mode */ mov pc, lr /* Exit */ - +END(get_stackptr) /* End of setstack.S */ Modified: stable/10/sys/arm/arm/support.S ============================================================================== --- stable/10/sys/arm/arm/support.S Mon Aug 11 01:22:10 2014 (r269795) +++ stable/10/sys/arm/arm/support.S Mon Aug 11 01:29:28 2014 (r269796) @@ -130,7 +130,7 @@ ENTRY(bzero) .Lnormal0: mov r3, #0x00 b do_memset - +EEND(bzero) /* LINTSTUB: Func: void *memset(void *, int, size_t) */ ENTRY(memset) and r3, r1, #0xff /* We deal with bytes */ @@ -276,7 +276,6 @@ do_memset: strgeb r3, [ip], #0x01 /* Set another byte */ strgtb r3, [ip] /* and a third */ RET /* Exit */ -END(bzero) END(memset) ENTRY(bcmp) @@ -394,7 +393,7 @@ ENTRY(bcopy) eor r0, r1, r0 eor r1, r0, r1 eor r0, r1, r0 -ENTRY(memmove) +EENTRY(memmove) /* Do the buffers overlap? */ cmp r0, r1 RETeq /* Bail now if src/dst are the same */ @@ -931,8 +930,8 @@ ENTRY(memmove) .Lmemmove_bsrcul1l4: add r1, r1, #1 b .Lmemmove_bl4 +EEND(memmove) END(bcopy) -END(memmove) #if !defined(_ARM_ARCH_5E) ENTRY(memcpy) @@ -2945,13 +2944,17 @@ END(memcpy) ENTRY(user) nop +END(user) ENTRY(btrap) nop +END(btrap) ENTRY(etrap) nop +END(etrap) ENTRY(bintr) nop +END(bintr) ENTRY(eintr) nop - +END(eintr) #endif Modified: stable/10/sys/arm/include/asm.h ============================================================================== --- stable/10/sys/arm/include/asm.h Mon Aug 11 01:22:10 2014 (r269795) +++ stable/10/sys/arm/include/asm.h Mon Aug 11 01:29:28 2014 (r269796) @@ -74,9 +74,20 @@ #define GLOBAL(X) .globl x #define _ENTRY(x) \ .text; _ALIGN_TEXT; .globl x; .type x,_ASM_TYPE_FUNCTION; x: _FNSTART - #define _END(x) .size x, . - x; _FNEND +/* + * EENTRY()/EEND() mark "extra" entry/exit points from a function. + * The unwind info cannot handle the concept of a nested function, or a function + * with multiple .fnstart directives, but some of our assembler code is written + * with multiple labels to allow entry at several points. The EENTRY() macro + * defines such an extra entry point without a new .fnstart, so that it's + * basically just a label that you can jump to. The EEND() macro does nothing + * at all, except document the exit point associated with the same-named entry. + */ +#define _EENTRY(x) .globl x; .type x,_ASM_TYPE_FUNCTION; x: +#define _EEND(x) /* nothing */ + #ifdef GPROF # define _PROF_PROLOGUE \ mov ip, lr; bl __mcount @@ -85,11 +96,17 @@ #endif #define ENTRY(y) _ENTRY(_C_LABEL(y)); _PROF_PROLOGUE +#define EENTRY(y) _EENTRY(_C_LABEL(y)); _PROF_PROLOGUE #define ENTRY_NP(y) _ENTRY(_C_LABEL(y)) +#define EENTRY_NP(y) _EENTRY(_C_LABEL(y)) #define END(y) _END(_C_LABEL(y)) +#define EEND(y) #define ASENTRY(y) _ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE +#define ASEENTRY(y) _EENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE #define ASENTRY_NP(y) _ENTRY(_ASM_LABEL(y)) +#define ASEENTRY_NP(y) _EENTRY(_ASM_LABEL(y)) #define ASEND(y) _END(_ASM_LABEL(y)) +#define ASEEND(y) #define ASMSTR .asciz Modified: stable/10/sys/libkern/arm/divsi3.S ============================================================================== --- stable/10/sys/libkern/arm/divsi3.S Mon Aug 11 01:22:10 2014 (r269795) +++ stable/10/sys/libkern/arm/divsi3.S Mon Aug 11 01:29:28 2014 (r269796) @@ -51,11 +51,11 @@ ENTRY_NP(__modsi3) RET END(__modsi3) +ENTRY_NP(__udivsi3) #ifdef __ARM_EABI__ -ENTRY_NP(__aeabi_uidiv) -ENTRY_NP(__aeabi_uidivmod) +EENTRY_NP(__aeabi_uidiv) +EENTRY_NP(__aeabi_uidivmod) #endif -ENTRY_NP(__udivsi3) .L_udivide: /* r0 = r0 / r1; r1 = r0 % r1 */ eor r0, r1, r0 eor r1, r0, r1 @@ -77,16 +77,16 @@ ENTRY_NP(__udivsi3) mov r1, #0 RET #ifdef __ARM_EABI__ -END(__aeabi_uidiv) -END(__aeabi_uidivmod) +EEND(__aeabi_uidiv) +EEND(__aeabi_uidivmod) #endif END(__udivsi3) +ENTRY_NP(__divsi3) #ifdef __ARM_EABI__ -ENTRY_NP(__aeabi_idiv) -ENTRY_NP(__aeabi_idivmod) +EENTRY_NP(__aeabi_idiv) +EENTRY_NP(__aeabi_idivmod) #endif -ENTRY_NP(__divsi3) .L_divide: /* r0 = r0 / r1; r1 = r0 % r1 */ eor r0, r1, r0 eor r1, r0, r1 @@ -401,8 +401,8 @@ ENTRY_NP(__divsi3) mov r0, r3 RET #ifdef __ARM_EABI__ -END(__aeabi_idiv) -END(__aeabi_idivmod) +EEND(__aeabi_idiv) +EEND(__aeabi_idivmod) #endif END(__divsi3) From owner-svn-src-stable-10@FreeBSD.ORG Mon Aug 11 01:48:01 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5C53A1D5 for ; Mon, 11 Aug 2014 01:48:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3F033291B for ; Mon, 11 Aug 2014 01:48:01 +0000 (UTC) Received: from ian (uid 1311) (envelope-from ian@FreeBSD.org) id 2928 by svn.freebsd.org (DragonFly Mail Agent v0.9+); Mon, 11 Aug 2014 01:48:00 +0000 From: Ian Lepore Date: Mon, 11 Aug 2014 01:48:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269797 - in stable/10: contrib/binutils/gas/config sys/arm/ti X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53e820d1.2928.482367bc@svn.freebsd.org> X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Aug 2014 01:48:01 -0000 Author: ian Date: Mon Aug 11 01:48:00 2014 New Revision: 269797 URL: http://svnweb.freebsd.org/changeset/base/269797 Log: MFC r269393, r269394, r269395: Fix parsing of arch extensions in binutils/gas. Use ".arch_extension sec" when compiling ARM TI code that uses the security extensions. Modified: stable/10/contrib/binutils/gas/config/tc-arm.c stable/10/sys/arm/ti/ti_smc.S Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/binutils/gas/config/tc-arm.c ============================================================================== --- stable/10/contrib/binutils/gas/config/tc-arm.c Mon Aug 11 01:29:28 2014 (r269796) +++ stable/10/contrib/binutils/gas/config/tc-arm.c Mon Aug 11 01:48:00 2014 (r269797) @@ -3837,6 +3837,7 @@ s_arm_eabi_attribute (int ignored ATTRIB #endif /* OBJ_ELF */ static void s_arm_arch (int); +static void s_arm_arch_extension (int); static void s_arm_object_arch (int); static void s_arm_cpu (int); static void s_arm_fpu (int); @@ -3891,6 +3892,7 @@ const pseudo_typeS md_pseudo_table[] = { "syntax", s_syntax, 0 }, { "cpu", s_arm_cpu, 0 }, { "arch", s_arm_arch, 0 }, + { "arch_extension", s_arm_arch_extension, 0 }, { "object_arch", s_arm_object_arch, 0 }, { "fpu", s_arm_fpu, 0 }, #ifdef OBJ_ELF @@ -20154,6 +20156,7 @@ static const struct arm_option_cpu_value {"xscale", ARM_FEATURE (0, ARM_CEXT_XSCALE)}, {"iwmmxt", ARM_FEATURE (0, ARM_CEXT_IWMMXT)}, {"iwmmxt2", ARM_FEATURE (0, ARM_CEXT_IWMMXT2)}, + {"sec", ARM_FEATURE (ARM_EXT_V6Z, 0)}, {NULL, ARM_ARCH_NONE} }; @@ -20337,7 +20340,7 @@ arm_parse_arch (char * str) } for (opt = arm_archs; opt->name != NULL; opt++) - if (streq (opt->name, str)) + if (strncmp (opt->name, str, optlen) == 0) { march_cpu_opt = &opt->value; march_fpu_opt = &opt->default_fpu; @@ -20738,6 +20741,34 @@ s_arm_arch (int ignored ATTRIBUTE_UNUSED ignore_rest_of_line (); } +/* Parse a .arch_extension directive. */ + +static void +s_arm_arch_extension (int ignored ATTRIBUTE_UNUSED) +{ + const struct arm_option_cpu_value_table *opt; + char saved_char; + char *name; + + name = input_line_pointer; + while (*input_line_pointer && !ISSPACE(*input_line_pointer)) + input_line_pointer++; + saved_char = *input_line_pointer; + *input_line_pointer = 0; + + for (opt = arm_extensions; opt->name != NULL; opt++) + if (streq (opt->name, name)) + { + ARM_MERGE_FEATURE_SETS (cpu_variant, cpu_variant, opt->value); + *input_line_pointer = saved_char; + demand_empty_rest_of_line (); + return; + } + + as_bad (_("unknown architecture `%s'\n"), name); + *input_line_pointer = saved_char; + ignore_rest_of_line (); +} /* Parse a .object_arch directive. */ Modified: stable/10/sys/arm/ti/ti_smc.S ============================================================================== --- stable/10/sys/arm/ti/ti_smc.S Mon Aug 11 01:29:28 2014 (r269796) +++ stable/10/sys/arm/ti/ti_smc.S Mon Aug 11 01:48:00 2014 (r269797) @@ -26,7 +26,8 @@ #include __FBSDID("$FreeBSD$"); -.arch armv7a + .arch armv7a + .arch_extension sec /* Issue a smc #0 call */ /* r0 and r1 contains the eventual arguments, r2 contains the function ID */ From owner-svn-src-stable-10@FreeBSD.ORG Mon Aug 11 02:20:25 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0B998744 for ; Mon, 11 Aug 2014 02:20:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E87C62B86 for ; Mon, 11 Aug 2014 02:20:24 +0000 (UTC) Received: from ian (uid 1311) (envelope-from ian@FreeBSD.org) id 23cf by svn.freebsd.org (DragonFly Mail Agent v0.9+); Mon, 11 Aug 2014 02:20:24 +0000 From: Ian Lepore Date: Mon, 11 Aug 2014 02:20:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269798 - in stable/10/sys: arm/include cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53e82868.23cf.4075296f@svn.freebsd.org> X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Aug 2014 02:20:25 -0000 Author: ian Date: Mon Aug 11 02:20:24 2014 New Revision: 269798 URL: http://svnweb.freebsd.org/changeset/base/269798 Log: MFC r269403, r269405, r269410, r269414: Add 64-bit atomic ops for armv6, and also for armv4 only in kernel code. Use the new ops in the cddl code (and avoid defining functions with the same names locally). Modified: stable/10/sys/arm/include/atomic.h stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c stable/10/sys/cddl/compat/opensolaris/sys/atomic.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/include/atomic.h ============================================================================== --- stable/10/sys/arm/include/atomic.h Mon Aug 11 01:48:00 2014 (r269797) +++ stable/10/sys/arm/include/atomic.h Mon Aug 11 02:20:24 2014 (r269798) @@ -88,6 +88,8 @@ defined (__ARM_ARCH_6T2__) || \ defined (__ARM_ARCH_6Z__) || \ defined (__ARM_ARCH_6ZK__) +#define ARM_HAVE_ATOMIC64 + static __inline void __do_dmb(void) { @@ -146,6 +148,28 @@ atomic_set_32(volatile uint32_t *address } static __inline void +atomic_set_64(volatile uint64_t *p, uint64_t val) +{ + uint64_t tmp; + uint32_t exflag; + + __asm __volatile( + "1: \n" + " ldrexd %[tmp], [%[ptr]]\n" + " orr %Q[tmp], %Q[val]\n" + " orr %R[tmp], %R[val]\n" + " strexd %[exf], %[tmp], [%[ptr]]\n" + " teq %[exf], #0\n" + " it ne \n" + " bne 1b\n" + : [exf] "=&r" (exflag), + [tmp] "=&r" (tmp) + : [ptr] "r" (p), + [val] "r" (val) + : "cc", "memory"); +} + +static __inline void atomic_set_long(volatile u_long *address, u_long setmask) { u_long tmp = 0, tmp2 = 0; @@ -177,6 +201,28 @@ atomic_clear_32(volatile uint32_t *addre } static __inline void +atomic_clear_64(volatile uint64_t *p, uint64_t val) +{ + uint64_t tmp; + uint32_t exflag; + + __asm __volatile( + "1: \n" + " ldrexd %[tmp], [%[ptr]]\n" + " bic %Q[tmp], %Q[val]\n" + " bic %R[tmp], %R[val]\n" + " strexd %[exf], %[tmp], [%[ptr]]\n" + " teq %[exf], #0\n" + " it ne \n" + " bne 1b\n" + : [exf] "=&r" (exflag), + [tmp] "=&r" (tmp) + : [ptr] "r" (p), + [val] "r" (val) + : "cc", "memory"); +} + +static __inline void atomic_clear_long(volatile u_long *address, u_long setmask) { u_long tmp = 0, tmp2 = 0; @@ -213,6 +259,35 @@ atomic_cmpset_32(volatile u_int32_t *p, return (ret); } +static __inline int +atomic_cmpset_64(volatile uint64_t *p, uint64_t cmpval, uint64_t newval) +{ + uint64_t tmp; + uint32_t ret; + + __asm __volatile( + "1: \n" + " ldrexd %[tmp], [%[ptr]]\n" + " teq %Q[tmp], %Q[cmp]\n" + " itee eq \n" + " teqeq %R[tmp], %R[cmp]\n" + " movne %[ret], #0\n" + " bne 2f\n" + " strexd %[ret], %[new], [%[ptr]]\n" + " teq %[ret], #0\n" + " it ne \n" + " bne 1b\n" + " mov %[ret], #1\n" + "2: \n" + : [ret] "=&r" (ret), + [tmp] "=&r" (tmp) + : [ptr] "r" (p), + [cmp] "r" (cmpval), + [new] "r" (newval) + : "cc", "memory"); + return (ret); +} + static __inline u_long atomic_cmpset_long(volatile u_long *p, volatile u_long cmpval, volatile u_long newval) { @@ -244,6 +319,15 @@ atomic_cmpset_acq_32(volatile u_int32_t return (ret); } +static __inline uint64_t +atomic_cmpset_acq_64(volatile uint64_t *p, volatile uint64_t cmpval, volatile uint64_t newval) +{ + uint64_t ret = atomic_cmpset_64(p, cmpval, newval); + + __do_dmb(); + return (ret); +} + static __inline u_long atomic_cmpset_acq_long(volatile u_long *p, volatile u_long cmpval, volatile u_long newval) { @@ -261,6 +345,14 @@ atomic_cmpset_rel_32(volatile u_int32_t return (atomic_cmpset_32(p, cmpval, newval)); } +static __inline uint64_t +atomic_cmpset_rel_64(volatile uint64_t *p, volatile uint64_t cmpval, volatile uint64_t newval) +{ + + __do_dmb(); + return (atomic_cmpset_64(p, cmpval, newval)); +} + static __inline u_long atomic_cmpset_rel_long(volatile u_long *p, volatile u_long cmpval, volatile u_long newval) { @@ -286,6 +378,28 @@ atomic_add_32(volatile u_int32_t *p, u_i } static __inline void +atomic_add_64(volatile uint64_t *p, uint64_t val) +{ + uint64_t tmp; + uint32_t exflag; + + __asm __volatile( + "1: \n" + " ldrexd %[tmp], [%[ptr]]\n" + " adds %Q[tmp], %Q[val]\n" + " adc %R[tmp], %R[val]\n" + " strexd %[exf], %[tmp], [%[ptr]]\n" + " teq %[exf], #0\n" + " it ne \n" + " bne 1b\n" + : [exf] "=&r" (exflag), + [tmp] "=&r" (tmp) + : [ptr] "r" (p), + [val] "r" (val) + : "cc", "memory"); +} + +static __inline void atomic_add_long(volatile u_long *p, u_long val) { u_long tmp = 0, tmp2 = 0; @@ -316,6 +430,28 @@ atomic_subtract_32(volatile u_int32_t *p } static __inline void +atomic_subtract_64(volatile uint64_t *p, uint64_t val) +{ + uint64_t tmp; + uint32_t exflag; + + __asm __volatile( + "1: \n" + " ldrexd %[tmp], [%[ptr]]\n" + " subs %Q[tmp], %Q[val]\n" + " sbc %R[tmp], %R[val]\n" + " strexd %[exf], %[tmp], [%[ptr]]\n" + " teq %[exf], #0\n" + " it ne \n" + " bne 1b\n" + : [exf] "=&r" (exflag), + [tmp] "=&r" (tmp) + : [ptr] "r" (p), + [val] "r" (val) + : "cc", "memory"); +} + +static __inline void atomic_subtract_long(volatile u_long *p, u_long val) { u_long tmp = 0, tmp2 = 0; @@ -334,6 +470,10 @@ ATOMIC_ACQ_REL(clear, 32) ATOMIC_ACQ_REL(add, 32) ATOMIC_ACQ_REL(subtract, 32) ATOMIC_ACQ_REL(set, 32) +ATOMIC_ACQ_REL(clear, 64) +ATOMIC_ACQ_REL(add, 64) +ATOMIC_ACQ_REL(subtract, 64) +ATOMIC_ACQ_REL(set, 64) ATOMIC_ACQ_REL_LONG(clear) ATOMIC_ACQ_REL_LONG(add) ATOMIC_ACQ_REL_LONG(subtract) @@ -392,6 +532,116 @@ atomic_store_rel_32(volatile uint32_t *p *p = v; } +static __inline uint64_t +atomic_fetchadd_64(volatile uint64_t *p, uint64_t val) +{ + uint64_t ret, tmp; + uint32_t exflag; + + __asm __volatile( + "1: \n" + " ldrexd %[ret], [%[ptr]]\n" + " adds %Q[tmp], %Q[ret], %Q[val]\n" + " adc %R[tmp], %R[ret], %R[val]\n" + " strexd %[exf], %[tmp], [%[ptr]]\n" + " teq %[exf], #0\n" + " it ne \n" + " bne 1b\n" + : [ret] "=&r" (ret), + [exf] "=&r" (exflag), + [tmp] "=&r" (tmp) + : [ptr] "r" (p), + [val] "r" (val) + : "cc", "memory"); + return (ret); +} + +static __inline uint64_t +atomic_readandclear_64(volatile uint64_t *p) +{ + uint64_t ret, tmp; + uint32_t exflag; + + __asm __volatile( + "1: \n" + " ldrexd %[ret], [%[ptr]]\n" + " mov %Q[tmp], #0\n" + " mov %R[tmp], #0\n" + " strexd %[exf], %[tmp], [%[ptr]]\n" + " teq %[exf], #0\n" + " it ne \n" + " bne 1b\n" + : [ret] "=&r" (ret), + [exf] "=&r" (exflag), + [tmp] "=&r" (tmp) + : [ptr] "r" (p) + : "cc", "memory"); + return (ret); +} + +static __inline uint64_t +atomic_load_64(volatile uint64_t *p) +{ + uint64_t ret; + + /* + * The only way to atomically load 64 bits is with LDREXD which puts the + * exclusive monitor into the open state, so reset it with CLREX because + * we don't actually need to store anything. + */ + __asm __volatile( + "1: \n" + " ldrexd %[ret], [%[ptr]]\n" + " clrex \n" + : [ret] "=&r" (ret) + : [ptr] "r" (p) + : "cc", "memory"); + return (ret); +} + +static __inline uint64_t +atomic_load_acq_64(volatile uint64_t *p) +{ + uint64_t ret; + + ret = atomic_load_64(p); + __do_dmb(); + return (ret); +} + +static __inline void +atomic_store_64(volatile uint64_t *p, uint64_t val) +{ + uint64_t tmp; + uint32_t exflag; + + /* + * The only way to atomically store 64 bits is with STREXD, which will + * succeed only if paired up with a preceeding LDREXD using the same + * address, so we read and discard the existing value before storing. + */ + __asm __volatile( + "1: \n" + " ldrexd %[tmp], [%[ptr]]\n" + " strexd %[exf], %[val], [%[ptr]]\n" + " teq %[exf], #0\n" + " it ne \n" + " bne 1b\n" + : [tmp] "=&r" (tmp), + [exf] "=&r" (exflag) + : [ptr] "r" (p), + [val] "r" (val) + : "cc", "memory"); +} + +static __inline void +atomic_store_rel_64(volatile uint64_t *p, uint64_t val) +{ + + __do_dmb(); + atomic_store_64(p, val); +} + static __inline u_long atomic_fetchadd_long(volatile u_long *p, u_long val) { @@ -474,6 +724,8 @@ __swp(uint32_t val, volatile uint32_t *p #ifdef _KERNEL +#define ARM_HAVE_ATOMIC64 + static __inline void atomic_set_32(volatile uint32_t *address, uint32_t setmask) { @@ -481,11 +733,23 @@ atomic_set_32(volatile uint32_t *address } static __inline void +atomic_set_64(volatile uint64_t *address, uint64_t setmask) +{ + __with_interrupts_disabled(*address |= setmask); +} + +static __inline void atomic_clear_32(volatile uint32_t *address, uint32_t clearmask) { __with_interrupts_disabled(*address &= ~clearmask); } +static __inline void +atomic_clear_64(volatile uint64_t *address, uint64_t clearmask) +{ + __with_interrupts_disabled(*address &= ~clearmask); +} + static __inline u_int32_t atomic_cmpset_32(volatile u_int32_t *p, volatile u_int32_t cmpval, volatile u_int32_t newval) { @@ -503,6 +767,23 @@ atomic_cmpset_32(volatile u_int32_t *p, return (ret); } +static __inline u_int64_t +atomic_cmpset_64(volatile u_int64_t *p, volatile u_int64_t cmpval, volatile u_int64_t newval) +{ + int ret; + + __with_interrupts_disabled( + { + if (*p == cmpval) { + *p = newval; + ret = 1; + } else { + ret = 0; + } + }); + return (ret); +} + static __inline void atomic_add_32(volatile u_int32_t *p, u_int32_t val) { @@ -510,11 +791,23 @@ atomic_add_32(volatile u_int32_t *p, u_i } static __inline void +atomic_add_64(volatile u_int64_t *p, u_int64_t val) +{ + __with_interrupts_disabled(*p += val); +} + +static __inline void atomic_subtract_32(volatile u_int32_t *p, u_int32_t val) { __with_interrupts_disabled(*p -= val); } +static __inline void +atomic_subtract_64(volatile u_int64_t *p, u_int64_t val) +{ + __with_interrupts_disabled(*p -= val); +} + static __inline uint32_t atomic_fetchadd_32(volatile uint32_t *p, uint32_t v) { @@ -528,6 +821,34 @@ atomic_fetchadd_32(volatile uint32_t *p, return (value); } +static __inline uint64_t +atomic_fetchadd_64(volatile uint64_t *p, uint64_t v) +{ + uint64_t value; + + __with_interrupts_disabled( + { + value = *p; + *p += v; + }); + return (value); +} + +static __inline uint64_t +atomic_load_64(volatile uint64_t *p) +{ + uint64_t value; + + __with_interrupts_disabled(value = *p); + return (value); +} + +static __inline void +atomic_store_64(volatile uint64_t *p, uint64_t value) +{ + __with_interrupts_disabled(*p = value); +} + #else /* !_KERNEL */ static __inline u_int32_t Modified: stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c ============================================================================== --- stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c Mon Aug 11 01:48:00 2014 (r269797) +++ stable/10/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c Mon Aug 11 02:20:24 2014 (r269798) @@ -52,7 +52,7 @@ atomic_init(void) } #endif -#if !defined(__LP64__) && !defined(__mips_n32) +#if !defined(__LP64__) && !defined(__mips_n32) && !defined(ARM_HAVE_ATOMIC64) void atomic_add_64(volatile uint64_t *target, int64_t delta) { Modified: stable/10/sys/cddl/compat/opensolaris/sys/atomic.h ============================================================================== --- stable/10/sys/cddl/compat/opensolaris/sys/atomic.h Mon Aug 11 01:48:00 2014 (r269797) +++ stable/10/sys/cddl/compat/opensolaris/sys/atomic.h Mon Aug 11 02:20:24 2014 (r269798) @@ -36,7 +36,7 @@ atomic_cmpset_ptr((volatile uintptr_t *)(_a), (uintptr_t)(_b), (uintptr_t) (_c)) #define cas32 atomic_cmpset_32 -#if !defined(__LP64__) && !defined(__mips_n32) +#if !defined(__LP64__) && !defined(__mips_n32) && !defined(ARM_HAVE_ATOMIC64) extern void atomic_add_64(volatile uint64_t *target, int64_t delta); extern void atomic_dec_64(volatile uint64_t *target); #endif @@ -85,7 +85,7 @@ atomic_dec_32_nv(volatile uint32_t *targ return (atomic_fetchadd_32(target, -1) - 1); } -#if defined(__LP64__) || defined(__mips_n32) +#if defined(__LP64__) || defined(__mips_n32) || defined(ARM_HAVE_ATOMIC64) static __inline void atomic_dec_64(volatile uint64_t *target) { From owner-svn-src-stable-10@FreeBSD.ORG Mon Aug 11 06:54:08 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1060F5E7 for ; Mon, 11 Aug 2014 06:54:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB0AF2695 for ; Mon, 11 Aug 2014 06:54:07 +0000 (UTC) Received: from delphij (uid 1035) (envelope-from delphij@FreeBSD.org) id 2851 by svn.freebsd.org (DragonFly Mail Agent v0.9+); Mon, 11 Aug 2014 06:54:07 +0000 From: Xin LI Date: Mon, 11 Aug 2014 06:54:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269800 - stable/10/sbin/ping6 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53e8688f.2851.32479e23@svn.freebsd.org> X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Aug 2014 06:54:08 -0000 Author: delphij Date: Mon Aug 11 06:54:07 2014 New Revision: 269800 URL: http://svnweb.freebsd.org/changeset/base/269800 Log: MFC r269180: When interval is set to very small value with limited amount of packets, ping6(8) would quit before the remote side gets a chance to respond. Solve this by resetting the itimer when we have reached the maximum packet number have reached, but let the other handling to continue. PR: bin/151023 Submitted by: tjmao at tjmao.net Modified: stable/10/sbin/ping6/ping6.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/ping6/ping6.c ============================================================================== --- stable/10/sbin/ping6/ping6.c Mon Aug 11 03:04:16 2014 (r269799) +++ stable/10/sbin/ping6/ping6.c Mon Aug 11 06:54:07 2014 (r269800) @@ -1090,8 +1090,14 @@ main(int argc, char *argv[]) /* signal handling */ if (seenalrm) { /* last packet sent, timeout reached? */ - if (npackets && ntransmitted >= npackets) - break; + if (npackets && ntransmitted >= npackets) { + struct timeval zerotime = {0, 0}; + itimer.it_value = zerotime; + itimer.it_interval = zerotime; + (void)setitimer(ITIMER_REAL, &itimer, NULL); + seenalrm = 0; /* clear flag */ + continue; + } retransmit(); seenalrm = 0; continue; From owner-svn-src-stable-10@FreeBSD.ORG Mon Aug 11 08:58:36 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A1834E09 for ; Mon, 11 Aug 2014 08:58:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8FBA3256B for ; Mon, 11 Aug 2014 08:58:36 +0000 (UTC) Received: from smh (uid 1306) (envelope-from smh@FreeBSD.org) id 29e9 by svn.freebsd.org (DragonFly Mail Agent v0.9+); Mon, 11 Aug 2014 08:58:36 +0000 From: Steven Hartland Date: Mon, 11 Aug 2014 08:58:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269805 - stable/10/usr.sbin/jail X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53e885bc.29e9.5339cb6e@svn.freebsd.org> X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Aug 2014 08:58:36 -0000 Author: smh Date: Mon Aug 11 08:58:35 2014 New Revision: 269805 URL: http://svnweb.freebsd.org/changeset/base/269805 Log: MFC r269522 Added support for extra ifconfig args to jail ip4.addr & ip6.addr params This allows for CARP interfaces to be used in jails e.g. ip4.addr = "em0|10.10.1.20/32 vhid 1 pass MyPass advskew 100" r269340 will not be MFC'ed as mentioned due to the slim window and the amount of additional commits required to support it. Sponsored by: Multiplay Modified: stable/10/usr.sbin/jail/command.c stable/10/usr.sbin/jail/config.c stable/10/usr.sbin/jail/jail.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/jail/command.c ============================================================================== --- stable/10/usr.sbin/jail/command.c Mon Aug 11 07:04:08 2014 (r269804) +++ stable/10/usr.sbin/jail/command.c Mon Aug 11 08:58:35 2014 (r269805) @@ -268,7 +268,7 @@ run_command(struct cfjail *j) pid_t pid; int argc, bg, clean, consfd, down, fib, i, injail, sjuser, timeout; #if defined(INET) || defined(INET6) - char *addr; + char *addr, *extrap, *p, *val; #endif static char *cleanenv; @@ -317,16 +317,30 @@ run_command(struct cfjail *j) switch (comparam) { #ifdef INET case IP__IP4_IFADDR: - argv = alloca(8 * sizeof(char *)); + argc = 0; + val = alloca(strlen(comstring->s) + 1); + strcpy(val, comstring->s); + cs = val; + extrap = NULL; + while ((p = strchr(cs, ' ')) != NULL && strlen(p) > 1) { + if (extrap == NULL) { + *p = '\0'; + extrap = p + 1; + } + cs = p + 1; + argc++; + } + + argv = alloca((8 + argc) * sizeof(char *)); *(const char **)&argv[0] = _PATH_IFCONFIG; - if ((cs = strchr(comstring->s, '|'))) { - argv[1] = alloca(cs - comstring->s + 1); - strlcpy(argv[1], comstring->s, cs - comstring->s + 1); + if ((cs = strchr(val, '|'))) { + argv[1] = alloca(cs - val + 1); + strlcpy(argv[1], val, cs - val + 1); addr = cs + 1; } else { *(const char **)&argv[1] = string_param(j->intparams[IP_INTERFACE]); - addr = comstring->s; + addr = val; } *(const char **)&argv[2] = "inet"; if (!(cs = strchr(addr, '/'))) { @@ -344,6 +358,15 @@ run_command(struct cfjail *j) argv[3] = addr; argc = 4; } + + if (!down) { + for (cs = strtok(extrap, " "); cs; cs = strtok(NULL, " ")) { + size_t len = strlen(cs) + 1; + argv[argc] = alloca(len); + strlcpy(argv[argc++], cs, len); + } + } + *(const char **)&argv[argc] = down ? "-alias" : "alias"; argv[argc + 1] = NULL; break; @@ -351,16 +374,30 @@ run_command(struct cfjail *j) #ifdef INET6 case IP__IP6_IFADDR: - argv = alloca(8 * sizeof(char *)); + argc = 0; + val = alloca(strlen(comstring->s) + 1); + strcpy(val, comstring->s); + cs = val; + extrap = NULL; + while ((p = strchr(cs, ' ')) != NULL && strlen(p) > 1) { + if (extrap == NULL) { + *p = '\0'; + extrap = p + 1; + } + cs = p + 1; + argc++; + } + + argv = alloca((8 + argc) * sizeof(char *)); *(const char **)&argv[0] = _PATH_IFCONFIG; - if ((cs = strchr(comstring->s, '|'))) { - argv[1] = alloca(cs - comstring->s + 1); - strlcpy(argv[1], comstring->s, cs - comstring->s + 1); + if ((cs = strchr(val, '|'))) { + argv[1] = alloca(cs - val + 1); + strlcpy(argv[1], val, cs - val + 1); addr = cs + 1; } else { *(const char **)&argv[1] = string_param(j->intparams[IP_INTERFACE]); - addr = comstring->s; + addr = val; } *(const char **)&argv[2] = "inet6"; argv[3] = addr; @@ -370,6 +407,15 @@ run_command(struct cfjail *j) argc = 6; } else argc = 4; + + if (!down) { + for (cs = strtok(extrap, " "); cs; cs = strtok(NULL, " ")) { + size_t len = strlen(cs) + 1; + argv[argc] = alloca(len); + strlcpy(argv[argc++], cs, len); + } + } + *(const char **)&argv[argc] = down ? "-alias" : "alias"; argv[argc + 1] = NULL; break; Modified: stable/10/usr.sbin/jail/config.c ============================================================================== --- stable/10/usr.sbin/jail/config.c Mon Aug 11 07:04:08 2014 (r269804) +++ stable/10/usr.sbin/jail/config.c Mon Aug 11 08:58:35 2014 (r269805) @@ -576,7 +576,9 @@ check_intparams(struct cfjail *j) /* * IP addresses may include an interface to set that address on, - * and a netmask/suffix for that address. + * a netmask/suffix for that address and options for ifconfig. + * These are copied to an internal command parameter and then stripped + * so they won't be passed on to jailparam_set. */ defif = string_param(j->intparams[IP_INTERFACE]) != NULL; #ifdef INET @@ -601,6 +603,10 @@ check_intparams(struct cfjail *j) *cs = '\0'; s->len = cs - s->s; } + if ((cs = strchr(s->s, ' ')) != NULL) { + *cs = '\0'; + s->len = cs - s->s; + } } } #endif @@ -625,6 +631,10 @@ check_intparams(struct cfjail *j) *cs = '\0'; s->len = cs - s->s; } + if ((cs = strchr(s->s, ' ')) != NULL) { + *cs = '\0'; + s->len = cs - s->s; + } } } #endif Modified: stable/10/usr.sbin/jail/jail.8 ============================================================================== --- stable/10/usr.sbin/jail/jail.8 Mon Aug 11 07:04:08 2014 (r269804) +++ stable/10/usr.sbin/jail/jail.8 Mon Aug 11 08:58:35 2014 (r269805) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 12, 2013 +.Dd August 4, 2014 .Dt JAIL 8 .Os .Sh NAME @@ -684,17 +684,23 @@ prison is created, and will be removed f prison is removed. .It Va ip4.addr In addition to the IP addresses that are passed to the kernel, and -interface and/or a netmask may also be specified, in the form -.Dq Ar interface Ns | Ns Ar ip-address Ns / Ns Ar netmask . +interface, netmask and additional paramters (as supported by +.Xr ifconfig 8 Ns ) +may also be specified, in the form +.Dq Ar interface Ns | Ns Ar ip-address Ns / Ns Ar netmask param ... . If an interface is given before the IP address, an alias for the address will be added to that interface, as it is with the .Va interface parameter. If a netmask in either dotted-quad or CIDR form is given after IP address, it will be used when adding the IP alias. +If additional parameters are specified then they will also be used when +adding the IP alias. .It Va ip6.addr In addition to the IP addresses that are passed to the kernel, -and interface and/or a prefix may also be specified, in the form -.Dq Ar interface Ns | Ns Ar ip-address Ns / Ns Ar prefix . +an interface, prefix and additional parameters (as supported by +.Xr ifconfig 8 Ns ) +may also be specified, in the form +.Dq Ar interface Ns | Ns Ar ip-address Ns / Ns Ar prefix param ... . .It Va vnet.interface A network interface to give to a vnet-enabled jail after is it created. The interface will automatically be returned when the jail is removed. @@ -1172,6 +1178,7 @@ environment of the first jail. .Xr pkill 1 , .Xr ps 1 , .Xr quota 1 , +.Xr ifconfig 8 , .Xr jail_set 2 , .Xr devfs 5 , .Xr fdescfs 5 , From owner-svn-src-stable-10@FreeBSD.ORG Mon Aug 11 18:42:21 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5554B816 for ; Mon, 11 Aug 2014 18:42:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 42694221F for ; Mon, 11 Aug 2014 18:42:21 +0000 (UTC) Received: from imp (uid 547) (envelope-from imp@FreeBSD.org) id 2878 by svn.freebsd.org (DragonFly Mail Agent v0.9+); Mon, 11 Aug 2014 18:42:20 +0000 From: Warner Losh Date: Mon, 11 Aug 2014 18:42:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269825 - stable/10/usr.sbin/config X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53e90e8d.2878.29cbb502@svn.freebsd.org> X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Aug 2014 18:42:21 -0000 Author: imp Date: Mon Aug 11 18:42:20 2014 New Revision: 269825 URL: http://svnweb.freebsd.org/changeset/base/269825 Log: MFC: Merge in the changes in -current: Support ! operator in "files" files. Improve error detection and reporting Cleanup code to make it easier to maintain. Remove mandatory keyword: it has been used for 17 years. Bump version number (we should have bumped for -I too, but didn't) r261501 | imp | 2014-02-04 17:26:11 -0700 (Tue, 04 Feb 2014) | 5 lines Fix ! by not clearing not at the bottom of the loop. Add a blank line Submitted by: bde (blank line) r261493 | imp | 2014-02-04 11:28:58 -0700 (Tue, 04 Feb 2014) | 5 lines Implement the '!' operator for files* files. It means 'include this only if the specified option is NOT specified.' Bump version because old config won't be able to cope with files* files that have this construct in them. r261446 | imp | 2014-02-03 12:14:36 -0700 (Mon, 03 Feb 2014) | 5 lines Convert the loop by gotos into a for loop to improve readability. I did this only with the inner loop for the token parsing, and not the outer loop which was understandable enough when the extra layers of looping went away... r261445 | imp | 2014-02-03 12:10:33 -0700 (Mon, 03 Feb 2014) | 4 lines Fix a bug introduced in r261437 that failed to honor "optional profiling-routine" to work, since profiling-routine is not really an option or a device, but a special case elsewhere in the code. r261444 | imp | 2014-02-03 11:56:41 -0700 (Mon, 03 Feb 2014) | 2 lines Slight cleanup to the error messaging to compress code vertically... r261442 | imp | 2014-02-03 11:31:51 -0700 (Mon, 03 Feb 2014) | 2 lines Better error messages when EOF is hit in the middle of a phrase. r261438 | imp | 2014-02-03 09:54:53 -0700 (Mon, 03 Feb 2014) | 5 lines Move the check for standard keyword + optional inclusion specifier to its proper location. Otherwise you could have 'file.c standard pci' without an error. This construct isn't in our tree, and has no well defined meaning. r261437 | imp | 2014-02-03 09:47:10 -0700 (Mon, 03 Feb 2014) | 4 lines Don't believe we have a requirement until after we've checked all the known key words. This will make error messages slightly better in weird corner cases, but should otherwise be a nop. r261436 | imp | 2014-02-03 09:46:01 -0700 (Mon, 03 Feb 2014) | 3 lines In the 17 years since r30796, the mandatory keyword has never been used in any files as far as I can tell, and is currently unused. Retire it. r261435 | imp | 2014-02-03 08:10:44 -0700 (Mon, 03 Feb 2014) | 6 lines Slightly deobfuscate read_file() and likely pessimize the runtime performance by epsilon. (Translation: elminate bogus macros that hid 'returns' making it hard to read and moved a block of code inline rather than at the end of the fuction where it was effectively a 'gosub' kind of goto). Modified: stable/10/usr.sbin/config/configvers.h stable/10/usr.sbin/config/mkmakefile.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/config/configvers.h ============================================================================== --- stable/10/usr.sbin/config/configvers.h Mon Aug 11 18:26:57 2014 (r269824) +++ stable/10/usr.sbin/config/configvers.h Mon Aug 11 18:42:20 2014 (r269825) @@ -49,5 +49,5 @@ * * $FreeBSD$ */ -#define CONFIGVERS 600012 +#define CONFIGVERS 600013 #define MAJOR_VERS(x) ((x) / 100000) Modified: stable/10/usr.sbin/config/mkmakefile.c ============================================================================== --- stable/10/usr.sbin/config/mkmakefile.c Mon Aug 11 18:26:57 2014 (r269824) +++ stable/10/usr.sbin/config/mkmakefile.c Mon Aug 11 18:42:20 2014 (r269825) @@ -43,6 +43,7 @@ static const char rcsid[] = #include #include +#include #include #include #include @@ -50,21 +51,6 @@ static const char rcsid[] = #include "config.h" #include "configvers.h" -#define next_word(fp, wd) \ - { char *word = get_word(fp); \ - if (word == (char *)EOF) \ - return; \ - else \ - wd = word; \ - } -#define next_quoted_word(fp, wd) \ - { char *word = get_quoted_word(fp); \ - if (word == (char *)EOF) \ - return; \ - else \ - wd = word; \ - } - static char *tail(char *); static void do_clean(FILE *); static void do_rules(FILE *); @@ -74,6 +60,16 @@ static void do_before_depend(FILE *); static int opteq(const char *, const char *); static void read_files(void); +static void errout(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + exit(1); +} + /* * Lookup a file, by name. */ @@ -313,8 +309,8 @@ read_file(char *fname) struct opt *op; char *wd, *this, *compilewith, *depends, *clean, *warning; const char *objprefix; - int compile, match, nreqs, std, filetype, - imp_rule, no_obj, before_depend, mandatory, nowerror; + int compile, match, nreqs, std, filetype, not, + imp_rule, no_obj, before_depend, nowerror; fp = fopen(fname, "r"); if (fp == 0) @@ -322,7 +318,7 @@ read_file(char *fname) next: /* * include "filename" - * filename [ standard | mandatory | optional ] + * filename [ standard | optional ] * [ dev* [ | dev* ... ] | profiling-routine ] [ no-obj ] * [ compile-with "compile rule" [no-implicit-rule] ] * [ dependency "dependency-list"] [ before-depend ] @@ -343,12 +339,9 @@ next: goto next; } if (eq(wd, "include")) { - next_quoted_word(fp, wd); - if (wd == 0) { - fprintf(stderr, "%s: missing include filename.\n", - fname); - exit(1); - } + wd = get_quoted_word(fp); + if (wd == (char *)EOF || wd == 0) + errout("%s: missing include filename.\n", fname); (void) snprintf(ifname, sizeof(ifname), "../../%s", wd); read_file(ifname); while (((wd = get_word(fp)) != (char *)EOF) && wd) @@ -356,11 +349,11 @@ next: goto next; } this = ns(wd); - next_word(fp, wd); - if (wd == 0) { - fprintf(stderr, "%s: No type for %s.\n", fname, this); - exit(1); - } + wd = get_word(fp); + if (wd == (char *)EOF) + return; + if (wd == 0) + errout("%s: No type for %s.\n", fname, this); tp = fl_lookup(this); compile = 0; match = 1; @@ -369,186 +362,154 @@ next: depends = 0; clean = 0; warning = 0; - std = mandatory = 0; + std = 0; imp_rule = 0; no_obj = 0; before_depend = 0; nowerror = 0; + not = 0; filetype = NORMAL; objprefix = ""; - if (eq(wd, "standard")) { + if (eq(wd, "standard")) std = 1; - /* - * If an entry is marked "mandatory", config will abort if it's - * not called by a configuration line in the config file. Apart - * from this, the device is handled like one marked "optional". - */ - } else if (eq(wd, "mandatory")) { - mandatory = 1; - } else if (!eq(wd, "optional")) { - fprintf(stderr, - "%s: \"%s\" %s must be optional, mandatory or standard\n", + else if (!eq(wd, "optional")) + errout("%s: \"%s\" %s must be optional or standard\n", fname, wd, this); - exit(1); - } -nextparam: - next_word(fp, wd); - if (wd == 0) { - compile += match; - if (compile && tp == NULL) - goto doneparam; - goto next; - } - if (eq(wd, "|")) { - if (nreqs == 0) { - fprintf(stderr, "%s: syntax error describing %s\n", - fname, this); - exit(1); + for (wd = get_word(fp); wd; wd = get_word(fp)) { + if (wd == (char *)EOF) + return; + if (eq(wd, "!")) { + not = 1; + continue; + } + if (eq(wd, "|")) { + if (nreqs == 0) + errout("%s: syntax error describing %s\n", + fname, this); + if (not) + compile += !match; + else + compile += match; + match = 1; + nreqs = 0; + not = 0; + continue; + } + if (eq(wd, "no-obj")) { + no_obj++; + continue; + } + if (eq(wd, "no-implicit-rule")) { + if (compilewith == 0) + errout("%s: alternate rule required when " + "\"no-implicit-rule\" is specified for" + " %s.\n", + fname, this); + imp_rule++; + continue; + } + if (eq(wd, "before-depend")) { + before_depend++; + continue; + } + if (eq(wd, "dependency")) { + wd = get_quoted_word(fp); + if (wd == (char *)EOF || wd == 0) + errout("%s: %s missing dependency string.\n", + fname, this); + depends = ns(wd); + continue; + } + if (eq(wd, "clean")) { + wd = get_quoted_word(fp); + if (wd == (char *)EOF || wd == 0) + errout("%s: %s missing clean file list.\n", + fname, this); + clean = ns(wd); + continue; + } + if (eq(wd, "compile-with")) { + wd = get_quoted_word(fp); + if (wd == (char *)EOF || wd == 0) + errout("%s: %s missing compile command string.\n", + fname, this); + compilewith = ns(wd); + continue; + } + if (eq(wd, "warning")) { + wd = get_quoted_word(fp); + if (wd == (char *)EOF || wd == 0) + errout("%s: %s missing warning text string.\n", + fname, this); + warning = ns(wd); + continue; + } + if (eq(wd, "obj-prefix")) { + wd = get_quoted_word(fp); + if (wd == (char *)EOF || wd == 0) + errout("%s: %s missing object prefix string.\n", + fname, this); + objprefix = ns(wd); + continue; + } + if (eq(wd, "nowerror")) { + nowerror = 1; + continue; } + if (eq(wd, "local")) { + filetype = LOCAL; + continue; + } + if (eq(wd, "no-depend")) { + filetype = NODEPEND; + continue; + } + nreqs++; + if (eq(wd, "profiling-routine")) { + filetype = PROFILING; + continue; + } + if (std) + errout("standard entry %s has optional inclusion specifier %s!\n", + this, wd); + STAILQ_FOREACH(dp, &dtab, d_next) + if (eq(dp->d_name, wd)) { + dp->d_done |= DEVDONE; + goto nextparam; + } + SLIST_FOREACH(op, &opt, op_next) + if (op->op_value == 0 && opteq(op->op_name, wd)) + goto nextparam; + match = 0; +nextparam:; + } + if (not) + compile += !match; + else compile += match; - match = 1; - nreqs = 0; - goto nextparam; - } - if (eq(wd, "no-obj")) { - no_obj++; - goto nextparam; + if (compile && tp == NULL) { + if (std == 0 && nreqs == 0) + errout("%s: what is %s optional on?\n", + fname, this); + if (filetype == PROFILING && profiling == 0) + goto next; + tp = new_fent(); + tp->f_fn = this; + tp->f_type = filetype; + if (imp_rule) + tp->f_flags |= NO_IMPLCT_RULE; + if (no_obj) + tp->f_flags |= NO_OBJ; + if (before_depend) + tp->f_flags |= BEFORE_DEPEND; + if (nowerror) + tp->f_flags |= NOWERROR; + tp->f_compilewith = compilewith; + tp->f_depends = depends; + tp->f_clean = clean; + tp->f_warn = warning; + tp->f_objprefix = objprefix; } - if (eq(wd, "no-implicit-rule")) { - if (compilewith == 0) { - fprintf(stderr, "%s: alternate rule required when " - "\"no-implicit-rule\" is specified.\n", - fname); - } - imp_rule++; - goto nextparam; - } - if (eq(wd, "before-depend")) { - before_depend++; - goto nextparam; - } - if (eq(wd, "dependency")) { - next_quoted_word(fp, wd); - if (wd == 0) { - fprintf(stderr, - "%s: %s missing dependency string.\n", - fname, this); - exit(1); - } - depends = ns(wd); - goto nextparam; - } - if (eq(wd, "clean")) { - next_quoted_word(fp, wd); - if (wd == 0) { - fprintf(stderr, "%s: %s missing clean file list.\n", - fname, this); - exit(1); - } - clean = ns(wd); - goto nextparam; - } - if (eq(wd, "compile-with")) { - next_quoted_word(fp, wd); - if (wd == 0) { - fprintf(stderr, - "%s: %s missing compile command string.\n", - fname, this); - exit(1); - } - compilewith = ns(wd); - goto nextparam; - } - if (eq(wd, "warning")) { - next_quoted_word(fp, wd); - if (wd == 0) { - fprintf(stderr, - "%s: %s missing warning text string.\n", - fname, this); - exit(1); - } - warning = ns(wd); - goto nextparam; - } - if (eq(wd, "obj-prefix")) { - next_quoted_word(fp, wd); - if (wd == 0) { - printf("%s: %s missing object prefix string.\n", - fname, this); - exit(1); - } - objprefix = ns(wd); - goto nextparam; - } - nreqs++; - if (eq(wd, "local")) { - filetype = LOCAL; - goto nextparam; - } - if (eq(wd, "no-depend")) { - filetype = NODEPEND; - goto nextparam; - } - if (eq(wd, "profiling-routine")) { - filetype = PROFILING; - goto nextparam; - } - if (eq(wd, "nowerror")) { - nowerror = 1; - goto nextparam; - } - STAILQ_FOREACH(dp, &dtab, d_next) - if (eq(dp->d_name, wd)) { - dp->d_done |= DEVDONE; - goto nextparam; - } - if (mandatory) { - fprintf(stderr, "%s: mandatory device \"%s\" not found\n", - fname, wd); - exit(1); - } - if (std) { - fprintf(stderr, - "standard entry %s has a device keyword - %s!\n", - this, wd); - exit(1); - } - SLIST_FOREACH(op, &opt, op_next) - if (op->op_value == 0 && opteq(op->op_name, wd)) - goto nextparam; - match = 0; - goto nextparam; - -doneparam: - if (std == 0 && nreqs == 0) { - fprintf(stderr, "%s: what is %s optional on?\n", - fname, this); - exit(1); - } - - if (wd) { - fprintf(stderr, "%s: syntax error describing %s\n", - fname, this); - exit(1); - } - if (filetype == PROFILING && profiling == 0) - goto next; - tp = new_fent(); - tp->f_fn = this; - tp->f_type = filetype; - if (imp_rule) - tp->f_flags |= NO_IMPLCT_RULE; - if (no_obj) - tp->f_flags |= NO_OBJ; - if (before_depend) - tp->f_flags |= BEFORE_DEPEND; - if (nowerror) - tp->f_flags |= NOWERROR; - tp->f_compilewith = compilewith; - tp->f_depends = depends; - tp->f_clean = clean; - tp->f_warn = warning; - tp->f_objprefix = objprefix; goto next; } From owner-svn-src-stable-10@FreeBSD.ORG Mon Aug 11 20:37:04 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9A6A1BFF for ; Mon, 11 Aug 2014 20:37:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6FA592106 for ; Mon, 11 Aug 2014 20:37:04 +0000 (UTC) Received: from dim (uid 1236) (envelope-from dim@FreeBSD.org) id 2ae0 by svn.freebsd.org (DragonFly Mail Agent v0.9+); Mon, 11 Aug 2014 20:37:04 +0000 From: Dimitry Andric Date: Mon, 11 Aug 2014 20:37:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269836 - in stable: 10/contrib/libc++/include 9/contrib/libc++/include X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53e92970.2ae0.4534a0a4@svn.freebsd.org> X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Aug 2014 20:37:04 -0000 Author: dim Date: Mon Aug 11 20:37:03 2014 New Revision: 269836 URL: http://svnweb.freebsd.org/changeset/base/269836 Log: MFC r269740: Pull in r214736 from upstream libc++ trunk (by Marshall Clow): Fix PR#20520 - predicate called too many times in list::remove_if. Add tests for list, forward_list, and the std::remove_if algorithm This fixes an issue where std::list<>::remove_if() and remove() could erroneously visit elements twice. Reported by: Dominic Fandrey PR: 192303 Modified: stable/10/contrib/libc++/include/list Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/9/contrib/libc++/include/list Directory Properties: stable/9/contrib/libc++/ (props changed) Modified: stable/10/contrib/libc++/include/list ============================================================================== --- stable/10/contrib/libc++/include/list Mon Aug 11 20:36:09 2014 (r269835) +++ stable/10/contrib/libc++/include/list Mon Aug 11 20:37:03 2014 (r269836) @@ -2046,6 +2046,8 @@ list<_Tp, _Alloc>::remove(const value_ty for (; __j != __e && *__j == __x; ++__j) ; __i = erase(__i, __j); + if (__i != __e) + __i = _VSTD::next(__i); } else ++__i; @@ -2065,6 +2067,8 @@ list<_Tp, _Alloc>::remove_if(_Pred __pre for (; __j != __e && __pred(*__j); ++__j) ; __i = erase(__i, __j); + if (__i != __e) + __i = _VSTD::next(__i); } else ++__i; From owner-svn-src-stable-10@FreeBSD.ORG Mon Aug 11 20:38:53 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 10824EB6 for ; Mon, 11 Aug 2014 20:38:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D978A2124 for ; Mon, 11 Aug 2014 20:38:52 +0000 (UTC) Received: from jlh (uid 1291) (envelope-from jlh@FreeBSD.org) id 2af8 by svn.freebsd.org (DragonFly Mail Agent v0.9+); Mon, 11 Aug 2014 20:38:52 +0000 From: Jeremie Le Hen Date: Mon, 11 Aug 2014 20:38:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269837 - stable/10/usr.bin/sed X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53e929dc.2af8.5dd58b3e@svn.freebsd.org> X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Aug 2014 20:38:53 -0000 Author: jlh Date: Mon Aug 11 20:38:52 2014 New Revision: 269837 URL: http://svnweb.freebsd.org/changeset/base/269837 Log: MFC r269302: Fix relative numerical addressing (addr,+N). As a bonus the patch untangles a bit the logic and makes the code easier to grasp. PR: 192108 Modified: stable/10/usr.bin/sed/process.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/sed/process.c ============================================================================== --- stable/10/usr.bin/sed/process.c Mon Aug 11 20:37:03 2014 (r269836) +++ stable/10/usr.bin/sed/process.c Mon Aug 11 20:38:52 2014 (r269837) @@ -288,24 +288,32 @@ applies(struct s_command *cp) r = 1; else if (cp->a2) if (cp->startline > 0) { - if (MATCH(cp->a2)) { - cp->startline = 0; - lastaddr = 1; - r = 1; - } else if (linenum - cp->startline <= cp->a2->u.l) - r = 1; - else if ((cp->a2->type == AT_LINE && - linenum > cp->a2->u.l) || - (cp->a2->type == AT_RELLINE && - linenum - cp->startline > cp->a2->u.l)) { - /* - * We missed the 2nd address due to a branch, - * so just close the range and return false. - */ - cp->startline = 0; - r = 0; - } else - r = 1; + switch (cp->a2->type) { + case AT_RELLINE: + if (linenum - cp->startline <= cp->a2->u.l) + r = 1; + else { + cp->startline = 0; + r = 0; + } + break; + default: + if (MATCH(cp->a2)) { + cp->startline = 0; + lastaddr = 1; + r = 1; + } else if (cp->a2->type == AT_LINE && + linenum > cp->a2->u.l) { + /* + * We missed the 2nd address due to a + * branch, so just close the range and + * return false. + */ + cp->startline = 0; + r = 0; + } else + r = 1; + } } else if (MATCH(cp->a1)) { /* * If the second address is a number less than or From owner-svn-src-stable-10@FreeBSD.ORG Tue Aug 12 00:53:05 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 601448CE for ; Tue, 12 Aug 2014 00:53:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 40CEB2BA4 for ; Tue, 12 Aug 2014 00:53:05 +0000 (UTC) Received: from delphij (uid 1035) (envelope-from delphij@FreeBSD.org) id 2aa0 by svn.freebsd.org (DragonFly Mail Agent v0.9+); Tue, 12 Aug 2014 00:53:03 +0000 From: Xin LI Date: Tue, 12 Aug 2014 00:53:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269845 - in stable/10: cddl/contrib/opensolaris/common/avl sys/cddl/contrib/opensolaris/common/avl sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/commo... X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53e9656f.2aa0.67bb7fd4@svn.freebsd.org> X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Aug 2014 00:53:05 -0000 Author: delphij Date: Tue Aug 12 00:53:03 2014 New Revision: 269845 URL: http://svnweb.freebsd.org/changeset/base/269845 Log: MFC r269229,269404,269466: MFV r269223: Change dn->dn_dbufs from linked list to AVL tree. Illumos issues: 4873 zvol unmap calls can take a very long time for larger datasets Modified: stable/10/cddl/contrib/opensolaris/common/avl/avl.c stable/10/sys/cddl/contrib/opensolaris/common/avl/avl.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/avl.h Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/common/avl/avl.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/common/avl/avl.c Mon Aug 11 22:43:44 2014 (r269844) +++ stable/10/cddl/contrib/opensolaris/common/avl/avl.c Tue Aug 12 00:53:03 2014 (r269845) @@ -24,6 +24,10 @@ */ /* + * Copyright (c) 2014 by Delphix. All rights reserved. + */ + +/* * AVL - generic AVL tree implementation for kernel use * * A complete description of AVL trees can be found in many CS textbooks. @@ -37,7 +41,7 @@ * insertion and deletion relatively efficiently. Searching the tree is * still a fast operation, roughly O(log(N)). * - * The key to insertion and deletion is a set of tree maniuplations called + * The key to insertion and deletion is a set of tree manipulations called * rotations, which bring unbalanced subtrees back into the semi-balanced state. * * This implementation of AVL trees has the following peculiarities: @@ -45,7 +49,7 @@ * - The AVL specific data structures are physically embedded as fields * in the "using" data structures. To maintain generality the code * must constantly translate between "avl_node_t *" and containing - * data structure "void *"s by adding/subracting the avl_offset. + * data structure "void *"s by adding/subtracting the avl_offset. * * - Since the AVL data is always embedded in other structures, there is * no locking or memory allocation in the AVL routines. This must be @@ -85,6 +89,12 @@ * is a modified "avl_node_t *". The bottom bit (normally 0 for a * pointer) is set to indicate if that the new node has a value greater * than the value of the indicated "avl_node_t *". + * + * Note - in addition to userland (e.g. libavl and libutil) and the kernel + * (e.g. genunix), avl.c is compiled into ld.so and kmdb's genunix module, + * which each have their own compilation environments and subsequent + * requirements. Each of these environments must be considered when adding + * dependencies from avl.c. */ #include @@ -94,7 +104,7 @@ #include /* - * Small arrays to translate between balance (or diff) values and child indeces. + * Small arrays to translate between balance (or diff) values and child indices. * * Code that deals with binary tree data structures will randomly use * left and right children when examining a tree. C "if()" statements @@ -114,7 +124,8 @@ static const int avl_balance2child[] = * * - If there is a left child, go to it, then to it's rightmost descendant. * - * - otherwise we return thru parent nodes until we've come from a right child. + * - otherwise we return through parent nodes until we've come from a right + * child. * * Return Value: * NULL - if at the end of the nodes @@ -863,6 +874,24 @@ avl_update(avl_tree_t *t, void *obj) return (B_FALSE); } +void +avl_swap(avl_tree_t *tree1, avl_tree_t *tree2) +{ + avl_node_t *temp_node; + ulong_t temp_numnodes; + + ASSERT3P(tree1->avl_compar, ==, tree2->avl_compar); + ASSERT3U(tree1->avl_offset, ==, tree2->avl_offset); + ASSERT3U(tree1->avl_size, ==, tree2->avl_size); + + temp_node = tree1->avl_root; + temp_numnodes = tree1->avl_numnodes; + tree1->avl_root = tree2->avl_root; + tree1->avl_numnodes = tree2->avl_numnodes; + tree2->avl_root = temp_node; + tree2->avl_numnodes = temp_numnodes; +} + /* * initialize a new AVL tree */ @@ -919,7 +948,7 @@ avl_is_empty(avl_tree_t *tree) /* * Post-order tree walk used to visit all tree nodes and destroy the tree - * in post order. This is used for destroying a tree w/o paying any cost + * in post order. This is used for destroying a tree without paying any cost * for rebalancing it. * * example: Modified: stable/10/sys/cddl/contrib/opensolaris/common/avl/avl.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/common/avl/avl.c Mon Aug 11 22:43:44 2014 (r269844) +++ stable/10/sys/cddl/contrib/opensolaris/common/avl/avl.c Tue Aug 12 00:53:03 2014 (r269845) @@ -24,6 +24,10 @@ */ /* + * Copyright (c) 2014 by Delphix. All rights reserved. + */ + +/* * AVL - generic AVL tree implementation for kernel use * * A complete description of AVL trees can be found in many CS textbooks. @@ -85,6 +89,12 @@ * is a modified "avl_node_t *". The bottom bit (normally 0 for a * pointer) is set to indicate if that the new node has a value greater * than the value of the indicated "avl_node_t *". + * + * Note - in addition to userland (e.g. libavl and libutil) and the kernel + * (e.g. genunix), avl.c is compiled into ld.so and kmdb's genunix module, + * which each have their own compilation environments and subsequent + * requirements. Each of these environments must be considered when adding + * dependencies from avl.c. */ #include @@ -864,6 +874,24 @@ avl_update(avl_tree_t *t, void *obj) return (B_FALSE); } +void +avl_swap(avl_tree_t *tree1, avl_tree_t *tree2) +{ + avl_node_t *temp_node; + ulong_t temp_numnodes; + + ASSERT3P(tree1->avl_compar, ==, tree2->avl_compar); + ASSERT3U(tree1->avl_offset, ==, tree2->avl_offset); + ASSERT3U(tree1->avl_size, ==, tree2->avl_size); + + temp_node = tree1->avl_root; + temp_numnodes = tree1->avl_numnodes; + tree1->avl_root = tree2->avl_root; + tree1->avl_numnodes = tree2->avl_numnodes; + tree2->avl_root = temp_node; + tree2->avl_numnodes = temp_numnodes; +} + /* * initialize a new AVL tree */ Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Mon Aug 11 22:43:44 2014 (r269844) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Tue Aug 12 00:53:03 2014 (r269845) @@ -69,6 +69,13 @@ dbuf_cons(void *vdb, void *unused, int k mutex_init(&db->db_mtx, NULL, MUTEX_DEFAULT, NULL); cv_init(&db->db_changed, NULL, CV_DEFAULT, NULL); refcount_create(&db->db_holds); + +#if defined(illumos) || !defined(_KERNEL) + db->db_creation = gethrtime(); +#else + db->db_creation = cpu_ticks() ^ ((uint64_t)CPU_SEQID << 48); +#endif + return (0); } @@ -330,7 +337,7 @@ dbuf_verify(dmu_buf_impl_t *db) ASSERT3U(db->db_level, <, dn->dn_nlevels); ASSERT(db->db_blkid == DMU_BONUS_BLKID || db->db_blkid == DMU_SPILL_BLKID || - !list_is_empty(&dn->dn_dbufs)); + !avl_is_empty(&dn->dn_dbufs)); } if (db->db_blkid == DMU_BONUS_BLKID) { ASSERT(dn != NULL); @@ -803,18 +810,30 @@ dbuf_unoverride(dbuf_dirty_record_t *dr) * receive; see comment below for details. */ void -dbuf_free_range(dnode_t *dn, uint64_t start, uint64_t end, dmu_tx_t *tx) +dbuf_free_range(dnode_t *dn, uint64_t start_blkid, uint64_t end_blkid, + dmu_tx_t *tx) { - dmu_buf_impl_t *db, *db_next; + dmu_buf_impl_t *db, *db_next, db_search; uint64_t txg = tx->tx_txg; + avl_index_t where; - if (end > dn->dn_maxblkid && (end != DMU_SPILL_BLKID)) - end = dn->dn_maxblkid; - dprintf_dnode(dn, "start=%llu end=%llu\n", start, end); + if (end_blkid > dn->dn_maxblkid && (end_blkid != DMU_SPILL_BLKID)) + end_blkid = dn->dn_maxblkid; + dprintf_dnode(dn, "start=%llu end=%llu\n", start_blkid, end_blkid); + + db_search.db_level = 0; + db_search.db_blkid = start_blkid; + db_search.db_creation = 0; mutex_enter(&dn->dn_dbufs_mtx); - if (start >= dn->dn_unlisted_l0_blkid * dn->dn_datablksz) { + if (start_blkid >= dn->dn_unlisted_l0_blkid) { /* There can't be any dbufs in this range; no need to search. */ +#ifdef DEBUG + db = avl_find(&dn->dn_dbufs, &db_search, &where); + ASSERT3P(db, ==, NULL); + db = avl_nearest(&dn->dn_dbufs, where, AVL_AFTER); + ASSERT(db == NULL || db->db_level > 0); +#endif mutex_exit(&dn->dn_dbufs_mtx); return; } else if (dmu_objset_is_receiving(dn->dn_objset)) { @@ -828,14 +847,18 @@ dbuf_free_range(dnode_t *dn, uint64_t st atomic_inc_64(&zfs_free_range_recv_miss); } - for (db = list_head(&dn->dn_dbufs); db != NULL; db = db_next) { - db_next = list_next(&dn->dn_dbufs, db); + db = avl_find(&dn->dn_dbufs, &db_search, &where); + ASSERT3P(db, ==, NULL); + db = avl_nearest(&dn->dn_dbufs, where, AVL_AFTER); + + for (; db != NULL; db = db_next) { + db_next = AVL_NEXT(&dn->dn_dbufs, db); ASSERT(db->db_blkid != DMU_BONUS_BLKID); - if (db->db_level != 0) - continue; - if (db->db_blkid < start || db->db_blkid > end) - continue; + if (db->db_level != 0 || db->db_blkid > end_blkid) { + break; + } + ASSERT3U(db->db_blkid, >=, start_blkid); /* found a level 0 buffer in the range */ mutex_enter(&db->db_mtx); @@ -1585,7 +1608,7 @@ dbuf_clear(dmu_buf_impl_t *db) dn = DB_DNODE(db); dndb = dn->dn_dbuf; if (db->db_blkid != DMU_BONUS_BLKID && MUTEX_HELD(&dn->dn_dbufs_mtx)) { - list_remove(&dn->dn_dbufs, db); + avl_remove(&dn->dn_dbufs, db); (void) atomic_dec_32_nv(&dn->dn_dbufs_count); membar_producer(); DB_DNODE_EXIT(db); @@ -1748,7 +1771,7 @@ dbuf_create(dnode_t *dn, uint8_t level, mutex_exit(&dn->dn_dbufs_mtx); return (odb); } - list_insert_head(&dn->dn_dbufs, db); + avl_add(&dn->dn_dbufs, db); if (db->db_level == 0 && db->db_blkid >= dn->dn_unlisted_l0_blkid) dn->dn_unlisted_l0_blkid = db->db_blkid + 1; @@ -1807,7 +1830,7 @@ dbuf_destroy(dmu_buf_impl_t *db) DB_DNODE_ENTER(db); dn = DB_DNODE(db); mutex_enter(&dn->dn_dbufs_mtx); - list_remove(&dn->dn_dbufs, db); + avl_remove(&dn->dn_dbufs, db); (void) atomic_dec_32_nv(&dn->dn_dbufs_count); mutex_exit(&dn->dn_dbufs_mtx); DB_DNODE_EXIT(db); @@ -1825,7 +1848,6 @@ dbuf_destroy(dmu_buf_impl_t *db) db->db_parent = NULL; db->db_buf = NULL; - ASSERT(!list_link_active(&db->db_link)); ASSERT(db->db.db_data == NULL); ASSERT(db->db_hash_next == NULL); ASSERT(db->db_blkptr == NULL); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Mon Aug 11 22:43:44 2014 (r269844) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Tue Aug 12 00:53:03 2014 (r269845) @@ -61,6 +61,43 @@ int zfs_default_ibs = DN_MAX_INDBLKSHIFT static kmem_cbrc_t dnode_move(void *, void *, size_t, void *); #endif +static int +dbuf_compare(const void *x1, const void *x2) +{ + const dmu_buf_impl_t *d1 = x1; + const dmu_buf_impl_t *d2 = x2; + + if (d1->db_level < d2->db_level) { + return (-1); + } else if (d1->db_level > d2->db_level) { + return (1); + } + + if (d1->db_blkid < d2->db_blkid) { + return (-1); + } else if (d1->db_blkid > d2->db_blkid) { + return (1); + } + + /* + * If a dbuf is being evicted while dn_dbufs_mutex is not held, we set + * the db_state to DB_EVICTING but do not remove it from dn_dbufs. If + * another thread creates a dbuf of the same blkid before the dbuf is + * removed from dn_dbufs, we can reach a state where there are two + * dbufs of the same blkid and level in db_dbufs. To maintain the avl + * invariant that there cannot be duplicate items, we distinguish + * between these two dbufs based on the time they were created. + */ + if (d1->db_creation < d2->db_creation) { + return (-1); + } else if (d1->db_creation > d2->db_creation) { + return (1); + } else { + ASSERT3P(d1, ==, d2); + return (0); + } +} + /* ARGSUSED */ static int dnode_cons(void *arg, void *unused, int kmflag) @@ -115,7 +152,7 @@ dnode_cons(void *arg, void *unused, int dn->dn_dbufs_count = 0; dn->dn_unlisted_l0_blkid = 0; - list_create(&dn->dn_dbufs, sizeof (dmu_buf_impl_t), + avl_create(&dn->dn_dbufs, dbuf_compare, sizeof (dmu_buf_impl_t), offsetof(dmu_buf_impl_t, db_link)); dn->dn_moved = 0; @@ -169,7 +206,7 @@ dnode_dest(void *arg, void *unused) ASSERT0(dn->dn_dbufs_count); ASSERT0(dn->dn_unlisted_l0_blkid); - list_destroy(&dn->dn_dbufs); + avl_destroy(&dn->dn_dbufs); } void @@ -505,7 +542,7 @@ dnode_allocate(dnode_t *dn, dmu_object_t ASSERT0(dn->dn_assigned_txg); ASSERT(refcount_is_zero(&dn->dn_tx_holds)); ASSERT3U(refcount_count(&dn->dn_holds), <=, 1); - ASSERT3P(list_head(&dn->dn_dbufs), ==, NULL); + ASSERT(avl_is_empty(&dn->dn_dbufs)); for (i = 0; i < TXG_SIZE; i++) { ASSERT0(dn->dn_next_nblkptr[i]); @@ -690,8 +727,8 @@ dnode_move_impl(dnode_t *odn, dnode_t *n ndn->dn_dirtyctx_firstset = odn->dn_dirtyctx_firstset; ASSERT(refcount_count(&odn->dn_tx_holds) == 0); refcount_transfer(&ndn->dn_holds, &odn->dn_holds); - ASSERT(list_is_empty(&ndn->dn_dbufs)); - list_move_tail(&ndn->dn_dbufs, &odn->dn_dbufs); + ASSERT(avl_is_empty(&ndn->dn_dbufs)); + avl_swap(&ndn->dn_dbufs, &odn->dn_dbufs); ndn->dn_dbufs_count = odn->dn_dbufs_count; ndn->dn_unlisted_l0_blkid = odn->dn_unlisted_l0_blkid; ndn->dn_bonus = odn->dn_bonus; @@ -725,7 +762,7 @@ dnode_move_impl(dnode_t *odn, dnode_t *n */ odn->dn_dbuf = NULL; odn->dn_handle = NULL; - list_create(&odn->dn_dbufs, sizeof (dmu_buf_impl_t), + avl_create(&odn->dn_dbufs, dbuf_compare, sizeof (dmu_buf_impl_t), offsetof(dmu_buf_impl_t, db_link)); odn->dn_dbufs_count = 0; odn->dn_unlisted_l0_blkid = 0; @@ -1236,7 +1273,8 @@ dnode_setdirty(dnode_t *dn, dmu_tx_t *tx return; } - ASSERT(!refcount_is_zero(&dn->dn_holds) || list_head(&dn->dn_dbufs)); + ASSERT(!refcount_is_zero(&dn->dn_holds) || + !avl_is_empty(&dn->dn_dbufs)); ASSERT(dn->dn_datablksz != 0); ASSERT0(dn->dn_next_bonuslen[txg&TXG_MASK]); ASSERT0(dn->dn_next_blksz[txg&TXG_MASK]); @@ -1309,7 +1347,7 @@ dnode_free(dnode_t *dn, dmu_tx_t *tx) int dnode_set_blksz(dnode_t *dn, uint64_t size, int ibs, dmu_tx_t *tx) { - dmu_buf_impl_t *db, *db_next; + dmu_buf_impl_t *db; int err; if (size == 0) @@ -1332,9 +1370,8 @@ dnode_set_blksz(dnode_t *dn, uint64_t si goto fail; mutex_enter(&dn->dn_dbufs_mtx); - for (db = list_head(&dn->dn_dbufs); db; db = db_next) { - db_next = list_next(&dn->dn_dbufs, db); - + for (db = avl_first(&dn->dn_dbufs); db != NULL; + db = AVL_NEXT(&dn->dn_dbufs, db)) { if (db->db_blkid != 0 && db->db_blkid != DMU_BONUS_BLKID && db->db_blkid != DMU_SPILL_BLKID) { mutex_exit(&dn->dn_dbufs_mtx); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Mon Aug 11 22:43:44 2014 (r269844) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Tue Aug 12 00:53:03 2014 (r269845) @@ -400,16 +400,13 @@ dnode_evict_dbufs(dnode_t *dn) int pass = 0; do { - dmu_buf_impl_t *db, marker; + dmu_buf_impl_t *db, *db_next; int evicting = FALSE; progress = FALSE; mutex_enter(&dn->dn_dbufs_mtx); - list_insert_tail(&dn->dn_dbufs, &marker); - db = list_head(&dn->dn_dbufs); - for (; db != ▮ db = list_head(&dn->dn_dbufs)) { - list_remove(&dn->dn_dbufs, db); - list_insert_tail(&dn->dn_dbufs, db); + for (db = avl_first(&dn->dn_dbufs); db != NULL; db = db_next) { + db_next = AVL_NEXT(&dn->dn_dbufs, db); #ifdef DEBUG DB_DNODE_ENTER(db); ASSERT3P(DB_DNODE(db), ==, dn); @@ -429,7 +426,6 @@ dnode_evict_dbufs(dnode_t *dn) } } - list_remove(&dn->dn_dbufs, &marker); /* * NB: we need to drop dn_dbufs_mtx between passes so * that any DB_EVICTING dbufs can make progress. @@ -500,7 +496,7 @@ dnode_sync_free(dnode_t *dn, dmu_tx_t *t dnode_undirty_dbufs(&dn->dn_dirty_records[txgoff]); dnode_evict_dbufs(dn); - ASSERT3P(list_head(&dn->dn_dbufs), ==, NULL); + ASSERT(avl_is_empty(&dn->dn_dbufs)); ASSERT3P(dn->dn_bonus, ==, NULL); /* Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h Mon Aug 11 22:43:44 2014 (r269844) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h Tue Aug 12 00:53:03 2014 (r269845) @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. */ @@ -213,11 +213,14 @@ typedef struct dmu_buf_impl { /* pointer to most recent dirty record for this buffer */ dbuf_dirty_record_t *db_last_dirty; + /* Creation time of dbuf (see comment in dbuf_compare). */ + hrtime_t db_creation; + /* * Our link on the owner dnodes's dn_dbufs list. * Protected by its dn_dbufs_mtx. */ - list_node_t db_link; + avl_node_t db_link; /* Data which is unique to data (leaf) blocks: */ Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Mon Aug 11 22:43:44 2014 (r269844) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Tue Aug 12 00:53:03 2014 (r269845) @@ -211,7 +211,7 @@ typedef struct dnode { refcount_t dn_holds; kmutex_t dn_dbufs_mtx; - list_t dn_dbufs; /* descendent dbufs */ + avl_tree_t dn_dbufs; /* descendent dbufs */ /* protected by dn_struct_rwlock */ struct dmu_buf_impl *dn_bonus; /* bonus buffer dbuf */ Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/avl.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/avl.h Mon Aug 11 22:43:44 2014 (r269844) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/avl.h Tue Aug 12 00:53:03 2014 (r269845) @@ -23,6 +23,10 @@ * Use is subject to license terms. */ +/* + * Copyright (c) 2014 by Delphix. All rights reserved. + */ + #ifndef _AVL_H #define _AVL_H @@ -260,6 +264,11 @@ extern boolean_t avl_update_lt(avl_tree_ extern boolean_t avl_update_gt(avl_tree_t *, void *); /* + * Swaps the contents of the two trees. + */ +extern void avl_swap(avl_tree_t *tree1, avl_tree_t *tree2); + +/* * Return the number of nodes in the tree */ extern ulong_t avl_numnodes(avl_tree_t *tree); From owner-svn-src-stable-10@FreeBSD.ORG Tue Aug 12 00:59:19 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B8D07A49 for ; Tue, 12 Aug 2014 00:59:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8C4DA2BCF for ; Tue, 12 Aug 2014 00:59:19 +0000 (UTC) Received: from delphij (uid 1035) (envelope-from delphij@FreeBSD.org) id 2ac0 by svn.freebsd.org (DragonFly Mail Agent v0.9+); Tue, 12 Aug 2014 00:59:19 +0000 From: Xin LI Date: Tue, 12 Aug 2014 00:59:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269846 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53e966e7.2ac0.3d7c5f0d@svn.freebsd.org> X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Aug 2014 00:59:19 -0000 Author: delphij Date: Tue Aug 12 00:59:19 2014 New Revision: 269846 URL: http://svnweb.freebsd.org/changeset/base/269846 Log: MFC r269230: MFV r269224: Increase default ARC buf_hash_table size. When typical block size is small, the hash table could be too small, which would lead to long hash chains and limit performance for cached reads. A new loader tunable, vfs.zfs.arc_average_blocksize, have been added which allows users to override the default assumption of average (typical) block size. Old default was 65536 (64 KiB) and new default is 8192 (8 KiB). Illumos issue: 5034 ARC's buf_hash_table is too small Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Aug 12 00:53:03 2014 (r269845) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Aug 12 00:59:19 2014 (r269846) @@ -203,15 +203,20 @@ int zfs_arc_grow_retry = 0; int zfs_arc_shrink_shift = 0; int zfs_arc_p_min_shift = 0; int zfs_disable_dup_eviction = 0; +uint64_t zfs_arc_average_blocksize = 8 * 1024; /* 8KB */ TUNABLE_QUAD("vfs.zfs.arc_max", &zfs_arc_max); TUNABLE_QUAD("vfs.zfs.arc_min", &zfs_arc_min); TUNABLE_QUAD("vfs.zfs.arc_meta_limit", &zfs_arc_meta_limit); +TUNABLE_QUAD("vfs.zfs.arc_average_blocksize", &zfs_arc_average_blocksize); SYSCTL_DECL(_vfs_zfs); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, arc_max, CTLFLAG_RDTUN, &zfs_arc_max, 0, "Maximum ARC size"); SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, arc_min, CTLFLAG_RDTUN, &zfs_arc_min, 0, "Minimum ARC size"); +SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, arc_average_blocksize, CTLFLAG_RDTUN, + &zfs_arc_average_blocksize, 0, + "ARC average blocksize"); /* * Note that buffers can be in one of 6 states: @@ -1056,10 +1061,11 @@ buf_init(void) /* * The hash table is big enough to fill all of physical memory - * with an average 64K block size. The table will take up - * totalmem*sizeof(void*)/64K (eg. 128KB/GB with 8-byte pointers). + * with an average block size of zfs_arc_average_blocksize (default 8K). + * By default, the table will take up + * totalmem * sizeof(void*) / 8K (1MB per GB with 8-byte pointers). */ - while (hsize * 65536 < (uint64_t)physmem * PAGESIZE) + while (hsize * zfs_arc_average_blocksize < (uint64_t)physmem * PAGESIZE) hsize <<= 1; retry: buf_hash_table.ht_mask = hsize - 1; From owner-svn-src-stable-10@FreeBSD.ORG Tue Aug 12 01:40:14 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 44834EC for ; Tue, 12 Aug 2014 01:40:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2D2552104 for ; Tue, 12 Aug 2014 01:40:14 +0000 (UTC) Received: from peter (uid 633) (envelope-from peter@FreeBSD.org) id 2d6c by svn.freebsd.org (DragonFly Mail Agent v0.9+); Tue, 12 Aug 2014 01:40:12 +0000 From: Peter Wemm Date: Tue, 12 Aug 2014 01:40:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269847 - in stable/10: contrib/apr contrib/apr/docs contrib/apr/encoding contrib/apr/file_io/unix contrib/apr/include contrib/apr/include/arch/unix contrib/apr/include/private contrib/... X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53e9707c.2d6c.2d976b@svn.freebsd.org> X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Aug 2014 01:40:14 -0000 Author: peter Date: Tue Aug 12 01:40:11 2014 New Revision: 269847 URL: http://svnweb.freebsd.org/changeset/base/269847 Log: MFC r266728,266731,266735,266736,268135,268960,269833 Update apr 1.4.8 -> 1.5.1 Update apr-util 1.5.2 -> 1.5.3 Update serf 1.3.4 -> 1.3.7 Update svnlite 1.8.8 -> 1.8.10 Deal with svnlite.1 manpage. Added: stable/10/contrib/apr/CMakeLists.txt - copied unchanged from r266735, head/contrib/apr/CMakeLists.txt stable/10/contrib/apr/README.cmake - copied unchanged from r266735, head/contrib/apr/README.cmake stable/10/contrib/apr/encoding/ - copied from r266735, head/contrib/apr/encoding/ stable/10/contrib/apr/include/apr.hwc - copied unchanged from r266735, head/contrib/apr/include/apr.hwc stable/10/contrib/apr/include/apr_escape.h - copied unchanged from r266735, head/contrib/apr/include/apr_escape.h stable/10/contrib/apr/include/apr_skiplist.h - copied unchanged from r266735, head/contrib/apr/include/apr_skiplist.h stable/10/contrib/apr/include/private/ - copied from r266735, head/contrib/apr/include/private/ stable/10/contrib/apr/poll/unix/z_asio.c - copied unchanged from r266735, head/contrib/apr/poll/unix/z_asio.c stable/10/contrib/apr/tables/apr_skiplist.c - copied unchanged from r266735, head/contrib/apr/tables/apr_skiplist.c stable/10/contrib/apr/tools/ - copied from r266735, head/contrib/apr/tools/ stable/10/contrib/subversion/subversion/include/private/svn_cert.h - copied unchanged from r269833, head/contrib/subversion/subversion/include/private/svn_cert.h Modified: stable/10/contrib/apr/CHANGES stable/10/contrib/apr/LICENSE stable/10/contrib/apr/Makefile.in stable/10/contrib/apr/Makefile.win stable/10/contrib/apr/NOTICE stable/10/contrib/apr/apr.dep stable/10/contrib/apr/apr.dsp stable/10/contrib/apr/apr.mak stable/10/contrib/apr/apr.spec stable/10/contrib/apr/build-outputs.mk stable/10/contrib/apr/build.conf stable/10/contrib/apr/configure stable/10/contrib/apr/configure.in stable/10/contrib/apr/docs/canonical_filenames.html stable/10/contrib/apr/file_io/unix/filedup.c stable/10/contrib/apr/file_io/unix/filestat.c stable/10/contrib/apr/file_io/unix/mktemp.c stable/10/contrib/apr/file_io/unix/open.c stable/10/contrib/apr/file_io/unix/pipe.c stable/10/contrib/apr/file_io/unix/readwrite.c stable/10/contrib/apr/include/apr.h.in stable/10/contrib/apr/include/apr_allocator.h stable/10/contrib/apr/include/apr_errno.h stable/10/contrib/apr/include/apr_file_info.h stable/10/contrib/apr/include/apr_file_io.h stable/10/contrib/apr/include/apr_fnmatch.h stable/10/contrib/apr/include/apr_hash.h stable/10/contrib/apr/include/apr_inherit.h stable/10/contrib/apr/include/apr_lib.h stable/10/contrib/apr/include/apr_mmap.h stable/10/contrib/apr/include/apr_network_io.h stable/10/contrib/apr/include/apr_poll.h stable/10/contrib/apr/include/apr_pools.h stable/10/contrib/apr/include/apr_shm.h stable/10/contrib/apr/include/apr_strings.h stable/10/contrib/apr/include/apr_tables.h stable/10/contrib/apr/include/apr_thread_mutex.h stable/10/contrib/apr/include/apr_thread_proc.h stable/10/contrib/apr/include/apr_time.h stable/10/contrib/apr/include/apr_user.h stable/10/contrib/apr/include/apr_version.h stable/10/contrib/apr/include/arch/unix/apr_arch_poll_private.h stable/10/contrib/apr/include/arch/unix/apr_arch_threadproc.h stable/10/contrib/apr/include/arch/unix/apr_private.h.in stable/10/contrib/apr/libapr.dep stable/10/contrib/apr/libapr.dsp stable/10/contrib/apr/libapr.mak stable/10/contrib/apr/locks/unix/proc_mutex.c stable/10/contrib/apr/network_io/unix/sendrecv.c stable/10/contrib/apr/network_io/unix/sockaddr.c stable/10/contrib/apr/network_io/unix/socket_util.c stable/10/contrib/apr/network_io/unix/sockets.c stable/10/contrib/apr/network_io/unix/sockopt.c stable/10/contrib/apr/passwd/apr_getpass.c stable/10/contrib/apr/poll/unix/pollcb.c stable/10/contrib/apr/poll/unix/pollset.c stable/10/contrib/apr/shmem/unix/shm.c stable/10/contrib/apr/strings/apr_cpystrn.c stable/10/contrib/apr/strings/apr_strings.c stable/10/contrib/apr/support/unix/waitio.c stable/10/contrib/apr/tables/apr_hash.c stable/10/contrib/apr/tables/apr_tables.c stable/10/contrib/serf/CHANGES stable/10/contrib/serf/auth/auth_spnego.c stable/10/contrib/serf/buckets/ssl_buckets.c stable/10/contrib/serf/serf.h stable/10/contrib/serf/ssltunnel.c stable/10/contrib/subversion/CHANGES stable/10/contrib/subversion/NOTICE stable/10/contrib/subversion/build-outputs.mk stable/10/contrib/subversion/build.conf stable/10/contrib/subversion/configure stable/10/contrib/subversion/configure.ac stable/10/contrib/subversion/get-deps.sh stable/10/contrib/subversion/subversion/include/private/svn_cache.h stable/10/contrib/subversion/subversion/include/private/svn_dep_compat.h stable/10/contrib/subversion/subversion/include/svn_version.h stable/10/contrib/subversion/subversion/libsvn_client/commit_util.c stable/10/contrib/subversion/subversion/libsvn_client/delete.c stable/10/contrib/subversion/subversion/libsvn_client/export.c stable/10/contrib/subversion/subversion/libsvn_client/externals.c stable/10/contrib/subversion/subversion/libsvn_client/merge.c stable/10/contrib/subversion/subversion/libsvn_client/prop_commands.c stable/10/contrib/subversion/subversion/libsvn_delta/svndiff.c stable/10/contrib/subversion/subversion/libsvn_fs_fs/fs.c stable/10/contrib/subversion/subversion/libsvn_fs_fs/fs.h stable/10/contrib/subversion/subversion/libsvn_fs_fs/fs_fs.c stable/10/contrib/subversion/subversion/libsvn_fs_fs/rep-cache-db.h stable/10/contrib/subversion/subversion/libsvn_ra_serf/commit.c stable/10/contrib/subversion/subversion/libsvn_ra_serf/getlocks.c stable/10/contrib/subversion/subversion/libsvn_ra_serf/inherited_props.c stable/10/contrib/subversion/subversion/libsvn_ra_serf/locks.c stable/10/contrib/subversion/subversion/libsvn_ra_serf/log.c stable/10/contrib/subversion/subversion/libsvn_ra_serf/options.c stable/10/contrib/subversion/subversion/libsvn_ra_serf/update.c stable/10/contrib/subversion/subversion/libsvn_ra_serf/util.c stable/10/contrib/subversion/subversion/libsvn_ra_svn/protocol stable/10/contrib/subversion/subversion/libsvn_repos/dump.c stable/10/contrib/subversion/subversion/libsvn_repos/fs-wrap.c stable/10/contrib/subversion/subversion/libsvn_subr/cache-memcache.c stable/10/contrib/subversion/subversion/libsvn_subr/config_auth.c stable/10/contrib/subversion/subversion/libsvn_subr/config_file.c stable/10/contrib/subversion/subversion/libsvn_subr/dirent_uri.c stable/10/contrib/subversion/subversion/libsvn_subr/internal_statements.h stable/10/contrib/subversion/subversion/libsvn_subr/io.c stable/10/contrib/subversion/subversion/libsvn_subr/opt.c stable/10/contrib/subversion/subversion/libsvn_subr/prompt.c stable/10/contrib/subversion/subversion/libsvn_subr/sysinfo.c stable/10/contrib/subversion/subversion/libsvn_subr/version.c stable/10/contrib/subversion/subversion/libsvn_wc/status.c stable/10/contrib/subversion/subversion/libsvn_wc/wc-checks.h stable/10/contrib/subversion/subversion/libsvn_wc/wc-metadata.h stable/10/contrib/subversion/subversion/libsvn_wc/wc-metadata.sql stable/10/contrib/subversion/subversion/libsvn_wc/wc-queries.h stable/10/contrib/subversion/subversion/libsvn_wc/wc-queries.sql stable/10/contrib/subversion/subversion/libsvn_wc/wc_db.c stable/10/contrib/subversion/subversion/libsvn_wc/wc_db.h stable/10/contrib/subversion/subversion/libsvn_wc/wc_db_wcroot.c stable/10/contrib/subversion/subversion/svn/conflict-callbacks.c stable/10/contrib/subversion/subversion/svndumpfilter/svndumpfilter.c stable/10/contrib/subversion/subversion/svnrdump/util.c stable/10/contrib/subversion/subversion/svnserve/serve.c stable/10/tools/build/mk/OptionalObsoleteFiles.inc stable/10/usr.bin/svn/lib/libapr/Makefile stable/10/usr.bin/svn/lib/libapr/apr.h stable/10/usr.bin/svn/lib/libapr/apr_private.h stable/10/usr.bin/svn/svn/Makefile stable/10/usr.bin/svn/svn_private_config.h Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/apr/CHANGES ============================================================================== --- stable/10/contrib/apr/CHANGES Tue Aug 12 00:59:19 2014 (r269846) +++ stable/10/contrib/apr/CHANGES Tue Aug 12 01:40:11 2014 (r269847) @@ -1,235 +1,124 @@ -*- coding: utf-8 -*- -Changes for APR 1.4.8 +Changes for APR 1.5.1 - *) Fix compiltation with FreeBSD on ARM. [Olli Hauer ] + *) apr_os_proc_mutex_get() on Unix: Avoid segfault for cross- + process pthread mutexes. [Yann Ylavic ] - *) Fix 1.4.7 regression in apr_mcast_hops() and apr_mcast_loopback() - for AF_INET (IPv4) sockets on most Unix platforms. [Joe Orton] + *) When using shmget-based shared memory, the ID used for ftok is + now an APR hash of the filename instead of the constant '1'. + We do this to help avoid collisions. PR 53996 [Jim Jagielski] - *) Fix the return value of apr_threadattr_detach_get() on some - platforms like OS X and Solaris. [Rainer Jung, ] + *) apr_socket_atreadeof(): Fix breakage on OS X. [Jim Jagielski] -Changes for APR 1.4.7 + *) Fix POSIX shared memory (shm_open) use for named shared memory. + Includes adding '--enable-posix-shm' to force POSIX shm if + available, and OS X compatibility. PR 55928. + [Jozef Hatala , Jim Jagielski] - *) Fix apr_sockaddr_info_get() not returning an error in some cases. - PR 54779. [Jan Kaluža ] + *) Fix race condition when calling apr_dir_make_recursive from + multiple threads on Windows. + [Bert Huijben] - *) Fix amd64 assembler version of apr_atomic_xchgptr(). PR 51851. [Mattias - EngdegÃ¥rd ] + *) Fix apr_escape.c compilation errors on EBCDIC platforms. + [Eric Covener] - *) Fix PPC atomics to work with gcc 4.0. PR 54840. [Mattias EngdegÃ¥rd - ] + *) FreeBSD 10: Correct a regression in 1.5.0 which affected non- + blocking sockets in some applications, including httpd. [Jeff + Trawick] - *) configure: Fix detection of O_NONBLOCK inheritance on busy - systems. [Rainer Jung] + *) Windows cmake build: Fix incorrect installation of some .pdb + files. Fix incorrect use of some logic intended for Windows 9x, + including legacy filesystem interfaces and dynamic loading of + some Windows APIs. [Jeff Trawick] - *) Remove unused code, fix strict C compliance bug in SHA-256 - implementation. [Jan Kaluza ] - - *) Fix apr_ipsubnet_test() false positives when comparing IPv4 - subnet representation against an IPv6 address. PR 54047. [Joe Orton] - - *) apr_socket_accept_filter: Return success when trying to again set - the filter to the same value as before, avoiding an unhelpful - APR_EINVAL. PR 37863. [Jeff Trawick] - - *) configure: Fix Linux 3.x detection. PR 54001. [Gilles Espinasse - ] - - *) apr_time_exp_*() on Windows: Fix error in the tm_yday field of - apr_time_exp_t for times within leap years. PR 53175. + *) apr_skiplist: Add compatibility with C++ applications. [Jeff Trawick] - *) Improve platform detection by updating config.guess and config.sub. - [Rainer Jung] - - *) Add support for OSX Mountain Lion (10.8) [Jim Jagielski] - - *) Add various gcc function attributes. [Stefan Fritsch] - - *) Fix some problems in apr_sockaddr_info_get() when trying to resolve - the loopback addresses of a protocol family that is not otherwise - configured on the system. PR 52709. [Nirgal Vourgère - , Stefan Fritsch] - - *) Fix file not being unlocked if truncate call on a file fails. - [Mladen Turk] - - *) apr_mcast_hops: Fix EINVAL for IPv6 sockets caused by using byte - instead integer for setsockopt. [Mladen Turk] - - *) Windows: Fix compile-time checks for 64-bit builds, resolving a - crash in httpd's mod_rewrite. PR 49155. [] - -Changes for APR 1.4.6 - - *) Flush write buffer before truncate call on a file. - [Mladen Turk] - - *) Randomise hashes by providing a seed. - Assigned CVE-2012-0840, oCERT-2011-003, but not known to be exploitable. - [Bojan Smojver, Branko ÄŒibej, Ruediger Pluem et al.] - - *) apr_random: Prevent segfault if pool used to initialize apr_random is - destroyed before forking. [Stefan Fritsch] - - *) testrand: Improve child randomness test case. [Rainer Jung] - - *) apr_proc_fork, apr_random_after_fork: disambiguate what happens to the - proc structure passed in, and ensure that the pid is set correctly in - a newly created child; note that merely mixing a PID into the random - seed of a new child doesn't markedly increase entropy. [Sander Temme] - - *) apr_file_open: Avoid fcntl() calls if support for O_CLOEXEC works. - PR 48557. [Mike Frysinger ] - - *) apr_dir_make_recursive: Fix race condition that could lead to EEXIST - being returned. PR 51254. [William Lee , - Wim Lewis ] - - *) configure: Fix APR_RESTORE_THE_ENVIRONMENT if the original variable was - a single space. PR 50334. [Nathan Phillip Brink ] - - *) apr_proc_create: Don't close any of the new stdin/stdout/stderr in the - child if it already has the correct FD. PR 51995. - [Dan Ports ] - - *) Fix flag character '#' in combination with format character 'x' in - apr snprintf implementations. [Rainer Jung] - - *) Improve platform detection by updating config.guess and config.sub. - [Rainer Jung] - - *) Add libtool2 files to extraclean make target. [Rainer Jung] + *) Correct a regression in 1.5.0 which affected out-of-tree + builds on Unix. [Rainer Jung] - *) Don't overwrite our config.guess and config.sub - when running buildconf. [Rainer Jung] + *) Improve platform detection for bundled expat by updating + config.guess and config.sub. [Rainer Jung] - *) Silence autoconf 2.68 warnings. [Rainer Jung] +Changes for APR 1.5.0 -Changes for APR 1.4.5 - - *) Security: CVE-2011-1928 - apr_fnmatch(): Fix high CPU loop. [William Rowe] - - *) Fix top_builddir in installed apr_rules.mk. [Bojan Smojver] - -Changes for APR 1.4.4 - - *) Windows: Fix command-line builds. [William Rowe] - -Changes for APR 1.4.3 - - *) Security: CVE-2011-0419 - Reimplement apr_fnmatch() from scratch using a non-recursive - algorithm; now has improved compliance with the fnmatch() spec. - [William Rowe] - - *) Fix environment-related crash using some non-standard builds on - Windows 7/Server 2008. [Steve Hay ] - - *) poll, pollset, pollcb on Windows: Handle calls with no file/socket - descriptors. PR 49882. [Stefan Ruppert , Jeff Trawick] - - *) Fix APR_IPV6_V6ONLY issues on Windows related to run-time behavior - on Windows older than Vista and SDK/MinGW levels without IPV6_V6ONLY. - PR 45321. [Sob ] - - *) Fix address handling when accepting an AF_INET socket from a socket - bound as AF_INET6. PR 49678. [Joe Orton] + *) Fix Linux kernel version check to recognize more versions, + including versions 3.10 and later. PR 55690. [Joe Orton, + Arfrever Frehtes Taifersar Arahesis ] + + *) Add apr_sockaddr_is_wildcard() to check if a socket address + refers to the wildcard address for the protocol family (e.g., + 0.0.0.0/INADDR_ANY for IPv4). [Jeff Trawick] + + *) apr_file_dup2() on Windows: Fix debug RTL assertion when + attempting to _commit(stdout) or _commit(stderr). [Mike Rumph + ] + + *) apr_socket_connect() on Windows: Handle WSAEISCONN. PR 48736. + [, Jeff Trawick] + + *) z/OS: threadsafe apr_pollset_poll support for sockets [Greg Ames] + + *) Windows: Don't obtain a mutex for buffered file I/O unless the + file was opened with the APR_FOPEN_XTHREAD flag. [Ivan Zhakov + ] + + *) Windows: Create named shared memory segments under the "Local" + namespace if the caller is unprivileged, fixing an inability of + unprivileged callers to use apr_shm_create() with named shared + memory segments under recent Windows. As before, shared memory + segments are created under the "Global" namespace for privileged + callers. Add apr_shm_create_ex() and apr_shm_attach_ex(), which + provide the ability to override the normal namespace selection. + [Jeff Trawick] - *) Fix error return values from apr_sockaddr_info_get() on Windows for - IPv6 builds. [Ivan Zhakov ] + *) Update compile settings for MINT OS. PR 47181. [Alan Hourihane + ] - *) Add new experimental configure option --enable-allocator-uses-mmap to - use mmap instead of malloc in apr_allocator_alloc(). This greatly reduces - memory fragmentation with malloc implementations (e.g. glibc) that - don't handle allocationss of a page-size-multiples in an efficient way. - It also makes apr_allocator_max_free_set() actually have some effect - on such platforms. [Stefan Fritsch] + *) Files and pipes on Windows: Don't create an unused pollset when + files and pipes are opened. [Mladen Turk] - *) configure: Support 64 and 32 bit universal builds for Darwin/ - OS X 10.6+. [Jim Jagielski] + *) apr_socket_timeout_set() on Windows: If the socket was in a non- + blocking state before, disable that setting so that timeouts work. + [Jeff Trawick] - *) apr_sockaddr_info_get() on AIX: Fix a problem which could set - the port field in the native socket address to 1 when 0 was - specified. PR 46964. [Jeff Trawick] + *) File info APIs: Fix calculation of atime and mtime on AIX. PR 51146. + [Ruediger Pluem] - *) configure: Make definition of apr_ino_t independent of - _FILE_OFFSET_BITS even on platforms where ino_t is 'unsigned int'. - [Stefan Fritsch] + *) Add the apr_escape interface. [Graham Leggett] - *) apr_ring: Workaround for aliasing problem that causes gcc 4.5 to - miscompile some brigade related code. PR 50190. [Stefan Fritsch] + *) Cygwin build fixes. PRs 51016 and 55586. [Carlo Bramini + ] - *) apr_file_flush_locked(): Handle short writes. [Stefan Fritsch] + *) Add apr_skiplist family. [Jim Jagielski] - *) apr_pollset_create_ex(): Trap errors from pollset providers. - PR 49094. [Sami Tolvanen ] + *) Add experimental cmake-based build system for Windows. Refer to + README.cmake for more information. [Jeff Trawick, Tom Donovan] - *) apr_pollset_create*(): Fix memory lifetime problem with the wakeup - pipe when the pollset was created with APR_POLLSET_NOCOPY. - [Neil Conway ] + *) Add the apr_table_getm() call, which transparently handles the + merging of keys with multiple values. [Graham Leggett] - *) Fix detection of some Linux variants when configure is built with - recent GNU tools. [Eric Covener] + *) Add apr_hash_this_key(), apr_hash_this_key_len(), and + apr_hash_this_val() for easier access to those attributes from + a hash iterator. [Hyrum K. Wright ] - *) Avoid a redundant fcntl() call in apr_file_open() where O_CLOEXEC - is supported. PR 46297. [Joe Orton] + *) MinGW/MSYS: Support shared builds of APR, other general improvements + to support of this toolchain. PR 46175. [Carlo Bramini + ] *) Improve platform detection by updating config.guess and config.sub. [Rainer Jung] -Changes for APR 1.4.2 - - *) Undo a crash-bug introduced in 1.4.1 affecting some applications of - the apr hash and table structures, reported to affect Subversion - by Bert Huijben . [Graham Leggett] - -Changes for APR 1.4.1 - - *) Win32: Properly handle the ERROR_DIRECTORY system error code. - [Brane ÄŒibej] - -Changes for APR 1.4.0 - - *) Windows: Default build configurations assume NT or higher at run-time. - - *) Add apr_global_mutex_lockfile() for retrieving the file, if any, - associated with the mutex. Add apr_global_mutex_name() for retrieving - the name of the lock mechanism used by the underlying proc mutex. - [Jeff Trawick] - - *) Add apr_socket_atreadeof to determine whether the receive part of the - socket has been closed by the peer. - [Ruediger Pluem, Mladen Turk, Joe Orton] - - *) Make apr_pollset and apr_pollcb implementations using providers. - Added apr_pollset_create_ex and apr_pollcb_create_ex that allows - choosing non-default providers. - [Mladen Turk] - - *) Win32: Use WSAPoll as default pollset method if supported and found - inside winsock dll. [Mladen Turk] - - *) apr_temp_dir_get() now checks the TMPDIR environment variable first, - instead of third. [Jim Jagielski] - - *) Add apr_file_sync() and apr_file_datasync() calls. [Bojan Smojver] - - *) apr_pollset_wakeup() on Windows: Fix core caused by closing the - file_socket_pipe with standard file_close. - [Arsen Chaloyan, Mladen Turk] - - *) Introduce apr_hash_do() for iterating over a hash table. [Mladen Turk] + *) apr_socket_opt_set: Add support for APR_SO_BROADCAST. PR 46389. + [Armin Müller ] - *) Make sure WIN32 behaves the same as posix for file-backed shared memory - by removing the file on cleanup/remove. [Mladen Turk] + *) Enable platform specific support for the opening of a file or + pipe in non-blocking mode through the APR_FOPEN_NONBLOCK flag. + [Graham Leggett] - *) Introduce apr_pollset_wakeup() for interrupting the blocking - apr_pollset_poll() call. [Mladen Turk] +Changes for APR 1.4.x and later: - *) Add apr_file_link() function. PR 44841. [Mark Heily ] + *) http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/CHANGES?view=markup Changes for APR 1.3.x and later: Copied: stable/10/contrib/apr/CMakeLists.txt (from r266735, head/contrib/apr/CMakeLists.txt) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/apr/CMakeLists.txt Tue Aug 12 01:40:11 2014 (r269847, copy of r266735, head/contrib/apr/CMakeLists.txt) @@ -0,0 +1,434 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Read README.cmake before using this. + +PROJECT(APR C) + +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) + +OPTION(APR_INSTALL_PRIVATE_H "Install selected private .h files (for httpd)" OFF) +OPTION(APR_HAVE_IPV6 "IPv6 support" ON) +OPTION(INSTALL_PDB "Install .pdb files (if generated)" ON) +OPTION(APR_BUILD_TESTAPR "Build the test suite" OFF) +OPTION(TEST_STATIC_LIBS "Test programs use APR static libraries instead of shared libraries?" OFF) +SET(MIN_WINDOWS_VER "Vista" + CACHE STRING "Minimum Windows version") + +# create 1-or-0 representation of feature tests for apr.h + +SET(apr_have_ipv6_10 0) + +IF(APR_HAVE_IPV6) + SET(apr_have_ipv6_10 1) +ENDIF() + +IF("${MIN_WINDOWS_VER}" STREQUAL "") + SET(win32_winnt_str "0x0600") +ELSEIF(${MIN_WINDOWS_VER} STREQUAL "Vista") + SET(win32_winnt_str "0x0600") +ELSEIF(${MIN_WINDOWS_VER} STREQUAL "Windows7") + SET(win32_winnt_str "0x0601") +ELSE() + SET(win32_winnt_str ${MIN_WINDOWS_VER}) +ENDIF() + +CONFIGURE_FILE(include/apr.hwc + ${PROJECT_BINARY_DIR}/apr.h) + +ADD_EXECUTABLE(gen_test_char tools/gen_test_char.c) +GET_TARGET_PROPERTY(GEN_TEST_CHAR_EXE gen_test_char LOCATION) +ADD_CUSTOM_COMMAND( + COMMENT "Generating character tables, apr_escape_test_char.h, for current locale" + DEPENDS gen_test_char + COMMAND ${GEN_TEST_CHAR_EXE} > ${PROJECT_BINARY_DIR}/apr_escape_test_char.h + OUTPUT ${PROJECT_BINARY_DIR}/apr_escape_test_char.h +) +ADD_CUSTOM_TARGET( + test_char_header ALL + DEPENDS ${PROJECT_BINARY_DIR}/apr_escape_test_char.h +) + +# Generated .h files are stored in PROJECT_BINARY_DIR, not the +# source tree. +# +# BROKEN: not searching PROJECT_BINARY_DIR first, so you have to +# manually delete apr.h in PROJECT_SOURCE_DIR/include if +# you've generated apr.h before using a different build + +SET(APR_INCLUDE_DIRECTORIES + ${PROJECT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/include + ${CMAKE_CURRENT_SOURCE_DIR}/include/arch/win32 + ${CMAKE_CURRENT_SOURCE_DIR}/include/arch/unix + ${CMAKE_CURRENT_SOURCE_DIR}/include/private +) + +SET(APR_SYSTEM_LIBS + ws2_32 + mswsock + rpcrt4 +) + +INCLUDE_DIRECTORIES(${APR_INCLUDE_DIRECTORIES}) + +SET(APR_PUBLIC_HEADERS_STATIC + include/apr_allocator.h + include/apr_atomic.h + include/apr_dso.h + include/apr_env.h + include/apr_errno.h + include/apr_escape.h + include/apr_file_info.h + include/apr_file_io.h + include/apr_fnmatch.h + include/apr_general.h + include/apr_getopt.h + include/apr_global_mutex.h + include/apr_hash.h + include/apr_inherit.h + include/apr_lib.h + include/apr_mmap.h + include/apr_network_io.h + include/apr_poll.h + include/apr_pools.h + include/apr_portable.h + include/apr_proc_mutex.h + include/apr_random.h + include/apr_ring.h + include/apr_shm.h + include/apr_signal.h + include/apr_skiplist.h + include/apr_strings.h + include/apr_support.h + include/apr_tables.h + include/apr_thread_cond.h + include/apr_thread_mutex.h + include/apr_thread_proc.h + include/apr_thread_rwlock.h + include/apr_time.h + include/apr_user.h + include/apr_version.h + include/apr_want.h +) +SET(APR_PUBLIC_HEADERS_GENERATED + ${PROJECT_BINARY_DIR}/apr.h +) + +SET(APR_SOURCES + atomic/win32/apr_atomic.c + dso/win32/dso.c + encoding/apr_escape.c + file_io/unix/copy.c + file_io/unix/fileacc.c + file_io/unix/filepath_util.c + file_io/unix/fullrw.c + file_io/unix/mktemp.c + file_io/unix/tempdir.c + file_io/win32/buffer.c + file_io/win32/dir.c + file_io/win32/filedup.c + file_io/win32/filepath.c + file_io/win32/filestat.c + file_io/win32/filesys.c + file_io/win32/flock.c + file_io/win32/open.c + file_io/win32/pipe.c + file_io/win32/readwrite.c + file_io/win32/seek.c + locks/win32/proc_mutex.c + locks/win32/thread_cond.c + locks/win32/thread_mutex.c + locks/win32/thread_rwlock.c + memory/unix/apr_pools.c + misc/unix/errorcodes.c + misc/unix/getopt.c + misc/unix/otherchild.c + misc/unix/version.c + misc/win32/charset.c + misc/win32/env.c + misc/win32/internal.c + misc/win32/misc.c + misc/win32/rand.c + misc/win32/start.c + misc/win32/utf8.c + mmap/unix/common.c + mmap/win32/mmap.c + network_io/unix/inet_ntop.c + network_io/unix/inet_pton.c + network_io/unix/multicast.c + network_io/unix/sockaddr.c + network_io/unix/socket_util.c + network_io/win32/sendrecv.c + network_io/win32/sockets.c + network_io/win32/sockopt.c + passwd/apr_getpass.c + poll/unix/poll.c + poll/unix/pollcb.c + poll/unix/pollset.c + poll/unix/select.c + random/unix/apr_random.c + random/unix/sha2.c + random/unix/sha2_glue.c + shmem/win32/shm.c + strings/apr_cpystrn.c + strings/apr_fnmatch.c + strings/apr_snprintf.c + strings/apr_strings.c + strings/apr_strnatcmp.c + strings/apr_strtok.c + tables/apr_hash.c + tables/apr_skiplist.c + tables/apr_tables.c + threadproc/win32/proc.c + threadproc/win32/signals.c + threadproc/win32/thread.c + threadproc/win32/threadpriv.c + time/win32/time.c + time/win32/timestr.c + user/win32/groupinfo.c + user/win32/userinfo.c +) + +SET(APR_TEST_SOURCES + test/abts.c + test/testargs.c + test/testatomic.c + test/testcond.c + test/testdir.c + test/testdso.c + test/testdup.c + test/testenv.c + test/testescape.c + test/testfile.c + test/testfilecopy.c + test/testfileinfo.c + test/testflock.c + test/testfmt.c + test/testfnmatch.c + test/testglobalmutex.c + test/testhash.c + test/testipsub.c + test/testlfs.c + test/testlock.c + test/testmmap.c + test/testnames.c + test/testoc.c + test/testpath.c + test/testpipe.c + test/testpoll.c + test/testpools.c + test/testproc.c + test/testprocmutex.c + test/testrand.c + test/testshm.c + test/testsleep.c + test/testsock.c + test/testsockets.c + test/testsockopt.c + test/teststr.c + test/teststrnatcmp.c + test/testtable.c + test/testtemp.c + test/testthread.c + test/testtime.c + test/testud.c + test/testuser.c + test/testutil.c + test/testvsn.c +) + +SET(install_targets) +SET(install_bin_pdb) +SET(install_lib_pdb) + +# libapr-1 is shared, apr-1 is static +ADD_LIBRARY(libapr-1 SHARED ${APR_SOURCES} ${APR_PUBLIC_HEADERS_GENERATED} libapr.rc) +SET(install_targets ${install_targets} libapr-1) +SET(install_bin_pdb ${install_bin_pdb} ${PROJECT_BINARY_DIR}/libapr-1.pdb) +TARGET_LINK_LIBRARIES(libapr-1 ${APR_SYSTEM_LIBS}) +SET_TARGET_PROPERTIES(libapr-1 PROPERTIES COMPILE_DEFINITIONS "APR_DECLARE_EXPORT;WINNT") +ADD_DEPENDENCIES(libapr-1 test_char_header) + +ADD_LIBRARY(apr-1 STATIC ${APR_SOURCES} ${APR_PUBLIC_HEADERS_GENERATED}) +SET(install_targets ${install_targets} apr-1) +SET(install_lib_pdb ${install_lib_pdb} ${PROJECT_BINARY_DIR}/apr-1.pdb) +TARGET_LINK_LIBRARIES(apr-1 ${APR_SYSTEM_LIBS}) +SET_TARGET_PROPERTIES(apr-1 PROPERTIES COMPILE_DEFINITIONS "APR_DECLARE_STATIC;WINNT") +ADD_DEPENDENCIES(apr-1 test_char_header) + +# libaprapp-1 and aprapp-1 are static +ADD_LIBRARY(libaprapp-1 STATIC misc/win32/apr_app.c misc/win32/internal.c ${APR_PUBLIC_HEADERS_GENERATED}) +SET(install_targets ${install_targets} libaprapp-1) +SET(install_lib_pdb ${install_lib_pdb} ${PROJECT_BINARY_DIR}/libaprapp-1.pdb) +SET_TARGET_PROPERTIES(libaprapp-1 PROPERTIES COMPILE_DEFINITIONS "APR_APP;WINNT") + +ADD_LIBRARY(aprapp-1 STATIC misc/win32/apr_app.c misc/win32/internal.c ${APR_PUBLIC_HEADERS_GENERATED}) +SET(install_targets ${install_targets} aprapp-1) +SET(install_lib_pdb ${install_lib_pdb} ${PROJECT_BINARY_DIR}/aprapp-1.pdb) +SET_TARGET_PROPERTIES(aprapp-1 PROPERTIES COMPILE_DEFINITIONS "APR_DECLARE_STATIC;APR_APP;WINNT") + +IF(APR_BUILD_TESTAPR) + ENABLE_TESTING() + # Create a "check" target that displays test program output to the console. + ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND} --verbose) + + # copy data files to build directory so that we can run programs from there + EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory + ${PROJECT_BINARY_DIR}/data) + EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${PROJECT_SOURCE_DIR}/test/data/file_datafile.txt + ${PROJECT_BINARY_DIR}/data/file_datafile.txt) + EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${PROJECT_SOURCE_DIR}/test/data/mmap_datafile.txt + ${PROJECT_BINARY_DIR}/data/mmap_datafile.txt) + + IF(TEST_STATIC_LIBS) + SET(whichapr apr-1) + SET(whichaprapp aprapp-1) + SET(apiflag -DAPR_DECLARE_STATIC) + ELSE() + SET(whichapr libapr-1) + SET(whichaprapp libaprapp-1) + SET(apiflag) + ENDIF() + + ADD_EXECUTABLE(testapp test/testapp.c) + TARGET_LINK_LIBRARIES(testapp ${whichapr} ${whichaprapp} ${APR_SYSTEM_LIBS}) + SET_TARGET_PROPERTIES(testapp PROPERTIES LINK_FLAGS /entry:wmainCRTStartup) + IF(apiflag) + SET_TARGET_PROPERTIES(testapp PROPERTIES COMPILE_FLAGS ${apiflag}) + ENDIF() + ADD_TEST(NAME testapp COMMAND testapp) + + ADD_EXECUTABLE(testall ${APR_TEST_SOURCES}) + TARGET_LINK_LIBRARIES(testall ${whichapr} ${APR_SYSTEM_LIBS}) + IF(apiflag) + SET_TARGET_PROPERTIES(testall PROPERTIES COMPILE_FLAGS ${apiflag}) + ENDIF() + ADD_TEST(NAME testall COMMAND testall) + + ADD_LIBRARY(mod_test MODULE test/mod_test.c) + TARGET_LINK_LIBRARIES(mod_test ${whichapr} ${APR_SYSTEM_LIBS}) + SET_PROPERTY(TARGET mod_test APPEND PROPERTY LINK_FLAGS /export:print_hello) + # nasty work-around for difficulties adding more than one additional flag + # (they get joined in a bad way behind the scenes) + GET_PROPERTY(link_flags TARGET mod_test PROPERTY LINK_FLAGS) + SET(link_flags "${link_flags} /export:count_reps") + SET_TARGET_PROPERTIES(mod_test PROPERTIES LINK_FLAGS ${link_flags}) + IF(apiflag) + SET_TARGET_PROPERTIES(mod_test PROPERTIES COMPILE_FLAGS ${apiflag}) + ENDIF() + + # Build all the single-source executable files with no special build + # requirements. + SET(single_source_programs + test/echod.c + test/sendfile.c + test/sockperf.c + test/testlockperf.c + test/testmutexscope.c + test/globalmutexchild.c + test/occhild.c + test/proc_child.c + test/readchild.c + test/sockchild.c + test/testshmproducer.c + test/testshmconsumer.c + test/tryread.c + test/internal/testucs.c + ) + + FOREACH(sourcefile ${single_source_programs}) + STRING(REGEX REPLACE ".*/([^\\]+)\\.c" "\\1" proggie ${sourcefile}) + ADD_EXECUTABLE(${proggie} ${sourcefile}) + TARGET_LINK_LIBRARIES(${proggie} ${whichapr} ${APR_SYSTEM_LIBS}) + IF(apiflag) + SET_TARGET_PROPERTIES(${proggie} PROPERTIES COMPILE_FLAGS ${apiflag}) + ENDIF() + ENDFOREACH() + + # Add tests for programs that run by themselves with no arguments. + SET(simple_tests + testmutexscope + testucs + ) + + FOREACH(simple ${simple_tests}) + ADD_TEST(NAME ${simple} COMMAND ${simple}) + ENDFOREACH() + + # testlockperf takes forever on Windows with default counter limit + ADD_TEST(NAME testlockperf COMMAND testlockperf -c 50000) + + # sendfile runs multiple times with different parameters. + FOREACH(sendfile_mode blocking nonblocking timeout) + ADD_TEST(NAME sendfile-${sendfile_mode} COMMAND sendfile client ${sendfile_mode} startserver) + ENDFOREACH() + + # No test is added for echod+sockperf. Those will have to be run manually. + +ENDIF (APR_BUILD_TESTAPR) + +# Installation + +INSTALL(TARGETS ${install_targets} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + ) + +IF(INSTALL_PDB) + INSTALL(FILES ${install_bin_pdb} + DESTINATION bin + CONFIGURATIONS RelWithDebInfo Debug) + + INSTALL(FILES ${install_lib_pdb} + DESTINATION lib + CONFIGURATIONS RelWithDebInfo Debug) +ENDIF() + +INSTALL(FILES ${APR_PUBLIC_HEADERS_STATIC} ${APR_PUBLIC_HEADERS_GENERATED} DESTINATION include) +IF(APR_INSTALL_PRIVATE_H) + # Kludges for unexpected dependencies of httpd 2.x, not installed by default + SET(APR_PRIVATE_H_FOR_HTTPD + include/arch/win32/apr_arch_file_io.h + include/arch/win32/apr_arch_misc.h + include/arch/win32/apr_arch_utf8.h + include/arch/win32/apr_private.h + ) + INSTALL(FILES ${APR_PRIVATE_H_FOR_HTTPD} DESTINATION include/arch/win32) + INSTALL(FILES include/arch/apr_private_common.h DESTINATION include/arch) +ENDIF() + +STRING(TOUPPER "${CMAKE_BUILD_TYPE}" buildtype) +MESSAGE(STATUS "") +MESSAGE(STATUS "") +MESSAGE(STATUS "APR configuration summary:") +MESSAGE(STATUS "") + +MESSAGE(STATUS " Build type ...................... : ${CMAKE_BUILD_TYPE}") +MESSAGE(STATUS " Install .pdb (if available)...... : ${INSTALL_PDB}") +MESSAGE(STATUS " Install prefix .................. : ${CMAKE_INSTALL_PREFIX}") +MESSAGE(STATUS " C compiler ...................... : ${CMAKE_C_COMPILER}") +MESSAGE(STATUS " IPv6 ............................ : ${APR_HAVE_IPV6}") +MESSAGE(STATUS " Minimum Windows version ......... : ${MIN_WINDOWS_VER}") +MESSAGE(STATUS " Build test suite ................ : ${APR_BUILD_TESTAPR}") +IF(TEST_STATIC_LIBS) +MESSAGE(STATUS " (testing static libraries)") +ELSE() +MESSAGE(STATUS " (testing dynamic libraries)") +ENDIF() +MESSAGE(STATUS " Install private .h for httpd .... : ${APR_INSTALL_PRIVATE_H}") Modified: stable/10/contrib/apr/LICENSE ============================================================================== --- stable/10/contrib/apr/LICENSE Tue Aug 12 00:59:19 2014 (r269846) +++ stable/10/contrib/apr/LICENSE Tue Aug 12 01:40:11 2014 (r269847) @@ -206,8 +206,8 @@ APACHE PORTABLE RUNTIME SUBCOMPONENTS: The Apache Portable Runtime includes a number of subcomponents with separate copyright notices and license terms. Your use of the source -code for the these subcomponents is subject to the terms and -conditions of the following licenses. +code for these subcomponents is subject to the terms and conditions +of the following licenses. From strings/apr_fnmatch.c, include/apr_fnmatch.h, misc/unix/getopt.c, file_io/unix/mktemp.c, strings/apr_strings.c: Modified: stable/10/contrib/apr/Makefile.in ============================================================================== --- stable/10/contrib/apr/Makefile.in Tue Aug 12 00:59:19 2014 (r269846) +++ stable/10/contrib/apr/Makefile.in Tue Aug 12 01:40:11 2014 (r269847) @@ -18,7 +18,7 @@ APR_MAJOR_VERSION=@APR_MAJOR_VERSION@ INCDIR=./include OSDIR=$(top_srcdir)/include/arch/@OSDIR@ DEFOSDIR=$(INCDIR)/arch/@DEFAULT_OSDIR@ -INCLUDES=-I$(INCDIR) -I$(OSDIR) -I$(DEFOSDIR) -I$(top_srcdir)/include/arch/@DEFAULT_OSDIR@ -I$(top_srcdir)/include +INCLUDES=-I$(INCDIR) -I$(OSDIR) -I$(DEFOSDIR) -I$(top_srcdir)/include/arch/@DEFAULT_OSDIR@ -I$(top_srcdir)/include -I$(top_srcdir)/include/private -I$(top_blddir)/include/private # # Macros for target determination @@ -36,7 +36,7 @@ INSTALL_DATA = @INSTALL_DATA@ # Rules for building specific targets, starting with 'all' for # building the entire package. # -TARGETS = $(TARGET_LIB) apr.exp apr-config.out build/apr_rules.out +TARGETS = $(TARGET_LIB) include/private/apr_escape_test_char.h apr.exp apr-config.out build/apr_rules.out LT_VERSION = @LT_VERSION@ @@ -45,7 +45,9 @@ LT_VERSION = @LT_VERSION@ @INCLUDE_OUTPUTS@ CLEAN_TARGETS = apr-config.out apr.exp exports.c export_vars.c .make.dirs \ - build/apr_rules.out + build/apr_rules.out tools/gen_test_char@EXEEXT@ \ + tools/gen_test_char.o tools/gen_test_char.lo \ + include/private/apr_escape_test_char.h DISTCLEAN_TARGETS = config.cache config.log config.status \ include/apr.h include/arch/unix/apr_private.h \ libtool $(APR_CONFIG) build/apr_rules.mk apr.pc \ @@ -99,6 +101,8 @@ install: $(TARGETS) $(TARGET_LIB): $(OBJECTS) $(LINK) @lib_target@ $(ALL_LIBS) +encoding/apr_escape.lo: include/private/apr_escape_test_char.h + exports.c: $(HEADERS) $(APR_MKEXPORT) $(HEADERS) > $@ @@ -125,5 +129,20 @@ check: $(TARGET_LIB) etags: etags `find . -name '*.[ch]'` +make_tools_dir: + $(APR_MKDIR) tools + +OBJECTS_gen_test_char = tools/gen_test_char.lo $(LOCAL_LIBS) +tools/gen_test_char.lo: make_tools_dir +tools/gen_test_char@EXEEXT@: $(OBJECTS_gen_test_char) + $(LINK_PROG) $(OBJECTS_gen_test_char) $(ALL_LIBS) + +include/private/apr_escape_test_char.h: tools/gen_test_char@EXEEXT@ + $(APR_MKDIR) include/private + tools/gen_test_char@EXEEXT@ > $@ + +LINK_PROG = $(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) $(LT_LDFLAGS) \ + @LT_NO_INSTALL@ $(ALL_LDFLAGS) -o $@ + # DO NOT REMOVE docs: $(INCDIR)/*.h Modified: stable/10/contrib/apr/Makefile.win ============================================================================== --- stable/10/contrib/apr/Makefile.win Tue Aug 12 00:59:19 2014 (r269846) +++ stable/10/contrib/apr/Makefile.win Tue Aug 12 01:40:11 2014 (r269847) @@ -7,7 +7,7 @@ # install - compile everything # clean - mop up everything # -# You can override the build mechansim, choose only one; +# You can override the build mechanism, choose only one; # # USEMAK=1 - compile from exported make files # USEDSW=1 - compile from .dsw / .dsp VC6 projects Modified: stable/10/contrib/apr/NOTICE ============================================================================== --- stable/10/contrib/apr/NOTICE Tue Aug 12 00:59:19 2014 (r269846) +++ stable/10/contrib/apr/NOTICE Tue Aug 12 01:40:11 2014 (r269847) @@ -1,7 +1,7 @@ Apache Portable Runtime -Copyright (c) 2011 The Apache Software Foundation. +Copyright (c) 2000-2014 The Apache Software Foundation. -This product includes software developed by +This product includes software developed at The Apache Software Foundation (http://www.apache.org/). Portions of this software were developed at the National Center Copied: stable/10/contrib/apr/README.cmake (from r266735, head/contrib/apr/README.cmake) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/apr/README.cmake Tue Aug 12 01:40:11 2014 (r269847, copy of r266735, head/contrib/apr/README.cmake) @@ -0,0 +1,112 @@ +Experimental cmake-based build support for APR on Microsoft Windows + +Status +------ + +This build support is currently intended only for Microsoft Windows. +Only Windows NT-based systems can be targeted. (The traditional +Windows build support for APR can target Windows 9x as well.) + +This build support is experimental. Specifically, + +* It does not support all features of APR. +* Some components may not be built correctly and/or in a manner + compatible with the previous Windows build support. +* Build interfaces, such as the mechanisms which are used to enable + optional functionality or specify prerequisites, may change from + release to release as feedback is received from users and bugs and + limitations are resolved. + +Important: Refer to the "Known Bugs and Limitations" section for further + information. + + It is beyond the scope of this document to document or explain + how to utilize the various cmake features, such as different + build backends or provisions for finding support libraries. + + Please refer to the cmake documentation for additional information + that applies to building any project with cmake. + +Prerequisites +------------- + +The following tools must be in PATH: + +* cmake, version 2.8 or later +* If using a command-line compiler: compiler and linker and related tools + (Refer to the cmake documentation for more information.) + +How to build +------------ + +1. cd to a clean directory for building (i.e., don't build in your + source tree) + +2. Some cmake backends may want your compile tools in PATH. (Hint: "Visual + Studio Command Prompt") + +3. cmake -G "some backend, like 'NMake Makefiles'" + -DCMAKE_INSTALL_PREFIX=d:/path/to/aprinst + -DAPR-specific-flags + d:/path/to/aprsource + + Alternately, use cmake-gui and update settings in the GUI. + + APR feature flags: + + APR_INSTALL_PRIVATE_H Install extra .h files which are required when + building httpd and Subversion but which aren't + intended for use by applications. + Default: OFF + APR_HAVE_IPV6 Enable IPv6 support + Default: ON + APR_BUILD_TESTAPR Build APR test suite + Default: OFF + TEST_STATIC_LIBS Build the test suite to test the APR static + library instead of the APR dynamic library. + Default: OFF + In order to build the test suite against both + static and dynamic libraries, separate builds + will be required, one with TEST_STATIC_LIBS + set to ON. + MIN_WINDOWS_VER Minimum Windows version supported by this build + (This controls the setting of _WIN32_WINNT.) + "Vista" or "Windows7" or a numeric value like + "0x0601" + Default: "Vista" + For desktop/server equivalence or other values, + refer to + http://msdn.microsoft.com/en-us/library/windows/ + desktop/aa383745(v=vs.85).aspx + INSTALL_PDB Install .pdb files if generated. + Default: ON + + CMAKE_C_FLAGS_RELEASE, _DEBUG, _RELWITHDEBINFO, _MINSIZEREL + + CMAKE_BUILD_TYPE + + For NMake Makefiles the choices are at least DEBUG, RELEASE, + RELWITHDEBINFO, and MINSIZEREL + Other backends make have other selections. + +4. build using chosen backend (e.g., "nmake install") + +Known Bugs and Limitations +-------------------------- + +* If include/apr.h or other generated files have been created in the source + directory by another build system, they will be used unexpectedly and + cause the build to fail. +* Options should be provided for remaining features: + + APR_POOL_DEBUG +* APR-CHANGES.txt, APR-LICENSE.txt, and APR-NOTICE.txt are not installed, + though perhaps that is a job for a higher-level script. + +Generally: + +* Many APR features have not been tested with this build. +* Developers need to examine the existing Windows build in great detail and see + what is missing from the cmake-based build, whether a feature or some build + nuance. +* Any feedback you can provide on your experiences with this build will be + helpful. Modified: stable/10/contrib/apr/apr.dep ============================================================================== --- stable/10/contrib/apr/apr.dep Tue Aug 12 00:59:19 2014 (r269846) +++ stable/10/contrib/apr/apr.dep Tue Aug 12 01:40:11 2014 (r269847) @@ -1,558 +1,1916 @@ -# Microsoft Developer Studio Generated Dependency File, included by apr.mak - -.\atomic\win32\apr_atomic.c : \ - ".\include\apr_atomic.h"\ - - -.\dso\win32\dso.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ - ".\include\apr_strings.h"\ - ".\include\arch\win32\apr_arch_dso.h"\ - ".\include\arch\win32\apr_arch_file_io.h"\ - ".\include\arch\win32\apr_arch_utf8.h"\ - - -.\file_io\win32\buffer.c : \ - ".\include\apr_getopt.h"\ - ".\include\apr_lib.h"\ - ".\include\apr_poll.h"\ - ".\include\apr_portable.h"\ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@FreeBSD.ORG Tue Aug 12 12:06:22 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8D69C9E5 for ; Tue, 12 Aug 2014 12:06:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5E1212503 for ; Tue, 12 Aug 2014 12:06:22 +0000 (UTC) Received: from hselasky (uid 1241) (envelope-from hselasky@FreeBSD.org) id 6b2e by svn.freebsd.org (DragonFly Mail Agent v0.9+); Tue, 12 Aug 2014 12:06:22 +0000 From: Hans Petter Selasky Date: Tue, 12 Aug 2014 12:06:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269860 - stable/10/sys/ofed/drivers/infiniband/hw/mlx4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53ea033e.6b2e.2182b9e@svn.freebsd.org> X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Aug 2014 12:06:22 -0000 Author: hselasky Date: Tue Aug 12 12:06:21 2014 New Revision: 269860 URL: http://svnweb.freebsd.org/changeset/base/269860 Log: MFC r268314: Fix some compile warnings. Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/infiniband/hw/mlx4/qp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/drivers/infiniband/hw/mlx4/qp.c ============================================================================== --- stable/10/sys/ofed/drivers/infiniband/hw/mlx4/qp.c Tue Aug 12 11:45:57 2014 (r269859) +++ stable/10/sys/ofed/drivers/infiniband/hw/mlx4/qp.c Tue Aug 12 12:06:21 2014 (r269860) @@ -264,7 +264,7 @@ static void post_nop_wqe(struct mlx4_ib_ /* Pad the remainder of the WQE with an inline data segment. */ if (size > s) { inl = wqe + s; - inl->byte_count = cpu_to_be32(1 << 31 | (size - s - sizeof *inl)); + inl->byte_count = cpu_to_be32(1U << 31 | (size - s - sizeof *inl)); } ctrl->srcrb_flags = 0; ctrl->fence_size = size / 16; @@ -1146,7 +1146,7 @@ static void mlx4_ib_lock_cqs(struct mlx4 { if (send_cq == recv_cq) { spin_lock_irq(&send_cq->lock); - __acquire(&recv_cq->lock); + (void) __acquire(&recv_cq->lock); } else if (send_cq->mcq.cqn < recv_cq->mcq.cqn) { spin_lock_irq(&send_cq->lock); spin_lock_nested(&recv_cq->lock, SINGLE_DEPTH_NESTING); @@ -1160,7 +1160,7 @@ static void mlx4_ib_unlock_cqs(struct ml __releases(&send_cq->lock) __releases(&recv_cq->lock) { if (send_cq == recv_cq) { - __release(&recv_cq->lock); + (void) __release(&recv_cq->lock); spin_unlock_irq(&send_cq->lock); } else if (send_cq->mcq.cqn < recv_cq->mcq.cqn) { spin_unlock(&recv_cq->lock); @@ -2422,11 +2422,11 @@ static int build_sriov_qp0_header(struct spc = MLX4_INLINE_ALIGN - ((unsigned long) (inl + 1) & (MLX4_INLINE_ALIGN - 1)); if (header_size <= spc) { - inl->byte_count = cpu_to_be32(1 << 31 | header_size); + inl->byte_count = cpu_to_be32(1U << 31 | header_size); memcpy(inl + 1, sqp->header_buf, header_size); i = 1; } else { - inl->byte_count = cpu_to_be32(1 << 31 | spc); + inl->byte_count = cpu_to_be32(1U << 31 | spc); memcpy(inl + 1, sqp->header_buf, spc); inl = (void *) (inl + 1) + spc; @@ -2445,7 +2445,7 @@ static int build_sriov_qp0_header(struct * of 16 mod 64. */ wmb(); - inl->byte_count = cpu_to_be32(1 << 31 | (header_size - spc)); + inl->byte_count = cpu_to_be32(1U << 31 | (header_size - spc)); i = 2; } @@ -2629,11 +2629,11 @@ static int build_mlx_header(struct mlx4_ spc = MLX4_INLINE_ALIGN - ((unsigned long) (inl + 1) & (MLX4_INLINE_ALIGN - 1)); if (header_size <= spc) { - inl->byte_count = cpu_to_be32(1 << 31 | header_size); + inl->byte_count = cpu_to_be32(1U << 31 | header_size); memcpy(inl + 1, sqp->header_buf, header_size); i = 1; } else { - inl->byte_count = cpu_to_be32(1 << 31 | spc); + inl->byte_count = cpu_to_be32(1U << 31 | spc); memcpy(inl + 1, sqp->header_buf, spc); inl = (void *) (inl + 1) + spc; @@ -2652,7 +2652,7 @@ static int build_mlx_header(struct mlx4_ * of 16 mod 64. */ wmb(); - inl->byte_count = cpu_to_be32(1 << 31 | (header_size - spc)); + inl->byte_count = cpu_to_be32(1U << 31 | (header_size - spc)); i = 2; } @@ -2797,17 +2797,17 @@ static void build_tunnel_header(struct i if (sizeof (hdr) <= spc) { memcpy(inl + 1, &hdr, sizeof (hdr)); wmb(); - inl->byte_count = cpu_to_be32(1 << 31 | sizeof (hdr)); + inl->byte_count = cpu_to_be32(1U << 31 | sizeof (hdr)); i = 1; } else { memcpy(inl + 1, &hdr, spc); wmb(); - inl->byte_count = cpu_to_be32(1 << 31 | spc); + inl->byte_count = cpu_to_be32(1U << 31 | spc); inl = (void *) (inl + 1) + spc; memcpy(inl + 1, (void *) &hdr + spc, sizeof (hdr) - spc); wmb(); - inl->byte_count = cpu_to_be32(1 << 31 | (sizeof (hdr) - spc)); + inl->byte_count = cpu_to_be32(1U << 31 | (sizeof (hdr) - spc)); i = 2; } From owner-svn-src-stable-10@FreeBSD.ORG Tue Aug 12 12:07:57 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A26E4C19 for ; Tue, 12 Aug 2014 12:07:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 792CA251C for ; Tue, 12 Aug 2014 12:07:57 +0000 (UTC) Received: from hselasky (uid 1241) (envelope-from hselasky@FreeBSD.org) id 6b59 by svn.freebsd.org (DragonFly Mail Agent v0.9+); Tue, 12 Aug 2014 12:07:57 +0000 From: Hans Petter Selasky Date: Tue, 12 Aug 2014 12:07:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269861 - stable/10/sys/ofed/drivers/infiniband/hw/mlx4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53ea039d.6b59.686e4d34@svn.freebsd.org> X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Aug 2014 12:07:57 -0000 Author: hselasky Date: Tue Aug 12 12:07:57 2014 New Revision: 269861 URL: http://svnweb.freebsd.org/changeset/base/269861 Log: MFC r268315: Fix compile warning. Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/infiniband/hw/mlx4/mcg.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/drivers/infiniband/hw/mlx4/mcg.c ============================================================================== --- stable/10/sys/ofed/drivers/infiniband/hw/mlx4/mcg.c Tue Aug 12 12:06:21 2014 (r269860) +++ stable/10/sys/ofed/drivers/infiniband/hw/mlx4/mcg.c Tue Aug 12 12:07:57 2014 (r269861) @@ -665,7 +665,7 @@ static void mlx4_ib_mcg_work_handler(str if (!list_empty(&group->pending_list)) req = list_first_entry(&group->pending_list, struct mcast_req, group_list); - if ((method == IB_MGMT_METHOD_GET_RESP)) { + if (method == IB_MGMT_METHOD_GET_RESP) { if (req) { send_reply_to_slave(req->func, group, &req->sa_mad, status); --group->func[req->func].num_pend_reqs; From owner-svn-src-stable-10@FreeBSD.ORG Tue Aug 12 12:10:30 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 701C2D7A for ; Tue, 12 Aug 2014 12:10:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5200825B8 for ; Tue, 12 Aug 2014 12:10:30 +0000 (UTC) Received: from hselasky (uid 1241) (envelope-from hselasky@FreeBSD.org) id 6e9c by svn.freebsd.org (DragonFly Mail Agent v0.9+); Tue, 12 Aug 2014 12:10:29 +0000 From: Hans Petter Selasky Date: Tue, 12 Aug 2014 12:10:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269862 - in stable/10/sys/ofed: drivers/infiniband/hw/mlx4 drivers/net/mlx4 include/linux X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53ea0436.6e9c.2b42d4e5@svn.freebsd.org> X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Aug 2014 12:10:30 -0000 Author: hselasky Date: Tue Aug 12 12:10:29 2014 New Revision: 269862 URL: http://svnweb.freebsd.org/changeset/base/269862 Log: MFC r268316: Fix OFED startup order: All SYSINIT()'s and modules should be loaded prior to starting "/sbin/init" which will run all the "/etc/rc.d/xxx" scripts. Else there can be a race configuring the interfaces via "/etc/rc.conf". Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/infiniband/hw/mlx4/main.c stable/10/sys/ofed/drivers/net/mlx4/en_main.c stable/10/sys/ofed/drivers/net/mlx4/main.c stable/10/sys/ofed/include/linux/module.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/drivers/infiniband/hw/mlx4/main.c ============================================================================== --- stable/10/sys/ofed/drivers/infiniband/hw/mlx4/main.c Tue Aug 12 12:07:57 2014 (r269861) +++ stable/10/sys/ofed/drivers/infiniband/hw/mlx4/main.c Tue Aug 12 12:10:29 2014 (r269862) @@ -2414,6 +2414,6 @@ static moduledata_t mlx4ib_mod = { .evhand = mlx4ib_evhand, }; -DECLARE_MODULE(mlx4ib, mlx4ib_mod, SI_SUB_SMP, SI_ORDER_ANY); +DECLARE_MODULE(mlx4ib, mlx4ib_mod, SI_SUB_OFED_PREINIT, SI_ORDER_ANY); MODULE_DEPEND(mlx4ib, mlx4, 1, 1, 1); MODULE_DEPEND(mlx4ib, ibcore, 1, 1, 1); Modified: stable/10/sys/ofed/drivers/net/mlx4/en_main.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/en_main.c Tue Aug 12 12:07:57 2014 (r269861) +++ stable/10/sys/ofed/drivers/net/mlx4/en_main.c Tue Aug 12 12:10:29 2014 (r269862) @@ -383,5 +383,5 @@ static moduledata_t mlxen_mod = { .name = "mlxen", .evhand = mlxen_evhand, }; -DECLARE_MODULE(mlxen, mlxen_mod, SI_SUB_SMP, SI_ORDER_ANY); +DECLARE_MODULE(mlxen, mlxen_mod, SI_SUB_OFED_PREINIT, SI_ORDER_ANY); MODULE_DEPEND(mlxen, mlx4, 1, 1, 1); Modified: stable/10/sys/ofed/drivers/net/mlx4/main.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/main.c Tue Aug 12 12:07:57 2014 (r269861) +++ stable/10/sys/ofed/drivers/net/mlx4/main.c Tue Aug 12 12:10:29 2014 (r269862) @@ -2875,4 +2875,4 @@ static moduledata_t mlx4_mod = { .evhand = mlx4_evhand, }; MODULE_VERSION(mlx4, 1); -DECLARE_MODULE(mlx4, mlx4_mod, SI_SUB_SMP, SI_ORDER_ANY); +DECLARE_MODULE(mlx4, mlx4_mod, SI_SUB_OFED_PREINIT, SI_ORDER_ANY); Modified: stable/10/sys/ofed/include/linux/module.h ============================================================================== --- stable/10/sys/ofed/include/linux/module.h Tue Aug 12 12:07:57 2014 (r269861) +++ stable/10/sys/ofed/include/linux/module.h Tue Aug 12 12:10:29 2014 (r269862) @@ -44,6 +44,11 @@ #define EXPORT_SYMBOL(name) #define EXPORT_SYMBOL_GPL(name) +/* OFED pre-module initialization */ +#define SI_SUB_OFED_PREINIT (SI_SUB_KTHREAD_INIT - 2) +/* OFED default module initialization */ +#define SI_SUB_OFED_MODINIT (SI_SUB_KTHREAD_INIT - 1) + #include static inline void @@ -68,17 +73,17 @@ _module_run(void *arg) } #define module_init(fn) \ - SYSINIT(fn, SI_SUB_LAST, SI_ORDER_FIRST, _module_run, (fn)) + SYSINIT(fn, SI_SUB_OFED_MODINIT, SI_ORDER_FIRST, _module_run, (fn)) /* * XXX This is a freebsdism designed to work around not having a module * load order resolver built in. */ #define module_init_order(fn, order) \ - SYSINIT(fn, SI_SUB_LAST, (order), _module_run, (fn)) + SYSINIT(fn, SI_SUB_OFED_MODINIT, (order), _module_run, (fn)) #define module_exit(fn) \ - SYSUNINIT(fn, SI_SUB_LAST, SI_ORDER_FIRST, _module_run, (fn)) + SYSUNINIT(fn, SI_SUB_OFED_MODINIT, SI_ORDER_FIRST, _module_run, (fn)) #define module_get(module) #define module_put(module) From owner-svn-src-stable-10@FreeBSD.ORG Tue Aug 12 12:22:39 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AEA1432A for ; Tue, 12 Aug 2014 12:22:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 77F5B26DA for ; Tue, 12 Aug 2014 12:22:39 +0000 (UTC) Received: from hselasky (uid 1241) (envelope-from hselasky@FreeBSD.org) id 622e by svn.freebsd.org (DragonFly Mail Agent v0.9+); Tue, 12 Aug 2014 12:22:39 +0000 From: Hans Petter Selasky Date: Tue, 12 Aug 2014 12:22:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269864 - stable/10/sys/dev/usb/controller X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53ea070f.622e.6d125182@svn.freebsd.org> X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Aug 2014 12:22:39 -0000 Author: hselasky Date: Tue Aug 12 12:22:39 2014 New Revision: 269864 URL: http://svnweb.freebsd.org/changeset/base/269864 Log: MFC r257594: Add description of two EHCI PCI IDs. Modified: stable/10/sys/dev/usb/controller/ehci_pci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- stable/10/sys/dev/usb/controller/ehci_pci.c Tue Aug 12 12:18:43 2014 (r269863) +++ stable/10/sys/dev/usb/controller/ehci_pci.c Tue Aug 12 12:22:39 2014 (r269864) @@ -154,6 +154,10 @@ ehci_pci_match(device_t self) return ("Intel PCH USB 2.0 controller USB-A"); case 0x3b3c8086: return ("Intel PCH USB 2.0 controller USB-B"); + case 0x8c268086: + return ("Intel Lynx Point USB 2.0 controller USB-A"); + case 0x8c2d8086: + return ("Intel Lynx Point USB 2.0 controller USB-B"); case 0x00e01033: return ("NEC uPD 720100 USB 2.0 controller"); From owner-svn-src-stable-10@FreeBSD.ORG Tue Aug 12 14:53:04 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3D343C5A for ; Tue, 12 Aug 2014 14:53:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B0F42A1F for ; Tue, 12 Aug 2014 14:53:04 +0000 (UTC) Received: from emaste (uid 1079) (envelope-from emaste@FreeBSD.org) id 65d0 by svn.freebsd.org (DragonFly Mail Agent v0.9+); Tue, 12 Aug 2014 14:53:02 +0000 From: Ed Maste Date: Tue, 12 Aug 2014 14:53:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269879 - in stable/10: . share/examples share/examples/libusb20 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53ea2a4f.65d0.7621b4e1@svn.freebsd.org> X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Aug 2014 14:53:04 -0000 Author: emaste Date: Tue Aug 12 14:53:02 2014 New Revision: 269879 URL: http://svnweb.freebsd.org/changeset/base/269879 Log: MFC cleanup of libusb20 example r257779 by hselasky: - Use libusb20_strerror() function instead of custom usb_error() one. - Rename "aux.[ch]" to "util.[ch]" which is a more common name for utility functions and allows checkout on some non-FreeBSD systems where the "aux.*" namespace is reserved. - Fix some compile warnings while at it. r257796 by glebius: Finish r257779. PR: 183728 Added: stable/10/share/examples/libusb20/util.c - copied unchanged from r257779, head/share/examples/libusb20/util.c stable/10/share/examples/libusb20/util.h - copied unchanged from r257779, head/share/examples/libusb20/util.h Deleted: stable/10/share/examples/libusb20/aux.c stable/10/share/examples/libusb20/aux.h Modified: stable/10/ObsoleteFiles.inc stable/10/share/examples/Makefile stable/10/share/examples/libusb20/Makefile stable/10/share/examples/libusb20/bulk.c stable/10/share/examples/libusb20/control.c Directory Properties: stable/10/ (props changed) Modified: stable/10/ObsoleteFiles.inc ============================================================================== --- stable/10/ObsoleteFiles.inc Tue Aug 12 14:37:33 2014 (r269878) +++ stable/10/ObsoleteFiles.inc Tue Aug 12 14:53:02 2014 (r269879) @@ -38,6 +38,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20140812: example files removed +OLD_FILES+=usr/share/examples/libusb20/aux.c +OLD_FILES+=usr/share/examples/libusb20/aux.h # 20140728: Remove an obsolete man page OLD_FILES+=usr/share/man/man9/VOP_GETVOBJECT.9.gz OLD_FILES+=usr/share/man/man9/VOP_CREATEVOBJECT.9.gz Modified: stable/10/share/examples/Makefile ============================================================================== --- stable/10/share/examples/Makefile Tue Aug 12 14:37:33 2014 (r269878) +++ stable/10/share/examples/Makefile Tue Aug 12 14:53:02 2014 (r269879) @@ -107,8 +107,8 @@ XFILES= BSD_daemon/FreeBSD.pfa \ kld/syscall/test/call.c \ libusb20/Makefile \ libusb20/README \ - libusb20/aux.c \ - libusb20/aux.h \ + libusb20/util.c \ + libusb20/util.h \ libusb20/bulk.c \ libusb20/control.c \ libvgl/Makefile \ Modified: stable/10/share/examples/libusb20/Makefile ============================================================================== --- stable/10/share/examples/libusb20/Makefile Tue Aug 12 14:37:33 2014 (r269878) +++ stable/10/share/examples/libusb20/Makefile Tue Aug 12 14:53:02 2014 (r269879) @@ -1,13 +1,14 @@ # $FreeBSD$ TARGETS= bulk control +CFLAGS+= -Wall all: $(TARGETS) -bulk: bulk.o aux.o - $(CC) $(CFLAGS) -o bulk bulk.o aux.o -lusb +bulk: bulk.o util.o + $(CC) $(CFLAGS) -o bulk bulk.o util.o -lusb -control: control.o aux.o - $(CC) $(CFLAGS) -o control control.o aux.o -lusb +control: control.o util.o + $(CC) $(CFLAGS) -o control control.o util.o -lusb clean: rm -f $(TARGETS) *.o *~ Modified: stable/10/share/examples/libusb20/bulk.c ============================================================================== --- stable/10/share/examples/libusb20/bulk.c Tue Aug 12 14:37:33 2014 (r269878) +++ stable/10/share/examples/libusb20/bulk.c Tue Aug 12 14:53:02 2014 (r269879) @@ -41,7 +41,7 @@ #include #include -#include "aux.h" +#include "util.h" /* * If you want to see the details of the internal datastructures @@ -74,7 +74,7 @@ doit(struct libusb20_device *dev) */ if ((rv = libusb20_dev_open(dev, 2)) != 0) { - fprintf(stderr, "libusb20_dev_open: %s\n", usb_error(rv)); + fprintf(stderr, "libusb20_dev_open: %s\n", libusb20_strerror(rv)); return; } @@ -84,7 +84,7 @@ doit(struct libusb20_device *dev) */ if ((rv = libusb20_dev_set_config_index(dev, 0)) != 0) { - fprintf(stderr, "libusb20_dev_set_config_index: %s\n", usb_error(rv)); + fprintf(stderr, "libusb20_dev_set_config_index: %s\n", libusb20_strerror(rv)); return; } @@ -97,7 +97,7 @@ doit(struct libusb20_device *dev) if (xfr_in == NULL || xfr_out == NULL) { - fprintf(stderr, "libusb20_tr_get_pointer: %s\n", usb_error(rv)); + fprintf(stderr, "libusb20_tr_get_pointer: %s\n", libusb20_strerror(rv)); return; } @@ -107,12 +107,12 @@ doit(struct libusb20_device *dev) */ if ((rv = libusb20_tr_open(xfr_out, 0, 1, out_ep)) != 0) { - fprintf(stderr, "libusb20_tr_open: %s\n", usb_error(rv)); + fprintf(stderr, "libusb20_tr_open: %s\n", libusb20_strerror(rv)); return; } if ((rv = libusb20_tr_open(xfr_in, 0, 1, in_ep)) != 0) { - fprintf(stderr, "libusb20_tr_open: %s\n", usb_error(rv)); + fprintf(stderr, "libusb20_tr_open: %s\n", libusb20_strerror(rv)); return; } @@ -124,7 +124,7 @@ doit(struct libusb20_device *dev) if ((rv = libusb20_tr_bulk_intr_sync(xfr_out, out_buf, out_len, &rlen, TIMEOUT)) != 0) { - fprintf(stderr, "libusb20_tr_bulk_intr_sync (OUT): %s\n", usb_error(rv)); + fprintf(stderr, "libusb20_tr_bulk_intr_sync (OUT): %s\n", libusb20_strerror(rv)); } printf("sent %d bytes\n", rlen); } @@ -132,7 +132,7 @@ doit(struct libusb20_device *dev) if ((rv = libusb20_tr_bulk_intr_sync(xfr_in, in_buf, BUFLEN, &rlen, TIMEOUT)) != 0) { - fprintf(stderr, "libusb20_tr_bulk_intr_sync: %s\n", usb_error(rv)); + fprintf(stderr, "libusb20_tr_bulk_intr_sync: %s\n", libusb20_strerror(rv)); } printf("received %d bytes\n", rlen); if (rlen > 0) Modified: stable/10/share/examples/libusb20/control.c ============================================================================== --- stable/10/share/examples/libusb20/control.c Tue Aug 12 14:37:33 2014 (r269878) +++ stable/10/share/examples/libusb20/control.c Tue Aug 12 14:53:02 2014 (r269879) @@ -11,8 +11,6 @@ /* * Simple demo program to illustrate the handling of FreeBSD's * libusb20. - * - * XXX */ /* @@ -38,12 +36,15 @@ #include #include #include +#include #include #include #include +#include "util.h" + /* * If you want to see the details of the internal datastructures * in the debugger, unifdef the following. @@ -86,7 +87,7 @@ doit(struct libusb20_device *dev) */ if ((rv = libusb20_dev_open(dev, 1)) != 0) { - fprintf(stderr, "libusb20_dev_open: %s\n", usb_error(rv)); + fprintf(stderr, "libusb20_dev_open: %s\n", libusb20_strerror(rv)); return; } @@ -96,7 +97,7 @@ doit(struct libusb20_device *dev) */ if ((rv = libusb20_dev_set_config_index(dev, 0)) != 0) { - fprintf(stderr, "libusb20_dev_set_config_index: %s\n", usb_error(rv)); + fprintf(stderr, "libusb20_dev_set_config_index: %s\n", libusb20_strerror(rv)); return; } @@ -126,7 +127,7 @@ doit(struct libusb20_device *dev) 0 /* flags */)) != 0) { fprintf(stderr, - "libusb20_dev_request_sync: %s\n", usb_error(rv)); + "libusb20_dev_request_sync: %s\n", libusb20_strerror(rv)); } printf("sent %d bytes\n", actlen); if ((setup.bmRequestType & 0x80) != 0) @@ -146,7 +147,7 @@ doit(struct libusb20_device *dev) if (xfr_intr == NULL) { - fprintf(stderr, "libusb20_tr_get_pointer: %s\n", usb_error(rv)); + fprintf(stderr, "libusb20_tr_get_pointer: %s\n", libusb20_strerror(rv)); return; } @@ -155,7 +156,7 @@ doit(struct libusb20_device *dev) */ if ((rv = libusb20_tr_open(xfr_intr, 0, 1, intr_ep)) != 0) { - fprintf(stderr, "libusb20_tr_open: %s\n", usb_error(rv)); + fprintf(stderr, "libusb20_tr_open: %s\n", libusb20_strerror(rv)); return; } @@ -165,7 +166,7 @@ doit(struct libusb20_device *dev) if ((rv = libusb20_tr_bulk_intr_sync(xfr_intr, in_buf, BUFLEN, &rlen, TIMEOUT)) != 0) { - fprintf(stderr, "libusb20_tr_bulk_intr_sync: %s\n", usb_error(rv)); + fprintf(stderr, "libusb20_tr_bulk_intr_sync: %s\n", libusb20_strerror(rv)); } printf("received %d bytes\n", rlen); if (rlen > 0) Copied: stable/10/share/examples/libusb20/util.c (from r257779, head/share/examples/libusb20/util.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/share/examples/libusb20/util.c Tue Aug 12 14:53:02 2014 (r269879, copy of r257779, head/share/examples/libusb20/util.c) @@ -0,0 +1,50 @@ +/* ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42) (by Poul-Henning Kamp): + * wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return. Joerg Wunsch + * ---------------------------------------------------------------------------- + * + * $FreeBSD$ + */ + +/* + * Helper functions common to all examples + */ + +#include +#include +#include + +#include +#include + +#include "util.h" + +/* + * Print "len" bytes from "buf" in hex, followed by an ASCII + * representation (somewhat resembling the output of hd(1)). + */ +void +print_formatted(uint8_t *buf, uint32_t len) +{ + int i, j; + + for (j = 0; j < len; j += 16) + { + printf("%02x: ", j); + + for (i = 0; i < 16 && i + j < len; i++) + printf("%02x ", buf[i + j]); + printf(" "); + for (i = 0; i < 16 && i + j < len; i++) + { + uint8_t c = buf[i + j]; + if(c >= ' ' && c <= '~') + printf("%c", (char)c); + else + putchar('.'); + } + putchar('\n'); + } +} Copied: stable/10/share/examples/libusb20/util.h (from r257779, head/share/examples/libusb20/util.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/share/examples/libusb20/util.h Tue Aug 12 14:53:02 2014 (r269879, copy of r257779, head/share/examples/libusb20/util.h) @@ -0,0 +1,14 @@ +/* ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42) (by Poul-Henning Kamp): + * wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return. Joerg Wunsch + * ---------------------------------------------------------------------------- + * + * $FreeBSD$ + */ + +#include +#include + +void print_formatted(uint8_t *buf, uint32_t len); From owner-svn-src-stable-10@FreeBSD.ORG Tue Aug 12 18:05:25 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 623947AE for ; Tue, 12 Aug 2014 18:05:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A18F7371A for ; Tue, 12 Aug 2014 17:56:48 +0000 (UTC) Received: from dim (uid 1236) (envelope-from dim@FreeBSD.org) id 6840 by svn.freebsd.org (DragonFly Mail Agent v0.9+); Tue, 12 Aug 2014 17:56:48 +0000 From: Dimitry Andric Date: Tue, 12 Aug 2014 17:56:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269885 - stable/10/lib/libproc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <53ea5560.6840.ea7a307@svn.freebsd.org> X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Aug 2014 18:05:25 -0000 Author: dim Date: Tue Aug 12 17:56:48 2014 New Revision: 269885 URL: http://svnweb.freebsd.org/changeset/base/269885 Log: MFC r269750: In r268463, I misplaced a return in demangle(), causing the function to erroneously skip symbols that were not mangled at all. Fix this by moving the return into the preceding if block. While here, simplify the code by letting __cxa_demangle() allocate the needed space for the demangled symbol. This also fixes a memory leak, which would occur whenever __cxa_demangle() failed. Reported by: pgj PR: base/191981 Modified: stable/10/lib/libproc/proc_sym.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libproc/proc_sym.c ============================================================================== --- stable/10/lib/libproc/proc_sym.c Tue Aug 12 17:51:26 2014 (r269884) +++ stable/10/lib/libproc/proc_sym.c Tue Aug 12 17:56:48 2014 (r269885) @@ -57,21 +57,15 @@ demangle(const char *symbol, char *buf, { #ifndef NO_CXA_DEMANGLE char *dembuf; - size_t demlen; if (symbol[0] == '_' && symbol[1] == 'Z' && symbol[2]) { - dembuf = malloc(len); - if (!dembuf) - goto fail; - demlen = len; - dembuf = __cxa_demangle(symbol, dembuf, &demlen, NULL); + dembuf = __cxa_demangle(symbol, NULL, NULL, NULL); if (!dembuf) goto fail; strlcpy(buf, dembuf, len); free(dembuf); + return; } - - return; fail: #endif /* NO_CXA_DEMANGLE */ strlcpy(buf, symbol, len); From owner-svn-src-stable-10@FreeBSD.ORG Tue Aug 12 19:37:09 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E4CBFDA2; Tue, 12 Aug 2014 19:37:09 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BACF125CA; Tue, 12 Aug 2014 19:37:09 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id AB870B949; Tue, 12 Aug 2014 15:37:08 -0400 (EDT) From: John Baldwin To: Peter Wemm Subject: Re: svn commit: r269847 - in stable/10: contrib/apr contrib/apr/docs contrib/apr/encoding contrib/apr/file_io/unix contrib/apr/include contrib/apr/include/arch/unix contrib/apr/include/private contrib/... Date: Tue, 12 Aug 2014 11:19:31 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20140415; KDE/4.5.5; amd64; ; ) References: <53e9707c.2d6c.2d976b@svn.freebsd.org> In-Reply-To: <53e9707c.2d6c.2d976b@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201408121119.32037.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 12 Aug 2014 15:37:08 -0400 (EDT) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-10@freebsd.org X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Aug 2014 19:37:10 -0000 On Monday, August 11, 2014 9:40:12 pm Peter Wemm wrote: > Author: peter > Date: Tue Aug 12 01:40:11 2014 > New Revision: 269847 > URL: http://svnweb.freebsd.org/changeset/base/269847 > > Log: > MFC r266728,266731,266735,266736,268135,268960,269833 > Update apr 1.4.8 -> 1.5.1 > Update apr-util 1.5.2 -> 1.5.3 > Update serf 1.3.4 -> 1.3.7 > Update svnlite 1.8.8 -> 1.8.10 > Deal with svnlite.1 manpage. Isn't this merge a little quick? 1.8.10 only went into head about 6 hours before this commit. The 1.8.8 merge to 10 was also rather quick (less than an hour after it was merged to HEAD). If the security issues noted in the commit for HEAD are severe enough to warrant an immediate merge, then there should probably be an advisory. Otherwise, I think svn updates should probably have some bake time in HEAD before going to stable. (As an aside, I didn't get a commit mail for 269833 for some reason) -- John Baldwin From owner-svn-src-stable-10@FreeBSD.ORG Tue Aug 12 20:23:23 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9C2D864E; Tue, 12 Aug 2014 20:23:23 +0000 (UTC) Received: from smtp2.wemm.org (smtp2.wemm.org [192.203.228.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp2.wemm.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 7CB8A2CE1; Tue, 12 Aug 2014 20:23:23 +0000 (UTC) Received: from overcee.wemm.org (canning.wemm.org [192.203.228.65]) by smtp2.wemm.org (Postfix) with ESMTP id 5E5D0133; Tue, 12 Aug 2014 13:23:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=m20140428; t=1407875002; bh=AslV9J+mZTOmX89TO/2Iqs2yQ6XiX/Qb6e5k78itR6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=KUBibtRHW5eTkmThX3lZlzAvqRZXkCQ5X45jkyJKq2h8/SZE+nIM/LrzocJBnTjlx XSML60WanRg89jlNfYfxBqXuLcekRKVpIcGMzFj+/nR2yRliL3MaIWEo6exkmxV0PH O2TQlrOwnF4ioYj/FXEofHPmLBe/OmBnbT2P6a4A= From: Peter Wemm To: John Baldwin Subject: Re: svn commit: r269847 - in stable/10: contrib/apr contrib/apr/docs contrib/apr/encoding contrib/apr/file_io/unix contrib/apr/include contrib/apr/include/arch/unix contrib/apr/include/private contrib/... Date: Tue, 12 Aug 2014 13:23:16 -0700 Message-ID: <5874043.odmAkWF3cI@overcee.wemm.org> User-Agent: KMail/4.12.5 (FreeBSD/11.0-CURRENT; KDE/4.12.5; amd64; ; ) In-Reply-To: <201408121119.32037.jhb@freebsd.org> References: <53e9707c.2d6c.2d976b@svn.freebsd.org> <201408121119.32037.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2541638.batFbtmx7p"; micalg="pgp-sha1"; protocol="application/pgp-signature" Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-10@freebsd.org, Peter Wemm X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Aug 2014 20:23:23 -0000 --nextPart2541638.batFbtmx7p Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" On Tuesday 12 August 2014 11:19:31 John Baldwin wrote: > On Monday, August 11, 2014 9:40:12 pm Peter Wemm wrote: > > Author: peter > > Date: Tue Aug 12 01:40:11 2014 > > New Revision: 269847 > > URL: http://svnweb.freebsd.org/changeset/base/269847 > >=20 > > Log: > > MFC r266728,266731,266735,266736,268135,268960,269833 > > =20 > > Update apr 1.4.8 -> 1.5.1 > > Update apr-util 1.5.2 -> 1.5.3 > > Update serf 1.3.4 -> 1.3.7 > > Update svnlite 1.8.8 -> 1.8.10 > > Deal with svnlite.1 manpage. >=20 > Isn't this merge a little quick? 1.8.10 only went into head about 6 = hours > before this commit. The 1.8.8 merge to 10 was also rather quick (les= s than > an hour after it was merged to HEAD). If the security issues noted i= n the > commit for HEAD are severe enough to warrant an immediate merge, then= there > should probably be an advisory. Otherwise, I think svn updates shoul= d > probably have some bake time in HEAD before going to stable. The jumbo-MFC was mostly to gather up the updates that have been baking= in=20 head for a while. 10.1 is coming up soon. It just seemed silly to MFC everything except a specific, targeted secu= rity fix. =20 I suspect that for every question I got about including the security up= date,=20 I'd have received 5 times as many asking why I hadn't included it. =2D-=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI= 6FJV UTF-8: for when a ' or ... just won\342\200\231t do\342\200\246 --nextPart2541638.batFbtmx7p Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABAgAGBQJT6ne5AAoJEDXWlwnsgJ4E5fEH/AtGeI60XUb2EWHRlIiS5WSm keGZlWJjaTV5VbtogcE+dyBsrppPCD68h80EWFbmX+nbi+Nn7E0pHE7yz+BBJwLW Wn4P/Qkc9R7/Ogdti9DqA6gNYPdz0E4/gaKsj3KxfHIRvSK8t9RCVmvQj0rhjQ6g GTEfpG591tGo8jwSbDmODh4YNfNfpGfRJZKdAZcFMND/01tNZ/WqENfRikc1pjno 3jvk9DLucYPg3plWGNt8WIqhcJMxfOt7q4H5vQe8/yH6c7inT6kQJLyWbMk1X1qH VLIg4P6OpS/H2i4Qxfk9Zv3a5usjOd1iYg34rurhl+LfJ9yhjarctVuiWjJye0c= =Jj5C -----END PGP SIGNATURE----- --nextPart2541638.batFbtmx7p-- From owner-svn-src-stable-10@FreeBSD.ORG Wed Aug 13 01:43:39 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 20E23F7E; Wed, 13 Aug 2014 01:43:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E7532256E; Wed, 13 Aug 2014 01:43:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7D1hcGE099870; Wed, 13 Aug 2014 01:43:38 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7D1hcPx099869; Wed, 13 Aug 2014 01:43:38 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201408130143.s7D1hcPx099869@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Wed, 13 Aug 2014 01:43:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269900 - stable/10/usr.bin/mkimg X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 01:43:39 -0000 Author: marcel Date: Wed Aug 13 01:43:38 2014 New Revision: 269900 URL: http://svnweb.freebsd.org/changeset/base/269900 Log: MFC 269745: Create a redundant grain directory and table. Modified: stable/10/usr.bin/mkimg/vmdk.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/mkimg/vmdk.c ============================================================================== --- stable/10/usr.bin/mkimg/vmdk.c Wed Aug 13 01:27:51 2014 (r269899) +++ stable/10/usr.bin/mkimg/vmdk.c Wed Aug 13 01:43:38 2014 (r269900) @@ -110,7 +110,7 @@ static int vmdk_write(int fd) { struct vmdk_header hdr; - uint32_t *gt, *gd; + uint32_t *gt, *gd, *rgd; char *buf, *desc; off_t cur, lim; uint64_t imagesz; @@ -143,25 +143,37 @@ vmdk_write(int fd) le32enc(&hdr.ngtes, VMDK_NGTES); sec = desc_len / VMDK_SECTOR_SIZE + 1; - le64enc(&hdr.rgd_offset, sec); - le64enc(&hdr.gd_offset, sec); ngrains = imagesz / grainsz; ngts = (ngrains + VMDK_NGTES - 1) / VMDK_NGTES; gdsz = (ngts * sizeof(uint32_t) + VMDK_SECTOR_SIZE - 1) & ~(VMDK_SECTOR_SIZE - 1); + gd = calloc(gdsz, 1); if (gd == NULL) { free(desc); return (ENOMEM); } - + le64enc(&hdr.gd_offset, sec); sec += gdsz / VMDK_SECTOR_SIZE; for (n = 0; n < ngts; n++) { le32enc(gd + n, sec); sec += VMDK_NGTES * sizeof(uint32_t) / VMDK_SECTOR_SIZE; } + rgd = calloc(gdsz, 1); + if (rgd == NULL) { + free(gd); + free(desc); + return (ENOMEM); + } + le64enc(&hdr.rgd_offset, sec); + sec += gdsz / VMDK_SECTOR_SIZE; + for (n = 0; n < ngts; n++) { + le32enc(rgd + n, sec); + sec += VMDK_NGTES * sizeof(uint32_t) / VMDK_SECTOR_SIZE; + } + sec = (sec + grainsz - 1) & ~(grainsz - 1); if (verbose) @@ -174,6 +186,7 @@ vmdk_write(int fd) gtsz = ngts * VMDK_NGTES * sizeof(uint32_t); gt = calloc(gtsz, 1); if (gt == NULL) { + free(rgd); free(gd); free(desc); return (ENOMEM); @@ -198,13 +211,18 @@ vmdk_write(int fd) error = errno; if (!error && sparse_write(fd, gt, gtsz) < 0) error = errno; + if (!error && sparse_write(fd, rgd, gdsz) < 0) + error = errno; + if (!error && sparse_write(fd, gt, gtsz) < 0) + error = errno; free(gt); + free(rgd); free(gd); free(desc); if (error) return (error); - cur = VMDK_SECTOR_SIZE + desc_len + gdsz + gtsz; + cur = VMDK_SECTOR_SIZE + desc_len + (gdsz + gtsz) * 2; lim = sec * VMDK_SECTOR_SIZE; if (cur < lim) { buf = calloc(VMDK_SECTOR_SIZE, 1); From owner-svn-src-stable-10@FreeBSD.ORG Wed Aug 13 06:41:07 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 25D15331; Wed, 13 Aug 2014 06:41:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 076222666; Wed, 13 Aug 2014 06:41:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7D6f6oD033632; Wed, 13 Aug 2014 06:41:06 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7D6f6gL033631; Wed, 13 Aug 2014 06:41:06 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201408130641.s7D6f6gL033631@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Wed, 13 Aug 2014 06:41:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269912 - stable/10/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 06:41:07 -0000 Author: rpaulo Date: Wed Aug 13 06:41:06 2014 New Revision: 269912 URL: http://svnweb.freebsd.org/changeset/base/269912 Log: MFC r269776 Remove the BROKEN_LIBELF section. Modified: stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Wed Aug 13 06:39:44 2014 (r269911) +++ stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Wed Aug 13 06:41:06 2014 (r269912) @@ -1915,7 +1915,6 @@ dtrace_program_link(dtrace_hdl_t *dtp, d goto done; } #if !defined(sun) -#define BROKEN_LIBELF /* * FreeBSD's ld(1) is not instructed to interpret and add * correctly the SUNW_dof section present in tfile. @@ -1939,9 +1938,6 @@ dtrace_program_link(dtrace_hdl_t *dtp, d /* * Add the string '.SUWN_dof' to the shstrtab section. */ -#ifdef BROKEN_LIBELF - elf_flagelf(e, ELF_C_SET, ELF_F_LAYOUT); -#endif elf_getshdrstrndx(e, &stridx); scn = elf_getscn(e, stridx); gelf_getshdr(scn, &shdr); @@ -1953,54 +1949,6 @@ dtrace_program_link(dtrace_hdl_t *dtp, d loc = shdr.sh_size; shdr.sh_size += data->d_size; gelf_update_shdr(scn, &shdr); -#ifdef BROKEN_LIBELF - off = shdr.sh_offset; - rc = shdr.sh_offset + shdr.sh_size; - gelf_getehdr(e, &ehdr); - if (ehdr.e_shoff > off) { - off = ehdr.e_shoff + ehdr.e_shnum * ehdr.e_shentsize; - rc = roundup(rc, 8); - ehdr.e_shoff = rc; - gelf_update_ehdr(e, &ehdr); - rc += ehdr.e_shnum * ehdr.e_shentsize; - } - for (;;) { - scn0 = NULL; - scn = NULL; - while ((scn = elf_nextscn(e, scn)) != NULL) { - gelf_getshdr(scn, &shdr); - if (shdr.sh_type == SHT_NOBITS || - shdr.sh_offset < off) - continue; - /* Find the immediately adjcent section. */ - if (scn0 == NULL || - shdr.sh_offset < shdr0.sh_offset) { - scn0 = scn; - gelf_getshdr(scn0, &shdr0); - } - } - if (scn0 == NULL) - break; - /* Load section data to work around another bug */ - elf_getdata(scn0, NULL); - /* Update section header, assure section alignment */ - off = shdr0.sh_offset + shdr0.sh_size; - rc = roundup(rc, shdr0.sh_addralign); - shdr0.sh_offset = rc; - gelf_update_shdr(scn0, &shdr0); - rc += shdr0.sh_size; - } - if (elf_update(e, ELF_C_WRITE) < 0) { - ret = dt_link_error(dtp, NULL, -1, NULL, - "failed to add append the shstrtab section: %s", - elf_errmsg(elf_errno())); - elf_end(e); - close(efd); - goto done; - } - elf_end(e); - e = elf_begin(efd, ELF_C_RDWR, NULL); -#endif /* * Construct the .SUNW_dof section. */ From owner-svn-src-stable-10@FreeBSD.ORG Wed Aug 13 06:45:02 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D1D7F85D; Wed, 13 Aug 2014 06:45:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BEA7326B7; Wed, 13 Aug 2014 06:45:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7D6j2Up036893; Wed, 13 Aug 2014 06:45:02 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7D6j2tD036892; Wed, 13 Aug 2014 06:45:02 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201408130645.s7D6j2tD036892@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Wed, 13 Aug 2014 06:45:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269913 - stable/10 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 06:45:02 -0000 Author: rpaulo Date: Wed Aug 13 06:45:02 2014 New Revision: 269913 URL: http://svnweb.freebsd.org/changeset/base/269913 Log: MFC r269744 Run dtrace in 32-bit mode when compiling 32-bit libraries. Modified: stable/10/Makefile.inc1 Directory Properties: stable/10/ (props changed) Modified: stable/10/Makefile.inc1 ============================================================================== --- stable/10/Makefile.inc1 Wed Aug 13 06:41:06 2014 (r269912) +++ stable/10/Makefile.inc1 Wed Aug 13 06:45:02 2014 (r269913) @@ -391,7 +391,8 @@ LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTR LIBDIR=/usr/lib32 \ SHLIBDIR=/usr/lib32 \ LIBPRIVATEDIR=/usr/lib32/private \ - COMPILER_TYPE=${WMAKE_COMPILER_TYPE} + COMPILER_TYPE=${WMAKE_COMPILER_TYPE} \ + DTRACE="${DTRACE} -32" LIB32WMAKEFLAGS+= \ CC="${XCC} ${LIB32FLAGS}" \ CXX="${XCXX} ${LIB32FLAGS}" \ From owner-svn-src-stable-10@FreeBSD.ORG Wed Aug 13 06:55:31 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3CECD1EC; Wed, 13 Aug 2014 06:55:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 293E42830; Wed, 13 Aug 2014 06:55:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7D6tUu4041651; Wed, 13 Aug 2014 06:55:30 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7D6tUIs041650; Wed, 13 Aug 2014 06:55:30 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201408130655.s7D6tUIs041650@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 13 Aug 2014 06:55:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269914 - stable/10/sys/vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 06:55:31 -0000 Author: kib Date: Wed Aug 13 06:55:30 2014 New Revision: 269914 URL: http://svnweb.freebsd.org/changeset/base/269914 Log: MFC r269642: Add wrappers to assert that vm object is unlocked and for try upgrade. Modified: stable/10/sys/vm/vm_object.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_object.h ============================================================================== --- stable/10/sys/vm/vm_object.h Wed Aug 13 06:45:02 2014 (r269913) +++ stable/10/sys/vm/vm_object.h Wed Aug 13 06:55:30 2014 (r269914) @@ -225,6 +225,8 @@ extern struct vm_object kmem_object_stor rw_assert(&(object)->lock, RA_RLOCKED) #define VM_OBJECT_ASSERT_WLOCKED(object) \ rw_assert(&(object)->lock, RA_WLOCKED) +#define VM_OBJECT_ASSERT_UNLOCKED(object) \ + rw_assert(&(object)->lock, RA_UNLOCKED) #define VM_OBJECT_LOCK_DOWNGRADE(object) \ rw_downgrade(&(object)->lock) #define VM_OBJECT_RLOCK(object) \ @@ -237,6 +239,8 @@ extern struct vm_object kmem_object_stor rw_try_rlock(&(object)->lock) #define VM_OBJECT_TRYWLOCK(object) \ rw_try_wlock(&(object)->lock) +#define VM_OBJECT_TRYUPGRADE(object) \ + rw_try_upgrade(&(object)->lock) #define VM_OBJECT_WLOCK(object) \ rw_wlock(&(object)->lock) #define VM_OBJECT_WUNLOCK(object) \ From owner-svn-src-stable-10@FreeBSD.ORG Wed Aug 13 06:58:43 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 74E9951B; Wed, 13 Aug 2014 06:58:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6122A2874; Wed, 13 Aug 2014 06:58:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7D6whqw042151; Wed, 13 Aug 2014 06:58:43 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7D6whIc042150; Wed, 13 Aug 2014 06:58:43 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201408130658.s7D6whIc042150@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 13 Aug 2014 06:58:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269915 - stable/10/sys/vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 06:58:43 -0000 Author: kib Date: Wed Aug 13 06:58:42 2014 New Revision: 269915 URL: http://svnweb.freebsd.org/changeset/base/269915 Log: MFC r269643: Weaken the requirement for the vm object lock by only asserting locked object in vm_pager_page_unswapped(), instead of locked exclusively. Modified: stable/10/sys/vm/vm_pager.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_pager.h ============================================================================== --- stable/10/sys/vm/vm_pager.h Wed Aug 13 06:55:30 2014 (r269914) +++ stable/10/sys/vm/vm_pager.h Wed Aug 13 06:58:42 2014 (r269915) @@ -187,7 +187,7 @@ static __inline void vm_pager_page_unswapped(vm_page_t m) { - VM_OBJECT_ASSERT_WLOCKED(m->object); + VM_OBJECT_ASSERT_LOCKED(m->object); if (pagertab[m->object->type]->pgo_pageunswapped) (*pagertab[m->object->type]->pgo_pageunswapped)(m); } From owner-svn-src-stable-10@FreeBSD.ORG Wed Aug 13 06:59:42 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 194236C7; Wed, 13 Aug 2014 06:59:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0482E2891; Wed, 13 Aug 2014 06:59:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7D6xfSD042340; Wed, 13 Aug 2014 06:59:41 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7D6xfTM042333; Wed, 13 Aug 2014 06:59:41 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201408130659.s7D6xfTM042333@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 13 Aug 2014 06:59:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269916 - stable/10/sys/dev/usb/controller X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 06:59:42 -0000 Author: hselasky Date: Wed Aug 13 06:59:40 2014 New Revision: 269916 URL: http://svnweb.freebsd.org/changeset/base/269916 Log: MFC r269604: - Implement fast interrupt handler to save CPU usage. - Cleanup some register reads and writes to use existing register access macros. - Ensure code which only applies to the control endpoint is not run for other endpoints in the data transfer path. Modified: stable/10/sys/dev/usb/controller/at91dci.c stable/10/sys/dev/usb/controller/at91dci.h stable/10/sys/dev/usb/controller/at91dci_atmelarm.c stable/10/sys/dev/usb/controller/at91dci_fdt.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/controller/at91dci.c ============================================================================== --- stable/10/sys/dev/usb/controller/at91dci.c Wed Aug 13 06:58:42 2014 (r269915) +++ stable/10/sys/dev/usb/controller/at91dci.c Wed Aug 13 06:59:40 2014 (r269916) @@ -91,6 +91,9 @@ #define AT9100_DCI_PC2SC(pc) \ AT9100_DCI_BUS2SC(USB_DMATAG_TO_XROOT((pc)->tag_parent)->bus) +#define AT9100_DCI_THREAD_IRQ \ + (AT91_UDP_INT_BUS | AT91_UDP_INT_END_BR | AT91_UDP_INT_RXRSM | AT91_UDP_INT_RXSUSP) + #ifdef USB_DEBUG static int at91dcidebug = 0; @@ -296,17 +299,15 @@ at91dci_set_address(struct at91dci_softc } static uint8_t -at91dci_setup_rx(struct at91dci_td *td) +at91dci_setup_rx(struct at91dci_softc *sc, struct at91dci_td *td) { - struct at91dci_softc *sc; struct usb_device_request req; uint32_t csr; uint32_t temp; uint16_t count; /* read out FIFO status */ - csr = bus_space_read_4(td->io_tag, td->io_hdl, - td->status_reg); + csr = AT91_UDP_READ_4(sc, td->status_reg); DPRINTFN(5, "csr=0x%08x rem=%u\n", csr, td->remainder); @@ -338,7 +339,7 @@ at91dci_setup_rx(struct at91dci_td *td) goto not_complete; } /* receive data */ - bus_space_read_multi_1(td->io_tag, td->io_hdl, + bus_space_read_multi_1(sc->sc_io_tag, sc->sc_io_hdl, td->fifo_reg, (void *)&req, sizeof(req)); /* copy data into real buffer */ @@ -347,9 +348,6 @@ at91dci_setup_rx(struct at91dci_td *td) td->offset = sizeof(req); td->remainder = 0; - /* get pointer to softc */ - sc = AT9100_DCI_PC2SC(td->pc); - /* sneak peek the set address */ if ((req.bmRequestType == UT_WRITE_DEVICE) && (req.bRequest == UR_SET_ADDRESS)) { @@ -367,8 +365,7 @@ at91dci_setup_rx(struct at91dci_td *td) /* write the direction of the control transfer */ AT91_CSR_ACK(csr, temp); - bus_space_write_4(td->io_tag, td->io_hdl, - td->status_reg, csr); + AT91_UDP_WRITE_4(sc, td->status_reg, csr); return (0); /* complete */ not_complete: @@ -383,15 +380,13 @@ not_complete: if (temp) { DPRINTFN(5, "clearing 0x%08x\n", temp); AT91_CSR_ACK(csr, temp); - bus_space_write_4(td->io_tag, td->io_hdl, - td->status_reg, csr); + AT91_UDP_WRITE_4(sc, td->status_reg, csr); } return (1); /* not complete */ - } static uint8_t -at91dci_data_rx(struct at91dci_td *td) +at91dci_data_rx(struct at91dci_softc *sc, struct at91dci_td *td) { struct usb_page_search buf_res; uint32_t csr; @@ -406,8 +401,7 @@ at91dci_data_rx(struct at91dci_td *td) /* check if any of the FIFO banks have data */ repeat: /* read out FIFO status */ - csr = bus_space_read_4(td->io_tag, td->io_hdl, - td->status_reg); + csr = AT91_UDP_READ_4(sc, td->status_reg); DPRINTFN(5, "csr=0x%08x rem=%u\n", csr, td->remainder); @@ -436,8 +430,7 @@ repeat: if (temp) { /* write command */ AT91_CSR_ACK(csr, temp); - bus_space_write_4(td->io_tag, td->io_hdl, - td->status_reg, csr); + AT91_UDP_WRITE_4(sc, td->status_reg, csr); } return (1); /* not complete */ } @@ -470,7 +463,7 @@ repeat: buf_res.length = count; } /* receive data */ - bus_space_read_multi_1(td->io_tag, td->io_hdl, + bus_space_read_multi_1(sc->sc_io_tag, sc->sc_io_hdl, td->fifo_reg, buf_res.buffer, buf_res.length); /* update counters */ @@ -495,8 +488,7 @@ repeat: /* write command */ AT91_CSR_ACK(csr, temp); - bus_space_write_4(td->io_tag, td->io_hdl, - td->status_reg, csr); + AT91_UDP_WRITE_4(sc, td->status_reg, csr); /* * NOTE: We may have to delay a little bit before @@ -518,7 +510,7 @@ repeat: } static uint8_t -at91dci_data_tx(struct at91dci_td *td) +at91dci_data_tx(struct at91dci_softc *sc, struct at91dci_td *td) { struct usb_page_search buf_res; uint32_t csr; @@ -531,8 +523,7 @@ at91dci_data_tx(struct at91dci_td *td) repeat: /* read out FIFO status */ - csr = bus_space_read_4(td->io_tag, td->io_hdl, - td->status_reg); + csr = AT91_UDP_READ_4(sc, td->status_reg); DPRINTFN(5, "csr=0x%08x rem=%u\n", csr, td->remainder); @@ -552,8 +543,7 @@ repeat: if (temp) { /* write command */ AT91_CSR_ACK(csr, temp); - bus_space_write_4(td->io_tag, td->io_hdl, - td->status_reg, csr); + AT91_UDP_WRITE_4(sc, td->status_reg, csr); } return (1); /* not complete */ } else { @@ -569,7 +559,6 @@ repeat: count = td->remainder; } while (count > 0) { - usbd_get_page(td->pc, td->offset, &buf_res); /* get correct length */ @@ -577,7 +566,7 @@ repeat: buf_res.length = count; } /* transmit data */ - bus_space_write_multi_1(td->io_tag, td->io_hdl, + bus_space_write_multi_1(sc->sc_io_tag, sc->sc_io_hdl, td->fifo_reg, buf_res.buffer, buf_res.length); /* update counters */ @@ -588,8 +577,7 @@ repeat: /* write command */ AT91_CSR_ACK(csr, temp); - bus_space_write_4(td->io_tag, td->io_hdl, - td->status_reg, csr); + AT91_UDP_WRITE_4(sc, td->status_reg, csr); /* check remainder */ if (td->remainder == 0) { @@ -605,19 +593,13 @@ repeat: } static uint8_t -at91dci_data_tx_sync(struct at91dci_td *td) +at91dci_data_tx_sync(struct at91dci_softc *sc, struct at91dci_td *td) { - struct at91dci_softc *sc; uint32_t csr; uint32_t temp; -#if 0 -repeat: -#endif - /* read out FIFO status */ - csr = bus_space_read_4(td->io_tag, td->io_hdl, - td->status_reg); + csr = AT91_UDP_READ_4(sc, td->status_reg); DPRINTFN(5, "csr=0x%08x\n", csr); @@ -637,8 +619,7 @@ repeat: if (!(csr & AT91_UDP_CSR_TXCOMP)) { goto not_complete; } - sc = AT9100_DCI_PC2SC(td->pc); - if (sc->sc_dv_addr != 0xFF) { + if (td->status_reg == AT91_UDP_CSR(0) && sc->sc_dv_addr != 0xFF) { /* * The AT91 has a special requirement with regard to * setting the address and that is to write the new @@ -648,8 +629,7 @@ repeat: } /* write command */ AT91_CSR_ACK(csr, temp); - bus_space_write_4(td->io_tag, td->io_hdl, - td->status_reg, csr); + AT91_UDP_WRITE_4(sc, td->status_reg, csr); return (0); /* complete */ @@ -657,24 +637,26 @@ not_complete: if (temp) { /* write command */ AT91_CSR_ACK(csr, temp); - bus_space_write_4(td->io_tag, td->io_hdl, - td->status_reg, csr); + AT91_UDP_WRITE_4(sc, td->status_reg, csr); } return (1); /* not complete */ } -static uint8_t +static void at91dci_xfer_do_fifo(struct usb_xfer *xfer) { - struct at91dci_softc *sc; + struct at91dci_softc *sc = AT9100_DCI_BUS2SC(xfer->xroot->bus); struct at91dci_td *td; uint8_t temp; DPRINTFN(9, "\n"); td = xfer->td_transfer_cache; + if (td == NULL) + return; + while (1) { - if ((td->func) (td)) { + if ((td->func) (sc, td)) { /* operation in progress */ break; } @@ -704,10 +686,9 @@ at91dci_xfer_do_fifo(struct usb_xfer *xf if (temp & 1) td->fifo_bank = 1; } - return (1); /* not complete */ + return; done: - sc = AT9100_DCI_BUS2SC(xfer->xroot->bus); temp = (xfer->endpointno & UE_ADDR); /* update FIFO bank flag and multi buffer */ @@ -718,23 +699,42 @@ done: } /* compute all actual lengths */ + xfer->td_transfer_cache = NULL; + sc->sc_xfer_complete = 1; +} - at91dci_standard_done(xfer); +static uint8_t +at91dci_xfer_do_complete(struct usb_xfer *xfer) +{ + struct at91dci_td *td; - return (0); /* complete */ + DPRINTFN(9, "\n"); + td = xfer->td_transfer_cache; + if (td == NULL) { + /* compute all actual lengths */ + at91dci_standard_done(xfer); + return(1); + } + return (0); } static void -at91dci_interrupt_poll(struct at91dci_softc *sc) +at91dci_interrupt_poll_locked(struct at91dci_softc *sc) { struct usb_xfer *xfer; + TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) + at91dci_xfer_do_fifo(xfer); +} + +static void +at91dci_interrupt_complete_locked(struct at91dci_softc *sc) +{ + struct usb_xfer *xfer; repeat: TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { - if (!at91dci_xfer_do_fifo(xfer)) { - /* queue has been modified */ + if (at91dci_xfer_do_complete(xfer)) goto repeat; - } } } @@ -764,20 +764,47 @@ at91dci_vbus_interrupt(struct at91dci_so } } +int +at91dci_filter_interrupt(void *arg) +{ + struct at91dci_softc *sc = arg; + int retval = FILTER_HANDLED; + uint32_t status; + + USB_BUS_SPIN_LOCK(&sc->sc_bus); + + status = AT91_UDP_READ_4(sc, AT91_UDP_ISR); + status &= AT91_UDP_INT_DEFAULT; + + if (status & AT9100_DCI_THREAD_IRQ) + retval = FILTER_SCHEDULE_THREAD; + + /* acknowledge interrupts */ + AT91_UDP_WRITE_4(sc, AT91_UDP_ICR, status & ~AT9100_DCI_THREAD_IRQ); + + /* poll FIFOs, if any */ + at91dci_interrupt_poll_locked(sc); + + if (sc->sc_xfer_complete != 0) + retval = FILTER_SCHEDULE_THREAD; + + USB_BUS_SPIN_UNLOCK(&sc->sc_bus); + + return (retval); +} + void -at91dci_interrupt(struct at91dci_softc *sc) +at91dci_interrupt(void *arg) { + struct at91dci_softc *sc = arg; uint32_t status; USB_BUS_LOCK(&sc->sc_bus); + USB_BUS_SPIN_LOCK(&sc->sc_bus); status = AT91_UDP_READ_4(sc, AT91_UDP_ISR); - status &= AT91_UDP_INT_DEFAULT; + status &= AT9100_DCI_THREAD_IRQ; - if (!status) { - USB_BUS_UNLOCK(&sc->sc_bus); - return; - } /* acknowledge interrupts */ AT91_UDP_WRITE_4(sc, AT91_UDP_ICR, status); @@ -837,14 +864,12 @@ at91dci_interrupt(struct at91dci_softc * /* complete root HUB interrupt endpoint */ at91dci_root_intr(sc); } - /* check for any endpoint interrupts */ - - if (status & AT91_UDP_INT_EPS) { - - DPRINTFN(5, "real endpoint interrupt 0x%08x\n", status); - at91dci_interrupt_poll(sc); + if (sc->sc_xfer_complete != 0) { + sc->sc_xfer_complete = 0; + at91dci_interrupt_complete_locked(sc); } + USB_BUS_SPIN_UNLOCK(&sc->sc_bus); USB_BUS_UNLOCK(&sc->sc_bus); } @@ -1048,12 +1073,17 @@ at91dci_timeout(void *arg) static void at91dci_start_standard_chain(struct usb_xfer *xfer) { + struct at91dci_softc *sc = AT9100_DCI_BUS2SC(xfer->xroot->bus); + DPRINTFN(9, "\n"); + USB_BUS_SPIN_LOCK(&sc->sc_bus); + /* poll one time */ - if (at91dci_xfer_do_fifo(xfer)) { + at91dci_xfer_do_fifo(xfer); + + if (at91dci_xfer_do_complete(xfer) == 0) { - struct at91dci_softc *sc = AT9100_DCI_BUS2SC(xfer->xroot->bus); uint8_t ep_no = xfer->endpointno & UE_ADDR; /* @@ -1074,6 +1104,7 @@ at91dci_start_standard_chain(struct usb_ &at91dci_timeout, xfer->timeout); } } + USB_BUS_SPIN_UNLOCK(&sc->sc_bus); } static void @@ -1214,6 +1245,8 @@ at91dci_device_done(struct usb_xfer *xfe DPRINTFN(2, "xfer=%p, endpoint=%p, error=%d\n", xfer, xfer->endpoint, error); + USB_BUS_SPIN_LOCK(&sc->sc_bus); + if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) { ep_no = (xfer->endpointno & UE_ADDR); @@ -1222,8 +1255,11 @@ at91dci_device_done(struct usb_xfer *xfe DPRINTFN(15, "disable interrupts on endpoint %d\n", ep_no); } + /* dequeue transfer and start next transfer */ usbd_transfer_done(xfer, error); + + USB_BUS_SPIN_UNLOCK(&sc->sc_bus); } static void @@ -1246,11 +1282,14 @@ at91dci_set_stall(struct usb_device *ude /* set FORCESTALL */ sc = AT9100_DCI_BUS2SC(udev->bus); + + USB_BUS_SPIN_LOCK(&sc->sc_bus); csr_reg = (ep->edesc->bEndpointAddress & UE_ADDR); csr_reg = AT91_UDP_CSR(csr_reg); csr_val = AT91_UDP_READ_4(sc, csr_reg); AT91_CSR_ACK(csr_val, AT91_UDP_CSR_FORCESTALL); AT91_UDP_WRITE_4(sc, csr_reg, csr_val); + USB_BUS_SPIN_UNLOCK(&sc->sc_bus); } static void @@ -1267,6 +1306,9 @@ at91dci_clear_stall_sub(struct at91dci_s /* clearing stall is not needed */ return; } + + USB_BUS_SPIN_LOCK(&sc->sc_bus); + /* compute CSR register offset */ csr_reg = AT91_UDP_CSR(ep_no); @@ -1347,6 +1389,8 @@ at91dci_clear_stall_sub(struct at91dci_s /* enable endpoint */ AT91_UDP_WRITE_4(sc, AT91_UDP_CSR(ep_no), csr_val); + + USB_BUS_SPIN_UNLOCK(&sc->sc_bus); } static void @@ -1482,7 +1526,10 @@ at91dci_do_poll(struct usb_bus *bus) struct at91dci_softc *sc = AT9100_DCI_BUS2SC(bus); USB_BUS_LOCK(&sc->sc_bus); - at91dci_interrupt_poll(sc); + USB_BUS_SPIN_LOCK(&sc->sc_bus); + at91dci_interrupt_poll_locked(sc); + at91dci_interrupt_complete_locked(sc); + USB_BUS_SPIN_UNLOCK(&sc->sc_bus); USB_BUS_UNLOCK(&sc->sc_bus); } @@ -2237,8 +2284,6 @@ at91dci_xfer_setup(struct usb_setup_para td = USB_ADD_BYTES(parm->buf, parm->size[0]); /* init TD */ - td->io_tag = sc->sc_io_tag; - td->io_hdl = sc->sc_io_hdl; td->max_packet_size = xfer->max_packet_size; td->status_reg = AT91_UDP_CSR(ep_no); td->fifo_reg = AT91_UDP_FDR(ep_no); Modified: stable/10/sys/dev/usb/controller/at91dci.h ============================================================================== --- stable/10/sys/dev/usb/controller/at91dci.h Wed Aug 13 06:58:42 2014 (r269915) +++ stable/10/sys/dev/usb/controller/at91dci.h Wed Aug 13 06:59:40 2014 (r269916) @@ -133,12 +133,11 @@ bus_space_write_4((sc)->sc_io_tag, (sc)->sc_io_hdl, reg, data) struct at91dci_td; +struct at91dci_softc; -typedef uint8_t (at91dci_cmd_t)(struct at91dci_td *td); +typedef uint8_t (at91dci_cmd_t)(struct at91dci_softc *sc, struct at91dci_td *td); struct at91dci_td { - bus_space_tag_t io_tag; - bus_space_handle_t io_hdl; struct at91dci_td *obj_next; at91dci_cmd_t *func; struct usb_page_cache *pc; @@ -221,6 +220,8 @@ struct at91dci_softc { void (*sc_pull_down) (void *arg); void *sc_pull_arg; + uint32_t sc_xfer_complete; + uint8_t sc_rt_addr; /* root HUB address */ uint8_t sc_dv_addr; /* device address */ uint8_t sc_conf; /* root HUB config */ @@ -235,7 +236,8 @@ struct at91dci_softc { usb_error_t at91dci_init(struct at91dci_softc *sc); void at91dci_uninit(struct at91dci_softc *sc); -void at91dci_interrupt(struct at91dci_softc *sc); +driver_filter_t at91dci_filter_interrupt; +driver_intr_t at91dci_interrupt; void at91dci_vbus_interrupt(struct at91dci_softc *sc, uint8_t is_on); #endif /* _AT9100_DCI_H_ */ Modified: stable/10/sys/dev/usb/controller/at91dci_atmelarm.c ============================================================================== --- stable/10/sys/dev/usb/controller/at91dci_atmelarm.c Wed Aug 13 06:58:42 2014 (r269915) +++ stable/10/sys/dev/usb/controller/at91dci_atmelarm.c Wed Aug 13 06:59:40 2014 (r269916) @@ -212,8 +212,8 @@ at91_udp_attach(device_t dev) } device_set_ivars(sc->sc_dci.sc_bus.bdev, &sc->sc_dci.sc_bus); - err = bus_setup_intr(dev, sc->sc_dci.sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, - NULL, (driver_intr_t *)at91dci_interrupt, sc, &sc->sc_dci.sc_intr_hdl); + err = bus_setup_intr(dev, sc->sc_dci.sc_irq_res, INTR_TYPE_TTY | INTR_MPSAFE, + at91dci_filter_interrupt, at91dci_interrupt, sc, &sc->sc_dci.sc_intr_hdl); if (err) { sc->sc_dci.sc_intr_hdl = NULL; goto error; Modified: stable/10/sys/dev/usb/controller/at91dci_fdt.c ============================================================================== --- stable/10/sys/dev/usb/controller/at91dci_fdt.c Wed Aug 13 06:58:42 2014 (r269915) +++ stable/10/sys/dev/usb/controller/at91dci_fdt.c Wed Aug 13 06:59:40 2014 (r269916) @@ -218,13 +218,8 @@ at91_udp_attach(device_t dev) } device_set_ivars(sc->sc_dci.sc_bus.bdev, &sc->sc_dci.sc_bus); -#if (__FreeBSD_version >= 700031) - err = bus_setup_intr(dev, sc->sc_dci.sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, - NULL, (driver_intr_t *)at91dci_interrupt, sc, &sc->sc_dci.sc_intr_hdl); -#else - err = bus_setup_intr(dev, sc->sc_dci.sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, - (driver_intr_t *)at91dci_interrupt, sc, &sc->sc_dci.sc_intr_hdl); -#endif + err = bus_setup_intr(dev, sc->sc_dci.sc_irq_res, INTR_TYPE_TTY | INTR_MPSAFE, + at91dci_filter_interrupt, at91dci_interrupt, sc, &sc->sc_dci.sc_intr_hdl); if (err) { sc->sc_dci.sc_intr_hdl = NULL; goto error; From owner-svn-src-stable-10@FreeBSD.ORG Wed Aug 13 07:02:23 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DC612966; Wed, 13 Aug 2014 07:02:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C8B912972; Wed, 13 Aug 2014 07:02:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7D72N7X046019; Wed, 13 Aug 2014 07:02:23 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7D72Nbe046018; Wed, 13 Aug 2014 07:02:23 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201408130702.s7D72Nbe046018@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 13 Aug 2014 07:02:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269917 - stable/10/sys/dev/usb X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 07:02:24 -0000 Author: hselasky Date: Wed Aug 13 07:02:23 2014 New Revision: 269917 URL: http://svnweb.freebsd.org/changeset/base/269917 Log: MFC r269566: Fix for deadlock in USB device side mode. Modified: stable/10/sys/dev/usb/usb_device.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/usb_device.c ============================================================================== --- stable/10/sys/dev/usb/usb_device.c Wed Aug 13 06:59:40 2014 (r269916) +++ stable/10/sys/dev/usb/usb_device.c Wed Aug 13 07:02:23 2014 (r269917) @@ -451,6 +451,17 @@ usb_endpoint_foreach(struct usb_device * return (NULL); } +#if USB_HAVE_UGEN +static uint16_t +usb_get_refcount(struct usb_device *udev) +{ + if (usb_proc_is_called_from(USB_BUS_EXPLORE_PROC(udev->bus)) || + usb_proc_is_called_from(USB_BUS_CONTROL_XFER_PROC(udev->bus))) + return (1); + return (2); +} +#endif + /*------------------------------------------------------------------------* * usb_wait_pending_ref_locked * @@ -463,9 +474,7 @@ static void usb_wait_pending_ref_locked(struct usb_device *udev) { #if USB_HAVE_UGEN - const uint16_t refcount = - usb_proc_is_called_from( - USB_BUS_EXPLORE_PROC(udev->bus)) ? 1 : 2; + const uint16_t refcount = usb_get_refcount(udev); DPRINTF("Refcount = %d\n", (int)refcount); @@ -496,9 +505,7 @@ static void usb_ref_restore_locked(struct usb_device *udev) { #if USB_HAVE_UGEN - const uint16_t refcount = - usb_proc_is_called_from( - USB_BUS_EXPLORE_PROC(udev->bus)) ? 1 : 2; + const uint16_t refcount = usb_get_refcount(udev); DPRINTF("Refcount = %d\n", (int)refcount); From owner-svn-src-stable-10@FreeBSD.ORG Wed Aug 13 07:13:43 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5CCF267A; Wed, 13 Aug 2014 07:13:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2EE222B16; Wed, 13 Aug 2014 07:13:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7D7Dha7051158; Wed, 13 Aug 2014 07:13:43 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7D7DgS9051156; Wed, 13 Aug 2014 07:13:42 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201408130713.s7D7DgS9051156@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 13 Aug 2014 07:13:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269920 - stable/10/sys/dev/usb/controller X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 07:13:43 -0000 Author: hselasky Date: Wed Aug 13 07:13:42 2014 New Revision: 269920 URL: http://svnweb.freebsd.org/changeset/base/269920 Log: MFC r269565: Rename driver name a bit to avoid unit number confusion in dmesg. Modified: stable/10/sys/dev/usb/controller/usb_controller.c stable/10/sys/dev/usb/controller/uss820dci_atmelarm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/controller/usb_controller.c ============================================================================== --- stable/10/sys/dev/usb/controller/usb_controller.c Wed Aug 13 07:11:37 2014 (r269919) +++ stable/10/sys/dev/usb/controller/usb_controller.c Wed Aug 13 07:13:42 2014 (r269920) @@ -133,7 +133,7 @@ DRIVER_MODULE(usbus, xhci, usb_driver, u /* Device Only Drivers */ DRIVER_MODULE(usbus, at91_udp, usb_driver, usb_devclass, 0, 0); DRIVER_MODULE(usbus, musbotg, usb_driver, usb_devclass, 0, 0); -DRIVER_MODULE(usbus, uss820, usb_driver, usb_devclass, 0, 0); +DRIVER_MODULE(usbus, uss820dci, usb_driver, usb_devclass, 0, 0); DRIVER_MODULE(usbus, octusb, usb_driver, usb_devclass, 0, 0); /* Dual Mode Drivers */ Modified: stable/10/sys/dev/usb/controller/uss820dci_atmelarm.c ============================================================================== --- stable/10/sys/dev/usb/controller/uss820dci_atmelarm.c Wed Aug 13 07:11:37 2014 (r269919) +++ stable/10/sys/dev/usb/controller/uss820dci_atmelarm.c Wed Aug 13 07:13:42 2014 (r269920) @@ -77,15 +77,15 @@ static device_method_t uss820dci_methods }; static driver_t uss820dci_driver = { - .name = "uss820", + .name = "uss820dci", .methods = uss820dci_methods, .size = sizeof(struct uss820dci_softc), }; static devclass_t uss820dci_devclass; -DRIVER_MODULE(uss820, atmelarm, uss820dci_driver, uss820dci_devclass, 0, 0); -MODULE_DEPEND(uss820, usb, 1, 1, 1); +DRIVER_MODULE(uss820dci, atmelarm, uss820dci_driver, uss820dci_devclass, 0, 0); +MODULE_DEPEND(uss820dci, usb, 1, 1, 1); static const char *const uss820_desc = "USS820 USB Device Controller"; From owner-svn-src-stable-10@FreeBSD.ORG Wed Aug 13 08:18:50 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 325007E9; Wed, 13 Aug 2014 08:18:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1DE0E2233; Wed, 13 Aug 2014 08:18:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7D8InPg079422; Wed, 13 Aug 2014 08:18:49 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7D8Inlt079420; Wed, 13 Aug 2014 08:18:49 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201408130818.s7D8Inlt079420@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 13 Aug 2014 08:18:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269921 - stable/10/sys/boot/usb X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 08:18:50 -0000 Author: hselasky Date: Wed Aug 13 08:18:49 2014 New Revision: 269921 URL: http://svnweb.freebsd.org/changeset/base/269921 Log: MFC r266396 and r267183: Build fixes. Add support for fast interrupts. Modified: stable/10/sys/boot/usb/bsd_kernel.c stable/10/sys/boot/usb/bsd_kernel.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/boot/usb/bsd_kernel.c ============================================================================== --- stable/10/sys/boot/usb/bsd_kernel.c Wed Aug 13 07:13:42 2014 (r269920) +++ stable/10/sys/boot/usb/bsd_kernel.c Wed Aug 13 08:18:49 2014 (r269921) @@ -380,8 +380,10 @@ device_get_parent(device_t dev) } void -device_set_interrupt(device_t dev, intr_fn_t *fn, void *arg) +device_set_interrupt(device_t dev, driver_filter_t *filter, + driver_intr_t *fn, void *arg) { + dev->dev_irq_filter = filter; dev->dev_irq_fn = fn; dev->dev_irq_arg = arg; } @@ -395,8 +397,16 @@ device_run_interrupts(device_t parent) return; TAILQ_FOREACH(child, &parent->dev_children, dev_link) { - if (child->dev_irq_fn != NULL) - (child->dev_irq_fn) (child->dev_irq_arg); + int status; + if (child->dev_irq_filter != NULL) + status = child->dev_irq_filter(child->dev_irq_arg); + else + status = FILTER_SCHEDULE_THREAD; + + if (status == FILTER_SCHEDULE_THREAD) { + if (child->dev_irq_fn != NULL) + (child->dev_irq_fn) (child->dev_irq_arg); + } } } Modified: stable/10/sys/boot/usb/bsd_kernel.h ============================================================================== --- stable/10/sys/boot/usb/bsd_kernel.h Wed Aug 13 07:13:42 2014 (r269920) +++ stable/10/sys/boot/usb/bsd_kernel.h Wed Aug 13 08:18:49 2014 (r269921) @@ -37,6 +37,7 @@ #define isalpha(x) (((x) >= 'a' && (x) <= 'z') || ((x) >= 'A' && (x) <= 'Z')) #define isdigit(x) ((x) >= '0' && (x) <= '9') #define panic(...) do { printf("USB PANIC: " __VA_ARGS__); while (1) ; } while (0) +#define rebooting 0 #define M_USB 0 #define M_USBDEV 0 #define USB_PROC_MAX 3 @@ -96,6 +97,7 @@ SYSINIT_ENTRY(uniq##_entry, "sysuninit", #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #define MAX(a,b) (((a) > (b)) ? (a) : (b)) #define MTX_DEF 0 +#define MTX_SPIN 0 #define MTX_RECURSE 0 #define SX_DUPOK 0 #define SX_NOWITNESS 0 @@ -201,6 +203,8 @@ struct mtx { void mtx_init(struct mtx *, const char *, const char *, int); void mtx_lock(struct mtx *); void mtx_unlock(struct mtx *); +#define mtx_lock_spin(x) mtx_lock(x) +#define mtx_unlock_spin(x) mtx_unlock(x) int mtx_owned(struct mtx *); void mtx_destroy(struct mtx *); @@ -266,7 +270,11 @@ struct module_data; typedef struct driver driver_t; typedef struct devclass *devclass_t; typedef struct device *device_t; -typedef void (intr_fn_t)(void *arg); +typedef void (driver_intr_t)(void *arg); +typedef int (driver_filter_t)(void *arg); +#define FILTER_STRAY 0x01 +#define FILTER_HANDLED 0x02 +#define FILTER_SCHEDULE_THREAD 0x04 typedef int device_attach_t (device_t dev); typedef int device_detach_t (device_t dev); @@ -294,7 +302,8 @@ struct device { const struct module_data *dev_module; void *dev_sc; void *dev_aux; - intr_fn_t *dev_irq_fn; + driver_filter_t *dev_irq_filter; + driver_intr_t *dev_irq_fn; void *dev_irq_arg; uint16_t dev_unit; @@ -341,7 +350,7 @@ const char *device_get_nameunit(device_t printf("%s: " fmt, device_get_nameunit(dev),## __VA_ARGS__) device_t device_add_child(device_t dev, const char *name, int unit); void device_quiet(device_t dev); -void device_set_interrupt(device_t dev, intr_fn_t *fn, void *arg); +void device_set_interrupt(device_t dev, driver_filter_t *, driver_intr_t *, void *); void device_run_interrupts(device_t parent); void device_set_ivars(device_t dev, void *ivars); void *device_get_ivars(device_t dev); From owner-svn-src-stable-10@FreeBSD.ORG Wed Aug 13 08:21:54 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9B972946; Wed, 13 Aug 2014 08:21:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 854B522D7; Wed, 13 Aug 2014 08:21:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7D8Lspg083054; Wed, 13 Aug 2014 08:21:54 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7D8LrSD083044; Wed, 13 Aug 2014 08:21:53 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201408130821.s7D8LrSD083044@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 13 Aug 2014 08:21:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269922 - in stable/10/sys: boot/usb conf dev/usb dev/usb/template modules/usb/template X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 08:21:54 -0000 Author: hselasky Date: Wed Aug 13 08:21:52 2014 New Revision: 269922 URL: http://svnweb.freebsd.org/changeset/base/269922 Log: MFC r269567: Add new USB phone descriptor template for USB device side mode. Added: stable/10/sys/dev/usb/template/usb_template_phone.c - copied unchanged from r269567, head/sys/dev/usb/template/usb_template_phone.c Modified: stable/10/sys/boot/usb/Makefile stable/10/sys/conf/files stable/10/sys/dev/usb/template/usb_template.c stable/10/sys/dev/usb/template/usb_template.h stable/10/sys/dev/usb/usb_ioctl.h stable/10/sys/modules/usb/template/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/boot/usb/Makefile ============================================================================== --- stable/10/sys/boot/usb/Makefile Wed Aug 13 08:18:49 2014 (r269921) +++ stable/10/sys/boot/usb/Makefile Wed Aug 13 08:21:52 2014 (r269922) @@ -116,6 +116,7 @@ SRCS+= usb_template_modem.c SRCS+= usb_template_mouse.c SRCS+= usb_template_kbd.c SRCS+= usb_template_audio.c +SRCS+= usb_template_phone.c SRCS+= sysinit_data.c SRCS+= sysuninit_data.c Modified: stable/10/sys/conf/files ============================================================================== --- stable/10/sys/conf/files Wed Aug 13 08:18:49 2014 (r269921) +++ stable/10/sys/conf/files Wed Aug 13 08:21:52 2014 (r269922) @@ -2524,6 +2524,7 @@ dev/usb/template/usb_template_modem.c op dev/usb/template/usb_template_mouse.c optional usb_template dev/usb/template/usb_template_msc.c optional usb_template dev/usb/template/usb_template_mtp.c optional usb_template +dev/usb/template/usb_template_phone.c optional usb_template # # USB END # Modified: stable/10/sys/dev/usb/template/usb_template.c ============================================================================== --- stable/10/sys/dev/usb/template/usb_template.c Wed Aug 13 08:18:49 2014 (r269921) +++ stable/10/sys/dev/usb/template/usb_template.c Wed Aug 13 08:21:52 2014 (r269922) @@ -135,7 +135,7 @@ usb_make_raw_desc(struct usb_temp_setup /* check if we have got a CDC union descriptor */ - if ((raw[0] >= sizeof(struct usb_cdc_union_descriptor)) && + if ((raw[0] == sizeof(struct usb_cdc_union_descriptor)) && (raw[1] == UDESC_CS_INTERFACE) && (raw[2] == UDESCSUB_CDC_UNION)) { struct usb_cdc_union_descriptor *ud = (void *)dst; @@ -150,7 +150,7 @@ usb_make_raw_desc(struct usb_temp_setup /* check if we have got an interface association descriptor */ - if ((raw[0] >= sizeof(struct usb_interface_assoc_descriptor)) && + if ((raw[0] == sizeof(struct usb_interface_assoc_descriptor)) && (raw[1] == UDESC_IFACE_ASSOC)) { struct usb_interface_assoc_descriptor *iad = (void *)dst; @@ -162,7 +162,7 @@ usb_make_raw_desc(struct usb_temp_setup /* check if we have got a call management descriptor */ - if ((raw[0] >= sizeof(struct usb_cdc_cm_descriptor)) && + if ((raw[0] == sizeof(struct usb_cdc_cm_descriptor)) && (raw[1] == UDESC_CS_INTERFACE) && (raw[2] == UDESCSUB_CDC_CM)) { struct usb_cdc_cm_descriptor *ccd = (void *)dst; @@ -1368,6 +1368,9 @@ usb_temp_setup_by_index(struct usb_devic case USB_TEMP_MOUSE: err = usb_temp_setup(udev, &usb_template_mouse); break; + case USB_TEMP_PHONE: + err = usb_temp_setup(udev, &usb_template_phone); + break; default: return (USB_ERR_INVAL); } Modified: stable/10/sys/dev/usb/template/usb_template.h ============================================================================== --- stable/10/sys/dev/usb/template/usb_template.h Wed Aug 13 08:18:49 2014 (r269921) +++ stable/10/sys/dev/usb/template/usb_template.h Wed Aug 13 08:21:52 2014 (r269922) @@ -105,6 +105,7 @@ extern const struct usb_temp_device_desc extern const struct usb_temp_device_desc usb_template_mouse; extern const struct usb_temp_device_desc usb_template_msc; extern const struct usb_temp_device_desc usb_template_mtp; +extern const struct usb_temp_device_desc usb_template_phone; usb_error_t usb_temp_setup(struct usb_device *, const struct usb_temp_device_desc *); Copied: stable/10/sys/dev/usb/template/usb_template_phone.c (from r269567, head/sys/dev/usb/template/usb_template_phone.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/dev/usb/template/usb_template_phone.c Wed Aug 13 08:21:52 2014 (r269922, copy of r269567, head/sys/dev/usb/template/usb_template_phone.c) @@ -0,0 +1,419 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 2014 Hans Petter Selasky. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * This file contains the USB template for an USB phone device. + */ + +#ifdef USB_GLOBAL_INCLUDE_FILE +#include USB_GLOBAL_INCLUDE_FILE +#else +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#endif /* USB_GLOBAL_INCLUDE_FILE */ + +enum { + INDEX_PHONE_LANG, + INDEX_PHONE_MIXER, + INDEX_PHONE_RECORD, + INDEX_PHONE_PLAYBACK, + INDEX_PHONE_PRODUCT, + INDEX_PHONE_HID, + INDEX_PHONE_MAX, +}; + +#define STRING_PHONE_PRODUCT \ + "U\0S\0B\0 \0P\0h\0o\0n\0e\0 \0D\0e\0v\0i\0c\0e" + +#define STRING_PHONE_MIXER \ + "M\0i\0x\0e\0r\0 \0i\0n\0t\0e\0r\0f\0a\0c\0e" + +#define STRING_PHONE_RECORD \ + "R\0e\0c\0o\0r\0d\0 \0i\0n\0t\0e\0r\0f\0a\0c\0e" + +#define STRING_PHONE_PLAYBACK \ + "P\0l\0a\0y\0b\0a\0c\0k\0 \0i\0n\0t\0e\0r\0f\0a\0c\0e" + +#define STRING_PHONE_HID \ + "H\0I\0D\0 \0i\0n\0t\0e\0r\0f\0a\0c\0e" + +/* make the real string descriptors */ + +USB_MAKE_STRING_DESC(STRING_PHONE_MIXER, string_phone_mixer); +USB_MAKE_STRING_DESC(STRING_PHONE_RECORD, string_phone_record); +USB_MAKE_STRING_DESC(STRING_PHONE_PLAYBACK, string_phone_playback); +USB_MAKE_STRING_DESC(STRING_PHONE_PRODUCT, string_phone_product); +USB_MAKE_STRING_DESC(STRING_PHONE_HID, string_phone_hid); + +/* prototypes */ + +/* + * Phone Mixer description structures + * + * Some of the phone descriptors were dumped from no longer in + * production Yealink VOIP USB phone adapter: + */ +static uint8_t phone_hid_descriptor[] = { + 0x05, 0x0b, 0x09, 0x01, 0xa1, 0x01, 0x05, 0x09, + 0x19, 0x01, 0x29, 0x3f, 0x15, 0x00, 0x25, 0x01, + 0x75, 0x01, 0x95, 0x80, 0x81, 0x00, 0x05, 0x08, + 0x19, 0x01, 0x29, 0x10, 0x15, 0x00, 0x25, 0x01, + 0x75, 0x01, 0x95, 0x80, 0x91, 0x00, 0xc0 +}; + +static const uint8_t phone_raw_desc_0[] = { + 0x0a, 0x24, 0x01, 0x00, 0x01, 0x4a, 0x00, 0x02, + 0x01, 0x02 +}; + +static const uint8_t phone_raw_desc_1[] = { + 0x0c, 0x24, 0x02, 0x01, 0x01, 0x02, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00 +}; + +static const uint8_t phone_raw_desc_2[] = { + 0x0c, 0x24, 0x02, 0x02, 0x01, 0x01, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00 +}; + +static const uint8_t phone_raw_desc_3[] = { + 0x09, 0x24, 0x03, 0x03, 0x01, 0x03, 0x00, 0x06, + 0x00 +}; + +static const uint8_t phone_raw_desc_4[] = { + 0x09, 0x24, 0x03, 0x04, 0x01, 0x01, 0x00, 0x05, + 0x00 +}; + +static const uint8_t phone_raw_desc_5[] = { + 0x0b, 0x24, 0x06, 0x05, 0x01, 0x02, 0x03, 0x00, + 0x03, 0x00, 0x00 +}; + +static const uint8_t phone_raw_desc_6[] = { + 0x0b, 0x24, 0x06, 0x06, 0x02, 0x02, 0x03, 0x00, + 0x03, 0x00, 0x00 +}; + +static const void *phone_raw_iface_0_desc[] = { + phone_raw_desc_0, + phone_raw_desc_1, + phone_raw_desc_2, + phone_raw_desc_3, + phone_raw_desc_4, + phone_raw_desc_5, + phone_raw_desc_6, + NULL, +}; + +static const struct usb_temp_interface_desc phone_iface_0 = { + .ppEndpoints = NULL, /* no endpoints */ + .ppRawDesc = phone_raw_iface_0_desc, + .bInterfaceClass = 1, + .bInterfaceSubClass = 1, + .bInterfaceProtocol = 0, + .iInterface = INDEX_PHONE_MIXER, +}; + +static const uint8_t phone_raw_desc_20[] = { + 0x07, 0x24, 0x01, 0x04, 0x01, 0x01, 0x00 +}; + +static const uint8_t phone_raw_desc_21[] = { + 0x0b, 0x24, 0x02, 0x01, 0x01, 0x02, 0x10, 0x01, + /* 8kHz */ + 0x40, 0x1f, 0x00 +}; + +static const uint8_t phone_raw_desc_22[] = { + 0x07, 0x25, 0x01, 0x00, 0x00, 0x00, 0x00 +}; + +static const void *phone_raw_iface_1_desc[] = { + phone_raw_desc_20, + phone_raw_desc_21, + NULL, +}; + +static const void *phone_raw_ep_1_desc[] = { + phone_raw_desc_22, + NULL, +}; + +static const struct usb_temp_packet_size phone_isoc_mps = { + .mps[USB_SPEED_FULL] = 0x10, + .mps[USB_SPEED_HIGH] = 0x10, +}; + +static const struct usb_temp_interval phone_isoc_interval = { + .bInterval[USB_SPEED_FULL] = 1, /* 1:1 */ + .bInterval[USB_SPEED_HIGH] = 4, /* 1:8 */ +}; + +static const struct usb_temp_endpoint_desc phone_isoc_in_ep = { + .ppRawDesc = phone_raw_ep_1_desc, + .pPacketSize = &phone_isoc_mps, + .pIntervals = &phone_isoc_interval, + .bEndpointAddress = UE_DIR_IN, + .bmAttributes = UE_ISOCHRONOUS, +}; + +static const struct usb_temp_endpoint_desc *phone_iface_1_ep[] = { + &phone_isoc_in_ep, + NULL, +}; + +static const struct usb_temp_interface_desc phone_iface_1_alt_0 = { + .ppEndpoints = NULL, /* no endpoints */ + .ppRawDesc = NULL, /* no raw descriptors */ + .bInterfaceClass = 1, + .bInterfaceSubClass = 2, + .bInterfaceProtocol = 0, + .iInterface = INDEX_PHONE_PLAYBACK, +}; + +static const struct usb_temp_interface_desc phone_iface_1_alt_1 = { + .ppEndpoints = phone_iface_1_ep, + .ppRawDesc = phone_raw_iface_1_desc, + .bInterfaceClass = 1, + .bInterfaceSubClass = 2, + .bInterfaceProtocol = 0, + .iInterface = INDEX_PHONE_PLAYBACK, + .isAltInterface = 1, /* this is an alternate setting */ +}; + +static const uint8_t phone_raw_desc_30[] = { + 0x07, 0x24, 0x01, 0x02, 0x01, 0x01, 0x00 +}; + +static const uint8_t phone_raw_desc_31[] = { + 0x0b, 0x24, 0x02, 0x01, 0x01, 0x02, 0x10, 0x01, + /* 8kHz */ + 0x40, 0x1f, 0x00 +}; + +static const uint8_t phone_raw_desc_32[] = { + 0x07, 0x25, 0x01, 0x00, 0x00, 0x00, 0x00 +}; + +static const void *phone_raw_iface_2_desc[] = { + phone_raw_desc_30, + phone_raw_desc_31, + NULL, +}; + +static const void *phone_raw_ep_2_desc[] = { + phone_raw_desc_32, + NULL, +}; + +static const struct usb_temp_endpoint_desc phone_isoc_out_ep = { + .ppRawDesc = phone_raw_ep_2_desc, + .pPacketSize = &phone_isoc_mps, + .pIntervals = &phone_isoc_interval, + .bEndpointAddress = UE_DIR_OUT, + .bmAttributes = UE_ISOCHRONOUS, +}; + +static const struct usb_temp_endpoint_desc *phone_iface_2_ep[] = { + &phone_isoc_out_ep, + NULL, +}; + +static const struct usb_temp_interface_desc phone_iface_2_alt_0 = { + .ppEndpoints = NULL, /* no endpoints */ + .ppRawDesc = NULL, /* no raw descriptors */ + .bInterfaceClass = 1, + .bInterfaceSubClass = 2, + .bInterfaceProtocol = 0, + .iInterface = INDEX_PHONE_RECORD, +}; + +static const struct usb_temp_interface_desc phone_iface_2_alt_1 = { + .ppEndpoints = phone_iface_2_ep, + .ppRawDesc = phone_raw_iface_2_desc, + .bInterfaceClass = 1, + .bInterfaceSubClass = 2, + .bInterfaceProtocol = 0, + .iInterface = INDEX_PHONE_RECORD, + .isAltInterface = 1, /* this is an alternate setting */ +}; + +static const uint8_t phone_hid_raw_desc_0[] = { + 0x09, 0x21, 0x00, 0x01, 0x00, 0x01, 0x22, sizeof(phone_hid_descriptor), + 0x00 +}; + +static const void *phone_hid_desc_0[] = { + phone_hid_raw_desc_0, + NULL, +}; + +static const struct usb_temp_packet_size phone_hid_mps = { + .mps[USB_SPEED_FULL] = 0x10, + .mps[USB_SPEED_HIGH] = 0x10, +}; + +static const struct usb_temp_interval phone_hid_interval = { + .bInterval[USB_SPEED_FULL] = 2, /* 2ms */ + .bInterval[USB_SPEED_HIGH] = 2, /* 2ms */ +}; + +static const struct usb_temp_endpoint_desc phone_hid_in_ep = { + .pPacketSize = &phone_hid_mps, + .pIntervals = &phone_hid_interval, + .bEndpointAddress = UE_DIR_IN, + .bmAttributes = UE_INTERRUPT, +}; + +static const struct usb_temp_endpoint_desc *phone_iface_3_ep[] = { + &phone_hid_in_ep, + NULL, +}; + +static const struct usb_temp_interface_desc phone_iface_3 = { + .ppEndpoints = phone_iface_3_ep, + .ppRawDesc = phone_hid_desc_0, + .bInterfaceClass = 3, + .bInterfaceSubClass = 0, + .bInterfaceProtocol = 0, + .iInterface = INDEX_PHONE_HID, +}; + +static const struct usb_temp_interface_desc *phone_interfaces[] = { + &phone_iface_0, + &phone_iface_1_alt_0, + &phone_iface_1_alt_1, + &phone_iface_2_alt_0, + &phone_iface_2_alt_1, + &phone_iface_3, + NULL, +}; + +static const struct usb_temp_config_desc phone_config_desc = { + .ppIfaceDesc = phone_interfaces, + .bmAttributes = UC_BUS_POWERED, + .bMaxPower = 25, /* 50 mA */ + .iConfiguration = INDEX_PHONE_PRODUCT, +}; + +static const struct usb_temp_config_desc *phone_configs[] = { + &phone_config_desc, + NULL, +}; + +static usb_temp_get_string_desc_t phone_get_string_desc; +static usb_temp_get_vendor_desc_t phone_get_vendor_desc; + +const struct usb_temp_device_desc usb_template_phone = { + .getStringDesc = &phone_get_string_desc, + .getVendorDesc = &phone_get_vendor_desc, + .ppConfigDesc = phone_configs, + .idVendor = USB_TEMPLATE_VENDOR, + .idProduct = 0xb001, + .bcdDevice = 0x0100, + .bDeviceClass = UDCLASS_IN_INTERFACE, + .bDeviceSubClass = 0, + .bDeviceProtocol = 0, + .iManufacturer = 0, + .iProduct = INDEX_PHONE_PRODUCT, + .iSerialNumber = 0, +}; + +/*------------------------------------------------------------------------* + * phone_get_vendor_desc + * + * Return values: + * NULL: Failure. No such vendor descriptor. + * Else: Success. Pointer to vendor descriptor is returned. + *------------------------------------------------------------------------*/ +static const void * +phone_get_vendor_desc(const struct usb_device_request *req, uint16_t *plen) +{ + if ((req->bmRequestType == 0x81) && (req->bRequest == 0x06) && + (req->wValue[0] == 0x00) && (req->wValue[1] == 0x22) && + (req->wIndex[1] == 0) && (req->wIndex[0] == 3 /* iface */)) { + + *plen = sizeof(phone_hid_descriptor); + return (phone_hid_descriptor); + } + return (NULL); +} + +/*------------------------------------------------------------------------* + * phone_get_string_desc + * + * Return values: + * NULL: Failure. No such string. + * Else: Success. Pointer to string descriptor is returned. + *------------------------------------------------------------------------*/ +static const void * +phone_get_string_desc(uint16_t lang_id, uint8_t string_index) +{ + static const void *ptr[INDEX_PHONE_MAX] = { + [INDEX_PHONE_LANG] = &usb_string_lang_en, + [INDEX_PHONE_MIXER] = &string_phone_mixer, + [INDEX_PHONE_RECORD] = &string_phone_record, + [INDEX_PHONE_PLAYBACK] = &string_phone_playback, + [INDEX_PHONE_PRODUCT] = &string_phone_product, + [INDEX_PHONE_HID] = &string_phone_hid, + }; + + if (string_index == 0) { + return (&usb_string_lang_en); + } + if (lang_id != 0x0409) { + return (NULL); + } + if (string_index < INDEX_PHONE_MAX) { + return (ptr[string_index]); + } + return (NULL); +} Modified: stable/10/sys/dev/usb/usb_ioctl.h ============================================================================== --- stable/10/sys/dev/usb/usb_ioctl.h Wed Aug 13 08:18:49 2014 (r269921) +++ stable/10/sys/dev/usb/usb_ioctl.h Wed Aug 13 08:21:52 2014 (r269922) @@ -64,6 +64,7 @@ enum { USB_TEMP_AUDIO, /* USB Audio */ USB_TEMP_KBD, /* USB Keyboard */ USB_TEMP_MOUSE, /* USB Mouse */ + USB_TEMP_PHONE, /* USB Phone */ USB_TEMP_MAX, }; Modified: stable/10/sys/modules/usb/template/Makefile ============================================================================== --- stable/10/sys/modules/usb/template/Makefile Wed Aug 13 08:18:49 2014 (r269921) +++ stable/10/sys/modules/usb/template/Makefile Wed Aug 13 08:21:52 2014 (r269922) @@ -38,6 +38,7 @@ SRCS= opt_bus.h opt_usb.h device_if.h bu usb_template_modem.c \ usb_template_mouse.c \ usb_template_msc.c \ - usb_template_mtp.c + usb_template_mtp.c \ + usb_template_phone.c .include From owner-svn-src-stable-10@FreeBSD.ORG Wed Aug 13 11:11:27 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C5038EF; Wed, 13 Aug 2014 11:11:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0A1C2721; Wed, 13 Aug 2014 11:11:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7DBBRms062420; Wed, 13 Aug 2014 11:11:27 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7DBBRUD062419; Wed, 13 Aug 2014 11:11:27 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201408131111.s7DBBRUD062419@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 13 Aug 2014 11:11:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269925 - stable/10/sys/dev/iscsi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 11:11:27 -0000 Author: trasz Date: Wed Aug 13 11:11:27 2014 New Revision: 269925 URL: http://svnweb.freebsd.org/changeset/base/269925 Log: MFC r269197: Fix potential double free that could happen after connection error. Modified: stable/10/sys/dev/iscsi/icl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/iscsi/icl.c ============================================================================== --- stable/10/sys/dev/iscsi/icl.c Wed Aug 13 09:34:33 2014 (r269924) +++ stable/10/sys/dev/iscsi/icl.c Wed Aug 13 11:11:27 2014 (r269925) @@ -669,7 +669,10 @@ icl_conn_receive_pdu(struct icl_conn *ic } if (error != 0) { - icl_pdu_free(request); + /* + * Don't free the PDU; it's pointed to by ic->ic_receive_pdu + * and will get freed in icl_conn_close(). + */ icl_conn_fail(ic); } From owner-svn-src-stable-10@FreeBSD.ORG Wed Aug 13 12:32:54 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 054E09F6; Wed, 13 Aug 2014 12:32:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CB030212F; Wed, 13 Aug 2014 12:32:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7DCWrmt006228; Wed, 13 Aug 2014 12:32:53 GMT (envelope-from gavin@FreeBSD.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7DCWrkk006224; Wed, 13 Aug 2014 12:32:53 GMT (envelope-from gavin@FreeBSD.org) Message-Id: <201408131232.s7DCWrkk006224@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gavin set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson Date: Wed, 13 Aug 2014 12:32:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269928 - in stable/10: . etc/mtree share/examples share/examples/cvsup X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 12:32:54 -0000 Author: gavin Date: Wed Aug 13 12:32:52 2014 New Revision: 269928 URL: http://svnweb.freebsd.org/changeset/base/269928 Log: Merge r267867 from head: Remove example cvsup config files. Deleted: stable/10/share/examples/cvsup/ Modified: stable/10/ObsoleteFiles.inc stable/10/etc/mtree/BSD.usr.dist stable/10/share/examples/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/ObsoleteFiles.inc ============================================================================== --- stable/10/ObsoleteFiles.inc Wed Aug 13 12:31:36 2014 (r269927) +++ stable/10/ObsoleteFiles.inc Wed Aug 13 12:32:52 2014 (r269928) @@ -45,6 +45,11 @@ OLD_FILES+=usr/share/examples/libusb20/a OLD_FILES+=usr/share/man/man9/VOP_GETVOBJECT.9.gz OLD_FILES+=usr/share/man/man9/VOP_CREATEVOBJECT.9.gz OLD_FILES+=usr/share/man/man9/VOP_DESTROYVOBJECT.9.gz +OLD_FILES+=usr/share/examples/cvsup/README +OLD_FILES+=usr/share/examples/cvsup/cvs-supfile +OLD_FILES+=usr/share/examples/cvsup/stable-supfile +OLD_FILES+=usr/share/examples/cvsup/standard-supfile +OLD_DIRS+=usr/share/examples/cvsup # 20140614: send-pr removal OLD_FILES+=usr/share/man/man1/send-pr.1.gz OLD_FILES+=etc/gnats/freefall Modified: stable/10/etc/mtree/BSD.usr.dist ============================================================================== --- stable/10/etc/mtree/BSD.usr.dist Wed Aug 13 12:31:36 2014 (r269927) +++ stable/10/etc/mtree/BSD.usr.dist Wed Aug 13 12:32:52 2014 (r269928) @@ -301,8 +301,6 @@ .. csh .. - cvsup - .. diskless .. drivers Modified: stable/10/share/examples/Makefile ============================================================================== --- stable/10/share/examples/Makefile Wed Aug 13 12:31:36 2014 (r269927) +++ stable/10/share/examples/Makefile Wed Aug 13 12:32:52 2014 (r269928) @@ -10,7 +10,6 @@ LDIRS= BSD_daemon \ bhyve \ bootforth \ csh \ - cvsup \ diskless \ drivers \ etc \ @@ -52,10 +51,6 @@ XFILES= BSD_daemon/FreeBSD.pfa \ bootforth/menuconf.4th \ bootforth/screen.4th \ csh/dot.cshrc \ - cvsup/README \ - cvsup/cvs-supfile \ - cvsup/stable-supfile \ - cvsup/standard-supfile \ diskless/ME \ diskless/README.BOOTP \ diskless/README.TEMPLATING \ From owner-svn-src-stable-10@FreeBSD.ORG Wed Aug 13 12:35:12 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 44057B53; Wed, 13 Aug 2014 12:35:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 302472149; Wed, 13 Aug 2014 12:35:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7DCZCX8006667; Wed, 13 Aug 2014 12:35:12 GMT (envelope-from gavin@FreeBSD.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7DCZChR006666; Wed, 13 Aug 2014 12:35:12 GMT (envelope-from gavin@FreeBSD.org) Message-Id: <201408131235.s7DCZChR006666@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gavin set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson Date: Wed, 13 Aug 2014 12:35:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269929 - stable/10/usr.sbin/jail X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 12:35:12 -0000 Author: gavin Date: Wed Aug 13 12:35:11 2014 New Revision: 269929 URL: http://svnweb.freebsd.org/changeset/base/269929 Log: Merge r268488 from head: Reword an awkward option description PR: 191726 Submitted by: yaneurabeya gmail.com Modified: stable/10/usr.sbin/jail/jail.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/jail/jail.8 ============================================================================== --- stable/10/usr.sbin/jail/jail.8 Wed Aug 13 12:32:52 2014 (r269928) +++ stable/10/usr.sbin/jail/jail.8 Wed Aug 13 12:35:11 2014 (r269929) @@ -653,8 +653,9 @@ file, instead of in the prison's file. The user to run commands as, when running in the system environment. The default is to run the commands as the current user. .It Va exec.timeout -The maximum amount of time to wait for a command to complete. -If a command is still running after this many seconds have passed, +The maximum amount of time to wait for a command to complete, in +seconds. +If a command is still running after this timeout has passed, the jail not be created or removed. .It Va exec.consolelog A file to direct command output (stdout and stderr) to. From owner-svn-src-stable-10@FreeBSD.ORG Wed Aug 13 12:37:00 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1CD43FA9; Wed, 13 Aug 2014 12:37:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 092F32172; Wed, 13 Aug 2014 12:37:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7DCaxD5007152; Wed, 13 Aug 2014 12:36:59 GMT (envelope-from gavin@FreeBSD.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7DCaxZ0007151; Wed, 13 Aug 2014 12:36:59 GMT (envelope-from gavin@FreeBSD.org) Message-Id: <201408131236.s7DCaxZ0007151@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gavin set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson Date: Wed, 13 Aug 2014 12:36:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269933 - stable/10/games/fortune/fortune X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 12:37:00 -0000 Author: gavin Date: Wed Aug 13 12:36:59 2014 New Revision: 269933 URL: http://svnweb.freebsd.org/changeset/base/269933 Log: Merge r268637 from head: fortune(8): Search fortune files installed by ports/packages as well as those supplied by the base system. PR: 191800 Submitted by: Andy Kosela Modified: stable/10/games/fortune/fortune/pathnames.h Directory Properties: stable/10/ (props changed) Modified: stable/10/games/fortune/fortune/pathnames.h ============================================================================== --- stable/10/games/fortune/fortune/pathnames.h Wed Aug 13 12:35:39 2014 (r269932) +++ stable/10/games/fortune/fortune/pathnames.h Wed Aug 13 12:36:59 2014 (r269933) @@ -30,4 +30,5 @@ * $FreeBSD$ */ -#define FORTDIR "/usr/share/games/fortune" +#define FORTDIR "/usr/share/games/fortune:" \ + "/usr/local/share/games/fortune" From owner-svn-src-stable-10@FreeBSD.ORG Wed Aug 13 12:41:32 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 571223CD; Wed, 13 Aug 2014 12:41:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 431682258; Wed, 13 Aug 2014 12:41:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7DCfWv3009450; Wed, 13 Aug 2014 12:41:32 GMT (envelope-from gavin@FreeBSD.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7DCfWiX009449; Wed, 13 Aug 2014 12:41:32 GMT (envelope-from gavin@FreeBSD.org) Message-Id: <201408131241.s7DCfWiX009449@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gavin set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson Date: Wed, 13 Aug 2014 12:41:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269935 - stable/10/share/man/man9 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 12:41:32 -0000 Author: gavin Date: Wed Aug 13 12:41:31 2014 New Revision: 269935 URL: http://svnweb.freebsd.org/changeset/base/269935 Log: Merge r268725 from head: Since r202933, kthread_suspend_check() takes no arguments. Update the example to match. Modified: stable/10/share/man/man9/kthread.9 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man9/kthread.9 ============================================================================== --- stable/10/share/man/man9/kthread.9 Wed Aug 13 12:38:08 2014 (r269934) +++ stable/10/share/man/man9/kthread.9 Wed Aug 13 12:41:31 2014 (r269935) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 24, 2010 +.Dd July 15, 2014 .Dt KTHREAD 9 .Os .Sh NAME @@ -275,7 +275,7 @@ buf_daemon() bufdaemonthread, SHUTDOWN_PRI_LAST); ... for (;;) { - kthread_suspend_check(bufdaemonthread); + kthread_suspend_check(); ... } } From owner-svn-src-stable-10@FreeBSD.ORG Wed Aug 13 12:44:44 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 91DF96C1; Wed, 13 Aug 2014 12:44:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E416227F; Wed, 13 Aug 2014 12:44:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7DCiik1011824; Wed, 13 Aug 2014 12:44:44 GMT (envelope-from gavin@FreeBSD.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7DCiiAG011823; Wed, 13 Aug 2014 12:44:44 GMT (envelope-from gavin@FreeBSD.org) Message-Id: <201408131244.s7DCiiAG011823@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gavin set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson Date: Wed, 13 Aug 2014 12:44:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269937 - stable/10/usr.sbin/pkg X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 12:44:44 -0000 Author: gavin Date: Wed Aug 13 12:44:44 2014 New Revision: 269937 URL: http://svnweb.freebsd.org/changeset/base/269937 Log: Merge r268728 from head: When we fail to extract the pkg binaries (for example, / is read-only), give a more helpful error message. Modified: stable/10/usr.sbin/pkg/pkg.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/pkg/pkg.c ============================================================================== --- stable/10/usr.sbin/pkg/pkg.c Wed Aug 13 12:42:15 2014 (r269936) +++ stable/10/usr.sbin/pkg/pkg.c Wed Aug 13 12:44:44 2014 (r269937) @@ -126,7 +126,8 @@ extract_pkg_static(int fd, char *p, int if (r == ARCHIVE_OK) ret = 0; else - warnx("fail to extract pkg-static"); + warnx("failed to extract pkg-static: %s", + archive_error_string(a)); cleanup: archive_read_free(a); From owner-svn-src-stable-10@FreeBSD.ORG Wed Aug 13 12:47:52 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 65F41C3B; Wed, 13 Aug 2014 12:47:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5264B22C5; Wed, 13 Aug 2014 12:47:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7DClqef012532; Wed, 13 Aug 2014 12:47:52 GMT (envelope-from gavin@FreeBSD.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7DClqGS012531; Wed, 13 Aug 2014 12:47:52 GMT (envelope-from gavin@FreeBSD.org) Message-Id: <201408131247.s7DClqGS012531@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gavin set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson Date: Wed, 13 Aug 2014 12:47:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269939 - stable/10/usr.bin/iscsictl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 12:47:52 -0000 Author: gavin Date: Wed Aug 13 12:47:51 2014 New Revision: 269939 URL: http://svnweb.freebsd.org/changeset/base/269939 Log: Merge r268842 from head: Fix two typos in iscsictl.8 PR: 191581 Submitted by: Jimmy Olgeni Modified: stable/10/usr.bin/iscsictl/iscsictl.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/iscsictl/iscsictl.8 ============================================================================== --- stable/10/usr.bin/iscsictl/iscsictl.8 Wed Aug 13 12:45:25 2014 (r269938) +++ stable/10/usr.bin/iscsictl/iscsictl.8 Wed Aug 13 12:47:51 2014 (r269939) @@ -83,7 +83,7 @@ The default is Target host name or address used for SendTargets discovery. When used, it will add a temporary discovery session. After discovery is done, sessions will be added for each discovered target, -and the temporary discovery sesion will be removed. +and the temporary discovery session will be removed. .It Fl n The "nickname" of session defined in the configuration file. .It Fl p @@ -98,7 +98,7 @@ CHAP login. Verbose mode. .El .Pp -Certain parameters are neccessary when adding a session. +Certain parameters are necessary when adding a session. One can specify these either via command line (using the .Fl t , .Fl p , From owner-svn-src-stable-10@FreeBSD.ORG Wed Aug 13 12:55:45 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0A2A5E69; Wed, 13 Aug 2014 12:55:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA9CC2488; Wed, 13 Aug 2014 12:55:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7DCti1L016905; Wed, 13 Aug 2014 12:55:44 GMT (envelope-from gavin@FreeBSD.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7DCtiUc016904; Wed, 13 Aug 2014 12:55:44 GMT (envelope-from gavin@FreeBSD.org) Message-Id: <201408131255.s7DCtiUc016904@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gavin set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson Date: Wed, 13 Aug 2014 12:55:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269940 - stable/10 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 12:55:45 -0000 Author: gavin Date: Wed Aug 13 12:55:44 2014 New Revision: 269940 URL: http://svnweb.freebsd.org/changeset/base/269940 Log: Merge r267859 (by bapt), r268998 from head: o Mark send-pr info page as an obsolete file o /usr/bin/sendbug and the sendbug(1) man page were part of send-pr and are no longer installed since r267486 (r267734 in stable/10). Add them to ObsoleteFiles.inc1, which should have been done in r267486. PR: 192010 (partial) Submitted by: Vick Khera (partial) Modified: stable/10/ObsoleteFiles.inc Directory Properties: stable/10/ (props changed) Modified: stable/10/ObsoleteFiles.inc ============================================================================== --- stable/10/ObsoleteFiles.inc Wed Aug 13 12:47:51 2014 (r269939) +++ stable/10/ObsoleteFiles.inc Wed Aug 13 12:55:44 2014 (r269940) @@ -51,7 +51,10 @@ OLD_FILES+=usr/share/examples/cvsup/stab OLD_FILES+=usr/share/examples/cvsup/standard-supfile OLD_DIRS+=usr/share/examples/cvsup # 20140614: send-pr removal +OLD_FILES+=usr/bin/sendbug +OLD_FILES+=usr/share/info/send-pr.info.gz OLD_FILES+=usr/share/man/man1/send-pr.1.gz +OLD_FILES+=usr/share/man/man1/sendbug.1.gz OLD_FILES+=etc/gnats/freefall OLD_DIRS+=etc/gnats # 20140512: new clang import which bumps version from 3.4 to 3.4.1. From owner-svn-src-stable-10@FreeBSD.ORG Wed Aug 13 15:48:10 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CC9A92FE; Wed, 13 Aug 2014 15:48:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B908C2837; Wed, 13 Aug 2014 15:48:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7DFmA2Y095071; Wed, 13 Aug 2014 15:48:10 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7DFmATv095070; Wed, 13 Aug 2014 15:48:10 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201408131548.s7DFmATv095070@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 13 Aug 2014 15:48:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269944 - stable/10/sys/netinet6 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 15:48:10 -0000 Author: ae Date: Wed Aug 13 15:48:10 2014 New Revision: 269944 URL: http://svnweb.freebsd.org/changeset/base/269944 Log: MFC r269306: Add new rule to source address selection algorithm. It prefers address with better virtual status. Use ifa_preferred() to choose better address. PR: 187341 Modified: stable/10/sys/netinet6/in6_src.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet6/in6_src.c ============================================================================== --- stable/10/sys/netinet6/in6_src.c Wed Aug 13 15:29:29 2014 (r269943) +++ stable/10/sys/netinet6/in6_src.c Wed Aug 13 15:48:10 2014 (r269944) @@ -443,6 +443,12 @@ in6_selectsrc(struct sockaddr_in6 *dstso REPLACE(8); /* + * Rule 9: prefer address with better virtual status. + */ + if (ifa_preferred(&ia_best->ia_ifa, &ia->ia_ifa)) + REPLACE(9); + + /* * Rule 14: Use longest matching prefix. * Note: in the address selection draft, this rule is * documented as "Rule 8". However, since it is also From owner-svn-src-stable-10@FreeBSD.ORG Wed Aug 13 16:11:58 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8E0D5C75; Wed, 13 Aug 2014 16:11:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 79EF02B30; Wed, 13 Aug 2014 16:11:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7DGBwIc007595; Wed, 13 Aug 2014 16:11:58 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7DGBv0P007591; Wed, 13 Aug 2014 16:11:57 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201408131611.s7DGBv0P007591@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Wed, 13 Aug 2014 16:11:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269946 - stable/10/share/mk X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 16:11:58 -0000 Author: rpaulo Date: Wed Aug 13 16:11:57 2014 New Revision: 269946 URL: http://svnweb.freebsd.org/changeset/base/269946 Log: MFC r268300 r268541 r268544 r268565 r269775 r269838 r269839 r269840 r269842 r269844 r269899: BSD make support for generating and compiling USDT DTrace probes. Deleted: stable/10/share/mk/bsd.dtrace.mk Modified: stable/10/share/mk/Makefile stable/10/share/mk/bsd.dep.mk stable/10/share/mk/bsd.lib.mk stable/10/share/mk/bsd.prog.mk Directory Properties: stable/10/ (props changed) Modified: stable/10/share/mk/Makefile ============================================================================== --- stable/10/share/mk/Makefile Wed Aug 13 15:50:16 2014 (r269945) +++ stable/10/share/mk/Makefile Wed Aug 13 16:11:57 2014 (r269946) @@ -11,7 +11,6 @@ FILES= \ bsd.crunchgen.mk \ bsd.dep.mk \ bsd.doc.mk \ - bsd.dtrace.mk \ bsd.endian.mk \ bsd.files.mk \ bsd.incs.mk \ Modified: stable/10/share/mk/bsd.dep.mk ============================================================================== --- stable/10/share/mk/bsd.dep.mk Wed Aug 13 15:50:16 2014 (r269945) +++ stable/10/share/mk/bsd.dep.mk Wed Aug 13 16:11:57 2014 (r269946) @@ -73,7 +73,7 @@ tags: ${SRCS} CLEANFILES?= .if !exists(${.OBJDIR}/${DEPENDFILE}) -.for _S in ${SRCS:N*.[hly]} +.for _S in ${SRCS:N*.[dhly]} ${_S:R}.o: ${_S} .endfor .endif @@ -121,14 +121,36 @@ ${_YC:R}.o: ${_YC} .endfor # DTrace probe definitions +# libelf is currently needed for drti.o +.if ${SRCS:M*.d} +LDFLAGS+= -lelf +LDADD+= ${LIBELF} +CFLAGS+= -D_DTRACE_VERSION=1 -I${.OBJDIR} +.endif .for _DSRC in ${SRCS:M*.d:N*/*} -.for _DH in ${_DSRC:R}.h -${_DH}: ${_DSRC} - ${DTRACE} -xnolibs -h -s ${.ALLSRC} -SRCS:= ${SRCS:S/${_DSRC}/${_DH}/} -CLEANFILES+= ${_DH} +.for _D in ${_DSRC:R} +DHDRS+= ${_D}.h +${_D}.h: ${_DSRC} + ${DTRACE} -xnolibs -h -s ${.ALLSRC} +SRCS:= ${SRCS:S/${_DSRC}/${_D}.h/} +OBJS+= ${_D}.o +CLEANFILES+= ${_D}.h ${_D}.o +${_D}.o: ${_D}.h ${OBJS:S/${_D}.o//} + ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.CURDIR}/${_DSRC} \ + ${OBJS:S/${_D}.o//} +.if defined(LIB) +CLEANFILES+= ${_D}.So ${_D}.po +${_D}.So: ${_D}.h ${SOBJS:S/${_D}.So//} + ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.CURDIR}/${_DSRC} \ + ${SOBJS:S/${_D}.So//} +${_D}.po: ${_D}.h ${POBJS:S/${_D}.po//} + ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.CURDIR}/${_DSRC} \ + ${POBJS:S/${_D}.po//} +.endif .endfor .endfor +beforedepend: ${DHDRS} +beforebuild: ${DHDRS} .endif .if !target(depend) Modified: stable/10/share/mk/bsd.lib.mk ============================================================================== --- stable/10/share/mk/bsd.lib.mk Wed Aug 13 15:50:16 2014 (r269945) +++ stable/10/share/mk/bsd.lib.mk Wed Aug 13 16:11:57 2014 (r269946) @@ -117,7 +117,8 @@ PO_FLAG=-pg ${CC} ${PICFLAG} -DPIC ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} -all: objwarn +all: beforebuild .WAIT +beforebuild: objwarn .if defined(PRIVATELIB) _LIBDIR:=${LIBPRIVATEDIR} Modified: stable/10/share/mk/bsd.prog.mk ============================================================================== --- stable/10/share/mk/bsd.prog.mk Wed Aug 13 15:50:16 2014 (r269945) +++ stable/10/share/mk/bsd.prog.mk Wed Aug 13 16:11:57 2014 (r269946) @@ -146,7 +146,8 @@ MAN1= ${MAN} .endif .endif # defined(PROG) -all: objwarn ${PROG} ${SCRIPTS} +all: beforebuild .WAIT ${PROG} ${SCRIPTS} +beforebuild: objwarn .if ${MK_MAN} != "no" all: _manpages .endif From owner-svn-src-stable-10@FreeBSD.ORG Wed Aug 13 22:34:15 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7CED1B69; Wed, 13 Aug 2014 22:34:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 692F72906; Wed, 13 Aug 2014 22:34:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7DMYFLu083255; Wed, 13 Aug 2014 22:34:15 GMT (envelope-from gavin@FreeBSD.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7DMYFl2083254; Wed, 13 Aug 2014 22:34:15 GMT (envelope-from gavin@FreeBSD.org) Message-Id: <201408132234.s7DMYFl2083254@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gavin set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson Date: Wed, 13 Aug 2014 22:34:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269955 - stable/10 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 22:34:15 -0000 Author: gavin Date: Wed Aug 13 22:34:14 2014 New Revision: 269955 URL: http://svnweb.freebsd.org/changeset/base/269955 Log: Add a header to the entries for the removal of csup example files. This is a direct commit to 10, as the equivelent commit to head included other changes that will not be merged to stable branches. Modified: stable/10/ObsoleteFiles.inc Modified: stable/10/ObsoleteFiles.inc ============================================================================== --- stable/10/ObsoleteFiles.inc Wed Aug 13 21:38:29 2014 (r269954) +++ stable/10/ObsoleteFiles.inc Wed Aug 13 22:34:14 2014 (r269955) @@ -45,6 +45,7 @@ OLD_FILES+=usr/share/examples/libusb20/a OLD_FILES+=usr/share/man/man9/VOP_GETVOBJECT.9.gz OLD_FILES+=usr/share/man/man9/VOP_CREATEVOBJECT.9.gz OLD_FILES+=usr/share/man/man9/VOP_DESTROYVOBJECT.9.gz +# 20140625: csup example files removal OLD_FILES+=usr/share/examples/cvsup/README OLD_FILES+=usr/share/examples/cvsup/cvs-supfile OLD_FILES+=usr/share/examples/cvsup/stable-supfile From owner-svn-src-stable-10@FreeBSD.ORG Thu Aug 14 12:16:04 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 769D7739; Thu, 14 Aug 2014 12:16:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 628D32DBB; Thu, 14 Aug 2014 12:16:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7ECG4ct062553; Thu, 14 Aug 2014 12:16:04 GMT (envelope-from roberto@FreeBSD.org) Received: (from roberto@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7ECG4Ov062550; Thu, 14 Aug 2014 12:16:04 GMT (envelope-from roberto@FreeBSD.org) Message-Id: <201408141216.s7ECG4Ov062550@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: roberto set sender to roberto@FreeBSD.org using -f From: Ollivier Robert Date: Thu, 14 Aug 2014 12:16:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269967 - stable/10 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Aug 2014 12:16:04 -0000 Author: roberto Date: Thu Aug 14 12:16:03 2014 New Revision: 269967 URL: http://svnweb.freebsd.org/changeset/base/269967 Log: MFC r269662: 10 has a new flex (2.5.37) and the config.h for unbound has been updated to take this into account. Alas it breaks source upgrade from any version of 9 because flex is not built as a bootstrap-tools (it would be for older versions). That means "libunbound/configlexer.c" is built with the old flex but using config.h for the new one. Build is thus broken going from 9.* to 10. Make flex a bootstrap-tools entry if host is less than 1000033 to take into account the flex update in 10. Tested on both 9.2-RC3 and 9.3 by myself and dim@. Running buildworld in head but as both 10 and 11 has the new flex, it will not matter. Reviewed by: imp Approved by: des, imp MFC after: 1 week Phabric: D554 Modified: stable/10/Makefile.inc1 Directory Properties: stable/10/ (props changed) Modified: stable/10/Makefile.inc1 ============================================================================== --- stable/10/Makefile.inc1 Thu Aug 14 08:42:16 2014 (r269966) +++ stable/10/Makefile.inc1 Thu Aug 14 12:16:03 2014 (r269967) @@ -1218,10 +1218,6 @@ _mklocale= usr.bin/mklocale _sed= usr.bin/sed .endif -.if ${BOOTSTRAPPING} < 900006 -_lex= usr.bin/lex -.endif - .if ${BOOTSTRAPPING} < 1000002 _m4= usr.bin/m4 .endif @@ -1244,6 +1240,10 @@ _nmtree= lib/libnetbsd \ _cat= bin/cat .endif +.if ${BOOTSTRAPPING} < 1000033 +_lex= usr.bin/lex +.endif + .if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041 _awk= usr.bin/awk .endif From owner-svn-src-stable-10@FreeBSD.ORG Thu Aug 14 12:31:19 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 94576BE6; Thu, 14 Aug 2014 12:31:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F3062FF6; Thu, 14 Aug 2014 12:31:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7ECVJpJ069433; Thu, 14 Aug 2014 12:31:19 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7ECVJu7069353; Thu, 14 Aug 2014 12:31:19 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201408141231.s7ECVJu7069353@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 14 Aug 2014 12:31:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269968 - stable/10/usr.bin/iscsictl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Aug 2014 12:31:19 -0000 Author: trasz Date: Thu Aug 14 12:31:18 2014 New Revision: 269968 URL: http://svnweb.freebsd.org/changeset/base/269968 Log: MFC r267614: Add "iscsictl -M", which allows one to change session parameters without removing it and adding back. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.bin/iscsictl/iscsictl.8 stable/10/usr.bin/iscsictl/iscsictl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/iscsictl/iscsictl.8 ============================================================================== --- stable/10/usr.bin/iscsictl/iscsictl.8 Thu Aug 14 12:16:03 2014 (r269967) +++ stable/10/usr.bin/iscsictl/iscsictl.8 Thu Aug 14 12:31:18 2014 (r269968) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 24, 2014 +.Dd June 18, 2014 .Dt ISCSICTL 8 .Os .Sh NAME @@ -47,6 +47,17 @@ .Fl A .Fl n Ar nickname Op Fl c Ar path .Nm +.Fl M +.Fl i Ar session-id +.Op Fl p Ar portal +.Op Fl t Ar target +.Op Fl u Ar user +.Op Fl s Ar secret +.Nm +.Fl M +.Fl i Ar session-id +.Op Fl n Ar nickname Op Fl c Ar path +.Nm .Fl R .Op Fl p Ar portal .Op Fl t Ar target @@ -68,6 +79,8 @@ The following options are available: .Bl -tag -width ".Fl A" .It Fl A Add session. +.It Fl M +Modify session. .It Fl R Remove session. .It Fl L @@ -84,6 +97,10 @@ Target host name or address used for Sen When used, it will add a temporary discovery session. After discovery is done, sessions will be added for each discovered target, and the temporary discovery session will be removed. +.It Fl i +Session ID, as displayed by +.Nm +.Fl v . .It Fl n The "nickname" of session defined in the configuration file. .It Fl p Modified: stable/10/usr.bin/iscsictl/iscsictl.c ============================================================================== --- stable/10/usr.bin/iscsictl/iscsictl.c Thu Aug 14 12:16:03 2014 (r269967) +++ stable/10/usr.bin/iscsictl/iscsictl.c Thu Aug 14 12:31:18 2014 (r269968) @@ -350,6 +350,82 @@ kernel_add(int iscsi_fd, const struct ta } static int +kernel_modify(int iscsi_fd, unsigned int session_id, const struct target *targ) +{ + struct iscsi_session_modify ism; + int error; + + memset(&ism, 0, sizeof(ism)); + ism.ism_session_id = session_id; + conf_from_target(&ism.ism_conf, targ); + error = ioctl(iscsi_fd, ISCSISMODIFY, &ism); + if (error != 0) + warn("ISCSISMODIFY"); + return (error); +} + +static void +kernel_modify_some(int iscsi_fd, unsigned int session_id, const char *target, + const char *target_addr, const char *user, const char *secret) +{ + struct iscsi_session_state *states = NULL; + struct iscsi_session_state *state; + struct iscsi_session_conf *conf; + struct iscsi_session_list isl; + struct iscsi_session_modify ism; + unsigned int i, nentries = 1; + int error; + + for (;;) { + states = realloc(states, + nentries * sizeof(struct iscsi_session_state)); + if (states == NULL) + err(1, "realloc"); + + memset(&isl, 0, sizeof(isl)); + isl.isl_nentries = nentries; + isl.isl_pstates = states; + + error = ioctl(iscsi_fd, ISCSISLIST, &isl); + if (error != 0 && errno == EMSGSIZE) { + nentries *= 4; + continue; + } + break; + } + if (error != 0) + errx(1, "ISCSISLIST"); + + for (i = 0; i < isl.isl_nentries; i++) { + state = &states[i]; + + if (state->iss_id == session_id) + break; + } + if (i == isl.isl_nentries) + errx(1, "session-id %u not found", session_id); + + conf = &state->iss_conf; + + if (target != NULL) + strlcpy(conf->isc_target, target, sizeof(conf->isc_target)); + if (target_addr != NULL) + strlcpy(conf->isc_target_addr, target_addr, + sizeof(conf->isc_target_addr)); + if (user != NULL) + strlcpy(conf->isc_user, user, sizeof(conf->isc_user)); + if (secret != NULL) + strlcpy(conf->isc_secret, secret, sizeof(conf->isc_secret)); + + memset(&ism, 0, sizeof(ism)); + ism.ism_session_id = session_id; + memcpy(&ism.ism_conf, conf, sizeof(ism.ism_conf)); + error = ioctl(iscsi_fd, ISCSISMODIFY, &ism); + if (error != 0) + warn("ISCSISMODIFY"); +} + +static int kernel_remove(int iscsi_fd, const struct target *targ) { struct iscsi_session_remove isr; @@ -404,7 +480,7 @@ kernel_list(int iscsi_fd, const struct t state = &states[i]; conf = &state->iss_conf; - printf("Session ID: %d\n", state->iss_id); + printf("Session ID: %u\n", state->iss_id); printf("Initiator name: %s\n", conf->isc_initiator); printf("Initiator portal: %s\n", conf->isc_initiator_addr); @@ -482,6 +558,10 @@ usage(void) "[-u user -s secret]\n"); fprintf(stderr, " iscsictl -A -a [-c path]\n"); fprintf(stderr, " iscsictl -A -n nickname [-c path]\n"); + fprintf(stderr, " iscsictl -M -i session-id [-p portal] " + "[-t target] [-u user] [-s secret]\n"); + fprintf(stderr, " iscsictl -M -i session-id -n nickname " + "[-c path]\n"); fprintf(stderr, " iscsictl -R [-p portal] [-t target]\n"); fprintf(stderr, " iscsictl -R -a\n"); fprintf(stderr, " iscsictl -R -n nickname [-c path]\n"); @@ -503,20 +583,25 @@ checked_strdup(const char *s) int main(int argc, char **argv) { - int Aflag = 0, Rflag = 0, Lflag = 0, aflag = 0, vflag = 0; + int Aflag = 0, Mflag = 0, Rflag = 0, Lflag = 0, aflag = 0, vflag = 0; const char *conf_path = DEFAULT_CONFIG_PATH; char *nickname = NULL, *discovery_host = NULL, *host = NULL, *target = NULL, *user = NULL, *secret = NULL; + long long session_id = -1; + char *end; int ch, error, iscsi_fd, retval, saved_errno; int failed = 0; struct conf *conf; struct target *targ; - while ((ch = getopt(argc, argv, "ARLac:d:n:p:t:u:s:v")) != -1) { + while ((ch = getopt(argc, argv, "AMRLac:d:i:n:p:t:u:s:v")) != -1) { switch (ch) { case 'A': Aflag = 1; break; + case 'M': + Mflag = 1; + break; case 'R': Rflag = 1; break; @@ -532,6 +617,16 @@ main(int argc, char **argv) case 'd': discovery_host = optarg; break; + case 'i': + session_id = strtol(optarg, &end, 10); + if ((size_t)(end - optarg) != strlen(optarg)) + errx(1, "trailing characters after session-id"); + if (session_id < 0) + errx(1, "session-id cannot be negative"); + if (session_id > UINT_MAX) + errx(1, "session-id cannot be greater than %u", + UINT_MAX); + break; case 'n': nickname = optarg; break; @@ -559,10 +654,10 @@ main(int argc, char **argv) if (argc != 0) usage(); - if (Aflag + Rflag + Lflag == 0) + if (Aflag + Mflag + Rflag + Lflag == 0) Lflag = 1; - if (Aflag + Rflag + Lflag > 1) - errx(1, "at most one of -A, -R, or -L may be specified"); + if (Aflag + Mflag + Rflag + Lflag > 1) + errx(1, "at most one of -A, -M, -R, or -L may be specified"); /* * Note that we ignore unneccessary/inapplicable "-c" flag; so that @@ -614,9 +709,33 @@ main(int argc, char **argv) if (secret != NULL && user == NULL) errx(1, "-s must always be used with -u"); + if (session_id != -1) + errx(1, "-i cannot be used with -A"); if (vflag != 0) errx(1, "-v cannot be used with -A"); + } else if (Mflag != 0) { + if (session_id == -1) + errx(1, "-M requires -i"); + + if (discovery_host != NULL) + errx(1, "-M and -d are mutually exclusive"); + if (aflag != 0) + errx(1, "-M and -a are mutually exclusive"); + if (nickname != NULL) { + if (host != NULL) + errx(1, "-n and -p and mutually exclusive"); + if (target != NULL) + errx(1, "-n and -t and mutually exclusive"); + if (user != NULL) + errx(1, "-n and -u and mutually exclusive"); + if (secret != NULL) + errx(1, "-n and -s and mutually exclusive"); + } + + if (vflag != 0) + errx(1, "-v cannot be used with -M"); + } else if (Rflag != 0) { if (user != NULL) errx(1, "-R and -u are mutually exclusive"); @@ -646,6 +765,8 @@ main(int argc, char **argv) } else errx(1, "must specify either -a, -n, -t, or -p"); + if (session_id != -1) + errx(1, "-i cannot be used with -R"); if (vflag != 0) errx(1, "-v cannot be used with -R"); @@ -664,6 +785,9 @@ main(int argc, char **argv) errx(1, "-L and -n and mutually exclusive"); if (discovery_host != NULL) errx(1, "-L and -d and mutually exclusive"); + + if (session_id != -1) + errx(1, "-i cannot be used with -L"); } iscsi_fd = open(ISCSI_PATH, O_RDWR); @@ -687,15 +811,20 @@ main(int argc, char **argv) conf = conf_new_from_file(conf_path); targ = target_find(conf, nickname); if (targ == NULL) - errx(1, "target %s not found in the configuration file", - nickname); + errx(1, "target %s not found in %s", + nickname, conf_path); if (Aflag != 0) failed += kernel_add(iscsi_fd, targ); + else if (Mflag != 0) + failed += kernel_modify(iscsi_fd, session_id, targ); else if (Rflag != 0) failed += kernel_remove(iscsi_fd, targ); else failed += kernel_list(iscsi_fd, targ, vflag); + } else if (Mflag != 0) { + kernel_modify_some(iscsi_fd, session_id, target, host, + user, secret); } else { if (Aflag != 0 && target != NULL) { if (valid_iscsi_name(target) == false) From owner-svn-src-stable-10@FreeBSD.ORG Thu Aug 14 12:33:24 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DCE11D37; Thu, 14 Aug 2014 12:33:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C8B02207F; Thu, 14 Aug 2014 12:33:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7ECXOFJ071693; Thu, 14 Aug 2014 12:33:24 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7ECXO4s071691; Thu, 14 Aug 2014 12:33:24 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201408141233.s7ECXO4s071691@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 14 Aug 2014 12:33:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269969 - stable/10/usr.bin/iscsictl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Aug 2014 12:33:25 -0000 Author: trasz Date: Thu Aug 14 12:33:24 2014 New Revision: 269969 URL: http://svnweb.freebsd.org/changeset/base/269969 Log: MFC r267615: Rename a variable; no functional changes. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.bin/iscsictl/iscsictl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/iscsictl/iscsictl.c ============================================================================== --- stable/10/usr.bin/iscsictl/iscsictl.c Thu Aug 14 12:31:18 2014 (r269968) +++ stable/10/usr.bin/iscsictl/iscsictl.c Thu Aug 14 12:33:24 2014 (r269969) @@ -585,7 +585,7 @@ main(int argc, char **argv) { int Aflag = 0, Mflag = 0, Rflag = 0, Lflag = 0, aflag = 0, vflag = 0; const char *conf_path = DEFAULT_CONFIG_PATH; - char *nickname = NULL, *discovery_host = NULL, *host = NULL, + char *nickname = NULL, *discovery_host = NULL, *portal = NULL, *target = NULL, *user = NULL, *secret = NULL; long long session_id = -1; char *end; @@ -631,7 +631,7 @@ main(int argc, char **argv) nickname = optarg; break; case 'p': - host = optarg; + portal = optarg; break; case 't': target = optarg; @@ -666,7 +666,7 @@ main(int argc, char **argv) */ if (Aflag != 0) { if (aflag != 0) { - if (host != NULL) + if (portal != NULL) errx(1, "-a and -p and mutually exclusive"); if (target != NULL) errx(1, "-a and -t and mutually exclusive"); @@ -679,7 +679,7 @@ main(int argc, char **argv) if (discovery_host != NULL) errx(1, "-a and -d and mutually exclusive"); } else if (nickname != NULL) { - if (host != NULL) + if (portal != NULL) errx(1, "-n and -p and mutually exclusive"); if (target != NULL) errx(1, "-n and -t and mutually exclusive"); @@ -690,17 +690,17 @@ main(int argc, char **argv) if (discovery_host != NULL) errx(1, "-n and -d and mutually exclusive"); } else if (discovery_host != NULL) { - if (host != NULL) + if (portal != NULL) errx(1, "-d and -p and mutually exclusive"); if (target != NULL) errx(1, "-d and -t and mutually exclusive"); } else { - if (target == NULL && host == NULL) + if (target == NULL && portal == NULL) errx(1, "must specify -a, -n or -t/-p"); - if (target != NULL && host == NULL) + if (target != NULL && portal == NULL) errx(1, "-t must always be used with -p"); - if (host != NULL && target == NULL) + if (portal != NULL && target == NULL) errx(1, "-p must always be used with -t"); } @@ -723,7 +723,7 @@ main(int argc, char **argv) if (aflag != 0) errx(1, "-M and -a are mutually exclusive"); if (nickname != NULL) { - if (host != NULL) + if (portal != NULL) errx(1, "-n and -p and mutually exclusive"); if (target != NULL) errx(1, "-n and -t and mutually exclusive"); @@ -745,22 +745,22 @@ main(int argc, char **argv) errx(1, "-R and -d are mutually exclusive"); if (aflag != 0) { - if (host != NULL) + if (portal != NULL) errx(1, "-a and -p and mutually exclusive"); if (target != NULL) errx(1, "-a and -t and mutually exclusive"); if (nickname != NULL) errx(1, "-a and -n and mutually exclusive"); } else if (nickname != NULL) { - if (host != NULL) + if (portal != NULL) errx(1, "-n and -p and mutually exclusive"); if (target != NULL) errx(1, "-n and -t and mutually exclusive"); - } else if (host != NULL) { + } else if (portal != NULL) { if (target != NULL) errx(1, "-p and -t and mutually exclusive"); } else if (target != NULL) { - if (host != NULL) + if (portal != NULL) errx(1, "-t and -p and mutually exclusive"); } else errx(1, "must specify either -a, -n, -t, or -p"); @@ -773,7 +773,7 @@ main(int argc, char **argv) } else { assert(Lflag != 0); - if (host != NULL) + if (portal != NULL) errx(1, "-L and -p and mutually exclusive"); if (target != NULL) errx(1, "-L and -t and mutually exclusive"); @@ -823,7 +823,7 @@ main(int argc, char **argv) else failed += kernel_list(iscsi_fd, targ, vflag); } else if (Mflag != 0) { - kernel_modify_some(iscsi_fd, session_id, target, host, + kernel_modify_some(iscsi_fd, session_id, target, portal, user, secret); } else { if (Aflag != 0 && target != NULL) { @@ -841,7 +841,7 @@ main(int argc, char **argv) targ->t_address = discovery_host; } else { targ->t_session_type = SESSION_TYPE_NORMAL; - targ->t_address = host; + targ->t_address = portal; } targ->t_user = user; targ->t_secret = secret; From owner-svn-src-stable-10@FreeBSD.ORG Thu Aug 14 12:50:26 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 763E04C2; Thu, 14 Aug 2014 12:50:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 60E7C21D9; Thu, 14 Aug 2014 12:50:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7ECoQZW077956; Thu, 14 Aug 2014 12:50:26 GMT (envelope-from gavin@FreeBSD.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7ECoQ2i077955; Thu, 14 Aug 2014 12:50:26 GMT (envelope-from gavin@FreeBSD.org) Message-Id: <201408141250.s7ECoQ2i077955@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gavin set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson Date: Thu, 14 Aug 2014 12:50:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269970 - stable/10/usr.sbin/jail X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Aug 2014 12:50:26 -0000 Author: gavin Date: Thu Aug 14 12:50:25 2014 New Revision: 269970 URL: http://svnweb.freebsd.org/changeset/base/269970 Log: Merge r266206 from head (by bjk): Review pass through jail.8 Replace usage of "prison" with "jail", since that term has mostly dropped out of use. Note once at the beginning that the "prison" term is equivalent, but do not use it otherwise. [1] Some grammar issues. Some mdoc formatting fixes. Consistently use \(em for em dashes, with spaces around it. Avoid contractions. Prefer ssh to telnet. PR: 176832 [1] Modified: stable/10/usr.sbin/jail/jail.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/jail/jail.8 ============================================================================== --- stable/10/usr.sbin/jail/jail.8 Thu Aug 14 12:33:24 2014 (r269969) +++ stable/10/usr.sbin/jail/jail.8 Thu Aug 14 12:50:25 2014 (r269970) @@ -63,7 +63,9 @@ The .Nm utility creates new jails, or modifies or removes existing jails. -A jail is specified via parameters on the command line, or in the +A jail +.Pq or Dq prison +is specified via parameters on the command line, or in the .Xr jail.conf 5 file. .Pp @@ -73,7 +75,7 @@ At least one of the options or .Fl r must be specified. -These options are used alone or in combination describe the operation to +These options are used alone or in combination to describe the operation to perform: .Bl -tag -width indent .It Fl c @@ -82,8 +84,7 @@ The jail .Va jid and .Va name -parameters (if specified) on the command line, -or any jails +parameters (if specified on the command line) must not refer to an existing jail. .It Fl m Modify an existing jail. @@ -97,14 +98,15 @@ Some parameters may not be changed on a Remove the .Ar jail specified by jid or name. -All jailed processes are killed, and all children of this jail are also +All jailed processes are killed, and all jails that are +children of this jail are also removed. .It Fl rc Restart an existing jail. The jail is first removed and then re-created, as if -.Dq Nm Fl c -and .Dq Nm Fl r +and +.Dq Nm Fl c were run in succession. .It Fl cm Create a jail if it does not exist, or modify the jail if it does exist. @@ -134,7 +136,7 @@ Resolve the parameter (or .Va hostname ) and add all IP addresses returned by the resolver -to the list of addresses for this prison. +to the list of addresses for this jail. This is equivalent to the .Va ip_hostname parameter. @@ -146,7 +148,7 @@ option. .It Fl J Ar jid_file Write a .Ar jid_file -file, containing parameters used to start the jail. +file, containing the parameters used to start the jail. .It Fl l Run commands in a clean environment. This is deprecated and is equivalent to the exec.clean parameter. @@ -166,7 +168,7 @@ Only error messages will be printed. A variation of the .Fl r option that removes an existing jail without using the configuration file. -No removal-related parameters for this jail will be used - the jail will +No removal-related parameters for this jail will be used \(em the jail will simply be removed. .It Fl s Ar securelevel Set the @@ -183,7 +185,7 @@ and .Va exec.system_jail_user parameters. .It Fl U Ar username -The user name from jailed environment as whom jailed commands should run. +The user name from the jailed environment as whom jailed commands should run. This is deprecated and is equivalent to the .Va exec.jail_user parameter. @@ -237,13 +239,12 @@ This mode will always create a new jail, .Fl c and .Fl m -options don't apply (and must not exist). +options do not apply (and must not be present). .Ss Jail Parameters Parameters in the .Xr jail.conf 5 -file, or on the command line, are generally in -.Dq name=value -form. +file, or on the command line, are generally of the form +.Dq name=value . Some parameters are boolean, and do not have a value but are set by the name alone with or without a .Dq no @@ -264,9 +265,10 @@ for details). .Pp The .Nm -utility recognizes two classes of parameters. There are the true jail +utility recognizes two classes of parameters. +There are the true jail parameters that are passed to the kernel when the jail is created, -can be seen with +which can be seen with .Xr jls 8 , and can (usually) be changed with .Dq Nm Fl m . @@ -314,26 +316,26 @@ parameter is implied by the file format, and need not be explicitly set when using the configuration file. .It Va path -The directory which is to be the root of the prison. -Any commands run inside the prison, either by +The directory which is to be the root of the jail. +Any commands run inside the jail, either by .Nm or from .Xr jexec 8 , are run from this directory. .It Va ip4.addr -A list of IPv4 addresses assigned to the prison. +A list of IPv4 addresses assigned to the jail. If this is set, the jail is restricted to using only these addresses. Any attempts to use other addresses fail, and attempts to use wildcard addresses silently use the jailed address instead. -For IPv4 the first address given will be kept used as the source address -in case source address selection on unbound sockets cannot find a better +For IPv4 the first address given will be used as the source address +when source address selection on unbound sockets cannot find a better match. -It is only possible to start multiple jails with the same IP address, +It is only possible to start multiple jails with the same IP address if none of the jails has more than this single overlapping IP address assigned to itself. .It Va ip4.saddrsel A boolean option to change the formerly mentioned behaviour and disable -IPv4 source address selection for the prison in favour of the primary +IPv4 source address selection for the jail in favour of the primary IPv4 address of the jail. Source address selection is enabled by default for all jails and the .Va ip4.nosaddrsel @@ -345,8 +347,8 @@ Possible values are to allow unrestricted access to all system addresses, .Dq new to restrict addresses via -.Va ip4.addr -above, and +.Va ip4.addr , +and .Dq disable to stop the jail from using IPv4 entirely. Setting the @@ -354,14 +356,14 @@ Setting the parameter implies a value of .Dq new . .It Va ip6.addr , Va ip6.saddrsel , Va ip6 -A set of IPv6 options for the prison, the counterparts to +A set of IPv6 options for the jail, the counterparts to .Va ip4.addr , .Va ip4.saddrsel and .Va ip4 above. .It vnet -Create the prison with its own virtual network stack, +Create the jail with its own virtual network stack, with its own network interfaces, addresses, routing table, etc. The kernel must have been compiled with the .Sy VIMAGE option @@ -373,7 +375,7 @@ and .Dq new to create a new network stack. .It Va host.hostname -The hostname of the prison. +The hostname of the jail. Other similar parameters are .Va host.domainname , .Va host.hostuuid @@ -392,7 +394,7 @@ Setting any of the above fields implies The value of the jail's .Va kern.securelevel sysctl. -A jail never has a lower securelevel than the default system, but by +A jail never has a lower securelevel than its parent system, but by setting this parameter it may have a higher one. If the system securelevel is changed, any jail securelevels will be at least as secure. @@ -432,12 +434,12 @@ section for more information. The number of descendants of this jail, including its own child jails and any jails created under them. .It Va enforce_statfs -This determines which information processes in a jail are able to get +This determines what information processes in a jail are able to get about mount points. It affects the behaviour of the following syscalls: .Xr statfs 2 , .Xr fstatfs 2 , -.Xr getfsstat 2 +.Xr getfsstat 2 , and .Xr fhstatfs 2 (as well as similar compatibility syscalls). @@ -488,12 +490,12 @@ namespace across the host and jail envir within a jail would be able to communicate with (and potentially interfere with) processes outside of the jail, and in other jails. .It Va allow.raw_sockets -The prison root is allowed to create raw sockets. +The jail root is allowed to create raw sockets. Setting this parameter allows utilities like .Xr ping 8 and .Xr traceroute 8 -to operate inside the prison. +to operate inside the jail. If this is set, the source IP addresses are enforced to comply with the IP address bound to the jail, regardless of whether or not the @@ -523,10 +525,10 @@ privileged users inside the jail will be devfs file system. This permission is effective only together with .Va allow.mount -and if +and only when .Va enforce_statfs is set to a value lower than 2. -Please consider restricting the devfs ruleset with the +The devfs ruleset should be restricted from the default by using the .Va devfs_ruleset option. .It Va allow.mount.nullfs @@ -534,7 +536,7 @@ privileged users inside the jail will be nullfs file system. This permission is effective only together with .Va allow.mount -and if +and only when .Va enforce_statfs is set to a value lower than 2. .It Va allow.mount.procfs @@ -542,7 +544,7 @@ privileged users inside the jail will be procfs file system. This permission is effective only together with .Va allow.mount -and if +and only when .Va enforce_statfs is set to a value lower than 2. .It Va allow.mount.tmpfs @@ -550,7 +552,7 @@ privileged users inside the jail will be tmpfs file system. This permission is effective only together with .Va allow.mount -and if +and only when .Va enforce_statfs is set to a value lower than 2. .It Va allow.mount.zfs @@ -558,7 +560,7 @@ privileged users inside the jail will be ZFS file system. This permission is effective only together with .Va allow.mount -and if +and only when .Va enforce_statfs is set to a value lower than 2. See @@ -566,7 +568,7 @@ See for information on how to configure the ZFS filesystem to operate from within a jail. .It Va allow.quotas -The prison root may administer quotas on the jail's filesystem(s). +The jail root may administer quotas on the jail's filesystem(s). This includes filesystems that the jail may share with other jails or with non-jailed parts of the system. .It Va allow.socket_af @@ -576,33 +578,33 @@ have not had jail functionality added to .El .El .Pp -There are pseudo-parameters that aren't passed to the kernel, but are +There are pseudo-parameters that are not passed to the kernel, but are used by .Nm -to set up the prison environment, often by running specified commands +to set up the jail environment, often by running specified commands when jails are created or removed. The .Va exec.* command parameters are .Xr sh 1 -command lines that are run in either the system or prison environment. +command lines that are run in either the system or jail environment. They may be given multiple values, which run would the specified commands in sequence. All commands must succeed (return a zero exit status), or the jail will -not be created or removed. +not be created or removed, as appropriate. .Pp The pseudo-parameters are: .Bl -tag -width indent .It Va exec.prestart -Command(s) to run in the system environment before a prison is created. +Command(s) to run in the system environment before a jail is created. .It Va exec.start -Command(s) to run in the prison environment when a jail is created. +Command(s) to run in the jail environment when a jail is created. A typical command to run is .Dq sh /etc/rc . .It Va command A synonym for .Va exec.start -for use when specifying a prison directly on the command line. +for use when specifying a jail directly on the command line. Unlike other parameters whose value is a single string, .Va command uses the remainder of the @@ -616,7 +618,7 @@ commands have completed. .It Va exec.prestop Command(s) to run in the system environment before a jail is removed. .It Va exec.stop -Command(s) to run in the prison environment before a jail is removed, +Command(s) to run in the jail environment before a jail is removed, and after any .Va exec.prestop commands have completed. @@ -641,14 +643,14 @@ is imported from the current environment The environment variables from the login class capability database for the target login are also set. .It Va exec.jail_user -The user to run commands as, when running in the prison environment. +The user to run commands as, when running in the jail environment. The default is to run the commands as the current user. .It Va exec.system_jail_user This boolean option looks for the .Va exec.jail_user in the system .Xr passwd 5 -file, instead of in the prison's file. +file, instead of in the jail's file. .It Va exec.system_user The user to run commands as, when running in the system environment. The default is to run the commands as the current user. @@ -656,35 +658,35 @@ The default is to run the commands as th The maximum amount of time to wait for a command to complete, in seconds. If a command is still running after this timeout has passed, -the jail not be created or removed. +the jail will not be created or removed, as appropriate. .It Va exec.consolelog A file to direct command output (stdout and stderr) to. .It Va exec.fib -The FIB (routing table) to set when running commands inside the prison. +The FIB (routing table) to set when running commands inside the jail. .It Va stop.timeout -The maximum amount of time to wait for a prison's processes to exit +The maximum amount of time to wait for a jail's processes to exit after sending them a .Dv SIGTERM signal (which happens after the .Va exec.stop commands have completed). -After this many seconds have passed, the prison will be removed, which +After this many seconds have passed, the jail will be removed, which will kill any remaining processes. If this is set to zero, no .Dv SIGTERM -is sent and the prison is immediately removed. +is sent and the jail is immediately removed. The default is 10 seconds. .It Va interface -A network interface to add the prison's IP addresses +A network interface to add the jail's IP addresses .Va ( ip4.addr and .Va ip6.addr ) to. An alias for each address will be added to the interface before the -prison is created, and will be removed from the interface after the -prison is removed. +jail is created, and will be removed from the interface after the +jail is removed. .It Va ip4.addr -In addition to the IP addresses that are passed to the kernel, and +In addition to the IP addresses that are passed to the kernel, an interface, netmask and additional paramters (as supported by .Xr ifconfig 8 Ns ) may also be specified, in the form @@ -692,8 +694,9 @@ may also be specified, in the form If an interface is given before the IP address, an alias for the address will be added to that interface, as it is with the .Va interface -parameter. If a netmask in either dotted-quad or CIDR form is given -after IP address, it will be used when adding the IP alias. +parameter. +If a netmask in either dotted-quad or CIDR form is given +after an IP address, it will be used when adding the IP alias. If additional parameters are specified then they will also be used when adding the IP alias. .It Va ip6.addr @@ -704,20 +707,20 @@ may also be specified, in the form .Dq Ar interface Ns | Ns Ar ip-address Ns / Ns Ar prefix param ... . .It Va vnet.interface A network interface to give to a vnet-enabled jail after is it created. -The interface will automatically be returned when the jail is removed. +The interface will automatically be released when the jail is removed. .It Va ip_hostname Resolve the .Va host.hostname parameter and add all IP addresses returned by the resolver to the list of addresses -.Va ( ip4.addr +.Po Va ip4.addr or -.Va ip6.addr ) -for this prison. +.Va ip6.addr Pc +for this jail. This may affect default address selection for outgoing IPv4 connections -of prisons. +from jails. The address first returned by the resolver for each address family -will be used as primary address. +will be used as the primary address. .It Va mount A filesystem to mount before creating the jail (and to unmount after removing it), given as a single @@ -735,7 +738,7 @@ filesystem on the chrooted directory, and apply the ruleset in the .Va devfs_ruleset parameter (or a default of ruleset 4: devfsrules_jail) -to restrict the devices visible inside the prison. +to restrict the devices visible inside the jail. .It Va mount.fdescfs Mount a .Xr fdescfs 5 @@ -768,11 +771,11 @@ is required, so as to provide the necessary command line tools, daemons, libraries, application configuration files, etc. However, for a virtual server configuration, a fair amount of -additional work is required so as to configure the +additional work is required so as to replace the .Dq boot process. This manual page documents the configuration steps necessary to support -either of these steps, although the configuration steps may be +either of these steps, although the configuration steps may need to be refined based on local requirements. .Ss "Setting up a Jail Directory Tree" To set up a jail directory tree containing an entire @@ -792,7 +795,7 @@ In many cases this example would put far In the other extreme case a jail might contain only one file: the executable to be run in the jail. .Pp -We recommend experimentation and caution that it is a lot easier to +We recommend experimentation, and caution that it is a lot easier to start with a .Dq fat jail and remove things until it stops working, @@ -811,13 +814,13 @@ for a jail named Substitute below as needed with your own directory, IP address, and hostname. .Ss "Setting up the Host Environment" -First, you will want to set up your real system's environment to be +First, set up the real system's environment to be .Dq jail-friendly . For consistency, we will refer to the parent box as the .Dq "host environment" , and to the jailed virtual machine as the .Dq "jail environment" . -Since jail is implemented using IP aliases, one of the first things to do +Since jails are implemented using IP aliases, one of the first things to do is to disable IP services on the host system that listen on all local IP addresses for a service. If a network service is present in the host environment that binds all @@ -840,13 +843,12 @@ rpcbind_enable="NO" is the native IP address for the host system, in this example. Daemons that run out of .Xr inetd 8 -can be easily set to use only the specified host IP address. +can be easily configured to use only the specified host IP address. Other daemons -will need to be manually configured\(emfor some this is possible through -the +will need to be manually configured \(em for some this is possible through .Xr rc.conf 5 flags entries; for others it is necessary to modify per-application -configuration files, or to recompile the applications. +configuration files, or to recompile the application. The following frequently deployed services must have their individual configuration files modified to limit the application to listening to a specific IP address: @@ -884,7 +886,7 @@ easily reconfigured to use only specific hosted directly from the kernel. Any third-party network software running in the host environment should also be checked and configured so that it -does not bind all IP addresses, which would result in those services' also +does not bind all IP addresses, which would result in those services also appearing to be offered by the jail environments. .Pp Once @@ -897,7 +899,7 @@ etc.). Start any jail for the first time without configuring the network interface so that you can clean it up a little and set up accounts. As -with any machine (virtual or not) you will need to set a root password, time +with any machine (virtual or not), you will need to set a root password, time zone, etc. Some of these steps apply only if you intend to run a full virtual server inside the jail; others apply both for constraining a particular application @@ -921,7 +923,7 @@ etc. .It Configure .Pa /etc/resolv.conf -so that name resolution within the jail will work correctly +so that name resolution within the jail will work correctly. .It Run .Xr newaliases 1 @@ -929,13 +931,13 @@ to quell .Xr sendmail 8 warnings. .It -Set a root password, probably different from the real host system +Set a root password, probably different from the real host system. .It -Set the timezone +Set the timezone. .It -Add accounts for users in the jail environment +Add accounts for users in the jail environment. .It -Install any packages the environment requires +Install any packages the environment requires. .El .Pp You may also want to perform any package-specific configuration (web servers, @@ -995,11 +997,12 @@ and other processes running within the j with the .Ql J flag appearing beside jailed processes. -To see an active list of jails, use the -.Xr jls 8 -utility. -You should also be able to -.Xr telnet 1 +To see an active list of jails, use +.Xr jls 8 . +If +.Xr sshd 8 +is enabled in the jail environment, you should be able to +.Xr ssh 1 to the hostname or IP address of the jailed environment, and log in using the accounts you created previously. .Pp @@ -1027,7 +1030,7 @@ This will send the .Dv SIGTERM or .Dv SIGKILL -signals to all processes in the jail - be careful not to run this from +signals to all processes in the jail \(em be careful not to run this from the host environment! Once all of the jail's processes have died, unless the jail was created with the @@ -1082,18 +1085,18 @@ or any file system inside a jail unless the file system is marked jail-friendly, the jail's .Va allow.mount -parameter is set and the jail's +parameter is set, and the jail's .Va enforce_statfs parameter is lower than 2. .Pp Multiple jails sharing the same file system can influence each other. -For example a user in one jail can fill the file system also +For example, a user in one jail can fill the file system, leaving no space for processes in the other jail. Trying to use .Xr quota 1 -to prevent this will not work either as the file system quotas +to prevent this will not work either, as the file system quotas are not aware of jails but only look at the user and group IDs. -This means the same user ID in two jails share the same file +This means the same user ID in two jails share a single file system quota. One would need to use one file system per jail to make this work. .Ss "Sysctl MIB Entries" @@ -1104,11 +1107,11 @@ is one) or not (value is zero). .Pp The variable .Va security.jail.max_af_ips -determines how may address per address family a prison may have. +determines how may address per address family a jail may have. The default is 255. .Pp Some MIB variables have per-jail settings. -Changes to these variables by a jailed process do not effect the host +Changes to these variables by a jailed process do not affect the host environment, only the jail environment. These variables are .Va kern.securelevel , @@ -1133,7 +1136,7 @@ of 0 indicates the jail is a child of th jail if the current process isn't jailed). .Pp Jailed processes are not allowed to confer greater permissions than they -themselves are given, e.g. if a jail is created with +themselves are given, e.g., if a jail is created with .Va allow.nomount , it is not able to create a jail with .Va allow.mount From owner-svn-src-stable-10@FreeBSD.ORG Thu Aug 14 14:07:05 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D5147D3E; Thu, 14 Aug 2014 14:07:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B5AD52A83; Thu, 14 Aug 2014 14:07:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7EE75UG013866; Thu, 14 Aug 2014 14:07:05 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7EE75lC013864; Thu, 14 Aug 2014 14:07:05 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201408141407.s7EE75lC013864@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Thu, 14 Aug 2014 14:07:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269975 - in stable/10: . sys/dev/ixgbe X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Aug 2014 14:07:05 -0000 Author: smh Date: Thu Aug 14 14:07:05 2014 New Revision: 269975 URL: http://svnweb.freebsd.org/changeset/base/269975 Log: Make the ixgbe tunables now match their sysctl counterparts. Previously the tunables and sysctls had different names for example: hw.ixgbe.enable_aim => hw.ix.enable_aim Anyone using ixgbe tunables should ensure they update /boot/loader.conf. This is a direct commit to stable as the changes to sysctls in head already fix this issue in a different way. Sponsored by: Multiplay Modified: stable/10/UPDATING stable/10/sys/dev/ixgbe/ixgbe.c Modified: stable/10/UPDATING ============================================================================== --- stable/10/UPDATING Thu Aug 14 13:57:17 2014 (r269974) +++ stable/10/UPDATING Thu Aug 14 14:07:05 2014 (r269975) @@ -16,6 +16,11 @@ from older versions of FreeBSD, try WITH stable/10, and then rebuild without this option. The bootstrap process from older version of current is a bit fragile. +20140814: + The ixgbe tunables now match their sysctl counterparts, for example: + hw.ixgbe.enable_aim => hw.ix.enable_aim + Anyone using ixgbe tunables should ensure they update /boot/loader.conf. + 20140801: The NFSv4.1 server committed by r269398 changes the internal function call interfaces used between the NFS and krpc modules. Modified: stable/10/sys/dev/ixgbe/ixgbe.c ============================================================================== --- stable/10/sys/dev/ixgbe/ixgbe.c Thu Aug 14 13:57:17 2014 (r269974) +++ stable/10/sys/dev/ixgbe/ixgbe.c Thu Aug 14 14:07:05 2014 (r269975) @@ -244,18 +244,18 @@ static SYSCTL_NODE(_hw, OID_AUTO, ix, CT ** traffic for that interrupt vector */ static int ixgbe_enable_aim = TRUE; -TUNABLE_INT("hw.ixgbe.enable_aim", &ixgbe_enable_aim); +TUNABLE_INT("hw.ix.enable_aim", &ixgbe_enable_aim); SYSCTL_INT(_hw_ix, OID_AUTO, enable_aim, CTLFLAG_RW, &ixgbe_enable_aim, 0, "Enable adaptive interrupt moderation"); static int ixgbe_max_interrupt_rate = (4000000 / IXGBE_LOW_LATENCY); -TUNABLE_INT("hw.ixgbe.max_interrupt_rate", &ixgbe_max_interrupt_rate); +TUNABLE_INT("hw.ix.max_interrupt_rate", &ixgbe_max_interrupt_rate); SYSCTL_INT(_hw_ix, OID_AUTO, max_interrupt_rate, CTLFLAG_RDTUN, &ixgbe_max_interrupt_rate, 0, "Maximum interrupts per second"); /* How many packets rxeof tries to clean at a time */ static int ixgbe_rx_process_limit = 256; -TUNABLE_INT("hw.ixgbe.rx_process_limit", &ixgbe_rx_process_limit); +TUNABLE_INT("hw.ix.rx_process_limit", &ixgbe_rx_process_limit); SYSCTL_INT(_hw_ix, OID_AUTO, rx_process_limit, CTLFLAG_RDTUN, &ixgbe_rx_process_limit, 0, "Maximum number of received packets to process at a time," @@ -263,7 +263,7 @@ SYSCTL_INT(_hw_ix, OID_AUTO, rx_process_ /* How many packets txeof tries to clean at a time */ static int ixgbe_tx_process_limit = 256; -TUNABLE_INT("hw.ixgbe.tx_process_limit", &ixgbe_tx_process_limit); +TUNABLE_INT("hw.ix.tx_process_limit", &ixgbe_tx_process_limit); SYSCTL_INT(_hw_ix, OID_AUTO, tx_process_limit, CTLFLAG_RDTUN, &ixgbe_tx_process_limit, 0, "Maximum number of sent packets to process at a time," @@ -283,7 +283,7 @@ static int ixgbe_smart_speed = ixgbe_sma * but this allows it to be forced off for testing. */ static int ixgbe_enable_msix = 1; -TUNABLE_INT("hw.ixgbe.enable_msix", &ixgbe_enable_msix); +TUNABLE_INT("hw.ix.enable_msix", &ixgbe_enable_msix); SYSCTL_INT(_hw_ix, OID_AUTO, enable_msix, CTLFLAG_RDTUN, &ixgbe_enable_msix, 0, "Enable MSI-X interrupts"); @@ -294,7 +294,7 @@ SYSCTL_INT(_hw_ix, OID_AUTO, enable_msix * can be overriden manually here. */ static int ixgbe_num_queues = 0; -TUNABLE_INT("hw.ixgbe.num_queues", &ixgbe_num_queues); +TUNABLE_INT("hw.ix.num_queues", &ixgbe_num_queues); SYSCTL_INT(_hw_ix, OID_AUTO, num_queues, CTLFLAG_RDTUN, &ixgbe_num_queues, 0, "Number of queues to configure, 0 indicates autoconfigure"); @@ -304,13 +304,13 @@ SYSCTL_INT(_hw_ix, OID_AUTO, num_queues, ** the better performing choice. */ static int ixgbe_txd = PERFORM_TXD; -TUNABLE_INT("hw.ixgbe.txd", &ixgbe_txd); +TUNABLE_INT("hw.ix.txd", &ixgbe_txd); SYSCTL_INT(_hw_ix, OID_AUTO, txd, CTLFLAG_RDTUN, &ixgbe_txd, 0, "Number of transmit descriptors per queue"); /* Number of RX descriptors per ring */ static int ixgbe_rxd = PERFORM_RXD; -TUNABLE_INT("hw.ixgbe.rxd", &ixgbe_rxd); +TUNABLE_INT("hw.ix.rxd", &ixgbe_rxd); SYSCTL_INT(_hw_ix, OID_AUTO, rxd, CTLFLAG_RDTUN, &ixgbe_rxd, 0, "Number of receive descriptors per queue"); @@ -320,7 +320,7 @@ SYSCTL_INT(_hw_ix, OID_AUTO, rxd, CTLFLA ** doing so you are on your own :) */ static int allow_unsupported_sfp = FALSE; -TUNABLE_INT("hw.ixgbe.unsupported_sfp", &allow_unsupported_sfp); +TUNABLE_INT("hw.ix.unsupported_sfp", &allow_unsupported_sfp); /* ** HW RSC control: From owner-svn-src-stable-10@FreeBSD.ORG Thu Aug 14 16:07:15 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 03AEA24F; Thu, 14 Aug 2014 16:07:15 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CC85229A5; Thu, 14 Aug 2014 16:07:14 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id B6C95B93B; Thu, 14 Aug 2014 12:07:13 -0400 (EDT) From: John Baldwin To: Peter Wemm Subject: Re: svn commit: r269847 - in stable/10: contrib/apr contrib/apr/docs contrib/apr/encoding contrib/apr/file_io/unix contrib/apr/include contrib/apr/include/arch/unix contrib/apr/include/private contrib/... Date: Thu, 14 Aug 2014 11:14:37 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20140415; KDE/4.5.5; amd64; ; ) References: <53e9707c.2d6c.2d976b@svn.freebsd.org> <201408121119.32037.jhb@freebsd.org> <5874043.odmAkWF3cI@overcee.wemm.org> In-Reply-To: <5874043.odmAkWF3cI@overcee.wemm.org> MIME-Version: 1.0 Message-Id: <201408141114.37992.jhb@freebsd.org> Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 14 Aug 2014 12:07:13 -0400 (EDT) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-10@freebsd.org, Peter Wemm X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Aug 2014 16:07:15 -0000 On Tuesday, August 12, 2014 4:23:16 pm Peter Wemm wrote: > On Tuesday 12 August 2014 11:19:31 John Baldwin wrote: > > On Monday, August 11, 2014 9:40:12 pm Peter Wemm wrote: > > > Author: peter > > > Date: Tue Aug 12 01:40:11 2014 > > > New Revision: 269847 > > > URL: http://svnweb.freebsd.org/changeset/base/269847 > > > > > > Log: > > > MFC r266728,266731,266735,266736,268135,268960,269833 > > > > > > Update apr 1.4.8 -> 1.5.1 > > > Update apr-util 1.5.2 -> 1.5.3 > > > Update serf 1.3.4 -> 1.3.7 > > > Update svnlite 1.8.8 -> 1.8.10 > > > Deal with svnlite.1 manpage. > > > > Isn't this merge a little quick? 1.8.10 only went into head about 6 hours > > before this commit. The 1.8.8 merge to 10 was also rather quick (less than > > an hour after it was merged to HEAD). If the security issues noted in the > > commit for HEAD are severe enough to warrant an immediate merge, then there > > should probably be an advisory. Otherwise, I think svn updates should > > probably have some bake time in HEAD before going to stable. > > The jumbo-MFC was mostly to gather up the updates that have been baking in > head for a while. 10.1 is coming up soon. > > It just seemed silly to MFC everything except a specific, targeted security fix. > I suspect that for every question I got about including the security update, > I'd have received 5 times as many asking why I hadn't included it. Surely the MFC could have waited 3 days or so though? We generally default to having some sort of bake-in period for MFCs and only bypassing that if there is an urgent need (such as an SA). The code flush for 10.1 is still a week away. -- John Baldwin From owner-svn-src-stable-10@FreeBSD.ORG Thu Aug 14 16:45:01 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EB9E7B50; Thu, 14 Aug 2014 16:45:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D6FE02FE3; Thu, 14 Aug 2014 16:45:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7EGj1Bj086627; Thu, 14 Aug 2014 16:45:01 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7EGj1Ef086626; Thu, 14 Aug 2014 16:45:01 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201408141645.s7EGj1Ef086626@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 14 Aug 2014 16:45:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r269986 - stable/10/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Aug 2014 16:45:02 -0000 Author: markj Date: Thu Aug 14 16:45:01 2014 New Revision: 269986 URL: http://svnweb.freebsd.org/changeset/base/269986 Log: MFC r257877: Don't try to use the 32-bit drti.o unless the data model is explicitly set to ILP32. Otherwise dtrace -G will attempt to use it on amd64 if it can't determine which data model to use, which happens when -64 is omitted and no object files are provided, e.g. with # dtrace -G -n BEGIN This would result in a linker error, but now works properly. Also remove an unnecessary #ifdef. Modified: stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Thu Aug 14 16:25:43 2014 (r269985) +++ stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Thu Aug 14 16:45:01 2014 (r269986) @@ -1871,7 +1871,7 @@ dtrace_program_link(dtrace_hdl_t *dtp, d * Arches which default to 64-bit need to explicitly use * the 32-bit library path. */ - int use_32 = !(dtp->dt_oflags & DTRACE_O_LP64); + int use_32 = (dtp->dt_oflags & DTRACE_O_ILP32); #else /* * Arches which are 32-bit only just use the normal @@ -1886,9 +1886,7 @@ dtrace_program_link(dtrace_hdl_t *dtp, d len = snprintf(&tmp, 1, fmt, dtp->dt_ld_path, file, tfile, drti) + 1; -#if !defined(sun) len *= 2; -#endif cmd = alloca(len); (void) snprintf(cmd, len, fmt, dtp->dt_ld_path, file, From owner-svn-src-stable-10@FreeBSD.ORG Thu Aug 14 22:01:28 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1D8BDB4A; Thu, 14 Aug 2014 22:01:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 93E922BBC; Thu, 14 Aug 2014 20:20:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7EKKNQT085510; Thu, 14 Aug 2014 20:20:23 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7EKKMP5085498; Thu, 14 Aug 2014 20:20:22 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201408142020.s7EKKMP5085498@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 14 Aug 2014 20:20:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270002 - in stable/10: include lib/libc/gen X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Aug 2014 22:01:28 -0000 Author: jhb Date: Thu Aug 14 20:20:21 2014 New Revision: 270002 URL: http://svnweb.freebsd.org/changeset/base/270002 Log: MFC 268531,269079,269204: Fix various edge cases with rewinddir(), seekdir(), and telldir(): - In the unionfs case, opendir() and fdopendir() read the directory's full contents and cache it. This cache is not refreshed when rewinddir() is called, so rewinddir() will not notice updates to a directory. Fix this by splitting the code to fetch a directory's contents out of __opendir_common() into a new _filldir() function and call this from rewinddir() when operating on a unionfs directory. - If rewinddir() is called on a directory opened with fdopendir() before any directory entries are fetched, rewinddir() will not adjust the seek location of the backing file descriptor. If the file descriptor passed to fdopendir() had a non-zero offset, the rewinddir() will not rewind to the beginning. Fix this by always seeking back to 0 in rewinddir(). This means the dd_rewind hack can also be removed. - Add missing locking to rewinddir() - POSIX says that passing a location returned by telldir() to seekdir() after an intervening call to rewinddir() is undefined, so reclaim any pending telldir() cookies in the directory when rewinddir() is called. - If telldir() is called immediately after a call to seekdir(), POSIX requires the return value of telldir() to equal the value passed to seekdir(). The current seekdir code with SINGLEUSE enabled breaks this case as each call to telldir() allocates a new cookie. Instead, remove the SINGLEUSE code and change telldir() to look for an existing cookie for the directory's current location rather than always creating a new cookie. PR: 121656 Modified: stable/10/include/dirent.h stable/10/lib/libc/gen/directory.3 stable/10/lib/libc/gen/gen-private.h stable/10/lib/libc/gen/opendir.c stable/10/lib/libc/gen/readdir.c stable/10/lib/libc/gen/rewinddir.c stable/10/lib/libc/gen/telldir.c stable/10/lib/libc/gen/telldir.h Directory Properties: stable/10/ (props changed) Modified: stable/10/include/dirent.h ============================================================================== --- stable/10/include/dirent.h Thu Aug 14 20:17:23 2014 (r270001) +++ stable/10/include/dirent.h Thu Aug 14 20:20:21 2014 (r270002) @@ -63,6 +63,7 @@ typedef struct _dirdesc DIR; #define DTF_NODUP 0x0002 /* don't return duplicate names */ #define DTF_REWIND 0x0004 /* rewind after reading union stack */ #define __DTF_READALL 0x0008 /* everything has been read */ +#define __DTF_SKIPREAD 0x0010 /* assume internal buffer is populated */ #else /* !__BSD_VISIBLE */ Modified: stable/10/lib/libc/gen/directory.3 ============================================================================== --- stable/10/lib/libc/gen/directory.3 Thu Aug 14 20:17:23 2014 (r270001) +++ stable/10/lib/libc/gen/directory.3 Thu Aug 14 20:20:21 2014 (r270002) @@ -28,7 +28,7 @@ .\" @(#)directory.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd August 18, 2013 +.Dd July 28, 2014 .Dt DIRECTORY 3 .Os .Sh NAME @@ -169,6 +169,10 @@ If the directory is closed and then reopened, prior values returned by .Fn telldir will no longer be valid. +Values returned by +.Fn telldir +are also invalidated by a call to +.Fn rewinddir . .Pp The .Fn seekdir @@ -182,13 +186,6 @@ The new position reverts to the one asso when the .Fn telldir operation was performed. -State associated with the token returned by -.Fn telldir is freed when it is passed to -.Fn seekdir . -If you wish return to the same location again, -then you must create a new token with another -.Fn telldir -call. .Pp The .Fn rewinddir Modified: stable/10/lib/libc/gen/gen-private.h ============================================================================== --- stable/10/lib/libc/gen/gen-private.h Thu Aug 14 20:17:23 2014 (r270001) +++ stable/10/lib/libc/gen/gen-private.h Thu Aug 14 20:20:21 2014 (r270002) @@ -48,7 +48,6 @@ struct _dirdesc { char *dd_buf; /* data buffer */ int dd_len; /* size of data buffer */ long dd_seek; /* magic cookie returned by getdirentries */ - long dd_rewind; /* magic cookie for rewinding */ int dd_flags; /* flags for readdir */ struct pthread_mutex *dd_lock; /* lock */ struct _telldir *dd_td; /* telldir position recording */ Modified: stable/10/lib/libc/gen/opendir.c ============================================================================== --- stable/10/lib/libc/gen/opendir.c Thu Aug 14 20:17:23 2014 (r270001) +++ stable/10/lib/libc/gen/opendir.c Thu Aug 14 20:20:21 2014 (r270002) @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); #include "gen-private.h" #include "telldir.h" -static DIR * __opendir_common(int, int); +static DIR * __opendir_common(int, int, bool); /* * Open a directory. @@ -67,18 +67,10 @@ opendir(const char *name) DIR * fdopendir(int fd) { - struct stat statb; - /* Check that fd is associated with a directory. */ - if (_fstat(fd, &statb) != 0) - return (NULL); - if (!S_ISDIR(statb.st_mode)) { - errno = ENOTDIR; - return (NULL); - } if (_fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) return (NULL); - return (__opendir_common(fd, DTF_HIDEW|DTF_NODUP)); + return (__opendir_common(fd, DTF_HIDEW|DTF_NODUP, true)); } DIR * @@ -88,11 +80,13 @@ __opendir2(const char *name, int flags) DIR *dir; int saved_errno; + if ((flags & (__DTF_READALL | __DTF_SKIPREAD)) != 0) + return (NULL); if ((fd = _open(name, O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC)) == -1) return (NULL); - dir = __opendir_common(fd, flags); + dir = __opendir_common(fd, flags, false); if (dir == NULL) { saved_errno = errno; _close(fd); @@ -110,22 +104,195 @@ opendir_compar(const void *p1, const voi } /* + * For a directory at the top of a unionfs stack, the entire directory's + * contents are read and cached locally until the next call to rewinddir(). + * For the fdopendir() case, the initial seek position must be preserved. + * For rewinddir(), the full directory should always be re-read from the + * beginning. + * + * If an error occurs, the existing buffer and state of 'dirp' is left + * unchanged. + */ +bool +_filldir(DIR *dirp, bool use_current_pos) +{ + struct dirent **dpv; + char *buf, *ddptr, *ddeptr; + off_t pos; + int fd2, incr, len, n, saved_errno, space; + + len = 0; + space = 0; + buf = NULL; + ddptr = NULL; + + /* + * Use the system page size if that is a multiple of DIRBLKSIZ. + * Hopefully this can be a big win someday by allowing page + * trades to user space to be done by _getdirentries(). + */ + incr = getpagesize(); + if ((incr % DIRBLKSIZ) != 0) + incr = DIRBLKSIZ; + + /* + * The strategy here is to read all the directory + * entries into a buffer, sort the buffer, and + * remove duplicate entries by setting the inode + * number to zero. + * + * We reopen the directory because _getdirentries() + * on a MNT_UNION mount modifies the open directory, + * making it refer to the lower directory after the + * upper directory's entries are exhausted. + * This would otherwise break software that uses + * the directory descriptor for fchdir or *at + * functions, such as fts.c. + */ + if ((fd2 = _openat(dirp->dd_fd, ".", O_RDONLY | O_CLOEXEC)) == -1) + return (false); + + if (use_current_pos) { + pos = lseek(dirp->dd_fd, 0, SEEK_CUR); + if (pos == -1 || lseek(fd2, pos, SEEK_SET) == -1) { + saved_errno = errno; + _close(fd2); + errno = saved_errno; + return (false); + } + } + + do { + /* + * Always make at least DIRBLKSIZ bytes + * available to _getdirentries + */ + if (space < DIRBLKSIZ) { + space += incr; + len += incr; + buf = reallocf(buf, len); + if (buf == NULL) { + saved_errno = errno; + _close(fd2); + errno = saved_errno; + return (false); + } + ddptr = buf + (len - space); + } + + n = _getdirentries(fd2, ddptr, space, &dirp->dd_seek); + if (n > 0) { + ddptr += n; + space -= n; + } + if (n < 0) { + saved_errno = errno; + _close(fd2); + errno = saved_errno; + return (false); + } + } while (n > 0); + _close(fd2); + + ddeptr = ddptr; + + /* + * There is now a buffer full of (possibly) duplicate + * names. + */ + dirp->dd_buf = buf; + + /* + * Go round this loop twice... + * + * Scan through the buffer, counting entries. + * On the second pass, save pointers to each one. + * Then sort the pointers and remove duplicate names. + */ + for (dpv = 0;;) { + n = 0; + ddptr = buf; + while (ddptr < ddeptr) { + struct dirent *dp; + + dp = (struct dirent *) ddptr; + if ((long)dp & 03L) + break; + if ((dp->d_reclen <= 0) || + (dp->d_reclen > (ddeptr + 1 - ddptr))) + break; + ddptr += dp->d_reclen; + if (dp->d_fileno) { + if (dpv) + dpv[n] = dp; + n++; + } + } + + if (dpv) { + struct dirent *xp; + + /* + * This sort must be stable. + */ + mergesort(dpv, n, sizeof(*dpv), opendir_compar); + + dpv[n] = NULL; + xp = NULL; + + /* + * Scan through the buffer in sort order, + * zapping the inode number of any + * duplicate names. + */ + for (n = 0; dpv[n]; n++) { + struct dirent *dp = dpv[n]; + + if ((xp == NULL) || + strcmp(dp->d_name, xp->d_name)) { + xp = dp; + } else { + dp->d_fileno = 0; + } + if (dp->d_type == DT_WHT && + (dirp->dd_flags & DTF_HIDEW)) + dp->d_fileno = 0; + } + + free(dpv); + break; + } else { + dpv = malloc((n+1) * sizeof(struct dirent *)); + if (dpv == NULL) + break; + } + } + + dirp->dd_len = len; + dirp->dd_size = ddptr - dirp->dd_buf; + return (true); +} + + +/* * Common routine for opendir(3), __opendir2(3) and fdopendir(3). */ static DIR * -__opendir_common(int fd, int flags) +__opendir_common(int fd, int flags, bool use_current_pos) { DIR *dirp; int incr; int saved_errno; int unionstack; - int fd2; - - fd2 = -1; if ((dirp = malloc(sizeof(DIR) + sizeof(struct _telldir))) == NULL) return (NULL); + dirp->dd_buf = NULL; + dirp->dd_fd = fd; + dirp->dd_flags = flags; + dirp->dd_loc = 0; + dirp->dd_lock = NULL; dirp->dd_td = (struct _telldir *)((char *)dirp + sizeof(DIR)); LIST_INIT(&dirp->dd_td->td_locq); dirp->dd_td->td_loccnt = 0; @@ -154,163 +321,39 @@ __opendir_common(int fd, int flags) } if (unionstack) { - int len = 0; - int space = 0; - char *buf = 0; - char *ddptr = 0; - char *ddeptr; - int n; - struct dirent **dpv; - - /* - * The strategy here is to read all the directory - * entries into a buffer, sort the buffer, and - * remove duplicate entries by setting the inode - * number to zero. - * - * We reopen the directory because _getdirentries() - * on a MNT_UNION mount modifies the open directory, - * making it refer to the lower directory after the - * upper directory's entries are exhausted. - * This would otherwise break software that uses - * the directory descriptor for fchdir or *at - * functions, such as fts.c. - */ - if ((fd2 = _openat(fd, ".", O_RDONLY | O_CLOEXEC)) == -1) { - saved_errno = errno; - free(buf); - free(dirp); - errno = saved_errno; - return (NULL); - } - - do { - /* - * Always make at least DIRBLKSIZ bytes - * available to _getdirentries - */ - if (space < DIRBLKSIZ) { - space += incr; - len += incr; - buf = reallocf(buf, len); - if (buf == NULL) - goto fail; - ddptr = buf + (len - space); - } - - n = _getdirentries(fd2, ddptr, space, &dirp->dd_seek); - if (n > 0) { - ddptr += n; - space -= n; - } - } while (n > 0); - - ddeptr = ddptr; - flags |= __DTF_READALL; - - _close(fd2); - fd2 = -1; - - /* - * There is now a buffer full of (possibly) duplicate - * names. - */ - dirp->dd_buf = buf; - - /* - * Go round this loop twice... - * - * Scan through the buffer, counting entries. - * On the second pass, save pointers to each one. - * Then sort the pointers and remove duplicate names. - */ - for (dpv = 0;;) { - n = 0; - ddptr = buf; - while (ddptr < ddeptr) { - struct dirent *dp; - - dp = (struct dirent *) ddptr; - if ((long)dp & 03L) - break; - if ((dp->d_reclen <= 0) || - (dp->d_reclen > (ddeptr + 1 - ddptr))) - break; - ddptr += dp->d_reclen; - if (dp->d_fileno) { - if (dpv) - dpv[n] = dp; - n++; - } - } - - if (dpv) { - struct dirent *xp; - - /* - * This sort must be stable. - */ - mergesort(dpv, n, sizeof(*dpv), - opendir_compar); - - dpv[n] = NULL; - xp = NULL; - - /* - * Scan through the buffer in sort order, - * zapping the inode number of any - * duplicate names. - */ - for (n = 0; dpv[n]; n++) { - struct dirent *dp = dpv[n]; - - if ((xp == NULL) || - strcmp(dp->d_name, xp->d_name)) { - xp = dp; - } else { - dp->d_fileno = 0; - } - if (dp->d_type == DT_WHT && - (flags & DTF_HIDEW)) - dp->d_fileno = 0; - } - - free(dpv); - break; - } else { - dpv = malloc((n+1) * sizeof(struct dirent *)); - if (dpv == NULL) - break; - } - } - - dirp->dd_len = len; - dirp->dd_size = ddptr - dirp->dd_buf; + if (!_filldir(dirp, use_current_pos)) + goto fail; + dirp->dd_flags |= __DTF_READALL; } else { dirp->dd_len = incr; - dirp->dd_size = 0; dirp->dd_buf = malloc(dirp->dd_len); if (dirp->dd_buf == NULL) goto fail; - dirp->dd_seek = 0; + if (use_current_pos) { + /* + * Read the first batch of directory entries + * to prime dd_seek. This also checks if the + * fd passed to fdopendir() is a directory. + */ + dirp->dd_size = _getdirentries(dirp->dd_fd, + dirp->dd_buf, dirp->dd_len, &dirp->dd_seek); + if (dirp->dd_size < 0) { + if (errno == EINVAL) + errno = ENOTDIR; + goto fail; + } + dirp->dd_flags |= __DTF_SKIPREAD; + } else { + dirp->dd_size = 0; + dirp->dd_seek = 0; + } } - dirp->dd_loc = 0; - dirp->dd_fd = fd; - dirp->dd_flags = flags; - dirp->dd_lock = NULL; - - /* - * Set up seek point for rewinddir. - */ - dirp->dd_rewind = telldir(dirp); - return (dirp); fail: saved_errno = errno; - if (fd2 != -1) - _close(fd2); + free(dirp->dd_buf); free(dirp); errno = saved_errno; return (NULL); Modified: stable/10/lib/libc/gen/readdir.c ============================================================================== --- stable/10/lib/libc/gen/readdir.c Thu Aug 14 20:17:23 2014 (r270001) +++ stable/10/lib/libc/gen/readdir.c Thu Aug 14 20:20:21 2014 (r270002) @@ -61,12 +61,14 @@ _readdir_unlocked(dirp, skip) return (NULL); dirp->dd_loc = 0; } - if (dirp->dd_loc == 0 && !(dirp->dd_flags & __DTF_READALL)) { + if (dirp->dd_loc == 0 && + !(dirp->dd_flags & (__DTF_READALL | __DTF_SKIPREAD))) { dirp->dd_size = _getdirentries(dirp->dd_fd, dirp->dd_buf, dirp->dd_len, &dirp->dd_seek); if (dirp->dd_size <= 0) return (NULL); } + dirp->dd_flags &= ~__DTF_SKIPREAD; dp = (struct dirent *)(dirp->dd_buf + dirp->dd_loc); if ((long)dp & 03L) /* bogus pointer check */ return (NULL); Modified: stable/10/lib/libc/gen/rewinddir.c ============================================================================== --- stable/10/lib/libc/gen/rewinddir.c Thu Aug 14 20:17:23 2014 (r270001) +++ stable/10/lib/libc/gen/rewinddir.c Thu Aug 14 20:20:21 2014 (r270002) @@ -33,9 +33,14 @@ static char sccsid[] = "@(#)rewinddir.c #include __FBSDID("$FreeBSD$"); +#include "namespace.h" #include #include +#include +#include +#include "un-namespace.h" +#include "libc_private.h" #include "gen-private.h" #include "telldir.h" @@ -44,6 +49,16 @@ rewinddir(dirp) DIR *dirp; { - _seekdir(dirp, dirp->dd_rewind); - dirp->dd_rewind = telldir(dirp); + if (__isthreaded) + _pthread_mutex_lock(&dirp->dd_lock); + if (dirp->dd_flags & __DTF_READALL) + _filldir(dirp, false); + else if (dirp->dd_seek != 0) { + (void) lseek(dirp->dd_fd, 0, SEEK_SET); + dirp->dd_seek = 0; + } + dirp->dd_loc = 0; + _reclaim_telldir(dirp); + if (__isthreaded) + _pthread_mutex_unlock(&dirp->dd_lock); } Modified: stable/10/lib/libc/gen/telldir.c ============================================================================== --- stable/10/lib/libc/gen/telldir.c Thu Aug 14 20:17:23 2014 (r270001) +++ stable/10/lib/libc/gen/telldir.c Thu Aug 14 20:20:21 2014 (r270002) @@ -47,13 +47,6 @@ __FBSDID("$FreeBSD$"); #include "telldir.h" /* - * The option SINGLEUSE may be defined to say that a telldir - * cookie may be used only once before it is freed. This option - * is used to avoid having memory usage grow without bound. - */ -#define SINGLEUSE - -/* * return a pointer into a directory */ long @@ -61,18 +54,31 @@ telldir(dirp) DIR *dirp; { struct ddloc *lp; + long idx; - if ((lp = (struct ddloc *)malloc(sizeof(struct ddloc))) == NULL) - return (-1); if (__isthreaded) _pthread_mutex_lock(&dirp->dd_lock); - lp->loc_index = dirp->dd_td->td_loccnt++; - lp->loc_seek = dirp->dd_seek; - lp->loc_loc = dirp->dd_loc; - LIST_INSERT_HEAD(&dirp->dd_td->td_locq, lp, loc_lqe); + LIST_FOREACH(lp, &dirp->dd_td->td_locq, loc_lqe) { + if (lp->loc_seek == dirp->dd_seek && + lp->loc_loc == dirp->dd_loc) + break; + } + if (lp == NULL) { + lp = malloc(sizeof(struct ddloc)); + if (lp == NULL) { + if (__isthreaded) + _pthread_mutex_unlock(&dirp->dd_lock); + return (-1); + } + lp->loc_index = dirp->dd_td->td_loccnt++; + lp->loc_seek = dirp->dd_seek; + lp->loc_loc = dirp->dd_loc; + LIST_INSERT_HEAD(&dirp->dd_td->td_locq, lp, loc_lqe); + } + idx = lp->loc_index; if (__isthreaded) _pthread_mutex_unlock(&dirp->dd_lock); - return (lp->loc_index); + return (idx); } /* @@ -94,7 +100,7 @@ _seekdir(dirp, loc) if (lp == NULL) return; if (lp->loc_loc == dirp->dd_loc && lp->loc_seek == dirp->dd_seek) - goto found; + return; (void) lseek(dirp->dd_fd, (off_t)lp->loc_seek, SEEK_SET); dirp->dd_seek = lp->loc_seek; dirp->dd_loc = 0; @@ -103,11 +109,6 @@ _seekdir(dirp, loc) if (dp == NULL) break; } -found: -#ifdef SINGLEUSE - LIST_REMOVE(lp, loc_lqe); - free((caddr_t)lp); -#endif } /* Modified: stable/10/lib/libc/gen/telldir.h ============================================================================== --- stable/10/lib/libc/gen/telldir.h Thu Aug 14 20:17:23 2014 (r270001) +++ stable/10/lib/libc/gen/telldir.h Thu Aug 14 20:20:21 2014 (r270002) @@ -36,6 +36,7 @@ #define _TELLDIR_H_ #include +#include /* * One of these structures is malloced to describe the current directory @@ -59,6 +60,7 @@ struct _telldir { long td_loccnt; /* index of entry for sequential readdir's */ }; +bool _filldir(DIR *, bool); struct dirent *_readdir_unlocked(DIR *, int); void _reclaim_telldir(DIR *); void _seekdir(DIR *, long); From owner-svn-src-stable-10@FreeBSD.ORG Thu Aug 14 23:38:05 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 232FE1C2; Thu, 14 Aug 2014 23:38:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0E42B2140; Thu, 14 Aug 2014 23:38:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7ENc4Ag078343; Thu, 14 Aug 2014 23:38:04 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7ENc4kx078342; Thu, 14 Aug 2014 23:38:04 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201408142338.s7ENc4kx078342@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Thu, 14 Aug 2014 23:38:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270007 - stable/10/sys/ufs/ffs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Aug 2014 23:38:05 -0000 Author: mckusick Date: Thu Aug 14 23:38:04 2014 New Revision: 270007 URL: http://svnweb.freebsd.org/changeset/base/270007 Log: MFC of 269674: The journal is only prepared to handle full-size block numbers, so we have to adjust freeblk records to reflect the change to a full-size block. For example, suppose we have a block made up of fragments 8-15 and want to free its last two fragments. We are given a request that says: FREEBLK ino=5, blkno=14, lbn=0, frags=2, oldfrags=0 where frags are the number of frags to free and oldfrags are the number of fragments to keep. To block align it, we have to change it to have a valid full-size blkno, so it becomes: FREEBLK ino=5, blkno=8, lbn=0, frags=2, oldfrags=6 Submitted by: Mikihito Takehara Tested by: Mikihito Takehara Reviewed by: Jeff Roberson Modified: stable/10/sys/ufs/ffs/ffs_softdep.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- stable/10/sys/ufs/ffs/ffs_softdep.c Thu Aug 14 23:17:33 2014 (r270006) +++ stable/10/sys/ufs/ffs/ffs_softdep.c Thu Aug 14 23:38:04 2014 (r270007) @@ -931,6 +931,7 @@ static inline struct jsegdep *inoref_jse static struct jmvref *newjmvref(struct inode *, ino_t, off_t, off_t); static struct jfreeblk *newjfreeblk(struct freeblks *, ufs_lbn_t, ufs2_daddr_t, int); +static void adjust_newfreework(struct freeblks *, int); static struct jtrunc *newjtrunc(struct freeblks *, off_t, int); static void move_newblock_dep(struct jaddref *, struct inodedep *); static void cancel_jfreeblk(struct freeblks *, ufs2_daddr_t); @@ -4066,6 +4067,33 @@ newjfreeblk(freeblks, lbn, blkno, frags) } /* + * The journal is only prepared to handle full-size block numbers, so we + * have to adjust the record to reflect the change to a full-size block. + * For example, suppose we have a block made up of fragments 8-15 and + * want to free its last two fragments. We are given a request that says: + * FREEBLK ino=5, blkno=14, lbn=0, frags=2, oldfrags=0 + * where frags are the number of fragments to free and oldfrags are the + * number of fragments to keep. To block align it, we have to change it to + * have a valid full-size blkno, so it becomes: + * FREEBLK ino=5, blkno=8, lbn=0, frags=2, oldfrags=6 + */ +static void +adjust_newfreework(freeblks, frag_offset) + struct freeblks *freeblks; + int frag_offset; +{ + struct jfreeblk *jfreeblk; + + KASSERT((LIST_FIRST(&freeblks->fb_jblkdephd) != NULL && + LIST_FIRST(&freeblks->fb_jblkdephd)->jb_list.wk_type == D_JFREEBLK), + ("adjust_newfreework: Missing freeblks dependency")); + + jfreeblk = WK_JFREEBLK(LIST_FIRST(&freeblks->fb_jblkdephd)); + jfreeblk->jf_blkno -= frag_offset; + jfreeblk->jf_frags += frag_offset; +} + +/* * Allocate a new jtrunc to track a partial truncation. */ static struct jtrunc * @@ -6432,6 +6460,9 @@ softdep_journal_freeblocks(ip, cred, len blkno += numfrags(ip->i_fs, frags); newfreework(ump, freeblks, NULL, lastlbn, blkno, oldfrags, 0, needj); + if (needj) + adjust_newfreework(freeblks, + numfrags(ip->i_fs, frags)); } else if (blkno == 0) allocblock = 1; } From owner-svn-src-stable-10@FreeBSD.ORG Fri Aug 15 03:52:41 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3A380CF4; Fri, 15 Aug 2014 03:52:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 25A982D2D; Fri, 15 Aug 2014 03:52:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7F3qfDK001168; Fri, 15 Aug 2014 03:52:41 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7F3qfvi001167; Fri, 15 Aug 2014 03:52:41 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201408150352.s7F3qfvi001167@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 15 Aug 2014 03:52:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270009 - in stable: 10/sbin/ifconfig 9/sbin/ifconfig X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Aug 2014 03:52:41 -0000 Author: gjb Date: Fri Aug 15 03:52:40 2014 New Revision: 270009 URL: http://svnweb.freebsd.org/changeset/base/270009 Log: MFC r269888: Fix a typo in a comment: s/interprete/interpret/ Sponsored by: The FreeBSD Foundation Modified: stable/10/sbin/ifconfig/ifconfig.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/9/sbin/ifconfig/ifconfig.c Directory Properties: stable/9/sbin/ifconfig/ (props changed) Modified: stable/10/sbin/ifconfig/ifconfig.c ============================================================================== --- stable/10/sbin/ifconfig/ifconfig.c Fri Aug 15 02:43:02 2014 (r270008) +++ stable/10/sbin/ifconfig/ifconfig.c Fri Aug 15 03:52:40 2014 (r270009) @@ -78,7 +78,7 @@ static const char rcsid[] = /* * Since "struct ifreq" is composed of various union members, callers - * should pay special attention to interprete the value. + * should pay special attention to interpret the value. * (.e.g. little/big endian difference in the structure.) */ struct ifreq ifr; From owner-svn-src-stable-10@FreeBSD.ORG Fri Aug 15 19:07:00 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 87F768F7; Fri, 15 Aug 2014 19:07:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 727512C79; Fri, 15 Aug 2014 19:07:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7FJ70pI031747; Fri, 15 Aug 2014 19:07:00 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7FJ6xlE031737; Fri, 15 Aug 2014 19:06:59 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201408151906.s7FJ6xlE031737@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 15 Aug 2014 19:06:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270026 - in stable/10/contrib/nvi: cl common X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Aug 2014 19:07:00 -0000 Author: emaste Date: Fri Aug 15 19:06:59 2014 New Revision: 270026 URL: http://svnweb.freebsd.org/changeset/base/270026 Log: MFC r259088: Vendor import nvi-2.1.2-c80f493b038 a multikey mapping fix PR: bin/182463 Modified: stable/10/contrib/nvi/cl/cl_term.c stable/10/contrib/nvi/common/key.c stable/10/contrib/nvi/common/key.h Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/nvi/cl/cl_term.c ============================================================================== --- stable/10/contrib/nvi/cl/cl_term.c Fri Aug 15 16:08:52 2014 (r270025) +++ stable/10/contrib/nvi/cl/cl_term.c Fri Aug 15 19:06:59 2014 (r270026) @@ -10,7 +10,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "$Id: cl_term.c,v 10.33 2012/04/21 23:51:46 zy Exp $"; +static const char sccsid[] = "$Id: cl_term.c,v 10.34 2013/12/07 16:21:14 wjenkner Exp $"; #endif /* not lint */ #include @@ -187,14 +187,18 @@ cl_term_init(SCR *sp) int cl_term_end(GS *gp) { - SEQ *qp, *nqp; + SEQ *qp, *nqp, *pre_qp = NULL; /* Delete screen specific mappings. */ SLIST_FOREACH_SAFE(qp, gp->seqq, q, nqp) if (F_ISSET(qp, SEQ_SCREEN)) { - SLIST_REMOVE_HEAD(gp->seqq, q); + if (qp == SLIST_FIRST(gp->seqq)) + SLIST_REMOVE_HEAD(gp->seqq, q); + else + SLIST_REMOVE_AFTER(pre_qp, q); (void)seq_free(qp); - } + } else + pre_qp = qp; return (0); } Modified: stable/10/contrib/nvi/common/key.c ============================================================================== --- stable/10/contrib/nvi/common/key.c Fri Aug 15 16:08:52 2014 (r270025) +++ stable/10/contrib/nvi/common/key.c Fri Aug 15 19:06:59 2014 (r270026) @@ -10,7 +10,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "$Id: key.c,v 10.53 2013/03/11 01:20:53 yamt Exp $"; +static const char sccsid[] = "$Id: key.c,v 10.54 2013/11/13 12:15:27 zy Exp $"; #endif /* not lint */ #include @@ -272,7 +272,7 @@ v_key_name( * The code prints non-printable wide characters in 4 or 5 digits * Unicode escape sequences, so only supports plane 0 to 15. */ - if (ISPRINT(ach)) + if (CAN_PRINT(sp, ach)) goto done; nopr: if (iscntrl(ch) && (ch < 0x20 || ch == 0x7f)) { sp->cname[0] = '^'; Modified: stable/10/contrib/nvi/common/key.h ============================================================================== --- stable/10/contrib/nvi/common/key.h Fri Aug 15 16:08:52 2014 (r270025) +++ stable/10/contrib/nvi/common/key.h Fri Aug 15 19:06:59 2014 (r270026) @@ -6,7 +6,7 @@ * * See the LICENSE file for redistribution information. * - * $Id: key.h,v 10.55 2012/10/07 01:31:17 zy Exp $ + * $Id: key.h,v 10.56 2013/11/13 12:15:27 zy Exp $ */ #include "multibyte.h" @@ -23,8 +23,9 @@ #define INPUT2INT5(sp,cw,n,nlen,w,wlen) \ sp->conv.input2int(sp, n, nlen, &(cw), &wlen, &w) #define CONST +#define INTISWIDE(c) (wctob(c) == EOF) #define CHAR_WIDTH(sp, ch) wcwidth(ch) -#define INTISWIDE(c) (wctob(c) == EOF) +#define CAN_PRINT(sp, ch) (CHAR_WIDTH(sp, ch) > 0) #else #define FILE2INT5(sp,buf,n,nlen,w,wlen) \ (w = n, wlen = nlen, 0) @@ -36,9 +37,10 @@ (n = w, nlen = wlen, 0) #define INPUT2INT5(sp,buf,n,nlen,w,wlen) \ (w = n, wlen = nlen, 0) -#define CONST const -#define INTISWIDE(c) 0 +#define CONST const +#define INTISWIDE(c) 0 #define CHAR_WIDTH(sp, ch) 1 +#define CAN_PRINT(sp, ch) isprint(ch) #endif #define FILE2INT(sp,n,nlen,w,wlen) \ FILE2INT5(sp,sp->cw,n,nlen,w,wlen) From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 00:52:14 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 328F6266; Sat, 16 Aug 2014 00:52:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D01E22C9; Sat, 16 Aug 2014 00:52:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7G0qDom009536; Sat, 16 Aug 2014 00:52:13 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7G0qDhT009535; Sat, 16 Aug 2014 00:52:13 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201408160052.s7G0qDhT009535@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 16 Aug 2014 00:52:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270030 - stable/10/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 00:52:14 -0000 Author: pfg Date: Sat Aug 16 00:52:13 2014 New Revision: 270030 URL: http://svnweb.freebsd.org/changeset/base/270030 Log: MFC r267875: 4251 libdtrace leaks open file handles Illumos commit: 93ed8d0d4b068b95d0bb50d57bb854df462a8485 (partial) Reference: https://www.illumos.org/issues/4251 Discussed with: Robert Mustacchi Obtained from: Illumos Modified: stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c Fri Aug 15 22:36:41 2014 (r270029) +++ stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c Sat Aug 16 00:52:13 2014 (r270030) @@ -2289,12 +2289,15 @@ dt_load_libs_dir(dtrace_hdl_t *dtp, cons dt_dprintf("skipping library %s, already processed " "library with the same name: %s", dp->d_name, dld->dtld_library); + (void) fclose(fp); continue; } dtp->dt_filetag = fname; - if (dt_lib_depend_add(dtp, &dtp->dt_lib_dep, fname) != 0) + if (dt_lib_depend_add(dtp, &dtp->dt_lib_dep, fname) != 0) { + (void) fclose(fp); return (-1); /* preserve dt_errno */ + } rv = dt_compile(dtp, DT_CTX_DPROG, DTRACE_PROBESPEC_NAME, NULL, @@ -2302,8 +2305,10 @@ dt_load_libs_dir(dtrace_hdl_t *dtp, cons if (rv != NULL && dtp->dt_errno && (dtp->dt_errno != EDT_COMPILER || - dtp->dt_errtag != dt_errtag(D_PRAGMA_DEPEND))) + dtp->dt_errtag != dt_errtag(D_PRAGMA_DEPEND))) { + (void) fclose(fp); return (-1); /* preserve dt_errno */ + } if (dtp->dt_errno) dt_dprintf("error parsing library %s: %s\n", From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 00:54:56 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D2A343A4; Sat, 16 Aug 2014 00:54:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A320522D4; Sat, 16 Aug 2014 00:54:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7G0suDA009902; Sat, 16 Aug 2014 00:54:56 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7G0su2P009901; Sat, 16 Aug 2014 00:54:56 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201408160054.s7G0su2P009901@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 16 Aug 2014 00:54:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270031 - stable/10/lib/libutil X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 00:54:56 -0000 Author: pfg Date: Sat Aug 16 00:54:56 2014 New Revision: 270031 URL: http://svnweb.freebsd.org/changeset/base/270031 Log: MFC r269015: fparseln(3): Update from NetBSD sources. -fix a condition so that fparseln() doesn't report spurious empty lines eg after 2 comment lines, or on EOF after a single comment line -no escape character means no escaped characters modify the previous fix so that no pointless realloc()s are done in the case of multiple empty continuation lines, and comment the code to make the logics obvious. fparseln is now part of libc in NetBSD so this changes the previous revision numbering. Obtained from: NetBSD (CVS Rev. 1.6-1.7) Modified: stable/10/lib/libutil/fparseln.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libutil/fparseln.c ============================================================================== --- stable/10/lib/libutil/fparseln.c Sat Aug 16 00:52:13 2014 (r270030) +++ stable/10/lib/libutil/fparseln.c Sat Aug 16 00:54:56 2014 (r270031) @@ -1,4 +1,4 @@ -/* $NetBSD: fparseln.c,v 1.9 1999/09/20 04:48:06 lukem Exp $ */ +/* $NetBSD: fparseln.c,v 1.7 2007/03/08 19:57:53 drochner Exp $ */ /* * Copyright (c) 1997 Christos Zoulas. All rights reserved. @@ -59,7 +59,7 @@ isescaped(const char *sp, const char *p, /* No escape character */ if (esc == '\0') - return 1; + return 0; /* Count the number of escape characters that precede ours */ for (ne = 0, cp = p; --cp >= sp && *cp == esc; ne++) @@ -135,13 +135,19 @@ fparseln(FILE *fp, size_t *size, size_t cp = &ptr[s - 1]; if (*cp == con && !isescaped(ptr, cp, esc)) { - s--; /* forget escape */ + s--; /* forget continuation char */ cnt = 1; } } - if (s == 0 && buf != NULL) - continue; + if (s == 0) { + /* + * nothing to add, skip realloc except in case + * we need a minimal buf to return an empty line + */ + if (cnt || buf != NULL) + continue; + } if ((cp = realloc(buf, len + s + 1)) == NULL) { free(buf); From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 01:00:38 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7F13E551; Sat, 16 Aug 2014 01:00:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6AA7A2405; Sat, 16 Aug 2014 01:00:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7G10c5L012815; Sat, 16 Aug 2014 01:00:38 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7G10cHo012814; Sat, 16 Aug 2014 01:00:38 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201408160100.s7G10cHo012814@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 16 Aug 2014 01:00:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270032 - stable/10/lib/libc/net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 01:00:38 -0000 Author: pfg Date: Sat Aug 16 01:00:37 2014 New Revision: 270032 URL: http://svnweb.freebsd.org/changeset/base/270032 Log: MFC r269695: Const-ify character string Obtained from: Apple Inc. (Libc 997.90.3) MFC after: 3 days Modified: stable/10/lib/libc/net/linkaddr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/net/linkaddr.c ============================================================================== --- stable/10/lib/libc/net/linkaddr.c Sat Aug 16 00:54:56 2014 (r270031) +++ stable/10/lib/libc/net/linkaddr.c Sat Aug 16 01:00:37 2014 (r270032) @@ -118,7 +118,7 @@ link_addr(addr, sdl) return; } -static char hexlist[] = "0123456789abcdef"; +static const char hexlist[] = "0123456789abcdef"; char * link_ntoa(sdl) From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 01:03:51 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C154173C; Sat, 16 Aug 2014 01:03:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AC65B24A8; Sat, 16 Aug 2014 01:03:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7G13pOs014384; Sat, 16 Aug 2014 01:03:51 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7G13pWh014383; Sat, 16 Aug 2014 01:03:51 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201408160103.s7G13pWh014383@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 16 Aug 2014 01:03:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270033 - stable/10/lib/libc/stdlib X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 01:03:51 -0000 Author: pfg Date: Sat Aug 16 01:03:51 2014 New Revision: 270033 URL: http://svnweb.freebsd.org/changeset/base/270033 Log: MFC r269901: Minor style tweaks. Obtained from: OpenBSD (CVS rev. 1.7) Modified: stable/10/lib/libc/stdlib/strtonum.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/stdlib/strtonum.c ============================================================================== --- stable/10/lib/libc/stdlib/strtonum.c Sat Aug 16 01:00:37 2014 (r270032) +++ stable/10/lib/libc/stdlib/strtonum.c Sat Aug 16 01:03:51 2014 (r270033) @@ -14,7 +14,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: strtonum.c,v 1.6 2004/08/03 19:38:01 millert Exp $ + * $OpenBSD: strtonum.c,v 1.7 2013/04/17 18:40:58 tedu Exp $ */ #include @@ -24,17 +24,17 @@ __FBSDID("$FreeBSD$"); #include #include -#define INVALID 1 -#define TOOSMALL 2 -#define TOOLARGE 3 +#define INVALID 1 +#define TOOSMALL 2 +#define TOOLARGE 3 long long strtonum(const char *numstr, long long minval, long long maxval, const char **errstrp) { long long ll = 0; - char *ep; int error = 0; + char *ep; struct errval { const char *errstr; int err; @@ -47,9 +47,9 @@ strtonum(const char *numstr, long long m ev[0].err = errno; errno = 0; - if (minval > maxval) + if (minval > maxval) { error = INVALID; - else { + } else { ll = strtoll(numstr, &ep, 10); if (errno == EINVAL || numstr == ep || *ep != '\0') error = INVALID; From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 01:06:23 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D64A3896; Sat, 16 Aug 2014 01:06:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C143824BE; Sat, 16 Aug 2014 01:06:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7G16NPk014778; Sat, 16 Aug 2014 01:06:23 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7G16NJ2014777; Sat, 16 Aug 2014 01:06:23 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201408160106.s7G16NJ2014777@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 16 Aug 2014 01:06:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270034 - stable/10/sbin/newfs_msdos X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 01:06:24 -0000 Author: pfg Date: Sat Aug 16 01:06:23 2014 New Revision: 270034 URL: http://svnweb.freebsd.org/changeset/base/270034 Log: MFC r269953: Use "NO NAME" as the default unnamed label. Microsoft recommends avoiding the use of spaces in the string structures for FAT. Unfortunately they do just that by default in the case of unlabeled filesystems. Follow the default MS behavior to avoid confusion in common tools like file(1). This was actually the default behavior before r203868. Obtained from: NetBSD (CVS rev. 1.39) Modified: stable/10/sbin/newfs_msdos/newfs_msdos.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/newfs_msdos/newfs_msdos.c ============================================================================== --- stable/10/sbin/newfs_msdos/newfs_msdos.c Sat Aug 16 01:03:51 2014 (r270033) +++ stable/10/sbin/newfs_msdos/newfs_msdos.c Sat Aug 16 01:06:23 2014 (r270034) @@ -689,7 +689,7 @@ main(int argc, char *argv[]) ((u_int)tm->tm_hour << 8 | (u_int)tm->tm_min)); mk4(bsx->exVolumeID, x); - mklabel(bsx->exVolumeLabel, opt_L ? opt_L : "NO_NAME"); + mklabel(bsx->exVolumeLabel, opt_L ? opt_L : "NO NAME"); sprintf(buf, "FAT%u", fat); setstr(bsx->exFileSysType, buf, sizeof(bsx->exFileSysType)); if (!opt_B) { From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 01:29:50 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 886BFB89; Sat, 16 Aug 2014 01:29:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 58FE1264B; Sat, 16 Aug 2014 01:29:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7G1Togn024014; Sat, 16 Aug 2014 01:29:50 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7G1TojV024013; Sat, 16 Aug 2014 01:29:50 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201408160129.s7G1TojV024013@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 16 Aug 2014 01:29:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270035 - stable/10/lib/libc/stdio X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 01:29:50 -0000 Author: pfg Date: Sat Aug 16 01:29:49 2014 New Revision: 270035 URL: http://svnweb.freebsd.org/changeset/base/270035 Log: MFC r268924: Update fflush(3) to return success on a read-only stream. This is done for compliance with SUSv3. The changes cause no secondary effects in the gnulib tests (we pass them). Obtained from: Apple Inc. (Libc 997.90.3 with changes) Reviewed by: bde Phabric: D440 Modified: stable/10/lib/libc/stdio/fflush.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/stdio/fflush.c ============================================================================== --- stable/10/lib/libc/stdio/fflush.c Sat Aug 16 01:06:23 2014 (r270034) +++ stable/10/lib/libc/stdio/fflush.c Sat Aug 16 01:29:49 2014 (r270035) @@ -60,7 +60,7 @@ fflush(FILE *fp) /* * There is disagreement about the correct behaviour of fflush() - * when passed a file which is not open for reading. According to + * when passed a file which is not open for writing. According to * the ISO C standard, the behaviour is undefined. * Under linux, such an fflush returns success and has no effect; * under Windows, such an fflush is documented as behaving instead @@ -68,11 +68,13 @@ fflush(FILE *fp) * Given that applications may be written with the expectation of * either of these two behaviours, the only safe (non-astonishing) * option is to return EBADF and ask that applications be fixed. + * SUSv3 now requires that fflush() returns success on a read-only + * stream. + * */ - if ((fp->_flags & (__SWR | __SRW)) == 0) { - errno = EBADF; - retval = EOF; - } else + if ((fp->_flags & (__SWR | __SRW)) == 0) + retval = 0; + else retval = __sflush(fp); FUNLOCKFILE(fp); return (retval); @@ -89,10 +91,9 @@ __fflush(FILE *fp) if (fp == NULL) return (_fwalk(sflush_locked)); - if ((fp->_flags & (__SWR | __SRW)) == 0) { - errno = EBADF; - retval = EOF; - } else + if ((fp->_flags & (__SWR | __SRW)) == 0) + retval = 0; + else retval = __sflush(fp); return (retval); } @@ -122,6 +123,12 @@ __sflush(FILE *fp) for (; n > 0; n -= t, p += t) { t = _swrite(fp, (char *)p, n); if (t <= 0) { + /* Reset _p and _w. */ + if (p > fp->_p) /* Some was written. */ + memmove(fp->_p, p, n); + fp->_p += n; + if ((fp->_flags & (__SLBF | __SNBF)) == 0) + fp->_w -= n; fp->_flags |= __SERR; return (EOF); } From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 08:37:13 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ACB36693; Sat, 16 Aug 2014 08:37:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9801E2EB1; Sat, 16 Aug 2014 08:37:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7G8bDYk013540; Sat, 16 Aug 2014 08:37:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7G8bDmw013539; Sat, 16 Aug 2014 08:37:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201408160837.s7G8bDmw013539@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 16 Aug 2014 08:37:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270039 - stable/10/lib/libthr/thread X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 08:37:13 -0000 Author: kib Date: Sat Aug 16 08:37:13 2014 New Revision: 270039 URL: http://svnweb.freebsd.org/changeset/base/270039 Log: MFC r269908: Style. Modified: stable/10/lib/libthr/thread/thr_stack.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libthr/thread/thr_stack.c ============================================================================== --- stable/10/lib/libthr/thread/thr_stack.c Sat Aug 16 08:31:25 2014 (r270038) +++ stable/10/lib/libthr/thread/thr_stack.c Sat Aug 16 08:37:13 2014 (r270039) @@ -268,7 +268,7 @@ _thr_stack_alloc(struct pthread_attr *at /* Map the stack and guard page together, and split guard page from allocated space: */ - if ((stackaddr = mmap(stackaddr, stacksize+guardsize, + if ((stackaddr = mmap(stackaddr, stacksize + guardsize, _rtld_get_stack_prot(), MAP_STACK, -1, 0)) != MAP_FAILED && (guardsize == 0 || From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 08:38:54 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 84B277CD; Sat, 16 Aug 2014 08:38:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 564582EB8; Sat, 16 Aug 2014 08:38:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7G8csXP013854; Sat, 16 Aug 2014 08:38:54 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7G8crTM013850; Sat, 16 Aug 2014 08:38:53 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201408160838.s7G8crTM013850@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 16 Aug 2014 08:38:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270040 - stable/10/lib/libthr/thread X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 08:38:54 -0000 Author: kib Date: Sat Aug 16 08:38:53 2014 New Revision: 270040 URL: http://svnweb.freebsd.org/changeset/base/270040 Log: MFC r269909: Add a knob LIBPTHREAD_BIGSTACK_MAIN, which instructs libthr to leave the whole RLIMIT_STACK-sized region of the kernel-allocated stack as the stack of main thread. Modified: stable/10/lib/libthr/thread/thr_init.c stable/10/lib/libthr/thread/thr_stack.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libthr/thread/thr_init.c ============================================================================== --- stable/10/lib/libthr/thread/thr_init.c Sat Aug 16 08:37:13 2014 (r270039) +++ stable/10/lib/libthr/thread/thr_init.c Sat Aug 16 08:38:53 2014 (r270040) @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -441,6 +442,7 @@ init_main_thread(struct pthread *thread) static void init_private(void) { + struct rlimit rlim; size_t len; int mib[2]; char *env; @@ -471,6 +473,12 @@ init_private(void) len = sizeof (_usrstack); if (sysctl(mib, 2, &_usrstack, &len, NULL, 0) == -1) PANIC("Cannot get kern.usrstack from sysctl"); + env = getenv("LIBPTHREAD_BIGSTACK_MAIN"); + if (env != NULL) { + if (getrlimit(RLIMIT_STACK, &rlim) == -1) + PANIC("Cannot get stack rlimit"); + _thr_stack_initial = rlim.rlim_cur; + } len = sizeof(_thr_is_smp); sysctlbyname("kern.smp.cpus", &_thr_is_smp, &len, NULL, 0); _thr_is_smp = (_thr_is_smp > 1); Modified: stable/10/lib/libthr/thread/thr_stack.c ============================================================================== --- stable/10/lib/libthr/thread/thr_stack.c Sat Aug 16 08:37:13 2014 (r270039) +++ stable/10/lib/libthr/thread/thr_stack.c Sat Aug 16 08:38:53 2014 (r270040) @@ -246,7 +246,10 @@ _thr_stack_alloc(struct pthread_attr *at THREAD_LIST_UNLOCK(curthread); } else { - /* Allocate a stack from usrstack. */ + /* + * Allocate a stack from or below usrstack, depending + * on the LIBPTHREAD_BIGSTACK_MAIN env variable. + */ if (last_stack == NULL) last_stack = _usrstack - _thr_stack_initial - _thr_guard_default; From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 12:59:48 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D5455D2F; Sat, 16 Aug 2014 12:59:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A5FA028BF; Sat, 16 Aug 2014 12:59:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7GCxmi5028778; Sat, 16 Aug 2014 12:59:48 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7GCxmNT028776; Sat, 16 Aug 2014 12:59:48 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201408161259.s7GCxmNT028776@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 16 Aug 2014 12:59:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270042 - in stable/10/sys: kern sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 12:59:49 -0000 Author: bz Date: Sat Aug 16 12:59:47 2014 New Revision: 270042 URL: http://svnweb.freebsd.org/changeset/base/270042 Log: MFC r269669: Split up sys_ktimer_getoverrun() into a sys_ and a kern_ variant and export the kern_ version needed by an upcoming linuxolator change. Sponsored by: DARPA,AFRL Modified: stable/10/sys/kern/kern_time.c stable/10/sys/sys/syscallsubr.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_time.c ============================================================================== --- stable/10/sys/kern/kern_time.c Sat Aug 16 10:47:24 2014 (r270041) +++ stable/10/sys/kern/kern_time.c Sat Aug 16 12:59:47 2014 (r270042) @@ -1361,13 +1361,20 @@ struct timer_getoverrun_args { int sys_ktimer_getoverrun(struct thread *td, struct ktimer_getoverrun_args *uap) { + + return (kern_ktimer_getoverrun(td, uap->timerid)); +} + +int +kern_ktimer_getoverrun(struct thread *td, int timer_id) +{ struct proc *p = td->td_proc; struct itimer *it; int error ; PROC_LOCK(p); - if (uap->timerid < 3 || - (it = itimer_find(p, uap->timerid)) == NULL) { + if (timer_id < 3 || + (it = itimer_find(p, timer_id)) == NULL) { PROC_UNLOCK(p); error = EINVAL; } else { Modified: stable/10/sys/sys/syscallsubr.h ============================================================================== --- stable/10/sys/sys/syscallsubr.h Sat Aug 16 10:47:24 2014 (r270041) +++ stable/10/sys/sys/syscallsubr.h Sat Aug 16 12:59:47 2014 (r270042) @@ -239,6 +239,7 @@ int kern_ktimer_settime(struct thread *t struct itimerspec *val, struct itimerspec *oval); int kern_ktimer_gettime(struct thread *td, int timer_id, struct itimerspec *val); +int kern_ktimer_getoverrun(struct thread *td, int timer_id); int kern_thr_new(struct thread *td, struct thr_param *param); int kern_thr_suspend(struct thread *td, struct timespec *tsp); int kern_truncate(struct thread *td, char *path, enum uio_seg pathseg, From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 13:06:12 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4E73EF89; Sat, 16 Aug 2014 13:06:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 374702982; Sat, 16 Aug 2014 13:06:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7GD6COb033056; Sat, 16 Aug 2014 13:06:12 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7GD6BlG033054; Sat, 16 Aug 2014 13:06:11 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201408161306.s7GD6BlG033054@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 16 Aug 2014 13:06:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270043 - stable/10/sbin/mount_nfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 13:06:12 -0000 Author: bz Date: Sat Aug 16 13:06:11 2014 New Revision: 270043 URL: http://svnweb.freebsd.org/changeset/base/270043 Log: MFC r269583: Provide -o vers= support for mount_nfs. Our mount_nfs does use -o nfsv<2|3|4> or -2 or -3 to specify the version. OSX (these days), Solaris, and Linux use -o vers=<2,3,4>. With the upcoming autofs support we can make a lot of (entrerprisy) setups getting mount options from LDAP just work by providing -o vers= compatibility. Reviewed by: wblock, bjk (man page), rmacklem, emaste Sponsored by: DARPA,AFRL PR: 192379 Modified: stable/10/sbin/mount_nfs/mount_nfs.8 stable/10/sbin/mount_nfs/mount_nfs.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/mount_nfs/mount_nfs.8 ============================================================================== --- stable/10/sbin/mount_nfs/mount_nfs.8 Sat Aug 16 12:59:47 2014 (r270042) +++ stable/10/sbin/mount_nfs/mount_nfs.8 Sat Aug 16 13:06:11 2014 (r270043) @@ -28,7 +28,7 @@ .\" @(#)mount_nfs.8 8.3 (Berkeley) 3/29/95 .\" $FreeBSD$ .\" -.Dd December 7, 2013 +.Dd August 5, 2014 .Dt MOUNT_NFS 8 .Os .Sh NAME @@ -371,6 +371,14 @@ tune the timeout interval.) .It Cm udp Use UDP transport. +.It Cm vers Ns = Ns Aq Ar vers_number +Use the specified version number for NFS requests. +See the +.Cm nfsv2 , +.Cm nfsv3 , +and +.Cm nfsv4 +options for details. .It Cm wcommitsize Ns = Ns Aq Ar value Set the maximum pending write commit size to the specified value. This determines the maximum amount of pending write data that the NFS @@ -466,6 +474,26 @@ Same as Same as .Fl o Cm retrans Ns = Ns Aq Ar value .El +.Pp +The following +.Fl o +named options are equivalent to other +.Fl o +named options and are supported for compatibility with other +operating systems (e.g., Linux, Solaris, and OSX) to ease usage of +.Xr autofs 5 +support. +.Bl -tag -width indent +.It Fl o Cm vers Ns = Ns 2 +Same as +.Fl o Cm nfsv2 +.It Fl o Cm vers Ns = Ns 3 +Same as +.Fl o Cm nfsv3 +.It Fl o Cm vers Ns = Ns 4 +Same as +.Fl o Cm nfsv4 +.El .Sh SEE ALSO .Xr nmount 2 , .Xr unmount 2 , Modified: stable/10/sbin/mount_nfs/mount_nfs.c ============================================================================== --- stable/10/sbin/mount_nfs/mount_nfs.c Sat Aug 16 12:59:47 2014 (r270042) +++ stable/10/sbin/mount_nfs/mount_nfs.c Sat Aug 16 13:06:11 2014 (r270043) @@ -310,6 +310,32 @@ main(int argc, char *argv[]) if (*p || num <= 0) errx(1, "illegal maxgroups value -- %s", val); //set_rpc_maxgrouplist(num); + } else if (strcmp(opt, "vers") == 0) { + num = strtol(val, &p, 10); + if (*p || num <= 0) + errx(1, "illegal vers value -- " + "%s", val); + switch (num) { + case 2: + mountmode = V2; + break; + case 3: + mountmode = V3; + build_iovec(&iov, &iovlen, + "nfsv3", NULL, 0); + break; + case 4: + mountmode = V4; + fstype = "nfs"; + nfsproto = IPPROTO_TCP; + if (portspec == NULL) + portspec = "2049"; + break; + default: + errx(1, "illegal nfs version " + "value -- %s", val); + } + pass_flag_to_nmount=0; } if (pass_flag_to_nmount) build_iovec(&iov, &iovlen, opt, val, From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 13:09:40 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C5A97168; Sat, 16 Aug 2014 13:09:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B122729A1; Sat, 16 Aug 2014 13:09:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7GD9eoR033511; Sat, 16 Aug 2014 13:09:40 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7GD9ejb033510; Sat, 16 Aug 2014 13:09:40 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201408161309.s7GD9ejb033510@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 16 Aug 2014 13:09:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270044 - stable/10/sys/netinet6 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 13:09:40 -0000 Author: bz Date: Sat Aug 16 13:09:40 2014 New Revision: 270044 URL: http://svnweb.freebsd.org/changeset/base/270044 Log: MFC r259884: Correct warnings comparing unsigned variables < 0 constantly reported while building kernels. All instances removed are indeed unsigned so the expressions could not be true. Modified: stable/10/sys/netinet6/in6_mcast.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet6/in6_mcast.c ============================================================================== --- stable/10/sys/netinet6/in6_mcast.c Sat Aug 16 13:06:11 2014 (r270043) +++ stable/10/sys/netinet6/in6_mcast.c Sat Aug 16 13:09:40 2014 (r270044) @@ -1849,8 +1849,7 @@ in6p_join_group(struct inpcb *inp, struc if (mreq.ipv6mr_interface == 0) { ifp = in6p_lookup_mcast_ifp(inp, &gsa->sin6); } else { - if (mreq.ipv6mr_interface < 0 || - V_if_index < mreq.ipv6mr_interface) + if (V_if_index < mreq.ipv6mr_interface) return (EADDRNOTAVAIL); ifp = ifnet_byindex(mreq.ipv6mr_interface); } @@ -2194,7 +2193,7 @@ in6p_leave_group(struct inpcb *inp, stru * XXX SCOPE6 lock potentially taken here. */ if (ifindex != 0) { - if (ifindex < 0 || V_if_index < ifindex) + if (V_if_index < ifindex) return (EADDRNOTAVAIL); ifp = ifnet_byindex(ifindex); if (ifp == NULL) @@ -2349,7 +2348,7 @@ in6p_set_multicast_if(struct inpcb *inp, error = sooptcopyin(sopt, &ifindex, sizeof(u_int), sizeof(u_int)); if (error) return (error); - if (ifindex < 0 || V_if_index < ifindex) + if (V_if_index < ifindex) return (EINVAL); ifp = ifnet_byindex(ifindex); From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 13:12:00 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3188C2F3; Sat, 16 Aug 2014 13:12:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1CA552A3A; Sat, 16 Aug 2014 13:12:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7GDBxDh037047; Sat, 16 Aug 2014 13:11:59 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7GDBxkg037046; Sat, 16 Aug 2014 13:11:59 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201408161311.s7GDBxkg037046@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 16 Aug 2014 13:11:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270045 - stable/10/sys/security/mac X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 13:12:00 -0000 Author: bz Date: Sat Aug 16 13:11:59 2014 New Revision: 270045 URL: http://svnweb.freebsd.org/changeset/base/270045 Log: MFC r259885: As constantly reported during kernel compilation, m_buflen is unsigned so can never be < 0. Remove the expression, which can never be true. Modified: stable/10/sys/security/mac/mac_framework.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/security/mac/mac_framework.c ============================================================================== --- stable/10/sys/security/mac/mac_framework.c Sat Aug 16 13:09:40 2014 (r270044) +++ stable/10/sys/security/mac/mac_framework.c Sat Aug 16 13:11:59 2014 (r270045) @@ -587,8 +587,7 @@ int mac_check_structmac_consistent(struct mac *mac) { - if (mac->m_buflen < 0 || - mac->m_buflen > MAC_MAX_LABEL_BUF_LEN) + if (mac->m_buflen > MAC_MAX_LABEL_BUF_LEN) return (EINVAL); return (0); From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 13:18:14 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 963645EB; Sat, 16 Aug 2014 13:18:14 +0000 (UTC) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id CAA042A7A; Sat, 16 Aug 2014 13:18:13 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 5E25D25D3815; Sat, 16 Aug 2014 13:18:10 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 45E36C27A08; Sat, 16 Aug 2014 13:18:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id wH-MLDfwvxV9; Sat, 16 Aug 2014 13:17:58 +0000 (UTC) Received: from [IPv6:fde9:577b:c1a9:4420:cabc:c8ff:fe8b:4fe6] (unknown [IPv6:fde9:577b:c1a9:4420:cabc:c8ff:fe8b:4fe6]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id C965FC249B9; Sat, 16 Aug 2014 13:17:54 +0000 (UTC) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r265946 - in stable/10: lib/libc/net sys/netinet sys/netinet6 sys/sys From: "Bjoern A. Zeeb" In-Reply-To: <201405130605.s4D65rsn092973@svn.freebsd.org> Date: Sat, 16 Aug 2014 13:17:48 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <13DBB4CD-1A87-4AD9-B1D9-8A709C143C20@FreeBSD.org> References: <201405130605.s4D65rsn092973@svn.freebsd.org> To: Kevin Lo X-Mailer: Apple Mail (2.1878.6) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-10@freebsd.org X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 13:18:14 -0000 On 13 May 2014, at 06:05 , Kevin Lo wrote: > Author: kevlo > Date: Tue May 13 06:05:53 2014 > New Revision: 265946 > URL: http://svnweb.freebsd.org/changeset/base/265946 >=20 > Log: > MFC r264212,r264213,r264248,r265776,r265811,r265909: Just for the records; this commit also merged unrelated r259887: Add more (IPv6) related Internet Protocols: - Host Identity Protocol (RFC5201) - Shim6 Protocol (RFC5533) - 2x experimentation and testing (RFC3692, RFC4727) This does not indicate interest to implement/support these protocols, but they are part of the "IPv6 Extension Header Types" [1] based on = RFC7045 and might thus be needed by filtering and next header parsing implementations. References: [1] http://www.iana.org/assignments/ipv6-parameters Obtained from: http://www.iana.org/assignments/protocol-numbers >=20 > - Add support for UDP-Lite protocol (RFC 3828) to IPv4 and IPv6 = stacks. > Tested with vlc and a test suite [1]. > [1] = http://www.erg.abdn.ac.uk/~gerrit/udp-lite/files/udplite_linux.tar.gz >=20 > Reviewed by: jhb, glebius, adrian >=20 > - Fix a logic bug which prevented the sending of UDP packet with 0 = checksum. >=20 > - Disable TX checksum offload for UDP-Lite completely. It wasn't used = for > partial checksum coverage, but even for full checksum coverage it = doesn't > work. >=20 > Added: > stable/10/sys/netinet/udplite.h > - copied unchanged from r264212, head/sys/netinet/udplite.h > Modified: > stable/10/lib/libc/net/getaddrinfo.c > stable/10/sys/netinet/in.c > stable/10/sys/netinet/in.h > stable/10/sys/netinet/in_pcb.c > stable/10/sys/netinet/in_proto.c > stable/10/sys/netinet/udp_usrreq.c > stable/10/sys/netinet/udp_var.h > stable/10/sys/netinet6/in6_ifattach.c > stable/10/sys/netinet6/in6_proto.c > stable/10/sys/netinet6/udp6_usrreq.c > stable/10/sys/netinet6/udp6_var.h > stable/10/sys/sys/param.h > Directory Properties: > stable/10/ (props changed) >=20 > Modified: stable/10/lib/libc/net/getaddrinfo.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- stable/10/lib/libc/net/getaddrinfo.c Tue May 13 05:26:43 2014 = (r265945) > +++ stable/10/lib/libc/net/getaddrinfo.c Tue May 13 06:05:53 2014 = (r265946) > @@ -170,12 +170,14 @@ static const struct explore explore[] =3D=20 > { PF_INET6, SOCK_STREAM, IPPROTO_TCP, 0x07 }, > { PF_INET6, SOCK_STREAM, IPPROTO_SCTP, 0x03 }, > { PF_INET6, SOCK_SEQPACKET, IPPROTO_SCTP, 0x07 }, > + { PF_INET6, SOCK_DGRAM, IPPROTO_UDPLITE, 0x03 }, > { PF_INET6, SOCK_RAW, ANY, 0x05 }, > #endif > { PF_INET, SOCK_DGRAM, IPPROTO_UDP, 0x07 }, > { PF_INET, SOCK_STREAM, IPPROTO_TCP, 0x07 }, > { PF_INET, SOCK_STREAM, IPPROTO_SCTP, 0x03 }, > { PF_INET, SOCK_SEQPACKET, IPPROTO_SCTP, 0x07 }, > + { PF_INET, SOCK_DGRAM, IPPROTO_UDPLITE, 0x03 }, > { PF_INET, SOCK_RAW, ANY, 0x05 }, > { -1, 0, 0, 0 }, > }; > @@ -1477,6 +1479,9 @@ get_port(struct addrinfo *ai, const char > case IPPROTO_SCTP: > proto =3D "sctp"; > break; > + case IPPROTO_UDPLITE: > + proto =3D "udplite"; > + break; > default: > proto =3D NULL; > break; >=20 > Modified: stable/10/sys/netinet/in.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- stable/10/sys/netinet/in.c Tue May 13 05:26:43 2014 = (r265945) > +++ stable/10/sys/netinet/in.c Tue May 13 06:05:53 2014 = (r265946) > @@ -1167,6 +1167,7 @@ in_ifdetach(struct ifnet *ifp) >=20 > in_pcbpurgeif0(&V_ripcbinfo, ifp); > in_pcbpurgeif0(&V_udbinfo, ifp); > + in_pcbpurgeif0(&V_ulitecbinfo, ifp); > in_purgemaddrs(ifp); > } >=20 >=20 > Modified: stable/10/sys/netinet/in.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- stable/10/sys/netinet/in.h Tue May 13 05:26:43 2014 = (r265945) > +++ stable/10/sys/netinet/in.h Tue May 13 06:05:53 2014 = (r265946) > @@ -237,12 +237,17 @@ __END_DECLS > #define IPPROTO_IPCOMP 108 /* payload = compression (IPComp) */ > #define IPPROTO_SCTP 132 /* SCTP */ > #define IPPROTO_MH 135 /* IPv6 Mobility = Header */ > +#define IPPROTO_UDPLITE 136 /* UDP-Lite */ > +#define IPPROTO_HIP 139 /* IP6 Host = Identity Protocol */ > +#define IPPROTO_SHIM6 140 /* IP6 Shim6 = Protocol */ > /* 101-254: Partly Unassigned */ > #define IPPROTO_PIM 103 /* Protocol = Independent Mcast */ > #define IPPROTO_CARP 112 /* CARP */ > #define IPPROTO_PGM 113 /* PGM */ > #define IPPROTO_MPLS 137 /* MPLS-in-IP */ > #define IPPROTO_PFSYNC 240 /* PFSYNC */ > +#define IPPROTO_RESERVED_253 253 /* Reserved */ > +#define IPPROTO_RESERVED_254 254 /* Reserved */ > /* 255: Reserved */ > /* BSD Private, local use, namespace incursion, no longer used */ > #define IPPROTO_OLD_DIVERT 254 /* OLD divert = pseudo-proto */ >=20 > Modified: stable/10/sys/netinet/in_pcb.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- stable/10/sys/netinet/in_pcb.c Tue May 13 05:26:43 2014 = (r265945) > +++ stable/10/sys/netinet/in_pcb.c Tue May 13 06:05:53 2014 = (r265946) > @@ -386,13 +386,14 @@ in_pcb_lport(struct inpcb *inp, struct i > lastport =3D &pcbinfo->ipi_lastport; > } > /* > - * For UDP, use random port allocation as long as the user > + * For UDP(-Lite), use random port allocation as long as the = user > * allows it. For TCP (and as of yet unknown) connections, > * use random port allocation only if the user allows it AND > * ipport_tick() allows it. > */ > if (V_ipport_randomized && > - (!V_ipport_stoprandom || pcbinfo =3D=3D &V_udbinfo)) > + (!V_ipport_stoprandom || pcbinfo =3D=3D &V_udbinfo || > + pcbinfo =3D=3D &V_ulitecbinfo)) > dorandom =3D 1; > else > dorandom =3D 0; > @@ -402,8 +403,8 @@ in_pcb_lport(struct inpcb *inp, struct i > */ > if (first =3D=3D last) > dorandom =3D 0; > - /* Make sure to not include UDP packets in the count. */ > - if (pcbinfo !=3D &V_udbinfo) > + /* Make sure to not include UDP(-Lite) packets in the count. */ > + if (pcbinfo !=3D &V_udbinfo || pcbinfo !=3D &V_ulitecbinfo) > V_ipport_tcpallocs++; > /* > * Instead of having two loops further down counting up or down >=20 > Modified: stable/10/sys/netinet/in_proto.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- stable/10/sys/netinet/in_proto.c Tue May 13 05:26:43 2014 = (r265945) > +++ stable/10/sys/netinet/in_proto.c Tue May 13 06:05:53 2014 = (r265946) > @@ -184,6 +184,20 @@ struct protosw inetsw[] =3D { > }, > #endif /* SCTP */ > { > + .pr_type =3D SOCK_DGRAM, > + .pr_domain =3D &inetdomain, > + .pr_protocol =3D IPPROTO_UDPLITE, > + .pr_flags =3D PR_ATOMIC|PR_ADDR, > + .pr_input =3D udp_input, > + .pr_ctlinput =3D udplite_ctlinput, > + .pr_ctloutput =3D udp_ctloutput, > + .pr_init =3D udplite_init, > +#ifdef VIMAGE > + .pr_destroy =3D udplite_destroy, > +#endif > + .pr_usrreqs =3D &udp_usrreqs > +}, > +{ > .pr_type =3D SOCK_RAW, > .pr_domain =3D &inetdomain, > .pr_protocol =3D IPPROTO_RAW, >=20 > Modified: stable/10/sys/netinet/udp_usrreq.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- stable/10/sys/netinet/udp_usrreq.c Tue May 13 05:26:43 2014 = (r265945) > +++ stable/10/sys/netinet/udp_usrreq.c Tue May 13 06:05:53 2014 = (r265946) > @@ -3,6 +3,7 @@ > * The Regents of the University of California. > * Copyright (c) 2008 Robert N. M. Watson > * Copyright (c) 2010-2011 Juniper Networks, Inc. > + * Copyright (c) 2014 Kevin Lo > * All rights reserved. > * > * Portions of this software were developed by Robert N. M. Watson = under > @@ -87,6 +88,7 @@ __FBSDID("$FreeBSD$"); > #endif > #include > #include > +#include >=20 > #ifdef IPSEC > #include > @@ -98,8 +100,9 @@ __FBSDID("$FreeBSD$"); > #include >=20 > /* > - * UDP protocol implementation. > + * UDP and UDP-Lite protocols implementation. > * Per RFC 768, August, 1980. > + * Per RFC 3828, July, 2004. > */ >=20 > /* > @@ -139,6 +142,8 @@ SYSCTL_ULONG(_net_inet_udp, UDPCTL_RECVS >=20 > VNET_DEFINE(struct inpcbhead, udb); /* from udp_var.h */ > VNET_DEFINE(struct inpcbinfo, udbinfo); > +VNET_DEFINE(struct inpcbhead, ulitecb); > +VNET_DEFINE(struct inpcbinfo, ulitecbinfo); > static VNET_DEFINE(uma_zone_t, udpcb_zone); > #define V_udpcb_zone VNET(udpcb_zone) >=20 > @@ -187,6 +192,16 @@ udp_inpcb_init(void *mem, int size, int=20 > return (0); > } >=20 > +static int > +udplite_inpcb_init(void *mem, int size, int flags) > +{ > + struct inpcb *inp; > + > + inp =3D mem; > + INP_LOCK_INIT(inp, "inp", "udpliteinp"); > + return (0); > +} > + > void > udp_init(void) > { > @@ -202,6 +217,15 @@ udp_init(void) > EVENTHANDLER_PRI_ANY); > } >=20 > +void > +udplite_init(void) > +{ > + > + in_pcbinfo_init(&V_ulitecbinfo, "udplite", &V_ulitecb, = UDBHASHSIZE, > + UDBHASHSIZE, "udplite_inpcb", udplite_inpcb_init, NULL, > + UMA_ZONE_NOFREE, IPI_HASHFIELDS_2TUPLE); > +} > + > /* > * Kernel module interface for updating udpstat. The argument is an = index > * into udpstat treated as an array of u_long. While this encodes the > @@ -243,6 +267,13 @@ udp_destroy(void) > in_pcbinfo_destroy(&V_udbinfo); > uma_zdestroy(V_udpcb_zone); > } > + > +void > +udplite_destroy(void) > +{ > + > + in_pcbinfo_destroy(&V_ulitecbinfo); > +} > #endif >=20 > #ifdef INET > @@ -346,9 +377,12 @@ udp_input(struct mbuf *m, int off) > struct ifnet *ifp; > struct inpcb *inp; > uint16_t len, ip_len; > + struct inpcbinfo *pcbinfo; > struct ip save_ip; > struct sockaddr_in udp_in; > struct m_tag *fwd_tag; > + int cscov_partial; > + uint8_t pr; >=20 > ifp =3D m->m_pkthdr.rcvif; > UDPSTAT_INC(udps_ipackets); > @@ -368,13 +402,15 @@ udp_input(struct mbuf *m, int off) > */ > ip =3D mtod(m, struct ip *); > if (m->m_len < iphlen + sizeof(struct udphdr)) { > - if ((m =3D m_pullup(m, iphlen + sizeof(struct udphdr))) = =3D=3D 0) { > + if ((m =3D m_pullup(m, iphlen + sizeof(struct udphdr))) = =3D=3D NULL) { > UDPSTAT_INC(udps_hdrops); > return; > } > ip =3D mtod(m, struct ip *); > } > uh =3D (struct udphdr *)((caddr_t)ip + iphlen); > + pr =3D ip->ip_p; > + cscov_partial =3D (pr =3D=3D IPPROTO_UDPLITE) ? 1 : 0; >=20 > /* > * Destination port of 0 is illegal, based on RFC768. > @@ -398,12 +434,18 @@ udp_input(struct mbuf *m, int off) > */ > len =3D ntohs((u_short)uh->uh_ulen); > ip_len =3D ntohs(ip->ip_len) - iphlen; > + if (pr =3D=3D IPPROTO_UDPLITE && len =3D=3D 0) { > + /* Zero means checksum over the complete packet. */ > + len =3D ip_len; > + cscov_partial =3D 0; > + } > if (ip_len !=3D len) { > if (len > ip_len || len < sizeof(struct udphdr)) { > UDPSTAT_INC(udps_badlen); > goto badunlocked; > } > - m_adj(m, len - ip_len); > + if (pr =3D=3D IPPROTO_UDP) > + m_adj(m, len - ip_len); > } >=20 > /* > @@ -421,20 +463,22 @@ udp_input(struct mbuf *m, int off) > if (uh->uh_sum) { > u_short uh_sum; >=20 > - if (m->m_pkthdr.csum_flags & CSUM_DATA_VALID) { > + if ((m->m_pkthdr.csum_flags & CSUM_DATA_VALID) && > + !cscov_partial) { > if (m->m_pkthdr.csum_flags & CSUM_PSEUDO_HDR) > uh_sum =3D m->m_pkthdr.csum_data; > else > uh_sum =3D in_pseudo(ip->ip_src.s_addr, > ip->ip_dst.s_addr, = htonl((u_short)len + > - m->m_pkthdr.csum_data + = IPPROTO_UDP)); > + m->m_pkthdr.csum_data + pr)); > uh_sum ^=3D 0xffff; > } else { > char b[9]; >=20 > bcopy(((struct ipovly *)ip)->ih_x1, b, 9); > bzero(((struct ipovly *)ip)->ih_x1, 9); > - ((struct ipovly *)ip)->ih_len =3D uh->uh_ulen; > + ((struct ipovly *)ip)->ih_len =3D (pr =3D=3D = IPPROTO_UDP) ? > + uh->uh_ulen : htons(ip_len); > uh_sum =3D in_cksum(m, len + sizeof (struct = ip)); > bcopy(b, ((struct ipovly *)ip)->ih_x1, 9); > } > @@ -446,14 +490,17 @@ udp_input(struct mbuf *m, int off) > } else > UDPSTAT_INC(udps_nosum); >=20 > + pcbinfo =3D get_inpcbinfo(pr); > if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) || > in_broadcast(ip->ip_dst, ifp)) { > struct inpcb *last; > + struct inpcbhead *pcblist; > struct ip_moptions *imo; >=20 > - INP_INFO_RLOCK(&V_udbinfo); > + INP_INFO_RLOCK(pcbinfo); > + pcblist =3D get_pcblist(pr); > last =3D NULL; > - LIST_FOREACH(inp, &V_udb, inp_list) { > + LIST_FOREACH(inp, pcblist, inp_list) { > if (inp->inp_lport !=3D uh->uh_dport) > continue; > #ifdef INET6 > @@ -539,12 +586,12 @@ udp_input(struct mbuf *m, int off) > UDPSTAT_INC(udps_noportbcast); > if (inp) > INP_RUNLOCK(inp); > - INP_INFO_RUNLOCK(&V_udbinfo); > + INP_INFO_RUNLOCK(pcbinfo); > goto badunlocked; > } > udp_append(last, ip, m, iphlen, &udp_in); > INP_RUNLOCK(last); > - INP_INFO_RUNLOCK(&V_udbinfo); > + INP_INFO_RUNLOCK(pcbinfo); > return; > } >=20 > @@ -565,7 +612,7 @@ udp_input(struct mbuf *m, int off) > * Transparently forwarded. Pretend to be the = destination. > * Already got one like this? > */ > - inp =3D in_pcblookup_mbuf(&V_udbinfo, ip->ip_src, = uh->uh_sport, > + inp =3D in_pcblookup_mbuf(pcbinfo, ip->ip_src, = uh->uh_sport, > ip->ip_dst, uh->uh_dport, INPLOOKUP_RLOCKPCB, ifp, = m); > if (!inp) { > /* > @@ -573,7 +620,7 @@ udp_input(struct mbuf *m, int off) > * Because we've rewritten the destination = address, > * any hardware-generated hash is ignored. > */ > - inp =3D in_pcblookup(&V_udbinfo, ip->ip_src, > + inp =3D in_pcblookup(pcbinfo, ip->ip_src, > uh->uh_sport, next_hop->sin_addr, > next_hop->sin_port ? = htons(next_hop->sin_port) : > uh->uh_dport, INPLOOKUP_WILDCARD | > @@ -583,7 +630,7 @@ udp_input(struct mbuf *m, int off) > m_tag_delete(m, fwd_tag); > m->m_flags &=3D ~M_IP_NEXTHOP; > } else > - inp =3D in_pcblookup_mbuf(&V_udbinfo, ip->ip_src, = uh->uh_sport, > + inp =3D in_pcblookup_mbuf(pcbinfo, ip->ip_src, = uh->uh_sport, > ip->ip_dst, uh->uh_dport, INPLOOKUP_WILDCARD | > INPLOOKUP_RLOCKPCB, ifp, m); > if (inp =3D=3D NULL) { > @@ -619,6 +666,16 @@ udp_input(struct mbuf *m, int off) > m_freem(m); > return; > } > + if (cscov_partial) { > + struct udpcb *up; > + > + up =3D intoudpcb(inp); > + if (up->u_rxcslen > len) { > + INP_RUNLOCK(inp); > + m_freem(m); > + return; > + } > + } >=20 > UDP_PROBE(receive, NULL, inp, ip, inp, uh); > udp_append(inp, ip, m, iphlen, &udp_in); > @@ -653,8 +710,9 @@ udp_notify(struct inpcb *inp, int errno) > } >=20 > #ifdef INET > -void > -udp_ctlinput(int cmd, struct sockaddr *sa, void *vip) > +static void > +udp_common_ctlinput(int cmd, struct sockaddr *sa, void *vip, > + struct inpcbinfo *pcbinfo) > { > struct ip *ip =3D vip; > struct udphdr *uh; > @@ -683,7 +741,7 @@ udp_ctlinput(int cmd, struct sockaddr *s > return; > if (ip !=3D NULL) { > uh =3D (struct udphdr *)((caddr_t)ip + (ip->ip_hl << = 2)); > - inp =3D in_pcblookup(&V_udbinfo, faddr, uh->uh_dport, > + inp =3D in_pcblookup(pcbinfo, faddr, uh->uh_dport, > ip->ip_src, uh->uh_sport, INPLOOKUP_RLOCKPCB, NULL); > if (inp !=3D NULL) { > INP_RLOCK_ASSERT(inp); > @@ -693,9 +751,22 @@ udp_ctlinput(int cmd, struct sockaddr *s > INP_RUNLOCK(inp); > } > } else > - in_pcbnotifyall(&V_udbinfo, faddr, inetctlerrmap[cmd], > + in_pcbnotifyall(pcbinfo, faddr, inetctlerrmap[cmd], > udp_notify); > } > +void > +udp_ctlinput(int cmd, struct sockaddr *sa, void *vip) > +{ > + > + return (udp_common_ctlinput(cmd, sa, vip, &V_udbinfo)); > +} > + > +void > +udplite_ctlinput(int cmd, struct sockaddr *sa, void *vip) > +{ > + > + return (udp_common_ctlinput(cmd, sa, vip, &V_ulitecbinfo)); > +} > #endif /* INET */ >=20 > static int > @@ -851,16 +922,16 @@ SYSCTL_PROC(_net_inet_udp, OID_AUTO, get > int > udp_ctloutput(struct socket *so, struct sockopt *sopt) > { > - int error =3D 0, optval; > struct inpcb *inp; > -#ifdef IPSEC_NAT_T > struct udpcb *up; > -#endif > + int isudplite, error, optval; >=20 > + error =3D 0; > + isudplite =3D (so->so_proto->pr_protocol =3D=3D IPPROTO_UDPLITE) = ? 1 : 0; > inp =3D sotoinpcb(so); > KASSERT(inp !=3D NULL, ("%s: inp =3D=3D NULL", __func__)); > INP_WLOCK(inp); > - if (sopt->sopt_level !=3D IPPROTO_UDP) { > + if (sopt->sopt_level !=3D so->so_proto->pr_protocol) { > #ifdef INET6 > if (INP_CHECK_SOCKAF(so, AF_INET6)) { > INP_WUNLOCK(inp); > @@ -918,6 +989,34 @@ udp_ctloutput(struct socket *so, struct=20 > } > INP_WUNLOCK(inp); > break; > + case UDPLITE_SEND_CSCOV: > + case UDPLITE_RECV_CSCOV: > + if (!isudplite) { > + INP_WUNLOCK(inp); > + error =3D ENOPROTOOPT; > + break; > + } > + INP_WUNLOCK(inp); > + error =3D sooptcopyin(sopt, &optval, = sizeof(optval), > + sizeof(optval)); > + if (error !=3D 0) > + break; > + inp =3D sotoinpcb(so); > + KASSERT(inp !=3D NULL, ("%s: inp =3D=3D NULL", = __func__)); > + INP_WLOCK(inp); > + up =3D intoudpcb(inp); > + KASSERT(up !=3D NULL, ("%s: up =3D=3D NULL", = __func__)); > + if (optval !=3D 0 && optval < 8) { > + INP_WUNLOCK(inp); > + error =3D EINVAL; > + break; > + } > + if (sopt->sopt_name =3D=3D UDPLITE_SEND_CSCOV) > + up->u_txcslen =3D optval; > + else > + up->u_rxcslen =3D optval; > + INP_WUNLOCK(inp); > + break; > default: > INP_WUNLOCK(inp); > error =3D ENOPROTOOPT; > @@ -935,6 +1034,22 @@ udp_ctloutput(struct socket *so, struct=20 > error =3D sooptcopyout(sopt, &optval, sizeof = optval); > break; > #endif > + case UDPLITE_SEND_CSCOV: > + case UDPLITE_RECV_CSCOV: > + if (!isudplite) { > + INP_WUNLOCK(inp); > + error =3D ENOPROTOOPT; > + break; > + } > + up =3D intoudpcb(inp); > + KASSERT(up !=3D NULL, ("%s: up =3D=3D NULL", = __func__)); > + if (sopt->sopt_name =3D=3D UDPLITE_SEND_CSCOV) > + optval =3D up->u_txcslen; > + else > + optval =3D up->u_rxcslen; > + INP_WUNLOCK(inp); > + error =3D sooptcopyout(sopt, &optval, = sizeof(optval)); > + break; > default: > INP_WUNLOCK(inp); > error =3D ENOPROTOOPT; > @@ -957,12 +1072,16 @@ udp_output(struct inpcb *inp, struct mbu > int len =3D m->m_pkthdr.len; > struct in_addr faddr, laddr; > struct cmsghdr *cm; > + struct inpcbinfo *pcbinfo; > struct sockaddr_in *sin, src; > + int cscov_partial =3D 0; > int error =3D 0; > int ipflags; > u_short fport, lport; > int unlock_udbinfo; > u_char tos; > + uint8_t pr; > + uint16_t cscov =3D 0; >=20 > /* > * udp_output() may need to temporarily bind or connect the = current > @@ -1057,12 +1176,14 @@ udp_output(struct inpcb *inp, struct mbu > * > * XXXRW: Check that hash locking update here is correct. > */ > + pr =3D inp->inp_socket->so_proto->pr_protocol; > + pcbinfo =3D get_inpcbinfo(pr); > sin =3D (struct sockaddr_in *)addr; > if (sin !=3D NULL && > (inp->inp_laddr.s_addr =3D=3D INADDR_ANY && inp->inp_lport = =3D=3D 0)) { > INP_RUNLOCK(inp); > INP_WLOCK(inp); > - INP_HASH_WLOCK(&V_udbinfo); > + INP_HASH_WLOCK(pcbinfo); > unlock_udbinfo =3D UH_WLOCKED; > } else if ((sin !=3D NULL && ( > (sin->sin_addr.s_addr =3D=3D INADDR_ANY) || > @@ -1070,7 +1191,7 @@ udp_output(struct inpcb *inp, struct mbu > (inp->inp_laddr.s_addr =3D=3D INADDR_ANY) || > (inp->inp_lport =3D=3D 0))) || > (src.sin_family =3D=3D AF_INET)) { > - INP_HASH_RLOCK(&V_udbinfo); > + INP_HASH_RLOCK(pcbinfo); > unlock_udbinfo =3D UH_RLOCKED; > } else > unlock_udbinfo =3D UH_UNLOCKED; > @@ -1083,7 +1204,7 @@ udp_output(struct inpcb *inp, struct mbu > laddr =3D inp->inp_laddr; > lport =3D inp->inp_lport; > if (src.sin_family =3D=3D AF_INET) { > - INP_HASH_LOCK_ASSERT(&V_udbinfo); > + INP_HASH_LOCK_ASSERT(pcbinfo); > if ((lport =3D=3D 0) || > (laddr.s_addr =3D=3D INADDR_ANY && > src.sin_addr.s_addr =3D=3D INADDR_ANY)) { > @@ -1134,7 +1255,7 @@ udp_output(struct inpcb *inp, struct mbu > inp->inp_lport =3D=3D 0 || > sin->sin_addr.s_addr =3D=3D INADDR_ANY || > sin->sin_addr.s_addr =3D=3D INADDR_BROADCAST) { > - INP_HASH_LOCK_ASSERT(&V_udbinfo); > + INP_HASH_LOCK_ASSERT(pcbinfo); > error =3D in_pcbconnect_setup(inp, addr, = &laddr.s_addr, > &lport, &faddr.s_addr, &fport, NULL, > td->td_ucred); > @@ -1149,7 +1270,7 @@ udp_output(struct inpcb *inp, struct mbu > if (inp->inp_laddr.s_addr =3D=3D INADDR_ANY && > inp->inp_lport =3D=3D 0) { > INP_WLOCK_ASSERT(inp); > - INP_HASH_WLOCK_ASSERT(&V_udbinfo); > + INP_HASH_WLOCK_ASSERT(pcbinfo); > /* > * Remember addr if jailed, to prevent > * rebinding. > @@ -1198,13 +1319,30 @@ udp_output(struct inpcb *inp, struct mbu > */ > ui =3D mtod(m, struct udpiphdr *); > bzero(ui->ui_x1, sizeof(ui->ui_x1)); /* XXX still needed? */ > - ui->ui_v =3D IPVERSION << 4; > - ui->ui_pr =3D IPPROTO_UDP; > + ui->ui_pr =3D pr; > ui->ui_src =3D laddr; > ui->ui_dst =3D faddr; > ui->ui_sport =3D lport; > ui->ui_dport =3D fport; > ui->ui_ulen =3D htons((u_short)len + sizeof(struct udphdr)); > + if (pr =3D=3D IPPROTO_UDPLITE) { > + struct udpcb *up; > + uint16_t plen; > + > + up =3D intoudpcb(inp); > + cscov =3D up->u_txcslen; > + plen =3D (u_short)len + sizeof(struct udphdr); > + if (cscov >=3D plen) > + cscov =3D 0; > + ui->ui_len =3D htons(plen); > + ui->ui_ulen =3D htons(cscov); > + /* > + * For UDP-Lite, checksum coverage length of zero means > + * the entire UDPLite packet is covered by the checksum. > + */ > + cscov_partial =3D (cscov =3D=3D 0) ? 0 : 1; > + } else > + ui->ui_v =3D IPVERSION << 4; >=20 > /* > * Set the Don't Fragment bit in the IP header. > @@ -1231,24 +1369,34 @@ udp_output(struct inpcb *inp, struct mbu > /* > * Set up checksum and output datagram. > */ > - if (V_udp_cksum) { > + ui->ui_sum =3D 0; > + if (pr =3D=3D IPPROTO_UDPLITE) { > + if (inp->inp_flags & INP_ONESBCAST) > + faddr.s_addr =3D INADDR_BROADCAST; > + if (cscov_partial) { > + if ((ui->ui_sum =3D in_cksum(m, sizeof(struct = ip) + cscov)) =3D=3D 0) > + ui->ui_sum =3D 0xffff; > + } else { > + if ((ui->ui_sum =3D in_cksum(m, sizeof(struct = udpiphdr) + len)) =3D=3D 0) > + ui->ui_sum =3D 0xffff; > + } > + } else if (V_udp_cksum) { > if (inp->inp_flags & INP_ONESBCAST) > faddr.s_addr =3D INADDR_BROADCAST; > ui->ui_sum =3D in_pseudo(ui->ui_src.s_addr, = faddr.s_addr, > - htons((u_short)len + sizeof(struct udphdr) + = IPPROTO_UDP)); > + htons((u_short)len + sizeof(struct udphdr) + pr)); > m->m_pkthdr.csum_flags =3D CSUM_UDP; > m->m_pkthdr.csum_data =3D offsetof(struct udphdr, = uh_sum); > - } else > - ui->ui_sum =3D 0; > + } > ((struct ip *)ui)->ip_len =3D htons(sizeof(struct udpiphdr) + = len); > ((struct ip *)ui)->ip_ttl =3D inp->inp_ip_ttl; /* XXX */ > ((struct ip *)ui)->ip_tos =3D tos; /* XXX */ > UDPSTAT_INC(udps_opackets); >=20 > if (unlock_udbinfo =3D=3D UH_WLOCKED) > - INP_HASH_WUNLOCK(&V_udbinfo); > + INP_HASH_WUNLOCK(pcbinfo); > else if (unlock_udbinfo =3D=3D UH_RLOCKED) > - INP_HASH_RUNLOCK(&V_udbinfo); > + INP_HASH_RUNLOCK(pcbinfo); > UDP_PROBE(send, NULL, inp, &ui->ui_i, inp, &ui->ui_u); > error =3D ip_output(m, inp->inp_options, NULL, ipflags, > inp->inp_moptions, inp); > @@ -1260,10 +1408,10 @@ udp_output(struct inpcb *inp, struct mbu >=20 > release: > if (unlock_udbinfo =3D=3D UH_WLOCKED) { > - INP_HASH_WUNLOCK(&V_udbinfo); > + INP_HASH_WUNLOCK(pcbinfo); > INP_WUNLOCK(inp); > } else if (unlock_udbinfo =3D=3D UH_RLOCKED) { > - INP_HASH_RUNLOCK(&V_udbinfo); > + INP_HASH_RUNLOCK(pcbinfo); > INP_RUNLOCK(inp); > } else > INP_RUNLOCK(inp); > @@ -1410,15 +1558,17 @@ static void > udp_abort(struct socket *so) > { > struct inpcb *inp; > + struct inpcbinfo *pcbinfo; >=20 > + pcbinfo =3D get_inpcbinfo(so->so_proto->pr_protocol); > inp =3D sotoinpcb(so); > KASSERT(inp !=3D NULL, ("udp_abort: inp =3D=3D NULL")); > INP_WLOCK(inp); > if (inp->inp_faddr.s_addr !=3D INADDR_ANY) { > - INP_HASH_WLOCK(&V_udbinfo); > + INP_HASH_WLOCK(pcbinfo); > in_pcbdisconnect(inp); > inp->inp_laddr.s_addr =3D INADDR_ANY; > - INP_HASH_WUNLOCK(&V_udbinfo); > + INP_HASH_WUNLOCK(pcbinfo); > soisdisconnected(so); > } > INP_WUNLOCK(inp); > @@ -1428,17 +1578,19 @@ static int > udp_attach(struct socket *so, int proto, struct thread *td) > { > struct inpcb *inp; > + struct inpcbinfo *pcbinfo; > int error; >=20 > + pcbinfo =3D get_inpcbinfo(so->so_proto->pr_protocol); > inp =3D sotoinpcb(so); > KASSERT(inp =3D=3D NULL, ("udp_attach: inp !=3D NULL")); > error =3D soreserve(so, udp_sendspace, udp_recvspace); > if (error) > return (error); > - INP_INFO_WLOCK(&V_udbinfo); > - error =3D in_pcballoc(so, &V_udbinfo); > + INP_INFO_WLOCK(pcbinfo); > + error =3D in_pcballoc(so, pcbinfo); > if (error) { > - INP_INFO_WUNLOCK(&V_udbinfo); > + INP_INFO_WUNLOCK(pcbinfo); > return (error); > } >=20 > @@ -1450,12 +1602,12 @@ udp_attach(struct socket *so, int proto, > if (error) { > in_pcbdetach(inp); > in_pcbfree(inp); > - INP_INFO_WUNLOCK(&V_udbinfo); > + INP_INFO_WUNLOCK(pcbinfo); > return (error); > } >=20 > INP_WUNLOCK(inp); > - INP_INFO_WUNLOCK(&V_udbinfo); > + INP_INFO_WUNLOCK(pcbinfo); > return (0); > } > #endif /* INET */ > @@ -1486,14 +1638,16 @@ static int > udp_bind(struct socket *so, struct sockaddr *nam, struct thread *td) > { > struct inpcb *inp; > + struct inpcbinfo *pcbinfo; > int error; >=20 > + pcbinfo =3D get_inpcbinfo(so->so_proto->pr_protocol); > inp =3D sotoinpcb(so); > KASSERT(inp !=3D NULL, ("udp_bind: inp =3D=3D NULL")); > INP_WLOCK(inp); > - INP_HASH_WLOCK(&V_udbinfo); > + INP_HASH_WLOCK(pcbinfo); > error =3D in_pcbbind(inp, nam, td->td_ucred); > - INP_HASH_WUNLOCK(&V_udbinfo); > + INP_HASH_WUNLOCK(pcbinfo); > INP_WUNLOCK(inp); > return (error); > } > @@ -1502,15 +1656,17 @@ static void > udp_close(struct socket *so) > { > struct inpcb *inp; > + struct inpcbinfo *pcbinfo; >=20 > + pcbinfo =3D get_inpcbinfo(so->so_proto->pr_protocol); > inp =3D sotoinpcb(so); > KASSERT(inp !=3D NULL, ("udp_close: inp =3D=3D NULL")); > INP_WLOCK(inp); > if (inp->inp_faddr.s_addr !=3D INADDR_ANY) { > - INP_HASH_WLOCK(&V_udbinfo); > + INP_HASH_WLOCK(pcbinfo); > in_pcbdisconnect(inp); > inp->inp_laddr.s_addr =3D INADDR_ANY; > - INP_HASH_WUNLOCK(&V_udbinfo); > + INP_HASH_WUNLOCK(pcbinfo); > soisdisconnected(so); > } > INP_WUNLOCK(inp); > @@ -1520,9 +1676,11 @@ static int > udp_connect(struct socket *so, struct sockaddr *nam, struct thread = *td) > { > struct inpcb *inp; > - int error; > + struct inpcbinfo *pcbinfo; > struct sockaddr_in *sin; > + int error; >=20 > + pcbinfo =3D get_inpcbinfo(so->so_proto->pr_protocol); > inp =3D sotoinpcb(so); > KASSERT(inp !=3D NULL, ("udp_connect: inp =3D=3D NULL")); > INP_WLOCK(inp); > @@ -1536,9 +1694,9 @@ udp_connect(struct socket *so, struct so > INP_WUNLOCK(inp); > return (error); > } > - INP_HASH_WLOCK(&V_udbinfo); > + INP_HASH_WLOCK(pcbinfo); > error =3D in_pcbconnect(inp, nam, td->td_ucred); > - INP_HASH_WUNLOCK(&V_udbinfo); > + INP_HASH_WUNLOCK(pcbinfo); > if (error =3D=3D 0) > soisconnected(so); > INP_WUNLOCK(inp); > @@ -1549,20 +1707,22 @@ static void > udp_detach(struct socket *so) > { > struct inpcb *inp; > + struct inpcbinfo *pcbinfo; > struct udpcb *up; >=20 > + pcbinfo =3D get_inpcbinfo(so->so_proto->pr_protocol); > inp =3D sotoinpcb(so); > KASSERT(inp !=3D NULL, ("udp_detach: inp =3D=3D NULL")); > KASSERT(inp->inp_faddr.s_addr =3D=3D INADDR_ANY, > ("udp_detach: not disconnected")); > - INP_INFO_WLOCK(&V_udbinfo); > + INP_INFO_WLOCK(pcbinfo); > INP_WLOCK(inp); > up =3D intoudpcb(inp); > KASSERT(up !=3D NULL, ("%s: up =3D=3D NULL", __func__)); > inp->inp_ppcb =3D NULL; > in_pcbdetach(inp); > in_pcbfree(inp); > - INP_INFO_WUNLOCK(&V_udbinfo); > + INP_INFO_WUNLOCK(pcbinfo); > udp_discardcb(up); > } >=20 > @@ -1570,7 +1730,9 @@ static int > udp_disconnect(struct socket *so) > { > struct inpcb *inp; > + struct inpcbinfo *pcbinfo; >=20 > + pcbinfo =3D get_inpcbinfo(so->so_proto->pr_protocol); > inp =3D sotoinpcb(so); > KASSERT(inp !=3D NULL, ("udp_disconnect: inp =3D=3D NULL")); > INP_WLOCK(inp); > @@ -1578,10 +1740,10 @@ udp_disconnect(struct socket *so) > INP_WUNLOCK(inp); > return (ENOTCONN); > } > - INP_HASH_WLOCK(&V_udbinfo); > + INP_HASH_WLOCK(pcbinfo); > in_pcbdisconnect(inp); > inp->inp_laddr.s_addr =3D INADDR_ANY; > - INP_HASH_WUNLOCK(&V_udbinfo); > + INP_HASH_WUNLOCK(pcbinfo); > SOCK_LOCK(so); > so->so_state &=3D ~SS_ISCONNECTED; /* XXX */ > SOCK_UNLOCK(so); >=20 > Modified: stable/10/sys/netinet/udp_var.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- stable/10/sys/netinet/udp_var.h Tue May 13 05:26:43 2014 = (r265945) > +++ stable/10/sys/netinet/udp_var.h Tue May 13 06:05:53 2014 = (r265946) > @@ -63,6 +63,8 @@ typedef void(*udp_tun_func_t)(struct mbu > struct udpcb { > udp_tun_func_t u_tun_func; /* UDP kernel tunneling = callback. */ > u_int u_flags; /* Generic UDP flags. */ > + uint16_t u_rxcslen; /* Coverage for incoming = datagrams. */ > + uint16_t u_txcslen; /* Coverage for outgoing = datagrams. */ > }; >=20 > #define intoudpcb(ip) ((struct udpcb *)(ip)->inp_ppcb) > @@ -130,8 +132,12 @@ SYSCTL_DECL(_net_inet_udp); > extern struct pr_usrreqs udp_usrreqs; > VNET_DECLARE(struct inpcbhead, udb); > VNET_DECLARE(struct inpcbinfo, udbinfo); > +VNET_DECLARE(struct inpcbhead, ulitecb); > +VNET_DECLARE(struct inpcbinfo, ulitecbinfo); > #define V_udb VNET(udb) > #define V_udbinfo VNET(udbinfo) > +#define V_ulitecb VNET(ulitecb) > +#define V_ulitecbinfo VNET(ulitecbinfo) >=20 > extern u_long udp_sendspace; > extern u_long udp_recvspace; > @@ -141,20 +147,37 @@ VNET_DECLARE(int, udp_blackhole); > #define V_udp_blackhole VNET(udp_blackhole) > extern int udp_log_in_vain; >=20 > -int udp_newudpcb(struct inpcb *); > -void udp_discardcb(struct udpcb *); > - > -void udp_ctlinput(int, struct sockaddr *, void *); > -int udp_ctloutput(struct socket *, struct sockopt *); > -void udp_init(void); > +static __inline struct inpcbinfo * > +get_inpcbinfo(uint8_t protocol) > +{ > + return (protocol =3D=3D IPPROTO_UDP) ? &V_udbinfo : = &V_ulitecbinfo; > +} > + > +static __inline struct inpcbhead * > +get_pcblist(uint8_t protocol) > +{ > + return (protocol =3D=3D IPPROTO_UDP) ? &V_udb : &V_ulitecb; > +} > + > +int udp_newudpcb(struct inpcb *); > +void udp_discardcb(struct udpcb *); > + > +void udp_ctlinput(int, struct sockaddr *, void *); > +void udplite_ctlinput(int, struct sockaddr *, void *); > +int udp_ctloutput(struct socket *, struct sockopt *); > +void udp_init(void); > +void udplite_init(void); > #ifdef VIMAGE > -void udp_destroy(void); > +void udp_destroy(void); > +void udplite_destroy(void); > #endif > -void udp_input(struct mbuf *, int); > +void udp_input(struct mbuf *, int); > +void udplite_input(struct mbuf *, int); > struct inpcb *udp_notify(struct inpcb *inp, int errno); > -int udp_shutdown(struct socket *so); > +int udp_shutdown(struct socket *so); >=20 > -int udp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f); > -#endif > +int udp_set_kernel_tunneling(struct socket *so, = udp_tun_func_t f); >=20 > -#endif > +#endif /* _KERNEL */ > + > +#endif /* _NETINET_UDP_VAR_H_ */ >=20 > Copied: stable/10/sys/netinet/udplite.h (from r264212, = head/sys/netinet/udplite.h) > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ stable/10/sys/netinet/udplite.h Tue May 13 06:05:53 2014 = (r265946, copy of r264212, head/sys/netinet/udplite.h) > @@ -0,0 +1,38 @@ > +/*- > + * Copyright (c) 2014, Kevin Lo > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above = copyright > + * notice, this list of conditions and the following disclaimer in = the > + * documentation and/or other materials provided with the = distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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$ > + */ > + > +#ifndef _NETINET_UDPLITE_H_ > +#define _NETINET_UDPLITE_H_ > + > +/*=20 > + * User-settable options (used with setsockopt). > + */ > +#define UDPLITE_SEND_CSCOV 2 /* Sender checksum = coverage. */ > +#define UDPLITE_RECV_CSCOV 4 /* Receiver checksum = coverage. */ > + > +#endif /* !_NETINET_UDPLITE_H_ */ >=20 > Modified: stable/10/sys/netinet6/in6_ifattach.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- stable/10/sys/netinet6/in6_ifattach.c Tue May 13 05:26:43 2014 = (r265945) > +++ stable/10/sys/netinet6/in6_ifattach.c Tue May 13 06:05:53 2014 = (r265946) > @@ -856,6 +856,7 @@ in6_ifdetach(struct ifnet *ifp) > } >=20 > in6_pcbpurgeif0(&V_udbinfo, ifp); > + in6_pcbpurgeif0(&V_ulitecbinfo, ifp); > in6_pcbpurgeif0(&V_ripcbinfo, ifp); > /* leave from all multicast groups joined */ > in6_purgemaddrs(ifp); >=20 > Modified: stable/10/sys/netinet6/in6_proto.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- stable/10/sys/netinet6/in6_proto.c Tue May 13 05:26:43 2014 = (r265945) > +++ stable/10/sys/netinet6/in6_proto.c Tue May 13 06:05:53 2014 = (r265946) > @@ -207,13 +207,26 @@ struct ip6protosw inet6sw[] =3D { > .pr_protocol =3D IPPROTO_SCTP, > .pr_flags =3D PR_WANTRCVD, > .pr_input =3D sctp6_input, > - .pr_ctlinput =3D sctp6_ctlinput, > + .pr_ctlinput =3D sctp6_ctlinput, > .pr_ctloutput =3D sctp_ctloutput, > .pr_drain =3D sctp_drain, > .pr_usrreqs =3D &sctp6_usrreqs > }, > #endif /* SCTP */ > { > + .pr_type =3D SOCK_DGRAM, > + .pr_domain =3D &inet6domain, > + .pr_protocol =3D IPPROTO_UDPLITE, > + .pr_flags =3D PR_ATOMIC|PR_ADDR, > + .pr_input =3D udp6_input, > + .pr_ctlinput =3D udplite6_ctlinput, > + .pr_ctloutput =3D udp_ctloutput, > +#ifndef INET /* Do not call initialization twice. */ > + .pr_init =3D udplite_init, > +#endif > + .pr_usrreqs =3D &udp6_usrreqs, > +}, > +{ > .pr_type =3D SOCK_RAW, > .pr_domain =3D &inet6domain, > .pr_protocol =3D IPPROTO_RAW, >=20 > Modified: stable/10/sys/netinet6/udp6_usrreq.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- stable/10/sys/netinet6/udp6_usrreq.c Tue May 13 05:26:43 2014 = (r265945) > +++ stable/10/sys/netinet6/udp6_usrreq.c Tue May 13 06:05:53 2014 = (r265946) > @@ -1,6 +1,7 @@ > /*- > * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. > * Copyright (c) 2010-2011 Juniper Networks, Inc. > + * Copyright (c) 2014 Kevin Lo > * All rights reserved. > * > * Portions of this software were developed by Robert N. M. Watson = under > @@ -109,6 +110,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include >=20 > #include > #include > @@ -181,12 +183,15 @@ udp6_input(struct mbuf **mp, int *offp,=20 > struct ip6_hdr *ip6; > struct udphdr *uh; > struct inpcb *inp; > + struct inpcbinfo *pcbinfo; > struct udpcb *up; > int off =3D *offp; > + int cscov_partial; > int plen, ulen; > struct sockaddr_in6 fromsa; > struct m_tag *fwd_tag; > uint16_t uh_sum; > + uint8_t nxt; >=20 > ifp =3D m->m_pkthdr.rcvif; > ip6 =3D mtod(m, struct ip6_hdr *); > @@ -218,6 +223,13 @@ udp6_input(struct mbuf **mp, int *offp,=20 > plen =3D ntohs(ip6->ip6_plen) - off + sizeof(*ip6); > ulen =3D ntohs((u_short)uh->uh_ulen); >=20 > + nxt =3D ip6->ip6_nxt; > + cscov_partial =3D (nxt =3D=3D IPPROTO_UDPLITE) ? 1 : 0; > + if (nxt =3D=3D IPPROTO_UDPLITE && ulen =3D=3D 0) { > + /* Zero means checksum over the complete packet. */ > + ulen =3D plen; > + cscov_partial =3D 0; > + } >=20 > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** >=20 =97=20 Bjoern A. Zeeb "Come on. Learn, goddamn it.", WarGames, 1983 From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 13:20:45 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E569373E; Sat, 16 Aug 2014 13:20:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D001D2B16; Sat, 16 Aug 2014 13:20:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7GDKjhD038836; Sat, 16 Aug 2014 13:20:45 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7GDKjYJ038831; Sat, 16 Aug 2014 13:20:45 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201408161320.s7GDKjYJ038831@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 16 Aug 2014 13:20:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270047 - stable/10/sbin/pfctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 13:20:46 -0000 Author: bz Date: Sat Aug 16 13:20:44 2014 New Revision: 270047 URL: http://svnweb.freebsd.org/changeset/base/270047 Log: MFC r259916: Use feature_present(3) to determine whether to open an INET or an INET6 socket when needed to allow pfctl to work on noinet and noinet6 kernels (and try to provide a fallback using AF_LINK as best effort). Adjust the Makefile to also respect relevant src.conf(5) options for compile time decisions on INET and INET6 support. Reviewed by: glebius (no objections) Modified: stable/10/sbin/pfctl/Makefile stable/10/sbin/pfctl/pfctl_altq.c stable/10/sbin/pfctl/pfctl_parser.c stable/10/sbin/pfctl/pfctl_parser.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/pfctl/Makefile ============================================================================== --- stable/10/sbin/pfctl/Makefile Sat Aug 16 13:13:17 2014 (r270046) +++ stable/10/sbin/pfctl/Makefile Sat Aug 16 13:20:44 2014 (r270047) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + # pf_ruleset.c is shared between kernel and pfctl .PATH: ${.CURDIR}/../../sys/netpfil/pf @@ -16,6 +18,14 @@ CFLAGS+= -Wall -Wmissing-prototypes -Wno CFLAGS+= -Wstrict-prototypes CFLAGS+= -DENABLE_ALTQ -I${.CURDIR} +# Need to use "WITH_" prefix to not conflict with the l/y INET/INET6 keywords +.if ${MK_INET6_SUPPORT} != "no" +CFLAGS+= -DWITH_INET6 +.endif +.if ${MK_INET_SUPPORT} != "no" +CFLAGS+= -DWITH_INET +.endif + YFLAGS= LDADD+= -lm -lmd Modified: stable/10/sbin/pfctl/pfctl_altq.c ============================================================================== --- stable/10/sbin/pfctl/pfctl_altq.c Sat Aug 16 13:13:17 2014 (r270046) +++ stable/10/sbin/pfctl/pfctl_altq.c Sat Aug 16 13:20:44 2014 (r270047) @@ -1122,7 +1122,7 @@ getifspeed(char *ifname) struct ifreq ifr; struct if_data ifrdat; - if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) + if ((s = socket(get_socket_domain(), SOCK_DGRAM, 0)) < 0) err(1, "socket"); bzero(&ifr, sizeof(ifr)); if (strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)) >= @@ -1143,7 +1143,7 @@ getifmtu(char *ifname) int s; struct ifreq ifr; - if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) + if ((s = socket(get_socket_domain(), SOCK_DGRAM, 0)) < 0) err(1, "socket"); bzero(&ifr, sizeof(ifr)); if (strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)) >= Modified: stable/10/sbin/pfctl/pfctl_parser.c ============================================================================== --- stable/10/sbin/pfctl/pfctl_parser.c Sat Aug 16 13:13:17 2014 (r270046) +++ stable/10/sbin/pfctl/pfctl_parser.c Sat Aug 16 13:20:44 2014 (r270047) @@ -1231,6 +1231,26 @@ ifa_load(void) freeifaddrs(ifap); } +int +get_socket_domain(void) +{ + int sdom; + + sdom = AF_UNSPEC; +#ifdef WITH_INET6 + if (sdom == AF_UNSPEC && feature_present("inet6")) + sdom = AF_INET6; +#endif +#ifdef WITH_INET + if (sdom == AF_UNSPEC && feature_present("inet")) + sdom = AF_INET; +#endif + if (sdom == AF_UNSPEC) + sdom = AF_LINK; + + return (sdom); +} + struct node_host * ifa_exists(const char *ifa_name) { @@ -1242,7 +1262,7 @@ ifa_exists(const char *ifa_name) ifa_load(); /* check wether this is a group */ - if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1) + if ((s = socket(get_socket_domain(), SOCK_DGRAM, 0)) == -1) err(1, "socket"); bzero(&ifgr, sizeof(ifgr)); strlcpy(ifgr.ifgr_name, ifa_name, sizeof(ifgr.ifgr_name)); @@ -1273,7 +1293,7 @@ ifa_grouplookup(const char *ifa_name, in int s, len; struct node_host *n, *h = NULL; - if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1) + if ((s = socket(get_socket_domain(), SOCK_DGRAM, 0)) == -1) err(1, "socket"); bzero(&ifgr, sizeof(ifgr)); strlcpy(ifgr.ifgr_name, ifa_name, sizeof(ifgr.ifgr_name)); Modified: stable/10/sbin/pfctl/pfctl_parser.h ============================================================================== --- stable/10/sbin/pfctl/pfctl_parser.h Sat Aug 16 13:13:17 2014 (r270046) +++ stable/10/sbin/pfctl/pfctl_parser.h Sat Aug 16 13:20:44 2014 (r270047) @@ -294,6 +294,7 @@ void set_ipmask(struct node_host *, u int check_netmask(struct node_host *, sa_family_t); int unmask(struct pf_addr *, sa_family_t); void ifa_load(void); +int get_socket_domain(void); struct node_host *ifa_exists(const char *); struct node_host *ifa_lookup(const char *, int); struct node_host *host(const char *); From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 13:23:24 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4F82A96F; Sat, 16 Aug 2014 13:23:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A5702B37; Sat, 16 Aug 2014 13:23:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7GDNOH7041931; Sat, 16 Aug 2014 13:23:24 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7GDNOo5041930; Sat, 16 Aug 2014 13:23:24 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201408161323.s7GDNOo5041930@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 16 Aug 2014 13:23:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270048 - stable/10/sys/dev/ie X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 13:23:24 -0000 Author: bz Date: Sat Aug 16 13:23:23 2014 New Revision: 270048 URL: http://svnweb.freebsd.org/changeset/base/270048 Log: MFC r259886: Bite the bullet and start removing the first compile time warnings by removing unsued file local functions and then unused callees. A lot more warnings to resolve but someone had to break the ice. X-Comment: I am not the new maintainer; chime in, it's ours. Modified: stable/10/sys/dev/ie/if_ie.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ie/if_ie.c ============================================================================== --- stable/10/sys/dev/ie/if_ie.c Sat Aug 16 13:20:44 2014 (r270047) +++ stable/10/sys/dev/ie/if_ie.c Sat Aug 16 13:23:23 2014 (r270048) @@ -172,17 +172,12 @@ static void iestart_locked (struct ifne static __inline void ee16_interrupt_enable (struct ie_softc *); -static void ee16_eeprom_outbits (struct ie_softc *, int, int); -static void ee16_eeprom_clock (struct ie_softc *, int); -static u_short ee16_read_eeprom (struct ie_softc *, int); -static int ee16_eeprom_inbits (struct ie_softc *); static __inline void ie_ack (struct ie_softc *, u_int); static void iereset (struct ie_softc *); static void ie_readframe (struct ie_softc *, int); static void ie_drop_packet_buffer (struct ie_softc *); -static void find_ie_mem_size (struct ie_softc *); static int command_and_wait (struct ie_softc *, int, void volatile *, int); static void run_tdr (struct ie_softc *, @@ -1090,26 +1085,6 @@ check_ie_present(struct ie_softc *sc) return (1); } -/* - * Divine the memory size of ie board UNIT. - * Better hope there's nothing important hiding just below the ie card... - */ -static void -find_ie_mem_size(struct ie_softc *sc) -{ - unsigned size; - - sc->iosize = 0; - - for (size = 65536; size >= 8192; size -= 8192) { - if (check_ie_present(sc)) { - return; - } - } - - return; -} - void el_reset_586(struct ie_softc *sc) { @@ -1152,82 +1127,6 @@ ee16_chan_attn(struct ie_softc *sc) outb(PORT(sc) + IEE16_ATTN, 0); } -u_short -ee16_read_eeprom(struct ie_softc *sc, int location) -{ - int ectrl, edata; - - ectrl = inb(sc->port + IEE16_ECTRL); - ectrl &= IEE16_ECTRL_MASK; - ectrl |= IEE16_ECTRL_EECS; - outb(sc->port + IEE16_ECTRL, ectrl); - - ee16_eeprom_outbits(sc, IEE16_EEPROM_READ, IEE16_EEPROM_OPSIZE1); - ee16_eeprom_outbits(sc, location, IEE16_EEPROM_ADDR_SIZE); - edata = ee16_eeprom_inbits(sc); - ectrl = inb(sc->port + IEE16_ECTRL); - ectrl &= ~(IEE16_RESET_ASIC | IEE16_ECTRL_EEDI | IEE16_ECTRL_EECS); - outb(sc->port + IEE16_ECTRL, ectrl); - ee16_eeprom_clock(sc, 1); - ee16_eeprom_clock(sc, 0); - return edata; -} - -static void -ee16_eeprom_outbits(struct ie_softc *sc, int edata, int count) -{ - int ectrl, i; - - ectrl = inb(sc->port + IEE16_ECTRL); - ectrl &= ~IEE16_RESET_ASIC; - for (i = count - 1; i >= 0; i--) { - ectrl &= ~IEE16_ECTRL_EEDI; - if (edata & (1 << i)) { - ectrl |= IEE16_ECTRL_EEDI; - } - outb(sc->port + IEE16_ECTRL, ectrl); - DELAY(1); /* eeprom data must be setup for 0.4 uSec */ - ee16_eeprom_clock(sc, 1); - ee16_eeprom_clock(sc, 0); - } - ectrl &= ~IEE16_ECTRL_EEDI; - outb(sc->port + IEE16_ECTRL, ectrl); - DELAY(1); /* eeprom data must be held for 0.4 uSec */ -} - -static int -ee16_eeprom_inbits(struct ie_softc *sc) -{ - int ectrl, edata, i; - - ectrl = inb(sc->port + IEE16_ECTRL); - ectrl &= ~IEE16_RESET_ASIC; - for (edata = 0, i = 0; i < 16; i++) { - edata = edata << 1; - ee16_eeprom_clock(sc, 1); - ectrl = inb(sc->port + IEE16_ECTRL); - if (ectrl & IEE16_ECTRL_EEDO) { - edata |= 1; - } - ee16_eeprom_clock(sc, 0); - } - return (edata); -} - -static void -ee16_eeprom_clock(struct ie_softc *sc, int state) -{ - int ectrl; - - ectrl = inb(sc->port + IEE16_ECTRL); - ectrl &= ~(IEE16_RESET_ASIC | IEE16_ECTRL_EESK); - if (state) { - ectrl |= IEE16_ECTRL_EESK; - } - outb(sc->port + IEE16_ECTRL, ectrl); - DELAY(9); /* EESK must be stable for 8.38 uSec */ -} - static __inline void ee16_interrupt_enable(struct ie_softc *sc) { From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 13:25:50 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7D5C3AB3; Sat, 16 Aug 2014 13:25:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 66B452B45; Sat, 16 Aug 2014 13:25:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7GDPom6042304; Sat, 16 Aug 2014 13:25:50 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7GDPoAK042303; Sat, 16 Aug 2014 13:25:50 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201408161325.s7GDPoAK042303@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 16 Aug 2014 13:25:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270049 - stable/10/usr.bin/netstat X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 13:25:50 -0000 Author: bz Date: Sat Aug 16 13:25:49 2014 New Revision: 270049 URL: http://svnweb.freebsd.org/changeset/base/270049 Log: MFC r261525: Print the MD5 signature information introduced in r221023 (head) in the TCP statistics output. Modified: stable/10/usr.bin/netstat/inet.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/netstat/inet.c ============================================================================== --- stable/10/usr.bin/netstat/inet.c Sat Aug 16 13:23:23 2014 (r270048) +++ stable/10/usr.bin/netstat/inet.c Sat Aug 16 13:25:49 2014 (r270049) @@ -723,6 +723,17 @@ tcp_stats(u_long off, const char *name, p(tcps_ecn_ect1, "\t%ju packet%s with ECN ECT(1) bit set\n"); p(tcps_ecn_shs, "\t%ju successful ECN handshake%s\n"); p(tcps_ecn_rcwnd, "\t%ju time%s ECN reduced the congestion window\n"); + + p(tcps_sig_rcvgoodsig, + "\t%ju packet%s with valid tcp-md5 signature received\n"); + p(tcps_sig_rcvbadsig, + "\t%ju packet%s with invalid tcp-md5 signature received\n"); + p(tcps_sig_err_buildsig, + "\t%ju packet%s with tcp-md5 signature mismatch\n"); + p(tcps_sig_err_sigopt, + "\t%ju packet%s with unexpected tcp-md5 signature received\n"); + p(tcps_sig_err_nosigopt, + "\t%ju packet%s without expected tcp-md5 signature received\n"); #undef p #undef p1a #undef p2 From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 13:47:05 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8F683D16; Sat, 16 Aug 2014 13:47:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 61F982D45; Sat, 16 Aug 2014 13:47:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7GDl55f051219; Sat, 16 Aug 2014 13:47:05 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7GDl5co051217; Sat, 16 Aug 2014 13:47:05 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201408161347.s7GDl5co051217@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 16 Aug 2014 13:47:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270050 - stable/10/sbin/route X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 13:47:05 -0000 Author: bz Date: Sat Aug 16 13:47:04 2014 New Revision: 270050 URL: http://svnweb.freebsd.org/changeset/base/270050 Log: MFC r264539: When switching variables to flags in r243185 a few cases were missed. After r263152 (in head) this leaves unused variables if route(8) is compiled without INET support. Switch the remaining variable accesses to flags and remove now obsolete variables. Reviewed by: glebius Modified: stable/10/sbin/route/route.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/route/route.c ============================================================================== --- stable/10/sbin/route/route.c Sat Aug 16 13:25:49 2014 (r270049) +++ stable/10/sbin/route/route.c Sat Aug 16 13:47:04 2014 (r270050) @@ -81,7 +81,7 @@ static struct keytab { static struct sockaddr_storage so[RTAX_MAX]; static int pid, rtm_addrs; static int s; -static int forcehost, forcenet, nflag, af, qflag, tflag; +static int nflag, af, qflag, tflag; static int verbose, aflen; static int locking, lockrest, debugonly; static struct rt_metrics rt_metrics; @@ -1235,7 +1235,7 @@ getaddr(int idx, char *str, struct hoste */ switch (idx) { case RTAX_DST: - forcenet++; + nrflags |= F_FORCENET; getaddr(RTAX_NETMASK, str, 0, nrflags); break; } @@ -1275,7 +1275,7 @@ getaddr(int idx, char *str, struct hoste if (!atalk_aton(str, &sat->sat_addr)) errx(EX_NOHOST, "bad address: %s", str); rtm_addrs |= RTA_NETMASK; - return(forcehost || sat->sat_addr.s_node != 0); + return(nrflags & F_FORCEHOST || sat->sat_addr.s_node != 0); } case AF_LINK: link_addr(str, (struct sockaddr_dl *)(void *)sa); @@ -1308,10 +1308,10 @@ getaddr(int idx, char *str, struct hoste } *q = '/'; } - if ((idx != RTAX_DST || forcenet == 0) && + if ((idx != RTAX_DST || (nrflags & F_FORCENET) == 0) && inet_aton(str, &sin->sin_addr)) { val = sin->sin_addr.s_addr; - if (idx != RTAX_DST || forcehost || + if (idx != RTAX_DST || nrflags & F_FORCEHOST || inet_lnaof(sin->sin_addr) != INADDR_ANY) return (1); else { @@ -1319,7 +1319,7 @@ getaddr(int idx, char *str, struct hoste goto netdone; } } - if (idx == RTAX_DST && forcehost == 0 && + if (idx == RTAX_DST && (nrflags & F_FORCEHOST) == 0 && ((val = inet_network(str)) != INADDR_NONE || ((np = getnetbyname(str)) != NULL && (val = np->n_net) != 0))) { netdone: From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 13:50:16 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1BEDDE5C; Sat, 16 Aug 2014 13:50:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EFDA62D59; Sat, 16 Aug 2014 13:50:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7GDoFaP051715; Sat, 16 Aug 2014 13:50:15 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7GDoFj3051712; Sat, 16 Aug 2014 13:50:15 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201408161350.s7GDoFj3051712@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 16 Aug 2014 13:50:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270051 - in stable/10/sys: dev/cxgbe/tom netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 13:50:16 -0000 Author: bz Date: Sat Aug 16 13:50:15 2014 New Revision: 270051 URL: http://svnweb.freebsd.org/changeset/base/270051 Log: MFC r266596: Move the tcp_fields_to_host() and tcp_fields_to_net() (inline) functions to the tcp_var.h header file in order to avoid further duplication with upcoming commits. Reviewed by: np Modified: stable/10/sys/dev/cxgbe/tom/t4_listen.c stable/10/sys/netinet/tcp_input.c stable/10/sys/netinet/tcp_var.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/tom/t4_listen.c ============================================================================== --- stable/10/sys/dev/cxgbe/tom/t4_listen.c Sat Aug 16 13:47:04 2014 (r270050) +++ stable/10/sys/dev/cxgbe/tom/t4_listen.c Sat Aug 16 13:50:15 2014 (r270051) @@ -1052,17 +1052,6 @@ calc_opt2p(struct adapter *sc, struct po return htobe32(opt2); } -/* XXX: duplication. */ -static inline void -tcp_fields_to_host(struct tcphdr *th) -{ - - th->th_seq = ntohl(th->th_seq); - th->th_ack = ntohl(th->th_ack); - th->th_win = ntohs(th->th_win); - th->th_urp = ntohs(th->th_urp); -} - static void pass_accept_req_to_protohdrs(const struct mbuf *m, struct in_conninfo *inc, struct tcphdr *th) Modified: stable/10/sys/netinet/tcp_input.c ============================================================================== --- stable/10/sys/netinet/tcp_input.c Sat Aug 16 13:47:04 2014 (r270050) +++ stable/10/sys/netinet/tcp_input.c Sat Aug 16 13:50:15 2014 (r270051) @@ -455,27 +455,7 @@ cc_post_recovery(struct tcpcb *tp, struc tp->t_bytes_acked = 0; } -static inline void -tcp_fields_to_host(struct tcphdr *th) -{ - - th->th_seq = ntohl(th->th_seq); - th->th_ack = ntohl(th->th_ack); - th->th_win = ntohs(th->th_win); - th->th_urp = ntohs(th->th_urp); -} - #ifdef TCP_SIGNATURE -static inline void -tcp_fields_to_net(struct tcphdr *th) -{ - - th->th_seq = htonl(th->th_seq); - th->th_ack = htonl(th->th_ack); - th->th_win = htons(th->th_win); - th->th_urp = htons(th->th_urp); -} - static inline int tcp_signature_verify_input(struct mbuf *m, int off0, int tlen, int optlen, struct tcpopt *to, struct tcphdr *th, u_int tcpbflag) Modified: stable/10/sys/netinet/tcp_var.h ============================================================================== --- stable/10/sys/netinet/tcp_var.h Sat Aug 16 13:47:04 2014 (r270050) +++ stable/10/sys/netinet/tcp_var.h Sat Aug 16 13:50:15 2014 (r270051) @@ -736,6 +736,27 @@ u_long tcp_seq_subtract(u_long, u_long void cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, uint32_t type); +static inline void +tcp_fields_to_host(struct tcphdr *th) +{ + + th->th_seq = ntohl(th->th_seq); + th->th_ack = ntohl(th->th_ack); + th->th_win = ntohs(th->th_win); + th->th_urp = ntohs(th->th_urp); +} + +#ifdef TCP_SIGNATURE +static inline void +tcp_fields_to_net(struct tcphdr *th) +{ + + th->th_seq = htonl(th->th_seq); + th->th_ack = htonl(th->th_ack); + th->th_win = htons(th->th_win); + th->th_urp = htons(th->th_urp); +} +#endif #endif /* _KERNEL */ #endif /* _NETINET_TCP_VAR_H_ */ From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 13:53:05 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 99539FAE; Sat, 16 Aug 2014 13:53:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 84AC92E1C; Sat, 16 Aug 2014 13:53:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7GDr51p055211; Sat, 16 Aug 2014 13:53:05 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7GDr5RC055210; Sat, 16 Aug 2014 13:53:05 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201408161353.s7GDr5RC055210@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 16 Aug 2014 13:53:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270052 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 13:53:05 -0000 Author: bz Date: Sat Aug 16 13:53:05 2014 New Revision: 270052 URL: http://svnweb.freebsd.org/changeset/base/270052 Log: MFC r266597: Remove the prototypes for things that are no longer file local but were moved to the header file. Was suppoed to be MFCed with: r266596 Pointy hat to: bz Modified: stable/10/sys/netinet/tcp_input.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/tcp_input.c ============================================================================== --- stable/10/sys/netinet/tcp_input.c Sat Aug 16 13:50:15 2014 (r270051) +++ stable/10/sys/netinet/tcp_input.c Sat Aug 16 13:53:05 2014 (r270052) @@ -229,9 +229,7 @@ static void tcp_pulloutofband(struct so struct tcphdr *, struct mbuf *, int); static void tcp_xmit_timer(struct tcpcb *, int); static void tcp_newreno_partial_ack(struct tcpcb *, struct tcphdr *); -static void inline tcp_fields_to_host(struct tcphdr *); #ifdef TCP_SIGNATURE -static void inline tcp_fields_to_net(struct tcphdr *); static int inline tcp_signature_verify_input(struct mbuf *, int, int, int, struct tcpopt *, struct tcphdr *, u_int); #endif From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 13:55:44 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AAB4D341; Sat, 16 Aug 2014 13:55:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7BD212E3A; Sat, 16 Aug 2014 13:55:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7GDtiRE055858; Sat, 16 Aug 2014 13:55:44 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7GDtiBk055857; Sat, 16 Aug 2014 13:55:44 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201408161355.s7GDtiBk055857@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 16 Aug 2014 13:55:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270053 - stable/10/sys/netipsec X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 13:55:44 -0000 Author: bz Date: Sat Aug 16 13:55:44 2014 New Revision: 270053 URL: http://svnweb.freebsd.org/changeset/base/270053 Log: MFC r266606: Only do a ports check if this is a NAT-T SA. Otherwise other lookups providing ports may get unexpected results. Modified: stable/10/sys/netipsec/key.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netipsec/key.c ============================================================================== --- stable/10/sys/netipsec/key.c Sat Aug 16 13:53:05 2014 (r270052) +++ stable/10/sys/netipsec/key.c Sat Aug 16 13:55:44 2014 (r270053) @@ -1085,7 +1085,9 @@ key_allocsa( struct secasvar *sav; u_int stateidx, arraysize, state; const u_int *saorder_state_valid; - int chkport; +#ifdef IPSEC_NAT_T + int natt_chkport; +#endif IPSEC_ASSERT(dst != NULL, ("null dst address")); @@ -1093,11 +1095,9 @@ key_allocsa( printf("DP %s from %s:%u\n", __func__, where, tag)); #ifdef IPSEC_NAT_T - chkport = (dst->sa.sa_family == AF_INET && + natt_chkport = (dst->sa.sa_family == AF_INET && dst->sa.sa_len == sizeof(struct sockaddr_in) && dst->sin.sin_port != 0); -#else - chkport = 0; #endif /* @@ -1115,6 +1115,8 @@ key_allocsa( arraysize = _ARRAYLEN(saorder_state_valid_prefer_new); } LIST_FOREACH(sah, &V_sahtree, chain) { + int checkport; + /* search valid state */ for (stateidx = 0; stateidx < arraysize; stateidx++) { state = saorder_state_valid[stateidx]; @@ -1129,13 +1131,25 @@ key_allocsa( continue; if (spi != sav->spi) continue; + checkport = 0; +#ifdef IPSEC_NAT_T + /* + * Really only check ports when this is a NAT-T + * SA. Otherwise other lookups providing ports + * might suffer. + */ + if (sav->natt_type && natt_chkport) + checkport = 1; +#endif #if 0 /* don't check src */ /* check src address */ - if (key_sockaddrcmp(&src->sa, &sav->sah->saidx.src.sa, chkport) != 0) + if (key_sockaddrcmp(&src->sa, + &sav->sah->saidx.src.sa, checkport) != 0) continue; #endif /* check dst address */ - if (key_sockaddrcmp(&dst->sa, &sav->sah->saidx.dst.sa, chkport) != 0) + if (key_sockaddrcmp(&dst->sa, + &sav->sah->saidx.dst.sa, checkport) != 0) continue; sa_addref(sav); goto done; From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 13:58:46 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 712FC4BB; Sat, 16 Aug 2014 13:58:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5C8462E53; Sat, 16 Aug 2014 13:58:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7GDwk3s056258; Sat, 16 Aug 2014 13:58:46 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7GDwkM9056256; Sat, 16 Aug 2014 13:58:46 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201408161358.s7GDwkM9056256@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 16 Aug 2014 13:58:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270054 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 13:58:46 -0000 Author: bz Date: Sat Aug 16 13:58:45 2014 New Revision: 270054 URL: http://svnweb.freebsd.org/changeset/base/270054 Log: MFC r266618: Make tcp_twrespond() file local private; this removes it from the public KPI; it is not used anywhere else and seems it never was. Modified: stable/10/sys/netinet/tcp_timewait.c stable/10/sys/netinet/tcp_var.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/tcp_timewait.c ============================================================================== --- stable/10/sys/netinet/tcp_timewait.c Sat Aug 16 13:55:44 2014 (r270053) +++ stable/10/sys/netinet/tcp_timewait.c Sat Aug 16 13:58:45 2014 (r270054) @@ -105,6 +105,7 @@ static VNET_DEFINE(TAILQ_HEAD(, tcptw), static void tcp_tw_2msl_reset(struct tcptw *, int); static void tcp_tw_2msl_stop(struct tcptw *); +static int tcp_twrespond(struct tcptw *, int); static int tcptw_auto_size(void) @@ -501,7 +502,7 @@ tcp_twclose(struct tcptw *tw, int reuse) uma_zfree(V_tcptw_zone, tw); } -int +static int tcp_twrespond(struct tcptw *tw, int flags) { struct inpcb *inp = tw->tw_inpcb; Modified: stable/10/sys/netinet/tcp_var.h ============================================================================== --- stable/10/sys/netinet/tcp_var.h Sat Aug 16 13:55:44 2014 (r270053) +++ stable/10/sys/netinet/tcp_var.h Sat Aug 16 13:58:45 2014 (r270054) @@ -695,7 +695,6 @@ void tcp_tw_destroy(void); void tcp_tw_zone_change(void); int tcp_twcheck(struct inpcb *, struct tcpopt *, struct tcphdr *, struct mbuf *, int); -int tcp_twrespond(struct tcptw *, int); void tcp_setpersist(struct tcpcb *); #ifdef TCP_SIGNATURE int tcp_signature_compute(struct mbuf *, int, int, int, u_char *, u_int); From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 14:03:01 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EE835618; Sat, 16 Aug 2014 14:03:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D9B842FD5; Sat, 16 Aug 2014 14:03:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7GE30mK060091; Sat, 16 Aug 2014 14:03:00 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7GE30ft060090; Sat, 16 Aug 2014 14:03:00 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201408161403.s7GE30ft060090@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 16 Aug 2014 14:03:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270055 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 14:03:01 -0000 Author: bz Date: Sat Aug 16 14:03:00 2014 New Revision: 270055 URL: http://svnweb.freebsd.org/changeset/base/270055 Log: MFC r266619: syncache_lookup() is a file local function. Make it static and take it out of the public KPI; seems it was never used elsewhere. Modified: stable/10/sys/netinet/tcp_syncache.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/tcp_syncache.c ============================================================================== --- stable/10/sys/netinet/tcp_syncache.c Sat Aug 16 13:58:45 2014 (r270054) +++ stable/10/sys/netinet/tcp_syncache.c Sat Aug 16 14:03:00 2014 (r270055) @@ -121,7 +121,6 @@ SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, static void syncache_drop(struct syncache *, struct syncache_head *); static void syncache_free(struct syncache *); static void syncache_insert(struct syncache *, struct syncache_head *); -struct syncache *syncache_lookup(struct in_conninfo *, struct syncache_head **); static int syncache_respond(struct syncache *); static struct socket *syncache_socket(struct syncache *, struct socket *, struct mbuf *m); @@ -492,7 +491,7 @@ syncache_timer(void *xsch) * Find an entry in the syncache. * Returns always with locked syncache_head plus a matching entry or NULL. */ -struct syncache * +static struct syncache * syncache_lookup(struct in_conninfo *inc, struct syncache_head **schp) { struct syncache *sc; From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 14:05:31 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D8C7379B; Sat, 16 Aug 2014 14:05:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B09D92FF2; Sat, 16 Aug 2014 14:05:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7GE5VQc060471; Sat, 16 Aug 2014 14:05:31 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7GE5VLh060470; Sat, 16 Aug 2014 14:05:31 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201408161405.s7GE5VLh060470@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 16 Aug 2014 14:05:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270056 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 14:05:32 -0000 Author: bz Date: Sat Aug 16 14:05:31 2014 New Revision: 270056 URL: http://svnweb.freebsd.org/changeset/base/270056 Log: MFC r266620: Remove the prototpye for the static inline function tcp_signature_verify_input(). The function is defined before first use already. Modified: stable/10/sys/netinet/tcp_input.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/tcp_input.c ============================================================================== --- stable/10/sys/netinet/tcp_input.c Sat Aug 16 14:03:00 2014 (r270055) +++ stable/10/sys/netinet/tcp_input.c Sat Aug 16 14:05:31 2014 (r270056) @@ -229,10 +229,6 @@ static void tcp_pulloutofband(struct so struct tcphdr *, struct mbuf *, int); static void tcp_xmit_timer(struct tcpcb *, int); static void tcp_newreno_partial_ack(struct tcpcb *, struct tcphdr *); -#ifdef TCP_SIGNATURE -static int inline tcp_signature_verify_input(struct mbuf *, int, int, - int, struct tcpopt *, struct tcphdr *, u_int); -#endif static void inline cc_ack_received(struct tcpcb *tp, struct tcphdr *th, uint16_t type); static void inline cc_conn_init(struct tcpcb *tp); From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 14:09:26 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CBE469C4; Sat, 16 Aug 2014 14:09:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B73802023; Sat, 16 Aug 2014 14:09:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7GE9QQ8060979; Sat, 16 Aug 2014 14:09:26 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7GE9QJ0060978; Sat, 16 Aug 2014 14:09:26 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201408161409.s7GE9QJ0060978@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 16 Aug 2014 14:09:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270057 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 14:09:26 -0000 Author: bz Date: Sat Aug 16 14:09:26 2014 New Revision: 270057 URL: http://svnweb.freebsd.org/changeset/base/270057 Log: MFC r266907: While PAWS is disabled, there are no consumers for the tcp options argument to tcp_twcheck(); thus mark it __unused. Modified: stable/10/sys/netinet/tcp_timewait.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/tcp_timewait.c ============================================================================== --- stable/10/sys/netinet/tcp_timewait.c Sat Aug 16 14:05:31 2014 (r270056) +++ stable/10/sys/netinet/tcp_timewait.c Sat Aug 16 14:09:26 2014 (r270057) @@ -350,7 +350,7 @@ tcp_twrecycleable(struct tcptw *tw) * looking for a pcb in the listen state. Returns 0 otherwise. */ int -tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th, +tcp_twcheck(struct inpcb *inp, struct tcpopt *to __unused, struct tcphdr *th, struct mbuf *m, int tlen) { struct tcptw *tw; From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 14:14:30 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7BE22B3F; Sat, 16 Aug 2014 14:14:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4D4EE20BF; Sat, 16 Aug 2014 14:14:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7GEEUZh064829; Sat, 16 Aug 2014 14:14:30 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7GEEUSb064828; Sat, 16 Aug 2014 14:14:30 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201408161414.s7GEEUSb064828@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 16 Aug 2014 14:14:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270058 - stable/10/sys/mips/beri X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 14:14:30 -0000 Author: bz Date: Sat Aug 16 14:14:29 2014 New Revision: 270058 URL: http://svnweb.freebsd.org/changeset/base/270058 Log: MFC r264605: Based on xlp_machdep.c and completed the list of options based on boot/mips/beri/loader/metadata.c allow FDT configuration to set command line options. This leads to an interesting quesiton of future interactions with loader. However for configurations without loader this allows bootverbose or boot single user to be set by compiling a new kernel, which is good enough for testing and debugging. Reviewed by: rwatson Sponsored by: DARPA/AFRL Modified: stable/10/sys/mips/beri/beri_machdep.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/mips/beri/beri_machdep.c ============================================================================== --- stable/10/sys/mips/beri/beri_machdep.c Sat Aug 16 14:09:26 2014 (r270057) +++ stable/10/sys/mips/beri/beri_machdep.c Sat Aug 16 14:14:29 2014 (r270058) @@ -131,6 +131,46 @@ platform_reset(void) __asm__ __volatile("wait"); } +#ifdef FDT +/* Parse cmd line args as env - copied from xlp_machdep. */ +/* XXX-BZ this should really be centrally provided for all (boot) code. */ +static void +_parse_bootargs(char *cmdline) +{ + char *n, *v; + + while ((v = strsep(&cmdline, " \n")) != NULL) { + if (*v == '\0') + continue; + if (*v == '-') { + while (*v != '\0') { + v++; + switch (*v) { + case 'a': boothowto |= RB_ASKNAME; break; + /* Someone should simulate that ;-) */ + case 'C': boothowto |= RB_CDROM; break; + case 'd': boothowto |= RB_KDB; break; + case 'D': boothowto |= RB_MULTIPLE; break; + case 'm': boothowto |= RB_MUTE; break; + case 'g': boothowto |= RB_GDB; break; + case 'h': boothowto |= RB_SERIAL; break; + case 'p': boothowto |= RB_PAUSE; break; + case 'r': boothowto |= RB_DFLTROOT; break; + case 's': boothowto |= RB_SINGLE; break; + case 'v': boothowto |= RB_VERBOSE; break; + } + } + } else { + n = strsep(&v, "="); + if (v == NULL) + setenv(n, "1"); + else + setenv(n, v); + } + } +} +#endif + void platform_start(__register_t a0, __register_t a1, __register_t a2, __register_t a3) @@ -142,7 +182,9 @@ platform_start(__register_t a0, __regist char **envp = (char **)a2; unsigned int memsize = a3; #ifdef FDT + char buf[2048]; /* early stack supposedly big enough */ vm_offset_t dtbp; + phandle_t chosen; void *kmdp; #endif int i; @@ -180,6 +222,13 @@ platform_start(__register_t a0, __regist while (1); if (OF_init((void *)dtbp) != 0) while (1); + + /* + * Get bootargs from FDT if specified. + */ + chosen = OF_finddevice("/chosen"); + if (OF_getprop(chosen, "bootargs", buf, sizeof(buf)) != -1) + _parse_bootargs(buf); #endif /* From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 14:17:10 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8C76AC8D; Sat, 16 Aug 2014 14:17:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 77B4820D9; Sat, 16 Aug 2014 14:17:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7GEHAwA065320; Sat, 16 Aug 2014 14:17:10 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7GEHAfM065319; Sat, 16 Aug 2014 14:17:10 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201408161417.s7GEHAfM065319@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 16 Aug 2014 14:17:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270059 - stable/10/sys/dev/altera/atse X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 14:17:10 -0000 Author: bz Date: Sat Aug 16 14:17:09 2014 New Revision: 270059 URL: http://svnweb.freebsd.org/changeset/base/270059 Log: MFC r264542: Use ETHER_ALIGN as argument to m_adj() to offset the beginning of packet rather than the magic number 2. While here fix a typo in a comment. No functional changes. Sponsored by: DARPA/AFRL Modified: stable/10/sys/dev/altera/atse/if_atse.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/altera/atse/if_atse.c ============================================================================== --- stable/10/sys/dev/altera/atse/if_atse.c Sat Aug 16 14:14:29 2014 (r270058) +++ stable/10/sys/dev/altera/atse/if_atse.c Sat Aug 16 14:17:09 2014 (r270059) @@ -1179,7 +1179,7 @@ outer: return (rx_npkts); m->m_len = m->m_pkthdr.len = MCLBYTES; /* Make sure upper layers will be aligned. */ - m_adj(m, 2); + m_adj(m, ETHER_ALIGN); sc->atse_rx_m = m; } @@ -1815,7 +1815,7 @@ atse_detach(device_t dev) return (0); } -/* Shared between nexus anf fdt implementation. */ +/* Shared between nexus and fdt implementation. */ void atse_detach_resources(device_t dev) { From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 14:21:04 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 31D39DD6; Sat, 16 Aug 2014 14:21:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 02C892162; Sat, 16 Aug 2014 14:21:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7GEL3sB066307; Sat, 16 Aug 2014 14:21:03 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7GEL3UE066305; Sat, 16 Aug 2014 14:21:03 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201408161421.s7GEL3UE066305@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 16 Aug 2014 14:21:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270060 - in stable/10/sys: boot/fdt/dts/mips mips/conf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 14:21:04 -0000 Author: bz Date: Sat Aug 16 14:21:03 2014 New Revision: 270060 URL: http://svnweb.freebsd.org/changeset/base/270060 Log: MFC r263632: For BERI on NetFPGA assume HZ=100 by default. Remove the uart support in favour of a "jtag-uart" interface imitation providing a much simpler interface, directly exported to the host, allowing the toolchain to be shared with BERI on Altera. [1] Submitted by: Jong Hun HAN (jong.han cl.cam.ac.uk) [1] Sponsored by: DARPA/AFRL Modified: stable/10/sys/boot/fdt/dts/mips/beri-netfpga.dts stable/10/sys/mips/conf/BERI_NETFPGA_MDROOT Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/boot/fdt/dts/mips/beri-netfpga.dts ============================================================================== --- stable/10/sys/boot/fdt/dts/mips/beri-netfpga.dts Sat Aug 16 14:17:09 2014 (r270059) +++ stable/10/sys/boot/fdt/dts/mips/beri-netfpga.dts Sat Aug 16 14:21:03 2014 (r270060) @@ -113,6 +113,14 @@ soft-interrupt-sources = <64>; }; + serial0: serial@7f000000 { + compatible = "altera,jtag_uart-11_0"; + reg = <0x7f000000 0x40>; + interrupts = <0>; + interrupt-parent = <&beripic>; + }; + +/* serial0: serial@7f002100 { compatible = "ns16550"; reg = <0x7f002100 0x20>; @@ -121,6 +129,7 @@ interrupts = <8>; interrupt-parent = <&beripic>; }; +*/ }; aliases { Modified: stable/10/sys/mips/conf/BERI_NETFPGA_MDROOT ============================================================================== --- stable/10/sys/mips/conf/BERI_NETFPGA_MDROOT Sat Aug 16 14:17:09 2014 (r270059) +++ stable/10/sys/mips/conf/BERI_NETFPGA_MDROOT Sat Aug 16 14:21:03 2014 (r270060) @@ -10,11 +10,14 @@ include "BERI_TEMPLATE" ident BERI_NETFPGA_MDROOT +options HZ=100 + options FDT options FDT_DTB_STATIC makeoptions FDT_DTS_FILE=beri-netfpga.dts -device uart +#device uart +device altera_jtag_uart # # This kernel configuration uses an embedded memory root file system. From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 14:30:49 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0EC3AF9B; Sat, 16 Aug 2014 14:30:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA6062221; Sat, 16 Aug 2014 14:30:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7GEUmBQ072820; Sat, 16 Aug 2014 14:30:48 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7GEUlN4072809; Sat, 16 Aug 2014 14:30:47 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201408161430.s7GEUlN4072809@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 16 Aug 2014 14:30:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270061 - in stable/10: share/man/man4 sys/boot/fdt/dts/mips sys/dev/netfpga10g sys/dev/netfpga10g/nf10bmac sys/mips/beri sys/mips/conf sys/modules sys/modules/netfpga10g X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 14:30:49 -0000 Author: bz Date: Sat Aug 16 14:30:46 2014 New Revision: 270061 URL: http://svnweb.freebsd.org/changeset/base/270061 Log: MFC r264601,264646,265766,267918,267919,267920: Merge if_nf10bmac(4), a driver to support an NetFPGA-10G Embedded CPU Ethernet Core. The current version operates on a simple PIO based interface connected to a NetFPGA-10G port. To avoid confusion: this driver operates on a CPU running on the FPGA, e.g. BERI/mips, and is not suited for the PCI host interface. Adjust the register layout to allow for 64bit registers in the future for nf10bmac(4). Also, add support for and enable RX interrupts. Allow switching between 32bit and 64bit bus width data access at compile time by setting NF10BMAC_64BIT and using a REGWTYPE #define to set correct variable and return value widths. Adjust comments to indicate the 32 or 64bit register widths. Relnotes: yes Sponsored by: DARPA/AFRL Added: stable/10/share/man/man4/netfpga10g_nf10bmac.4 - copied unchanged from r264601, head/share/man/man4/netfpga10g_nf10bmac.4 stable/10/sys/dev/netfpga10g/ - copied from r264601, head/sys/dev/netfpga10g/ stable/10/sys/modules/netfpga10g/ - copied from r264601, head/sys/modules/netfpga10g/ Modified: stable/10/share/man/man4/Makefile stable/10/sys/boot/fdt/dts/mips/beri-netfpga.dts stable/10/sys/dev/netfpga10g/nf10bmac/if_nf10bmac.c stable/10/sys/dev/netfpga10g/nf10bmac/if_nf10bmac_fdt.c stable/10/sys/dev/netfpga10g/nf10bmac/if_nf10bmacreg.h stable/10/sys/mips/beri/files.beri stable/10/sys/mips/conf/BERI_NETFPGA_MDROOT stable/10/sys/modules/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/Makefile ============================================================================== --- stable/10/share/man/man4/Makefile Sat Aug 16 14:21:03 2014 (r270060) +++ stable/10/share/man/man4/Makefile Sat Aug 16 14:30:46 2014 (r270061) @@ -282,6 +282,7 @@ MAN= aac.4 \ ncv.4 \ ${_ndis.4} \ net80211.4 \ + netfpga10g_nf10bmac.4 \ netgraph.4 \ netintro.4 \ netmap.4 \ @@ -678,6 +679,7 @@ MLINKS+=mwl.4 if_mwl.4 MLINKS+=mxge.4 if_mxge.4 MLINKS+=my.4 if_my.4 MLINKS+=${_ndis.4} ${_if_ndis.4} +MLINKS+=netfpga10g_nf10bmac.4 if_nf10bmac.4 MLINKS+=netintro.4 net.4 \ netintro.4 networking.4 MLINKS+=${_nfe.4} ${_if_nfe.4} Copied: stable/10/share/man/man4/netfpga10g_nf10bmac.4 (from r264601, head/share/man/man4/netfpga10g_nf10bmac.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/share/man/man4/netfpga10g_nf10bmac.4 Sat Aug 16 14:30:46 2014 (r270061, copy of r264601, head/share/man/man4/netfpga10g_nf10bmac.4) @@ -0,0 +1,70 @@ +.\"- +.\" Copyright (c) 2014 Bjoern A. Zeeb +.\" All rights reserved. +.\" +.\" This software was developed by SRI International and the University of +.\" Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-11-C-0249 +.\" ("MRC2"), as part of the DARPA MRC research programme. +.\" +.\" 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$ +.\" +.Dd April 17, 2014 +.Dt NETFPGA10G_NF10BMAC 4 +.Os +.Sh NAME +.Nm netfpga10g_nf10bmac +.Nd driver for the NetFPGA-10G Embedded CPU Ethernet Core +.Sh SYNOPSIS +.Cd "device netfpga10g_nf10bmac" +.Sh DESCRIPTION +The +.Nm +device driver provides support for the NetFPGA-10G Embedded CPU Ethernet +Core. +.Sh HARDWARE +The current version of the +.Nm +driver works with one PIO mode interface of the +NetFPGA-10G Embedded CPU Ethernet Core version 1.00a. +.Sh SEE ALSO +.Xr netintro 4 , +.Xr ifconfig 8 +.Rs +.%T NetFPGA-10G Wiki +.%U https://github.com/NetFPGA/NetFPGA-public/wiki +.Re +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 11.0 . +.Sh AUTHORS +This software and this manual page were +developed by SRI International and the University of Cambridge Computer +Laboratory under DARPA/AFRL contract +.Pq FA8750-11-C-0249 +.Pq Do MRC2 Dc , +as part of the DARPA MRC research programme. +The device driver was written by +.An Bjoern A. Zeeb . Modified: stable/10/sys/boot/fdt/dts/mips/beri-netfpga.dts ============================================================================== --- stable/10/sys/boot/fdt/dts/mips/beri-netfpga.dts Sat Aug 16 14:21:03 2014 (r270060) +++ stable/10/sys/boot/fdt/dts/mips/beri-netfpga.dts Sat Aug 16 14:30:46 2014 (r270061) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2012-2013 Robert N. M. Watson * Copyright (c) 2013 SRI International - * Copyright (c) 2013 Bjoern A. Zeeb + * Copyright (c) 2013-2014 Bjoern A. Zeeb * All rights reserved. * * This software was developed by SRI International and the University of @@ -130,6 +130,18 @@ interrupt-parent = <&beripic>; }; */ + + ethernet@7f005000 { + compatible = "netfpag10g,nf10bmac"; + // LOOP, TX, RX, INTR + reg = <0x7f005000 0x20 + 0x7f005020 0x30 + 0x7f005050 0x30 + 0x7f005100 0x10>; + // RX + interrupts = <1>; + interrupt-parent = <&beripic>; + }; }; aliases { Modified: stable/10/sys/dev/netfpga10g/nf10bmac/if_nf10bmac.c ============================================================================== --- head/sys/dev/netfpga10g/nf10bmac/if_nf10bmac.c Thu Apr 17 12:33:26 2014 (r264601) +++ stable/10/sys/dev/netfpga10g/nf10bmac/if_nf10bmac.c Sat Aug 16 14:30:46 2014 (r270061) @@ -92,13 +92,15 @@ static poll_handler_t nf10bmac_poll; #define NF10BMAC_LOCK_ASSERT(_sc) \ mtx_assert(&(_sc)->nf10bmac_mtx, MA_OWNED) -#define NF10BMAC_TX_LEN 0x08 -#define NF10BMAC_TX_META 0x04 +#define NF10BMAC_CTRL0 0x00 #define NF10BMAC_TX_DATA 0x00 -#define NF10BMAC_RX_LEN 0x08 -#define NF10BMAC_RX_META 0x04 +#define NF10BMAC_TX_META 0x08 +#define NF10BMAC_TX_LEN 0x10 #define NF10BMAC_RX_DATA 0x00 -#define NF10BMAC_CTRL0 0x00 +#define NF10BMAC_RX_META 0x08 +#define NF10BMAC_RX_LEN 0x10 +#define NF10BMAC_INTR_CLEAR_DIS 0x00 +#define NF10BMAC_INTR_CTRL 0x08 #define NF10BMAC_TUSER_MAC0 (1 << 0) #define NF10BMAC_TUSER_CPU0 (1 << 1) @@ -109,63 +111,101 @@ static poll_handler_t nf10bmac_poll; #define NF10BMAC_TUSER_MAC3 (1 << 6) #define NF10BMAC_TUSER_CPU3 (1 << 7) +#define NF10BMAC_DATA_LEN_MASK 0x0000ffff #define NF10BMAC_DATA_DPORT_MASK 0xff000000 #define NF10BMAC_DATA_DPORT_SHIFT 24 #define NF10BMAC_DATA_SPORT_MASK 0x00ff0000 #define NF10BMAC_DATA_SPORT_SHIFT 16 -#define NF10BMAC_DATA_LAST 0x00000080 +#define NF10BMAC_DATA_LAST 0x00008000 +#ifdef NF10BMAC_64BIT +#define NF10BMAC_DATA_STRB 0x000000ff +#define REGWTYPE uint64_t +#else #define NF10BMAC_DATA_STRB 0x0000000f +#define REGWTYPE uint32_t +#endif static inline void -nf10bmac_write_4(struct resource *res, uint32_t reg, uint32_t val4, +nf10bmac_write(struct resource *res, REGWTYPE reg, REGWTYPE val, const char *f __unused, const int l __unused) { - bus_write_4(res, reg, htole32(val4)); +#ifdef NF10BMAC_64BIT + bus_write_8(res, reg, htole64(val)); +#else + bus_write_4(res, reg, htole32(val)); +#endif } -static inline uint32_t -nf10bmac_read_4(struct resource *res, uint32_t reg, +static inline REGWTYPE +nf10bmac_read(struct resource *res, REGWTYPE reg, const char *f __unused, const int l __unused) { +#ifdef NF10BMAC_64BIT + return (le64toh(bus_read_8(res, reg))); +#else return (le32toh(bus_read_4(res, reg))); +#endif } static inline void -nf10bmac_write_4_be(struct resource *res, uint32_t reg, uint32_t val4, +nf10bmac_write_be(struct resource *res, REGWTYPE reg, REGWTYPE val, const char *f __unused, const int l __unused) { - bus_write_4(res, reg, htobe32(val4)); +#ifdef NF10BMAC_64BIT + bus_write_8(res, reg, htobe64(val)); +#else + bus_write_4(res, reg, htobe32(val)); +#endif } -static inline uint32_t -nf10bmac_read_4_be(struct resource *res, uint32_t reg, +static inline REGWTYPE +nf10bmac_read_be(struct resource *res, REGWTYPE reg, const char *f __unused, const int l __unused) { +#ifdef NF10BMAC_64BIT + return (be64toh(bus_read_8(res, reg))); +#else return (be32toh(bus_read_4(res, reg))); +#endif } -#define NF10BMAC_WRITE_CTRL_4(sc, reg, val) \ - nf10bmac_write_4((sc)->nf10bmac_mem_res, (reg), (val), \ +#define NF10BMAC_WRITE_CTRL(sc, reg, val) \ + nf10bmac_write((sc)->nf10bmac_ctrl_res, (reg), (val), \ __func__, __LINE__) -#define NF10BMAC_WRITE_4(sc, reg, val) \ - nf10bmac_write_4((sc)->nf10bmac_tx_mem_res, (reg), (val), \ +#define NF10BMAC_WRITE(sc, reg, val) \ + nf10bmac_write((sc)->nf10bmac_tx_mem_res, (reg), (val), \ __func__, __LINE__) -#define NF10BMAC_READ_4(sc, reg) \ - nf10bmac_read_4((sc)->nf10bmac_rx_mem_res, (reg), \ +#define NF10BMAC_READ(sc, reg) \ + nf10bmac_read((sc)->nf10bmac_rx_mem_res, (reg), \ __func__, __LINE__) -#define NF10BMAC_WRITE_4_BE(sc, reg, val) \ - nf10bmac_write_4_be((sc)->nf10bmac_tx_mem_res, (reg), (val), \ +#define NF10BMAC_WRITE_BE(sc, reg, val) \ + nf10bmac_write_be((sc)->nf10bmac_tx_mem_res, (reg), (val), \ __func__, __LINE__) -#define NF10BMAC_READ_4_BE(sc, reg) \ - nf10bmac_read_4_be((sc)->nf10bmac_rx_mem_res, (reg), \ +#define NF10BMAC_READ_BE(sc, reg) \ + nf10bmac_read_be((sc)->nf10bmac_rx_mem_res, (reg), \ __func__, __LINE__) +#define NF10BMAC_WRITE_INTR(sc, reg, val, _f, _l) \ + nf10bmac_write((sc)->nf10bmac_intr_res, (reg), (val), \ + (_f), (_l)) + +#define NF10BMAC_RX_INTR_CLEAR_DIS(sc) \ + NF10BMAC_WRITE_INTR((sc), NF10BMAC_INTR_CLEAR_DIS, 1, \ + __func__, __LINE__) +#define NF10BMAC_RX_INTR_ENABLE(sc) \ + NF10BMAC_WRITE_INTR((sc), NF10BMAC_INTR_CTRL, 1, \ + __func__, __LINE__) +#define NF10BMAC_RX_INTR_DISABLE(sc) \ + NF10BMAC_WRITE_INTR((sc), NF10BMAC_INTR_CTRL, 0, \ + __func__, __LINE__) + + #ifdef ENABLE_WATCHDOG static void nf10bmac_tick(void *); #endif @@ -178,7 +218,7 @@ static int nf10bmac_tx_locked(struct nf10bmac_softc *sc, struct mbuf *m) { int32_t len, l, ml; - uint32_t m4, val4; + REGWTYPE md, val; NF10BMAC_LOCK_ASSERT(sc); @@ -193,16 +233,16 @@ nf10bmac_tx_locked(struct nf10bmac_softc len = m->m_pkthdr.len; /* Write the length at start of packet. */ - NF10BMAC_WRITE_4(sc, NF10BMAC_TX_LEN, len); + NF10BMAC_WRITE(sc, NF10BMAC_TX_LEN, len); /* Write the meta data and data. */ - ml = len / sizeof(val4); - len -= (ml * sizeof(val4)); + ml = len / sizeof(val); + len -= (ml * sizeof(val)); for (l = 0; l <= ml; l++) { int32_t cl; - cl = sizeof(val4); - m4 = (NF10BMAC_TUSER_CPU0 << NF10BMAC_DATA_SPORT_SHIFT); + cl = sizeof(val); + md = (NF10BMAC_TUSER_CPU0 << NF10BMAC_DATA_SPORT_SHIFT); if (l == ml || (len == 0 && l == (ml - 1))) { if (l == ml && len == 0) { break; @@ -211,20 +251,20 @@ nf10bmac_tx_locked(struct nf10bmac_softc int sl; if (l == (ml - 1)) - len = 4; + len = sizeof(val); cl = len; for (s = 0, sl = len; sl > 0; sl--) s |= (1 << (sl - 1)); - m4 |= (s & NF10BMAC_DATA_STRB); - m4 |= NF10BMAC_DATA_LAST; + md |= (s & NF10BMAC_DATA_STRB); + md |= NF10BMAC_DATA_LAST; } } else { - m4 |= NF10BMAC_DATA_STRB; + md |= NF10BMAC_DATA_STRB; } - NF10BMAC_WRITE_4(sc, NF10BMAC_TX_META, m4); - bcopy(&sc->nf10bmac_tx_buf[l*sizeof(val4)], &val4, cl); - NF10BMAC_WRITE_4_BE(sc, NF10BMAC_TX_DATA, val4); + NF10BMAC_WRITE(sc, NF10BMAC_TX_META, md); + bcopy(&sc->nf10bmac_tx_buf[l*sizeof(val)], &val, cl); + NF10BMAC_WRITE_BE(sc, NF10BMAC_TX_DATA, val); } /* If anyone is interested give them a copy. */ @@ -293,14 +333,14 @@ nf10bmac_start(struct ifnet *ifp) static void nf10bmac_eat_packet_munch_munch(struct nf10bmac_softc *sc) { - uint32_t m4, val4; + REGWTYPE md, val; do { - m4 = NF10BMAC_READ_4_BE(sc, NF10BMAC_RX_META); - if ((m4 & NF10BMAC_DATA_STRB) != 0) - val4 = NF10BMAC_READ_4_BE(sc, NF10BMAC_RX_DATA); - } while ((m4 & NF10BMAC_DATA_STRB) != 0 && - (m4 & NF10BMAC_DATA_LAST) == 0); + md = NF10BMAC_READ_BE(sc, NF10BMAC_RX_META); + if ((md & NF10BMAC_DATA_STRB) != 0) + val = NF10BMAC_READ_BE(sc, NF10BMAC_RX_DATA); + } while ((md & NF10BMAC_DATA_STRB) != 0 && + (md & NF10BMAC_DATA_LAST) == 0); } static int @@ -308,7 +348,7 @@ nf10bmac_rx_locked(struct nf10bmac_softc { struct ifnet *ifp; struct mbuf *m; - uint32_t m4, val4; + REGWTYPE md, val; int32_t len, l; /* @@ -318,21 +358,21 @@ nf10bmac_rx_locked(struct nf10bmac_softc * skip to tlast). */ - len = NF10BMAC_READ_4(sc, NF10BMAC_RX_LEN); + len = NF10BMAC_READ(sc, NF10BMAC_RX_LEN) & NF10BMAC_DATA_LEN_MASK; if (len > (MCLBYTES - ETHER_ALIGN)) { nf10bmac_eat_packet_munch_munch(sc); return (0); } - m4 = NF10BMAC_READ_4(sc, NF10BMAC_RX_META); - if (len == 0 && (m4 & NF10BMAC_DATA_STRB) == 0) { + md = NF10BMAC_READ(sc, NF10BMAC_RX_META); + if (len == 0 && (md & NF10BMAC_DATA_STRB) == 0) { /* No packet data available. */ return (0); - } else if (len == 0 && (m4 & NF10BMAC_DATA_STRB) != 0) { + } else if (len == 0 && (md & NF10BMAC_DATA_STRB) != 0) { /* We are in the middle of a packet. */ nf10bmac_eat_packet_munch_munch(sc); return (0); - } else if ((m4 & NF10BMAC_DATA_STRB) == 0) { + } else if ((md & NF10BMAC_DATA_STRB) == 0) { /* Invalid length "hint". */ device_printf(sc->nf10bmac_dev, "Unexpected length %d on zero strb\n", len); @@ -359,13 +399,13 @@ nf10bmac_rx_locked(struct nf10bmac_softc ifp = sc->nf10bmac_ifp; l = 0; /* - while ((m4 & NF10BMAC_DATA_STRB) != 0 && l < len) { + while ((md & NF10BMAC_DATA_STRB) != 0 && l < len) { */ while (l < len) { size_t cl; - if ((m4 & NF10BMAC_DATA_LAST) == 0 && - (len - l) < sizeof(val4)) { + if ((md & NF10BMAC_DATA_LAST) == 0 && + (len - l) < sizeof(val)) { /* * Our length and LAST disagree. We have a valid STRB. * We could continue until we fill the mbuf and just @@ -376,34 +416,34 @@ nf10bmac_rx_locked(struct nf10bmac_softc ifp->if_ierrors++; m_freem(m); return (0); - } else if ((len - l) <= sizeof(val4)) { + } else if ((len - l) <= sizeof(val)) { cl = len - l; } else { - cl = sizeof(val4); + cl = sizeof(val); } /* Read the first bytes of data as well. */ - val4 = NF10BMAC_READ_4_BE(sc, NF10BMAC_RX_DATA); - bcopy(&val4, (uint8_t *)(m->m_data + l), cl); + val = NF10BMAC_READ_BE(sc, NF10BMAC_RX_DATA); + bcopy(&val, (uint8_t *)(m->m_data + l), cl); l += cl; - if ((m4 & NF10BMAC_DATA_LAST) != 0 || l >= len) + if ((md & NF10BMAC_DATA_LAST) != 0 || l >= len) break; else { DELAY(50); - m4 = NF10BMAC_READ_4(sc, NF10BMAC_RX_META); + md = NF10BMAC_READ(sc, NF10BMAC_RX_META); } cl = 10; - while ((m4 & NF10BMAC_DATA_STRB) == 0 && cl-- > 0) { + while ((md & NF10BMAC_DATA_STRB) == 0 && cl-- > 0) { DELAY(10); - m4 = NF10BMAC_READ_4(sc, NF10BMAC_RX_META); + md = NF10BMAC_READ(sc, NF10BMAC_RX_META); } } /* We should get out of this loop with tlast and tsrb. */ - if ((m4 & NF10BMAC_DATA_LAST) == 0 || (m4 & NF10BMAC_DATA_STRB) == 0) { + if ((md & NF10BMAC_DATA_LAST) == 0 || (md & NF10BMAC_DATA_STRB) == 0) { device_printf(sc->nf10bmac_dev, "Unexpected rx loop end state: " - "m4=0x%08x len=%d l=%d\n", m4, len, l); + "md=0x%08jx len=%d l=%d\n", (uintmax_t)md, len, l); ifp->if_ierrors++; m_freem(m); return (0); @@ -435,6 +475,7 @@ nf10bmac_stop_locked(struct nf10bmac_sof ifp = sc->nf10bmac_ifp; ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + NF10BMAC_RX_INTR_CLEAR_DIS(sc); sc->nf10bmac_flags &= ~NF10BMAC_FLAGS_LINK; if_link_state_change(ifp, LINK_STATE_DOWN); @@ -446,7 +487,25 @@ static int nf10bmac_reset(struct nf10bmac_softc *sc) { - /* Currently we cannot do anything. */ + /* + * If we do not have an ether address set, initialize to the same + * OUI as NetFPGA-10G Linux driver does (which luckily seems + * unallocated). We just change the NIC specific part from + * the slightly long "\0NF10C0" to "\0NFBSD". + * Oh and we keep the way of setting it from a string as they do. + * It's an amazing way to hide it. + * XXX-BZ If NetFPGA gets their own OUI we should fix this. + */ + if (sc->nf10bmac_eth_addr[0] == 0x00 && + sc->nf10bmac_eth_addr[1] == 0x00 && + sc->nf10bmac_eth_addr[2] == 0x00 && + sc->nf10bmac_eth_addr[3] == 0x00 && + sc->nf10bmac_eth_addr[4] == 0x00 && + sc->nf10bmac_eth_addr[5] == 0x00) { + memcpy(&sc->nf10bmac_eth_addr, "\0NFBSD", ETHER_ADDR_LEN); + sc->nf10bmac_eth_addr[5] += sc->nf10bmac_unit; + } + return (0); } @@ -480,6 +539,16 @@ nf10bmac_init_locked(struct nf10bmac_sof /* Instead drain the FIFO; or at least a possible first packet.. */ nf10bmac_eat_packet_munch_munch(sc); +#ifdef DEVICE_POLLING + /* Only enable interrupts if we are not polling. */ + if (ifp->if_capenable & IFCAP_POLLING) { + NF10BMAC_RX_INTR_CLEAR_DIS(sc); + } else +#endif + { + NF10BMAC_RX_INTR_ENABLE(sc); + } + ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; @@ -538,6 +607,49 @@ nf10bmac_tick(void *xsc) } #endif +static void +nf10bmac_intr(void *arg) +{ + struct nf10bmac_softc *sc; + struct ifnet *ifp; + int rx_npkts; + + sc = (struct nf10bmac_softc *)arg; + ifp = sc->nf10bmac_ifp; + + NF10BMAC_LOCK(sc); +#ifdef DEVICE_POLLING + if (ifp->if_capenable & IFCAP_POLLING) { + NF10BMAC_UNLOCK(sc); + return; + } +#endif + + /* NF10BMAC_RX_INTR_DISABLE(sc); */ + NF10BMAC_RX_INTR_CLEAR_DIS(sc); + + /* We only have an RX interrupt and no status information. */ + rx_npkts = 0; + while (rx_npkts < NF10BMAC_MAX_PKTS) { + int c; + + c = nf10bmac_rx_locked(sc); + rx_npkts += c; + if (c == 0) + break; + } + + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + /* Re-enable interrupts. */ + NF10BMAC_RX_INTR_ENABLE(sc); + + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + nf10bmac_start_locked(ifp); + } + NF10BMAC_UNLOCK(sc); +} + + #ifdef DEVICE_POLLING static int nf10bmac_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) @@ -631,10 +743,16 @@ nf10bmac_ioctl(struct ifnet *ifp, u_long break; } + NF10BMAC_RX_INTR_CLEAR_DIS(sc); + /* * Do not allow disabling of polling if we do * not have interrupts. */ + } else if (sc->nf10bmac_rx_irq_res != NULL) { + error = ether_poll_deregister(ifp); + /* Enable interrupts. */ + NF10BMAC_RX_INTR_ENABLE(sc); } else { ifp->if_capenable ^= IFCAP_POLLING; error = EINVAL; @@ -655,7 +773,6 @@ nf10bmac_ioctl(struct ifnet *ifp, u_long return (error); } - /* * Generic device handling routines. */ @@ -715,18 +832,40 @@ nf10bmac_attach(device_t dev) ifmedia_add(&sc->nf10bmac_media, IFM_ETHER | IFM_10G_T, 0, NULL); ifmedia_set(&sc->nf10bmac_media, IFM_ETHER | IFM_10G_T); - /* Interrupts would go here. */ + /* Initialise. */ + error = 0; + + /* Hook up interrupts. Well the one. */ + if (sc->nf10bmac_rx_irq_res != NULL) { + error = bus_setup_intr(dev, sc->nf10bmac_rx_irq_res, + INTR_TYPE_NET | INTR_MPSAFE, NULL, nf10bmac_intr, + sc, &sc->nf10bmac_rx_intrhand); + if (error != 0) { + device_printf(dev, "enabling RX IRQ failed\n"); + ether_ifdetach(ifp); + goto err; + } + } + if ((ifp->if_capenable & IFCAP_POLLING) != 0 || + sc->nf10bmac_rx_irq_res == NULL) { #ifdef DEVICE_POLLING - ifp->if_capenable |= IFCAP_POLLING; - device_printf(dev, "forcing to polling due to no interrupts\n"); - error = ether_poll_register(nf10bmac_poll, ifp); - if (error != 0) - goto err; + /* If not on and no IRQs force it on. */ + if (sc->nf10bmac_rx_irq_res == NULL) { + ifp->if_capenable |= IFCAP_POLLING; + device_printf(dev, + "forcing to polling due to no interrupts\n"); + } + error = ether_poll_register(nf10bmac_poll, ifp); + if (error != 0) + goto err; #else - device_printf(dev, "no DEVICE_POLLING in kernel and no IRQs\n"); - error = ENXIO; + device_printf(dev, "no DEVICE_POLLING in kernel and no IRQs\n"); + error = ENXIO; #endif + } else { + NF10BMAC_RX_INTR_ENABLE(sc); + } err: if (error != 0) @@ -762,6 +901,10 @@ nf10bmac_detach(device_t dev) ether_ifdetach(ifp); } + if (sc->nf10bmac_rx_intrhand) + bus_teardown_intr(dev, sc->nf10bmac_rx_irq_res, + sc->nf10bmac_rx_intrhand); + if (ifp != NULL) if_free(ifp); ifmedia_removeall(&sc->nf10bmac_media); @@ -779,10 +922,15 @@ nf10bmac_detach_resources(device_t dev) sc = device_get_softc(dev); - if (sc->nf10bmac_mem_res != NULL) { + if (sc->nf10bmac_rx_irq_res != NULL) { + bus_release_resource(dev, SYS_RES_IRQ, sc->nf10bmac_rx_irq_rid, + sc->nf10bmac_rx_irq_res); + sc->nf10bmac_rx_irq_res = NULL; + } + if (sc->nf10bmac_intr_res != NULL) { bus_release_resource(dev, SYS_RES_MEMORY, - sc->nf10bmac_mem_rid, sc->nf10bmac_mem_res); - sc->nf10bmac_mem_res = NULL; + sc->nf10bmac_intr_rid, sc->nf10bmac_intr_res); + sc->nf10bmac_intr_res = NULL; } if (sc->nf10bmac_rx_mem_res != NULL) { bus_release_resource(dev, SYS_RES_MEMORY, @@ -794,6 +942,11 @@ nf10bmac_detach_resources(device_t dev) sc->nf10bmac_tx_mem_rid, sc->nf10bmac_tx_mem_res); sc->nf10bmac_tx_mem_res = NULL; } + if (sc->nf10bmac_ctrl_res != NULL) { + bus_release_resource(dev, SYS_RES_MEMORY, + sc->nf10bmac_ctrl_rid, sc->nf10bmac_ctrl_res); + sc->nf10bmac_ctrl_res = NULL; + } } int Modified: stable/10/sys/dev/netfpga10g/nf10bmac/if_nf10bmac_fdt.c ============================================================================== --- head/sys/dev/netfpga10g/nf10bmac/if_nf10bmac_fdt.c Thu Apr 17 12:33:26 2014 (r264601) +++ stable/10/sys/dev/netfpga10g/nf10bmac/if_nf10bmac_fdt.c Sat Aug 16 14:30:46 2014 (r270061) @@ -85,16 +85,34 @@ nf10bmac_attach_fdt(device_t dev) /* * FDT lists our resources. For convenience we use three different * mappings. We need to attach them in the oder specified in .dts: - * TX (size 0xc), RX (size 0xc), LOOP (size 0x4). + * LOOP (size 0x1f), TX (0x2f), RX (0x2f), INTR (0xf). */ + /* + * LOOP memory region (this could be a general control region). + * 0x00: 32/64bit register to enable a Y-"lopback". + */ + sc->nf10bmac_ctrl_rid = 0; + sc->nf10bmac_ctrl_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &sc->nf10bmac_ctrl_rid, RF_ACTIVE); + if (sc->nf10bmac_ctrl_res == NULL) { + device_printf(dev, "failed to map memory for CTRL region\n"); + error = ENXIO; + goto err; + } + if (bootverbose) + device_printf(sc->nf10bmac_dev, "CTRL region at mem %p-%p\n", + (void *)rman_get_start(sc->nf10bmac_ctrl_res), + (void *)(rman_get_start(sc->nf10bmac_ctrl_res) + + rman_get_size(sc->nf10bmac_ctrl_res))); + /* * TX and TX metadata FIFO memory region. - * 0x00: 32bit FIFO data, - * 0x04: 32bit FIFO metadata, - * 0x08: 32bit packet length. + * 0x00: 32/64bit FIFO data, + * 0x08: 32/64bit FIFO metadata, + * 0x10: 32/64bit packet length. */ - sc->nf10bmac_tx_mem_rid = 0; + sc->nf10bmac_tx_mem_rid = 1; sc->nf10bmac_tx_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->nf10bmac_tx_mem_rid, RF_ACTIVE); if (sc->nf10bmac_tx_mem_res == NULL) { @@ -110,11 +128,11 @@ nf10bmac_attach_fdt(device_t dev) /* * RX and RXC metadata FIFO memory region. - * 0x00: 32bit FIFO data, - * 0x04: 32bit FIFO metadata, - * 0x08: 32bit packet length. + * 0x00: 32/64bit FIFO data, + * 0x08: 32/64bit FIFO metadata, + * 0x10: 32/64bit packet length. */ - sc->nf10bmac_rx_mem_rid = 1; + sc->nf10bmac_rx_mem_rid = 2; sc->nf10bmac_rx_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->nf10bmac_rx_mem_rid, RF_ACTIVE); if (sc->nf10bmac_rx_mem_res == NULL) { @@ -129,22 +147,28 @@ nf10bmac_attach_fdt(device_t dev) rman_get_size(sc->nf10bmac_rx_mem_res))); /* - * LOOP memory region (this could be a general control region). - * 0x00: 32bit register to enable a Y-"lopback". + * Interrupt handling registers. + * 0x00: 32/64bit register to clear (and disable) the RX interrupt. + * 0x08: 32/64bit register to enable or disable the RX interrupt. */ - sc->nf10bmac_mem_rid = 2; - sc->nf10bmac_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &sc->nf10bmac_mem_rid, RF_ACTIVE); - if (sc->nf10bmac_mem_res == NULL) { - device_printf(dev, "failed to map memory for CTRL region\n"); + sc->nf10bmac_intr_rid = 3; + sc->nf10bmac_intr_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &sc->nf10bmac_intr_rid, RF_ACTIVE); + if (sc->nf10bmac_intr_res == NULL) { + device_printf(dev, "failed to map memory for INTR region\n"); error = ENXIO; goto err; } if (bootverbose) - device_printf(sc->nf10bmac_dev, "CTRL region at mem %p-%p\n", - (void *)rman_get_start(sc->nf10bmac_mem_res), - (void *)(rman_get_start(sc->nf10bmac_mem_res) + - rman_get_size(sc->nf10bmac_mem_res))); + device_printf(sc->nf10bmac_dev, "INTR region at mem %p-%p\n", + (void *)rman_get_start(sc->nf10bmac_intr_res), + (void *)(rman_get_start(sc->nf10bmac_intr_res) + + rman_get_size(sc->nf10bmac_intr_res))); + + /* (Optional) RX and TX IRQ. */ + sc->nf10bmac_rx_irq_rid = 0; + sc->nf10bmac_rx_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, + &sc->nf10bmac_rx_irq_rid, RF_ACTIVE | RF_SHAREABLE); error = nf10bmac_attach(dev); if (error) Modified: stable/10/sys/dev/netfpga10g/nf10bmac/if_nf10bmacreg.h ============================================================================== --- head/sys/dev/netfpga10g/nf10bmac/if_nf10bmacreg.h Thu Apr 17 12:33:26 2014 (r264601) +++ stable/10/sys/dev/netfpga10g/nf10bmac/if_nf10bmacreg.h Sat Aug 16 14:30:46 2014 (r270061) @@ -35,15 +35,20 @@ struct nf10bmac_softc { struct ifnet *nf10bmac_ifp; + struct resource *nf10bmac_ctrl_res; struct resource *nf10bmac_tx_mem_res; struct resource *nf10bmac_rx_mem_res; - struct resource *nf10bmac_mem_res; + struct resource *nf10bmac_intr_res; + struct resource *nf10bmac_rx_irq_res; + void *nf10bmac_rx_intrhand; uint8_t *nf10bmac_tx_buf; device_t nf10bmac_dev; int nf10bmac_unit; + int nf10bmac_ctrl_rid; int nf10bmac_tx_mem_rid; int nf10bmac_rx_mem_rid; - int nf10bmac_mem_rid; + int nf10bmac_intr_rid; + int nf10bmac_rx_irq_rid; int nf10bmac_if_flags; uint32_t nf10bmac_flags; #define NF10BMAC_FLAGS_LINK 0x00000001 Modified: stable/10/sys/mips/beri/files.beri ============================================================================== --- stable/10/sys/mips/beri/files.beri Sat Aug 16 14:21:03 2014 (r270060) +++ stable/10/sys/mips/beri/files.beri Sat Aug 16 14:30:46 2014 (r270061) @@ -6,6 +6,8 @@ dev/altera/jtag_uart/altera_jtag_uart_co dev/altera/jtag_uart/altera_jtag_uart_tty.c optional altera_jtag_uart dev/altera/jtag_uart/altera_jtag_uart_fdt.c optional altera_jtag_uart fdt dev/altera/jtag_uart/altera_jtag_uart_nexus.c optional altera_jtag_uart +dev/netfpga10g/nf10bmac/if_nf10bmac_fdt.c optional netfpga10g_nf10bmac fdt +dev/netfpga10g/nf10bmac/if_nf10bmac.c optional netfpga10g_nf10bmac dev/terasic/de4led/terasic_de4led.c optional terasic_de4led dev/terasic/de4led/terasic_de4led_fdt.c optional terasic_de4led fdt dev/terasic/de4led/terasic_de4led_nexus.c optional terasic_de4led Modified: stable/10/sys/mips/conf/BERI_NETFPGA_MDROOT ============================================================================== --- stable/10/sys/mips/conf/BERI_NETFPGA_MDROOT Sat Aug 16 14:21:03 2014 (r270060) +++ stable/10/sys/mips/conf/BERI_NETFPGA_MDROOT Sat Aug 16 14:30:46 2014 (r270061) @@ -19,6 +19,11 @@ makeoptions FDT_DTS_FILE=beri-netfpga.dt #device uart device altera_jtag_uart +device bpf + +options DEVICE_POLLING +device netfpga10g_nf10bmac + # # This kernel configuration uses an embedded memory root file system. # Adjust the following path and size based on local requirements. Modified: stable/10/sys/modules/Makefile ============================================================================== --- stable/10/sys/modules/Makefile Sat Aug 16 14:21:03 2014 (r270060) +++ stable/10/sys/modules/Makefile Sat Aug 16 14:30:46 2014 (r270061) @@ -239,6 +239,7 @@ SUBDIR= \ ${_ncp} \ ${_ncv} \ ${_ndis} \ + netfpga10g \ ${_netgraph} \ ${_nfe} \ nfs_common \ From owner-svn-src-stable-10@FreeBSD.ORG Sat Aug 16 21:36:23 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 377CADEE; Sat, 16 Aug 2014 21:36:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 22BAC2E97; Sat, 16 Aug 2014 21:36:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7GLaN5V077451; Sat, 16 Aug 2014 21:36:23 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7GLaM6g077450; Sat, 16 Aug 2014 21:36:22 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201408162136.s7GLaM6g077450@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 16 Aug 2014 21:36:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r270066 - stable/10/sys/fs/nfsserver X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Aug 2014 21:36:23 -0000 Author: rmacklem Date: Sat Aug 16 21:36:22 2014 New Revision: 270066 URL: http://svnweb.freebsd.org/changeset/base/270066 Log: MFC: r269771 Change the NFS server's printf related to hitting the DRC cache's flood level so that it suggests increasing vfs.nfsd.tcphighwater. Modified: stable/10/sys/fs/nfsserver/nfs_nfsdsocket.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsserver/nfs_nfsdsocket.c ============================================================================== --- stable/10/sys/fs/nfsserver/nfs_nfsdsocket.c Sat Aug 16 20:44:45 2014 (r270065) +++ stable/10/sys/fs/nfsserver/nfs_nfsdsocket.c Sat Aug 16 21:36:22 2014 (r270066) @@ -749,10 +749,9 @@ nfsrvd_compound(struct nfsrv_descript *n nd->nd_rp->rc_refcnt == 0) && (nfsrv_mallocmget_limit() || nfsrc_tcpsavedreplies > nfsrc_floodlevel)) { - if (nfsrc_tcpsavedreplies > nfsrc_floodlevel) { - printf("nfsd server cache flooded, try to"); - printf(" increase nfsrc_floodlevel\n"); - } + if (nfsrc_tcpsavedreplies > nfsrc_floodlevel) + printf("nfsd server cache flooded, try " + "increasing vfs.nfsd.tcphighwater\n"); nd->nd_repstat = NFSERR_RESOURCE; *repp = nfsd_errmap(nd); if (op == NFSV4OP_SETATTR) {