From owner-svn-src-head@FreeBSD.ORG Sun May 24 01:18:59 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71B471065670; Sun, 24 May 2009 01:18:57 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E5678FC22; Sun, 24 May 2009 01:18:57 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4O1IvOY073137; Sun, 24 May 2009 01:18:57 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4O1IunO073132; Sun, 24 May 2009 01:18:56 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200905240118.n4O1IunO073132@svn.freebsd.org> From: Rick Macklem Date: Sun, 24 May 2009 01:18:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192674 - head/usr.sbin/nfsd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 01:18:59 -0000 Author: rmacklem Date: Sun May 24 01:18:56 2009 New Revision: 192674 URL: http://svn.freebsd.org/changeset/base/192674 Log: Modify nfsd.c to add support for the experimental nfs server. This includes the addition of a new flag "-4" that will force use of the experimental server with nfsv4 support in it. This commit also adds two new man pages to the repository that are NFSv4 specific. One describes the file used by the server to restart nfsv4 services safely. The other is a brief overview of nfsv4 and its setup. Reviewed by: dfr Approved by: kib (mentor) Added: head/usr.sbin/nfsd/nfsv4.4 (contents, props changed) head/usr.sbin/nfsd/stablerestart.5 (contents, props changed) Modified: head/usr.sbin/nfsd/Makefile head/usr.sbin/nfsd/nfsd.8 head/usr.sbin/nfsd/nfsd.c Modified: head/usr.sbin/nfsd/Makefile ============================================================================== --- head/usr.sbin/nfsd/Makefile Sat May 23 23:08:07 2009 (r192673) +++ head/usr.sbin/nfsd/Makefile Sun May 24 01:18:56 2009 (r192674) @@ -2,7 +2,7 @@ # $FreeBSD$ PROG= nfsd -MAN= nfsd.8 +MAN= nfsd.8 nfsv4.4 stablerestart.5 WARNS?= 6 Modified: head/usr.sbin/nfsd/nfsd.8 ============================================================================== --- head/usr.sbin/nfsd/nfsd.8 Sat May 23 23:08:07 2009 (r192673) +++ head/usr.sbin/nfsd/nfsd.8 Sun May 24 01:18:56 2009 (r192674) @@ -38,7 +38,7 @@ server .Sh SYNOPSIS .Nm -.Op Fl ardut +.Op Fl ardut4 .Op Fl n Ar num_servers .Op Fl h Ar bindip .Sh DESCRIPTION @@ -100,6 +100,18 @@ clients. Serve .Tn UDP NFS clients. +.It Fl 4 +Forces +.Nm +to try and start the experimental server that includes NFSv4 support in it. +If this flag isn't specified, the experimental server will only be started +if it is linked into the kernel and the regular one isn't. +.br +ie. The kernel is built with the following: +.Bd -literal -offset indent -compact +# options NFSSERVER +options NFSD +.Ed .El .Pp For example, @@ -120,8 +132,11 @@ utility listens for service requests at .Tn NFS server specification; see .%T "Network File System Protocol Specification" , -RFC1094 and -.%T "NFS: Network File System Version 3 Protocol Specification" . +RFC1094, +.%T "NFS: Network File System Version 3 Protocol Specification" , +RFC1813 and +.%T "Network File System (NFS) Version 4 Protocol" , +RFC3530. .Pp If .Nm @@ -178,13 +193,28 @@ just do a .Xr nfsstat 1 , .Xr kldload 2 , .Xr nfssvc 2 , +.Xr nfsv4 4 , .Xr exports 5 , +.Xr gssd 8 , .Xr ipfw 8 , .Xr mountd 8 , .Xr nfsiod 8 , +.Xr nfsrevoke 8 , +.Xr nfsuserd 8 , .Xr rpcbind 8 .Sh HISTORY The .Nm utility first appeared in .Bx 4.4 . +.Sh BUGS +If +.Nm +is started when +.Xr gssd 8 +is not running, it will service AUTH_SYS requests only. To fix the problem +you must kill +.Nm +and then restart it, after the +.Xr gssd 8 +is running. Modified: head/usr.sbin/nfsd/nfsd.c ============================================================================== --- head/usr.sbin/nfsd/nfsd.c Sat May 23 23:08:07 2009 (r192673) +++ head/usr.sbin/nfsd/nfsd.c Sun May 24 01:18:56 2009 (r192674) @@ -48,6 +48,7 @@ static const char rcsid[] = #include #include #include +#include #include #include @@ -59,6 +60,7 @@ static const char rcsid[] = #include #include #include +#include #include #include @@ -77,11 +79,14 @@ int debug = 1; int debug = 0; #endif +#define NFSD_STABLERESTART "/var/db/nfs-stablerestart" #define MAXNFSDCNT 256 #define DEFNFSDCNT 4 pid_t children[MAXNFSDCNT]; /* PIDs of children */ int nfsdcnt; /* number of children */ int new_syscall; +int run_v4server = 0; /* Force running of nfsv4 server */ +int nfssvc_nfsd; /* Set to correct NFSSVC_xxx flag */ void cleanup(int); void child_cleanup(int); @@ -112,6 +117,7 @@ void usage(void); * -d - unregister with rpcbind * -t - support tcp nfs clients * -u - support udp nfs clients + * -4 - forces it to run a server that supports nfsv4 * followed by "n" which is the number of nfsds' to fork off */ int @@ -131,20 +137,15 @@ main(int argc, char **argv) int tcp6sock, ip6flag, tcpflag, tcpsock; int udpflag, ecode, s, srvcnt; int bindhostc, bindanyflag, rpcbreg, rpcbregcnt; + int stablefd, nfssvc_addsock; char **bindhost = NULL; pid_t pid; - if (modfind("nfsserver") < 0) { - /* Not present in kernel, try loading it */ - if (kldload("nfsserver") < 0 || modfind("nfsserver") < 0) - errx(1, "NFS server is not available"); - } - nfsdcnt = DEFNFSDCNT; unregister = reregister = tcpflag = maxsock = 0; bindanyflag = udpflag = connect_type_cnt = bindhostc = 0; -#define GETOPT "ah:n:rdtu" -#define USAGE "[-ardtu] [-n num_servers] [-h bindip]" +#define GETOPT "ah:n:rdtu4" +#define USAGE "[-ardtu4] [-n num_servers] [-h bindip]" while ((ch = getopt(argc, argv, GETOPT)) != -1) switch (ch) { case 'a': @@ -179,6 +180,9 @@ main(int argc, char **argv) case 'u': udpflag = 1; break; + case '4': + run_v4server = 1; + break; default: case '?': usage(); @@ -203,6 +207,25 @@ main(int argc, char **argv) } } + /* + * If the "-4" option was specified OR only the nfsd module is + * found in the server, run "nfsd". + * Otherwise, try and run "nfsserver". + */ + if (run_v4server > 0) { + if (modfind("nfsd") < 0) { + /* Not present in kernel, try loading it */ + if (kldload("nfsd") < 0 || modfind("nfsd") < 0) + errx(1, "NFS server is not available"); + } + } else if (modfind("nfsserver") < 0 && modfind("nfsd") >= 0) { + run_v4server = 1; + } else if (modfind("nfsserver") < 0) { + /* Not present in kernel, try loading it */ + if (kldload("nfsserver") < 0 || modfind("nfsserver") < 0) + errx(1, "NFS server is not available"); + } + ip6flag = 1; s = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); if (s == -1) { @@ -328,15 +351,47 @@ main(int argc, char **argv) openlog("nfsd", LOG_PID, LOG_DAEMON); /* - * Figure out if the kernel supports the new-style - * NFSSVC_NFSD. Old kernels will return ENXIO because they - * don't recognise the flag value, new ones will return EINVAL - * because argp is NULL. + * For V4, we open the stablerestart file and call nfssvc() + * to get it loaded. This is done before the daemons do the + * regular nfssvc() call to service NFS requests. + * (This way the file remains open until the last nfsd is killed + * off.) + * Note that this file is not created by this daemon and can + * only be relocated by recompiling the daemon, in order to + * minimize accidentally starting up with the wrong file. + * If should be created as an empty file Read and Write for + * root before the first time you run NFS v4 and should never + * be re-initialized if at all possible. It should live on a + * local, non-volatile storage device that does not do hardware + * level write-back caching. (See SCSI doc for more information + * on how to prevent write-back caching on SCSI disks.) */ - new_syscall = FALSE; - if (nfssvc(NFSSVC_NFSD, NULL) < 0 && errno == EINVAL) + if (run_v4server > 0) { + stablefd = open(NFSD_STABLERESTART, O_RDWR, 0); + if (stablefd < 0) { + syslog(LOG_ERR, "Can't open %s\n", NFSD_STABLERESTART); + exit(1); + } + if (nfssvc(NFSSVC_STABLERESTART, (caddr_t)&stablefd) < 0) { + syslog(LOG_ERR, "Can't read stable storage file\n"); + exit(1); + } + nfssvc_addsock = NFSSVC_NFSDADDSOCK; + nfssvc_nfsd = NFSSVC_NFSDNFSD; new_syscall = TRUE; - new_syscall = FALSE; + } else { + nfssvc_addsock = NFSSVC_ADDSOCK; + nfssvc_nfsd = NFSSVC_NFSD; + /* + * Figure out if the kernel supports the new-style + * NFSSVC_NFSD. Old kernels will return ENXIO because they + * don't recognise the flag value, new ones will return EINVAL + * because argp is NULL. + */ + new_syscall = FALSE; + if (nfssvc(NFSSVC_NFSD, NULL) < 0 && errno == EINVAL) + new_syscall = TRUE; + } if (!new_syscall) { /* If we use UDP only, we start the last server below. */ @@ -413,7 +468,7 @@ main(int argc, char **argv) addsockargs.sock = sock; addsockargs.name = NULL; addsockargs.namelen = 0; - if (nfssvc(NFSSVC_ADDSOCK, &addsockargs) < 0) { + if (nfssvc(nfssvc_addsock, &addsockargs) < 0) { syslog(LOG_ERR, "can't Add UDP socket"); nfsd_exit(1); } @@ -481,7 +536,7 @@ main(int argc, char **argv) addsockargs.sock = sock; addsockargs.name = NULL; addsockargs.namelen = 0; - if (nfssvc(NFSSVC_ADDSOCK, &addsockargs) < 0) { + if (nfssvc(nfssvc_addsock, &addsockargs) < 0) { syslog(LOG_ERR, "can't add UDP6 socket"); nfsd_exit(1); @@ -711,7 +766,7 @@ main(int argc, char **argv) addsockargs.sock = msgsock; addsockargs.name = (caddr_t)&inetpeer; addsockargs.namelen = len; - nfssvc(NFSSVC_ADDSOCK, &addsockargs); + nfssvc(nfssvc_addsock, &addsockargs); (void)close(msgsock); } else if (FD_ISSET(tcpsock, &v6bits)) { len = sizeof(inet6peer); @@ -733,7 +788,7 @@ main(int argc, char **argv) addsockargs.sock = msgsock; addsockargs.name = (caddr_t)&inet6peer; addsockargs.namelen = len; - nfssvc(NFSSVC_ADDSOCK, &addsockargs); + nfssvc(nfssvc_addsock, &addsockargs); (void)close(msgsock); } } @@ -861,19 +916,47 @@ nfsd_exit(int status) void start_server(int master) { - char principal[128]; - char hostname[128]; + char principal[MAXHOSTNAMELEN + 5]; struct nfsd_nfsd_args nfsdargs; - int status; + int status, error; + char hostname[MAXHOSTNAMELEN + 1], *cp; + struct addrinfo *aip, hints; status = 0; if (new_syscall) { - gethostname(hostname, sizeof(hostname)); - snprintf(principal, sizeof(principal), "nfs@%s", hostname); + gethostname(hostname, sizeof (hostname)); + snprintf(principal, sizeof (principal), "nfs@%s", hostname); + if ((cp = strchr(hostname, '.')) == NULL || + *(cp + 1) == '\0') { + /* If not fully qualified, try getaddrinfo() */ + memset((void *)&hints, 0, sizeof (hints)); + hints.ai_flags = AI_CANONNAME; + error = getaddrinfo(hostname, NULL, &hints, &aip); + if (error == 0) { + if (aip->ai_canonname != NULL && + (cp = strchr(aip->ai_canonname, '.')) != + NULL && *(cp + 1) != '\0') + snprintf(principal, sizeof (principal), + "nfs@%s", aip->ai_canonname); + freeaddrinfo(aip); + } + } nfsdargs.principal = principal; nfsdargs.minthreads = nfsdcnt; nfsdargs.maxthreads = nfsdcnt; - if (nfssvc(NFSSVC_NFSD, &nfsdargs) < 0) { + error = nfssvc(nfssvc_nfsd, &nfsdargs); + if (error < 0 && errno == EAUTH) { + /* + * This indicates that it could not register the + * rpcsec_gss credentials, usually because the + * gssd daemon isn't running. + * (only the experimental server with nfsv4) + */ + syslog(LOG_ERR, "No gssd, using AUTH_SYS only"); + principal[0] = '\0'; + error = nfssvc(nfssvc_nfsd, &nfsdargs); + } + if (error < 0) { syslog(LOG_ERR, "nfssvc: %m"); status = 1; } Added: head/usr.sbin/nfsd/nfsv4.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/nfsd/nfsv4.4 Sun May 24 01:18:56 2009 (r192674) @@ -0,0 +1,309 @@ +.\" Copyright (c) 2009 Rick Macklem, University of Guelph +.\" 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. +.\" +.\" $FreeBSD$ +.\" +.Dd April 30, 2009 +.Dt NFSV4 4 +.Os +.Sh NAME +.Nm nfsv4 +.Nd NFS Version 4 Protocol +.Sh SYNOPSIS +experimental client and server with NFSv4 support +.Sh DESCRIPTION +The experimental nfs client and server provides support for the +.Tn NFSv4 +specification; see +.%T "Network File System (NFS) Version 4 Protocol \\*(tNRFC\\*(sP 3530" . +The protocol is somewhat similar to NFS Version 3, but differs in significant +ways. It uses a single Compound RPC that concatenates operations to-gether. +Each of these operations are similar to the RPCs of NFS Version 3. +The operations in the compound are performed in order, until one of +them fails (returns an error) and then the RPC terminates at that point. +.Pp +It has +integrated locking support, which implies that the server is no longer +stateless. As such, the +.Tn NFSv4 +server remains in recovery mode for a Grace period (always greater than the +lease duration the server uses) after a reboot. +During this Grace period, clients may recover state but not perform other +open/lock state changing operations. +To provide for correct recovery semantics, a small file described by +.Xr stablerestart 5 +is used by the server during the recovery phase. If this file is missing, +the server will not start. +If this file is lost, it should be recovered from backups, since creating +an empty +.Xr stablerestart 5 +file will result in the server starting without providing a Grace Period +for recovery. +Note that recovery only occurs when the server +machine is rebooted, not when the +.Xr nfsd 8 +are just restarted. +.Pp +It provides several optional features not in NFS Version 3: +.sp +.Bd -literal -offset indent -compact +- NFS Version 4 ACLs +- Referrals, which redirect subtrees to other servers + (not yet implemented) +- Delegations, which allow a client to operate on a file locally +.Ed +.Pp +The +.Tn NFSv4 +protocol does not use a separate mount protocol and assumes that the +server provides a single file system tree structure, rooted at the point +in the local file system tree specified by the +.sp 1 +.Bd -literal -offset indent -compact +V4: +.Ed +.sp 1 +line in +.Xr exports 5 . +The +.Xr nfsd 8 +allows a limited subset of operations to be performed on non-exported subtrees +of the local file system, so that traversal of the tree to the exported +subtrees is possible. +As such, the ``'' can be in a non-exported file system. However, +the entire tree that is rooted at that point must be in local file systems +that are of types that can be NFS exported. +Since the +.Nm +file system is rooted at ``'', setting this to anything other +than ``/'' will result in clients being required to use different mount +paths for +.Nm +than for NFS Version 2 or 3. +Unlike NFS Version 2 and 3, Version 4 allows a client mount to span across +multiple server file systems, although not all clients are capable of doing +this. +.Pp +.Nm +uses names for users and groups instead of numbers. On the wire, they +take the form: +.sp +.Bd -literal -offset indent -compact +@ +.Ed +.sp +where ``'' is not the same as the DNS domain used +for host name lookups, but is usually set to the same string. Most systems set this ``'' +to the domain name part of the machine's +.Xr hostname 1 +by default. However, this can normally be overridden by a command line +option or configuration file for the daemon used to do the name<->number +mapping. +On FreeBSD, the mapping daemon is called +.Xr nfsuserd 8 +and has a command line option that overrides the domain component of the +machine's hostname. +This can be set in +.Xr rc.conf 5 +via the nfsv4_userd_flags variable. +For use of +.Nm , +either client or server, this daemon must be enabled by setting +.sp +.Bd -literal -offset indent -compact +nfsv4_enable="YES" +.Ed +.sp +in +.Xr rc.conf 5 . +If this ``'' is not set correctly or the daemon is not running, ``ls -l'' will typically +report a lot of ``nobody'' and ``nogroup'' ownerships. +.Pp +Although numbers are no longer used in the +.Nm +protocol, they will still be in the RPC authentication fields when running +using AUTH_SYS (sec=sys), which is the default. +As such, in this case both the user/group name and number spaces must +be consistent between the client and server. +.Pp +However, if you run +.Nm +with RPCSEC_GSS (sec=krb5, krb5i, krb5p), only names and KerberosV tickets +will go on the wire. +.Sh SERVER SETUP +.Pp +To set up the experimental nfs server that supports +.Nm +you will need to either build a kernel with: +.sp +.Bd -literal -offset indent -compact +options NFSD +.Ed +and not +.Bd -literal -offset indent -compact +options NFSSERVER +.Ed +.sp +or start +.Xr mountd 8 +and +.Xr nfsd 8 +with the ``-4'' option to force use of the experimental server. +This will occur if +.sp +.Bd -literal -offset indent -compact +nfsv4_enable="YES" +.Ed +.sp +is set in +.Xr rc.conf 5 , +as above. +.Pp +You will also need to add a: +.sp +.Bd -literal -offset indent -compact +V4: +.Ed +.sp +line to the +.Xr exports 5 +file, to tell the server where the +.Nm +tree is rooted. +.Pp +If the file systems you are exporting are only being accessed via +.Nm +there are a couple of +.Xr sysctl 8 +variables that you can change, which might improve performance. +.Bl -tag -width Ds +.It Cm vfs.newnfs.issue_delegations +when set non-zero, allows the server to issue Open Delegations to +clients. These delegations permit the client to manipulate the file +locally on the client. Unfortunately, at this time, client use of +delegations is limited, so performance gains may not be observed. +This can only be enabled when the file systems being exported to +.Nm +clients are not being accessed locally on the server and, if being +accessed via NFS Version 2 or 3 clients, these clients cannot be +using the NLM. +.It Cm vfs.newnfs.enable_locallocks +can be set to 0 to disable acquisition of local byte range locks. +Disabling local locking can only be done if neither local accesses +to the exported file systems nor the NLM is operating on them. +.El +.sp +Note that Samba server access would be considered ``local access'' for the above +discussion. +.Pp +To build a kernel with the experimental +.Nm +linked into it, the +.sp +.Bd -literal -offset indent -compact +options NFSD +.Ed +.sp +must be specified in the kernel's +.Xr config 5 +file. +.Sh CLIENT MOUNTS +.Pp +To do an +.Nm +mount, specify the ``nfsv4'' option on the +.Xr mount_nfs 8 +command line. +This will force use of the experimental client plus set ``tcp'' and +.Nm . +.Pp +If the +.Nm +server that is being mounted on supports delegations, you can set +.sp +.Bd -literal -offset indent -compact +nfsv4_callbackdaemon_enable="YES" +.Ed +.sp +via +.Xr rc.conf 5 +so that the client side callback daemon +.Xr nfscbd 8 +is started upon boot. +Without a functioning callback path, a server will never issue Delegations +to a client. +.sp +By default, the callback address will be set to the IP address acquired via +rtalloc() in the kernel and port# 7745. +To override the default port#, a command line option for +.Xr nfscbd 8 +can be set via the variable +.sp +.Bd -literal -offset indent -compact +nfsv4_callbackdaemon_flag +.Ed +.sp +using +.Xr rc.conf 5 . +.sp +To get callbacks to work when behind a NAT gateway, a port for the callback +service will need to be set up on the NAT gateway and then the address +of the NAT gateway (host IP plus port#) will need to be set by assigning the +.Xr sysctl 8 +variable vfs.newnfs.callback_addr to a string of the form: +.sp +N.N.N.N.N.N +.sp +where the first 4 Ns are the host IP address and the last two are the +port# in network byte order (all decimal #s in the range 0-255). +.Pp +To build a kernel with the experimental +.Nm +client linked into it, the option +.sp +.Bd -literal -offset indent -compact +options NFSCL +.Ed +.sp +must be specified in the kernel's +.Xr config 5 +file. +.Sh FILES +.Bl -tag -width /var/db/nfs-stablerestart -compact +.It Pa /var/db/nfs-stablerestart +NFS V4 stable restart file +.El +.Sh SEE ALSO +.Xr stablerestart 5 +.Xr mountd 8 +.Xr nfscbd 8 +.Xr nfsd 8 +.Xr nfsdumpstate 8 +.Xr nfsrevoke 8 +.Xr nfsuserd 8 +.Sh BUGS +At this time, there is no recall of delegations for local file system +operations. As such, delegations should only be enabled for file systems +that are being used soley as NFS export volumes and are not being accessed +via local system calls nor services such as Samba. Added: head/usr.sbin/nfsd/stablerestart.5 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/nfsd/stablerestart.5 Sun May 24 01:18:56 2009 (r192674) @@ -0,0 +1,93 @@ +.\" Copyright (c) 2009 Rick Macklem, University of Guelph +.\" 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. +.\" +.\" $FreeBSD$ +.\" +.Dd Sept 7, 2007 +.Dt STABLERESTART 5 +.Os +.Sh NAME +.Nm nfs-stablerestart +.Nd handles restart edge conditions for the +.Tn NFS +V4 server +.Sh SYNOPSIS +.Nm nfs-stablerestart +.Sh DESCRIPTION +The +.Nm +file holds information that allows the +.Tn NFS +V4 server to restart without always returning the NFSERR_NOGRACE error, as described in the +.Tn NFS V4 +server specification; see +.%T "Network File System (NFS) Version 4 Protocol \\*(tNRFC\\*(sP 3530, Section 8.6.3" . +.Pp +The first record in the file, as defined by struct nfsf_rec in +/usr/include/fs/nfs/nfsrvstate.h, holds the lease duration of the +last incarnation of the server and the number of boot times that follows. +Following this are the number of previous boot times listed in the +first record. +The lease duration is used to set the Grace Period. +The boot times +are used to avoid the unlikely occurrence of a boot time being reused, +due to a TOD clock going backwards. This record and the previous boot times with this boot time added is re-written at the +end of the Grace Period. +.Pp +The rest of the file are appended records, as defined by +struct nfst_rec in /usr/include/fs/nfs/nfsrvstate.h and are used +represent one of two things. There are records which indicate that a +client successfully aquired state and records that indicate a client's state was revoked. +State revoke records indicate that state information +for a client was discarded, due to lease expiry and an otherwise +conflicting open or lock request being made by a different client. +These records can be used +to determine if clients might have done either of the +edge conditions. +.Pp +If a client might have done either edge condition or this file is +empty or corrupted, the server returns NFSERR_NOGRACE for any reclaim +request from the client. +.Pp +For correct operation of the server, it must be ensured that the file +is written to stable storage by the time a write op with IO_SYNC specified +has returned. This might require hardware level caching to be disabled for +a local disk drive that holds the file, or similar. +.Sh FILES +.Bl -tag -width /var/db/nfs-stablerestart -compact +.It Pa /var/db/nfs-stablerestart +NFS V4 stable restart file +.El +.Sh SEE ALSO +.Xr nfsv4 4 +.Xr nfsd 8 +.Sh BUGS +If the file is empty, the NFS V4 server has no choice but to return +NFSERR_NOGRACE for all Reclaim requests. Although correct, this is +a highly undesirable occurrence, so the file should not be lost if +at all possible. Nfsd will not create the file if it does not +exist and will simply log a failure to start, in the hopes that the +file can be recovered from a backup. To move the file, you must edit +the nfsd sources and recompile it. This was done to discourage +accidental relocation of the file. From owner-svn-src-head@FreeBSD.ORG Sun May 24 03:22:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 030D9106566C; Sun, 24 May 2009 03:22:50 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E47528FC19; Sun, 24 May 2009 03:22:49 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4O3MnJo075757; Sun, 24 May 2009 03:22:49 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4O3Mn7F075755; Sun, 24 May 2009 03:22:49 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200905240322.n4O3Mn7F075755@svn.freebsd.org> From: Rick Macklem Date: Sun, 24 May 2009 03:22:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192675 - in head/sys/fs: nfs nfsclient X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 03:22:50 -0000 Author: rmacklem Date: Sun May 24 03:22:49 2009 New Revision: 192675 URL: http://svn.freebsd.org/changeset/base/192675 Log: Fix the experimental nfsv4 client so that it works for the case of a kerberized mount without a host based principal name. This will only work for mounts being done by a user other than root. Support for a host based principal name will not work until proposed changes to the rpcsec_gss part of the krpc are committed. It now builds for "options KGSSAPI". Approved by: kib (mentor) Modified: head/sys/fs/nfs/nfs_commonkrpc.c head/sys/fs/nfsclient/nfs_clvfsops.c Modified: head/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- head/sys/fs/nfs/nfs_commonkrpc.c Sun May 24 01:18:56 2009 (r192674) +++ head/sys/fs/nfs/nfs_commonkrpc.c Sun May 24 03:22:49 2009 (r192675) @@ -341,7 +341,9 @@ nfs_getauth(struct nfssockreq *nrp, int else auth = NULL; #endif - return (auth); + if (auth != NULL) + return (auth); + /* fallthrough */ #endif /* KGSSAPI */ case AUTH_SYS: default: @@ -402,7 +404,7 @@ newnfs_request(struct nfsrv_descript *nd { u_int32_t *tl; time_t waituntil; - int i, j; + int i, j, set_uid = 0; int trycnt, error = 0, usegssname = 0, secflavour = AUTH_SYS; u_int16_t procnum; u_int trylater_delay = 1; @@ -413,6 +415,7 @@ newnfs_request(struct nfsrv_descript *nd enum clnt_stat stat; struct nfsreq *rep = NULL; char *srv_principal = NULL; + uid_t saved_uid = (uid_t)-1; if (xidp != NULL) *xidp = 0; @@ -423,6 +426,14 @@ newnfs_request(struct nfsrv_descript *nd } /* + * XXX if not already connected call nfs_connect now. Longer + * term, change nfs_mount to call nfs_connect unconditionally + * and let clnt_reconnect_create handle reconnects. + */ + if (nrp->nr_client == NULL) + newnfs_connect(nmp, nrp, cred, td, 0); + + /* * For a client side mount, nmp is != NULL and clp == NULL. For * server calls (callbacks or upcalls), nmp == NULL. */ @@ -442,8 +453,30 @@ newnfs_request(struct nfsrv_descript *nd nd->nd_procnum != NFSPROC_NULL) { if (NFSHASALLGSSNAME(nmp) && nmp->nm_krbnamelen > 0) nd->nd_flag |= ND_USEGSSNAME; - if ((nd->nd_flag & ND_USEGSSNAME) && nmp->nm_krbnamelen > 0) - usegssname = 1; + if ((nd->nd_flag & ND_USEGSSNAME) != 0) { + /* + * If there is a client side host based credential, + * use that, otherwise use the system uid, if set. + */ + if (nmp->nm_krbnamelen > 0) { + usegssname = 1; + } else if (nmp->nm_uid != (uid_t)-1) { + saved_uid = cred->cr_uid; + cred->cr_uid = nmp->nm_uid; + set_uid = 1; + } + } else if (nmp->nm_krbnamelen == 0 && + nmp->nm_uid != (uid_t)-1 && cred->cr_uid == (uid_t)0) { + /* + * If there is no host based principal name and + * the system uid is set and this is root, use the + * system uid, since root won't have user + * credentials in a credentials cache file. + */ + saved_uid = cred->cr_uid; + cred->cr_uid = nmp->nm_uid; + set_uid = 1; + } if (NFSHASINTEGRITY(nmp)) secflavour = RPCSEC_GSS_KRB5I; else if (NFSHASPRIVACY(nmp)) @@ -462,14 +495,6 @@ newnfs_request(struct nfsrv_descript *nd ((nmp->nm_tprintf_delay)-(nmp->nm_tprintf_initial_delay)); } - /* - * XXX if not already connected call nfs_connect now. Longer - * term, change nfs_mount to call nfs_connect unconditionally - * and let clnt_reconnect_create handle reconnects. - */ - if (nrp->nr_client == NULL) - newnfs_connect(nmp, nrp, cred, td, 0); - if (nd->nd_procnum == NFSPROC_NULL) auth = authnone_create(); else if (usegssname) @@ -478,6 +503,8 @@ newnfs_request(struct nfsrv_descript *nd else auth = nfs_getauth(nrp, secflavour, NULL, srv_principal, NULL, cred); + if (set_uid) + cred->cr_uid = saved_uid; if (auth == NULL) { m_freem(nd->nd_mreq); return (EACCES); Modified: head/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvfsops.c Sun May 24 01:18:56 2009 (r192674) +++ head/sys/fs/nfsclient/nfs_clvfsops.c Sun May 24 03:22:49 2009 (r192675) @@ -1062,20 +1062,20 @@ mountnfs(struct nfs_args *argp, struct m nmp->nm_krbnamelen = argp->krbnamelen; nmp->nm_dirpathlen = argp->dirlen; nmp->nm_srvkrbnamelen = argp->srvkrbnamelen; - if (nmp->nm_dirpathlen > 0) { + if (td->td_ucred->cr_uid != (uid_t)0) { /* - * Since we will be doing dirpath as root, - * set nm_uid to the real uid doing the mount, - * since that is normally the user with a valid TGT. + * nm_uid is used to get KerberosV credentials for + * the nfsv4 state handling operations if there is + * no host based principal set. Use the uid of + * this user if not root, since they are doing the + * mount. I don't think setting this for root will + * work, since root normally does not have user + * credentials in a credentials cache. */ - nmp->nm_uid = td->td_ucred->cr_ruid; + nmp->nm_uid = td->td_ucred->cr_uid; } else { /* - * Just set to -1, so the first Op - * will set it later, to the uid of - * the process doing that (usually - * from a first open in the mount - * point). + * Just set to -1, so it won't be used. */ nmp->nm_uid = (uid_t)-1; } From owner-svn-src-head@FreeBSD.ORG Sun May 24 07:44:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05255106566B; Sun, 24 May 2009 07:44:01 +0000 (UTC) (envelope-from prvs=1388076d8b=brian@FreeBSD.org) Received: from idcmail-mo1so.shaw.ca (idcmail-mo1so.shaw.ca [24.71.223.10]) by mx1.freebsd.org (Postfix) with ESMTP id 9988C8FC13; Sun, 24 May 2009 07:43:56 +0000 (UTC) (envelope-from prvs=1388076d8b=brian@FreeBSD.org) Received: from pd4ml1so-ssvc.prod.shaw.ca ([10.0.141.141]) by pd3mo1so-svcs.prod.shaw.ca with ESMTP; 24 May 2009 01:15:06 -0600 X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.0 c=0 a=6I5d2MoRAAAA:8 a=sA-ssjpUAAAA:8 a=NyH9ZzuaM3mH3TXmokoA:9 a=Ya9cgGcA8_JnUO2ovTbRnaOqD2UA:4 a=SV7veod9ZcQA:10 a=WJ3hkfHDukgA:10 a=BhwSaWxvstEA:10 a=3btXR5R2BdcA:10 Received: from unknown (HELO store.lan.Awfulhak.org) ([174.7.23.140]) by pd4ml1so-dmz.prod.shaw.ca with ESMTP; 24 May 2009 01:15:06 -0600 Received: from store.lan.Awfulhak.org (localhost.localdomain [127.0.0.1]) by localhost (Email Security Appliance) with SMTP id 4B0CBC433AB_A18F408B; Sun, 24 May 2009 07:15:20 +0000 (GMT) Received: from gw.Awfulhak.org (gw.lan.Awfulhak.org [172.16.0.1]) by store.lan.Awfulhak.org (Sophos Email Appliance) with ESMTP id 18ED2C460FA_A18F402F; Sun, 24 May 2009 07:15:14 +0000 (GMT) Received: from dev.lan.Awfulhak.org (brian@dev.lan.Awfulhak.org [172.16.0.5]) by gw.Awfulhak.org (8.14.3/8.14.3) with ESMTP id n4O7Ex9B055143; Sun, 24 May 2009 00:14:59 -0700 (PDT) (envelope-from brian@FreeBSD.org) Date: Sun, 24 May 2009 00:14:59 -0700 From: Brian Somers To: Dag-Erling Smorgrav Message-ID: <20090524001459.69c93ca9@dev.lan.Awfulhak.org> In-Reply-To: <200905221846.n4MIkSY4015378@svn.freebsd.org> References: <200905221846.n4MIkSY4015378@svn.freebsd.org> X-Mailer: Claws Mail 3.7.1 (GTK+ 2.16.1; i386-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r192595 - in head: crypto/openssh crypto/openssh/openbsd-compat secure/lib/libssh secure/usr.sbin/sshd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 07:44:01 -0000 On Fri, 22 May 2009 18:46:28 +0000 (UTC) Dag-Erling Smorgrav wrote: > Author: des > Date: Fri May 22 18:46:28 2009 > New Revision: 192595 > URL: http://svn.freebsd.org/changeset/base/192595 > > Log: > Upgrade to OpenSSH 5.2p1. > > MFC after: 3 months [.....] Should this be MFCd a little sooner? http://news.zdnet.com/2100-9595_22-303182.html -- Brian Somers Don't _EVER_ lose your sense of humour ! From owner-svn-src-head@FreeBSD.ORG Sun May 24 09:42:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D05FC106567A; Sun, 24 May 2009 09:42:53 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BE6368FC28; Sun, 24 May 2009 09:42:53 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4O9graI082964; Sun, 24 May 2009 09:42:53 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4O9grwd082963; Sun, 24 May 2009 09:42:53 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200905240942.n4O9grwd082963@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sun, 24 May 2009 09:42:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192677 - head/share/man/man9 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 09:42:54 -0000 Author: trasz Date: Sun May 24 09:42:53 2009 New Revision: 192677 URL: http://svn.freebsd.org/changeset/base/192677 Log: Add new constants to the acl(9) manual page. Modified: head/share/man/man9/acl.9 Modified: head/share/man/man9/acl.9 ============================================================================== --- head/share/man/man9/acl.9 Sun May 24 03:49:07 2009 (r192676) +++ head/share/man/man9/acl.9 Sun May 24 09:42:53 2009 (r192677) @@ -59,7 +59,9 @@ Currently, each ACL is represented in-ke structure, defined as follows: .Bd -literal -offset indent struct acl { - int acl_cnt; + unsigned int acl_maxcnt; + unsigned int acl_cnt; + int acl_spare[4]; struct acl_entry acl_entry[ACL_MAX_ENTRIES]; }; .Ed @@ -67,6 +69,10 @@ struct acl { An ACL is constructed from a fixed size array of ACL entries, each of which consists of a set of permissions, principal namespace, and principal identifier. +In this implementation, the +.Vt acl_maxcnt +field is always set to +.Dv ACL_MAX_ENTRIES . .Pp Each individual ACL entry is of the type .Vt acl_entry_t , @@ -97,13 +103,20 @@ match the ACL entry qualifier. .It Dv ACL_MASK The maximum discretionary access rights that can be granted to a process in the file group class. +This is only valid for POSIX.1e ACLs. .It Dv ACL_OTHER Discretionary access rights for processes not covered by any other ACL entry. +This is only valid for POSIX.1e ACLs. .It Dv ACL_OTHER_OBJ Same as .Dv ACL_OTHER . -Each ACL entry must contain exactly one +.It Dv ACL_EVERYONE +Discretionary access rights for all users. +This is only valid for NFSv4 ACLs. +.El +.Pp +Each POSIX.1e ACL must contain exactly one .Dv ACL_USER_OBJ , one .Dv ACL_GROUP_OBJ , @@ -117,13 +130,19 @@ or are present, then exactly one .Dv ACL_MASK entry should be present. -.El .It Vt uid_t Va ae_id The ID of user for whom this ACL describes access permissions. +For entries other than +.Dv ACL_USER +and +.Dv ACL_GROUP , +this field should be set to +.Dv ACL_UNDEFINED_ID . .It Vt acl_perm_t Va ae_perm This field defines what kind of access the process matching this ACL has for accessing the associated file. -.Bl -tag -width ".Dv ACL_POSIX1E_BITS" +For POSIX.1e ACLs, the following are valid: +.Bl -tag -width ".Dv ACL_WRITE_NAMED_ATTRS" .It Dv ACL_EXECUTE The process may execute the associated file. .It Dv ACL_WRITE @@ -134,6 +153,57 @@ The process may read from the associated The process has no read, write or execute permissions to the associated file. .El +.Pp +For NFSv4 ACLs, the following are valid: +.Bl -tag -width ".Dv ACL_WRITE_NAMED_ATTRS" +.It Dv ACL_READ_DATA +The process may read from the associated file. +.It Dv ACL_LIST_DIRECTORY +Same as +.Dv ACL_READ_DATA . +.It Dv ACL_WRITE_DATA +The process may write to the associated file. +.It Dv ACL_ADD_FILE +Same as +.Dv ACL_ACL_WRITE_DATA . +.It Dv ACL_APPEND_DATA +.It Dv ACL_ADD_SUBDIRECTORY +Same as +.Dv ACL_APPEND_DATA . +.It Dv ACL_READ_NAMED_ATTRS +Ignored. +.It Dv ACL_WRITE_NAMED_ATTRS +Ignored. +.It Dv ACL_EXECUTE +The process may execute the associated file. +.It Dv ACL_DELETE_CHILD +.It Dv ACL_READ_ATTRIBUTES +.It Dv ACL_WRITE_ATTRIBUTES +.It Dv ACL_DELETE +.It Dv ACL_READ_ACL +.It Dv ACL_WRITE_ACL +.It Dv ACL_WRITE_OWNER +.It Dv ACL_SYNCHRONIZE +Ignored. +.El +.It Vt acl_entry_type_t Va ae_entry_type +This field defines the type of NFSv4 ACL entry. +It is not used with POSIX.1e ACLs. +The following values are valid: +.Bl -tag -width ".Dv ACL_WRITE_NAMED_ATTRS" +.It Dv ACL_ENTRY_TYPE_ALLOW +.It Dv ACL_ENTRY_TYPE_DENY +.El +.It Vt acl_flag_t Va ae_flags +This field defines the inheritance flags of NFSv4 ACL entry. +It is not used with POSIX.1e ACLs. +The following values are valid: +.Bl -tag -width ".Dv ACL_ENTRY_DIRECTORY_INHERIT" +.It Dv ACL_ENTRY_FILE_INHERIT +.It Dv ACL_ENTRY_DIRECTORY_INHERIT +.It Dv ACL_ENRY_NO_PROPAGATE_INHERIT +.It Dv ACL_ENTRY_INHERIT_ONLY +.El .El .Sh SEE ALSO .Xr acl 3 , From owner-svn-src-head@FreeBSD.ORG Sun May 24 10:23:31 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4B9E106564A; Sun, 24 May 2009 10:23:31 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 910898FC17; Sun, 24 May 2009 10:23:31 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (cm-84.215.252.34.getinternet.no [84.215.252.34]) by smtp.des.no (Postfix) with ESMTP id 9B9616D418; Sun, 24 May 2009 12:23:30 +0200 (CEST) Received: by ds4.des.no (Postfix, from userid 1001) id 8184D844E2; Sun, 24 May 2009 12:23:30 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Brian Somers References: <200905221846.n4MIkSY4015378@svn.freebsd.org> <20090524001459.69c93ca9@dev.lan.Awfulhak.org> Date: Sun, 24 May 2009 12:23:30 +0200 In-Reply-To: <20090524001459.69c93ca9@dev.lan.Awfulhak.org> (Brian Somers's message of "Sun, 24 May 2009 00:14:59 -0700") Message-ID: <86d49yx0il.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r192595 - in head: crypto/openssh crypto/openssh/openbsd-compat secure/lib/libssh secure/usr.sbin/sshd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 10:23:32 -0000 Brian Somers writes: > Should this be MFCd a little sooner? > > http://news.zdnet.com/2100-9595_22-303182.html Where to begin... 1) ZDNet is about six months behind - this was discovered in November of last year. 2) They also got the numbers wrong; it's 14 bits at 2^-14 chance of success. 4) They got a lot of other details wrong, including the claim that this is a "design flaw in OpenSSH". It's a design flaw in the SSH protocol, and should affect any SSH implementation that uses CBC. 3) It is completely impractical, because every failed attempt kills the connection, and it takes several thousand attempts to recover anything at all. In the "how worried should I be" department, it's about neck and neck with MD5 collisions. 4) If it *does* worry you, adding the following line at the bottom of /etc/ssh_config and /etc/sshd_config will take care of it: Ciphers aes128-ctr,aes256-ctr,arcfour256,arcfour,aes128-cbc,aes256-cbc On systems where you don't have root access, you can add it to the "Host *" section in your ~/.ssh/config: Host * Ciphers aes128-ctr,aes256-ctr,arcfour256,arcfour,aes128-cbc,aes256-cbc Your SSH client / server will then use CBC only if there is no other alternative. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Sun May 24 11:10:28 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 137871065675; Sun, 24 May 2009 11:10:28 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DBC8B8FC12; Sun, 24 May 2009 11:10:27 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4OBARIM088026; Sun, 24 May 2009 11:10:27 GMT (envelope-from dfr@svn.freebsd.org) Received: (from dfr@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4OBARpV088025; Sun, 24 May 2009 11:10:27 GMT (envelope-from dfr@svn.freebsd.org) Message-Id: <200905241110.n4OBARpV088025@svn.freebsd.org> From: Doug Rabson Date: Sun, 24 May 2009 11:10:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192678 - in head/sys: kgssapi nfsserver X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 11:10:28 -0000 Author: dfr Date: Sun May 24 11:10:27 2009 New Revision: 192678 URL: http://svn.freebsd.org/changeset/base/192678 Log: Fix build of KGSSAPI bits post-vimage. Modified: head/sys/kgssapi/gsstest.c head/sys/nfsserver/nfs_srvkrpc.c Modified: head/sys/kgssapi/gsstest.c ============================================================================== --- head/sys/kgssapi/gsstest.c Sun May 24 09:42:53 2009 (r192677) +++ head/sys/kgssapi/gsstest.c Sun May 24 11:10:27 2009 (r192678) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -227,7 +228,7 @@ gsstest_1(void) { static char sbuf[512]; - snprintf(sbuf, sizeof(sbuf), "nfs@%s", hostname); + snprintf(sbuf, sizeof(sbuf), "nfs@%s", V_hostname); name_desc.value = sbuf; } @@ -430,7 +431,7 @@ gsstest_2(int step, const gss_buffer_t i case 1: if (server_context == GSS_C_NO_CONTEXT) { static char sbuf[512]; - snprintf(sbuf, sizeof(sbuf), "nfs@%s", hostname); + snprintf(sbuf, sizeof(sbuf), "nfs@%s", V_hostname); name_desc.value = sbuf; name_desc.length = strlen((const char *) name_desc.value); @@ -811,7 +812,7 @@ gsstest_3(void) return(1); } - snprintf(service, sizeof(service), "host@%s", hostname); + snprintf(service, sizeof(service), "host@%s", V_hostname); auth = rpc_gss_seccreate(client, curthread->td_ucred, service, "kerberosv5", rpc_gss_svc_privacy, @@ -881,7 +882,7 @@ gsstest_4(void) const char **mechs; static rpc_gss_callback_t cb; - snprintf(principal, sizeof(principal), "host@%s", hostname); + snprintf(principal, sizeof(principal), "host@%s", V_hostname); mechs = rpc_gss_get_mechanisms(); while (*mechs) { Modified: head/sys/nfsserver/nfs_srvkrpc.c ============================================================================== --- head/sys/nfsserver/nfs_srvkrpc.c Sun May 24 09:42:53 2009 (r192677) +++ head/sys/nfsserver/nfs_srvkrpc.c Sun May 24 11:10:27 2009 (r192678) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -488,7 +489,7 @@ nfssvc_nfsd(struct thread *td, struct nf if (error) return (error); } else { - snprintf(principal, sizeof(principal), "nfs@%s", hostname); + snprintf(principal, sizeof(principal), "nfs@%s", V_hostname); } #endif From owner-svn-src-head@FreeBSD.ORG Sun May 24 11:37:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2D47106566C; Sun, 24 May 2009 11:37:10 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A1E9D8FC19; Sun, 24 May 2009 11:37:10 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4OBbA1s088558; Sun, 24 May 2009 11:37:10 GMT (envelope-from dfr@svn.freebsd.org) Received: (from dfr@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4OBbAxI088557; Sun, 24 May 2009 11:37:10 GMT (envelope-from dfr@svn.freebsd.org) Message-Id: <200905241137.n4OBbAxI088557@svn.freebsd.org> From: Doug Rabson Date: Sun, 24 May 2009 11:37:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192679 - head/lib/libstand X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 11:37:11 -0000 Author: dfr Date: Sun May 24 11:37:10 2009 New Revision: 192679 URL: http://svn.freebsd.org/changeset/base/192679 Log: Increase the number of available file descriptors to 64. This fixes the reported zfsboot problems for systems where more than seven drives are part of ZFS pools. Modified: head/lib/libstand/stand.h Modified: head/lib/libstand/stand.h ============================================================================== --- head/lib/libstand/stand.h Sun May 24 11:10:27 2009 (r192678) +++ head/lib/libstand/stand.h Sun May 24 11:37:10 2009 (r192679) @@ -167,7 +167,7 @@ struct open_file { #define SOPEN_RASIZE 512 }; -#define SOPEN_MAX 8 +#define SOPEN_MAX 64 extern struct open_file files[]; /* f_flags values */ From owner-svn-src-head@FreeBSD.ORG Sun May 24 11:39:52 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9AF79106566B; Sun, 24 May 2009 11:39:52 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from itchy.rabson.org (router.rabson.org [80.177.232.241]) by mx1.freebsd.org (Postfix) with ESMTP id 4EC3A8FC1A; Sun, 24 May 2009 11:39:52 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from [IPv6:2001:470:909f:1:225:ff:feed:9426] (unknown [IPv6:2001:470:909f:1:225:ff:feed:9426]) by itchy.rabson.org (Postfix) with ESMTP id 3C17C5D43; Sun, 24 May 2009 12:40:39 +0100 (BST) Message-Id: <7AC0926C-3FA1-4EEC-9438-643FF7D310A7@rabson.org> From: Doug Rabson To: d@delphij.net In-Reply-To: <4A1734DC.6080203@delphij.net> Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v935.3) Date: Sun, 24 May 2009 12:39:21 +0100 References: <200905161048.n4GAmKRh057122@svn.freebsd.org> <4A1734DC.6080203@delphij.net> X-Mailer: Apple Mail (2.935.3) Cc: svn-src-head@FreeBSD.ORG, Doug Rabson , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG Subject: Re: svn commit: r192194 - in head/sys: boot/i386/zfsboot boot/zfs cddl/boot/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 11:39:53 -0000 On 23 May 2009, at 00:27, Xin LI wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi, Doug, > > Doug Rabson wrote: >> Author: dfr >> Date: Sat May 16 10:48:20 2009 >> New Revision: 192194 >> URL: http://svn.freebsd.org/changeset/base/192194 >> >> Log: >> Add support for booting from raidz1 and raidz2 pools. >> >> Modified: >> head/sys/boot/i386/zfsboot/zfsboot.c >> head/sys/boot/zfs/zfsimpl.c >> head/sys/cddl/boot/zfs/README >> head/sys/cddl/boot/zfs/zfsimpl.h >> head/sys/cddl/boot/zfs/zfssubr.c > > I think this commit has broken booting from mirrored zpool when raidz2 > pool is exist. In my setup it was 4 disks: This should be fixed in r192679. From owner-svn-src-head@FreeBSD.ORG Sun May 24 12:28:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ABED6106564A; Sun, 24 May 2009 12:28:38 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9AA2D8FC1D; Sun, 24 May 2009 12:28:38 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4OCScb2089633; Sun, 24 May 2009 12:28:38 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4OCSckJ089632; Sun, 24 May 2009 12:28:38 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200905241228.n4OCSckJ089632@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 24 May 2009 12:28:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192681 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 12:28:39 -0000 Author: kib Date: Sun May 24 12:28:38 2009 New Revision: 192681 URL: http://svn.freebsd.org/changeset/base/192681 Log: Replace the while statement with the if for clarity. The loop body cannot be executed more then once. Reviewed by: dfr Tested by: pho MFC after: 1 month Modified: head/sys/kern/kern_lockf.c Modified: head/sys/kern/kern_lockf.c ============================================================================== --- head/sys/kern/kern_lockf.c Sun May 24 11:52:08 2009 (r192680) +++ head/sys/kern/kern_lockf.c Sun May 24 12:28:38 2009 (r192681) @@ -1361,7 +1361,7 @@ lf_setlock(struct lockf *state, struct l /* * Scan lock list for this file looking for locks that would block us. */ - while (lf_getblock(state, lock)) { + if (lf_getblock(state, lock)) { /* * Free the structure and return if nonblocking. */ From owner-svn-src-head@FreeBSD.ORG Sun May 24 12:32:04 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 371A4106564A; Sun, 24 May 2009 12:32:04 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 25EC58FC08; Sun, 24 May 2009 12:32:04 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4OCW4qt089742; Sun, 24 May 2009 12:32:04 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4OCW4Za089741; Sun, 24 May 2009 12:32:04 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200905241232.n4OCW4Za089741@svn.freebsd.org> From: Ed Schouten Date: Sun, 24 May 2009 12:32:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192682 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 12:32:04 -0000 Author: ed Date: Sun May 24 12:32:03 2009 New Revision: 192682 URL: http://svn.freebsd.org/changeset/base/192682 Log: Block when initially opening a TTY multiple times. In the original MPSAFE TTY code, I changed the behaviour by returning EBUSY. I thought this made more sense, because it's basically a race to see who gets the TTY first. It turns out this is not a good change, because it also causes EBUSY to be returned when another process is closing the TTY. This can happen during startup, when /etc/rc (or one of its children) is still busy draining its data and /sbin/init is attempting to open the TTY to spawn a getty. Reported by: bz Tested by: bz Modified: head/sys/kern/tty.c Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Sun May 24 12:28:38 2009 (r192681) +++ head/sys/kern/tty.c Sun May 24 12:32:03 2009 (r192682) @@ -206,6 +206,7 @@ ttydev_leave(struct tty *tp) ttydevsw_close(tp); tp->t_flags &= ~TF_OPENCLOSE; + cv_broadcast(&tp->t_dcdwait); tty_rel_free(tp); } @@ -231,13 +232,17 @@ ttydev_open(struct cdev *dev, int oflags tty_unlock(tp); return (ENXIO); } + /* - * Prevent the TTY from being opened when being torn down or - * built up by unrelated processes. + * Block when other processes are currently opening or closing + * the TTY. */ - if (tp->t_flags & TF_OPENCLOSE) { - tty_unlock(tp); - return (EBUSY); + while (tp->t_flags & TF_OPENCLOSE) { + error = tty_wait(tp, &tp->t_dcdwait); + if (error != 0) { + tty_unlock(tp); + return (error); + } } tp->t_flags |= TF_OPENCLOSE; @@ -299,6 +304,7 @@ ttydev_open(struct cdev *dev, int oflags tp->t_flags |= TF_OPENED_IN; done: tp->t_flags &= ~TF_OPENCLOSE; + cv_broadcast(&tp->t_dcdwait); ttydev_leave(tp); return (error); From owner-svn-src-head@FreeBSD.ORG Sun May 24 12:33:16 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4A4E10656F9; Sun, 24 May 2009 12:33:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B10488FC22; Sun, 24 May 2009 12:33:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4OCXGos089815; Sun, 24 May 2009 12:33:16 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4OCXGkd089814; Sun, 24 May 2009 12:33:16 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200905241233.n4OCXGkd089814@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 24 May 2009 12:33:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192683 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 12:33:19 -0000 Author: kib Date: Sun May 24 12:33:16 2009 New Revision: 192683 URL: http://svn.freebsd.org/changeset/base/192683 Log: In lf_advlockasync(), recheck for doomed vnode after the state->ls_lock is acquired. In the lf_purgelocks(), assert that vnode is doomed and set *statep to NULL before clearing ls_pending list. Otherwise, we allow for the thread executing lf_advlockasync() to put new pending entry after state->ls_lock is dropped in lf_purgelocks(). Reviewed by: dfr Tested by: pho MFC after: 1 month Modified: head/sys/kern/kern_lockf.c Modified: head/sys/kern/kern_lockf.c ============================================================================== --- head/sys/kern/kern_lockf.c Sun May 24 12:32:03 2009 (r192682) +++ head/sys/kern/kern_lockf.c Sun May 24 12:33:16 2009 (r192683) @@ -633,7 +633,20 @@ lf_advlockasync(struct vop_advlockasync_ } sx_xlock(&state->ls_lock); - switch(ap->a_op) { + /* + * Recheck the doomed vnode after state->ls_lock is + * locked. lf_purgelocks() requires that no new threads add + * pending locks when vnode is marked by VI_DOOMED flag. + */ + VI_LOCK(vp); + if (vp->v_iflag & VI_DOOMED) { + VI_UNLOCK(vp); + lf_free_lock(lock); + return (ENOENT); + } + VI_UNLOCK(vp); + + switch (ap->a_op) { case F_SETLK: error = lf_setlock(state, lock, vp, ap->a_cookiep); break; @@ -755,8 +768,11 @@ lf_purgelocks(struct vnode *vp, struct l * the remaining locks. */ VI_LOCK(vp); + KASSERT(vp->v_iflag & VI_DOOMED, + ("lf_purgelocks: vp %p has not vgone yet", vp)); state = *statep; if (state) { + *statep = NULL; state->ls_threads++; VI_UNLOCK(vp); @@ -789,7 +805,6 @@ lf_purgelocks(struct vnode *vp, struct l VI_LOCK(vp); while (state->ls_threads > 1) msleep(state, VI_MTX(vp), 0, "purgelocks", 0); - *statep = 0; VI_UNLOCK(vp); /* From owner-svn-src-head@FreeBSD.ORG Sun May 24 12:37:55 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D50431065676; Sun, 24 May 2009 12:37:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C331F8FC0C; Sun, 24 May 2009 12:37:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4OCbtZ0089948; Sun, 24 May 2009 12:37:55 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4OCbtmI089947; Sun, 24 May 2009 12:37:55 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200905241237.n4OCbtmI089947@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 24 May 2009 12:37:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192684 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 12:37:56 -0000 Author: kib Date: Sun May 24 12:37:55 2009 New Revision: 192684 URL: http://svn.freebsd.org/changeset/base/192684 Log: In lf_purgelocks(), assert that state->ls_pending is empty after we weeded out threads, and clean ls_active instead of ls_pending. Reviewed by: dfr Tested by: pho MFC after: 1 month Modified: head/sys/kern/kern_lockf.c Modified: head/sys/kern/kern_lockf.c ============================================================================== --- head/sys/kern/kern_lockf.c Sun May 24 12:33:16 2009 (r192683) +++ head/sys/kern/kern_lockf.c Sun May 24 12:37:55 2009 (r192684) @@ -813,7 +813,9 @@ lf_purgelocks(struct vnode *vp, struct l * above). We don't need to bother locking since we * are the last thread using this state structure. */ - LIST_FOREACH_SAFE(lock, &state->ls_pending, lf_link, nlock) { + KASSERT(LIST_EMPTY(&state->ls_pending), + ("lock pending for %p", state)); + LIST_FOREACH_SAFE(lock, &state->ls_active, lf_link, nlock) { LIST_REMOVE(lock, lf_link); lf_free_lock(lock); } From owner-svn-src-head@FreeBSD.ORG Sun May 24 12:39:39 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 62029106564A; Sun, 24 May 2009 12:39:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 45E058FC1F; Sun, 24 May 2009 12:39:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4OCddNn090015; Sun, 24 May 2009 12:39:39 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4OCddD8090013; Sun, 24 May 2009 12:39:39 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200905241239.n4OCddD8090013@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 24 May 2009 12:39:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192685 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 12:39:39 -0000 Author: kib Date: Sun May 24 12:39:38 2009 New Revision: 192685 URL: http://svn.freebsd.org/changeset/base/192685 Log: The advisory lock may be activated or activated and removed during the sleep waiting for conditions when the lock may be granted. To prevent lf_setlock() from accessing possibly freed memory, add reference counting to the struct lockf_entry. Bump refcount around the sleep. Make lf_free_lock() return non-zero when structure was freed, and use this after the sleep to return EINTR to the caller. The error code might need a clarification, but we cannot return success to usermode, since the lock is not owned anymore. Reviewed by: dfr Tested by: pho MFC after: 1 month Modified: head/sys/kern/kern_lockf.c head/sys/sys/lockf.h Modified: head/sys/kern/kern_lockf.c ============================================================================== --- head/sys/kern/kern_lockf.c Sun May 24 12:37:55 2009 (r192684) +++ head/sys/kern/kern_lockf.c Sun May 24 12:39:38 2009 (r192685) @@ -106,7 +106,7 @@ static int lf_owner_matches(struct lock int); static struct lockf_entry * lf_alloc_lock(struct lock_owner *); -static void lf_free_lock(struct lockf_entry *); +static int lf_free_lock(struct lockf_entry *); static int lf_clearlock(struct lockf *, struct lockf_entry *); static int lf_overlaps(struct lockf_entry *, struct lockf_entry *); static int lf_blocks(struct lockf_entry *, struct lockf_entry *); @@ -347,9 +347,13 @@ lf_alloc_lock(struct lock_owner *lo) return (lf); } -static void +static int lf_free_lock(struct lockf_entry *lock) { + + KASSERT(lock->lf_refs > 0, ("lockf_entry negative ref count %p", lock)); + if (--lock->lf_refs > 0) + return (0); /* * Adjust the lock_owner reference count and * reclaim the entry if this is the last lock @@ -394,6 +398,7 @@ lf_free_lock(struct lockf_entry *lock) printf("Freed lock %p\n", lock); #endif free(lock, M_LOCKF); + return (1); } /* @@ -540,6 +545,7 @@ lf_advlockasync(struct vop_advlockasync_ * the lf_lock_owners_lock tax twice. */ lock = lf_alloc_lock(NULL); + lock->lf_refs = 1; lock->lf_start = start; lock->lf_end = end; lock->lf_owner = lo; @@ -1447,7 +1453,13 @@ lf_setlock(struct lockf *state, struct l goto out; } + lock->lf_refs++; error = sx_sleep(lock, &state->ls_lock, priority, lockstr, 0); + if (lf_free_lock(lock)) { + error = EINTR; + goto out; + } + /* * We may have been awakened by a signal and/or by a * debugger continuing us (in which cases we must @@ -1809,6 +1821,7 @@ lf_split(struct lockf *state, struct loc */ splitlock = lf_alloc_lock(lock1->lf_owner); memcpy(splitlock, lock1, sizeof *splitlock); + splitlock->lf_refs = 1; if (splitlock->lf_flags & F_REMOTE) vref(splitlock->lf_vnode); Modified: head/sys/sys/lockf.h ============================================================================== --- head/sys/sys/lockf.h Sun May 24 12:37:55 2009 (r192684) +++ head/sys/sys/lockf.h Sun May 24 12:39:38 2009 (r192685) @@ -80,6 +80,7 @@ struct lockf_entry { LIST_ENTRY(lockf_entry) lf_link; /* (s) Linkage for lock lists */ struct lockf_edge_list lf_outedges; /* (s) list of out-edges */ struct lockf_edge_list lf_inedges; /* (s) list of out-edges */ + int lf_refs; /* (s) ref count */ }; LIST_HEAD(lockf_entry_list, lockf_entry); From owner-svn-src-head@FreeBSD.ORG Sun May 24 13:22:00 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFA7B106566C; Sun, 24 May 2009 13:22:00 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A37EC8FC08; Sun, 24 May 2009 13:22:00 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4ODM0T4090868; Sun, 24 May 2009 13:22:00 GMT (envelope-from dfr@svn.freebsd.org) Received: (from dfr@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4ODM0B2090867; Sun, 24 May 2009 13:22:00 GMT (envelope-from dfr@svn.freebsd.org) Message-Id: <200905241322.n4ODM0B2090867@svn.freebsd.org> From: Doug Rabson Date: Sun, 24 May 2009 13:22:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192686 - head/sys/nfsclient X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 13:22:01 -0000 Author: dfr Date: Sun May 24 13:22:00 2009 New Revision: 192686 URL: http://svn.freebsd.org/changeset/base/192686 Log: Make sure we feed 32bit align memory to nfsm_dissect otherwise we will fault on platforms with strict alignment requirements. In particular, this fixes the problems with the new RPC transport on the arm platform. Note: this adds yet another copy of nfs_realign(). I will attempt to refactor after NFS_LEGACYRPC is removed. Submitted by: sam Modified: head/sys/nfsclient/nfs_krpc.c Modified: head/sys/nfsclient/nfs_krpc.c ============================================================================== --- head/sys/nfsclient/nfs_krpc.c Sun May 24 12:39:38 2009 (r192685) +++ head/sys/nfsclient/nfs_krpc.c Sun May 24 13:22:00 2009 (r192686) @@ -407,6 +407,65 @@ nfs_feedback(int type, int proc, void *a } /* + * nfs_realign: + * + * Check for badly aligned mbuf data and realign by copying the unaligned + * portion of the data into a new mbuf chain and freeing the portions + * of the old chain that were replaced. + * + * We cannot simply realign the data within the existing mbuf chain + * because the underlying buffers may contain other rpc commands and + * we cannot afford to overwrite them. + * + * We would prefer to avoid this situation entirely. The situation does + * not occur with NFS/UDP and is supposed to only occassionally occur + * with TCP. Use vfs.nfs.realign_count and realign_test to check this. + * + */ +static int +nfs_realign(struct mbuf **pm, int hsiz) +{ + struct mbuf *m, *n; + int off, space; + + ++nfs_realign_test; + while ((m = *pm) != NULL) { + if ((m->m_len & 0x3) || (mtod(m, intptr_t) & 0x3)) { + /* + * NB: we can't depend on m_pkthdr.len to help us + * decide what to do here. May not be worth doing + * the m_length calculation as m_copyback will + * expand the mbuf chain below as needed. + */ + space = m_length(m, NULL); + if (space >= MINCLSIZE) { + /* NB: m_copyback handles space > MCLBYTES */ + n = m_getcl(M_DONTWAIT, MT_DATA, 0); + } else + n = m_get(M_DONTWAIT, MT_DATA); + if (n == NULL) + return (ENOMEM); + /* + * Align the remainder of the mbuf chain. + */ + n->m_len = 0; + off = 0; + while (m != NULL) { + m_copyback(n, off, m->m_len, mtod(m, caddr_t)); + off += m->m_len; + m = m->m_next; + } + m_freem(*pm); + *pm = n; + ++nfs_realign_count; + break; + } + pm = &m->m_next; + } + return (0); +} + +/* * nfs_request - goes something like this * - fill in request struct * - links it into list @@ -525,12 +584,25 @@ tryagain: } else { error = EACCES; } - md = mrep; if (error) goto nfsmout; KASSERT(mrep != NULL, ("mrep shouldn't be NULL if no error\n")); + /* + * Search for any mbufs that are not a multiple of 4 bytes long + * or with m_data not longword aligned. + * These could cause pointer alignment problems, so copy them to + * well aligned mbufs. + */ + error = nfs_realign(&mrep, 2 * NFSX_UNSIGNED); + if (error == ENOMEM) { + m_freem(mrep); + AUTH_DESTROY(auth); + return (error); + } + + md = mrep; dpos = mtod(mrep, caddr_t); tl = nfsm_dissect(u_int32_t *, NFSX_UNSIGNED); if (*tl != 0) { From owner-svn-src-head@FreeBSD.ORG Sun May 24 14:01:09 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66B02106566C; Sun, 24 May 2009 14:01:09 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from itchy.rabson.org (router.rabson.org [80.177.232.241]) by mx1.freebsd.org (Postfix) with ESMTP id 3EEDC8FC15; Sun, 24 May 2009 14:01:08 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from [IPv6:2001:470:909f:1:225:ff:feed:9426] (unknown [IPv6:2001:470:909f:1:225:ff:feed:9426]) by itchy.rabson.org (Postfix) with ESMTP id B68595D9F; Sun, 24 May 2009 15:01:55 +0100 (BST) Message-Id: From: Doug Rabson To: Doug Rabson In-Reply-To: <200905241322.n4ODM0B2090867@svn.freebsd.org> Mime-Version: 1.0 (Apple Message framework v935.3) Date: Sun, 24 May 2009 15:00:37 +0100 References: <200905241322.n4ODM0B2090867@svn.freebsd.org> X-Mailer: Apple Mail (2.935.3) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192686 - head/sys/nfsclient X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 14:01:09 -0000 Also, this problem appears to be there in the new experimental NFS client code as well. I haven't tried to fix that. On 24 May 2009, at 14:22, Doug Rabson wrote: > Author: dfr > Date: Sun May 24 13:22:00 2009 > New Revision: 192686 > URL: http://svn.freebsd.org/changeset/base/192686 > > Log: > Make sure we feed 32bit align memory to nfsm_dissect otherwise we > will fault > on platforms with strict alignment requirements. In particular, > this fixes the > problems with the new RPC transport on the arm platform. > > Note: this adds yet another copy of nfs_realign(). I will attempt > to refactor > after NFS_LEGACYRPC is removed. > > Submitted by: sam > > Modified: > head/sys/nfsclient/nfs_krpc.c > > Modified: head/sys/nfsclient/nfs_krpc.c > = > = > = > = > = > = > = > = > ====================================================================== > --- head/sys/nfsclient/nfs_krpc.c Sun May 24 12:39:38 2009 (r192685) > +++ head/sys/nfsclient/nfs_krpc.c Sun May 24 13:22:00 2009 (r192686) > @@ -407,6 +407,65 @@ nfs_feedback(int type, int proc, void *a > } > > /* > + * nfs_realign: > + * > + * Check for badly aligned mbuf data and realign by copying the > unaligned > + * portion of the data into a new mbuf chain and freeing the portions > + * of the old chain that were replaced. > + * > + * We cannot simply realign the data within the existing mbuf chain > + * because the underlying buffers may contain other rpc commands and > + * we cannot afford to overwrite them. > + * > + * We would prefer to avoid this situation entirely. The situation > does > + * not occur with NFS/UDP and is supposed to only occassionally occur > + * with TCP. Use vfs.nfs.realign_count and realign_test to check > this. > + * > + */ > +static int > +nfs_realign(struct mbuf **pm, int hsiz) > +{ > + struct mbuf *m, *n; > + int off, space; > + > + ++nfs_realign_test; > + while ((m = *pm) != NULL) { > + if ((m->m_len & 0x3) || (mtod(m, intptr_t) & 0x3)) { > + /* > + * NB: we can't depend on m_pkthdr.len to help us > + * decide what to do here. May not be worth doing > + * the m_length calculation as m_copyback will > + * expand the mbuf chain below as needed. > + */ > + space = m_length(m, NULL); > + if (space >= MINCLSIZE) { > + /* NB: m_copyback handles space > MCLBYTES */ > + n = m_getcl(M_DONTWAIT, MT_DATA, 0); > + } else > + n = m_get(M_DONTWAIT, MT_DATA); > + if (n == NULL) > + return (ENOMEM); > + /* > + * Align the remainder of the mbuf chain. > + */ > + n->m_len = 0; > + off = 0; > + while (m != NULL) { > + m_copyback(n, off, m->m_len, mtod(m, caddr_t)); > + off += m->m_len; > + m = m->m_next; > + } > + m_freem(*pm); > + *pm = n; > + ++nfs_realign_count; > + break; > + } > + pm = &m->m_next; > + } > + return (0); > +} > + > +/* > * nfs_request - goes something like this > * - fill in request struct > * - links it into list > @@ -525,12 +584,25 @@ tryagain: > } else { > error = EACCES; > } > - md = mrep; > if (error) > goto nfsmout; > > KASSERT(mrep != NULL, ("mrep shouldn't be NULL if no error\n")); > > + /* > + * Search for any mbufs that are not a multiple of 4 bytes long > + * or with m_data not longword aligned. > + * These could cause pointer alignment problems, so copy them to > + * well aligned mbufs. > + */ > + error = nfs_realign(&mrep, 2 * NFSX_UNSIGNED); > + if (error == ENOMEM) { > + m_freem(mrep); > + AUTH_DESTROY(auth); > + return (error); > + } > + > + md = mrep; > dpos = mtod(mrep, caddr_t); > tl = nfsm_dissect(u_int32_t *, NFSX_UNSIGNED); > if (*tl != 0) { From owner-svn-src-head@FreeBSD.ORG Sun May 24 15:27:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 374631065670; Sun, 24 May 2009 15:27:26 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 25B4D8FC0A; Sun, 24 May 2009 15:27:26 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4OFRQSL093299; Sun, 24 May 2009 15:27:26 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4OFRQMl093298; Sun, 24 May 2009 15:27:26 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <200905241527.n4OFRQMl093298@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 24 May 2009 15:27:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192687 - head/bin/chflags X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 15:27:26 -0000 Author: jilles Date: Sun May 24 15:27:25 2009 New Revision: 192687 URL: http://svn.freebsd.org/changeset/base/192687 Log: Fix chflags -h in various cases: do not use link target's flags as original. Patch slightly changed to align more with chmod.c. PR: bin/131999 Submitted by: bde Approved by: ed (mentor) MFC after: 3 weeks Modified: head/bin/chflags/chflags.c Modified: head/bin/chflags/chflags.c ============================================================================== --- head/bin/chflags/chflags.c Sun May 24 13:22:00 2009 (r192686) +++ head/bin/chflags/chflags.c Sun May 24 15:27:25 2009 (r192687) @@ -115,7 +115,7 @@ main(int argc, char *argv[]) fts_options |= FTS_LOGICAL; } } else - fts_options = FTS_LOGICAL; + fts_options = hflag ? FTS_PHYSICAL : FTS_LOGICAL; /* XXX: Why don't chflags and lchflags have compatible prototypes? */ if (hflag) From owner-svn-src-head@FreeBSD.ORG Sun May 24 15:32:34 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7AB55106566C; Sun, 24 May 2009 15:32:34 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 69AA78FC12; Sun, 24 May 2009 15:32:34 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4OFWYmo093447; Sun, 24 May 2009 15:32:34 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4OFWYHt093446; Sun, 24 May 2009 15:32:34 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <200905241532.n4OFWYHt093446@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 24 May 2009 15:32:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192688 - head/bin/ps X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 15:32:34 -0000 Author: jilles Date: Sun May 24 15:32:34 2009 New Revision: 192688 URL: http://svn.freebsd.org/changeset/base/192688 Log: Fix elapsed (etime) field for swapped out processes in ps: show '-' instead of time since the Epoch. PR: bin/123069 Submitted by: Vladimir Kozbin Approved by: ed (mentor) MFC after: 3 weeks Modified: head/bin/ps/print.c Modified: head/bin/ps/print.c ============================================================================== --- head/bin/ps/print.c Sun May 24 15:27:25 2009 (r192687) +++ head/bin/ps/print.c Sun May 24 15:32:34 2009 (r192688) @@ -596,6 +596,10 @@ elapsed(KINFO *k, VARENT *ve) char obuff[128]; v = ve->var; + if (!k->ki_valid) { + (void)printf("%-*s", v->width, "-"); + return; + } val = now - k->ki_p->ki_start.tv_sec; days = val / (24 * 60 * 60); val %= 24 * 60 * 60; From owner-svn-src-head@FreeBSD.ORG Sun May 24 15:48:49 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CCE6106566B; Sun, 24 May 2009 15:48:49 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0A0DC8FC18; Sun, 24 May 2009 15:48:49 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4OFmmdr093775; Sun, 24 May 2009 15:48:48 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4OFmmsM093774; Sun, 24 May 2009 15:48:48 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200905241548.n4OFmmsM093774@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sun, 24 May 2009 15:48:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192689 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 15:48:50 -0000 Author: trasz Date: Sun May 24 15:48:48 2009 New Revision: 192689 URL: http://svn.freebsd.org/changeset/base/192689 Log: Fix comment. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun May 24 15:32:34 2009 (r192688) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun May 24 15:48:48 2009 (r192689) @@ -3963,7 +3963,7 @@ static int zfs_freebsd_access(ap) struct vop_access_args /* { struct vnode *a_vp; - int a_accmode; + accmode_t a_accmode; struct ucred *a_cred; struct thread *a_td; } */ *ap; From owner-svn-src-head@FreeBSD.ORG Sun May 24 17:08:00 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84F75106566B; Sun, 24 May 2009 17:08:00 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 730008FC12; Sun, 24 May 2009 17:08:00 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4OH8034095406; Sun, 24 May 2009 17:08:00 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4OH80Fp095405; Sun, 24 May 2009 17:08:00 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200905241708.n4OH80Fp095405@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sun, 24 May 2009 17:08:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192690 - head/share/man/man9 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 17:08:01 -0000 Author: trasz Date: Sun May 24 17:08:00 2009 New Revision: 192690 URL: http://svn.freebsd.org/changeset/base/192690 Log: Fix typo in the manual page. Modified: head/share/man/man9/acl.9 Modified: head/share/man/man9/acl.9 ============================================================================== --- head/share/man/man9/acl.9 Sun May 24 15:48:48 2009 (r192689) +++ head/share/man/man9/acl.9 Sun May 24 17:08:00 2009 (r192690) @@ -201,7 +201,7 @@ The following values are valid: .Bl -tag -width ".Dv ACL_ENTRY_DIRECTORY_INHERIT" .It Dv ACL_ENTRY_FILE_INHERIT .It Dv ACL_ENTRY_DIRECTORY_INHERIT -.It Dv ACL_ENRY_NO_PROPAGATE_INHERIT +.It Dv ACL_ENRTY_NO_PROPAGATE_INHERIT .It Dv ACL_ENTRY_INHERIT_ONLY .El .El From owner-svn-src-head@FreeBSD.ORG Sun May 24 18:34:55 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61A53106564A; Sun, 24 May 2009 18:34:55 +0000 (UTC) (envelope-from tmclaugh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4EBBC8FC1A; Sun, 24 May 2009 18:34:55 +0000 (UTC) (envelope-from tmclaugh@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4OIYsE6097198; Sun, 24 May 2009 18:34:55 GMT (envelope-from tmclaugh@svn.freebsd.org) Received: (from tmclaugh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4OIYstO097192; Sun, 24 May 2009 18:34:54 GMT (envelope-from tmclaugh@svn.freebsd.org) Message-Id: <200905241834.n4OIYstO097192@svn.freebsd.org> From: Tom McLaughlin Date: Sun, 24 May 2009 18:34:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192691 - head/share/man/man9 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 18:34:55 -0000 Author: tmclaugh (ports committer) Date: Sun May 24 18:34:54 2009 New Revision: 192691 URL: http://svn.freebsd.org/changeset/base/192691 Log: Update man pages after VFS_* changes in r191990. Approved by: brueffer, attilio Modified: head/share/man/man9/VFS_MOUNT.9 head/share/man/man9/VFS_QUOTACTL.9 head/share/man/man9/VFS_ROOT.9 head/share/man/man9/VFS_STATFS.9 head/share/man/man9/VFS_SYNC.9 head/share/man/man9/VFS_UNMOUNT.9 Modified: head/share/man/man9/VFS_MOUNT.9 ============================================================================== --- head/share/man/man9/VFS_MOUNT.9 Sun May 24 17:08:00 2009 (r192690) +++ head/share/man/man9/VFS_MOUNT.9 Sun May 24 18:34:54 2009 (r192691) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 7, 2005 +.Dd May 23, 2009 .Os .Dt VFS_MOUNT 9 .Sh NAME @@ -39,7 +39,7 @@ .In sys/mount.h .In sys/vnode.h .Ft int -.Fn VFS_MOUNT "struct mount *mp" "struct thread *td" +.Fn VFS_MOUNT "struct mount *mp" .Sh DESCRIPTION The .Fn VFS_MOUNT @@ -50,8 +50,6 @@ The arguments it expects are: .Bl -tag -width data .It Fa mp Structure representing the file system. -.It Fa td -Thread which is mounting the file system. .El .Pp The Modified: head/share/man/man9/VFS_QUOTACTL.9 ============================================================================== --- head/share/man/man9/VFS_QUOTACTL.9 Sun May 24 17:08:00 2009 (r192690) +++ head/share/man/man9/VFS_QUOTACTL.9 Sun May 24 18:34:54 2009 (r192691) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 24, 1996 +.Dd May 23, 2009 .Os .Dt VFS_QUOTACTL 9 .Sh NAME @@ -39,7 +39,7 @@ .In sys/mount.h .In sys/vnode.h .Ft int -.Fn VFS_QUOTACTL "struct mount *mp" "int cmds" "uid_t uid" "caddr_t arg" "struct thread *td" +.Fn VFS_QUOTACTL "struct mount *mp" "int cmds" "uid_t uid" "caddr_t arg" .Sh DESCRIPTION Implement file system quotas. See Modified: head/share/man/man9/VFS_ROOT.9 ============================================================================== --- head/share/man/man9/VFS_ROOT.9 Sun May 24 17:08:00 2009 (r192690) +++ head/share/man/man9/VFS_ROOT.9 Sun May 24 18:34:54 2009 (r192691) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 26, 2006 +.Dd May 23, 2009 .Os .Dt VFS_ROOT 9 .Sh NAME @@ -39,7 +39,7 @@ .In sys/mount.h .In sys/vnode.h .Ft int -.Fn VFS_ROOT "struct mount *mp" "int flags" "struct vnode **vpp" "struct thread *td" +.Fn VFS_ROOT "struct mount *mp" "int flags" "struct vnode **vpp" .Sh DESCRIPTION Return a locked vnode for the root directory of the file system. .Pp @@ -58,8 +58,6 @@ File system is free to ignore the argument and instead acquire an exclusive lock. .It Fa vpp Return parameter for the root vnode. -.It Fa td -The calling thread. .El .Sh SEE ALSO .Xr VFS 9 , Modified: head/share/man/man9/VFS_STATFS.9 ============================================================================== --- head/share/man/man9/VFS_STATFS.9 Sun May 24 17:08:00 2009 (r192690) +++ head/share/man/man9/VFS_STATFS.9 Sun May 24 18:34:54 2009 (r192691) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 7, 2005 +.Dd May 23, 2009 .Os .Dt VFS_STATFS 9 .Sh NAME @@ -39,7 +39,7 @@ .In sys/mount.h .In sys/vnode.h .Ft int -.Fn VFS_STATFS "struct mount *mp" "struct statfs *sbp" "struct thread *td" +.Fn VFS_STATFS "struct mount *mp" "struct statfs *sbp" .Sh DESCRIPTION The .Fn VFS_STATFS @@ -56,8 +56,6 @@ A structure, as defined by .In sys/mount.h , into which information is placed about the file system. -.It Fa td -The thread which is querying the file system. .El .Pp The fields of Modified: head/share/man/man9/VFS_SYNC.9 ============================================================================== --- head/share/man/man9/VFS_SYNC.9 Sun May 24 17:08:00 2009 (r192690) +++ head/share/man/man9/VFS_SYNC.9 Sun May 24 18:34:54 2009 (r192691) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 7, 2005 +.Dd May 23, 2009 .Os .Dt VFS_SYNC 9 .Sh NAME @@ -39,7 +39,7 @@ .In sys/mount.h .In sys/vnode.h .Ft int -.Fn VFS_SYNC "struct mount *mp" "int waitfor" "struct thread *td" +.Fn VFS_SYNC "struct mount *mp" "int waitfor" .Sh DESCRIPTION The .Fn VFS_SYNC @@ -61,8 +61,6 @@ start all I/O, but do not wait for it .It Dv MNT_LAZY push data not written by file system syncer .El -.It Fa td -The calling thread. .El .Pp The Modified: head/share/man/man9/VFS_UNMOUNT.9 ============================================================================== --- head/share/man/man9/VFS_UNMOUNT.9 Sun May 24 17:08:00 2009 (r192690) +++ head/share/man/man9/VFS_UNMOUNT.9 Sun May 24 18:34:54 2009 (r192691) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 7, 2005 +.Dd May 23, 2009 .Os .Dt VFS_UNMOUNT 9 .Sh NAME @@ -39,7 +39,7 @@ .In sys/mount.h .In sys/vnode.h .Ft int -.Fn VFS_UNMOUNT "struct mount *mp" "int mntflags" "struct thread *td" +.Fn VFS_UNMOUNT "struct mount *mp" "int mntflags" .Sh DESCRIPTION The .Fn VFS_UNMOUNT @@ -58,8 +58,6 @@ are: .It Dv MNT_FORCE Open files are forcibly closed before the file system is unmounted. .El -.It Fa td -Thread which is unmounting the file system. .El .Sh SEE ALSO .Xr vflush 9 , From owner-svn-src-head@FreeBSD.ORG Sun May 24 18:35:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 845A3106566C; Sun, 24 May 2009 18:35:53 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 580738FC0A; Sun, 24 May 2009 18:35:53 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4OIZrZT097316; Sun, 24 May 2009 18:35:53 GMT (envelope-from antoine@svn.freebsd.org) Received: (from antoine@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4OIZro7097315; Sun, 24 May 2009 18:35:53 GMT (envelope-from antoine@svn.freebsd.org) Message-Id: <200905241835.n4OIZro7097315@svn.freebsd.org> From: Antoine Brodin Date: Sun, 24 May 2009 18:35:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192692 - head/sys/compat/ndis X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 18:35:53 -0000 Author: antoine Date: Sun May 24 18:35:53 2009 New Revision: 192692 URL: http://svn.freebsd.org/changeset/base/192692 Log: Remove an unused variable. Modified: head/sys/compat/ndis/kern_ndis.c Modified: head/sys/compat/ndis/kern_ndis.c ============================================================================== --- head/sys/compat/ndis/kern_ndis.c Sun May 24 18:34:54 2009 (r192691) +++ head/sys/compat/ndis/kern_ndis.c Sun May 24 18:35:53 2009 (r192692) @@ -543,7 +543,7 @@ ndis_free_bufs(b0) return; } -int in_reset = 0; + void ndis_free_packet(p) ndis_packet *p; From owner-svn-src-head@FreeBSD.ORG Sun May 24 18:49:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E25A41065675; Sun, 24 May 2009 18:49:53 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D05078FC14; Sun, 24 May 2009 18:49:53 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4OInrZ7097595; Sun, 24 May 2009 18:49:53 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4OInroo097594; Sun, 24 May 2009 18:49:53 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200905241849.n4OInroo097594@svn.freebsd.org> From: Rick Macklem Date: Sun, 24 May 2009 18:49:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192693 - head/sys/fs/nfsserver X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 18:49:54 -0000 Author: rmacklem Date: Sun May 24 18:49:53 2009 New Revision: 192693 URL: http://svn.freebsd.org/changeset/base/192693 Log: Fix the experimental NFSv4 server so that it handles the case where a client is not allowed NFSv4 access correctly. This restriction is specified in the "V4: ..." line(s) in /etc/exports. Approved by: kib (mentor) Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdkrpc.c Sun May 24 18:35:53 2009 (r192692) +++ head/sys/fs/nfsserver/nfs_nfsdkrpc.c Sun May 24 18:49:53 2009 (r192693) @@ -286,6 +286,8 @@ nfs_proc(struct nfsrv_descript *nd, u_in cacherep = RC_DROPIT; } else if (nd->nd_repstat) { cacherep = RC_REPLY; + if ((nd->nd_flag & ND_NFSV4) == 0) + panic("nfs_repstat for nfsv2,3"); } else { /* * For NFSv3, play it safe and assume that the client is @@ -313,6 +315,9 @@ nfs_proc(struct nfsrv_descript *nd, u_in else cacherep = RC_REPLY; *rpp = nfsrvd_updatecache(nd, so); + } else if (cacherep == RC_REPLY) { + /* Generate the error reply message for NFSv4 */ + nfsrvd_dorpc(nd, isdgram, td); } return (cacherep); } From owner-svn-src-head@FreeBSD.ORG Sun May 24 19:21:49 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7EBA51065690; Sun, 24 May 2009 19:21:49 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C0AA8FC0C; Sun, 24 May 2009 19:21:49 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4OJLn5u098233; Sun, 24 May 2009 19:21:49 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4OJLnda098232; Sun, 24 May 2009 19:21:49 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200905241921.n4OJLnda098232@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sun, 24 May 2009 19:21:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192694 - head/sys/cddl/compat/opensolaris/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 19:21:50 -0000 Author: trasz Date: Sun May 24 19:21:49 2009 New Revision: 192694 URL: http://svn.freebsd.org/changeset/base/192694 Log: Don't allow non-owner to set SUID bit on a file. It doesn't make any difference now, but in NFSv4 ACLs, there is write_acl permission, which also affects mode changes. Reviewed by: pjd Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c Sun May 24 18:49:53 2009 (r192693) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c Sun May 24 19:21:49 2009 (r192694) @@ -302,6 +302,14 @@ secpolicy_setid_setsticky_clear(struct v if (error) return (error); } + /* + * Deny setting setuid if we are not the file owner. + */ + if ((vap->va_mode & S_ISUID) && ovap->va_uid != cred->cr_uid) { + error = priv_check_cred(cred, PRIV_VFS_ADMIN, 0); + if (error) + return (error); + } return (0); } From owner-svn-src-head@FreeBSD.ORG Sun May 24 19:46:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6CF11106564A; Sun, 24 May 2009 19:46:12 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5A6AE8FC20; Sun, 24 May 2009 19:46:12 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4OJkC6A099415; Sun, 24 May 2009 19:46:12 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4OJkCnR099413; Sun, 24 May 2009 19:46:12 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200905241946.n4OJkCnR099413@svn.freebsd.org> From: Rick Macklem Date: Sun, 24 May 2009 19:46:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192695 - head/sys/fs/nfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 19:46:12 -0000 Author: rmacklem Date: Sun May 24 19:46:12 2009 New Revision: 192695 URL: http://svn.freebsd.org/changeset/base/192695 Log: Crib the realign function out of nfs_krpc.c and add a call to it for the client side reply. Hopefully this fixes the problem with using the new krpc for arm for the experimental nfs client. Approved by: kib (mentor) Modified: head/sys/fs/nfs/nfs_commonkrpc.c head/sys/fs/nfs/nfs_commonport.c Modified: head/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- head/sys/fs/nfs/nfs_commonkrpc.c Sun May 24 19:21:49 2009 (r192694) +++ head/sys/fs/nfs/nfs_commonkrpc.c Sun May 24 19:46:12 2009 (r192695) @@ -603,6 +603,13 @@ tryagain: KASSERT(nd->nd_mrep != NULL, ("mrep shouldn't be NULL if no error\n")); + /* + * Search for any mbufs that are not a multiple of 4 bytes long + * or with m_data not longword aligned. + * These could cause pointer alignment problems, so copy them to + * well aligned mbufs. + */ + newnfs_realign(&nd->nd_mrep); nd->nd_md = nd->nd_mrep; nd->nd_dpos = NFSMTOD(nd->nd_md, caddr_t); nd->nd_repstat = 0; Modified: head/sys/fs/nfs/nfs_commonport.c ============================================================================== --- head/sys/fs/nfs/nfs_commonport.c Sun May 24 19:21:49 2009 (r192694) +++ head/sys/fs/nfs/nfs_commonport.c Sun May 24 19:46:12 2009 (r192695) @@ -70,8 +70,8 @@ static int nfs_realign_test; static int nfs_realign_count; SYSCTL_NODE(_vfs, OID_AUTO, newnfs, CTLFLAG_RW, 0, "New NFS filesystem"); -SYSCTL_INT(_vfs_newnfs, OID_AUTO, realign_test, CTLFLAG_RW, &nfs_realign_test, 0, ""); -SYSCTL_INT(_vfs_newnfs, OID_AUTO, realign_count, CTLFLAG_RW, &nfs_realign_count, 0, ""); +SYSCTL_INT(_vfs_newnfs, OID_AUTO, newnfs_realign_test, CTLFLAG_RW, &nfs_realign_test, 0, ""); +SYSCTL_INT(_vfs_newnfs, OID_AUTO, newnfs_realign_count, CTLFLAG_RW, &nfs_realign_count, 0, ""); SYSCTL_INT(_vfs_newnfs, OID_AUTO, nfs4acl_enable, CTLFLAG_RW, &nfsrv_useacl, 0, ""); SYSCTL_STRING(_vfs_newnfs, OID_AUTO, callback_addr, CTLFLAG_RW, nfsv4_callbackaddr, sizeof(nfsv4_callbackaddr), ""); @@ -129,7 +129,7 @@ newnfs_realign(struct mbuf **pm) } #else /* - * nfs_realign: + * newnfs_realign: * * Check for badly aligned mbuf data and realign by copying the unaligned * portion of the data into a new mbuf chain and freeing the portions @@ -142,43 +142,50 @@ newnfs_realign(struct mbuf **pm) * We would prefer to avoid this situation entirely. The situation does * not occur with NFS/UDP and is supposed to only occassionally occur * with TCP. Use vfs.nfs.realign_count and realign_test to check this. + * */ void newnfs_realign(struct mbuf **pm) { - struct mbuf *m; - struct mbuf *n = NULL; - int off = 0; + struct mbuf *m, *n; + int off, space; ++nfs_realign_test; while ((m = *pm) != NULL) { if ((m->m_len & 0x3) || (mtod(m, intptr_t) & 0x3)) { - MGET(n, M_WAIT, MT_DATA); - if (m->m_len >= MINCLSIZE) { - MCLGET(n, M_WAIT); - } + /* + * NB: we can't depend on m_pkthdr.len to help us + * decide what to do here. May not be worth doing + * the m_length calculation as m_copyback will + * expand the mbuf chain below as needed. + */ + space = m_length(m, NULL); + if (space >= MINCLSIZE) { + /* NB: m_copyback handles space > MCLBYTES */ + n = m_getcl(M_WAITOK, MT_DATA, 0); + } else + n = m_get(M_WAITOK, MT_DATA); + if (n == NULL) + return; + /* + * Align the remainder of the mbuf chain. + */ n->m_len = 0; + off = 0; + while (m != NULL) { + m_copyback(n, off, m->m_len, mtod(m, caddr_t)); + off += m->m_len; + m = m->m_next; + } + m_freem(*pm); + *pm = n; + ++nfs_realign_count; break; } pm = &m->m_next; } - - /* - * If n is non-NULL, loop on m copying data, then replace the - * portion of the chain that had to be realigned. - */ - if (n != NULL) { - ++nfs_realign_count; - while (m) { - m_copyback(n, off, m->m_len, mtod(m, caddr_t)); - off += m->m_len; - m = m->m_next; - } - m_freem(*pm); - *pm = n; - } } -#endif /* newnfs_realign */ +#endif /* !__i386__ */ #ifdef notdef static void From owner-svn-src-head@FreeBSD.ORG Sun May 24 20:34:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A07B1065673; Sun, 24 May 2009 20:34:30 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC0268FC1F; Sun, 24 May 2009 20:34:29 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4OKYTTG000510; Sun, 24 May 2009 20:34:29 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4OKYTYN000509; Sun, 24 May 2009 20:34:29 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200905242034.n4OKYTYN000509@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sun, 24 May 2009 20:34:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192696 - head/share/man/man9 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 20:34:30 -0000 Author: trasz Date: Sun May 24 20:34:29 2009 New Revision: 192696 URL: http://svn.freebsd.org/changeset/base/192696 Log: There are things too complex to be fixed in one commit. Fix a typo in acl(9) manual page. Submitted by: avg Modified: head/share/man/man9/acl.9 Modified: head/share/man/man9/acl.9 ============================================================================== --- head/share/man/man9/acl.9 Sun May 24 19:46:12 2009 (r192695) +++ head/share/man/man9/acl.9 Sun May 24 20:34:29 2009 (r192696) @@ -201,7 +201,7 @@ The following values are valid: .Bl -tag -width ".Dv ACL_ENTRY_DIRECTORY_INHERIT" .It Dv ACL_ENTRY_FILE_INHERIT .It Dv ACL_ENTRY_DIRECTORY_INHERIT -.It Dv ACL_ENRTY_NO_PROPAGATE_INHERIT +.It Dv ACL_ENTRY_NO_PROPAGATE_INHERIT .It Dv ACL_ENTRY_INHERIT_ONLY .El .El From owner-svn-src-head@FreeBSD.ORG Sun May 24 23:47:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4DA38106566C; Sun, 24 May 2009 23:47:23 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2C1D28FC13; Sun, 24 May 2009 23:47:23 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4ONlN0K004505; Sun, 24 May 2009 23:47:23 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4ONlNII004504; Sun, 24 May 2009 23:47:23 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200905242347.n4ONlNII004504@svn.freebsd.org> From: Rick Macklem Date: Sun, 24 May 2009 23:47:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192705 - head/sys/fs/nfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2009 23:47:23 -0000 Author: rmacklem Date: Sun May 24 23:47:22 2009 New Revision: 192705 URL: http://svn.freebsd.org/changeset/base/192705 Log: Temporarily #undef NFS4_ACL_EXTATTR_NAME, so that the experimental nfs subsystem will build while the NFSv4 ACL support is going into the kernel. Approved by: kib (mentor) Modified: head/sys/fs/nfs/nfsport.h Modified: head/sys/fs/nfs/nfsport.h ============================================================================== --- head/sys/fs/nfs/nfsport.h Sun May 24 23:24:49 2009 (r192704) +++ head/sys/fs/nfs/nfsport.h Sun May 24 23:47:22 2009 (r192705) @@ -71,6 +71,8 @@ #include #include #include +/* until the nfsv4 acl stuff is all committed, undef NFS4_ACL_EXTATTR_NAME */ +#undef NFS4_ACL_EXTATTR_NAME #include #include #include From owner-svn-src-head@FreeBSD.ORG Mon May 25 00:56:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D59B9106564A; Mon, 25 May 2009 00:56:01 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C33228FC14; Mon, 25 May 2009 00:56:01 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P0u1Ji005864; Mon, 25 May 2009 00:56:01 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P0u1xk005863; Mon, 25 May 2009 00:56:01 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250056.n4P0u1xk005863@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 00:56:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192706 - head/sys/dev/nfe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 00:56:02 -0000 Author: yongari Date: Mon May 25 00:56:01 2009 New Revision: 192706 URL: http://svn.freebsd.org/changeset/base/192706 Log: NVIDIA MCP controllers have no Rx buffer alignment restrictions. Remove PAGE_SIZE alignment used in Rx buffer DMA tag creation. The alignment restriction was used in old local jumbo allocator and nfe(4) switched to UMA backed page allocator for jumbo frame. This change should fix jumbo buffer allocation failure. Reported by: Pascal Braun ( pascal.braun <> continum dot net ) Modified: head/sys/dev/nfe/if_nfe.c Modified: head/sys/dev/nfe/if_nfe.c ============================================================================== --- head/sys/dev/nfe/if_nfe.c Sun May 24 23:47:22 2009 (r192705) +++ head/sys/dev/nfe/if_nfe.c Mon May 25 00:56:01 2009 (r192706) @@ -1153,7 +1153,7 @@ nfe_alloc_jrx_ring(struct nfe_softc *sc, /* Create DMA tag for jumbo Rx buffers. */ error = bus_dma_tag_create(sc->nfe_parent_tag, - PAGE_SIZE, 0, /* alignment, boundary */ + 1, 0, /* alignment, boundary */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ From owner-svn-src-head@FreeBSD.ORG Mon May 25 01:00:09 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB0151065672; Mon, 25 May 2009 01:00:09 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 987F98FC0C; Mon, 25 May 2009 01:00:09 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P109wN005989; Mon, 25 May 2009 01:00:09 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P109lv005988; Mon, 25 May 2009 01:00:09 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200905250100.n4P109lv005988@svn.freebsd.org> From: Rick Macklem Date: Mon, 25 May 2009 01:00:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192707 - head/sys/fs/nfsserver X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 01:00:10 -0000 Author: rmacklem Date: Mon May 25 01:00:09 2009 New Revision: 192707 URL: http://svn.freebsd.org/changeset/base/192707 Log: Add NFSv4 root export checks to the DelegPurge, Renew and ReleaseLockOwner operations analagous to what is already in place for SetClientID and SetClientIDConfirm. These are the five NFSv4 operations that do not use file handle(s), so the checks are done using the NFSv4 root export entries in /etc/exports. Approved by: kib (mentor) Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdserv.c Mon May 25 00:56:01 2009 (r192706) +++ head/sys/fs/nfsserver/nfs_nfsdserv.c Mon May 25 01:00:09 2009 (r192707) @@ -2830,6 +2830,11 @@ nfsrvd_delegpurge(struct nfsrv_descript int error = 0; nfsquad_t clientid; + if ((!nfs_rootfhset && !nfsv4root_set) || + nfsd_checkrootexp(nd)) { + nd->nd_repstat = NFSERR_WRONGSEC; + return (0); + } NFSM_DISSECT(tl, u_int32_t *, 2 * NFSX_UNSIGNED); clientid.lval[0] = *tl++; clientid.lval[1] = *tl; @@ -3024,6 +3029,11 @@ nfsrvd_renew(struct nfsrv_descript *nd, int error = 0; nfsquad_t clientid; + if ((!nfs_rootfhset && !nfsv4root_set) || + nfsd_checkrootexp(nd)) { + nd->nd_repstat = NFSERR_WRONGSEC; + return (0); + } NFSM_DISSECT(tl, u_int32_t *, NFSX_HYPER); clientid.lval[0] = *tl++; clientid.lval[1] = *tl; @@ -3355,6 +3365,11 @@ nfsrvd_releaselckown(struct nfsrv_descri int error = 0, len; nfsquad_t clientid; + if ((!nfs_rootfhset && !nfsv4root_set) || + nfsd_checkrootexp(nd)) { + nd->nd_repstat = NFSERR_WRONGSEC; + return (0); + } NFSM_DISSECT(tl, u_int32_t *, 3 * NFSX_UNSIGNED); len = fxdr_unsigned(int, *(tl + 2)); MALLOC(stp, struct nfsstate *, sizeof (struct nfsstate) + len, From owner-svn-src-head@FreeBSD.ORG Mon May 25 01:41:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47213106566B; Mon, 25 May 2009 01:41:06 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3435A8FC17; Mon, 25 May 2009 01:41:06 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P1f6Rs006791; Mon, 25 May 2009 01:41:06 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P1f6ZC006790; Mon, 25 May 2009 01:41:06 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250141.n4P1f6ZC006790@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 01:41:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192708 - head/sys/dev/mii X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 01:41:06 -0000 Author: yongari Date: Mon May 25 01:41:05 2009 New Revision: 192708 URL: http://svn.freebsd.org/changeset/base/192708 Log: Use mii_phy_add_media() and remove usage of local macro ADD. Also checks extended status register to see whether the PHY is fast ethernet or not. This removes a lot of checks for specific PHY models and it makes easy to add more PHYs to e1000phy(4). While I'm here remove setting mii_anegticks as it is set with mii_phy_add_media(). Modified: head/sys/dev/mii/e1000phy.c Modified: head/sys/dev/mii/e1000phy.c ============================================================================== --- head/sys/dev/mii/e1000phy.c Mon May 25 01:00:09 2009 (r192707) +++ head/sys/dev/mii/e1000phy.c Mon May 25 01:41:05 2009 (r192708) @@ -129,7 +129,6 @@ e1000phy_attach(device_t dev) struct mii_softc *sc; struct mii_attach_args *ma; struct mii_data *mii; - int fast_ether; esc = device_get_softc(dev); sc = &esc->mii_sc; @@ -142,10 +141,8 @@ e1000phy_attach(device_t dev) sc->mii_phy = ma->mii_phyno; sc->mii_service = e1000phy_service; sc->mii_pdata = mii; - sc->mii_anegticks = MII_ANEGTICKS_GIGE; mii->mii_instance++; - fast_ether = 0; esc->mii_model = MII_MODEL(ma->mii_id2); switch (esc->mii_model) { case MII_MODEL_MARVELL_E1011: @@ -167,54 +164,16 @@ e1000phy_attach(device_t dev) */ PHY_WRITE(sc, E1000_EADR, 0); break; - case MII_MODEL_MARVELL_E3082: - /* 88E3082 10/100 Fast Ethernet PHY. */ - sc->mii_anegticks = MII_ANEGTICKS; - fast_ether = 1; - break; } e1000phy_reset(sc); + sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; + if (sc->mii_capabilities & BMSR_EXTSTAT) + sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); device_printf(dev, " "); - -#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst), - E1000_CR_ISOLATE); - if ((sc->mii_flags & MIIF_HAVEFIBER) == 0) { - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, 0, sc->mii_inst), - E1000_CR_SPEED_10); - printf("10baseT, "); - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_FDX, sc->mii_inst), - E1000_CR_SPEED_10 | E1000_CR_FULL_DUPLEX); - printf("10baseT-FDX, "); - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, 0, sc->mii_inst), - E1000_CR_SPEED_100); - printf("100baseTX, "); - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_FDX, sc->mii_inst), - E1000_CR_SPEED_100 | E1000_CR_FULL_DUPLEX); - printf("100baseTX-FDX, "); - if (fast_ether == 0) { - /* - * 1000BT-simplex not supported; driver must ignore - * this entry, but it must be present in order to - * manually set full-duplex. - */ - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_T, 0, - sc->mii_inst), E1000_CR_SPEED_1000); - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_T, IFM_FDX, - sc->mii_inst), - E1000_CR_SPEED_1000 | E1000_CR_FULL_DUPLEX); - printf("1000baseTX-FDX, "); - } - } else { - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, IFM_FDX, sc->mii_inst), - E1000_CR_SPEED_1000 | E1000_CR_FULL_DUPLEX); - printf("1000baseSX-FDX, "); - } - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst), 0); - printf("auto\n"); -#undef ADD + mii_phy_add_media(sc); + printf("\n"); MIIBUS_MEDIAINIT(sc->mii_dev); return (0); @@ -339,12 +298,14 @@ e1000phy_service(struct mii_softc *sc, s speed = 0; switch (IFM_SUBTYPE(ife->ifm_media)) { case IFM_1000_T: - if (esc->mii_model == MII_MODEL_MARVELL_E3082) + if ((sc->mii_extcapabilities & + (EXTSR_1000TFDX | EXTSR_1000THDX)) == 0) return (EINVAL); speed = E1000_CR_SPEED_1000; break; case IFM_1000_SX: - if (esc->mii_model == MII_MODEL_MARVELL_E3082) + if ((sc->mii_extcapabilities & + (EXTSR_1000XFDX | EXTSR_1000XHDX)) == 0) return (EINVAL); speed = E1000_CR_SPEED_1000; break; @@ -390,7 +351,8 @@ e1000phy_service(struct mii_softc *sc, s PHY_WRITE(sc, E1000_1GCR, gig | E1000_1GCR_MS_ENABLE); } else { - if (esc->mii_model != MII_MODEL_MARVELL_E3082) + if ((sc->mii_extcapabilities & + (EXTSR_1000TFDX | EXTSR_1000THDX)) != 0) PHY_WRITE(sc, E1000_1GCR, 0); } PHY_WRITE(sc, E1000_AR, E1000_AR_SELECTOR_FIELD); @@ -533,7 +495,7 @@ e1000phy_mii_phy_auto(struct e1000phy_so else PHY_WRITE(sc, E1000_AR, E1000_FA_1000X_FD | E1000_FA_1000X | E1000_FA_SYM_PAUSE | E1000_FA_ASYM_PAUSE); - if (esc->mii_model != MII_MODEL_MARVELL_E3082) + if ((sc->mii_extcapabilities & (EXTSR_1000TFDX | EXTSR_1000THDX)) != 0) PHY_WRITE(sc, E1000_1GCR, E1000_1GCR_1000T_FD | E1000_1GCR_1000T); PHY_WRITE(sc, E1000_CR, From owner-svn-src-head@FreeBSD.ORG Mon May 25 01:45:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4864C1065672; Mon, 25 May 2009 01:45:29 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 362618FC0C; Mon, 25 May 2009 01:45:29 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P1jTc7006912; Mon, 25 May 2009 01:45:29 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P1jTrg006910; Mon, 25 May 2009 01:45:29 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250145.n4P1jTrg006910@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 01:45:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192709 - head/sys/dev/mii X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 01:45:29 -0000 Author: yongari Date: Mon May 25 01:45:28 2009 New Revision: 192709 URL: http://svn.freebsd.org/changeset/base/192709 Log: Report current link state while auto-negotiation is in progress. Modified: head/sys/dev/mii/e1000phy.c Modified: head/sys/dev/mii/e1000phy.c ============================================================================== --- head/sys/dev/mii/e1000phy.c Mon May 25 01:41:05 2009 (r192708) +++ head/sys/dev/mii/e1000phy.c Mon May 25 01:45:28 2009 (r192709) @@ -394,7 +394,7 @@ done: if (sc->mii_ticks++ == 0) break; if (sc->mii_ticks <= sc->mii_anegticks) - return (0); + break; sc->mii_ticks = 0; e1000phy_reset(sc); From owner-svn-src-head@FreeBSD.ORG Mon May 25 01:56:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70CDA106566B; Mon, 25 May 2009 01:56:19 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 440938FC16; Mon, 25 May 2009 01:56:19 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P1uJ0H007146; Mon, 25 May 2009 01:56:19 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P1uJDv007145; Mon, 25 May 2009 01:56:19 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250156.n4P1uJDv007145@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 01:56:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192710 - head/sys/dev/mii X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 01:56:20 -0000 Author: yongari Date: Mon May 25 01:56:19 2009 New Revision: 192710 URL: http://svn.freebsd.org/changeset/base/192710 Log: Don't read unnecessary PHY registers. Speed/duplex resolution bit is valid only for auto-negotiation case so check the bit if we know auto-negotiation is active. While I'm here explicitly checks current speed with speed mask and set IFM_NONE if resolved speed is unknown. Modified: head/sys/dev/mii/e1000phy.c Modified: head/sys/dev/mii/e1000phy.c ============================================================================== --- head/sys/dev/mii/e1000phy.c Mon May 25 01:45:28 2009 (r192709) +++ head/sys/dev/mii/e1000phy.c Mon May 25 01:56:19 2009 (r192710) @@ -414,18 +414,14 @@ static void e1000phy_status(struct mii_softc *sc) { struct mii_data *mii = sc->mii_pdata; - int bmsr, bmcr, esr, gsr, ssr, isr, ar, lpar; + int bmcr, bmsr, gsr, ssr, ar, lpar; mii->mii_media_status = IFM_AVALID; mii->mii_media_active = IFM_ETHER; bmsr = PHY_READ(sc, E1000_SR) | PHY_READ(sc, E1000_SR); - esr = PHY_READ(sc, E1000_ESR); bmcr = PHY_READ(sc, E1000_CR); ssr = PHY_READ(sc, E1000_SSR); - isr = PHY_READ(sc, E1000_ISR); - ar = PHY_READ(sc, E1000_AR); - lpar = PHY_READ(sc, E1000_LPAR); if (bmsr & E1000_SR_LINK_STATUS) mii->mii_media_status |= IFM_ACTIVE; @@ -433,22 +429,28 @@ e1000phy_status(struct mii_softc *sc) if (bmcr & E1000_CR_LOOPBACK) mii->mii_media_active |= IFM_LOOP; - if ((((bmcr & E1000_CR_AUTO_NEG_ENABLE) != 0) && - ((bmsr & E1000_SR_AUTO_NEG_COMPLETE) == 0)) || - ((ssr & E1000_SSR_LINK) == 0) || - ((ssr & E1000_SSR_SPD_DPLX_RESOLVED) == 0)) { + if ((bmcr & E1000_CR_AUTO_NEG_ENABLE) != 0 && + (ssr & E1000_SSR_SPD_DPLX_RESOLVED) == 0) { /* Erg, still trying, I guess... */ mii->mii_media_active |= IFM_NONE; return; } if ((sc->mii_flags & MIIF_HAVEFIBER) == 0) { - if (ssr & E1000_SSR_1000MBS) + switch (ssr & E1000_SSR_SPEED) { + case E1000_SSR_1000MBS: mii->mii_media_active |= IFM_1000_T; - else if (ssr & E1000_SSR_100MBS) + break; + case E1000_SSR_100MBS: mii->mii_media_active |= IFM_100_TX; - else + break; + case E1000_SSR_10MBS: mii->mii_media_active |= IFM_10_T; + break; + default: + mii->mii_media_active |= IFM_NONE; + return; + } } else { if (ssr & E1000_SSR_1000MBS) mii->mii_media_active |= IFM_1000_SX; @@ -460,6 +462,8 @@ e1000phy_status(struct mii_softc *sc) mii->mii_media_active |= IFM_HDX; if ((sc->mii_flags & MIIF_HAVEFIBER) == 0) { + ar = PHY_READ(sc, E1000_AR); + lpar = PHY_READ(sc, E1000_LPAR); /* FLAG0==rx-flow-control FLAG1==tx-flow-control */ if ((ar & E1000_AR_PAUSE) && (lpar & E1000_LPAR_PAUSE)) { mii->mii_media_active |= IFM_FLAG0 | IFM_FLAG1; From owner-svn-src-head@FreeBSD.ORG Mon May 25 02:05:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10F28106566B; Mon, 25 May 2009 02:05:01 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F2AD58FC1C; Mon, 25 May 2009 02:05:00 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P250mR007351; Mon, 25 May 2009 02:05:00 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P250JE007350; Mon, 25 May 2009 02:05:00 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250205.n4P250JE007350@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 02:05:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192711 - head/sys/dev/mii X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 02:05:01 -0000 Author: yongari Date: Mon May 25 02:05:00 2009 New Revision: 192711 URL: http://svn.freebsd.org/changeset/base/192711 Log: Do not ignore NEXT Page capability of auto-negotiation advertisement register. Some PHYs such as 88E3016 requires NEXT Page capability to establish valid link. Also set protocol selector field which is read only but it makes the intention clearer. Modified: head/sys/dev/mii/e1000phy.c Modified: head/sys/dev/mii/e1000phy.c ============================================================================== --- head/sys/dev/mii/e1000phy.c Mon May 25 01:56:19 2009 (r192710) +++ head/sys/dev/mii/e1000phy.c Mon May 25 02:05:00 2009 (r192711) @@ -490,13 +490,16 @@ static int e1000phy_mii_phy_auto(struct e1000phy_softc *esc) { struct mii_softc *sc; + uint16_t reg; sc = &esc->mii_sc; - if ((sc->mii_flags & MIIF_HAVEFIBER) == 0) - PHY_WRITE(sc, E1000_AR, E1000_AR_10T | E1000_AR_10T_FD | + if ((sc->mii_flags & MIIF_HAVEFIBER) == 0) { + reg = PHY_READ(sc, E1000_AR); + reg |= E1000_AR_10T | E1000_AR_10T_FD | E1000_AR_100TX | E1000_AR_100TX_FD | - E1000_AR_PAUSE | E1000_AR_ASM_DIR); - else + E1000_AR_PAUSE | E1000_AR_ASM_DIR; + PHY_WRITE(sc, E1000_AR, reg | E1000_AR_SELECTOR_FIELD); + } else PHY_WRITE(sc, E1000_AR, E1000_FA_1000X_FD | E1000_FA_1000X | E1000_FA_SYM_PAUSE | E1000_FA_ASYM_PAUSE); if ((sc->mii_extcapabilities & (EXTSR_1000TFDX | EXTSR_1000THDX)) != 0) From owner-svn-src-head@FreeBSD.ORG Mon May 25 02:36:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE544106564A; Mon, 25 May 2009 02:36:29 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC07E8FC1D; Mon, 25 May 2009 02:36:29 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P2aTd4008001; Mon, 25 May 2009 02:36:29 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P2aTUF007998; Mon, 25 May 2009 02:36:29 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250236.n4P2aTUF007998@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 02:36:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192713 - head/sys/dev/mii X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 02:36:30 -0000 Author: yongari Date: Mon May 25 02:36:29 2009 New Revision: 192713 URL: http://svn.freebsd.org/changeset/base/192713 Log: Add driver support for 88E3016 PHY which is found on Marvell Yukon FE+ controller. Due to the severe silicon bugs for Yukon FE+, 88E3016 seems to require more workarounds. However I'm not sure whether the workaround is PHY specific or only applicable to Yukon FE+. The datasheet for the PHY is publicly available but it lacks several details for the workaround used in this change. The workaround information was obtained from Linux. Many thanks to Yukon FE+ users who helped me add 88E3016 support. Tested by: bz, Tanguy Bouzeloc ( the.zauron <> gmail dot com ) Bruce Cran ( bruce <> cran dot org dot uk ) Michael Reifenberger ( mike <> reifenberger dot com ) Stephen Montgomery-Smith ( stephen <> missouri dot edu ) Modified: head/sys/dev/mii/e1000phy.c head/sys/dev/mii/e1000phyreg.h head/sys/dev/mii/miidevs Modified: head/sys/dev/mii/e1000phy.c ============================================================================== --- head/sys/dev/mii/e1000phy.c Mon May 25 02:09:09 2009 (r192712) +++ head/sys/dev/mii/e1000phy.c Mon May 25 02:36:29 2009 (r192713) @@ -107,6 +107,7 @@ static const struct mii_phydesc e1000phy MII_PHY_DESC(MARVELL, E1116), MII_PHY_DESC(MARVELL, E1116R), MII_PHY_DESC(MARVELL, E1118), + MII_PHY_DESC(MARVELL, E3016), MII_PHY_DESC(xxMARVELL, E1000), MII_PHY_DESC(xxMARVELL, E1011), MII_PHY_DESC(xxMARVELL, E1000_3), @@ -212,18 +213,29 @@ e1000phy_reset(struct mii_softc *sc) reg |= E1000_SCR_AUTO_X_MODE; if (esc->mii_model == MII_MODEL_MARVELL_E1116) reg &= ~E1000_SCR_POWER_DOWN; + reg |= E1000_SCR_ASSERT_CRS_ON_TX; break; case MII_MODEL_MARVELL_E3082: reg |= (E1000_SCR_AUTO_X_MODE >> 1); + reg |= E1000_SCR_ASSERT_CRS_ON_TX; + break; + case MII_MODEL_MARVELL_E3016: + reg |= E1000_SCR_AUTO_MDIX; + reg &= ~(E1000_SCR_EN_DETECT | + E1000_SCR_SCRAMBLER_DISABLE); + reg |= E1000_SCR_LPNP; + /* XXX Enable class A driver for Yukon FE+ A0. */ + PHY_WRITE(sc, 0x1C, PHY_READ(sc, 0x1C) | 0x0001); break; default: reg &= ~E1000_SCR_AUTO_X_MODE; + reg |= E1000_SCR_ASSERT_CRS_ON_TX; break; } - /* Enable CRS on TX. */ - reg |= E1000_SCR_ASSERT_CRS_ON_TX; - /* Auto correction for reversed cable polarity. */ - reg &= ~E1000_SCR_POLARITY_REVERSAL; + if (esc->mii_model != MII_MODEL_MARVELL_E3016) { + /* Auto correction for reversed cable polarity. */ + reg &= ~E1000_SCR_POLARITY_REVERSAL; + } PHY_WRITE(sc, E1000_SCR, reg); if (esc->mii_model == MII_MODEL_MARVELL_E1116) { @@ -242,6 +254,13 @@ e1000phy_reset(struct mii_softc *sc) case MII_MODEL_MARVELL_E1118: case MII_MODEL_MARVELL_E1149: break; + case MII_MODEL_MARVELL_E3016: + /* LED2 -> ACT, LED1 -> LINK, LED0 -> SPEED. */ + PHY_WRITE(sc, 0x16, 0x0B << 8 | 0x05 << 4 | 0x04); + /* Integrated register calibration workaround. */ + PHY_WRITE(sc, 0x1D, 17); + PHY_WRITE(sc, 0x1E, 0x3F60); + break; default: /* Force TX_CLK to 25MHz clock. */ reg = PHY_READ(sc, E1000_ESCR); Modified: head/sys/dev/mii/e1000phyreg.h ============================================================================== --- head/sys/dev/mii/e1000phyreg.h Mon May 25 02:09:09 2009 (r192712) +++ head/sys/dev/mii/e1000phyreg.h Mon May 25 02:36:29 2009 (r192713) @@ -236,6 +236,16 @@ #define E1000_SCR_TX_FIFO_DEPTH_10 0x8000 #define E1000_SCR_TX_FIFO_DEPTH_12 0xC000 +/* 88E3016 only */ +#define E1000_SCR_AUTO_MDIX 0x0030 +#define E1000_SCR_SIGDET_POLARITY 0x0040 +#define E1000_SCR_EXT_DISTANCE 0x0080 +#define E1000_SCR_FEFI_DISABLE 0x0100 +#define E1000_SCR_NLP_GEN_DISABLE 0x0800 +#define E1000_SCR_LPNP 0x1000 +#define E1000_SCR_NLP_CHK_DISABLE 0x2000 +#define E1000_SCR_EN_DETECT 0x4000 + #define E1000_SCR_EN_DETECT_MASK 0x0300 /* 88E1112 page 2 */ Modified: head/sys/dev/mii/miidevs ============================================================================== --- head/sys/dev/mii/miidevs Mon May 25 02:09:09 2009 (r192712) +++ head/sys/dev/mii/miidevs Mon May 25 02:36:29 2009 (r192713) @@ -247,6 +247,7 @@ model MARVELL E1111 0x000c Marvell 88E1 model MARVELL E1116 0x0021 Marvell 88E1116 Gigabit PHY model MARVELL E1116R 0x0024 Marvell 88E1116R Gigabit PHY model MARVELL E1118 0x0022 Marvell 88E1118 Gigabit PHY +model MARVELL E3016 0x0026 Marvell 88E3016 10/100 Fast Ethernet PHY model xxMARVELL E1000 0x0005 Marvell 88E1000 Gigabit PHY model xxMARVELL E1011 0x0002 Marvell 88E1011 Gigabit PHY model xxMARVELL E1000_3 0x0003 Marvell 88E1000 Gigabit PHY From owner-svn-src-head@FreeBSD.ORG Mon May 25 03:24:47 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF0F9106564A; Mon, 25 May 2009 03:24:47 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D23798FC08; Mon, 25 May 2009 03:24:47 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P3Ol4N009323; Mon, 25 May 2009 03:24:47 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P3OlWM009321; Mon, 25 May 2009 03:24:47 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250324.n4P3OlWM009321@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 03:24:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192716 - head/sys/dev/msk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 03:24:48 -0000 Author: yongari Date: Mon May 25 03:24:47 2009 New Revision: 192716 URL: http://svn.freebsd.org/changeset/base/192716 Log: Remove link handling taskqueue and use mii callback directly. While I'm here also checks driver running state. Modified: head/sys/dev/msk/if_msk.c head/sys/dev/msk/if_mskreg.h Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Mon May 25 03:06:26 2009 (r192715) +++ head/sys/dev/msk/if_msk.c Mon May 25 03:24:47 2009 (r192716) @@ -285,7 +285,6 @@ static int msk_phy_writereg(struct msk_i static int msk_miibus_readreg(device_t, int, int); static int msk_miibus_writereg(device_t, int, int, int); static void msk_miibus_statchg(device_t); -static void msk_link_task(void *, int); static void msk_rxfilter(struct msk_if_softc *); static void msk_setvlan(struct msk_if_softc *, struct ifnet *); @@ -459,32 +458,22 @@ msk_phy_writereg(struct msk_if_softc *sc static void msk_miibus_statchg(device_t dev) { - struct msk_if_softc *sc_if; - - sc_if = device_get_softc(dev); - taskqueue_enqueue(taskqueue_swi, &sc_if->msk_link_task); -} - -static void -msk_link_task(void *arg, int pending) -{ struct msk_softc *sc; struct msk_if_softc *sc_if; struct mii_data *mii; struct ifnet *ifp; uint32_t gmac; - sc_if = (struct msk_if_softc *)arg; + sc_if = device_get_softc(dev); sc = sc_if->msk_softc; MSK_IF_LOCK(sc_if); mii = device_get_softc(sc_if->msk_miibus); ifp = sc_if->msk_ifp; - if (mii == NULL || ifp == NULL) { - MSK_IF_UNLOCK(sc_if); + if (mii == NULL || ifp == NULL || + (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) return; - } if (mii->mii_media_status & IFM_ACTIVE) { if (IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) @@ -554,8 +543,6 @@ msk_link_task(void *arg, int pending) /* Read again to ensure writing. */ GMAC_READ_2(sc, sc_if->msk_port, GM_GP_CTRL); } - - MSK_IF_UNLOCK(sc_if); } static void @@ -1416,7 +1403,6 @@ msk_attach(device_t dev) } callout_init_mtx(&sc_if->msk_tick_ch, &sc_if->msk_softc->msk_mtx, 0); - TASK_INIT(&sc_if->msk_link_task, 0, msk_link_task, sc_if); msk_sysctl_node(sc_if); /* Disable jumbo frame for Yukon FE. */ @@ -1791,7 +1777,6 @@ msk_detach(device_t dev) MSK_IF_UNLOCK(sc_if); callout_drain(&sc_if->msk_tick_ch); taskqueue_drain(taskqueue_fast, &sc_if->msk_tx_task); - taskqueue_drain(taskqueue_swi, &sc_if->msk_link_task); ether_ifdetach(ifp); MSK_IF_LOCK(sc_if); } Modified: head/sys/dev/msk/if_mskreg.h ============================================================================== --- head/sys/dev/msk/if_mskreg.h Mon May 25 03:06:26 2009 (r192715) +++ head/sys/dev/msk/if_mskreg.h Mon May 25 03:24:47 2009 (r192716) @@ -2395,7 +2395,6 @@ struct msk_if_softc { struct msk_ring_data msk_rdata; struct msk_softc *msk_softc; /* parent controller */ struct msk_hw_stats msk_stats; - struct task msk_link_task; struct task msk_tx_task; int msk_if_flags; int msk_detach; From owner-svn-src-head@FreeBSD.ORG Mon May 25 03:42:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C36A4106566B; Mon, 25 May 2009 03:42:33 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B140B8FC12; Mon, 25 May 2009 03:42:33 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P3gXYB009706; Mon, 25 May 2009 03:42:33 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P3gX23009704; Mon, 25 May 2009 03:42:33 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250342.n4P3gX23009704@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 03:42:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192718 - head/sys/dev/msk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 03:42:34 -0000 Author: yongari Date: Mon May 25 03:42:33 2009 New Revision: 192718 URL: http://svn.freebsd.org/changeset/base/192718 Log: Use bit definition to represent link state, device suspend instead of using separate variables in softc. Modified: head/sys/dev/msk/if_msk.c head/sys/dev/msk/if_mskreg.h Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Mon May 25 03:41:40 2009 (r192717) +++ head/sys/dev/msk/if_msk.c Mon May 25 03:42:33 2009 (r192718) @@ -477,11 +477,11 @@ msk_miibus_statchg(device_t dev) if (mii->mii_media_status & IFM_ACTIVE) { if (IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) - sc_if->msk_link = 1; + sc_if->msk_flags |= MSK_FLAG_LINK; } else - sc_if->msk_link = 0; + sc_if->msk_flags &= ~MSK_FLAG_LINK; - if (sc_if->msk_link != 0) { + if ((sc_if->msk_flags & MSK_FLAG_LINK) != 0) { /* Enable Tx FIFO Underrun. */ CSR_WRITE_1(sc, MR_ADDR(sc_if->msk_port, GMAC_IRQ_MSK), GM_IS_TX_FF_UR | GM_IS_RX_FF_OR); @@ -2626,7 +2626,7 @@ msk_start(struct ifnet *ifp) MSK_IF_LOCK(sc_if); if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING || sc_if->msk_link == 0) { + IFF_DRV_RUNNING || (sc_if->msk_flags & MSK_FLAG_LINK) == 0) { MSK_IF_UNLOCK(sc_if); return; } @@ -2683,7 +2683,7 @@ msk_watchdog(struct msk_if_softc *sc_if) if (sc_if->msk_watchdog_timer == 0 || --sc_if->msk_watchdog_timer) return; ifp = sc_if->msk_ifp; - if (sc_if->msk_link == 0) { + if ((sc_if->msk_flags & MSK_FLAG_LINK) == 0) { if (bootverbose) if_printf(sc_if->msk_ifp, "watchdog timeout " "(missed link)\n"); @@ -2770,7 +2770,7 @@ mskc_suspend(device_t dev) /* Put hardware reset. */ CSR_WRITE_2(sc, B0_CTST, CS_RST_SET); - sc->msk_suspended = 1; + sc->msk_pflags |= MSK_FLAG_SUSPEND; MSK_UNLOCK(sc); @@ -2793,7 +2793,7 @@ mskc_resume(device_t dev) ((sc->msk_if[i]->msk_ifp->if_flags & IFF_UP) != 0)) msk_init_locked(sc->msk_if[i]); } - sc->msk_suspended = 0; + sc->msk_pflags &= MSK_FLAG_SUSPEND; MSK_UNLOCK(sc); @@ -3306,7 +3306,8 @@ msk_legacy_intr(void *xsc) /* Reading B0_Y2_SP_ISRC2 masks further interrupts. */ status = CSR_READ_4(sc, B0_Y2_SP_ISRC2); - if (status == 0 || status == 0xffffffff || sc->msk_suspended != 0 || + if (status == 0 || status == 0xffffffff || + (sc->msk_pflags & MSK_FLAG_SUSPEND) != 0 || (status & sc->msk_intrmask) == 0) { CSR_WRITE_4(sc, B0_Y2_SP_ICR, 2); return; @@ -3393,7 +3394,8 @@ msk_int_task(void *arg, int pending) /* Get interrupt source. */ status = CSR_READ_4(sc, B0_ISRC); - if (status == 0 || status == 0xffffffff || sc->msk_suspended != 0 || + if (status == 0 || status == 0xffffffff || + (sc->msk_pflags & MSK_FLAG_SUSPEND) != 0 || (status & sc->msk_intrmask) == 0) goto done; @@ -3675,7 +3677,7 @@ msk_init_locked(struct msk_if_softc *sc_ CSR_WRITE_4(sc, B0_IMSK, sc->msk_intrmask); CSR_READ_4(sc, B0_IMSK); - sc_if->msk_link = 0; + sc_if->msk_flags &= ~MSK_FLAG_LINK; mii_mediachg(mii); ifp->if_drv_flags |= IFF_DRV_RUNNING; @@ -3910,7 +3912,7 @@ msk_stop(struct msk_if_softc *sc_if) * Mark the interface down. */ ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); - sc_if->msk_link = 0; + sc_if->msk_flags &= ~MSK_FLAG_LINK; } /* Modified: head/sys/dev/msk/if_mskreg.h ============================================================================== --- head/sys/dev/msk/if_mskreg.h Mon May 25 03:41:40 2009 (r192717) +++ head/sys/dev/msk/if_mskreg.h Mon May 25 03:42:33 2009 (r192718) @@ -2342,7 +2342,6 @@ struct msk_softc { uint32_t msk_intrmask; uint32_t msk_intrhwemask; uint32_t msk_pflags; - int msk_suspended; int msk_clock; int msk_msi; struct msk_if_softc *msk_if[2]; @@ -2382,10 +2381,11 @@ struct msk_if_softc { int msk_framesize; int msk_phytype; int msk_phyaddr; - int msk_link; uint32_t msk_flags; #define MSK_FLAG_RAMBUF 0x0010 #define MSK_FLAG_NOJUMBO 0x0020 +#define MSK_FLAG_SUSPEND 0x2000 +#define MSK_FLAG_LINK 0x8000 struct callout msk_tick_ch; int msk_watchdog_timer; uint32_t msk_txq; /* Tx. Async Queue offset */ From owner-svn-src-head@FreeBSD.ORG Mon May 25 03:49:44 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53A661065670; Mon, 25 May 2009 03:49:44 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 272618FC0C; Mon, 25 May 2009 03:49:44 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P3ni7R009873; Mon, 25 May 2009 03:49:44 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P3nhMl009871; Mon, 25 May 2009 03:49:43 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250349.n4P3nhMl009871@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 03:49:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192719 - head/sys/dev/msk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 03:49:44 -0000 Author: yongari Date: Mon May 25 03:49:43 2009 New Revision: 192719 URL: http://svn.freebsd.org/changeset/base/192719 Log: Use bit definition to represent MSI and detach state instead of using separate variables in softc. Modified: head/sys/dev/msk/if_msk.c head/sys/dev/msk/if_mskreg.h Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Mon May 25 03:42:33 2009 (r192718) +++ head/sys/dev/msk/if_msk.c Mon May 25 03:49:43 2009 (r192719) @@ -923,7 +923,7 @@ msk_ioctl(struct ifnet *ifp, u_long comm & (IFF_PROMISC | IFF_ALLMULTI)) != 0) msk_rxfilter(sc_if); } else { - if (sc_if->msk_detach == 0) + if ((sc_if->msk_flags & MSK_FLAG_DETACH) == 0) msk_init_locked(sc_if); } } else { @@ -1645,7 +1645,7 @@ mskc_attach(device_t dev) if (sc->msk_num_port == 1 && pci_alloc_msi(dev, &msir) == 0) { if (msic == msir) { - sc->msk_msi = 1; + sc->msk_pflags |= MSK_FLAG_MSI; sc->msk_irq_spec = msic == 2 ? msk_irq_spec_msi2 : msk_irq_spec_msi; @@ -1771,7 +1771,7 @@ msk_detach(device_t dev) ifp = sc_if->msk_ifp; if (device_is_attached(dev)) { /* XXX */ - sc_if->msk_detach = 1; + sc_if->msk_flags |= MSK_FLAG_DETACH; msk_stop(sc_if); /* Can't hold locks while calling detach. */ MSK_IF_UNLOCK(sc_if); @@ -1855,7 +1855,7 @@ mskc_detach(device_t dev) sc->msk_intrhand[1] = NULL; } bus_release_resources(dev, sc->msk_irq_spec, sc->msk_irq); - if (sc->msk_msi) + if ((sc->msk_pflags & MSK_FLAG_MSI) != 0) pci_release_msi(dev); bus_release_resources(dev, sc->msk_res_spec, sc->msk_res); mtx_destroy(&sc->msk_mtx); Modified: head/sys/dev/msk/if_mskreg.h ============================================================================== --- head/sys/dev/msk/if_mskreg.h Mon May 25 03:42:33 2009 (r192718) +++ head/sys/dev/msk/if_mskreg.h Mon May 25 03:49:43 2009 (r192719) @@ -2343,7 +2343,6 @@ struct msk_softc { uint32_t msk_intrhwemask; uint32_t msk_pflags; int msk_clock; - int msk_msi; struct msk_if_softc *msk_if[2]; device_t msk_devs[2]; int msk_txqsize; @@ -2382,9 +2381,11 @@ struct msk_if_softc { int msk_phytype; int msk_phyaddr; uint32_t msk_flags; +#define MSK_FLAG_MSI 0x0001 #define MSK_FLAG_RAMBUF 0x0010 #define MSK_FLAG_NOJUMBO 0x0020 #define MSK_FLAG_SUSPEND 0x2000 +#define MSK_FLAG_DETACH 0x4000 #define MSK_FLAG_LINK 0x8000 struct callout msk_tick_ch; int msk_watchdog_timer; @@ -2397,7 +2398,6 @@ struct msk_if_softc { struct msk_hw_stats msk_stats; struct task msk_tx_task; int msk_if_flags; - int msk_detach; uint16_t msk_vtag; /* VLAN tag id. */ }; From owner-svn-src-head@FreeBSD.ORG Mon May 25 03:53:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A363B106566B; Mon, 25 May 2009 03:53:12 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 91A048FC1C; Mon, 25 May 2009 03:53:12 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P3rCpg009971; Mon, 25 May 2009 03:53:12 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P3rCcG009970; Mon, 25 May 2009 03:53:12 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250353.n4P3rCcG009970@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 03:53:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192720 - head/sys/dev/msk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 03:53:13 -0000 Author: yongari Date: Mon May 25 03:53:12 2009 New Revision: 192720 URL: http://svn.freebsd.org/changeset/base/192720 Log: Correctly return the result of mii_mediachg(). Previously it always used to return success. Modified: head/sys/dev/msk/if_msk.c Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Mon May 25 03:49:43 2009 (r192719) +++ head/sys/dev/msk/if_msk.c Mon May 25 03:53:12 2009 (r192720) @@ -856,15 +856,16 @@ msk_mediachange(struct ifnet *ifp) { struct msk_if_softc *sc_if; struct mii_data *mii; + int error; sc_if = ifp->if_softc; MSK_IF_LOCK(sc_if); mii = device_get_softc(sc_if->msk_miibus); - mii_mediachg(mii); + error = mii_mediachg(mii); MSK_IF_UNLOCK(sc_if); - return (0); + return (error); } /* From owner-svn-src-head@FreeBSD.ORG Mon May 25 04:22:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B7F61065672; Mon, 25 May 2009 04:22:27 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 695208FC08; Mon, 25 May 2009 04:22:27 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P4MRvc010759; Mon, 25 May 2009 04:22:27 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P4MRVF010757; Mon, 25 May 2009 04:22:27 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250422.n4P4MRVF010757@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 04:22:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192723 - head/sys/dev/msk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 04:22:28 -0000 Author: yongari Date: Mon May 25 04:22:27 2009 New Revision: 192723 URL: http://svn.freebsd.org/changeset/base/192723 Log: Rather than checking every chip revision, introduce more flags to mark controller's capability. Controllers that have jumbo frame support sets MSK_FLAG_JUMBO, and controllers that does not support checksum offloading for jumbo frames will set MSK_FLAG_JUMBO_NOCSUM. For Fast Ethernet controllers it will set MSK_FLAG_FASTETHER and it would be used in link state handling. While here, disable Tx checksum offloading if jumbo frame is used on controllers that does not have Tx checksum offloading capability for jumbo frame(e.g. Yukon EC Ultra). Modified: head/sys/dev/msk/if_msk.c head/sys/dev/msk/if_mskreg.h Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Mon May 25 04:13:06 2009 (r192722) +++ head/sys/dev/msk/if_msk.c Mon May 25 04:22:27 2009 (r192723) @@ -901,20 +901,29 @@ msk_ioctl(struct ifnet *ifp, u_long comm switch(command) { case SIOCSIFMTU: + MSK_IF_LOCK(sc_if); if (ifr->ifr_mtu > MSK_JUMBO_MTU || ifr->ifr_mtu < ETHERMIN) error = EINVAL; else if (ifp->if_mtu != ifr->ifr_mtu) { - if ((sc_if->msk_flags & MSK_FLAG_NOJUMBO) != 0 && - ifr->ifr_mtu > ETHERMTU) - error = EINVAL; - else { - MSK_IF_LOCK(sc_if); - ifp->if_mtu = ifr->ifr_mtu; - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) - msk_init_locked(sc_if); - MSK_IF_UNLOCK(sc_if); + if (ifr->ifr_mtu > ETHERMTU) { + if ((sc_if->msk_flags & MSK_FLAG_JUMBO) == 0) { + error = EINVAL; + MSK_IF_UNLOCK(sc_if); + break; + } + if ((sc_if->msk_flags & + MSK_FLAG_JUMBO_NOCSUM) != 0) { + ifp->if_hwassist &= + ~(MSK_CSUM_FEATURES | CSUM_TSO); + ifp->if_capenable &= + ~(IFCAP_TSO4 | IFCAP_TXCSUM); + VLAN_CAPABILITIES(ifp); + } } + ifp->if_mtu = ifr->ifr_mtu; + msk_init_locked(sc_if); } + MSK_IF_UNLOCK(sc_if); break; case SIOCSIFFLAGS: MSK_IF_LOCK(sc_if); @@ -971,11 +980,7 @@ msk_ioctl(struct ifnet *ifp, u_long comm ifp->if_hwassist &= ~CSUM_TSO; } if (ifp->if_mtu > ETHERMTU && - sc_if->msk_softc->msk_hw_id == CHIP_ID_YUKON_EC_U) { - /* - * In Yukon EC Ultra, TSO & checksum offload is not - * supported for jumbo frame. - */ + (sc_if->msk_flags & MSK_FLAG_JUMBO_NOCSUM) != 0) { ifp->if_hwassist &= ~(MSK_CSUM_FEATURES | CSUM_TSO); ifp->if_capenable &= ~(IFCAP_TSO4 | IFCAP_TXCSUM); } @@ -1406,10 +1411,6 @@ msk_attach(device_t dev) callout_init_mtx(&sc_if->msk_tick_ch, &sc_if->msk_softc->msk_mtx, 0); msk_sysctl_node(sc_if); - /* Disable jumbo frame for Yukon FE. */ - if (sc_if->msk_softc->msk_hw_id == CHIP_ID_YUKON_FE) - sc_if->msk_flags |= MSK_FLAG_NOJUMBO; - if ((error = msk_txrx_dma_alloc(sc_if) != 0)) goto fail; msk_rx_dma_jalloc(sc_if); @@ -1609,14 +1610,20 @@ mskc_attach(device_t dev) switch (sc->msk_hw_id) { case CHIP_ID_YUKON_EC: + sc->msk_clock = 125; /* 125 Mhz */ + sc->msk_pflags |= MSK_FLAG_JUMBO; + break; case CHIP_ID_YUKON_EC_U: sc->msk_clock = 125; /* 125 Mhz */ + sc->msk_pflags |= MSK_FLAG_JUMBO | MSK_FLAG_JUMBO_NOCSUM; break; case CHIP_ID_YUKON_FE: sc->msk_clock = 100; /* 100 Mhz */ + sc->msk_pflags |= MSK_FLAG_FASTETHER; break; case CHIP_ID_YUKON_XL: sc->msk_clock = 156; /* 156 Mhz */ + sc->msk_pflags |= MSK_FLAG_JUMBO; break; default: sc->msk_clock = 156; /* 156 Mhz */ @@ -2158,11 +2165,10 @@ msk_rx_dma_jalloc(struct msk_if_softc *s bus_size_t rxalign; int error, i; - if (jumbo_disable != 0 || (sc_if->msk_flags & MSK_FLAG_NOJUMBO) != 0) { - sc_if->msk_flags |= MSK_FLAG_NOJUMBO; + if (jumbo_disable != 0 || (sc_if->msk_flags & MSK_FLAG_JUMBO) == 0) { + sc_if->msk_flags &= ~MSK_FLAG_JUMBO; device_printf(sc_if->msk_if_dev, "disabling jumbo frame support\n"); - sc_if->msk_flags |= MSK_FLAG_NOJUMBO; return (0); } /* Create tag for jumbo Rx ring. */ @@ -2257,7 +2263,7 @@ jumbo_fail: msk_rx_dma_jfree(sc_if); device_printf(sc_if->msk_if_dev, "disabling jumbo frame support " "due to resource shortage\n"); - sc_if->msk_flags |= MSK_FLAG_NOJUMBO; + sc_if->msk_flags &= ~MSK_FLAG_JUMBO; return (error); } @@ -3490,11 +3496,7 @@ msk_init_locked(struct msk_if_softc *sc_ sc_if->msk_framesize = ifp->if_mtu; sc_if->msk_framesize += ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; if (ifp->if_mtu > ETHERMTU && - sc_if->msk_softc->msk_hw_id == CHIP_ID_YUKON_EC_U) { - /* - * In Yukon EC Ultra, TSO & checksum offload is not - * supported for jumbo frame. - */ + (sc_if->msk_flags & MSK_FLAG_JUMBO_NOCSUM) != 0) { ifp->if_hwassist &= ~(MSK_CSUM_FEATURES | CSUM_TSO); ifp->if_capenable &= ~(IFCAP_TSO4 | IFCAP_TXCSUM); } Modified: head/sys/dev/msk/if_mskreg.h ============================================================================== --- head/sys/dev/msk/if_mskreg.h Mon May 25 04:13:06 2009 (r192722) +++ head/sys/dev/msk/if_mskreg.h Mon May 25 04:22:27 2009 (r192723) @@ -2382,8 +2382,10 @@ struct msk_if_softc { int msk_phyaddr; uint32_t msk_flags; #define MSK_FLAG_MSI 0x0001 -#define MSK_FLAG_RAMBUF 0x0010 -#define MSK_FLAG_NOJUMBO 0x0020 +#define MSK_FLAG_FASTETHER 0x0004 +#define MSK_FLAG_JUMBO 0x0008 +#define MSK_FLAG_JUMBO_NOCSUM 0x0010 +#define MSK_FLAG_RAMBUF 0x0020 #define MSK_FLAG_SUSPEND 0x2000 #define MSK_FLAG_DETACH 0x4000 #define MSK_FLAG_LINK 0x8000 From owner-svn-src-head@FreeBSD.ORG Mon May 25 04:25:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8201106566B; Mon, 25 May 2009 04:25:08 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B674A8FC1F; Mon, 25 May 2009 04:25:08 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P4P81g010844; Mon, 25 May 2009 04:25:08 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P4P8hi010843; Mon, 25 May 2009 04:25:08 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250425.n4P4P8hi010843@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 04:25:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192724 - head/sys/dev/msk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 04:25:09 -0000 Author: yongari Date: Mon May 25 04:25:08 2009 New Revision: 192724 URL: http://svn.freebsd.org/changeset/base/192724 Log: Caller already hold a driver lock in mii callback, assert it. Modified: head/sys/dev/msk/if_msk.c Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Mon May 25 04:22:27 2009 (r192723) +++ head/sys/dev/msk/if_msk.c Mon May 25 04:25:08 2009 (r192724) @@ -467,7 +467,7 @@ msk_miibus_statchg(device_t dev) sc_if = device_get_softc(dev); sc = sc_if->msk_softc; - MSK_IF_LOCK(sc_if); + MSK_IF_LOCK_ASSERT(sc_if); mii = device_get_softc(sc_if->msk_miibus); ifp = sc_if->msk_ifp; From owner-svn-src-head@FreeBSD.ORG Mon May 25 04:27:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3192106566B; Mon, 25 May 2009 04:27:12 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CE0408FC16; Mon, 25 May 2009 04:27:12 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P4RChY010921; Mon, 25 May 2009 04:27:12 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P4RCH6010920; Mon, 25 May 2009 04:27:12 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250427.n4P4RCH6010920@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 04:27:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192725 - head/sys/dev/msk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 04:27:13 -0000 Author: yongari Date: Mon May 25 04:27:12 2009 New Revision: 192725 URL: http://svn.freebsd.org/changeset/base/192725 Log: Oops, add missing ~ operator. Modified: head/sys/dev/msk/if_msk.c Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Mon May 25 04:25:08 2009 (r192724) +++ head/sys/dev/msk/if_msk.c Mon May 25 04:27:12 2009 (r192725) @@ -2800,7 +2800,7 @@ mskc_resume(device_t dev) ((sc->msk_if[i]->msk_ifp->if_flags & IFF_UP) != 0)) msk_init_locked(sc->msk_if[i]); } - sc->msk_pflags &= MSK_FLAG_SUSPEND; + sc->msk_pflags &= ~MSK_FLAG_SUSPEND; MSK_UNLOCK(sc); From owner-svn-src-head@FreeBSD.ORG Mon May 25 06:09:18 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E91C106567B; Mon, 25 May 2009 06:09:18 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5C7958FC19; Mon, 25 May 2009 06:09:18 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P69IJ4012866; Mon, 25 May 2009 06:09:18 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P69I9e012864; Mon, 25 May 2009 06:09:18 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250609.n4P69I9e012864@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 06:09:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192726 - head/sys/dev/msk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 06:09:22 -0000 Author: yongari Date: Mon May 25 06:09:18 2009 New Revision: 192726 URL: http://svn.freebsd.org/changeset/base/192726 Log: Add support for newer descriptor format. This format is used on Yukon FE+, Yukon Extreme and Yukon Supreme. Modified: head/sys/dev/msk/if_msk.c head/sys/dev/msk/if_mskreg.h Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Mon May 25 04:27:12 2009 (r192725) +++ head/sys/dev/msk/if_msk.c Mon May 25 06:09:18 2009 (r192726) @@ -2399,7 +2399,8 @@ msk_encap(struct msk_if_softc *sc_if, st tcp_offset = offset = 0; m = *m_head; - if ((m->m_pkthdr.csum_flags & (MSK_CSUM_FEATURES | CSUM_TSO)) != 0) { + if ((sc_if->msk_flags & MSK_FLAG_DESCV2) == 0 && + (m->m_pkthdr.csum_flags & (MSK_CSUM_FEATURES | CSUM_TSO)) != 0) { /* * Since mbuf has no protocol specific structure information * in it we have to inspect protocol information here to @@ -2526,11 +2527,18 @@ msk_encap(struct msk_if_softc *sc_if, st /* Check TSO support. */ if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) { - tso_mtu = offset + m->m_pkthdr.tso_segsz; + if ((sc_if->msk_flags & MSK_FLAG_DESCV2) != 0) + tso_mtu = m->m_pkthdr.tso_segsz; + else + tso_mtu = offset + m->m_pkthdr.tso_segsz; if (tso_mtu != sc_if->msk_cdata.msk_tso_mtu) { tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; tx_le->msk_addr = htole32(tso_mtu); - tx_le->msk_control = htole32(OP_LRGLEN | HW_OWNER); + if ((sc_if->msk_flags & MSK_FLAG_DESCV2) != 0) + tx_le->msk_control = htole32(OP_MSS | HW_OWNER); + else + tx_le->msk_control = + htole32(OP_LRGLEN | HW_OWNER); sc_if->msk_cdata.msk_tx_cnt++; MSK_INC(prod, MSK_TX_RING_CNT); sc_if->msk_cdata.msk_tso_mtu = tso_mtu; @@ -2554,15 +2562,21 @@ msk_encap(struct msk_if_softc *sc_if, st } /* Check if we have to handle checksum offload. */ if (tso == 0 && (m->m_pkthdr.csum_flags & MSK_CSUM_FEATURES) != 0) { - tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; - tx_le->msk_addr = htole32(((tcp_offset + m->m_pkthdr.csum_data) - & 0xffff) | ((uint32_t)tcp_offset << 16)); - tx_le->msk_control = htole32(1 << 16 | (OP_TCPLISW | HW_OWNER)); - control = CALSUM | WR_SUM | INIT_SUM | LOCK_SUM; - if ((m->m_pkthdr.csum_flags & CSUM_UDP) != 0) - control |= UDPTCP; - sc_if->msk_cdata.msk_tx_cnt++; - MSK_INC(prod, MSK_TX_RING_CNT); + if ((sc_if->msk_flags & MSK_FLAG_DESCV2) != 0) + control |= CALSUM; + else { + tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; + tx_le->msk_addr = htole32(((tcp_offset + + m->m_pkthdr.csum_data) & 0xffff) | + ((uint32_t)tcp_offset << 16)); + tx_le->msk_control = htole32(1 << 16 | + (OP_TCPLISW | HW_OWNER)); + control = CALSUM | WR_SUM | INIT_SUM | LOCK_SUM; + if ((m->m_pkthdr.csum_flags & CSUM_UDP) != 0) + control |= UDPTCP; + sc_if->msk_cdata.msk_tx_cnt++; + MSK_INC(prod, MSK_TX_RING_CNT); + } } si = prod; Modified: head/sys/dev/msk/if_mskreg.h ============================================================================== --- head/sys/dev/msk/if_mskreg.h Mon May 25 04:27:12 2009 (r192725) +++ head/sys/dev/msk/if_mskreg.h Mon May 25 06:09:18 2009 (r192726) @@ -2122,6 +2122,8 @@ struct msk_stat_desc { #define OP_ADDR64VLAN (OP_ADDR64 | OP_VLAN) #define OP_LRGLEN 0x24000000 #define OP_LRGLENVLAN (OP_LRGLEN | OP_VLAN) +#define OP_MSS 0x28000000 +#define OP_MSSVLAN (OP_MSS | OP_VLAN) #define OP_BUFFER 0x40000000 #define OP_PACKET 0x41000000 #define OP_LARGESEND 0x43000000 @@ -2386,6 +2388,7 @@ struct msk_if_softc { #define MSK_FLAG_JUMBO 0x0008 #define MSK_FLAG_JUMBO_NOCSUM 0x0010 #define MSK_FLAG_RAMBUF 0x0020 +#define MSK_FLAG_DESCV2 0x0040 #define MSK_FLAG_SUSPEND 0x2000 #define MSK_FLAG_DETACH 0x4000 #define MSK_FLAG_LINK 0x8000 From owner-svn-src-head@FreeBSD.ORG Mon May 25 06:19:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27A89106566B; Mon, 25 May 2009 06:19:37 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EFB948FC0C; Mon, 25 May 2009 06:19:36 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P6Ja8j013084; Mon, 25 May 2009 06:19:36 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P6JaLs013083; Mon, 25 May 2009 06:19:36 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250619.n4P6JaLs013083@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 06:19:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192727 - head/sys/dev/msk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 06:19:37 -0000 Author: yongari Date: Mon May 25 06:19:36 2009 New Revision: 192727 URL: http://svn.freebsd.org/changeset/base/192727 Log: Explicitly check resolved speed/duplex. Just checking IFM_ACTIVE does not guarantee established link. Also 1000baseT link report for fast ethernet controller is not valid one so make sure gigabit link is allowed for this controller. Whenever we lost link, check whether Rx/Tx MACs were enabled. If both MAC are not active, do not try to disable it again. Modified: head/sys/dev/msk/if_msk.c Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Mon May 25 06:09:18 2009 (r192726) +++ head/sys/dev/msk/if_msk.c Mon May 25 06:19:36 2009 (r192727) @@ -475,11 +475,25 @@ msk_miibus_statchg(device_t dev) (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) return; - if (mii->mii_media_status & IFM_ACTIVE) { - if (IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) + sc_if->msk_flags &= ~MSK_FLAG_LINK; + if ((mii->mii_media_status & (IFM_AVALID | IFM_ACTIVE)) == + (IFM_AVALID | IFM_ACTIVE)) { + switch (IFM_SUBTYPE(mii->mii_media_active)) { + case IFM_10_T: + case IFM_100_TX: sc_if->msk_flags |= MSK_FLAG_LINK; - } else - sc_if->msk_flags &= ~MSK_FLAG_LINK; + break; + case IFM_1000_T: + case IFM_1000_SX: + case IFM_1000_LX: + case IFM_1000_CX: + if ((sc_if->msk_flags & MSK_FLAG_FASTETHER) == 0) + sc_if->msk_flags |= MSK_FLAG_LINK; + break; + default: + break; + } + } if ((sc_if->msk_flags & MSK_FLAG_LINK) != 0) { /* Enable Tx FIFO Underrun. */ @@ -538,10 +552,12 @@ msk_miibus_statchg(device_t dev) msk_phy_writereg(sc_if, PHY_ADDR_MARV, PHY_MARV_INT_MASK, 0); /* Disable Rx/Tx MAC. */ gmac = GMAC_READ_2(sc, sc_if->msk_port, GM_GP_CTRL); - gmac &= ~(GM_GPCR_RX_ENA | GM_GPCR_TX_ENA); - GMAC_WRITE_2(sc, sc_if->msk_port, GM_GP_CTRL, gmac); - /* Read again to ensure writing. */ - GMAC_READ_2(sc, sc_if->msk_port, GM_GP_CTRL); + if ((GM_GPCR_RX_ENA | GM_GPCR_TX_ENA) != 0) { + gmac &= ~(GM_GPCR_RX_ENA | GM_GPCR_TX_ENA); + GMAC_WRITE_2(sc, sc_if->msk_port, GM_GP_CTRL, gmac); + /* Read again to ensure writing. */ + GMAC_READ_2(sc, sc_if->msk_port, GM_GP_CTRL); + } } } From owner-svn-src-head@FreeBSD.ORG Mon May 25 06:29:03 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E16A106567A; Mon, 25 May 2009 06:29:03 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2A3DD8FC0A; Mon, 25 May 2009 06:29:03 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P6T2Dc013351; Mon, 25 May 2009 06:29:02 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P6T2m5013350; Mon, 25 May 2009 06:29:02 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250629.n4P6T2m5013350@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 06:29:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192728 - head/sys/dev/msk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 06:29:09 -0000 Author: yongari Date: Mon May 25 06:29:02 2009 New Revision: 192728 URL: http://svn.freebsd.org/changeset/base/192728 Log: Disable HW WOL for Yukon EC Ultra. While I'm here use switch statement over if-else statement. This change will make it easy to add newer Yukon controllers. Modified: head/sys/dev/msk/if_msk.c Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Mon May 25 06:19:36 2009 (r192727) +++ head/sys/dev/msk/if_msk.c Mon May 25 06:29:02 2009 (r192728) @@ -1080,7 +1080,7 @@ mskc_setup_rambuffer(struct msk_softc *s static void msk_phy_power(struct msk_softc *sc, int mode) { - uint32_t val; + uint32_t our, val; int i; switch (mode) { @@ -1106,16 +1106,17 @@ msk_phy_power(struct msk_softc *sc, int val = pci_read_config(sc->msk_dev, PCI_OUR_REG_1, 4); val &= ~(PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD); - if (sc->msk_hw_id == CHIP_ID_YUKON_XL && - sc->msk_hw_rev > CHIP_REV_YU_XL_A1) { - /* Deassert Low Power for 1st PHY. */ - val |= PCI_Y2_PHY1_COMA; - if (sc->msk_num_port > 1) - val |= PCI_Y2_PHY2_COMA; - } else if (sc->msk_hw_id == CHIP_ID_YUKON_EC_U) { - uint32_t our; - - CSR_WRITE_2(sc, B0_CTST, Y2_HW_WOL_ON); + switch (sc->msk_hw_id) { + case CHIP_ID_YUKON_XL: + if (sc->msk_hw_rev > CHIP_REV_YU_XL_A1) { + /* Deassert Low Power for 1st PHY. */ + val |= PCI_Y2_PHY1_COMA; + if (sc->msk_num_port > 1) + val |= PCI_Y2_PHY2_COMA; + } + break; + case CHIP_ID_YUKON_EC_U: + CSR_WRITE_2(sc, B0_CTST, Y2_HW_WOL_OFF); /* Enable all clocks. */ pci_write_config(sc->msk_dev, PCI_OUR_REG_3, 0, 4); @@ -1126,6 +1127,9 @@ msk_phy_power(struct msk_softc *sc, int pci_write_config(sc->msk_dev, PCI_OUR_REG_4, our, 4); /* Set to default value. */ pci_write_config(sc->msk_dev, PCI_OUR_REG_5, 0, 4); + break; + default: + break; } /* Release PHY from PowerDown/COMA mode. */ pci_write_config(sc->msk_dev, PCI_OUR_REG_1, val, 4); From owner-svn-src-head@FreeBSD.ORG Mon May 25 06:39:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EDFD8106566B; Mon, 25 May 2009 06:39:48 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DC9328FC25; Mon, 25 May 2009 06:39:48 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P6dm8G013671; Mon, 25 May 2009 06:39:48 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P6dmrt013670; Mon, 25 May 2009 06:39:48 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250639.n4P6dmrt013670@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 06:39:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192731 - head/sys/dev/msk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 06:39:49 -0000 Author: yongari Date: Mon May 25 06:39:48 2009 New Revision: 192731 URL: http://svn.freebsd.org/changeset/base/192731 Log: Explicitly reset GMAC Controls and initialize GM_GP_CTRL register. The GM_GP_CTRL register may have stale content from previous link information so clearing it will make hardware update the register correctly when it established a valid link. While I'm here remove stale comment. Modified: head/sys/dev/msk/if_msk.c Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Mon May 25 06:36:02 2009 (r192730) +++ head/sys/dev/msk/if_msk.c Mon May 25 06:39:48 2009 (r192731) @@ -3535,18 +3535,16 @@ msk_init_locked(struct msk_if_softc *sc_ ifp->if_capenable &= ~(IFCAP_TSO4 | IFCAP_TXCSUM); } + /* GMAC Control reset. */ + CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_RST_SET); + CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_RST_CLR); + CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_F_LOOPB_OFF); + /* - * Initialize GMAC first. - * Without this initialization, Rx MAC did not work as expected - * and Rx MAC garbled status LEs and it resulted in out-of-order - * or duplicated frame delivery which in turn showed very poor - * Rx performance.(I had to write a packet analysis code that - * could be embeded in driver to diagnose this issue.) - * I've spent almost 2 months to fix this issue. If I have had - * datasheet for Yukon II I wouldn't have encountered this. :-( + * Initialize GMAC first such that speed/duplex/flow-control + * parameters are renegotiated when interface is brought up. */ - gmac = GM_GPCR_SPEED_100 | GM_GPCR_SPEED_1000 | GM_GPCR_DUP_FULL; - GMAC_WRITE_2(sc, sc_if->msk_port, GM_GP_CTRL, gmac); + GMAC_WRITE_2(sc, sc_if->msk_port, GM_GP_CTRL, 0); /* Dummy read the Interrupt Source Register. */ CSR_READ_1(sc, MR_ADDR(sc_if->msk_port, GMAC_IRQ_SRC)); From owner-svn-src-head@FreeBSD.ORG Mon May 25 06:45:34 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F0D3106564A; Mon, 25 May 2009 06:45:34 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D29B8FC14; Mon, 25 May 2009 06:45:34 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P6jXJe013846; Mon, 25 May 2009 06:45:33 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P6jXIw013842; Mon, 25 May 2009 06:45:33 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <200905250645.n4P6jXIw013842@svn.freebsd.org> From: Brian Somers Date: Mon, 25 May 2009 06:45:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192732 - head/usr.bin/sed X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 06:45:34 -0000 Author: brian Date: Mon May 25 06:45:33 2009 New Revision: 192732 URL: http://svn.freebsd.org/changeset/base/192732 Log: Implement "addr1,+N" ranges - not dissimilar to grep's -A switch. PR: 134856 Submitted by: Jeremie Le Hen - jeremie at le-hen dot org Modified: head/usr.bin/sed/compile.c head/usr.bin/sed/defs.h head/usr.bin/sed/process.c head/usr.bin/sed/sed.1 Modified: head/usr.bin/sed/compile.c ============================================================================== --- head/usr.bin/sed/compile.c Mon May 25 06:39:48 2009 (r192731) +++ head/usr.bin/sed/compile.c Mon May 25 06:45:33 2009 (r192732) @@ -181,7 +181,7 @@ semicolon: EATSPACE(); if ((*link = cmd = malloc(sizeof(struct s_command))) == NULL) err(1, "malloc"); link = &cmd->next; - cmd->nonsel = cmd->inrange = 0; + cmd->startline = cmd->nonsel = 0; /* First parse the addresses */ naddr = 0; @@ -775,6 +775,7 @@ compile_addr(char *p, struct s_addr *a) icase = 0; + a->type = 0; switch (*p) { case '\\': /* Context address */ ++p; @@ -798,10 +799,16 @@ compile_addr(char *p, struct s_addr *a) case '$': /* Last line */ a->type = AT_LAST; return (p + 1); + + case '+': /* Relative line number */ + a->type = AT_RELLINE; + p++; + /* FALLTHROUGH */ /* Line number */ case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': - a->type = AT_LINE; + if (a->type == 0) + a->type = AT_LINE; a->u.l = strtol(p, &end, 10); return (end); default: Modified: head/usr.bin/sed/defs.h ============================================================================== --- head/usr.bin/sed/defs.h Mon May 25 06:39:48 2009 (r192731) +++ head/usr.bin/sed/defs.h Mon May 25 06:45:33 2009 (r192732) @@ -38,8 +38,9 @@ * Types of address specifications */ enum e_atype { - AT_RE, /* Line that match RE */ + AT_RE = 1, /* Line that match RE */ AT_LINE, /* Specific line */ + AT_RELLINE, /* Relative line */ AT_LAST, /* Last line */ }; @@ -91,6 +92,7 @@ struct s_tr { struct s_command { struct s_command *next; /* Pointer to next command */ struct s_addr *a1, *a2; /* Start and end address */ + u_long startline; /* Start line number or zero */ char *t; /* Text for : a c i r w */ union { struct s_command *c; /* Command(s) for b t { */ @@ -100,7 +102,6 @@ struct s_command { } u; char code; /* Command code */ u_int nonsel:1; /* True if ! */ - u_int inrange:1; /* True if in range */ }; /* Modified: head/usr.bin/sed/process.c ============================================================================== --- head/usr.bin/sed/process.c Mon May 25 06:39:48 2009 (r192731) +++ head/usr.bin/sed/process.c Mon May 25 06:45:33 2009 (r192732) @@ -275,8 +275,8 @@ new: if (!nflag && !pd) (a)->type == AT_LINE ? linenum == (a)->u.l : lastline()) /* - * Return TRUE if the command applies to the current line. Sets the inrange - * flag to process ranges. Interprets the non-select (``!'') flag. + * Return TRUE if the command applies to the current line. Sets the start + * line for process ranges. Interprets the non-select (``!'') flag. */ static __inline int applies(struct s_command *cp) @@ -287,18 +287,22 @@ applies(struct s_command *cp) if (cp->a1 == NULL && cp->a2 == NULL) r = 1; else if (cp->a2) - if (cp->inrange) { + if (cp->startline > 0) { if (MATCH(cp->a2)) { - cp->inrange = 0; + cp->startline = 0; lastaddr = 1; r = 1; - } else if (cp->a2->type == AT_LINE && - linenum > cp->a2->u.l) { + } 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->inrange = 0; + cp->startline = 0; r = 0; } else r = 1; @@ -308,12 +312,15 @@ applies(struct s_command *cp) * equal to the line number first selected, only * one line shall be selected. * -- POSIX 1003.2 + * Likewise if the relative second line address is zero. */ - if (cp->a2->type == AT_LINE && - linenum >= cp->a2->u.l) + if ((cp->a2->type == AT_LINE && + linenum >= cp->a2->u.l) || + (cp->a2->type == AT_RELLINE && cp->a2->u.l == 0)) lastaddr = 1; - else - cp->inrange = 1; + else { + cp->startline = linenum; + } r = 1; } else r = 0; @@ -331,11 +338,11 @@ resetstate(void) struct s_command *cp; /* - * Reset all inrange markers. + * Reset all in-range markers. */ for (cp = prog; cp; cp = cp->code == '{' ? cp->u.c : cp->next) if (cp->a2) - cp->inrange = 0; + cp->startline = 0; /* * Clear out the hold space. Modified: head/usr.bin/sed/sed.1 ============================================================================== --- head/usr.bin/sed/sed.1 Mon May 25 06:39:48 2009 (r192731) +++ head/usr.bin/sed/sed.1 Mon May 25 06:45:33 2009 (r192732) @@ -211,6 +211,9 @@ that matches the second address. If the second address is a number less than or equal to the line number first selected, only that line is selected. +The number in the second address may be prefixed with a +.Pq Dq \&+ +to specify the number of lines to match after the first pattern. In the case when the second address is a context address, .Nm @@ -594,7 +597,10 @@ The .Fl E , I , a and .Fl i -options, as well as the +options, the prefixing +.Dq \&+ +in the second member of an address range, +as well as the .Dq I flag to the address regular expression and substitution command are non-standard From owner-svn-src-head@FreeBSD.ORG Mon May 25 06:58:43 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E4AC1065670; Mon, 25 May 2009 06:58:43 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B9DA8FC1D; Mon, 25 May 2009 06:58:43 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P6wgXC014183; Mon, 25 May 2009 06:58:42 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P6wgDT014180; Mon, 25 May 2009 06:58:42 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <200905250658.n4P6wgDT014180@svn.freebsd.org> From: Brian Somers Date: Mon, 25 May 2009 06:58:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192733 - in head/tools/regression/usr.bin/sed: . regress.multitest.out X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 06:58:44 -0000 Author: brian Date: Mon May 25 06:58:42 2009 New Revision: 192733 URL: http://svn.freebsd.org/changeset/base/192733 Log: Regression test the 'addr1,+N' feature added in r192732 Added: head/tools/regression/usr.bin/sed/regress.multitest.out/40_2.21 (contents, props changed) head/tools/regression/usr.bin/sed/regress.multitest.out/41_2.22 (contents, props changed) Modified: head/tools/regression/usr.bin/sed/multitest.t Modified: head/tools/regression/usr.bin/sed/multitest.t ============================================================================== --- head/tools/regression/usr.bin/sed/multitest.t Mon May 25 06:45:33 2009 (r192732) +++ head/tools/regression/usr.bin/sed/multitest.t Mon May 25 06:58:42 2009 (r192733) @@ -180,6 +180,8 @@ hello' /dev/null mark '2.18' ; $SED -n '/l2_3/,/l1_8/p' lines1 lines2 mark '2.19' ; $SED -n '12,3p' lines1 lines2 mark '2.20' ; $SED -n '/l1_7/,3p' lines1 lines2 + mark '2.21' ; $SED -n '13,+4p' lines1 lines2 + mark '2.22' ; $SED -n '/l1_6/,+2p' lines1 lines2 } test_group() Added: head/tools/regression/usr.bin/sed/regress.multitest.out/40_2.21 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usr.bin/sed/regress.multitest.out/40_2.21 Mon May 25 06:58:42 2009 (r192733) @@ -0,0 +1,5 @@ +l1_13 +l1_14 +l2_1 +l2_2 +l2_3 Added: head/tools/regression/usr.bin/sed/regress.multitest.out/41_2.22 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usr.bin/sed/regress.multitest.out/41_2.22 Mon May 25 06:58:42 2009 (r192733) @@ -0,0 +1,3 @@ +l1_6 +l1_7 +l1_8 From owner-svn-src-head@FreeBSD.ORG Mon May 25 07:06:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A41BD106566C; Mon, 25 May 2009 07:06:10 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9249B8FC16; Mon, 25 May 2009 07:06:10 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P76AsS014389; Mon, 25 May 2009 07:06:10 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P76AbK014387; Mon, 25 May 2009 07:06:10 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250706.n4P76AbK014387@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 07:06:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192734 - head/sys/dev/msk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 07:06:11 -0000 Author: yongari Date: Mon May 25 07:06:10 2009 New Revision: 192734 URL: http://svn.freebsd.org/changeset/base/192734 Log: Add preliminary Yukon FE+ support and register definitions. Yukon FE+ is fast ethernet controller and uses new descriptor format. Since I don't have this controller, the support code was written from guess and various feedback from enthusiastic users. Thanks to all users who patiently tested my initial patches. Special thanks to Tanguy Bouzeloc who fixed critical bug of initial patch. Tested by: bz, Tanguy Bouzeloc ( the.zauron <> gmail dot com ) Bruce Cran ( bruce <> cran dot org dot uk ) Michael Reifenberger ( mike <> reifenberger dot com ) Stephen Montgomery-Smith ( stephen <> missouri dot edu ) Modified: head/sys/dev/msk/if_msk.c head/sys/dev/msk/if_mskreg.h Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Mon May 25 06:58:42 2009 (r192733) +++ head/sys/dev/msk/if_msk.c Mon May 25 07:06:10 2009 (r192734) @@ -220,7 +220,8 @@ static const char *model_name[] = { "Yukon EC Ultra", "Yukon Unknown", "Yukon EC", - "Yukon FE" + "Yukon FE", + "Yukon FE+" }; static int mskc_probe(device_t); @@ -1116,6 +1117,7 @@ msk_phy_power(struct msk_softc *sc, int } break; case CHIP_ID_YUKON_EC_U: + case CHIP_ID_YUKON_FE_P: CSR_WRITE_2(sc, B0_CTST, Y2_HW_WOL_OFF); /* Enable all clocks. */ @@ -1579,7 +1581,7 @@ mskc_attach(device_t dev) sc->msk_hw_rev = (CSR_READ_1(sc, B2_MAC_CFG) >> 4) & 0x0f; /* Bail out if chip is not recognized. */ if (sc->msk_hw_id < CHIP_ID_YUKON_XL || - sc->msk_hw_id > CHIP_ID_YUKON_FE) { + sc->msk_hw_id > CHIP_ID_YUKON_FE_P) { device_printf(dev, "unknown device: id=0x%02x, rev=0x%02x\n", sc->msk_hw_id, sc->msk_hw_rev); mtx_destroy(&sc->msk_mtx); @@ -1641,6 +1643,10 @@ mskc_attach(device_t dev) sc->msk_clock = 100; /* 100 Mhz */ sc->msk_pflags |= MSK_FLAG_FASTETHER; break; + case CHIP_ID_YUKON_FE_P: + sc->msk_clock = 50; /* 50 Mhz */ + sc->msk_pflags |= MSK_FLAG_FASTETHER | MSK_FLAG_DESCV2; + break; case CHIP_ID_YUKON_XL: sc->msk_clock = 156; /* 156 Mhz */ sc->msk_pflags |= MSK_FLAG_JUMBO; @@ -3512,6 +3518,7 @@ msk_init_locked(struct msk_if_softc *sc_ struct mii_data *mii; uint16_t eaddr[ETHER_ADDR_LEN / 2]; uint16_t gmac; + uint32_t reg; int error, i; MSK_IF_LOCK_ASSERT(sc_if); @@ -3590,8 +3597,10 @@ msk_init_locked(struct msk_if_softc *sc_ /* Configure Rx MAC FIFO. */ CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, RX_GMF_CTRL_T), GMF_RST_SET); CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, RX_GMF_CTRL_T), GMF_RST_CLR); - CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, RX_GMF_CTRL_T), - GMF_OPER_ON | GMF_RX_F_FL_ON); + reg = GMF_OPER_ON | GMF_RX_F_FL_ON; + if (sc->msk_hw_id == CHIP_ID_YUKON_FE_P) + reg |= GMF_RX_OVER_ON; + CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, RX_GMF_CTRL_T), reg); /* Set receive filter. */ msk_rxfilter(sc_if); Modified: head/sys/dev/msk/if_mskreg.h ============================================================================== --- head/sys/dev/msk/if_mskreg.h Mon May 25 06:58:42 2009 (r192733) +++ head/sys/dev/msk/if_mskreg.h Mon May 25 07:06:10 2009 (r192734) @@ -828,6 +828,7 @@ #define CHIP_ID_YUKON_EC_U 0xb4 /* Chip ID for YUKON-2 EC Ultra */ #define CHIP_ID_YUKON_EC 0xb6 /* Chip ID for YUKON-2 EC */ #define CHIP_ID_YUKON_FE 0xb7 /* Chip ID for YUKON-2 FE */ +#define CHIP_ID_YUKON_FE_P 0xb8 /* Chip ID for YUKON-2 FE+ */ #define CHIP_REV_YU_XL_A0 0 /* Chip Rev. for Yukon-2 A0 */ #define CHIP_REV_YU_XL_A1 1 /* Chip Rev. for Yukon-2 A1 */ @@ -841,6 +842,8 @@ #define CHIP_REV_YU_EC_U_A0 1 #define CHIP_REV_YU_EC_U_A1 2 +#define CHIP_REV_YU_FE_P_A0 0 /* Chip Rev. for Yukon-2 FE+ A0 */ + /* B2_Y2_CLK_GATE 8 bit Clock Gating (Yukon-2 only) */ #define Y2_STATUS_LNK2_INAC BIT_7 /* Status Link 2 inactiv (0 = activ) */ #define Y2_CLK_GAT_LNK2_DIS BIT_6 /* Disable clock gating Link 2 */ @@ -1855,6 +1858,10 @@ #define RX_TRUNC_OFF BIT_26 /* disable packet truncation */ #define RX_VLAN_STRIP_ON BIT_25 /* enable VLAN stripping */ #define RX_VLAN_STRIP_OFF BIT_24 /* disable VLAN stripping */ +#define GMF_RX_OVER_ON BIT_19 /* enable flushing on receive overrun */ +#define GMF_RX_OVER_OFF BIT_18 /* disable flushing on receive overrun */ +#define GMF_ASF_RX_OVER_ON BIT_17 /* enable flushing of ASF when overrun */ +#define GMF_ASF_RX_OVER_OFF BIT_16 /* disable flushing of ASF when overrun */ #define GMF_WP_TST_ON BIT_14 /* Write Pointer Test On */ #define GMF_WP_TST_OFF BIT_13 /* Write Pointer Test Off */ #define GMF_WP_STEP BIT_12 /* Write Pointer Step/Increment */ From owner-svn-src-head@FreeBSD.ORG Mon May 25 07:31:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 580E8106566C; Mon, 25 May 2009 07:31:19 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 462008FC18; Mon, 25 May 2009 07:31:19 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P7VJdP014944; Mon, 25 May 2009 07:31:19 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P7VJjj014942; Mon, 25 May 2009 07:31:19 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250731.n4P7VJjj014942@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 07:31:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192735 - head/sys/dev/msk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 07:31:19 -0000 Author: yongari Date: Mon May 25 07:31:18 2009 New Revision: 192735 URL: http://svn.freebsd.org/changeset/base/192735 Log: Add workaround for Yukon FE+ A0. This controller is known to have severe silicon bugs that can't handle VLAN hardware tagging as well as status LE writeback bug. The status LE writeback bug is so critical we can't trust status word of received frame. To accept frames on Yukon FE+ A0 msk(4) just do minimal check for received frames and pass them to upper stack. This means msk(4) can pass corrupted frames to upper layer. You have been warned! Also I supposed RX_GMF_FL_THR to be 32bits register but Linux driver treated it as 16bit register so follow their leads. At least this does not seem to break msk(4) on Yukon FE+. Tested by: bz, Tanguy Bouzeloc ( the.zauron <> gmail dot com ) Bruce Cran ( bruce <> cran dot org dot uk ) Michael Reifenberger ( mike <> reifenberger dot com ) Stephen Montgomery-Smith ( stephen <> missouri dot edu ) Modified: head/sys/dev/msk/if_msk.c head/sys/dev/msk/if_mskreg.h Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Mon May 25 07:06:10 2009 (r192734) +++ head/sys/dev/msk/if_msk.c Mon May 25 07:31:18 2009 (r192735) @@ -1493,14 +1493,17 @@ msk_attach(device_t dev) ether_ifattach(ifp, eaddr); MSK_IF_LOCK(sc_if); - /* - * VLAN capability setup - * Due to Tx checksum offload hardware bugs, msk(4) manually - * computes checksum for short frames. For VLAN tagged frames - * this workaround does not work so disable checksum offload - * for VLAN interface. - */ - ifp->if_capabilities |= IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING; + /* VLAN capability setup */ + ifp->if_capabilities |= IFCAP_VLAN_MTU; + if ((sc_if->msk_flags & MSK_FLAG_NOHWVLAN) == 0) { + /* + * Due to Tx checksum offload hardware bugs, msk(4) manually + * computes checksum for short frames. For VLAN tagged frames + * this workaround does not work so disable checksum offload + * for VLAN interface. + */ + ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING; + } ifp->if_capenable = ifp->if_capabilities; /* @@ -1646,6 +1649,19 @@ mskc_attach(device_t dev) case CHIP_ID_YUKON_FE_P: sc->msk_clock = 50; /* 50 Mhz */ sc->msk_pflags |= MSK_FLAG_FASTETHER | MSK_FLAG_DESCV2; + if (sc->msk_hw_rev == CHIP_REV_YU_FE_P_A0) { + /* + * XXX + * FE+ A0 has status LE writeback bug so msk(4) + * does not rely on status word of received frame + * in msk_rxeof() which in turn disables all + * hardware assistance bits reported by the status + * word as well as validity of the recevied frame. + * Just pass received frames to upper stack with + * minimal test and let upper stack handle them. + */ + sc->msk_pflags |= MSK_FLAG_NOHWVLAN | MSK_FLAG_NORXCHK; + } break; case CHIP_ID_YUKON_XL: sc->msk_clock = 156; /* 156 Mhz */ @@ -2882,7 +2898,18 @@ msk_rxeof(struct msk_if_softc *sc_if, ui if ((status & GMR_FS_VLAN) != 0 && (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0) rxlen -= ETHER_VLAN_ENCAP_LEN; - if (len > sc_if->msk_framesize || + if ((sc_if->msk_flags & MSK_FLAG_NORXCHK) != 0) { + /* + * For controllers that returns bogus status code + * just do minimal check and let upper stack + * handle this frame. + */ + if (len > MSK_MAX_FRAMELEN || len < ETHER_HDR_LEN) { + ifp->if_ierrors++; + msk_discard_rxbuf(sc_if, cons); + break; + } + } else if (len > sc_if->msk_framesize || ((status & GMR_FS_ANY_ERR) != 0) || ((status & GMR_FS_RX_OK) == 0) || (rxlen != len)) { /* Don't count flow-control packet as errors. */ @@ -3613,8 +3640,12 @@ msk_init_locked(struct msk_if_softc *sc_ * Set Rx FIFO flush threshold to 64 bytes + 1 FIFO word * due to hardware hang on receipt of pause frames. */ - CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, RX_GMF_FL_THR), - RX_GMF_FL_THR_DEF + 1); + reg = RX_GMF_FL_THR_DEF + 1; + /* Another magic for Yukon FE+ - From Linux. */ + if (sc->msk_hw_id == CHIP_ID_YUKON_FE_P && + sc->msk_hw_rev == CHIP_REV_YU_FE_P_A0) + reg = 0x178; + CSR_WRITE_2(sc, MR_ADDR(sc_if->msk_port, RX_GMF_FL_THR), reg); /* Configure Tx MAC FIFO. */ CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T), GMF_RST_SET); @@ -3646,6 +3677,14 @@ msk_init_locked(struct msk_if_softc *sc_ } } + if (sc->msk_hw_id == CHIP_ID_YUKON_FE_P && + sc->msk_hw_rev == CHIP_REV_YU_FE_P_A0) { + /* Disable dynamic watermark - from Linux. */ + reg = CSR_READ_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_EA)); + reg &= ~0x03; + CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_EA), reg); + } + /* * Disable Force Sync bit and Alloc bit in Tx RAM interface * arbiter as we don't use Sync Tx queue. Modified: head/sys/dev/msk/if_mskreg.h ============================================================================== --- head/sys/dev/msk/if_mskreg.h Mon May 25 07:06:10 2009 (r192734) +++ head/sys/dev/msk/if_mskreg.h Mon May 25 07:31:18 2009 (r192735) @@ -2396,6 +2396,8 @@ struct msk_if_softc { #define MSK_FLAG_JUMBO_NOCSUM 0x0010 #define MSK_FLAG_RAMBUF 0x0020 #define MSK_FLAG_DESCV2 0x0040 +#define MSK_FLAG_NOHWVLAN 0x0080 +#define MSK_FLAG_NORXCHK 0x0100 #define MSK_FLAG_SUSPEND 0x2000 #define MSK_FLAG_DETACH 0x4000 #define MSK_FLAG_LINK 0x8000 From owner-svn-src-head@FreeBSD.ORG Mon May 25 07:48:02 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23A681065670; Mon, 25 May 2009 07:48:02 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 122ED8FC3E; Mon, 25 May 2009 07:48:02 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P7m0VZ015282; Mon, 25 May 2009 07:48:00 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P7m0na015280; Mon, 25 May 2009 07:48:00 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250748.n4P7m0na015280@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 07:48:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192736 - head/sys/dev/msk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 07:48:02 -0000 Author: yongari Date: Mon May 25 07:48:00 2009 New Revision: 192736 URL: http://svn.freebsd.org/changeset/base/192736 Log: Add device ids for Yukon FE+(88E8040, 88E8040T, 88E8048 and 88E8070). Modified: head/sys/dev/msk/if_msk.c head/sys/dev/msk/if_mskreg.h Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Mon May 25 07:31:18 2009 (r192735) +++ head/sys/dev/msk/if_msk.c Mon May 25 07:48:00 2009 (r192736) @@ -197,6 +197,14 @@ static struct msk_product { "Marvell Yukon 88E8038 Gigabit Ethernet" }, { VENDORID_MARVELL, DEVICEID_MRVL_8039, "Marvell Yukon 88E8039 Gigabit Ethernet" }, + { VENDORID_MARVELL, DEVICEID_MRVL_8040, + "Marvell Yukon 88E8040 Fast Ethernet" }, + { VENDORID_MARVELL, DEVICEID_MRVL_8040T, + "Marvell Yukon 88E8040T Fast Ethernet" }, + { VENDORID_MARVELL, DEVICEID_MRVL_8048, + "Marvell Yukon 88E8048 Fast Ethernet" }, + { VENDORID_MARVELL, DEVICEID_MRVL_8070, + "Marvell Yukon 88E8070 Fast Ethernet" }, { VENDORID_MARVELL, DEVICEID_MRVL_4361, "Marvell Yukon 88E8050 Gigabit Ethernet" }, { VENDORID_MARVELL, DEVICEID_MRVL_4360, Modified: head/sys/dev/msk/if_mskreg.h ============================================================================== --- head/sys/dev/msk/if_mskreg.h Mon May 25 07:31:18 2009 (r192735) +++ head/sys/dev/msk/if_mskreg.h Mon May 25 07:48:00 2009 (r192736) @@ -130,12 +130,16 @@ #define DEVICEID_MRVL_8035 0x4350 #define DEVICEID_MRVL_8036 0x4351 #define DEVICEID_MRVL_8038 0x4352 -#define DEVICEID_MRVL_8039 0X4353 +#define DEVICEID_MRVL_8039 0x4353 +#define DEVICEID_MRVL_8040 0x4354 +#define DEVICEID_MRVL_8040T 0x4355 +#define DEVICEID_MRVL_8048 0x435A #define DEVICEID_MRVL_4360 0x4360 #define DEVICEID_MRVL_4361 0x4361 #define DEVICEID_MRVL_4362 0x4362 #define DEVICEID_MRVL_4363 0x4363 #define DEVICEID_MRVL_4364 0x4364 +#define DEVICEID_MRVL_8070 0x4365 #define DEVICEID_MRVL_436A 0x436A /* From owner-svn-src-head@FreeBSD.ORG Mon May 25 07:50:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E03C0106564A; Mon, 25 May 2009 07:50:14 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CF3178FC1E; Mon, 25 May 2009 07:50:14 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P7oE8E015362; Mon, 25 May 2009 07:50:14 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P7oEYb015361; Mon, 25 May 2009 07:50:14 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250750.n4P7oEYb015361@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 07:50:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192737 - head/sys/dev/msk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 07:50:15 -0000 Author: yongari Date: Mon May 25 07:50:14 2009 New Revision: 192737 URL: http://svn.freebsd.org/changeset/base/192737 Log: If interface is not UP, don't return media status. Modified: head/sys/dev/msk/if_msk.c Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Mon May 25 07:48:00 2009 (r192736) +++ head/sys/dev/msk/if_msk.c Mon May 25 07:50:14 2009 (r192737) @@ -904,6 +904,10 @@ msk_mediastatus(struct ifnet *ifp, struc sc_if = ifp->if_softc; MSK_IF_LOCK(sc_if); + if ((ifp->if_flags & IFF_UP) == 0) { + MSK_IF_UNLOCK(sc_if); + return; + } mii = device_get_softc(sc_if->msk_miibus); mii_pollstat(mii); From owner-svn-src-head@FreeBSD.ORG Mon May 25 07:56:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0E311065675; Mon, 25 May 2009 07:56:14 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DFA2B8FC1D; Mon, 25 May 2009 07:56:14 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P7uE3O015529; Mon, 25 May 2009 07:56:14 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P7uEaE015528; Mon, 25 May 2009 07:56:14 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250756.n4P7uEaE015528@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 07:56:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192738 - head/sys/dev/msk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 07:56:15 -0000 Author: yongari Date: Mon May 25 07:56:14 2009 New Revision: 192738 URL: http://svn.freebsd.org/changeset/base/192738 Log: Don't reinitialize controller when interface is already running. Modified: head/sys/dev/msk/if_msk.c Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Mon May 25 07:50:14 2009 (r192737) +++ head/sys/dev/msk/if_msk.c Mon May 25 07:56:14 2009 (r192738) @@ -2763,6 +2763,7 @@ msk_watchdog(struct msk_if_softc *sc_if) if_printf(sc_if->msk_ifp, "watchdog timeout " "(missed link)\n"); ifp->if_oerrors++; + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; msk_init_locked(sc_if); return; } @@ -2787,6 +2788,7 @@ msk_watchdog(struct msk_if_softc *sc_if) if_printf(ifp, "watchdog timeout\n"); ifp->if_oerrors++; + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; msk_init_locked(sc_if); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) taskqueue_enqueue(taskqueue_fast, &sc_if->msk_tx_task); @@ -2865,8 +2867,11 @@ mskc_resume(device_t dev) mskc_reset(sc); for (i = 0; i < sc->msk_num_port; i++) { if (sc->msk_if[i] != NULL && sc->msk_if[i]->msk_ifp != NULL && - ((sc->msk_if[i]->msk_ifp->if_flags & IFF_UP) != 0)) + ((sc->msk_if[i]->msk_ifp->if_flags & IFF_UP) != 0)) { + sc->msk_if[i]->msk_ifp->if_drv_flags &= + ~IFF_DRV_RUNNING; msk_init_locked(sc->msk_if[i]); + } } sc->msk_pflags &= ~MSK_FLAG_SUSPEND; @@ -3566,6 +3571,9 @@ msk_init_locked(struct msk_if_softc *sc_ sc = sc_if->msk_softc; mii = device_get_softc(sc_if->msk_miibus); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + return; + error = 0; /* Cancel pending I/O and free all Rx/Tx buffers. */ msk_stop(sc_if); From owner-svn-src-head@FreeBSD.ORG Mon May 25 07:59:31 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56CB51065670; Mon, 25 May 2009 07:59:31 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 45B628FC1F; Mon, 25 May 2009 07:59:31 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P7xVHi015629; Mon, 25 May 2009 07:59:31 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P7xVub015628; Mon, 25 May 2009 07:59:31 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250759.n4P7xVub015628@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 07:59:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192739 - head/sys/dev/msk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 07:59:31 -0000 Author: yongari Date: Mon May 25 07:59:30 2009 New Revision: 192739 URL: http://svn.freebsd.org/changeset/base/192739 Log: Be consistent with other capability checking. Modified: head/sys/dev/msk/if_msk.c Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Mon May 25 07:56:14 2009 (r192738) +++ head/sys/dev/msk/if_msk.c Mon May 25 07:59:30 2009 (r192739) @@ -987,23 +987,24 @@ msk_ioctl(struct ifnet *ifp, u_long comm case SIOCSIFCAP: MSK_IF_LOCK(sc_if); mask = ifr->ifr_reqcap ^ ifp->if_capenable; - if ((mask & IFCAP_TXCSUM) != 0) { + if ((mask & IFCAP_TXCSUM) != 0 && + (IFCAP_TXCSUM & ifp->if_capabilities) != 0) { ifp->if_capenable ^= IFCAP_TXCSUM; - if ((IFCAP_TXCSUM & ifp->if_capenable) != 0 && - (IFCAP_TXCSUM & ifp->if_capabilities) != 0) + if ((IFCAP_TXCSUM & ifp->if_capenable) != 0) ifp->if_hwassist |= MSK_CSUM_FEATURES; else ifp->if_hwassist &= ~MSK_CSUM_FEATURES; } - if ((mask & IFCAP_VLAN_HWTAGGING) != 0) { + if ((mask & IFCAP_VLAN_HWTAGGING) != 0 && + (IFCAP_VLAN_HWTAGGING & ifp->if_capabilities) != 0) { ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; msk_setvlan(sc_if, ifp); } - if ((mask & IFCAP_TSO4) != 0) { + if ((mask & IFCAP_TSO4) != 0 && + (IFCAP_TSO4 & ifp->if_capabilities) != 0) { ifp->if_capenable ^= IFCAP_TSO4; - if ((IFCAP_TSO4 & ifp->if_capenable) != 0 && - (IFCAP_TSO4 & ifp->if_capabilities) != 0) + if ((IFCAP_TSO4 & ifp->if_capenable) != 0) ifp->if_hwassist |= CSUM_TSO; else ifp->if_hwassist &= ~CSUM_TSO; From owner-svn-src-head@FreeBSD.ORG Mon May 25 08:02:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 267F51065672; Mon, 25 May 2009 08:02:06 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 155A18FC16; Mon, 25 May 2009 08:02:06 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P825ug015782; Mon, 25 May 2009 08:02:05 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P825ct015779; Mon, 25 May 2009 08:02:05 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250802.n4P825ct015779@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 08:02:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192740 - head/sys/dev/msk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 08:02:06 -0000 Author: yongari Date: Mon May 25 08:02:05 2009 New Revision: 192740 URL: http://svn.freebsd.org/changeset/base/192740 Log: Simplify SIOCSIFFLAGS handler. Modified: head/sys/dev/msk/if_msk.c Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Mon May 25 07:59:30 2009 (r192739) +++ head/sys/dev/msk/if_msk.c Mon May 25 08:02:05 2009 (r192740) @@ -957,18 +957,14 @@ msk_ioctl(struct ifnet *ifp, u_long comm case SIOCSIFFLAGS: MSK_IF_LOCK(sc_if); if ((ifp->if_flags & IFF_UP) != 0) { - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { - if (((ifp->if_flags ^ sc_if->msk_if_flags) - & (IFF_PROMISC | IFF_ALLMULTI)) != 0) - msk_rxfilter(sc_if); - } else { - if ((sc_if->msk_flags & MSK_FLAG_DETACH) == 0) - msk_init_locked(sc_if); - } - } else { - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) - msk_stop(sc_if); - } + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0 && + ((ifp->if_flags ^ sc_if->msk_if_flags) & + (IFF_PROMISC | IFF_ALLMULTI)) != 0) + msk_rxfilter(sc_if); + else if ((sc_if->msk_flags & MSK_FLAG_DETACH) == 0) + msk_init_locked(sc_if); + } else if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + msk_stop(sc_if); sc_if->msk_if_flags = ifp->if_flags; MSK_IF_UNLOCK(sc_if); break; From owner-svn-src-head@FreeBSD.ORG Mon May 25 08:11:04 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E86AA1065672; Mon, 25 May 2009 08:11:04 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 44B7F8FC24; Mon, 25 May 2009 08:11:04 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P8B4IX016067; Mon, 25 May 2009 08:11:04 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P8B41a016066; Mon, 25 May 2009 08:11:04 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250811.n4P8B41a016066@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 08:11:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192741 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 08:11:05 -0000 Author: yongari Date: Mon May 25 08:11:03 2009 New Revision: 192741 URL: http://svn.freebsd.org/changeset/base/192741 Log: msk(4) now supports Yukon FE+. Specifically 88E8040, 88E8040T, 88E8048 and 88E8070 are supported. Bump .Dd Modified: head/share/man/man4/msk.4 Modified: head/share/man/man4/msk.4 ============================================================================== --- head/share/man/man4/msk.4 Mon May 25 08:02:05 2009 (r192740) +++ head/share/man/man4/msk.4 Mon May 25 08:11:03 2009 (r192741) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 5, 2007 +.Dd May 25, 2009 .Dt MSK 4 .Os .Sh NAME @@ -184,6 +184,12 @@ Marvell Yukon 88E8038 Gigabit Ethernet .It Marvell Yukon 88E8039 Gigabit Ethernet .It +Marvell Yukon 88E8040 Fast Ethernet +.It +Marvell Yukon 88E8040T Fast Ethernet +.It +Marvell Yukon 88E8048 Fast Ethernet +.It Marvell Yukon 88E8050 Gigabit Ethernet .It Marvell Yukon 88E8052 Gigabit Ethernet @@ -196,6 +202,8 @@ Marvell Yukon 88E8056 Gigabit Ethernet .It Marvell Yukon 88E8058 Gigabit Ethernet .It +Marvell Yukon 88E8070 Fast Ethernet +.It SysKonnect SK-9Sxx Gigabit Ethernet .It SysKonnect SK-9Exx Gigabit Ethernet From owner-svn-src-head@FreeBSD.ORG Mon May 25 08:26:40 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48665106566C; Mon, 25 May 2009 08:26:40 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 373518FC16; Mon, 25 May 2009 08:26:40 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P8Qeum016447; Mon, 25 May 2009 08:26:40 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P8QenI016446; Mon, 25 May 2009 08:26:40 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250826.n4P8QenI016446@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 08:26:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192742 - head/sys/dev/msk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 08:26:40 -0000 Author: yongari Date: Mon May 25 08:26:39 2009 New Revision: 192742 URL: http://svn.freebsd.org/changeset/base/192742 Log: Correct controller description for 88E8035, 88E8036, 88E8038 and 88E8039. These are fast ethernet controllers. Modified: head/sys/dev/msk/if_msk.c Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Mon May 25 08:11:03 2009 (r192741) +++ head/sys/dev/msk/if_msk.c Mon May 25 08:26:39 2009 (r192742) @@ -190,13 +190,13 @@ static struct msk_product { { VENDORID_MARVELL, DEVICEID_MRVL_8062X, "Marvell Yukon 88E8062 SX/LX Gigabit Ethernet" }, { VENDORID_MARVELL, DEVICEID_MRVL_8035, - "Marvell Yukon 88E8035 Gigabit Ethernet" }, + "Marvell Yukon 88E8035 Fast Ethernet" }, { VENDORID_MARVELL, DEVICEID_MRVL_8036, - "Marvell Yukon 88E8036 Gigabit Ethernet" }, + "Marvell Yukon 88E8036 Fast Ethernet" }, { VENDORID_MARVELL, DEVICEID_MRVL_8038, - "Marvell Yukon 88E8038 Gigabit Ethernet" }, + "Marvell Yukon 88E8038 Fast Ethernet" }, { VENDORID_MARVELL, DEVICEID_MRVL_8039, - "Marvell Yukon 88E8039 Gigabit Ethernet" }, + "Marvell Yukon 88E8039 Fast Ethernet" }, { VENDORID_MARVELL, DEVICEID_MRVL_8040, "Marvell Yukon 88E8040 Fast Ethernet" }, { VENDORID_MARVELL, DEVICEID_MRVL_8040T, From owner-svn-src-head@FreeBSD.ORG Mon May 25 08:27:52 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5BBDD1065673; Mon, 25 May 2009 08:27:52 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4ABA08FC2A; Mon, 25 May 2009 08:27:52 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P8RqLt016513; Mon, 25 May 2009 08:27:52 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P8Rqxr016512; Mon, 25 May 2009 08:27:52 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200905250827.n4P8Rqxr016512@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 25 May 2009 08:27:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192743 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 08:27:53 -0000 Author: yongari Date: Mon May 25 08:27:52 2009 New Revision: 192743 URL: http://svn.freebsd.org/changeset/base/192743 Log: Correct controller description for 88E8035, 88E8036, 88E8038 and 88E8039. These are fast ethernet controllers. Modified: head/share/man/man4/msk.4 Modified: head/share/man/man4/msk.4 ============================================================================== --- head/share/man/man4/msk.4 Mon May 25 08:26:39 2009 (r192742) +++ head/share/man/man4/msk.4 Mon May 25 08:27:52 2009 (r192743) @@ -176,13 +176,13 @@ Marvell Yukon 88E8062CU Gigabit Ethernet .It Marvell Yukon 88E8062 SX/LX Gigabit Ethernet .It -Marvell Yukon 88E8035 Gigabit Ethernet +Marvell Yukon 88E8035 Fast Ethernet .It -Marvell Yukon 88E8036 Gigabit Ethernet +Marvell Yukon 88E8036 Fast Ethernet .It -Marvell Yukon 88E8038 Gigabit Ethernet +Marvell Yukon 88E8038 Fast Ethernet .It -Marvell Yukon 88E8039 Gigabit Ethernet +Marvell Yukon 88E8039 Fast Ethernet .It Marvell Yukon 88E8040 Fast Ethernet .It From owner-svn-src-head@FreeBSD.ORG Mon May 25 09:09:43 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDBF3106564A; Mon, 25 May 2009 09:09:43 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA5C68FC12; Mon, 25 May 2009 09:09:43 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P99heR017454; Mon, 25 May 2009 09:09:43 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P99hCo017453; Mon, 25 May 2009 09:09:43 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200905250909.n4P99hCo017453@svn.freebsd.org> From: Robert Watson Date: Mon, 25 May 2009 09:09:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192744 - head/sys/netipx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 09:09:44 -0000 Author: rwatson Date: Mon May 25 09:09:43 2009 New Revision: 192744 URL: http://svn.freebsd.org/changeset/base/192744 Log: Copy spx_usrreq.c to spx_reass.c in order to apply similar file layout changes to IPX/SPX that were applied to TCP/IP in the creation of tcp_reass.c. MFC after: 1 month Added: head/sys/netipx/spx_reass.c (props changed) - copied unchanged from r192743, head/sys/netipx/spx_usrreq.c Copied: head/sys/netipx/spx_reass.c (from r192743, head/sys/netipx/spx_usrreq.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/netipx/spx_reass.c Mon May 25 09:09:43 2009 (r192744, copy of r192743, head/sys/netipx/spx_usrreq.c) @@ -0,0 +1,2132 @@ +/*- + * Copyright (c) 1984, 1985, 1986, 1987, 1993 + * The Regents of the University of California. + * Copyright (c) 2004-2006 Robert N. M. Watson + * 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. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * 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. + * + * Copyright (c) 1995, Mike Mitchell + * 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * 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. + * + * @(#)spx_usrreq.h + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +/* + * SPX protocol implementation. + */ +static struct mtx spx_mtx; /* Protects only spx_iss. */ +static u_short spx_iss; +static u_short spx_newchecks[50]; +static int spx_hardnosed; +static int spx_use_delack = 0; +static int traceallspxs = 0; +static struct spx_istat spx_istat; +static int spxrexmtthresh = 3; + +#define SPX_LOCK_INIT() mtx_init(&spx_mtx, "spx_mtx", NULL, MTX_DEF) +#define SPX_LOCK() mtx_lock(&spx_mtx) +#define SPX_UNLOCK() mtx_unlock(&spx_mtx) + +/* Following was struct spxstat spxstat; */ +#ifndef spxstat +#define spxstat spx_istat.newstats +#endif + +static const int spx_backoff[SPX_MAXRXTSHIFT+1] = + { 1, 2, 4, 8, 16, 32, 64, 64, 64, 64, 64, 64, 64 }; + +static void spx_close(struct spxpcb *cb); +static void spx_disconnect(struct spxpcb *cb); +static void spx_drop(struct spxpcb *cb, int errno); +static int spx_output(struct spxpcb *cb, struct mbuf *m0); +static int spx_reass(struct spxpcb *cb, struct spx *si); +static void spx_setpersist(struct spxpcb *cb); +static void spx_template(struct spxpcb *cb); +static void spx_timers(struct spxpcb *cb, int timer); +static void spx_usrclosed(struct spxpcb *cb); + +static void spx_usr_abort(struct socket *so); +static int spx_accept(struct socket *so, struct sockaddr **nam); +static int spx_attach(struct socket *so, int proto, struct thread *td); +static int spx_bind(struct socket *so, struct sockaddr *nam, struct thread *td); +static void spx_usr_close(struct socket *so); +static int spx_connect(struct socket *so, struct sockaddr *nam, + struct thread *td); +static void spx_detach(struct socket *so); +static void spx_pcbdetach(struct ipxpcb *ipxp); +static int spx_usr_disconnect(struct socket *so); +static int spx_listen(struct socket *so, int backlog, struct thread *td); +static int spx_rcvd(struct socket *so, int flags); +static int spx_rcvoob(struct socket *so, struct mbuf *m, int flags); +static int spx_send(struct socket *so, int flags, struct mbuf *m, + struct sockaddr *addr, struct mbuf *control, + struct thread *td); +static int spx_shutdown(struct socket *so); +static int spx_sp_attach(struct socket *so, int proto, struct thread *td); + +struct pr_usrreqs spx_usrreqs = { + .pru_abort = spx_usr_abort, + .pru_accept = spx_accept, + .pru_attach = spx_attach, + .pru_bind = spx_bind, + .pru_connect = spx_connect, + .pru_control = ipx_control, + .pru_detach = spx_detach, + .pru_disconnect = spx_usr_disconnect, + .pru_listen = spx_listen, + .pru_peeraddr = ipx_peeraddr, + .pru_rcvd = spx_rcvd, + .pru_rcvoob = spx_rcvoob, + .pru_send = spx_send, + .pru_shutdown = spx_shutdown, + .pru_sockaddr = ipx_sockaddr, + .pru_close = spx_usr_close, +}; + +struct pr_usrreqs spx_usrreq_sps = { + .pru_abort = spx_usr_abort, + .pru_accept = spx_accept, + .pru_attach = spx_sp_attach, + .pru_bind = spx_bind, + .pru_connect = spx_connect, + .pru_control = ipx_control, + .pru_detach = spx_detach, + .pru_disconnect = spx_usr_disconnect, + .pru_listen = spx_listen, + .pru_peeraddr = ipx_peeraddr, + .pru_rcvd = spx_rcvd, + .pru_rcvoob = spx_rcvoob, + .pru_send = spx_send, + .pru_shutdown = spx_shutdown, + .pru_sockaddr = ipx_sockaddr, + .pru_close = spx_usr_close, +}; + +static __inline void +spx_insque(struct spx_q *element, struct spx_q *head) +{ + + element->si_next = head->si_next; + element->si_prev = head; + head->si_next = element; + element->si_next->si_prev = element; +} + +static __inline void +spx_remque(struct spx_q *element) +{ + + element->si_next->si_prev = element->si_prev; + element->si_prev->si_next = element->si_next; + element->si_prev = NULL; +} + +void +spx_init(void) +{ + + SPX_LOCK_INIT(); + spx_iss = 1; /* WRONG !! should fish it out of TODR */ +} + +void +spx_input(struct mbuf *m, struct ipxpcb *ipxp) +{ + struct spxpcb *cb; + struct spx *si = mtod(m, struct spx *); + struct socket *so; + struct spx spx_savesi; + int dropsocket = 0; + short ostate = 0; + + spxstat.spxs_rcvtotal++; + KASSERT(ipxp != NULL, ("spx_input: ipxpcb == NULL")); + + /* + * spx_input() assumes that the caller will hold both the pcb list + * lock and also the ipxp lock. spx_input() will release both before + * returning, and may in fact trade in the ipxp lock for another pcb + * lock following sonewconn(). + */ + IPX_LIST_LOCK_ASSERT(); + IPX_LOCK_ASSERT(ipxp); + + cb = ipxtospxpcb(ipxp); + KASSERT(cb != NULL, ("spx_input: cb == NULL")); + + if (ipxp->ipxp_flags & IPXP_DROPPED) + goto drop; + + if (m->m_len < sizeof(*si)) { + if ((m = m_pullup(m, sizeof(*si))) == NULL) { + IPX_UNLOCK(ipxp); + IPX_LIST_UNLOCK(); + spxstat.spxs_rcvshort++; + return; + } + si = mtod(m, struct spx *); + } + si->si_seq = ntohs(si->si_seq); + si->si_ack = ntohs(si->si_ack); + si->si_alo = ntohs(si->si_alo); + + so = ipxp->ipxp_socket; + KASSERT(so != NULL, ("spx_input: so == NULL")); + + if (so->so_options & SO_DEBUG || traceallspxs) { + ostate = cb->s_state; + spx_savesi = *si; + } + if (so->so_options & SO_ACCEPTCONN) { + struct spxpcb *ocb = cb; + + so = sonewconn(so, 0); + if (so == NULL) + goto drop; + + /* + * This is ugly, but .... + * + * Mark socket as temporary until we're committed to keeping + * it. The code at ``drop'' and ``dropwithreset'' check the + * flag dropsocket to see if the temporary socket created + * here should be discarded. We mark the socket as + * discardable until we're committed to it below in + * TCPS_LISTEN. + * + * XXXRW: In the new world order of real kernel parallelism, + * temporarily allocating the socket when we're "not sure" + * seems like a bad idea, as we might race to remove it if + * the listen socket is closed...? + * + * We drop the lock of the listen socket ipxp, and acquire + * the lock of the new socket ippx. + */ + dropsocket++; + IPX_UNLOCK(ipxp); + ipxp = (struct ipxpcb *)so->so_pcb; + IPX_LOCK(ipxp); + ipxp->ipxp_laddr = si->si_dna; + cb = ipxtospxpcb(ipxp); + cb->s_mtu = ocb->s_mtu; /* preserve sockopts */ + cb->s_flags = ocb->s_flags; /* preserve sockopts */ + cb->s_flags2 = ocb->s_flags2; /* preserve sockopts */ + cb->s_state = TCPS_LISTEN; + } + IPX_LOCK_ASSERT(ipxp); + + /* + * Packet received on connection. Reset idle time and keep-alive + * timer. + */ + cb->s_idle = 0; + cb->s_timer[SPXT_KEEP] = SPXTV_KEEP; + + switch (cb->s_state) { + case TCPS_LISTEN:{ + struct sockaddr_ipx *sipx, ssipx; + struct ipx_addr laddr; + + /* + * If somebody here was carying on a conversation and went + * away, and his pen pal thinks he can still talk, we get the + * misdirected packet. + */ + if (spx_hardnosed && (si->si_did != 0 || si->si_seq != 0)) { + spx_istat.gonawy++; + goto dropwithreset; + } + sipx = &ssipx; + bzero(sipx, sizeof *sipx); + sipx->sipx_len = sizeof(*sipx); + sipx->sipx_family = AF_IPX; + sipx->sipx_addr = si->si_sna; + laddr = ipxp->ipxp_laddr; + if (ipx_nullhost(laddr)) + ipxp->ipxp_laddr = si->si_dna; + if (ipx_pcbconnect(ipxp, (struct sockaddr *)sipx, &thread0)) { + ipxp->ipxp_laddr = laddr; + spx_istat.noconn++; + goto drop; + } + spx_template(cb); + dropsocket = 0; /* committed to socket */ + cb->s_did = si->si_sid; + cb->s_rack = si->si_ack; + cb->s_ralo = si->si_alo; +#define THREEWAYSHAKE +#ifdef THREEWAYSHAKE + cb->s_state = TCPS_SYN_RECEIVED; + cb->s_force = 1 + SPXT_KEEP; + spxstat.spxs_accepts++; + cb->s_timer[SPXT_KEEP] = SPXTV_KEEP; + } + break; + + case TCPS_SYN_RECEIVED: { + /* + * This state means that we have heard a response to our + * acceptance of their connection. It is probably logically + * unnecessary in this implementation. + */ + if (si->si_did != cb->s_sid) { + spx_istat.wrncon++; + goto drop; + } +#endif + ipxp->ipxp_fport = si->si_sport; + cb->s_timer[SPXT_REXMT] = 0; + cb->s_timer[SPXT_KEEP] = SPXTV_KEEP; + soisconnected(so); + cb->s_state = TCPS_ESTABLISHED; + spxstat.spxs_accepts++; + } + break; + + case TCPS_SYN_SENT: + /* + * This state means that we have gotten a response to our + * attempt to establish a connection. We fill in the data + * from the other side, telling us which port to respond to, + * instead of the well-known one we might have sent to in the + * first place. We also require that this is a response to + * our connection id. + */ + if (si->si_did != cb->s_sid) { + spx_istat.notme++; + goto drop; + } + spxstat.spxs_connects++; + cb->s_did = si->si_sid; + cb->s_rack = si->si_ack; + cb->s_ralo = si->si_alo; + cb->s_dport = ipxp->ipxp_fport = si->si_sport; + cb->s_timer[SPXT_REXMT] = 0; + cb->s_flags |= SF_ACKNOW; + soisconnected(so); + cb->s_state = TCPS_ESTABLISHED; + + /* + * Use roundtrip time of connection request for initial rtt. + */ + if (cb->s_rtt) { + cb->s_srtt = cb->s_rtt << 3; + cb->s_rttvar = cb->s_rtt << 1; + SPXT_RANGESET(cb->s_rxtcur, + ((cb->s_srtt >> 2) + cb->s_rttvar) >> 1, + SPXTV_MIN, SPXTV_REXMTMAX); + cb->s_rtt = 0; + } + } + + if (so->so_options & SO_DEBUG || traceallspxs) + spx_trace(SA_INPUT, (u_char)ostate, cb, &spx_savesi, 0); + + m->m_len -= sizeof(struct ipx); + m->m_pkthdr.len -= sizeof(struct ipx); + m->m_data += sizeof(struct ipx); + + if (spx_reass(cb, si)) + m_freem(m); + if (cb->s_force || (cb->s_flags & (SF_ACKNOW|SF_WIN|SF_RXT))) + spx_output(cb, NULL); + cb->s_flags &= ~(SF_WIN|SF_RXT); + IPX_UNLOCK(ipxp); + IPX_LIST_UNLOCK(); + return; + +dropwithreset: + IPX_LOCK_ASSERT(ipxp); + if (cb == NULL || (cb->s_ipxpcb->ipxp_socket->so_options & SO_DEBUG || + traceallspxs)) + spx_trace(SA_DROP, (u_char)ostate, cb, &spx_savesi, 0); + IPX_UNLOCK(ipxp); + if (dropsocket) { + struct socket *head; + ACCEPT_LOCK(); + KASSERT((so->so_qstate & SQ_INCOMP) != 0, + ("spx_input: nascent socket not SQ_INCOMP on soabort()")); + head = so->so_head; + TAILQ_REMOVE(&head->so_incomp, so, so_list); + head->so_incqlen--; + so->so_qstate &= ~SQ_INCOMP; + so->so_head = NULL; + ACCEPT_UNLOCK(); + soabort(so); + } + IPX_LIST_UNLOCK(); + m_freem(m); + return; + +drop: + IPX_LOCK_ASSERT(ipxp); + if (cb->s_ipxpcb->ipxp_socket->so_options & SO_DEBUG || traceallspxs) + spx_trace(SA_DROP, (u_char)ostate, cb, &spx_savesi, 0); + IPX_UNLOCK(ipxp); + IPX_LIST_UNLOCK(); + m_freem(m); +} + +/* + * This is structurally similar to the tcp reassembly routine but its + * function is somewhat different: it merely queues packets up, and + * suppresses duplicates. + */ +static int +spx_reass(struct spxpcb *cb, struct spx *si) +{ + struct spx_q *q; + struct mbuf *m; + struct socket *so = cb->s_ipxpcb->ipxp_socket; + char packetp = cb->s_flags & SF_HI; + int incr; + char wakeup = 0; + + IPX_LOCK_ASSERT(cb->s_ipxpcb); + + if (si == SI(0)) + goto present; + + /* + * Update our news from them. + */ + if (si->si_cc & SPX_SA) + cb->s_flags |= (spx_use_delack ? SF_DELACK : SF_ACKNOW); + if (SSEQ_GT(si->si_alo, cb->s_ralo)) + cb->s_flags |= SF_WIN; + if (SSEQ_LEQ(si->si_ack, cb->s_rack)) { + if ((si->si_cc & SPX_SP) && cb->s_rack != (cb->s_smax + 1)) { + spxstat.spxs_rcvdupack++; + + /* + * If this is a completely duplicate ack and other + * conditions hold, we assume a packet has been + * dropped and retransmit it exactly as in + * tcp_input(). + */ + if (si->si_ack != cb->s_rack || + si->si_alo != cb->s_ralo) + cb->s_dupacks = 0; + else if (++cb->s_dupacks == spxrexmtthresh) { + u_short onxt = cb->s_snxt; + int cwnd = cb->s_cwnd; + + cb->s_snxt = si->si_ack; + cb->s_cwnd = CUNIT; + cb->s_force = 1 + SPXT_REXMT; + spx_output(cb, NULL); + cb->s_timer[SPXT_REXMT] = cb->s_rxtcur; + cb->s_rtt = 0; + if (cwnd >= 4 * CUNIT) + cb->s_cwnd = cwnd / 2; + if (SSEQ_GT(onxt, cb->s_snxt)) + cb->s_snxt = onxt; + return (1); + } + } else + cb->s_dupacks = 0; + goto update_window; + } + cb->s_dupacks = 0; + + /* + * If our correspondent acknowledges data we haven't sent TCP would + * drop the packet after acking. We'll be a little more permissive. + */ + if (SSEQ_GT(si->si_ack, (cb->s_smax + 1))) { + spxstat.spxs_rcvacktoomuch++; + si->si_ack = cb->s_smax + 1; + } + spxstat.spxs_rcvackpack++; + + /* + * If transmit timer is running and timed sequence number was acked, + * update smoothed round trip time. See discussion of algorithm in + * tcp_input.c + */ + if (cb->s_rtt && SSEQ_GT(si->si_ack, cb->s_rtseq)) { + spxstat.spxs_rttupdated++; + if (cb->s_srtt != 0) { + short delta; + delta = cb->s_rtt - (cb->s_srtt >> 3); + if ((cb->s_srtt += delta) <= 0) + cb->s_srtt = 1; + if (delta < 0) + delta = -delta; + delta -= (cb->s_rttvar >> 2); + if ((cb->s_rttvar += delta) <= 0) + cb->s_rttvar = 1; + } else { + /* + * No rtt measurement yet. + */ + cb->s_srtt = cb->s_rtt << 3; + cb->s_rttvar = cb->s_rtt << 1; + } + cb->s_rtt = 0; + cb->s_rxtshift = 0; + SPXT_RANGESET(cb->s_rxtcur, + ((cb->s_srtt >> 2) + cb->s_rttvar) >> 1, + SPXTV_MIN, SPXTV_REXMTMAX); + } + + /* + * If all outstanding data is acked, stop retransmit timer and + * remember to restart (more output or persist). If there is more + * data to be acked, restart retransmit timer, using current + * (possibly backed-off) value; + */ + if (si->si_ack == cb->s_smax + 1) { + cb->s_timer[SPXT_REXMT] = 0; + cb->s_flags |= SF_RXT; + } else if (cb->s_timer[SPXT_PERSIST] == 0) + cb->s_timer[SPXT_REXMT] = cb->s_rxtcur; + + /* + * When new data is acked, open the congestion window. If the window + * gives us less than ssthresh packets in flight, open exponentially + * (maxseg at a time). Otherwise open linearly (maxseg^2 / cwnd at a + * time). + */ + incr = CUNIT; + if (cb->s_cwnd > cb->s_ssthresh) + incr = max(incr * incr / cb->s_cwnd, 1); + cb->s_cwnd = min(cb->s_cwnd + incr, cb->s_cwmx); + + /* + * Trim Acked data from output queue. + */ + SOCKBUF_LOCK(&so->so_snd); + while ((m = so->so_snd.sb_mb) != NULL) { + if (SSEQ_LT((mtod(m, struct spx *))->si_seq, si->si_ack)) + sbdroprecord_locked(&so->so_snd); + else + break; + } + sowwakeup_locked(so); + cb->s_rack = si->si_ack; +update_window: + if (SSEQ_LT(cb->s_snxt, cb->s_rack)) + cb->s_snxt = cb->s_rack; + if (SSEQ_LT(cb->s_swl1, si->si_seq) || ((cb->s_swl1 == si->si_seq && + (SSEQ_LT(cb->s_swl2, si->si_ack))) || + (cb->s_swl2 == si->si_ack && SSEQ_LT(cb->s_ralo, si->si_alo)))) { + /* keep track of pure window updates */ + if ((si->si_cc & SPX_SP) && cb->s_swl2 == si->si_ack + && SSEQ_LT(cb->s_ralo, si->si_alo)) { + spxstat.spxs_rcvwinupd++; + spxstat.spxs_rcvdupack--; + } + cb->s_ralo = si->si_alo; + cb->s_swl1 = si->si_seq; + cb->s_swl2 = si->si_ack; + cb->s_swnd = (1 + si->si_alo - si->si_ack); + if (cb->s_swnd > cb->s_smxw) + cb->s_smxw = cb->s_swnd; + cb->s_flags |= SF_WIN; + } + + /* + * If this packet number is higher than that which we have allocated + * refuse it, unless urgent. + */ + if (SSEQ_GT(si->si_seq, cb->s_alo)) { + if (si->si_cc & SPX_SP) { + spxstat.spxs_rcvwinprobe++; + return (1); + } else + spxstat.spxs_rcvpackafterwin++; + if (si->si_cc & SPX_OB) { + if (SSEQ_GT(si->si_seq, cb->s_alo + 60)) + return (1); /* else queue this packet; */ + } else { +#ifdef BROKEN + /* + * XXXRW: This is broken on at least one count: + * spx_close() will free the ipxp and related parts, + * which are then touched by spx_input() after the + * return from spx_reass(). + */ + /*struct socket *so = cb->s_ipxpcb->ipxp_socket; + if (so->so_state && SS_NOFDREF) { + spx_close(cb); + } else + would crash system*/ +#endif + spx_istat.notyet++; + return (1); + } + } + + /* + * If this is a system packet, we don't need to queue it up, and + * won't update acknowledge #. + */ + if (si->si_cc & SPX_SP) + return (1); + + /* + * We have already seen this packet, so drop. + */ + if (SSEQ_LT(si->si_seq, cb->s_ack)) { + spx_istat.bdreas++; + spxstat.spxs_rcvduppack++; + if (si->si_seq == cb->s_ack - 1) + spx_istat.lstdup++; + return (1); + } + + /* + * Loop through all packets queued up to insert in appropriate + * sequence. + */ + for (q = cb->s_q.si_next; q != &cb->s_q; q = q->si_next) { + if (si->si_seq == SI(q)->si_seq) { + spxstat.spxs_rcvduppack++; + return (1); + } + if (SSEQ_LT(si->si_seq, SI(q)->si_seq)) { + spxstat.spxs_rcvoopack++; + break; + } + } + spx_insque((struct spx_q *)si, q->si_prev); + + /* + * If this packet is urgent, inform process + */ + if (si->si_cc & SPX_OB) { + cb->s_iobc = ((char *)si)[1 + sizeof(*si)]; + sohasoutofband(so); + cb->s_oobflags |= SF_IOOB; + } +present: +#define SPINC sizeof(struct spxhdr) + SOCKBUF_LOCK(&so->so_rcv); + + /* + * Loop through all packets queued up to update acknowledge number, + * and present all acknowledged data to user; if in packet interface + * mode, show packet headers. + */ + for (q = cb->s_q.si_next; q != &cb->s_q; q = q->si_next) { + if (SI(q)->si_seq == cb->s_ack) { + cb->s_ack++; + m = dtom(q); + if (SI(q)->si_cc & SPX_OB) { + cb->s_oobflags &= ~SF_IOOB; + if (so->so_rcv.sb_cc) + so->so_oobmark = so->so_rcv.sb_cc; + else + so->so_rcv.sb_state |= SBS_RCVATMARK; + } + q = q->si_prev; + spx_remque(q->si_next); + wakeup = 1; + spxstat.spxs_rcvpack++; +#ifdef SF_NEWCALL + if (cb->s_flags2 & SF_NEWCALL) { + struct spxhdr *sp = mtod(m, struct spxhdr *); + u_char dt = sp->spx_dt; + spx_newchecks[4]++; + if (dt != cb->s_rhdr.spx_dt) { + struct mbuf *mm = + m_getclr(M_DONTWAIT, MT_CONTROL); + spx_newchecks[0]++; + if (mm != NULL) { + u_short *s = + mtod(mm, u_short *); + cb->s_rhdr.spx_dt = dt; + mm->m_len = 5; /*XXX*/ + s[0] = 5; + s[1] = 1; + *(u_char *)(&s[2]) = dt; + sbappend_locked(&so->so_rcv, mm); + } + } + if (sp->spx_cc & SPX_OB) { + MCHTYPE(m, MT_OOBDATA); + spx_newchecks[1]++; + so->so_oobmark = 0; + so->so_rcv.sb_state &= ~SBS_RCVATMARK; + } + if (packetp == 0) { + m->m_data += SPINC; + m->m_len -= SPINC; + m->m_pkthdr.len -= SPINC; + } + if ((sp->spx_cc & SPX_EM) || packetp) { + sbappendrecord_locked(&so->so_rcv, m); + spx_newchecks[9]++; + } else + sbappend_locked(&so->so_rcv, m); + } else +#endif + if (packetp) + sbappendrecord_locked(&so->so_rcv, m); + else { + cb->s_rhdr = *mtod(m, struct spxhdr *); + m->m_data += SPINC; + m->m_len -= SPINC; + m->m_pkthdr.len -= SPINC; + sbappend_locked(&so->so_rcv, m); + } + } else + break; + } + if (wakeup) + sorwakeup_locked(so); + else + SOCKBUF_UNLOCK(&so->so_rcv); + return (0); +} + +void +spx_ctlinput(int cmd, struct sockaddr *arg_as_sa, void *dummy) +{ + + /* Currently, nothing. */ +} + +static int +spx_output(struct spxpcb *cb, struct mbuf *m0) +{ + struct socket *so = cb->s_ipxpcb->ipxp_socket; + struct mbuf *m; + struct spx *si = NULL; + struct sockbuf *sb = &so->so_snd; + int len = 0, win, rcv_win; + short span, off, recordp = 0; + u_short alo; + int error = 0, sendalot; +#ifdef notdef + int idle; +#endif + struct mbuf *mprev; + + IPX_LOCK_ASSERT(cb->s_ipxpcb); + + if (m0 != NULL) { + int mtu = cb->s_mtu; + int datalen; + + /* + * Make sure that packet isn't too big. + */ + for (m = m0; m != NULL; m = m->m_next) { + mprev = m; + len += m->m_len; + if (m->m_flags & M_EOR) + recordp = 1; + } + datalen = (cb->s_flags & SF_HO) ? + len - sizeof(struct spxhdr) : len; + if (datalen > mtu) { + if (cb->s_flags & SF_PI) { + m_freem(m0); + return (EMSGSIZE); + } else { + int oldEM = cb->s_cc & SPX_EM; + + cb->s_cc &= ~SPX_EM; + while (len > mtu) { + m = m_copym(m0, 0, mtu, M_DONTWAIT); + if (m == NULL) { + cb->s_cc |= oldEM; + m_freem(m0); + return (ENOBUFS); + } + if (cb->s_flags & SF_NEWCALL) { + struct mbuf *mm = m; + spx_newchecks[7]++; + while (mm != NULL) { + mm->m_flags &= ~M_EOR; + mm = mm->m_next; + } + } + error = spx_output(cb, m); + if (error) { + cb->s_cc |= oldEM; + m_freem(m0); + return (error); + } + m_adj(m0, mtu); + len -= mtu; + } + cb->s_cc |= oldEM; + } + } + + /* + * Force length even, by adding a "garbage byte" if + * necessary. + */ + if (len & 1) { + m = mprev; + if (M_TRAILINGSPACE(m) >= 1) + m->m_len++; + else { + struct mbuf *m1 = m_get(M_DONTWAIT, MT_DATA); + + if (m1 == NULL) { + m_freem(m0); + return (ENOBUFS); + } + m1->m_len = 1; + *(mtod(m1, u_char *)) = 0; + m->m_next = m1; + } + } + m = m_gethdr(M_DONTWAIT, MT_DATA); + if (m == NULL) { + m_freem(m0); + return (ENOBUFS); + } + + /* + * Fill in mbuf with extended SP header and addresses and + * length put into network format. + */ + MH_ALIGN(m, sizeof(struct spx)); + m->m_len = sizeof(struct spx); + m->m_next = m0; + si = mtod(m, struct spx *); + si->si_i = *cb->s_ipx; + si->si_s = cb->s_shdr; + if ((cb->s_flags & SF_PI) && (cb->s_flags & SF_HO)) { + struct spxhdr *sh; + if (m0->m_len < sizeof(*sh)) { + if((m0 = m_pullup(m0, sizeof(*sh))) == NULL) { + m_free(m); + m_freem(m0); + return (EINVAL); + } + m->m_next = m0; + } + sh = mtod(m0, struct spxhdr *); + si->si_dt = sh->spx_dt; + si->si_cc |= sh->spx_cc & SPX_EM; + m0->m_len -= sizeof(*sh); + m0->m_data += sizeof(*sh); + len -= sizeof(*sh); + } + len += sizeof(*si); + if ((cb->s_flags2 & SF_NEWCALL) && recordp) { + si->si_cc |= SPX_EM; + spx_newchecks[8]++; + } + if (cb->s_oobflags & SF_SOOB) { + /* + * Per jqj@cornell: Make sure OB packets convey + * exactly 1 byte. If the packet is 1 byte or + * larger, we have already guaranted there to be at + * least one garbage byte for the checksum, and extra + * bytes shouldn't hurt! + */ + if (len > sizeof(*si)) { + si->si_cc |= SPX_OB; + len = (1 + sizeof(*si)); + } + } + si->si_len = htons((u_short)len); + m->m_pkthdr.len = ((len - 1) | 1) + 1; + + /* + * Queue stuff up for output. + */ + sbappendrecord(sb, m); + cb->s_seq++; + } +#ifdef notdef + idle = (cb->s_smax == (cb->s_rack - 1)); +#endif +again: + sendalot = 0; + off = cb->s_snxt - cb->s_rack; + win = min(cb->s_swnd, (cb->s_cwnd / CUNIT)); + + /* + * If in persist timeout with window of 0, send a probe. Otherwise, + * if window is small but non-zero and timer expired, send what we + * can and go into transmit state. + */ + if (cb->s_force == 1 + SPXT_PERSIST) { + if (win != 0) { + cb->s_timer[SPXT_PERSIST] = 0; + cb->s_rxtshift = 0; + } + } + span = cb->s_seq - cb->s_rack; + len = min(span, win) - off; + + if (len < 0) { + /* + * Window shrank after we went into it. If window shrank to + * 0, cancel pending restransmission and pull s_snxt back to + * (closed) window. We will enter persist state below. If + * the widndow didn't close completely, just wait for an ACK. + */ + len = 0; + if (win == 0) { + cb->s_timer[SPXT_REXMT] = 0; + cb->s_snxt = cb->s_rack; + } + } + if (len > 1) + sendalot = 1; + rcv_win = sbspace(&so->so_rcv); + + /* + * Send if we owe peer an ACK. + */ + if (cb->s_oobflags & SF_SOOB) { + /* + * Must transmit this out of band packet. + */ + cb->s_oobflags &= ~ SF_SOOB; + sendalot = 1; + spxstat.spxs_sndurg++; + goto found; + } + if (cb->s_flags & SF_ACKNOW) + goto send; + if (cb->s_state < TCPS_ESTABLISHED) + goto send; + + /* + * Silly window can't happen in spx. Code from TCP deleted. + */ + if (len) + goto send; + + /* + * Compare available window to amount of window known to peer (as + * advertised window less next expected input.) If the difference is + * at least two packets or at least 35% of the mximum possible + * window, then want to send a window update to peer. + */ + if (rcv_win > 0) { + u_short delta = 1 + cb->s_alo - cb->s_ack; + int adv = rcv_win - (delta * cb->s_mtu); + + if ((so->so_rcv.sb_cc == 0 && adv >= (2 * cb->s_mtu)) || + (100 * adv / so->so_rcv.sb_hiwat >= 35)) { + spxstat.spxs_sndwinup++; + cb->s_flags |= SF_ACKNOW; + goto send; + } + + } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon May 25 09:23:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7D48106564A; Mon, 25 May 2009 09:23:26 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB7828FC1D; Mon, 25 May 2009 09:23:26 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P9NQjY017782; Mon, 25 May 2009 09:23:26 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P9NQMh017780; Mon, 25 May 2009 09:23:26 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <200905250923.n4P9NQMh017780@svn.freebsd.org> From: Brian Somers Date: Mon, 25 May 2009 09:23:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192745 - head/sbin/fdisk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 09:23:27 -0000 Author: brian Date: Mon May 25 09:23:26 2009 New Revision: 192745 URL: http://svn.freebsd.org/changeset/base/192745 Log: Enhance the 'p' command so that it understands size qualifiers (K/M/G) and so that it understands '*' as 'DTRT'. PR: 68312 Submitted by: Rene de Vries - rene at tunix dot nl (mostly) MFC after: 3 weeks Modified: head/sbin/fdisk/fdisk.8 head/sbin/fdisk/fdisk.c Modified: head/sbin/fdisk/fdisk.8 ============================================================================== --- head/sbin/fdisk/fdisk.8 Mon May 25 09:09:43 2009 (r192744) +++ head/sbin/fdisk/fdisk.8 Mon May 25 09:23:26 2009 (r192745) @@ -372,6 +372,31 @@ starting at sector for .Ar length sectors. +If the +.Ar start +or +.Ar length +is suffixed with a +.Em K , +.Em M +or +.Em G , +it is taken as a +.Em Kilobyte , +.Em Megabyte +or +.Em Gigabyte +measurement respectively. +If the +.Ar start +is given as +.Qq * +it is set to the value of the previous partition end. +If the +.Ar length +is given as +.Qq * +the partition end is set to the end of the disk. .Pp Only those slices explicitly mentioned by these lines are modified; any slice not referenced by a @@ -421,6 +446,17 @@ for 2503871 sectors (note: these numbers downwards to correspond to head and cylinder boundaries): .Pp .Dl "p 1 165 1 2503871" +.Pp +Example: to set slices 1, 2 and 4 to +.Fx +slices, the first being 2 Gigabytes, the second being 10 Gigabytes and the +forth being the remainder of the disk (again, numbers will be rounded +appropriately): +.Pp +.Dl "p 1 165 63 2G" +.Dl "p 2 165 * 10G" +.Dl "p 3 0 0 0" +.Dl "p 4 165 * *" .It Ic a Ar slice Make .Ar slice Modified: head/sbin/fdisk/fdisk.c ============================================================================== --- head/sbin/fdisk/fdisk.c Mon May 25 09:09:43 2009 (r192744) +++ head/sbin/fdisk/fdisk.c Mon May 25 09:23:26 2009 (r192745) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); int iotest; +#define NOSECTORS ((u_int32_t)-1) #define LBUF 100 static char lbuf[LBUF]; @@ -106,6 +107,7 @@ typedef struct cmd { struct arg { char argtype; int arg_val; + char *arg_str; } args[MAX_ARGS]; } CMD; @@ -970,16 +972,23 @@ parse_config_line(char *line, CMD *comma */ while (1) { while (isspace(*cp)) ++cp; + if (*cp == '\0') + break; /* eol */ if (*cp == '#') break; /* found comment */ if (isalpha(*cp)) command->args[command->n_args].argtype = *cp++; - if (!isdigit(*cp)) - break; /* assume end of line */ end = NULL; command->args[command->n_args].arg_val = strtol(cp, &end, 0); - if (cp == end) - break; /* couldn't parse number */ + if (cp == end || (!isspace(*end) && *end != '\0')) { + char ch; + end = cp; + while (!isspace(*end) && *end != '\0') ++end; + ch = *end; *end = '\0'; + command->args[command->n_args].arg_str = strdup(cp); + *end = ch; + } else + command->args[command->n_args].arg_str = NULL; cp = end; command->n_args++; } @@ -1078,6 +1087,33 @@ process_geometry(CMD *command) return (status); } +static u_int32_t +str2sectors(const char *str) +{ + char *end; + unsigned long val; + + val = strtoul(str, &end, 0); + if (str == end || *end == '\0') { + warnx("ERROR line %d: unexpected size: \'%s\'", + current_line_number, str); + return NOSECTORS; + } + + if (*end == 'K') + val *= 1024UL / secsize; + else if (*end == 'M') + val *= 1024UL * 1024UL / secsize; + else if (*end == 'G') + val *= 1024UL * 1024UL * 1024UL / secsize; + else { + warnx("ERROR line %d: unexpected modifier: %c " + "(not K/M/G)", current_line_number, *end); + return NOSECTORS; + } + + return val; +} static int process_partition(CMD *command) @@ -1103,8 +1139,48 @@ process_partition(CMD *command) partp = &mboot.parts[partition - 1]; bzero(partp, sizeof (*partp)); partp->dp_typ = command->args[1].arg_val; - partp->dp_start = command->args[2].arg_val; - partp->dp_size = command->args[3].arg_val; + if (command->args[2].arg_str != NULL) { + if (strcmp(command->args[2].arg_str, "*") == 0) { + int i; + partp->dp_start = dos_sectors; + for (i = 1; i < partition; i++) { + struct dos_partition *prev_partp; + prev_partp = ((struct dos_partition *) + &mboot.parts) + i - 1; + if (prev_partp->dp_typ != 0) + partp->dp_start = prev_partp->dp_start + + prev_partp->dp_size; + } + if (partp->dp_start % dos_sectors != 0) { + prev_head_boundary = partp->dp_start / + dos_sectors * dos_sectors; + partp->dp_start = prev_head_boundary + + dos_sectors; + } + } else { + partp->dp_start = str2sectors(command->args[2].arg_str); + if (partp->dp_start == NOSECTORS) + break; + } + } else + partp->dp_start = command->args[2].arg_val; + + if (command->args[3].arg_str != NULL) { + if (strcmp(command->args[3].arg_str, "*") == 0) + partp->dp_size = ((disksecs / dos_cylsecs) * + dos_cylsecs) - partp->dp_start; + else { + partp->dp_size = str2sectors(command->args[3].arg_str); + if (partp->dp_size == NOSECTORS) + break; + } + prev_cyl_boundary = ((partp->dp_start + partp->dp_size) / + dos_cylsecs) * dos_cylsecs; + if (prev_cyl_boundary > partp->dp_start) + partp->dp_size = prev_cyl_boundary - partp->dp_start; + } else + partp->dp_size = command->args[3].arg_val; + max_end = partp->dp_start + partp->dp_size; if (partp->dp_typ == 0) { From owner-svn-src-head@FreeBSD.ORG Mon May 25 09:28:55 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4EA39106564A; Mon, 25 May 2009 09:28:55 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B9A68FC12; Mon, 25 May 2009 09:28:55 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P9StGD017936; Mon, 25 May 2009 09:28:55 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P9StAR017933; Mon, 25 May 2009 09:28:55 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200905250928.n4P9StAR017933@svn.freebsd.org> From: Robert Watson Date: Mon, 25 May 2009 09:28:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192746 - in head/sys: conf netipx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 09:28:55 -0000 Author: rwatson Date: Mon May 25 09:28:54 2009 New Revision: 192746 URL: http://svn.freebsd.org/changeset/base/192746 Log: Complete move of SPX reassembly from spx_usrreq.c to spx_reass.c. MFC after: 1 month Modified: head/sys/conf/files head/sys/netipx/spx_reass.c head/sys/netipx/spx_usrreq.c head/sys/netipx/spx_var.h Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon May 25 09:23:26 2009 (r192745) +++ head/sys/conf/files Mon May 25 09:28:54 2009 (r192746) @@ -2427,6 +2427,7 @@ netipx/ipx_pcb.c optional ipx netipx/ipx_proto.c optional ipx netipx/ipx_usrreq.c optional ipx netipx/spx_debug.c optional ipx +netipx/spx_reass.c optional ipx netipx/spx_usrreq.c optional ipx netnatm/natm.c optional natm netnatm/natm_pcb.c optional natm Modified: head/sys/netipx/spx_reass.c ============================================================================== --- head/sys/netipx/spx_reass.c Mon May 25 09:23:26 2009 (r192745) +++ head/sys/netipx/spx_reass.c Mon May 25 09:28:54 2009 (r192746) @@ -89,97 +89,9 @@ __FBSDID("$FreeBSD$"); #include #include -/* - * SPX protocol implementation. - */ -static struct mtx spx_mtx; /* Protects only spx_iss. */ -static u_short spx_iss; -static u_short spx_newchecks[50]; -static int spx_hardnosed; static int spx_use_delack = 0; -static int traceallspxs = 0; -static struct spx_istat spx_istat; static int spxrexmtthresh = 3; -#define SPX_LOCK_INIT() mtx_init(&spx_mtx, "spx_mtx", NULL, MTX_DEF) -#define SPX_LOCK() mtx_lock(&spx_mtx) -#define SPX_UNLOCK() mtx_unlock(&spx_mtx) - -/* Following was struct spxstat spxstat; */ -#ifndef spxstat -#define spxstat spx_istat.newstats -#endif - -static const int spx_backoff[SPX_MAXRXTSHIFT+1] = - { 1, 2, 4, 8, 16, 32, 64, 64, 64, 64, 64, 64, 64 }; - -static void spx_close(struct spxpcb *cb); -static void spx_disconnect(struct spxpcb *cb); -static void spx_drop(struct spxpcb *cb, int errno); -static int spx_output(struct spxpcb *cb, struct mbuf *m0); -static int spx_reass(struct spxpcb *cb, struct spx *si); -static void spx_setpersist(struct spxpcb *cb); -static void spx_template(struct spxpcb *cb); -static void spx_timers(struct spxpcb *cb, int timer); -static void spx_usrclosed(struct spxpcb *cb); - -static void spx_usr_abort(struct socket *so); -static int spx_accept(struct socket *so, struct sockaddr **nam); -static int spx_attach(struct socket *so, int proto, struct thread *td); -static int spx_bind(struct socket *so, struct sockaddr *nam, struct thread *td); -static void spx_usr_close(struct socket *so); -static int spx_connect(struct socket *so, struct sockaddr *nam, - struct thread *td); -static void spx_detach(struct socket *so); -static void spx_pcbdetach(struct ipxpcb *ipxp); -static int spx_usr_disconnect(struct socket *so); -static int spx_listen(struct socket *so, int backlog, struct thread *td); -static int spx_rcvd(struct socket *so, int flags); -static int spx_rcvoob(struct socket *so, struct mbuf *m, int flags); -static int spx_send(struct socket *so, int flags, struct mbuf *m, - struct sockaddr *addr, struct mbuf *control, - struct thread *td); -static int spx_shutdown(struct socket *so); -static int spx_sp_attach(struct socket *so, int proto, struct thread *td); - -struct pr_usrreqs spx_usrreqs = { - .pru_abort = spx_usr_abort, - .pru_accept = spx_accept, - .pru_attach = spx_attach, - .pru_bind = spx_bind, - .pru_connect = spx_connect, - .pru_control = ipx_control, - .pru_detach = spx_detach, - .pru_disconnect = spx_usr_disconnect, - .pru_listen = spx_listen, - .pru_peeraddr = ipx_peeraddr, - .pru_rcvd = spx_rcvd, - .pru_rcvoob = spx_rcvoob, - .pru_send = spx_send, - .pru_shutdown = spx_shutdown, - .pru_sockaddr = ipx_sockaddr, - .pru_close = spx_usr_close, -}; - -struct pr_usrreqs spx_usrreq_sps = { - .pru_abort = spx_usr_abort, - .pru_accept = spx_accept, - .pru_attach = spx_sp_attach, - .pru_bind = spx_bind, - .pru_connect = spx_connect, - .pru_control = ipx_control, - .pru_detach = spx_detach, - .pru_disconnect = spx_usr_disconnect, - .pru_listen = spx_listen, - .pru_peeraddr = ipx_peeraddr, - .pru_rcvd = spx_rcvd, - .pru_rcvoob = spx_rcvoob, - .pru_send = spx_send, - .pru_shutdown = spx_shutdown, - .pru_sockaddr = ipx_sockaddr, - .pru_close = spx_usr_close, -}; - static __inline void spx_insque(struct spx_q *element, struct spx_q *head) { @@ -189,8 +101,8 @@ spx_insque(struct spx_q *element, struct head->si_next = element; element->si_next->si_prev = element; } - -static __inline void + +void spx_remque(struct spx_q *element) { @@ -199,258 +111,12 @@ spx_remque(struct spx_q *element) element->si_prev = NULL; } -void -spx_init(void) -{ - - SPX_LOCK_INIT(); - spx_iss = 1; /* WRONG !! should fish it out of TODR */ -} - -void -spx_input(struct mbuf *m, struct ipxpcb *ipxp) -{ - struct spxpcb *cb; - struct spx *si = mtod(m, struct spx *); - struct socket *so; - struct spx spx_savesi; - int dropsocket = 0; - short ostate = 0; - - spxstat.spxs_rcvtotal++; - KASSERT(ipxp != NULL, ("spx_input: ipxpcb == NULL")); - - /* - * spx_input() assumes that the caller will hold both the pcb list - * lock and also the ipxp lock. spx_input() will release both before - * returning, and may in fact trade in the ipxp lock for another pcb - * lock following sonewconn(). - */ - IPX_LIST_LOCK_ASSERT(); - IPX_LOCK_ASSERT(ipxp); - - cb = ipxtospxpcb(ipxp); - KASSERT(cb != NULL, ("spx_input: cb == NULL")); - - if (ipxp->ipxp_flags & IPXP_DROPPED) - goto drop; - - if (m->m_len < sizeof(*si)) { - if ((m = m_pullup(m, sizeof(*si))) == NULL) { - IPX_UNLOCK(ipxp); - IPX_LIST_UNLOCK(); - spxstat.spxs_rcvshort++; - return; - } - si = mtod(m, struct spx *); - } - si->si_seq = ntohs(si->si_seq); - si->si_ack = ntohs(si->si_ack); - si->si_alo = ntohs(si->si_alo); - - so = ipxp->ipxp_socket; - KASSERT(so != NULL, ("spx_input: so == NULL")); - - if (so->so_options & SO_DEBUG || traceallspxs) { - ostate = cb->s_state; - spx_savesi = *si; - } - if (so->so_options & SO_ACCEPTCONN) { - struct spxpcb *ocb = cb; - - so = sonewconn(so, 0); - if (so == NULL) - goto drop; - - /* - * This is ugly, but .... - * - * Mark socket as temporary until we're committed to keeping - * it. The code at ``drop'' and ``dropwithreset'' check the - * flag dropsocket to see if the temporary socket created - * here should be discarded. We mark the socket as - * discardable until we're committed to it below in - * TCPS_LISTEN. - * - * XXXRW: In the new world order of real kernel parallelism, - * temporarily allocating the socket when we're "not sure" - * seems like a bad idea, as we might race to remove it if - * the listen socket is closed...? - * - * We drop the lock of the listen socket ipxp, and acquire - * the lock of the new socket ippx. - */ - dropsocket++; - IPX_UNLOCK(ipxp); - ipxp = (struct ipxpcb *)so->so_pcb; - IPX_LOCK(ipxp); - ipxp->ipxp_laddr = si->si_dna; - cb = ipxtospxpcb(ipxp); - cb->s_mtu = ocb->s_mtu; /* preserve sockopts */ - cb->s_flags = ocb->s_flags; /* preserve sockopts */ - cb->s_flags2 = ocb->s_flags2; /* preserve sockopts */ - cb->s_state = TCPS_LISTEN; - } - IPX_LOCK_ASSERT(ipxp); - - /* - * Packet received on connection. Reset idle time and keep-alive - * timer. - */ - cb->s_idle = 0; - cb->s_timer[SPXT_KEEP] = SPXTV_KEEP; - - switch (cb->s_state) { - case TCPS_LISTEN:{ - struct sockaddr_ipx *sipx, ssipx; - struct ipx_addr laddr; - - /* - * If somebody here was carying on a conversation and went - * away, and his pen pal thinks he can still talk, we get the - * misdirected packet. - */ - if (spx_hardnosed && (si->si_did != 0 || si->si_seq != 0)) { - spx_istat.gonawy++; - goto dropwithreset; - } - sipx = &ssipx; - bzero(sipx, sizeof *sipx); - sipx->sipx_len = sizeof(*sipx); - sipx->sipx_family = AF_IPX; - sipx->sipx_addr = si->si_sna; - laddr = ipxp->ipxp_laddr; - if (ipx_nullhost(laddr)) - ipxp->ipxp_laddr = si->si_dna; - if (ipx_pcbconnect(ipxp, (struct sockaddr *)sipx, &thread0)) { - ipxp->ipxp_laddr = laddr; - spx_istat.noconn++; - goto drop; - } - spx_template(cb); - dropsocket = 0; /* committed to socket */ - cb->s_did = si->si_sid; - cb->s_rack = si->si_ack; - cb->s_ralo = si->si_alo; -#define THREEWAYSHAKE -#ifdef THREEWAYSHAKE - cb->s_state = TCPS_SYN_RECEIVED; - cb->s_force = 1 + SPXT_KEEP; - spxstat.spxs_accepts++; - cb->s_timer[SPXT_KEEP] = SPXTV_KEEP; - } - break; - - case TCPS_SYN_RECEIVED: { - /* - * This state means that we have heard a response to our - * acceptance of their connection. It is probably logically - * unnecessary in this implementation. - */ - if (si->si_did != cb->s_sid) { - spx_istat.wrncon++; - goto drop; - } -#endif - ipxp->ipxp_fport = si->si_sport; - cb->s_timer[SPXT_REXMT] = 0; - cb->s_timer[SPXT_KEEP] = SPXTV_KEEP; - soisconnected(so); - cb->s_state = TCPS_ESTABLISHED; - spxstat.spxs_accepts++; - } - break; - - case TCPS_SYN_SENT: - /* - * This state means that we have gotten a response to our - * attempt to establish a connection. We fill in the data - * from the other side, telling us which port to respond to, - * instead of the well-known one we might have sent to in the - * first place. We also require that this is a response to - * our connection id. - */ - if (si->si_did != cb->s_sid) { - spx_istat.notme++; - goto drop; - } - spxstat.spxs_connects++; - cb->s_did = si->si_sid; - cb->s_rack = si->si_ack; - cb->s_ralo = si->si_alo; - cb->s_dport = ipxp->ipxp_fport = si->si_sport; - cb->s_timer[SPXT_REXMT] = 0; - cb->s_flags |= SF_ACKNOW; - soisconnected(so); - cb->s_state = TCPS_ESTABLISHED; - - /* - * Use roundtrip time of connection request for initial rtt. - */ - if (cb->s_rtt) { - cb->s_srtt = cb->s_rtt << 3; - cb->s_rttvar = cb->s_rtt << 1; - SPXT_RANGESET(cb->s_rxtcur, - ((cb->s_srtt >> 2) + cb->s_rttvar) >> 1, - SPXTV_MIN, SPXTV_REXMTMAX); - cb->s_rtt = 0; - } - } - - if (so->so_options & SO_DEBUG || traceallspxs) - spx_trace(SA_INPUT, (u_char)ostate, cb, &spx_savesi, 0); - - m->m_len -= sizeof(struct ipx); - m->m_pkthdr.len -= sizeof(struct ipx); - m->m_data += sizeof(struct ipx); - - if (spx_reass(cb, si)) - m_freem(m); - if (cb->s_force || (cb->s_flags & (SF_ACKNOW|SF_WIN|SF_RXT))) - spx_output(cb, NULL); - cb->s_flags &= ~(SF_WIN|SF_RXT); - IPX_UNLOCK(ipxp); - IPX_LIST_UNLOCK(); - return; - -dropwithreset: - IPX_LOCK_ASSERT(ipxp); - if (cb == NULL || (cb->s_ipxpcb->ipxp_socket->so_options & SO_DEBUG || - traceallspxs)) - spx_trace(SA_DROP, (u_char)ostate, cb, &spx_savesi, 0); - IPX_UNLOCK(ipxp); - if (dropsocket) { - struct socket *head; - ACCEPT_LOCK(); - KASSERT((so->so_qstate & SQ_INCOMP) != 0, - ("spx_input: nascent socket not SQ_INCOMP on soabort()")); - head = so->so_head; - TAILQ_REMOVE(&head->so_incomp, so, so_list); - head->so_incqlen--; - so->so_qstate &= ~SQ_INCOMP; - so->so_head = NULL; - ACCEPT_UNLOCK(); - soabort(so); - } - IPX_LIST_UNLOCK(); - m_freem(m); - return; - -drop: - IPX_LOCK_ASSERT(ipxp); - if (cb->s_ipxpcb->ipxp_socket->so_options & SO_DEBUG || traceallspxs) - spx_trace(SA_DROP, (u_char)ostate, cb, &spx_savesi, 0); - IPX_UNLOCK(ipxp); - IPX_LIST_UNLOCK(); - m_freem(m); -} - /* * This is structurally similar to the tcp reassembly routine but its * function is somewhat different: it merely queues packets up, and * suppresses duplicates. */ -static int +int spx_reass(struct spxpcb *cb, struct spx *si) { struct spx_q *q; @@ -758,1375 +424,3 @@ present: SOCKBUF_UNLOCK(&so->so_rcv); return (0); } - -void -spx_ctlinput(int cmd, struct sockaddr *arg_as_sa, void *dummy) -{ - - /* Currently, nothing. */ -} - -static int -spx_output(struct spxpcb *cb, struct mbuf *m0) -{ - struct socket *so = cb->s_ipxpcb->ipxp_socket; - struct mbuf *m; - struct spx *si = NULL; - struct sockbuf *sb = &so->so_snd; - int len = 0, win, rcv_win; - short span, off, recordp = 0; - u_short alo; - int error = 0, sendalot; -#ifdef notdef - int idle; -#endif - struct mbuf *mprev; - - IPX_LOCK_ASSERT(cb->s_ipxpcb); - - if (m0 != NULL) { - int mtu = cb->s_mtu; - int datalen; - - /* - * Make sure that packet isn't too big. - */ - for (m = m0; m != NULL; m = m->m_next) { - mprev = m; - len += m->m_len; - if (m->m_flags & M_EOR) - recordp = 1; - } - datalen = (cb->s_flags & SF_HO) ? - len - sizeof(struct spxhdr) : len; - if (datalen > mtu) { - if (cb->s_flags & SF_PI) { - m_freem(m0); - return (EMSGSIZE); - } else { - int oldEM = cb->s_cc & SPX_EM; - - cb->s_cc &= ~SPX_EM; - while (len > mtu) { - m = m_copym(m0, 0, mtu, M_DONTWAIT); - if (m == NULL) { - cb->s_cc |= oldEM; - m_freem(m0); - return (ENOBUFS); - } - if (cb->s_flags & SF_NEWCALL) { - struct mbuf *mm = m; - spx_newchecks[7]++; - while (mm != NULL) { - mm->m_flags &= ~M_EOR; - mm = mm->m_next; - } - } - error = spx_output(cb, m); - if (error) { - cb->s_cc |= oldEM; - m_freem(m0); - return (error); - } - m_adj(m0, mtu); - len -= mtu; - } - cb->s_cc |= oldEM; - } - } - - /* - * Force length even, by adding a "garbage byte" if - * necessary. - */ - if (len & 1) { - m = mprev; - if (M_TRAILINGSPACE(m) >= 1) - m->m_len++; - else { - struct mbuf *m1 = m_get(M_DONTWAIT, MT_DATA); - - if (m1 == NULL) { - m_freem(m0); - return (ENOBUFS); - } - m1->m_len = 1; - *(mtod(m1, u_char *)) = 0; - m->m_next = m1; - } - } - m = m_gethdr(M_DONTWAIT, MT_DATA); - if (m == NULL) { - m_freem(m0); - return (ENOBUFS); - } - - /* - * Fill in mbuf with extended SP header and addresses and - * length put into network format. - */ - MH_ALIGN(m, sizeof(struct spx)); - m->m_len = sizeof(struct spx); - m->m_next = m0; - si = mtod(m, struct spx *); - si->si_i = *cb->s_ipx; - si->si_s = cb->s_shdr; - if ((cb->s_flags & SF_PI) && (cb->s_flags & SF_HO)) { - struct spxhdr *sh; - if (m0->m_len < sizeof(*sh)) { - if((m0 = m_pullup(m0, sizeof(*sh))) == NULL) { - m_free(m); - m_freem(m0); - return (EINVAL); - } - m->m_next = m0; - } - sh = mtod(m0, struct spxhdr *); - si->si_dt = sh->spx_dt; - si->si_cc |= sh->spx_cc & SPX_EM; - m0->m_len -= sizeof(*sh); - m0->m_data += sizeof(*sh); - len -= sizeof(*sh); - } - len += sizeof(*si); - if ((cb->s_flags2 & SF_NEWCALL) && recordp) { - si->si_cc |= SPX_EM; - spx_newchecks[8]++; - } - if (cb->s_oobflags & SF_SOOB) { - /* - * Per jqj@cornell: Make sure OB packets convey - * exactly 1 byte. If the packet is 1 byte or - * larger, we have already guaranted there to be at - * least one garbage byte for the checksum, and extra - * bytes shouldn't hurt! - */ - if (len > sizeof(*si)) { - si->si_cc |= SPX_OB; - len = (1 + sizeof(*si)); - } - } - si->si_len = htons((u_short)len); - m->m_pkthdr.len = ((len - 1) | 1) + 1; - - /* - * Queue stuff up for output. - */ - sbappendrecord(sb, m); - cb->s_seq++; - } -#ifdef notdef - idle = (cb->s_smax == (cb->s_rack - 1)); -#endif -again: - sendalot = 0; - off = cb->s_snxt - cb->s_rack; - win = min(cb->s_swnd, (cb->s_cwnd / CUNIT)); - - /* - * If in persist timeout with window of 0, send a probe. Otherwise, - * if window is small but non-zero and timer expired, send what we - * can and go into transmit state. - */ - if (cb->s_force == 1 + SPXT_PERSIST) { - if (win != 0) { - cb->s_timer[SPXT_PERSIST] = 0; - cb->s_rxtshift = 0; - } - } - span = cb->s_seq - cb->s_rack; - len = min(span, win) - off; - - if (len < 0) { - /* - * Window shrank after we went into it. If window shrank to - * 0, cancel pending restransmission and pull s_snxt back to - * (closed) window. We will enter persist state below. If - * the widndow didn't close completely, just wait for an ACK. - */ - len = 0; - if (win == 0) { - cb->s_timer[SPXT_REXMT] = 0; - cb->s_snxt = cb->s_rack; - } - } - if (len > 1) - sendalot = 1; - rcv_win = sbspace(&so->so_rcv); - - /* - * Send if we owe peer an ACK. - */ - if (cb->s_oobflags & SF_SOOB) { - /* - * Must transmit this out of band packet. - */ - cb->s_oobflags &= ~ SF_SOOB; - sendalot = 1; - spxstat.spxs_sndurg++; - goto found; - } - if (cb->s_flags & SF_ACKNOW) - goto send; - if (cb->s_state < TCPS_ESTABLISHED) - goto send; - - /* - * Silly window can't happen in spx. Code from TCP deleted. - */ - if (len) - goto send; - - /* - * Compare available window to amount of window known to peer (as - * advertised window less next expected input.) If the difference is - * at least two packets or at least 35% of the mximum possible - * window, then want to send a window update to peer. - */ - if (rcv_win > 0) { - u_short delta = 1 + cb->s_alo - cb->s_ack; - int adv = rcv_win - (delta * cb->s_mtu); - - if ((so->so_rcv.sb_cc == 0 && adv >= (2 * cb->s_mtu)) || - (100 * adv / so->so_rcv.sb_hiwat >= 35)) { - spxstat.spxs_sndwinup++; - cb->s_flags |= SF_ACKNOW; - goto send; - } - - } - - /* - * Many comments from tcp_output.c are appropriate here including ... - * If send window is too small, there is data to transmit, and no - * retransmit or persist is pending, then go to persist state. If - * nothing happens soon, send when timer expires: if window is - * non-zero, transmit what we can, otherwise send a probe. - */ - if (so->so_snd.sb_cc && cb->s_timer[SPXT_REXMT] == 0 && - cb->s_timer[SPXT_PERSIST] == 0) { - cb->s_rxtshift = 0; - spx_setpersist(cb); - } - - /* - * No reason to send a packet, just return. - */ - cb->s_outx = 1; - return (0); - -send: - /* - * Find requested packet. - */ - si = 0; - if (len > 0) { - cb->s_want = cb->s_snxt; - for (m = sb->sb_mb; m != NULL; m = m->m_act) { - si = mtod(m, struct spx *); - if (SSEQ_LEQ(cb->s_snxt, si->si_seq)) - break; - } - found: - if (si != NULL) { - if (si->si_seq == cb->s_snxt) - cb->s_snxt++; - else - spxstat.spxs_sndvoid++, si = 0; - } - } - - /* - * Update window. - */ - if (rcv_win < 0) - rcv_win = 0; - alo = cb->s_ack - 1 + (rcv_win / ((short)cb->s_mtu)); - if (SSEQ_LT(alo, cb->s_alo)) - alo = cb->s_alo; - - if (si != NULL) { - /* - * Must make a copy of this packet for ipx_output to monkey - * with. - */ - m = m_copy(dtom(si), 0, (int)M_COPYALL); - if (m == NULL) - return (ENOBUFS); - si = mtod(m, struct spx *); - if (SSEQ_LT(si->si_seq, cb->s_smax)) - spxstat.spxs_sndrexmitpack++; - else - spxstat.spxs_sndpack++; - } else if (cb->s_force || cb->s_flags & SF_ACKNOW) { - /* - * Must send an acknowledgement or a probe. - */ - if (cb->s_force) - spxstat.spxs_sndprobe++; - if (cb->s_flags & SF_ACKNOW) - spxstat.spxs_sndacks++; - m = m_gethdr(M_DONTWAIT, MT_DATA); - if (m == NULL) - return (ENOBUFS); - - /* - * Fill in mbuf with extended SP header and addresses and - * length put into network format. - */ - MH_ALIGN(m, sizeof(struct spx)); - m->m_len = sizeof(*si); - m->m_pkthdr.len = sizeof(*si); - si = mtod(m, struct spx *); - si->si_i = *cb->s_ipx; - si->si_s = cb->s_shdr; - si->si_seq = cb->s_smax + 1; - si->si_len = htons(sizeof(*si)); - si->si_cc |= SPX_SP; - } else { - cb->s_outx = 3; - if (so->so_options & SO_DEBUG || traceallspxs) - spx_trace(SA_OUTPUT, cb->s_state, cb, si, 0); - return (0); - } - - /* - * Stuff checksum and output datagram. - */ - if ((si->si_cc & SPX_SP) == 0) { - if (cb->s_force != (1 + SPXT_PERSIST) || - cb->s_timer[SPXT_PERSIST] == 0) { - /* - * If this is a new packet and we are not currently - * timing anything, time this one. - */ - if (SSEQ_LT(cb->s_smax, si->si_seq)) { - cb->s_smax = si->si_seq; - if (cb->s_rtt == 0) { - spxstat.spxs_segstimed++; - cb->s_rtseq = si->si_seq; - cb->s_rtt = 1; - } - } - - /* - * Set rexmt timer if not currently set, initial - * value for retransmit timer is smoothed round-trip - * time + 2 * round-trip time variance. Initialize - * shift counter which is used for backoff of - * retransmit time. - */ - if (cb->s_timer[SPXT_REXMT] == 0 && - cb->s_snxt != cb->s_rack) { - cb->s_timer[SPXT_REXMT] = cb->s_rxtcur; - if (cb->s_timer[SPXT_PERSIST]) { - cb->s_timer[SPXT_PERSIST] = 0; - cb->s_rxtshift = 0; - } - } - } else if (SSEQ_LT(cb->s_smax, si->si_seq)) - cb->s_smax = si->si_seq; - } else if (cb->s_state < TCPS_ESTABLISHED) { - if (cb->s_rtt == 0) - cb->s_rtt = 1; /* Time initial handshake */ - if (cb->s_timer[SPXT_REXMT] == 0) - cb->s_timer[SPXT_REXMT] = cb->s_rxtcur; - } - - /* - * Do not request acks when we ack their data packets or when we do a - * gratuitous window update. - */ - if (((si->si_cc & SPX_SP) == 0) || cb->s_force) - si->si_cc |= SPX_SA; - si->si_seq = htons(si->si_seq); - si->si_alo = htons(alo); - si->si_ack = htons(cb->s_ack); - - if (ipxcksum) - si->si_sum = ipx_cksum(m, ntohs(si->si_len)); - else - si->si_sum = 0xffff; - - cb->s_outx = 4; - if (so->so_options & SO_DEBUG || traceallspxs) - spx_trace(SA_OUTPUT, cb->s_state, cb, si, 0); - - if (so->so_options & SO_DONTROUTE) - error = ipx_outputfl(m, NULL, IPX_ROUTETOIF); - else - error = ipx_outputfl(m, &cb->s_ipxpcb->ipxp_route, 0); - if (error) - return (error); - spxstat.spxs_sndtotal++; - - /* - * Data sent (as far as we can tell). If this advertises a larger - * window than any other segment, then remember the size of the - * advertized window. Any pending ACK has now been sent. - */ - cb->s_force = 0; - cb->s_flags &= ~(SF_ACKNOW|SF_DELACK); - if (SSEQ_GT(alo, cb->s_alo)) - cb->s_alo = alo; - if (sendalot) - goto again; - cb->s_outx = 5; - return (0); -} - -static int spx_do_persist_panics = 0; - -static void -spx_setpersist(struct spxpcb *cb) -{ - int t = ((cb->s_srtt >> 2) + cb->s_rttvar) >> 1; - - IPX_LOCK_ASSERT(cb->s_ipxpcb); - - if (cb->s_timer[SPXT_REXMT] && spx_do_persist_panics) - panic("spx_output REXMT"); - - /* - * Start/restart persistance timer. - */ - SPXT_RANGESET(cb->s_timer[SPXT_PERSIST], - t*spx_backoff[cb->s_rxtshift], - SPXTV_PERSMIN, SPXTV_PERSMAX); - if (cb->s_rxtshift < SPX_MAXRXTSHIFT) - cb->s_rxtshift++; -} - -int -spx_ctloutput(struct socket *so, struct sockopt *sopt) -{ - struct spxhdr spxhdr; - struct ipxpcb *ipxp; - struct spxpcb *cb; - int mask, error; - short soptval; - u_short usoptval; - int optval; - - ipxp = sotoipxpcb(so); - KASSERT(ipxp != NULL, ("spx_ctloutput: ipxp == NULL")); - - /* - * This will have to be changed when we do more general stacking of - * protocols. - */ - if (sopt->sopt_level != IPXPROTO_SPX) - return (ipx_ctloutput(so, sopt)); - - IPX_LOCK(ipxp); - if (ipxp->ipxp_flags & IPXP_DROPPED) { - IPX_UNLOCK(ipxp); - return (ECONNRESET); - } - - IPX_LOCK(ipxp); - cb = ipxtospxpcb(ipxp); - KASSERT(cb != NULL, ("spx_ctloutput: cb == NULL")); - - error = 0; - switch (sopt->sopt_dir) { - case SOPT_GET: - switch (sopt->sopt_name) { - case SO_HEADERS_ON_INPUT: - mask = SF_HI; - goto get_flags; - - case SO_HEADERS_ON_OUTPUT: - mask = SF_HO; - get_flags: - soptval = cb->s_flags & mask; - IPX_UNLOCK(ipxp); - error = sooptcopyout(sopt, &soptval, - sizeof(soptval)); - break; - - case SO_MTU: - usoptval = cb->s_mtu; - IPX_UNLOCK(ipxp); - error = sooptcopyout(sopt, &usoptval, - sizeof(usoptval)); - break; - - case SO_LAST_HEADER: - spxhdr = cb->s_rhdr; - IPX_UNLOCK(ipxp); - error = sooptcopyout(sopt, &spxhdr, sizeof(spxhdr)); - break; - - case SO_DEFAULT_HEADERS: - spxhdr = cb->s_shdr; - IPX_UNLOCK(ipxp); - error = sooptcopyout(sopt, &spxhdr, sizeof(spxhdr)); - break; - - default: - IPX_UNLOCK(ipxp); - error = ENOPROTOOPT; - } - break; - - case SOPT_SET: - /* - * XXX Why are these shorts on get and ints on set? That - * doesn't make any sense... - * - * XXXRW: Note, when we re-acquire the ipxp lock, we should - * re-check that it's not dropped. - */ - IPX_UNLOCK(ipxp); - switch (sopt->sopt_name) { - case SO_HEADERS_ON_INPUT: - mask = SF_HI; - goto set_head; - - case SO_HEADERS_ON_OUTPUT: - mask = SF_HO; - set_head: - error = sooptcopyin(sopt, &optval, sizeof optval, - sizeof optval); - if (error) - break; - - IPX_LOCK(ipxp); - if (cb->s_flags & SF_PI) { - if (optval) - cb->s_flags |= mask; - else - cb->s_flags &= ~mask; - } else error = EINVAL; - IPX_UNLOCK(ipxp); - break; - - case SO_MTU: - error = sooptcopyin(sopt, &usoptval, sizeof usoptval, - sizeof usoptval); - if (error) - break; - /* Unlocked write. */ - cb->s_mtu = usoptval; - break; - -#ifdef SF_NEWCALL - case SO_NEWCALL: - error = sooptcopyin(sopt, &optval, sizeof optval, - sizeof optval); - if (error) - break; - IPX_LOCK(ipxp); - if (optval) { - cb->s_flags2 |= SF_NEWCALL; - spx_newchecks[5]++; - } else { - cb->s_flags2 &= ~SF_NEWCALL; - spx_newchecks[6]++; - } - IPX_UNLOCK(ipxp); - break; -#endif - - case SO_DEFAULT_HEADERS: - { - struct spxhdr sp; - - error = sooptcopyin(sopt, &sp, sizeof sp, - sizeof sp); - if (error) - break; - IPX_LOCK(ipxp); - cb->s_dt = sp.spx_dt; - cb->s_cc = sp.spx_cc & SPX_EM; - IPX_UNLOCK(ipxp); - } - break; - - default: - error = ENOPROTOOPT; - } - break; - - default: - panic("spx_ctloutput: bad socket option direction"); - } - return (error); -} - -static void -spx_usr_abort(struct socket *so) -{ - struct ipxpcb *ipxp; - struct spxpcb *cb; - - ipxp = sotoipxpcb(so); - KASSERT(ipxp != NULL, ("spx_usr_abort: ipxp == NULL")); - - cb = ipxtospxpcb(ipxp); - KASSERT(cb != NULL, ("spx_usr_abort: cb == NULL")); - - IPX_LIST_LOCK(); - IPX_LOCK(ipxp); - spx_drop(cb, ECONNABORTED); - IPX_UNLOCK(ipxp); - IPX_LIST_UNLOCK(); -} *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon May 25 09:52:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 94D57106566B; Mon, 25 May 2009 09:52:58 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 831858FC1A; Mon, 25 May 2009 09:52:58 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P9qwio018443; Mon, 25 May 2009 09:52:58 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P9qwIg018442; Mon, 25 May 2009 09:52:58 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <200905250952.n4P9qwIg018442@svn.freebsd.org> From: Maxim Konovalov Date: Mon, 25 May 2009 09:52:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192747 - head/sbin/geom/class/journal X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 09:52:59 -0000 Author: maxim Date: Mon May 25 09:52:58 2009 New Revision: 192747 URL: http://svn.freebsd.org/changeset/base/192747 Log: o Fix typo in the example. PR: docs/134930 Submitted by: Alex Keda MFC after: 1 week Modified: head/sbin/geom/class/journal/gjournal.8 Modified: head/sbin/geom/class/journal/gjournal.8 ============================================================================== --- head/sbin/geom/class/journal/gjournal.8 Mon May 25 09:28:54 2009 (r192746) +++ head/sbin/geom/class/journal/gjournal.8 Mon May 25 09:52:58 2009 (r192747) @@ -220,7 +220,7 @@ allows this (i.e., if the last sector is .Bd -literal -offset indent umount /dev/da0s1d gjournal label da0s1d da0s1e && \e - tunefs -J enable -n disable da01sd.journal && \e + tunefs -J enable -n disable da0s1d.journal && \e mount -o async /dev/da0s1d.journal /mnt || \e mount /dev/da0s1d /mnt .Ed From owner-svn-src-head@FreeBSD.ORG Mon May 25 09:57:18 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 659131065670; Mon, 25 May 2009 09:57:18 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5228E8FC13; Mon, 25 May 2009 09:57:18 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4P9vIbI018571; Mon, 25 May 2009 09:57:18 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4P9vI38018570; Mon, 25 May 2009 09:57:18 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200905250957.n4P9vI38018570@svn.freebsd.org> From: Robert Watson Date: Mon, 25 May 2009 09:57:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192748 - head/sys/netipx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 09:57:19 -0000 Author: rwatson Date: Mon May 25 09:57:18 2009 New Revision: 192748 URL: http://svn.freebsd.org/changeset/base/192748 Log: Prefer m_nextpkt to m_act when iterating mbuf queues. MFC after: 1 month Modified: head/sys/netipx/spx_usrreq.c Modified: head/sys/netipx/spx_usrreq.c ============================================================================== --- head/sys/netipx/spx_usrreq.c Mon May 25 09:52:58 2009 (r192747) +++ head/sys/netipx/spx_usrreq.c Mon May 25 09:57:18 2009 (r192748) @@ -673,7 +673,7 @@ send: si = 0; if (len > 0) { cb->s_want = cb->s_snxt; - for (m = sb->sb_mb; m != NULL; m = m->m_act) { + for (m = sb->sb_mb; m != NULL; m = m->m_nextpkt) { si = mtod(m, struct spx *); if (SSEQ_LEQ(cb->s_snxt, si->si_seq)) break; From owner-svn-src-head@FreeBSD.ORG Mon May 25 10:25:41 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B67AA106564A; Mon, 25 May 2009 10:25:41 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A450D8FC16; Mon, 25 May 2009 10:25:41 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4PAPfCU021298; Mon, 25 May 2009 10:25:41 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4PAPftB021295; Mon, 25 May 2009 10:25:41 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200905251025.n4PAPftB021295@svn.freebsd.org> From: Robert Watson Date: Mon, 25 May 2009 10:25:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192753 - head/sys/netipx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 10:25:42 -0000 Author: rwatson Date: Mon May 25 10:25:41 2009 New Revision: 192753 URL: http://svn.freebsd.org/changeset/base/192753 Log: Pull SPX reassembly queue init and flush into spx_reass.c. MFC after: 1 month Modified: head/sys/netipx/spx_reass.c head/sys/netipx/spx_usrreq.c head/sys/netipx/spx_var.h Modified: head/sys/netipx/spx_reass.c ============================================================================== --- head/sys/netipx/spx_reass.c Mon May 25 10:22:39 2009 (r192752) +++ head/sys/netipx/spx_reass.c Mon May 25 10:25:41 2009 (r192753) @@ -1,7 +1,7 @@ /*- * Copyright (c) 1984, 1985, 1986, 1987, 1993 * The Regents of the University of California. - * Copyright (c) 2004-2006 Robert N. M. Watson + * Copyright (c) 2004-2009 Robert N. M. Watson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -112,6 +112,34 @@ spx_remque(struct spx_q *element) } /* + * Flesh pending queued segments on SPX close. + */ +void +spx_reass_flush(struct spxpcb *cb) +{ + struct spx_q *s; + struct mbuf *m; + + s = cb->s_q.si_next; + while (s != &(cb->s_q)) { + s = s->si_next; + spx_remque(s); + m = dtom(s); + m_freem(m); + } +} + +/* + * Initialize SPX segment reassembly queue on SPX socket open. + */ +void +spx_reass_init(struct spxpcb *cb) +{ + + cb->s_q.si_next = cb->s_q.si_prev = &cb->s_q; +} + +/* * This is structurally similar to the tcp reassembly routine but its * function is somewhat different: it merely queues packets up, and * suppresses duplicates. Modified: head/sys/netipx/spx_usrreq.c ============================================================================== --- head/sys/netipx/spx_usrreq.c Mon May 25 10:22:39 2009 (r192752) +++ head/sys/netipx/spx_usrreq.c Mon May 25 10:25:41 2009 (r192753) @@ -1,7 +1,7 @@ /*- * Copyright (c) 1984, 1985, 1986, 1987, 1993 * The Regents of the University of California. - * Copyright (c) 2004-2006 Robert N. M. Watson + * Copyright (c) 2004-2009 Robert N. M. Watson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1091,7 +1091,7 @@ spx_attach(struct socket *so, int proto, cb->s_state = TCPS_LISTEN; cb->s_smax = -1; cb->s_swl1 = -1; - cb->s_q.si_next = cb->s_q.si_prev = &cb->s_q; + spx_reass_init(cb); cb->s_ipxpcb = ipxp; cb->s_mtu = 576 - sizeof(struct spx); sb = &so->so_snd; @@ -1117,21 +1117,13 @@ static void spx_pcbdetach(struct ipxpcb *ipxp) { struct spxpcb *cb; - struct spx_q *s; - struct mbuf *m; IPX_LOCK_ASSERT(ipxp); cb = ipxtospxpcb(ipxp); KASSERT(cb != NULL, ("spx_pcbdetach: cb == NULL")); - s = cb->s_q.si_next; - while (s != &(cb->s_q)) { - s = s->si_next; - spx_remque(s); - m = dtom(s); - m_freem(m); - } + spx_reass_flush(cb); m_free(dtom(cb->s_ipx)); free(cb, M_PCB); ipxp->ipxp_pcb = NULL; Modified: head/sys/netipx/spx_var.h ============================================================================== --- head/sys/netipx/spx_var.h Mon May 25 10:22:39 2009 (r192752) +++ head/sys/netipx/spx_var.h Mon May 25 10:25:41 2009 (r192753) @@ -153,6 +153,8 @@ extern u_short spx_newchecks[50]; int spx_output(struct spxpcb *cb, struct mbuf *m0); int spx_reass(struct spxpcb *cb, struct spx *si); +void spx_reass_flush(struct spxpcb *cb); +void spx_reass_init(struct spxpcb *cb); void spx_remque(struct spx_q *element); #endif From owner-svn-src-head@FreeBSD.ORG Mon May 25 11:50:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE39410656BF; Mon, 25 May 2009 11:50:58 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9E60A8FC4A; Mon, 25 May 2009 11:50:58 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4PBowJN022943; Mon, 25 May 2009 11:50:58 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4PBowse022941; Mon, 25 May 2009 11:50:58 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200905251150.n4PBowse022941@svn.freebsd.org> From: Robert Watson Date: Mon, 25 May 2009 11:50:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192754 - head/sys/netipx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 11:51:02 -0000 Author: rwatson Date: Mon May 25 11:50:58 2009 New Revision: 192754 URL: http://svn.freebsd.org/changeset/base/192754 Log: Rather than store a skeleton IPX header in an mbuf hung off the SPX PCB, simply embed it in the PCB, avoiding additional memory overhead, memory allocation overhead, and removing one of the few remaining uses of dtom() in the network stack. Restore misplaced spx_ctlinput() from an earlier commit. MFC after: 1 month Modified: head/sys/netipx/spx.h head/sys/netipx/spx_usrreq.c Modified: head/sys/netipx/spx.h ============================================================================== --- head/sys/netipx/spx.h Mon May 25 10:25:41 2009 (r192753) +++ head/sys/netipx/spx.h Mon May 25 11:50:58 2009 (r192754) @@ -129,7 +129,7 @@ struct spxpcb { u_short s_mtu; /* Max packet size for this stream */ /* use sequence fields in headers to store sequence numbers for this connection */ - struct ipx *s_ipx; + struct ipx s_ipx; struct spxhdr s_shdr; /* prototype header to transmit */ #define s_cc s_shdr.spx_cc /* connection control (for EM bit) */ #define s_dt s_shdr.spx_dt /* datastream type */ @@ -138,7 +138,7 @@ struct spxpcb { #define s_seq s_shdr.spx_seq /* sequence number */ #define s_ack s_shdr.spx_ack /* acknowledge number */ #define s_alo s_shdr.spx_alo /* allocation number */ -#define s_dport s_ipx->ipx_dna.x_port /* where we are sending */ +#define s_dport s_ipx.ipx_dna.x_port /* where we are sending */ struct spxhdr s_rhdr; /* last received header (in effect!)*/ u_short s_rack; /* their acknowledge number */ u_short s_ralo; /* their allocation number */ Modified: head/sys/netipx/spx_usrreq.c ============================================================================== --- head/sys/netipx/spx_usrreq.c Mon May 25 10:25:41 2009 (r192753) +++ head/sys/netipx/spx_usrreq.c Mon May 25 11:50:58 2009 (r192754) @@ -417,6 +417,13 @@ drop: m_freem(m); } +void +spx_ctlinput(int cmd, struct sockaddr *arg_as_sa, void *dummy) +{ + + /* Currently, nothing. */ +} + int spx_output(struct spxpcb *cb, struct mbuf *m0) { @@ -520,7 +527,7 @@ spx_output(struct spxpcb *cb, struct mbu m->m_len = sizeof(struct spx); m->m_next = m0; si = mtod(m, struct spx *); - si->si_i = *cb->s_ipx; + si->si_i = cb->s_ipx; si->si_s = cb->s_shdr; if ((cb->s_flags & SF_PI) && (cb->s_flags & SF_HO)) { struct spxhdr *sh; @@ -729,7 +736,7 @@ send: m->m_len = sizeof(*si); m->m_pkthdr.len = sizeof(*si); si = mtod(m, struct spx *); - si->si_i = *cb->s_ipx; + si->si_i = cb->s_ipx; si->si_s = cb->s_shdr; si->si_seq = cb->s_smax + 1; si->si_len = htons(sizeof(*si)); @@ -1087,7 +1094,6 @@ spx_attach(struct socket *so, int proto, ipxp = sotoipxpcb(so); ipxp->ipxp_flags |= IPXP_SPX; - cb->s_ipx = mtod(mm, struct ipx *); cb->s_state = TCPS_LISTEN; cb->s_smax = -1; cb->s_swl1 = -1; @@ -1124,7 +1130,6 @@ spx_pcbdetach(struct ipxpcb *ipxp) KASSERT(cb != NULL, ("spx_pcbdetach: cb == NULL")); spx_reass_flush(cb); - m_free(dtom(cb->s_ipx)); free(cb, M_PCB); ipxp->ipxp_pcb = NULL; } @@ -1490,14 +1495,13 @@ static void spx_template(struct spxpcb *cb) { struct ipxpcb *ipxp = cb->s_ipxpcb; - struct ipx *ipx = cb->s_ipx; struct sockbuf *sb = &(ipxp->ipxp_socket->so_snd); IPX_LOCK_ASSERT(ipxp); - ipx->ipx_pt = IPXPROTO_SPX; - ipx->ipx_sna = ipxp->ipxp_laddr; - ipx->ipx_dna = ipxp->ipxp_faddr; + cb->s_ipx.ipx_pt = IPXPROTO_SPX; + cb->s_ipx.ipx_sna = ipxp->ipxp_laddr; + cb->s_ipx.ipx_dna = ipxp->ipxp_faddr; SPX_LOCK(); cb->s_sid = htons(spx_iss); spx_iss += SPX_ISSINCR/2; @@ -1519,8 +1523,7 @@ spx_template(struct spxpcb *cb) /* * Close a SPIP control block. Wake up any sleepers. We used to free any - * queued packets and cb->s_ipx here, but now we defer that until the pcb is - * discarded. + * queued packets, but now we defer that until the pcb is discarded. */ void spx_close(struct spxpcb *cb) From owner-svn-src-head@FreeBSD.ORG Mon May 25 11:52:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC743106567A; Mon, 25 May 2009 11:52:33 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AA3F78FC14; Mon, 25 May 2009 11:52:33 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4PBqXa2023004; Mon, 25 May 2009 11:52:33 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4PBqXic023003; Mon, 25 May 2009 11:52:33 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200905251152.n4PBqXic023003@svn.freebsd.org> From: Robert Watson Date: Mon, 25 May 2009 11:52:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192755 - head/sys/netipx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 11:52:34 -0000 Author: rwatson Date: Mon May 25 11:52:33 2009 New Revision: 192755 URL: http://svn.freebsd.org/changeset/base/192755 Log: Prefer NULL to 0 for pointer assignments. MFC after: 1 month Modified: head/sys/netipx/spx_usrreq.c Modified: head/sys/netipx/spx_usrreq.c ============================================================================== --- head/sys/netipx/spx_usrreq.c Mon May 25 11:50:58 2009 (r192754) +++ head/sys/netipx/spx_usrreq.c Mon May 25 11:52:33 2009 (r192755) @@ -677,7 +677,7 @@ send: /* * Find requested packet. */ - si = 0; + si = NULL; if (len > 0) { cb->s_want = cb->s_snxt; for (m = sb->sb_mb; m != NULL; m = m->m_nextpkt) { @@ -690,7 +690,7 @@ send: if (si->si_seq == cb->s_snxt) cb->s_snxt++; else - spxstat.spxs_sndvoid++, si = 0; + spxstat.spxs_sndvoid++, si = NULL; } } From owner-svn-src-head@FreeBSD.ORG Mon May 25 13:32:54 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6CE910656D6; Mon, 25 May 2009 13:32:54 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E6B28FC21; Mon, 25 May 2009 13:32:54 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4PDWsHQ025170; Mon, 25 May 2009 13:32:54 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4PDWsdt025169; Mon, 25 May 2009 13:32:54 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200905251332.n4PDWsdt025169@svn.freebsd.org> From: Robert Watson Date: Mon, 25 May 2009 13:32:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192756 - head/sys/netipx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 13:32:55 -0000 Author: rwatson Date: Mon May 25 13:32:54 2009 New Revision: 192756 URL: http://svn.freebsd.org/changeset/base/192756 Log: Eliminate use of dtom() in spx_output() by fixing up tracking of the containing mbuf for 'si' in local variable 'm'. MFC after: 1 month Modified: head/sys/netipx/spx_usrreq.c Modified: head/sys/netipx/spx_usrreq.c ============================================================================== --- head/sys/netipx/spx_usrreq.c Mon May 25 11:52:33 2009 (r192755) +++ head/sys/netipx/spx_usrreq.c Mon May 25 13:32:54 2009 (r192756) @@ -428,7 +428,7 @@ int spx_output(struct spxpcb *cb, struct mbuf *m0) { struct socket *so = cb->s_ipxpcb->ipxp_socket; - struct mbuf *m; + struct mbuf *m = NULL; struct spx *si = NULL; struct sockbuf *sb = &so->so_snd; int len = 0, win, rcv_win; @@ -678,6 +678,7 @@ send: * Find requested packet. */ si = NULL; + m = NULL; if (len > 0) { cb->s_want = cb->s_snxt; for (m = sb->sb_mb; m != NULL; m = m->m_nextpkt) { @@ -687,10 +688,12 @@ send: } found: if (si != NULL) { - if (si->si_seq == cb->s_snxt) - cb->s_snxt++; - else - spxstat.spxs_sndvoid++, si = NULL; + if (si->si_seq != cb->s_snxt) { + spxstat.spxs_sndvoid++; + si = NULL; + m = NULL; + } else + cb->s_snxt++; } } @@ -703,12 +706,12 @@ send: if (SSEQ_LT(alo, cb->s_alo)) alo = cb->s_alo; - if (si != NULL) { + if (m != NULL) { /* * Must make a copy of this packet for ipx_output to monkey * with. */ - m = m_copy(dtom(si), 0, (int)M_COPYALL); + m = m_copy(m, 0, M_COPYALL); if (m == NULL) return (ENOBUFS); si = mtod(m, struct spx *); From owner-svn-src-head@FreeBSD.ORG Mon May 25 13:34:04 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50D96106564A; Mon, 25 May 2009 13:34:04 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3EA8F8FC24; Mon, 25 May 2009 13:34:04 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4PDY4S8025250; Mon, 25 May 2009 13:34:04 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4PDY460025249; Mon, 25 May 2009 13:34:04 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200905251334.n4PDY460025249@svn.freebsd.org> From: Robert Watson Date: Mon, 25 May 2009 13:34:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192757 - head/sys/netipx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 13:34:04 -0000 Author: rwatson Date: Mon May 25 13:34:03 2009 New Revision: 192757 URL: http://svn.freebsd.org/changeset/base/192757 Log: Add missing call to ipx_pcbdetach() during SPX socket tear-down: not harmful in practice if running without INVARIANTS, but will panic with KASSERT enabled when SPX sockets are closed. MFC after: 3 days Modified: head/sys/netipx/spx_usrreq.c Modified: head/sys/netipx/spx_usrreq.c ============================================================================== --- head/sys/netipx/spx_usrreq.c Mon May 25 13:32:54 2009 (r192756) +++ head/sys/netipx/spx_usrreq.c Mon May 25 13:34:03 2009 (r192757) @@ -1253,6 +1253,7 @@ spx_detach(struct socket *so) IPX_LIST_LOCK(); IPX_LOCK(ipxp); spx_pcbdetach(ipxp); + ipx_pcbdetach(ipxp); ipx_pcbfree(ipxp); IPX_LIST_UNLOCK(); } From owner-svn-src-head@FreeBSD.ORG Mon May 25 13:52:52 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F3FB3106564A; Mon, 25 May 2009 13:52:51 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E1BD88FC12; Mon, 25 May 2009 13:52:51 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4PDqpne025642; Mon, 25 May 2009 13:52:51 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4PDqpuu025640; Mon, 25 May 2009 13:52:51 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200905251352.n4PDqpuu025640@svn.freebsd.org> From: Robert Watson Date: Mon, 25 May 2009 13:52:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192758 - head/sys/netipx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 13:52:52 -0000 Author: rwatson Date: Mon May 25 13:52:51 2009 New Revision: 192758 URL: http://svn.freebsd.org/changeset/base/192758 Log: Staticize spx_remque() now that it's only used from spx_reass.c. Modified: head/sys/netipx/spx_reass.c head/sys/netipx/spx_var.h Modified: head/sys/netipx/spx_reass.c ============================================================================== --- head/sys/netipx/spx_reass.c Mon May 25 13:34:03 2009 (r192757) +++ head/sys/netipx/spx_reass.c Mon May 25 13:52:51 2009 (r192758) @@ -102,7 +102,7 @@ spx_insque(struct spx_q *element, struct element->si_next->si_prev = element; } -void +static void spx_remque(struct spx_q *element) { Modified: head/sys/netipx/spx_var.h ============================================================================== --- head/sys/netipx/spx_var.h Mon May 25 13:34:03 2009 (r192757) +++ head/sys/netipx/spx_var.h Mon May 25 13:52:51 2009 (r192758) @@ -155,7 +155,6 @@ int spx_output(struct spxpcb *cb, struct int spx_reass(struct spxpcb *cb, struct spx *si); void spx_reass_flush(struct spxpcb *cb); void spx_reass_init(struct spxpcb *cb); -void spx_remque(struct spx_q *element); #endif #endif /* !_NETIPX_SPX_VAR_H_ */ From owner-svn-src-head@FreeBSD.ORG Mon May 25 14:37:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15FBD1065677; Mon, 25 May 2009 14:37:13 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 003388FC12; Mon, 25 May 2009 14:37:13 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4PEbCP7026636; Mon, 25 May 2009 14:37:12 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4PEbAPT026579; Mon, 25 May 2009 14:37:10 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200905251437.n4PEbAPT026579@svn.freebsd.org> From: Attilio Rao Date: Mon, 25 May 2009 14:37:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192760 - in head: lib/libc_r/arch/amd64 lib/libc_r/arch/i386 lib/libstand/i386 lib/msun/amd64 lib/msun/i387 lib/msun/ia64 tools/KSE/ksetest tools/KSE/rr X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 14:37:13 -0000 Author: attilio Date: Mon May 25 14:37:10 2009 New Revision: 192760 URL: http://svn.freebsd.org/changeset/base/192760 Log: Use, in uncovered part, the END() macro in order to improve debugging. In this specific case, Valgrind won't get confused when analyzing such functions. Sponsored by: Sandvine Incorporated Tested by: emaste MFC: 3 days Modified: head/lib/libc_r/arch/amd64/_atomic_lock.S head/lib/libc_r/arch/i386/_atomic_lock.S head/lib/libstand/i386/_setjmp.S head/lib/msun/amd64/e_sqrt.S head/lib/msun/amd64/e_sqrtf.S head/lib/msun/amd64/s_lrint.S head/lib/msun/amd64/s_lrintf.S head/lib/msun/amd64/s_remquo.S head/lib/msun/amd64/s_remquof.S head/lib/msun/amd64/s_scalbn.S head/lib/msun/amd64/s_scalbnf.S head/lib/msun/amd64/s_scalbnl.S head/lib/msun/i387/e_exp.S head/lib/msun/i387/e_fmod.S head/lib/msun/i387/e_log.S head/lib/msun/i387/e_log10.S head/lib/msun/i387/e_log10f.S head/lib/msun/i387/e_remainder.S head/lib/msun/i387/e_remainderf.S head/lib/msun/i387/e_sqrt.S head/lib/msun/i387/e_sqrtf.S head/lib/msun/i387/s_ceil.S head/lib/msun/i387/s_ceilf.S head/lib/msun/i387/s_ceill.S head/lib/msun/i387/s_copysign.S head/lib/msun/i387/s_copysignf.S head/lib/msun/i387/s_copysignl.S head/lib/msun/i387/s_cos.S head/lib/msun/i387/s_finite.S head/lib/msun/i387/s_floor.S head/lib/msun/i387/s_floorf.S head/lib/msun/i387/s_floorl.S head/lib/msun/i387/s_llrint.S head/lib/msun/i387/s_llrintf.S head/lib/msun/i387/s_logb.S head/lib/msun/i387/s_logbf.S head/lib/msun/i387/s_lrint.S head/lib/msun/i387/s_lrintf.S head/lib/msun/i387/s_remquo.S head/lib/msun/i387/s_remquof.S head/lib/msun/i387/s_rint.S head/lib/msun/i387/s_rintf.S head/lib/msun/i387/s_scalbn.S head/lib/msun/i387/s_scalbnf.S head/lib/msun/i387/s_scalbnl.S head/lib/msun/i387/s_significand.S head/lib/msun/i387/s_significandf.S head/lib/msun/i387/s_sin.S head/lib/msun/i387/s_tan.S head/lib/msun/i387/s_trunc.S head/lib/msun/i387/s_truncf.S head/lib/msun/i387/s_truncl.S head/lib/msun/ia64/s_fma.S head/lib/msun/ia64/s_fmaf.S head/lib/msun/ia64/s_fmal.S head/tools/KSE/ksetest/kse_asm.S head/tools/KSE/rr/kse_asm.S Modified: head/lib/libc_r/arch/amd64/_atomic_lock.S ============================================================================== --- head/lib/libc_r/arch/amd64/_atomic_lock.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/libc_r/arch/amd64/_atomic_lock.S Mon May 25 14:37:10 2009 (r192760) @@ -38,4 +38,5 @@ ENTRY(_atomic_lock) movl $1, %eax xchgq %rax, (%rdi) ret +END(_atomic_lock) Modified: head/lib/libc_r/arch/i386/_atomic_lock.S ============================================================================== --- head/lib/libc_r/arch/i386/_atomic_lock.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/libc_r/arch/i386/_atomic_lock.S Mon May 25 14:37:10 2009 (r192760) @@ -39,4 +39,5 @@ ENTRY(_atomic_lock) movl $1, %eax xchg %eax, (%ecx) ret +END(_atomic_lock) Modified: head/lib/libstand/i386/_setjmp.S ============================================================================== --- head/lib/libstand/i386/_setjmp.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/libstand/i386/_setjmp.S Mon May 25 14:37:10 2009 (r192760) @@ -58,6 +58,7 @@ ENTRY(_setjmp) movl %edi,20(%eax) xorl %eax,%eax ret +END(_setjmp) ENTRY(_longjmp) movl 4(%esp),%edx @@ -73,3 +74,4 @@ ENTRY(_longjmp) incl %eax 1: movl %ecx,0(%esp) ret +END(_longjmp) Modified: head/lib/msun/amd64/e_sqrt.S ============================================================================== --- head/lib/msun/amd64/e_sqrt.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/amd64/e_sqrt.S Mon May 25 14:37:10 2009 (r192760) @@ -30,4 +30,5 @@ __FBSDID("$FreeBSD$") ENTRY(sqrt) sqrtsd %xmm0, %xmm0 ret +END(sqrt) Modified: head/lib/msun/amd64/e_sqrtf.S ============================================================================== --- head/lib/msun/amd64/e_sqrtf.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/amd64/e_sqrtf.S Mon May 25 14:37:10 2009 (r192760) @@ -30,3 +30,4 @@ __FBSDID("$FreeBSD$") ENTRY(sqrtf) sqrtss %xmm0, %xmm0 ret +END(sqrtf) Modified: head/lib/msun/amd64/s_lrint.S ============================================================================== --- head/lib/msun/amd64/s_lrint.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/amd64/s_lrint.S Mon May 25 14:37:10 2009 (r192760) @@ -34,3 +34,4 @@ __FBSDID("$FreeBSD$") ENTRY(fn) cvtsd2si %xmm0, %rax ret +END(fn) Modified: head/lib/msun/amd64/s_lrintf.S ============================================================================== --- head/lib/msun/amd64/s_lrintf.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/amd64/s_lrintf.S Mon May 25 14:37:10 2009 (r192760) @@ -34,3 +34,4 @@ __FBSDID("$FreeBSD$") ENTRY(fn) cvtss2si %xmm0, %rax ret +END(fn) Modified: head/lib/msun/amd64/s_remquo.S ============================================================================== --- head/lib/msun/amd64/s_remquo.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/amd64/s_remquo.S Mon May 25 14:37:10 2009 (r192760) @@ -63,3 +63,4 @@ ENTRY(remquo) fstpl -8(%rsp) movsd -8(%rsp),%xmm0 ret +END(remquo) Modified: head/lib/msun/amd64/s_remquof.S ============================================================================== --- head/lib/msun/amd64/s_remquof.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/amd64/s_remquof.S Mon May 25 14:37:10 2009 (r192760) @@ -63,3 +63,4 @@ ENTRY(remquof) fstps -4(%rsp) movss -4(%rsp),%xmm0 ret +END(remquof) Modified: head/lib/msun/amd64/s_scalbn.S ============================================================================== --- head/lib/msun/amd64/s_scalbn.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/amd64/s_scalbn.S Mon May 25 14:37:10 2009 (r192760) @@ -37,3 +37,4 @@ ENTRY(scalbn) fstpl -8(%rsp) movsd -8(%rsp),%xmm0 ret +END(scalbn) Modified: head/lib/msun/amd64/s_scalbnf.S ============================================================================== --- head/lib/msun/amd64/s_scalbnf.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/amd64/s_scalbnf.S Mon May 25 14:37:10 2009 (r192760) @@ -37,6 +37,7 @@ ENTRY(scalbnf) fstps -8(%rsp) movss -8(%rsp),%xmm0 ret +END(scalbnf) .globl CNAME(ldexpf) .set CNAME(ldexpf),CNAME(scalbnf) Modified: head/lib/msun/amd64/s_scalbnl.S ============================================================================== --- head/lib/msun/amd64/s_scalbnl.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/amd64/s_scalbnl.S Mon May 25 14:37:10 2009 (r192760) @@ -14,6 +14,7 @@ ENTRY(scalbnl) fscale fstp %st(1) ret +END(scalbnl) .globl CNAME(ldexpl) .set CNAME(ldexpl),CNAME(scalbnl) Modified: head/lib/msun/i387/e_exp.S ============================================================================== --- head/lib/msun/i387/e_exp.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/e_exp.S Mon May 25 14:37:10 2009 (r192760) @@ -96,3 +96,4 @@ x_Inf_or_NaN: x_not_minus_Inf: fldl 4(%esp) ret +END(exp) Modified: head/lib/msun/i387/e_fmod.S ============================================================================== --- head/lib/msun/i387/e_fmod.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/e_fmod.S Mon May 25 14:37:10 2009 (r192760) @@ -46,3 +46,4 @@ ENTRY(fmod) jp 1b fstp %st(1) ret +END(fmod) Modified: head/lib/msun/i387/e_log.S ============================================================================== --- head/lib/msun/i387/e_log.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/e_log.S Mon May 25 14:37:10 2009 (r192760) @@ -42,3 +42,4 @@ ENTRY(log) fldl 4(%esp) fyl2x ret +END(log) Modified: head/lib/msun/i387/e_log10.S ============================================================================== --- head/lib/msun/i387/e_log10.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/e_log10.S Mon May 25 14:37:10 2009 (r192760) @@ -42,3 +42,4 @@ ENTRY(log10) fldl 4(%esp) fyl2x ret +END(log10) Modified: head/lib/msun/i387/e_log10f.S ============================================================================== --- head/lib/msun/i387/e_log10f.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/e_log10f.S Mon May 25 14:37:10 2009 (r192760) @@ -13,3 +13,4 @@ ENTRY(log10f) flds 4(%esp) fyl2x ret +END(log10f) Modified: head/lib/msun/i387/e_remainder.S ============================================================================== --- head/lib/msun/i387/e_remainder.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/e_remainder.S Mon May 25 14:37:10 2009 (r192760) @@ -46,3 +46,4 @@ ENTRY(remainder) jp 1b fstp %st(1) ret +END(remainder) Modified: head/lib/msun/i387/e_remainderf.S ============================================================================== --- head/lib/msun/i387/e_remainderf.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/e_remainderf.S Mon May 25 14:37:10 2009 (r192760) @@ -17,3 +17,4 @@ ENTRY(remainderf) jp 1b fstp %st(1) ret +END(remainderf) Modified: head/lib/msun/i387/e_sqrt.S ============================================================================== --- head/lib/msun/i387/e_sqrt.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/e_sqrt.S Mon May 25 14:37:10 2009 (r192760) @@ -41,3 +41,4 @@ ENTRY(sqrt) fldl 4(%esp) fsqrt ret +END(sqrt) Modified: head/lib/msun/i387/e_sqrtf.S ============================================================================== --- head/lib/msun/i387/e_sqrtf.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/e_sqrtf.S Mon May 25 14:37:10 2009 (r192760) @@ -12,3 +12,4 @@ ENTRY(sqrtf) flds 4(%esp) fsqrt ret +END(sqrtf) Modified: head/lib/msun/i387/s_ceil.S ============================================================================== --- head/lib/msun/i387/s_ceil.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_ceil.S Mon May 25 14:37:10 2009 (r192760) @@ -56,3 +56,4 @@ ENTRY(ceil) leave ret +END(ceil) Modified: head/lib/msun/i387/s_ceilf.S ============================================================================== --- head/lib/msun/i387/s_ceilf.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_ceilf.S Mon May 25 14:37:10 2009 (r192760) @@ -27,3 +27,4 @@ ENTRY(ceilf) leave ret +END(ceilf) Modified: head/lib/msun/i387/s_ceill.S ============================================================================== --- head/lib/msun/i387/s_ceill.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_ceill.S Mon May 25 14:37:10 2009 (r192760) @@ -25,3 +25,4 @@ ENTRY(ceill) leave ret +END(ceill) Modified: head/lib/msun/i387/s_copysign.S ============================================================================== --- head/lib/msun/i387/s_copysign.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_copysign.S Mon May 25 14:37:10 2009 (r192760) @@ -46,3 +46,4 @@ ENTRY(copysign) movl %eax,8(%esp) fldl 4(%esp) ret +END(copysign) Modified: head/lib/msun/i387/s_copysignf.S ============================================================================== --- head/lib/msun/i387/s_copysignf.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_copysignf.S Mon May 25 14:37:10 2009 (r192760) @@ -17,3 +17,4 @@ ENTRY(copysignf) movl %eax,4(%esp) flds 4(%esp) ret +END(copysignf) Modified: head/lib/msun/i387/s_copysignl.S ============================================================================== --- head/lib/msun/i387/s_copysignl.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_copysignl.S Mon May 25 14:37:10 2009 (r192760) @@ -15,3 +15,4 @@ ENTRY(copysignl) movl %eax,12(%esp) fldt 4(%esp) ret +END(copysignl) Modified: head/lib/msun/i387/s_cos.S ============================================================================== --- head/lib/msun/i387/s_cos.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_cos.S Mon May 25 14:37:10 2009 (r192760) @@ -54,3 +54,4 @@ ENTRY(cos) fstp %st(1) fcos ret +END(cos) Modified: head/lib/msun/i387/s_finite.S ============================================================================== --- head/lib/msun/i387/s_finite.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_finite.S Mon May 25 14:37:10 2009 (r192760) @@ -44,3 +44,4 @@ ENTRY(finite) setneb %al andl $0x000000ff, %eax ret +END(finite) Modified: head/lib/msun/i387/s_floor.S ============================================================================== --- head/lib/msun/i387/s_floor.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_floor.S Mon May 25 14:37:10 2009 (r192760) @@ -56,3 +56,4 @@ ENTRY(floor) leave ret +END(floor) Modified: head/lib/msun/i387/s_floorf.S ============================================================================== --- head/lib/msun/i387/s_floorf.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_floorf.S Mon May 25 14:37:10 2009 (r192760) @@ -27,3 +27,4 @@ ENTRY(floorf) leave ret +END(floorf) Modified: head/lib/msun/i387/s_floorl.S ============================================================================== --- head/lib/msun/i387/s_floorl.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_floorl.S Mon May 25 14:37:10 2009 (r192760) @@ -25,3 +25,4 @@ ENTRY(floorl) leave ret +END(floorl) Modified: head/lib/msun/i387/s_llrint.S ============================================================================== --- head/lib/msun/i387/s_llrint.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_llrint.S Mon May 25 14:37:10 2009 (r192760) @@ -34,3 +34,4 @@ ENTRY(llrint) popl %eax popl %edx ret +END(llrint) Modified: head/lib/msun/i387/s_llrintf.S ============================================================================== --- head/lib/msun/i387/s_llrintf.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_llrintf.S Mon May 25 14:37:10 2009 (r192760) @@ -34,3 +34,4 @@ ENTRY(llrintf) popl %eax popl %edx ret +END(llrintf) Modified: head/lib/msun/i387/s_logb.S ============================================================================== --- head/lib/msun/i387/s_logb.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_logb.S Mon May 25 14:37:10 2009 (r192760) @@ -42,3 +42,4 @@ ENTRY(logb) fxtract fstp %st ret +END(logb) Modified: head/lib/msun/i387/s_logbf.S ============================================================================== --- head/lib/msun/i387/s_logbf.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_logbf.S Mon May 25 14:37:10 2009 (r192760) @@ -13,3 +13,4 @@ ENTRY(logbf) fxtract fstp %st ret +END(logbf) Modified: head/lib/msun/i387/s_lrint.S ============================================================================== --- head/lib/msun/i387/s_lrint.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_lrint.S Mon May 25 14:37:10 2009 (r192760) @@ -33,3 +33,4 @@ ENTRY(lrint) fistpl (%esp) popl %eax ret +END(lrint) Modified: head/lib/msun/i387/s_lrintf.S ============================================================================== --- head/lib/msun/i387/s_lrintf.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_lrintf.S Mon May 25 14:37:10 2009 (r192760) @@ -33,3 +33,4 @@ ENTRY(lrintf) fistpl (%esp) popl %eax ret +END(lrintf) Modified: head/lib/msun/i387/s_remquo.S ============================================================================== --- head/lib/msun/i387/s_remquo.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_remquo.S Mon May 25 14:37:10 2009 (r192760) @@ -60,3 +60,4 @@ ENTRY(remquo) movl 20(%esp),%ecx movl %eax,(%ecx) ret +END(remquo) Modified: head/lib/msun/i387/s_remquof.S ============================================================================== --- head/lib/msun/i387/s_remquof.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_remquof.S Mon May 25 14:37:10 2009 (r192760) @@ -60,3 +60,4 @@ ENTRY(remquof) movl 12(%esp),%ecx movl %eax,(%ecx) ret +END(remquof) Modified: head/lib/msun/i387/s_rint.S ============================================================================== --- head/lib/msun/i387/s_rint.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_rint.S Mon May 25 14:37:10 2009 (r192760) @@ -41,3 +41,4 @@ ENTRY(rint) fldl 4(%esp) frndint ret +END(rint) Modified: head/lib/msun/i387/s_rintf.S ============================================================================== --- head/lib/msun/i387/s_rintf.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_rintf.S Mon May 25 14:37:10 2009 (r192760) @@ -12,3 +12,4 @@ ENTRY(rintf) flds 4(%esp) frndint ret +END(rintf) Modified: head/lib/msun/i387/s_scalbn.S ============================================================================== --- head/lib/msun/i387/s_scalbn.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_scalbn.S Mon May 25 14:37:10 2009 (r192760) @@ -43,3 +43,4 @@ ENTRY(scalbn) fscale fstp %st(1) ret +END(scalbn) Modified: head/lib/msun/i387/s_scalbnf.S ============================================================================== --- head/lib/msun/i387/s_scalbnf.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_scalbnf.S Mon May 25 14:37:10 2009 (r192760) @@ -14,6 +14,7 @@ ENTRY(scalbnf) fscale fstp %st(1) /* bug fix for fp stack overflow */ ret +END(scalbnf) .globl CNAME(ldexpf) .set CNAME(ldexpf),CNAME(scalbnf) Modified: head/lib/msun/i387/s_scalbnl.S ============================================================================== --- head/lib/msun/i387/s_scalbnl.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_scalbnl.S Mon May 25 14:37:10 2009 (r192760) @@ -14,6 +14,7 @@ ENTRY(scalbnl) fscale fstp %st(1) ret +END(scalbnl) .globl CNAME(ldexpl) .set CNAME(ldexpl),CNAME(scalbnl) Modified: head/lib/msun/i387/s_significand.S ============================================================================== --- head/lib/msun/i387/s_significand.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_significand.S Mon May 25 14:37:10 2009 (r192760) @@ -42,3 +42,4 @@ ENTRY(significand) fxtract fstp %st(1) ret +END(significand) Modified: head/lib/msun/i387/s_significandf.S ============================================================================== --- head/lib/msun/i387/s_significandf.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_significandf.S Mon May 25 14:37:10 2009 (r192760) @@ -13,3 +13,4 @@ ENTRY(significandf) fxtract fstp %st(1) ret +END(significandf) Modified: head/lib/msun/i387/s_sin.S ============================================================================== --- head/lib/msun/i387/s_sin.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_sin.S Mon May 25 14:37:10 2009 (r192760) @@ -54,3 +54,4 @@ ENTRY(sin) fstp %st(1) fsin ret +END(sin) Modified: head/lib/msun/i387/s_tan.S ============================================================================== --- head/lib/msun/i387/s_tan.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_tan.S Mon May 25 14:37:10 2009 (r192760) @@ -56,3 +56,4 @@ ENTRY(tan) fptan fstp %st(0) ret +END(tan) Modified: head/lib/msun/i387/s_trunc.S ============================================================================== --- head/lib/msun/i387/s_trunc.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_trunc.S Mon May 25 14:37:10 2009 (r192760) @@ -24,3 +24,4 @@ ENTRY(trunc) leave ret +END(trunc) Modified: head/lib/msun/i387/s_truncf.S ============================================================================== --- head/lib/msun/i387/s_truncf.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_truncf.S Mon May 25 14:37:10 2009 (r192760) @@ -24,3 +24,4 @@ ENTRY(truncf) leave ret +END(truncf) Modified: head/lib/msun/i387/s_truncl.S ============================================================================== --- head/lib/msun/i387/s_truncl.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/i387/s_truncl.S Mon May 25 14:37:10 2009 (r192760) @@ -24,3 +24,4 @@ ENTRY(truncl) leave ret +END(truncl) Modified: head/lib/msun/ia64/s_fma.S ============================================================================== --- head/lib/msun/ia64/s_fma.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/ia64/s_fma.S Mon May 25 14:37:10 2009 (r192760) @@ -32,3 +32,4 @@ ENTRY(fma, 3) fma.d f8 = f8, f9, f10 br.ret.sptk b0 } +END(fma) Modified: head/lib/msun/ia64/s_fmaf.S ============================================================================== --- head/lib/msun/ia64/s_fmaf.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/ia64/s_fmaf.S Mon May 25 14:37:10 2009 (r192760) @@ -32,3 +32,4 @@ ENTRY(fmaf, 3) fma.s f8 = f8, f9, f10 br.ret.sptk b0 } +END(fmaf) Modified: head/lib/msun/ia64/s_fmal.S ============================================================================== --- head/lib/msun/ia64/s_fmal.S Mon May 25 14:36:21 2009 (r192759) +++ head/lib/msun/ia64/s_fmal.S Mon May 25 14:37:10 2009 (r192760) @@ -32,3 +32,4 @@ ENTRY(fmal, 3) fma f8 = f8, f9, f10 br.ret.sptk b0 } +END(fmal) Modified: head/tools/KSE/ksetest/kse_asm.S ============================================================================== --- head/tools/KSE/ksetest/kse_asm.S Mon May 25 14:36:21 2009 (r192759) +++ head/tools/KSE/ksetest/kse_asm.S Mon May 25 14:37:10 2009 (r192760) @@ -99,6 +99,7 @@ ENTRY(uts_to_thread) pop %ebx /* %ebx off stack */ popf /* flags off stack */ 5: ret /* %eip off stack */ +END(uts_to_thread) /* * int thread_to_uts(struct kse_thr_mailbox *tm, struct kse_mailbox *km); @@ -154,4 +155,5 @@ ENTRY(thread_to_uts) pushl KM_FUNC_OFFSET(%edx) /* .. the uts can return to itself */ pushl KM_FUNC_OFFSET(%edx) /* push the address of the uts func */ 2: ret +END(thread_to_uts) Modified: head/tools/KSE/rr/kse_asm.S ============================================================================== --- head/tools/KSE/rr/kse_asm.S Mon May 25 14:36:21 2009 (r192759) +++ head/tools/KSE/rr/kse_asm.S Mon May 25 14:37:10 2009 (r192760) @@ -99,6 +99,7 @@ ENTRY(uts_to_thread) pop %ebx /* %ebx off stack */ popf /* flags off stack */ 5: ret /* %eip off stack */ +END(uts_to_thread) /* * int thread_to_uts(struct kse_thr_mailbox *tm, struct kse_mailbox *km); @@ -154,4 +155,5 @@ ENTRY(thread_to_uts) pushl KM_FUNC_OFFSET(%edx) /* .. the uts can return to itself */ pushl KM_FUNC_OFFSET(%edx) /* push the address of the uts func */ 2: ret +END(thread_to_uts) From owner-svn-src-head@FreeBSD.ORG Mon May 25 14:51:47 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C00BE106566C; Mon, 25 May 2009 14:51:47 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE1B18FC18; Mon, 25 May 2009 14:51:47 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4PEplhm026988; Mon, 25 May 2009 14:51:47 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4PEplVr026987; Mon, 25 May 2009 14:51:47 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200905251451.n4PEplVr026987@svn.freebsd.org> From: Robert Watson Date: Mon, 25 May 2009 14:51:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192761 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 14:51:48 -0000 Author: rwatson Date: Mon May 25 14:51:47 2009 New Revision: 192761 URL: http://svn.freebsd.org/changeset/base/192761 Log: Remove comment about moving tcp_reass() to its own file named tcp_reass.c, that happened a while ago. MFC after: 3 days Modified: head/sys/netinet/tcp_reass.c Modified: head/sys/netinet/tcp_reass.c ============================================================================== --- head/sys/netinet/tcp_reass.c Mon May 25 14:37:10 2009 (r192760) +++ head/sys/netinet/tcp_reass.c Mon May 25 14:51:47 2009 (r192761) @@ -150,8 +150,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd /* * XXX: tcp_reass() is rather inefficient with its data structures - * and should be rewritten (see NetBSD for optimizations). While - * doing that it should move to its own file tcp_reass.c. + * and should be rewritten (see NetBSD for optimizations). */ /* From owner-svn-src-head@FreeBSD.ORG Mon May 25 15:48:11 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48079106566B; Mon, 25 May 2009 15:48:11 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 34BD48FC13; Mon, 25 May 2009 15:48:11 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4PFmAIK028147; Mon, 25 May 2009 15:48:10 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4PFmAMX028145; Mon, 25 May 2009 15:48:10 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200905251548.n4PFmAMX028145@svn.freebsd.org> From: Rick Macklem Date: Mon, 25 May 2009 15:48:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192762 - head/usr.bin/nfsstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 15:48:11 -0000 Author: rmacklem Date: Mon May 25 15:48:10 2009 New Revision: 192762 URL: http://svn.freebsd.org/changeset/base/192762 Log: Add the "-4" option to nfsstat, so that it will reports stats for the experimental nfs subsystem when that option is specified. Approved by: kib (mentor) Modified: head/usr.bin/nfsstat/nfsstat.1 head/usr.bin/nfsstat/nfsstat.c Modified: head/usr.bin/nfsstat/nfsstat.1 ============================================================================== --- head/usr.bin/nfsstat/nfsstat.1 Mon May 25 14:51:47 2009 (r192761) +++ head/usr.bin/nfsstat/nfsstat.1 Mon May 25 15:48:10 2009 (r192762) @@ -42,7 +42,7 @@ statistics .Sh SYNOPSIS .Nm -.Op Fl cszW +.Op Fl cszW4 .Op Fl M Ar core .Op Fl N Ar system .Op Fl w Ar wait @@ -82,6 +82,10 @@ activity for both the client and server second intervals. .It Fl z Reset statistics after displaying them. +(Not currently supported by the experimental nfs subsystem.) +.It Fl 4 +Gather statistics from the experimental nfs subsystem that includes +support for NFSv4 instead of the regular nfs subsystem. .El .Sh FILES .Bl -tag -width ".Pa /boot/kernel/kernel" -compact @@ -97,6 +101,7 @@ default memory file .Xr systat 1 , .Xr sysctl 3 , .Xr iostat 8 , +.Xr nfsdumpstate 8 , .Xr pstat 8 , .Xr vmstat 8 .Sh HISTORY Modified: head/usr.bin/nfsstat/nfsstat.c ============================================================================== --- head/usr.bin/nfsstat/nfsstat.c Mon May 25 14:51:47 2009 (r192761) +++ head/usr.bin/nfsstat/nfsstat.c Mon May 25 15:48:10 2009 (r192762) @@ -56,6 +56,10 @@ static const char rcsid[] = #include #include #include +#include + +#include + #include #include #include @@ -82,6 +86,9 @@ kvm_t *kd; static int deadkernel = 0; static int widemode = 0; static int zflag = 0; +static int run_v4 = 0; +static int printtitle = 1; +static struct ext_nfsstats ext_nfsstats; void intpr(int, int); void printhdr(int, int); @@ -89,6 +96,8 @@ void sidewaysintpr(u_int, int, int); void usage(void); char *sperc1(int, int); char *sperc2(int, int); +void exp_intpr(int, int); +void exp_sidewaysintpr(u_int, int, int); #define DELTA(field) (nfsstats.field - lastst.field) @@ -104,7 +113,7 @@ main(int argc, char **argv) interval = 0; memf = nlistf = NULL; - while ((ch = getopt(argc, argv, "csWM:N:w:z")) != -1) + while ((ch = getopt(argc, argv, "csWM:N:w:z4")) != -1) switch(ch) { case 'M': memf = optarg; @@ -131,6 +140,9 @@ main(int argc, char **argv) case 'z': zflag = 1; break; + case '4': + run_v4 = 1; + break; case '?': default: usage(); @@ -149,7 +161,13 @@ main(int argc, char **argv) } } #endif - if (nlistf != NULL || memf != NULL) { + if (run_v4 != 0 && modfind("nfscommon") < 0) + errx(1, "experimental client/server not loaded"); + + if (run_v4 != 0) { + if (nfssvc(NFSSVC_GETSTATS, &ext_nfsstats) < 0) + err(1, "Can't get stats"); + } else if (nlistf != NULL || memf != NULL) { deadkernel = 1; if ((kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, @@ -161,10 +179,17 @@ main(int argc, char **argv) } } - if (interval) - sidewaysintpr(interval, clientOnly, serverOnly); - else - intpr(clientOnly, serverOnly); + if (interval) { + if (run_v4 > 0) + exp_sidewaysintpr(interval, clientOnly, serverOnly); + else + sidewaysintpr(interval, clientOnly, serverOnly); + } else { + if (run_v4 > 0) + exp_intpr(clientOnly, serverOnly); + else + intpr(clientOnly, serverOnly); + } exit(0); } @@ -517,3 +542,335 @@ sperc2(int ttl, int misses) return(p); } +/* + * Print a description of the nfs stats for the experimental client/server. + */ +void +exp_intpr(int clientOnly, int serverOnly) +{ + + if (clientOnly != 0) { + if (printtitle) { + printf("Client Info:\n"); + printf("Rpc Counts:\n"); + printf( + "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" + , "Getattr", "Setattr", "Lookup", "Readlink", + "Read", "Write", "Create", "Remove"); + } + printf("%9d %9d %9d %9d %9d %9d %9d %9d\n", + ext_nfsstats.rpccnt[NFSPROC_GETATTR], + ext_nfsstats.rpccnt[NFSPROC_SETATTR], + ext_nfsstats.rpccnt[NFSPROC_LOOKUP], + ext_nfsstats.rpccnt[NFSPROC_READLINK], + ext_nfsstats.rpccnt[NFSPROC_READ], + ext_nfsstats.rpccnt[NFSPROC_WRITE], + ext_nfsstats.rpccnt[NFSPROC_CREATE], + ext_nfsstats.rpccnt[NFSPROC_REMOVE]); + if (printtitle) + printf( + "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" + , "Rename", "Link", "Symlink", "Mkdir", "Rmdir", + "Readdir", "RdirPlus", "Access"); + printf("%9d %9d %9d %9d %9d %9d %9d %9d\n", + ext_nfsstats.rpccnt[NFSPROC_RENAME], + ext_nfsstats.rpccnt[NFSPROC_LINK], + ext_nfsstats.rpccnt[NFSPROC_SYMLINK], + ext_nfsstats.rpccnt[NFSPROC_MKDIR], + ext_nfsstats.rpccnt[NFSPROC_RMDIR], + ext_nfsstats.rpccnt[NFSPROC_READDIR], + ext_nfsstats.rpccnt[NFSPROC_READDIRPLUS], + ext_nfsstats.rpccnt[NFSPROC_ACCESS]); + if (printtitle) + printf( + "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" + , "Mknod", "Fsstat", "Fsinfo", "PathConf", + "Commit", "SetClId", "SetClIdCf", "Lock"); + printf("%9d %9d %9d %9d %9d %9d %9d %9d\n", + ext_nfsstats.rpccnt[NFSPROC_MKNOD], + ext_nfsstats.rpccnt[NFSPROC_FSSTAT], + ext_nfsstats.rpccnt[NFSPROC_FSINFO], + ext_nfsstats.rpccnt[NFSPROC_PATHCONF], + ext_nfsstats.rpccnt[NFSPROC_COMMIT], + ext_nfsstats.rpccnt[NFSPROC_SETCLIENTID], + ext_nfsstats.rpccnt[NFSPROC_SETCLIENTIDCFRM], + ext_nfsstats.rpccnt[NFSPROC_LOCK]); + if (printtitle) + printf("%9.9s %9.9s %9.9s %9.9s\n", + "LockT", "LockU", "Open", "OpenCfr"); + printf("%9d %9d %9d %9d\n", + ext_nfsstats.rpccnt[NFSPROC_LOCKT], + ext_nfsstats.rpccnt[NFSPROC_LOCKU], + ext_nfsstats.rpccnt[NFSPROC_OPEN], + ext_nfsstats.rpccnt[NFSPROC_OPENCONFIRM]); + if (printtitle) + printf( + "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" + , "OpenOwner", "Opens", "LockOwner", + "Locks", "Delegs", "LocalOwn", + "LocalOpen", "LocalLOwn"); + printf("%9d %9d %9d %9d %9d %9d %9d %9d\n", + ext_nfsstats.clopenowners, + ext_nfsstats.clopens, + ext_nfsstats.cllockowners, + ext_nfsstats.cllocks, + ext_nfsstats.cldelegates, + ext_nfsstats.cllocalopenowners, + ext_nfsstats.cllocalopens, + ext_nfsstats.cllocallockowners); + if (printtitle) + printf("%9.9s\n", "LocalLock"); + printf("%9d\n", ext_nfsstats.cllocallocks); + if (printtitle) { + printf("Rpc Info:\n"); + printf("%9.9s %9.9s %9.9s %9.9s %9.9s\n", + "TimedOut", "Invalid", "X Replies", "Retries", + "Requests"); + } + printf("%9d %9d %9d %9d %9d\n", + ext_nfsstats.rpctimeouts, + ext_nfsstats.rpcinvalid, + ext_nfsstats.rpcunexpected, + ext_nfsstats.rpcretries, + ext_nfsstats.rpcrequests); + if (printtitle) { + printf("Cache Info:\n"); + printf("%9.9s %9.9s %9.9s %9.9s", + "Attr Hits", "Misses", "Lkup Hits", "Misses"); + printf(" %9.9s %9.9s %9.9s %9.9s\n", + "BioR Hits", "Misses", "BioW Hits", "Misses"); + } + printf("%9d %9d %9d %9d", + ext_nfsstats.attrcache_hits, + ext_nfsstats.attrcache_misses, + ext_nfsstats.lookupcache_hits, + ext_nfsstats.lookupcache_misses); + printf(" %9d %9d %9d %9d\n", + ext_nfsstats.biocache_reads, + ext_nfsstats.read_bios, + ext_nfsstats.biocache_writes, + ext_nfsstats.write_bios); + if (printtitle) { + printf("%9.9s %9.9s %9.9s %9.9s", + "BioRLHits", "Misses", "BioD Hits", "Misses"); + printf(" %9.9s %9.9s\n", "DirE Hits", "Misses"); + } + printf("%9d %9d %9d %9d", + ext_nfsstats.biocache_readlinks, + ext_nfsstats.readlink_bios, + ext_nfsstats.biocache_readdirs, + ext_nfsstats.readdir_bios); + printf(" %9d %9d\n", + ext_nfsstats.direofcache_hits, + ext_nfsstats.direofcache_misses); + } + if (serverOnly != 0) { + if (printtitle) { + printf("\nServer Info:\n"); + printf( + "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" + , "Getattr", "Setattr", "Lookup", "Readlink", + "Read", "Write", "Create", "Remove"); + } + printf("%9d %9d %9d %9d %9d %9d %9d %9d\n", + ext_nfsstats.srvrpccnt[NFSV4OP_GETATTR], + ext_nfsstats.srvrpccnt[NFSV4OP_SETATTR], + ext_nfsstats.srvrpccnt[NFSV4OP_LOOKUP], + ext_nfsstats.srvrpccnt[NFSV4OP_READLINK], + ext_nfsstats.srvrpccnt[NFSV4OP_READ], + ext_nfsstats.srvrpccnt[NFSV4OP_WRITE], + ext_nfsstats.srvrpccnt[NFSV4OP_V3CREATE], + ext_nfsstats.srvrpccnt[NFSV4OP_REMOVE]); + if (printtitle) + printf( + "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" + , "Rename", "Link", "Symlink", "Mkdir", "Rmdir", + "Readdir", "RdirPlus", "Access"); + printf("%9d %9d %9d %9d %9d %9d %9d %9d\n", + ext_nfsstats.srvrpccnt[NFSV4OP_RENAME], + ext_nfsstats.srvrpccnt[NFSV4OP_LINK], + ext_nfsstats.srvrpccnt[NFSV4OP_SYMLINK], + ext_nfsstats.srvrpccnt[NFSV4OP_MKDIR], + ext_nfsstats.srvrpccnt[NFSV4OP_RMDIR], + ext_nfsstats.srvrpccnt[NFSV4OP_READDIR], + ext_nfsstats.srvrpccnt[NFSV4OP_READDIRPLUS], + ext_nfsstats.srvrpccnt[NFSV4OP_ACCESS]); + if (printtitle) + printf( + "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" + , "Mknod", "Fsstat", "Fsinfo", "PathConf", + "Commit", "LookupP", "SetClId", "SetClIdCf"); + printf("%9d %9d %9d %9d %9d %9d %9d %9d\n", + ext_nfsstats.srvrpccnt[NFSV4OP_MKNOD], + ext_nfsstats.srvrpccnt[NFSV4OP_FSSTAT], + ext_nfsstats.srvrpccnt[NFSV4OP_FSINFO], + ext_nfsstats.srvrpccnt[NFSV4OP_PATHCONF], + ext_nfsstats.srvrpccnt[NFSV4OP_COMMIT], + ext_nfsstats.srvrpccnt[NFSV4OP_LOOKUPP], + ext_nfsstats.srvrpccnt[NFSV4OP_SETCLIENTID], + ext_nfsstats.srvrpccnt[NFSV4OP_SETCLIENTIDCFRM]); + if (printtitle) + printf( + "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" + , "Open", "OpenAttr", "OpenDwnGr", "OpenCfrm", + "DelePurge", "DeleRet", "GetFH", "Lock"); + printf("%9d %9d %9d %9d %9d %9d %9d %9d\n", + ext_nfsstats.srvrpccnt[NFSV4OP_OPEN], + ext_nfsstats.srvrpccnt[NFSV4OP_OPENATTR], + ext_nfsstats.srvrpccnt[NFSV4OP_OPENDOWNGRADE], + ext_nfsstats.srvrpccnt[NFSV4OP_OPENCONFIRM], + ext_nfsstats.srvrpccnt[NFSV4OP_DELEGPURGE], + ext_nfsstats.srvrpccnt[NFSV4OP_DELEGRETURN], + ext_nfsstats.srvrpccnt[NFSV4OP_GETFH], + ext_nfsstats.srvrpccnt[NFSV4OP_LOCK]); + if (printtitle) + printf( + "%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n" + , "LockT", "LockU", "Close", "Verify", "NVerify", + "PutFH", "PutPubFH", "PutRootFH"); + printf("%9d %9d %9d %9d %9d %9d %9d %9d\n", + ext_nfsstats.srvrpccnt[NFSV4OP_LOCKT], + ext_nfsstats.srvrpccnt[NFSV4OP_LOCKU], + ext_nfsstats.srvrpccnt[NFSV4OP_CLOSE], + ext_nfsstats.srvrpccnt[NFSV4OP_VERIFY], + ext_nfsstats.srvrpccnt[NFSV4OP_NVERIFY], + ext_nfsstats.srvrpccnt[NFSV4OP_PUTFH], + ext_nfsstats.srvrpccnt[NFSV4OP_PUTPUBFH], + ext_nfsstats.srvrpccnt[NFSV4OP_PUTROOTFH]); + if (printtitle) + printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n", + "Renew", "RestoreFH", "SaveFH", "Secinfo", + "RelLckOwn", "V4Create"); + printf("%9d %9d %9d %9d %9d %9d\n", + ext_nfsstats.srvrpccnt[NFSV4OP_RENEW], + ext_nfsstats.srvrpccnt[NFSV4OP_RESTOREFH], + ext_nfsstats.srvrpccnt[NFSV4OP_SAVEFH], + ext_nfsstats.srvrpccnt[NFSV4OP_SECINFO], + ext_nfsstats.srvrpccnt[NFSV4OP_RELEASELCKOWN], + ext_nfsstats.srvrpccnt[NFSV4OP_CREATE]); + if (printtitle) { + printf("Server:\n"); + printf("%9.9s %9.9s %9.9s\n", + "Retfailed", "Faults", "Clients"); + } + printf("%9d %9d %9d\n", + ext_nfsstats.srv_errs, ext_nfsstats.srvrpc_errs, + ext_nfsstats.srvclients); + if (printtitle) + printf("%9.9s %9.9s %9.9s %9.9s %9.9s \n", + "OpenOwner", "Opens", "LockOwner", + "Locks", "Delegs"); + printf("%9d %9d %9d %9d %9d \n", + ext_nfsstats.srvopenowners, + ext_nfsstats.srvopens, + ext_nfsstats.srvlockowners, + ext_nfsstats.srvlocks, + ext_nfsstats.srvdelegates); + if (printtitle) { + printf("Server Cache Stats:\n"); + printf("%9.9s %9.9s %9.9s %9.9s %9.9s %9.9s\n", + "Inprog", "Idem", "Non-idem", "Misses", + "CacheSize", "TCPPeak"); + } + printf("%9d %9d %9d %9d %9d %9d\n", + ext_nfsstats.srvcache_inproghits, + ext_nfsstats.srvcache_idemdonehits, + ext_nfsstats.srvcache_nonidemdonehits, + ext_nfsstats.srvcache_misses, + ext_nfsstats.srvcache_size, + ext_nfsstats.srvcache_tcppeak); + } +} + +/* + * Print a running summary of nfs statistics for the experimental client and/or + * server. + * Repeat display every interval seconds, showing statistics + * collected over that interval. Assumes that interval is non-zero. + * First line printed at top of screen is always cumulative. + */ +void +exp_sidewaysintpr(u_int interval, int clientOnly, int serverOnly) +{ + struct ext_nfsstats nfsstats, lastst, *ext_nfsstatsp; + int hdrcnt = 1; + + ext_nfsstatsp = &lastst; + if (nfssvc(NFSSVC_GETSTATS, ext_nfsstatsp) < 0) + err(1, "Can't get stats"); + sleep(interval); + + for (;;) { + ext_nfsstatsp = &nfsstats; + if (nfssvc(NFSSVC_GETSTATS, ext_nfsstatsp) < 0) + err(1, "Can't get stats"); + + if (--hdrcnt == 0) { + printhdr(clientOnly, serverOnly); + if (clientOnly && serverOnly) + hdrcnt = 10; + else + hdrcnt = 20; + } + if (clientOnly) { + printf("%s %6d %6d %6d %6d %6d %6d %6d %6d", + ((clientOnly && serverOnly) ? "Client:" : ""), + DELTA(attrcache_hits) + DELTA(attrcache_misses), + DELTA(lookupcache_hits) + DELTA(lookupcache_misses), + DELTA(biocache_readlinks), + DELTA(biocache_reads), + DELTA(biocache_writes), + nfsstats.rpccnt[NFSPROC_RENAME] - + lastst.rpccnt[NFSPROC_RENAME], + DELTA(accesscache_hits) + DELTA(accesscache_misses), + DELTA(biocache_readdirs) + ); + if (widemode) { + printf(" %s %s %s %s %s %s", + sperc1(DELTA(attrcache_hits), + DELTA(attrcache_misses)), + sperc1(DELTA(lookupcache_hits), + DELTA(lookupcache_misses)), + sperc2(DELTA(biocache_reads), + DELTA(read_bios)), + sperc2(DELTA(biocache_writes), + DELTA(write_bios)), + sperc1(DELTA(accesscache_hits), + DELTA(accesscache_misses)), + sperc2(DELTA(biocache_readdirs), + DELTA(readdir_bios)) + ); + } + printf("\n"); + lastst = nfsstats; + } + if (serverOnly) { + printf("%s %6d %6d %6d %6d %6d %6d %6d %6d", + ((clientOnly && serverOnly) ? "Server:" : ""), + nfsstats.srvrpccnt[NFSPROC_GETATTR] - + lastst.srvrpccnt[NFSPROC_GETATTR], + nfsstats.srvrpccnt[NFSPROC_LOOKUP] - + lastst.srvrpccnt[NFSPROC_LOOKUP], + nfsstats.srvrpccnt[NFSPROC_READLINK] - + lastst.srvrpccnt[NFSPROC_READLINK], + nfsstats.srvrpccnt[NFSPROC_READ] - + lastst.srvrpccnt[NFSPROC_READ], + nfsstats.srvrpccnt[NFSPROC_WRITE] - + lastst.srvrpccnt[NFSPROC_WRITE], + nfsstats.srvrpccnt[NFSPROC_RENAME] - + lastst.srvrpccnt[NFSPROC_RENAME], + nfsstats.srvrpccnt[NFSPROC_ACCESS] - + lastst.srvrpccnt[NFSPROC_ACCESS], + (nfsstats.srvrpccnt[NFSPROC_READDIR] - + lastst.srvrpccnt[NFSPROC_READDIR]) + + (nfsstats.srvrpccnt[NFSPROC_READDIRPLUS] - + lastst.srvrpccnt[NFSPROC_READDIRPLUS])); + printf("\n"); + lastst = nfsstats; + } + fflush(stdout); + sleep(interval); + } + /*NOTREACHED*/ +} + From owner-svn-src-head@FreeBSD.ORG Mon May 25 16:34:35 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90A8A106564A; Mon, 25 May 2009 16:34:35 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7F84C8FC12; Mon, 25 May 2009 16:34:35 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4PGYZwJ029078; Mon, 25 May 2009 16:34:35 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4PGYZC4029076; Mon, 25 May 2009 16:34:35 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200905251634.n4PGYZC4029076@svn.freebsd.org> From: Sam Leffler Date: Mon, 25 May 2009 16:34:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192763 - in head/sys: net sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 16:34:36 -0000 Author: sam Date: Mon May 25 16:34:35 2009 New Revision: 192763 URL: http://svn.freebsd.org/changeset/base/192763 Log: rev bpf attach/detach event api to include the dlt Modified: head/sys/net/bpf.c head/sys/sys/eventhandler.h Modified: head/sys/net/bpf.c ============================================================================== --- head/sys/net/bpf.c Mon May 25 15:48:10 2009 (r192762) +++ head/sys/net/bpf.c Mon May 25 16:34:35 2009 (r192763) @@ -535,7 +535,7 @@ bpf_attachd(struct bpf_d *d, struct bpf_ bpf_bpfd_cnt++; BPFIF_UNLOCK(bp); - EVENTHANDLER_INVOKE(bpf_track, bp->bif_ifp, 1); + EVENTHANDLER_INVOKE(bpf_track, bp->bif_ifp, bp->bif_dlt, 1); } /* @@ -563,7 +563,7 @@ bpf_detachd(struct bpf_d *d) BPFD_UNLOCK(d); BPFIF_UNLOCK(bp); - EVENTHANDLER_INVOKE(bpf_track, ifp, 0); + EVENTHANDLER_INVOKE(bpf_track, ifp, bp->bif_dlt, 0); /* * Check if this descriptor had requested promiscuous mode. Modified: head/sys/sys/eventhandler.h ============================================================================== --- head/sys/sys/eventhandler.h Mon May 25 15:48:10 2009 (r192762) +++ head/sys/sys/eventhandler.h Mon May 25 16:34:35 2009 (r192763) @@ -184,7 +184,8 @@ EVENTHANDLER_DECLARE(vlan_unconfig, vlan /* BPF attach/detach events */ struct ifnet; -typedef void (*bpf_track_fn)(void *, struct ifnet *, int /* 1 =>'s attach */); +typedef void (*bpf_track_fn)(void *, struct ifnet *, int /* dlt */, + int /* 1 =>'s attach */); EVENTHANDLER_DECLARE(bpf_track, bpf_track_fn); /* From owner-svn-src-head@FreeBSD.ORG Mon May 25 16:35:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27FDE106564A; Mon, 25 May 2009 16:35:32 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 177838FC21; Mon, 25 May 2009 16:35:32 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4PGZVcG029141; Mon, 25 May 2009 16:35:31 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4PGZVhE029140; Mon, 25 May 2009 16:35:31 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200905251635.n4PGZVhE029140@svn.freebsd.org> From: Sam Leffler Date: Mon, 25 May 2009 16:35:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192764 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 16:35:32 -0000 Author: sam Date: Mon May 25 16:35:31 2009 New Revision: 192764 URL: http://svn.freebsd.org/changeset/base/192764 Log: do internal bpf tracking only for radiotap DLT's Modified: head/sys/net80211/ieee80211_freebsd.c Modified: head/sys/net80211/ieee80211_freebsd.c ============================================================================== --- head/sys/net80211/ieee80211_freebsd.c Mon May 25 16:34:35 2009 (r192763) +++ head/sys/net80211/ieee80211_freebsd.c Mon May 25 16:35:31 2009 (r192764) @@ -730,10 +730,10 @@ ieee80211_load_module(const char *modnam static eventhandler_tag wlan_bpfevent; static void -bpf_track(void *arg, struct ifnet *ifp, int attach) +bpf_track(void *arg, struct ifnet *ifp, int dlt, int attach) { /* NB: identify vap's by if_start */ - if (ifp->if_start == ieee80211_start) { + if (dlt == DLT_IEEE802_11_RADIO && ifp->if_start == ieee80211_start) { struct ieee80211vap *vap = ifp->if_softc; /* * Track bpf radiotap listener state. We mark the vap From owner-svn-src-head@FreeBSD.ORG Mon May 25 16:38:47 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8ED8110656CD; Mon, 25 May 2009 16:38:47 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7D5A88FC35; Mon, 25 May 2009 16:38:47 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4PGclhb029235; Mon, 25 May 2009 16:38:47 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4PGclq3029229; Mon, 25 May 2009 16:38:47 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200905251638.n4PGclq3029229@svn.freebsd.org> From: Sam Leffler Date: Mon, 25 May 2009 16:38:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192765 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 16:38:48 -0000 Author: sam Date: Mon May 25 16:38:47 2009 New Revision: 192765 URL: http://svn.freebsd.org/changeset/base/192765 Log: Fix handling of devices w/o radiotap support: o do not attach DLT_IEEE802_11_RADIO unless both tx and rx headers are present; this is assumed in the capture code paths o verify the above with asserts in ieee80211_radiotap_{rx,tx} o add missing checks for active taps before calling ieee80211_radiotap_rx Modified: head/sys/net80211/ieee80211_adhoc.c head/sys/net80211/ieee80211_hostap.c head/sys/net80211/ieee80211_monitor.c head/sys/net80211/ieee80211_radiotap.c head/sys/net80211/ieee80211_sta.c head/sys/net80211/ieee80211_wds.c Modified: head/sys/net80211/ieee80211_adhoc.c ============================================================================== --- head/sys/net80211/ieee80211_adhoc.c Mon May 25 16:35:31 2009 (r192764) +++ head/sys/net80211/ieee80211_adhoc.c Mon May 25 16:38:47 2009 (r192765) @@ -656,7 +656,7 @@ err: ifp->if_ierrors++; out: if (m != NULL) { - if (need_tap) + if (need_tap && ieee80211_radiotap_active_vap(vap)) ieee80211_radiotap_rx(vap, m); m_freem(m); } Modified: head/sys/net80211/ieee80211_hostap.c ============================================================================== --- head/sys/net80211/ieee80211_hostap.c Mon May 25 16:35:31 2009 (r192764) +++ head/sys/net80211/ieee80211_hostap.c Mon May 25 16:38:47 2009 (r192765) @@ -850,7 +850,7 @@ err: ifp->if_ierrors++; out: if (m != NULL) { - if (need_tap) + if (need_tap && ieee80211_radiotap_active_vap(vap)) ieee80211_radiotap_rx(vap, m); m_freem(m); } Modified: head/sys/net80211/ieee80211_monitor.c ============================================================================== --- head/sys/net80211/ieee80211_monitor.c Mon May 25 16:35:31 2009 (r192764) +++ head/sys/net80211/ieee80211_monitor.c Mon May 25 16:38:47 2009 (r192765) @@ -128,7 +128,8 @@ monitor_input(struct ieee80211_node *ni, { struct ieee80211vap *vap = ni->ni_vap; - ieee80211_radiotap_rx(vap, m); + if (ieee80211_radiotap_active_vap(vap)) + ieee80211_radiotap_rx(vap, m); m_freem(m); return -1; } Modified: head/sys/net80211/ieee80211_radiotap.c ============================================================================== --- head/sys/net80211/ieee80211_radiotap.c Mon May 25 16:35:31 2009 (r192764) +++ head/sys/net80211/ieee80211_radiotap.c Mon May 25 16:38:47 2009 (r192765) @@ -102,12 +102,12 @@ ieee80211_radiotap_vattach(struct ieee80 struct ieee80211com *ic = vap->iv_ic; struct ieee80211_radiotap_header *th = ic->ic_th; - KASSERT(th != NULL, ("no radiotap setup")); - - /* radiotap DLT for raw 802.11 frames */ - bpfattach2(vap->iv_ifp, DLT_IEEE802_11_RADIO, - sizeof(struct ieee80211_frame) + le16toh(th->it_len), - &vap->iv_rawbpf); + if (th != NULL && ic->ic_rh != NULL) { + /* radiotap DLT for raw 802.11 frames */ + bpfattach2(vap->iv_ifp, DLT_IEEE802_11_RADIO, + sizeof(struct ieee80211_frame) + le16toh(th->it_len), + &vap->iv_rawbpf); + } } void @@ -193,6 +193,7 @@ dispatch_radiotap(struct ieee80211vap *v void ieee80211_radiotap_tx(struct ieee80211vap *vap0, struct mbuf *m) { + KASSERT(vap0->iv_ic->ic_th != NULL, ("no tx radiotap header")); dispatch_radiotap(vap0, m, vap0->iv_ic->ic_th); } @@ -202,6 +203,7 @@ ieee80211_radiotap_tx(struct ieee80211va void ieee80211_radiotap_rx(struct ieee80211vap *vap0, struct mbuf *m) { + KASSERT(vap0->iv_ic->ic_rh != NULL, ("no rx radiotap header")); dispatch_radiotap(vap0, m, vap0->iv_ic->ic_rh); } Modified: head/sys/net80211/ieee80211_sta.c ============================================================================== --- head/sys/net80211/ieee80211_sta.c Mon May 25 16:35:31 2009 (r192764) +++ head/sys/net80211/ieee80211_sta.c Mon May 25 16:38:47 2009 (r192765) @@ -885,7 +885,7 @@ err: ifp->if_ierrors++; out: if (m != NULL) { - if (need_tap) + if (need_tap && ieee80211_radiotap_active_vap(vap)) ieee80211_radiotap_rx(vap, m); m_freem(m); } Modified: head/sys/net80211/ieee80211_wds.c ============================================================================== --- head/sys/net80211/ieee80211_wds.c Mon May 25 16:35:31 2009 (r192764) +++ head/sys/net80211/ieee80211_wds.c Mon May 25 16:38:47 2009 (r192765) @@ -797,7 +797,7 @@ err: ifp->if_ierrors++; out: if (m != NULL) { - if (need_tap) + if (need_tap && ieee80211_radiotap_active_vap(vap)) ieee80211_radiotap_rx(vap, m); m_freem(m); } From owner-svn-src-head@FreeBSD.ORG Mon May 25 17:06:24 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B70161065672; Mon, 25 May 2009 17:06:24 +0000 (UTC) (envelope-from markm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A5D568FC3E; Mon, 25 May 2009 17:06:24 +0000 (UTC) (envelope-from markm@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4PH6OFk029925; Mon, 25 May 2009 17:06:24 GMT (envelope-from markm@svn.freebsd.org) Received: (from markm@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4PH6Ovq029924; Mon, 25 May 2009 17:06:24 GMT (envelope-from markm@svn.freebsd.org) Message-Id: <200905251706.n4PH6Ovq029924@svn.freebsd.org> From: Mark Murray Date: Mon, 25 May 2009 17:06:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192766 - head/share/syscons/keymaps X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 17:06:25 -0000 Author: markm Date: Mon May 25 17:06:24 2009 New Revision: 192766 URL: http://svn.freebsd.org/changeset/base/192766 Log: Euro is missing With this I shall see it fixed Thank you for your time Modified: head/share/syscons/keymaps/uk.iso-ctrl.kbd Modified: head/share/syscons/keymaps/uk.iso-ctrl.kbd ============================================================================== --- head/share/syscons/keymaps/uk.iso-ctrl.kbd Mon May 25 16:38:47 2009 (r192765) +++ head/share/syscons/keymaps/uk.iso-ctrl.kbd Mon May 25 17:06:24 2009 (r192766) @@ -8,7 +8,7 @@ 002 '1' '!' nop nop '`' '`' nop nop O 003 '2' '"' nul nul '@' '@' nul nul O 004 '3' 163 nop nop '#' '#' nop nop O - 005 '4' '$' nop nop '4' '$' nop nop O + 005 '4' '$' 164 164 '4' '$' nop nop O 006 '5' '%' nop nop '5' '%' nop nop O 007 '6' '^' rs rs '^' '^' rs rs O 008 '7' '&' nop nop '[' '[' esc esc O From owner-svn-src-head@FreeBSD.ORG Mon May 25 20:07:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 08530106566B; Mon, 25 May 2009 20:07:42 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB0E48FC0C; Mon, 25 May 2009 20:07:41 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4PK7fl1033486; Mon, 25 May 2009 20:07:41 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4PK7fC1033485; Mon, 25 May 2009 20:07:41 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200905252007.n4PK7fC1033485@svn.freebsd.org> From: Ed Schouten Date: Mon, 25 May 2009 20:07:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192768 - head/usr.bin/kdump X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 20:07:42 -0000 Author: ed Date: Mon May 25 20:07:41 2009 New Revision: 192768 URL: http://svn.freebsd.org/changeset/base/192768 Log: Fix kdump build when building it by hand. I don't entirely like this approach, but it will only be temporarily, namely until we get rid of COMPAT_43TTY. I do want to cause a compiler error when included, because it's just there for binary compatibility. Reported by: Andrzej Tobola Modified: head/usr.bin/kdump/mkioctls Modified: head/usr.bin/kdump/mkioctls ============================================================================== --- head/usr.bin/kdump/mkioctls Mon May 25 19:55:00 2009 (r192767) +++ head/usr.bin/kdump/mkioctls Mon May 25 20:07:41 2009 (r192768) @@ -32,7 +32,7 @@ ioctl_includes=` ` awk -v x="$ioctl_includes" 'BEGIN {print x}' | - gcc -E -I$1 -dM - | + gcc -E -I$1 -dM -DCOMPAT_43TTY - | awk -v ioctl_includes="$ioctl_includes" -v use_switch="$use_switch" ' BEGIN { print "/* XXX obnoxious prerequisites. */" From owner-svn-src-head@FreeBSD.ORG Mon May 25 21:27:31 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79D0C106566C; Mon, 25 May 2009 21:27:31 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E5F48FC1B; Mon, 25 May 2009 21:27:31 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4PLRVGB036013; Mon, 25 May 2009 21:27:31 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4PLRVq2036012; Mon, 25 May 2009 21:27:31 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <200905252127.n4PLRVq2036012@svn.freebsd.org> From: Brian Somers Date: Mon, 25 May 2009 21:27:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192772 - head/sbin/fdisk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 21:27:32 -0000 Author: brian Date: Mon May 25 21:27:31 2009 New Revision: 192772 URL: http://svn.freebsd.org/changeset/base/192772 Log: Bump the document date to reflect the 'p' command enhancements. Suggested by: trhodes Modified: head/sbin/fdisk/fdisk.8 Modified: head/sbin/fdisk/fdisk.8 ============================================================================== --- head/sbin/fdisk/fdisk.8 Mon May 25 21:12:49 2009 (r192771) +++ head/sbin/fdisk/fdisk.8 Mon May 25 21:27:31 2009 (r192772) @@ -1,6 +1,6 @@ .\" $FreeBSD$ .\" -.Dd April 30, 2007 +.Dd May 24, 2009 .Dt FDISK 8 .Os .Sh NAME From owner-svn-src-head@FreeBSD.ORG Mon May 25 21:29:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DFE0106564A; Mon, 25 May 2009 21:29:06 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 523848FC19; Mon, 25 May 2009 21:29:06 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4PLT6p0036228; Mon, 25 May 2009 21:29:06 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4PLT6Z9036227; Mon, 25 May 2009 21:29:06 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <200905252129.n4PLT6Z9036227@svn.freebsd.org> From: Brian Somers Date: Mon, 25 May 2009 21:29:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192773 - head/usr.bin/sed X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 21:29:07 -0000 Author: brian Date: Mon May 25 21:29:06 2009 New Revision: 192773 URL: http://svn.freebsd.org/changeset/base/192773 Log: Bump the document date to reflect the recent address range enhancements. Suggested by: throdes Modified: head/usr.bin/sed/sed.1 Modified: head/usr.bin/sed/sed.1 ============================================================================== --- head/usr.bin/sed/sed.1 Mon May 25 21:27:31 2009 (r192772) +++ head/usr.bin/sed/sed.1 Mon May 25 21:29:06 2009 (r192773) @@ -31,7 +31,7 @@ .\" @(#)sed.1 8.2 (Berkeley) 12/30/93 .\" $FreeBSD$ .\" -.Dd August 24, 2008 +.Dd May 24, 2009 .Dt SED 1 .Os .Sh NAME From owner-svn-src-head@FreeBSD.ORG Mon May 25 22:50:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 721171065670; Mon, 25 May 2009 22:50:12 +0000 (UTC) (envelope-from markm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4650B8FC16; Mon, 25 May 2009 22:50:12 +0000 (UTC) (envelope-from markm@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4PMoCVr038299; Mon, 25 May 2009 22:50:12 GMT (envelope-from markm@svn.freebsd.org) Received: (from markm@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4PMoCRt038297; Mon, 25 May 2009 22:50:12 GMT (envelope-from markm@svn.freebsd.org) Message-Id: <200905252250.n4PMoCRt038297@svn.freebsd.org> From: Mark Murray Date: Mon, 25 May 2009 22:50:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192774 - head/sys/dev/random X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 22:50:12 -0000 Author: markm Date: Mon May 25 22:50:11 2009 New Revision: 192774 URL: http://svn.freebsd.org/changeset/base/192774 Log: There is rubbish here It is time to take it out Now it is cleaner Modified: head/sys/dev/random/nehemiah.c head/sys/dev/random/randomdev_soft.c Modified: head/sys/dev/random/nehemiah.c ============================================================================== --- head/sys/dev/random/nehemiah.c Mon May 25 21:29:06 2009 (r192773) +++ head/sys/dev/random/nehemiah.c Mon May 25 22:50:11 2009 (r192774) @@ -129,7 +129,7 @@ random_nehemiah_init(void) { acw.raw = 0ULL; acw.field.round_count = 12; - + mtx_init(&random_nehemiah_mtx, "random nehemiah", NULL, MTX_DEF); } Modified: head/sys/dev/random/randomdev_soft.c ============================================================================== --- head/sys/dev/random/randomdev_soft.c Mon May 25 21:29:06 2009 (r192773) +++ head/sys/dev/random/randomdev_soft.c Mon May 25 22:50:11 2009 (r192774) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2000-2004 Mark R V Murray + * Copyright (c) 2000-2009 Mark R V Murray * Copyright (c) 2004 Robert N. M. Watson * All rights reserved. * @@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$"); #define RANDOM_FIFO_MAX 256 /* How many events to queue up */ static void random_kthread(void *); -static void +static void random_harvest_internal(u_int64_t, const void *, u_int, u_int, u_int, enum esource); static int random_yarrow_poll(int event,struct thread *td); @@ -235,7 +235,7 @@ random_kthread(void *arg __unused) { STAILQ_HEAD(, harvest) local_queue; struct harvest *event = NULL; - int active, local_count; + int local_count; enum esource source; STAILQ_INIT(&local_queue); @@ -244,8 +244,6 @@ random_kthread(void *arg __unused) /* Process until told to stop */ for (; random_kthread_control >= 0;) { - active = 0; - /* Cycle through all the entropy sources */ mtx_lock_spin(&harvest_mtx); for (source = RANDOM_START; source < ENTROPYSOURCE; source++) { @@ -284,9 +282,8 @@ random_kthread(void *arg __unused) if (random_kthread_control == 1) random_kthread_control = 0; - /* Found nothing, so don't belabour the issue */ - if (!active) - pause("-", hz / 10); + /* Work done, so don't belabour the issue */ + pause("-", hz / 10); } @@ -381,7 +378,7 @@ random_yarrow_poll(int events, struct th revents = events & (POLLIN | POLLRDNORM); else selrecord(td, &random_systat.rsel); - + mtx_unlock(&random_reseed_mtx); return revents; } @@ -407,7 +404,7 @@ random_yarrow_block(int flag) mtx_unlock(&random_reseed_mtx); return error; -} +} /* Helper routine to perform explicit reseeds */ static void From owner-svn-src-head@FreeBSD.ORG Mon May 25 23:06:47 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 35D4B106566C; Mon, 25 May 2009 23:06:47 +0000 (UTC) (envelope-from markm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 24BA08FC19; Mon, 25 May 2009 23:06:47 +0000 (UTC) (envelope-from markm@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4PN6l1j038717; Mon, 25 May 2009 23:06:47 GMT (envelope-from markm@svn.freebsd.org) Received: (from markm@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4PN6ltN038716; Mon, 25 May 2009 23:06:47 GMT (envelope-from markm@svn.freebsd.org) Message-Id: <200905252306.n4PN6ltN038716@svn.freebsd.org> From: Mark Murray Date: Mon, 25 May 2009 23:06:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192775 - head/share/misc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 23:06:47 -0000 Author: markm Date: Mon May 25 23:06:46 2009 New Revision: 192775 URL: http://svn.freebsd.org/changeset/base/192775 Log: I have been here long The duration I know not I tell what I can Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Mon May 25 22:50:11 2009 (r192774) +++ head/share/misc/committers-src.dot Mon May 25 23:06:46 2009 (r192775) @@ -127,6 +127,7 @@ linimon [label="Mark Linimon\nlinimon@Fr lstewart [label="Lawrence Stewart\nlstewart@FreeBSD.org\n2008/10/06"] lulf [label="Ulf Lilleengen\nlulf@FreeBSD.org\n2007/10/24"] marcel [label="Marcel Moolenaar\nmarcel@FreeBSD.org\n1999/07/03"] +markm [label="Mark Murray\nmarkm@FreeBSD.org\n199?/??/??"] marks [label="Mark Santcroos\nmarks@FreeBSD.org\n2004/03/18"] markus [label="Markus Brueffer\nmarkus@FreeBSD.org\n2006/06/01"] matteo [label="Matteo Riondato\nmatteo@FreeBSD.org\n2006/01/18"] @@ -344,6 +345,8 @@ marcel -> arun marcel -> marius marcel -> nwhitehorn +markm -> sheldonh + mdodd -> jake mlaier -> benjsc @@ -378,6 +381,8 @@ philip -> matteo pjd -> lulf +rgrimes -> markm + rpaulo -> avg ru -> ceri From owner-svn-src-head@FreeBSD.ORG Tue May 26 00:07:02 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89CE5106564A; Tue, 26 May 2009 00:07:02 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 790348FC14; Tue, 26 May 2009 00:07:02 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4Q072r6040448; Tue, 26 May 2009 00:07:02 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4Q072JS040447; Tue, 26 May 2009 00:07:02 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200905260007.n4Q072JS040447@svn.freebsd.org> From: Doug Barton Date: Tue, 26 May 2009 00:07:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192776 - in head/libexec: . makekey X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 00:07:03 -0000 Author: dougb Date: Tue May 26 00:07:02 2009 New Revision: 192776 URL: http://svn.freebsd.org/changeset/base/192776 Log: Per the man page: The makekey utility has been deprecated and will be removed in a future release of FreeBSD. Actually removing it was approved back on 10/29/2007 by re (kensmith) but I dropped the ball on actually removing it. It's doubtful that it's become more relevant/useful in the intervening time. Deleted: head/libexec/makekey/ Modified: head/libexec/Makefile Modified: head/libexec/Makefile ============================================================================== --- head/libexec/Makefile Mon May 25 23:06:46 2009 (r192775) +++ head/libexec/Makefile Tue May 26 00:07:02 2009 (r192776) @@ -11,7 +11,6 @@ SUBDIR= ${_atrun} \ getty \ lukemftpd \ ${_mail.local} \ - makekey \ ${_mknetid} \ ${_pppoed} \ rbootd \ From owner-svn-src-head@FreeBSD.ORG Tue May 26 01:09:34 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 141811065686; Tue, 26 May 2009 01:09:34 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DCB4F8FC1F; Tue, 26 May 2009 01:09:33 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4Q19XQa041835; Tue, 26 May 2009 01:09:33 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4Q19Xl0041834; Tue, 26 May 2009 01:09:33 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200905260109.n4Q19Xl0041834@svn.freebsd.org> From: Rick Macklem Date: Tue, 26 May 2009 01:09:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192780 - head/sys/fs/nfsserver X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 01:09:34 -0000 Author: rmacklem Date: Tue May 26 01:09:33 2009 New Revision: 192780 URL: http://svn.freebsd.org/changeset/base/192780 Log: Fix the experimental nfs server's interface to the new krpc so that it handles the case of a non-exported NFSv4 root correctly. Also, delete handling for the case where nd_repstat is already set in nfs_proc(), since that no longer happens. Approved by: kib (mentor) Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdkrpc.c Tue May 26 00:23:03 2009 (r192779) +++ head/sys/fs/nfsserver/nfs_nfsdkrpc.c Tue May 26 01:09:33 2009 (r192780) @@ -210,8 +210,15 @@ nfssvc_program(struct svc_req *rqst, SVC #ifdef MAC mac_cred_associate_nfsd(nd.nd_cred); #endif - if ((nd.nd_flag & ND_NFSV4)) + if ((nd.nd_flag & ND_NFSV4) != 0) { nd.nd_repstat = nfsvno_v4rootexport(&nd); + if (nd.nd_repstat != 0) { + svcerr_weakauth(rqst); + svc_freereq(rqst); + m_freem(nd.nd_mrep); + return; + } + } cacherep = nfs_proc(&nd, rqst->rq_xid, xprt->xp_socket, xprt->xp_sockref, &rp); @@ -272,22 +279,17 @@ nfs_proc(struct nfsrv_descript *nd, u_in NFSGETTIME(&nd->nd_starttime); /* - * Several cases: + * Two cases: * 1 - For NFSv2 over UDP, if we are near our malloc/mget * limit, just drop the request. There is no * NFSERR_RESOURCE or NFSERR_DELAY for NFSv2 and the * client will timeout/retry over UDP in a little while. - * 2 - nd_repstat set to some error, so generate the reply now. - * 3 - nd_repstat == 0 && nd_mreq == NULL, which + * 2 - nd_repstat == 0 && nd_mreq == NULL, which * means a normal nfs rpc, so check the cache */ if ((nd->nd_flag & ND_NFSV2) && nd->nd_nam2 != NULL && nfsrv_mallocmget_limit()) { cacherep = RC_DROPIT; - } else if (nd->nd_repstat) { - cacherep = RC_REPLY; - if ((nd->nd_flag & ND_NFSV4) == 0) - panic("nfs_repstat for nfsv2,3"); } else { /* * For NFSv3, play it safe and assume that the client is @@ -315,9 +317,6 @@ nfs_proc(struct nfsrv_descript *nd, u_in else cacherep = RC_REPLY; *rpp = nfsrvd_updatecache(nd, so); - } else if (cacherep == RC_REPLY) { - /* Generate the error reply message for NFSv4 */ - nfsrvd_dorpc(nd, isdgram, td); } return (cacherep); } From owner-svn-src-head@FreeBSD.ORG Tue May 26 01:16:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 279ED1065674; Tue, 26 May 2009 01:16:10 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 169018FC1F; Tue, 26 May 2009 01:16:10 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4Q1G9dl042055; Tue, 26 May 2009 01:16:09 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4Q1G9Z1042053; Tue, 26 May 2009 01:16:09 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200905260116.n4Q1G9Z1042053@svn.freebsd.org> From: Rick Macklem Date: Tue, 26 May 2009 01:16:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192781 - in head/sys/fs: nfs nfsserver X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 01:16:10 -0000 Author: rmacklem Date: Tue May 26 01:16:09 2009 New Revision: 192781 URL: http://svn.freebsd.org/changeset/base/192781 Log: Fix the handling of NFSv4 Illegal Operation number to conform to RFC3530 (the operation number in the reply must be set to the value for OP_ILLEGAL). Also cleaned up some indentation. Approved by: kib (mentor) Modified: head/sys/fs/nfs/nfsport.h head/sys/fs/nfsserver/nfs_nfsdsocket.c Modified: head/sys/fs/nfs/nfsport.h ============================================================================== --- head/sys/fs/nfs/nfsport.h Tue May 26 01:09:33 2009 (r192780) +++ head/sys/fs/nfs/nfsport.h Tue May 26 01:16:09 2009 (r192781) @@ -235,6 +235,9 @@ */ #define NFSV4OP_NOPS 40 +/* Quirky case if the illegal op code */ +#define NFSV4OP_OPILLEGAL 10044 + /* * Fake NFSV4OP_xxx used for nfsstat. Start at NFSV4OP_NOPS. */ Modified: head/sys/fs/nfsserver/nfs_nfsdsocket.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdsocket.c Tue May 26 01:09:33 2009 (r192780) +++ head/sys/fs/nfsserver/nfs_nfsdsocket.c Tue May 26 01:16:09 2009 (r192781) @@ -639,13 +639,16 @@ nfsrvd_compound(struct nfsrv_descript *n for (i = 0; i < numops; i++) { NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); NFSM_BUILD(repp, u_int32_t *, 2 * NFSX_UNSIGNED); - *repp++ = *tl; + *repp = *tl; op = fxdr_unsigned(int, *tl); if (op < NFSV4OP_ACCESS || op >= NFSV4OP_NOPS) { - nd->nd_repstat = NFSERR_OPILLEGAL; - *repp = nfsd_errmap(nd); - retops++; - break; + nd->nd_repstat = NFSERR_OPILLEGAL; + *repp++ = txdr_unsigned(NFSV4OP_OPILLEGAL); + *repp = nfsd_errmap(nd); + retops++; + break; + } else { + repp++; } /* @@ -682,12 +685,12 @@ nfsrvd_compound(struct nfsrv_descript *n nd->nd_repstat = NFSERR_RESOURCE; *repp = nfsd_errmap(nd); if (op == NFSV4OP_SETATTR) { - /* - * Setattr replies require a bitmap. - * even for errors like these. - */ - NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); - *tl = 0; + /* + * Setattr replies require a bitmap. + * even for errors like these. + */ + NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); + *tl = 0; } retops++; break; From owner-svn-src-head@FreeBSD.ORG Tue May 26 01:47:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E6B4106564A; Tue, 26 May 2009 01:47:38 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 12EA98FC0C; Tue, 26 May 2009 01:47:38 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4Q1lbl3042672; Tue, 26 May 2009 01:47:37 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4Q1lbf8042671; Tue, 26 May 2009 01:47:37 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200905260147.n4Q1lbf8042671@svn.freebsd.org> From: Rick Macklem Date: Tue, 26 May 2009 01:47:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192782 - head/sys/fs/nfsserver X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 01:47:38 -0000 Author: rmacklem Date: Tue May 26 01:47:37 2009 New Revision: 192782 URL: http://svn.freebsd.org/changeset/base/192782 Log: Add two sysctl variables to the experimental nfs server, so that the range of versions of NFS handled by the server can be limited. The nfsd daemon must be restarted after these sysctl variables are changed, in order for the change to take effect. Approved by: kib (mentor) Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdkrpc.c Tue May 26 01:16:09 2009 (r192781) +++ head/sys/fs/nfsserver/nfs_nfsdkrpc.c Tue May 26 01:47:37 2009 (r192782) @@ -82,6 +82,14 @@ SYSCTL_INT(_vfs_newnfs, OID_AUTO, nfs_pr &nfs_privport, 0, "Only allow clients using a privileged port for NFSv2 and 3"); +static int nfs_minvers = NFS_VER2; +SYSCTL_INT(_vfs_newnfs, OID_AUTO, server_min_nfsvers, CTLFLAG_RW, + &nfs_minvers, 0, "The lowest version of NFS handled by the server"); + +static int nfs_maxvers = NFS_VER4; +SYSCTL_INT(_vfs_newnfs, OID_AUTO, server_max_nfsvers, CTLFLAG_RW, + &nfs_maxvers, 0, "The highest version of NFS handled by the server"); + static int nfs_proc(struct nfsrv_descript *, u_int32_t, struct socket *, u_int64_t, struct nfsrvcache **); @@ -353,9 +361,15 @@ nfsrvd_addsock(struct file *fp) fp->f_ops = &badfileops; fp->f_data = NULL; xprt->xp_sockref = ++sockref; - svc_reg(xprt, NFS_PROG, NFS_VER2, nfssvc_program, NULL); - svc_reg(xprt, NFS_PROG, NFS_VER3, nfssvc_program, NULL); - svc_reg(xprt, NFS_PROG, NFS_VER4, nfssvc_program, NULL); + if (nfs_minvers == NFS_VER2) + svc_reg(xprt, NFS_PROG, NFS_VER2, nfssvc_program, + NULL); + if (nfs_minvers <= NFS_VER3 && nfs_maxvers >= NFS_VER3) + svc_reg(xprt, NFS_PROG, NFS_VER3, nfssvc_program, + NULL); + if (nfs_maxvers >= NFS_VER4) + svc_reg(xprt, NFS_PROG, NFS_VER4, nfssvc_program, + NULL); } return (0); From owner-svn-src-head@FreeBSD.ORG Tue May 26 03:56:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F9C51065675; Tue, 26 May 2009 03:56:57 +0000 (UTC) (envelope-from benjsc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4DD988FC18; Tue, 26 May 2009 03:56:57 +0000 (UTC) (envelope-from benjsc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4Q3uut6045471; Tue, 26 May 2009 03:56:56 GMT (envelope-from benjsc@svn.freebsd.org) Received: (from benjsc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4Q3uutQ045470; Tue, 26 May 2009 03:56:56 GMT (envelope-from benjsc@svn.freebsd.org) Message-Id: <200905260356.n4Q3uutQ045470@svn.freebsd.org> From: Benjamin Close Date: Tue, 26 May 2009 03:56:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192784 - head/sys/dev/bktr X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 03:56:57 -0000 Author: benjsc Date: Tue May 26 03:56:56 2009 New Revision: 192784 URL: http://svn.freebsd.org/changeset/base/192784 Log: Free the memory correctly in the error case Submitted by: frtzkatz at yahoo.com Approved by: sam MFC after: 1 month Modified: head/sys/dev/bktr/bktr_os.c Modified: head/sys/dev/bktr/bktr_os.c ============================================================================== --- head/sys/dev/bktr/bktr_os.c Tue May 26 03:45:58 2009 (r192783) +++ head/sys/dev/bktr/bktr_os.c Tue May 26 03:56:56 2009 (r192784) @@ -470,7 +470,7 @@ fail: if (bktr->res_irq) bus_release_resource(dev, SYS_RES_IRQ, bktr->irq_rid, bktr->res_irq); if (bktr->res_mem) - bus_release_resource(dev, SYS_RES_IRQ, bktr->mem_rid, bktr->res_mem); + bus_release_resource(dev, SYS_RES_MEM, bktr->mem_rid, bktr->res_mem); return error; } From owner-svn-src-head@FreeBSD.ORG Tue May 26 06:10:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47525106564A; Tue, 26 May 2009 06:10:13 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.cksoft.de (mail.cksoft.de [195.88.108.3]) by mx1.freebsd.org (Postfix) with ESMTP id EC88E8FC19; Tue, 26 May 2009 06:10:12 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 6CA9441C750; Tue, 26 May 2009 08:10:11 +0200 (CEST) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([195.88.108.3]) by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id H4atNpITQPna; Tue, 26 May 2009 08:10:05 +0200 (CEST) Received: by mail.cksoft.de (Postfix, from userid 66) id D66D541C735; Tue, 26 May 2009 08:10:05 +0200 (CEST) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id 75BF54448E6; Tue, 26 May 2009 06:05:57 +0000 (UTC) Date: Tue, 26 May 2009 06:05:57 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Doug Barton In-Reply-To: <200905260007.n4Q072JS040447@svn.freebsd.org> Message-ID: <20090526060526.L72053@maildrop.int.zabbadoz.net> References: <200905260007.n4Q072JS040447@svn.freebsd.org> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192776 - in head/libexec: . makekey X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 06:10:15 -0000 On Tue, 26 May 2009, Doug Barton wrote: > Author: dougb > Date: Tue May 26 00:07:02 2009 > New Revision: 192776 > URL: http://svn.freebsd.org/changeset/base/192776 > > Log: > Per the man page: > The makekey utility has been deprecated and will be removed in a future > release of FreeBSD. > > Actually removing it was approved back on 10/29/2007 by re (kensmith) but > I dropped the ball on actually removing it. It's doubtful that it's become > more relevant/useful in the intervening time. > > Deleted: > head/libexec/makekey/ Can you also update OboseletesFiles.inc? > Modified: > head/libexec/Makefile > > Modified: head/libexec/Makefile > ============================================================================== > --- head/libexec/Makefile Mon May 25 23:06:46 2009 (r192775) > +++ head/libexec/Makefile Tue May 26 00:07:02 2009 (r192776) > @@ -11,7 +11,6 @@ SUBDIR= ${_atrun} \ > getty \ > lukemftpd \ > ${_mail.local} \ > - makekey \ > ${_mknetid} \ > ${_pppoed} \ > rbootd \ > -- Bjoern A. Zeeb The greatest risk is not taking one. From owner-svn-src-head@FreeBSD.ORG Tue May 26 06:24:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F3DF106566C; Tue, 26 May 2009 06:24:51 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2CFBE8FC15; Tue, 26 May 2009 06:24:51 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4Q6Opxe048765; Tue, 26 May 2009 06:24:51 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4Q6OpSb048764; Tue, 26 May 2009 06:24:51 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200905260624.n4Q6OpSb048764@svn.freebsd.org> From: Rafal Jaworowski Date: Tue, 26 May 2009 06:24:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192795 - head/sys/powerpc/booke X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 06:24:51 -0000 Author: raj Date: Tue May 26 06:24:50 2009 New Revision: 192795 URL: http://svn.freebsd.org/changeset/base/192795 Log: Set PG_WRITEABLE in Book-E pmap_enter[_locked] if it creates a mapping that permits write access. This is similar to r192671. Pointed out and reviewed by: alc Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Tue May 26 06:20:50 2009 (r192794) +++ head/sys/powerpc/booke/pmap.c Tue May 26 06:24:50 2009 (r192795) @@ -1574,6 +1574,8 @@ mmu_booke_enter_locked(mmu_t mmu, pmap_t flags |= PTE_SW; if (!su) flags |= PTE_UW; + + vm_page_flag_set(m, PG_WRITEABLE); } else { /* Handle modified pages, sense modify status. */ @@ -1638,6 +1640,8 @@ mmu_booke_enter_locked(mmu_t mmu, pmap_t flags |= PTE_SW; if (!su) flags |= PTE_UW; + + vm_page_flag_set(m, PG_WRITEABLE); } if (prot & VM_PROT_EXECUTE) { From owner-svn-src-head@FreeBSD.ORG Tue May 26 07:29:18 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8FB40106566B; Tue, 26 May 2009 07:29:18 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6358B8FC14; Tue, 26 May 2009 07:29:18 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4Q7TI0n050085; Tue, 26 May 2009 07:29:18 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4Q7TIDL050084; Tue, 26 May 2009 07:29:18 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200905260729.n4Q7TIDL050084@svn.freebsd.org> From: Ulf Lilleengen Date: Tue, 26 May 2009 07:29:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192797 - head/sys/geom X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 07:29:19 -0000 Author: lulf Date: Tue May 26 07:29:17 2009 New Revision: 192797 URL: http://svn.freebsd.org/changeset/base/192797 Log: - Add 'show bio' DDB command. MFC after: 3 weeks Modified: head/sys/geom/geom_subr.c Modified: head/sys/geom/geom_subr.c ============================================================================== --- head/sys/geom/geom_subr.c Tue May 26 07:19:45 2009 (r192796) +++ head/sys/geom/geom_subr.c Tue May 26 07:29:17 2009 (r192797) @@ -1258,6 +1258,76 @@ DB_SHOW_COMMAND(geom, db_show_geom) } } +static void +db_print_bio_cmd(struct bio *bp) +{ + printf(" cmd: "); + switch (bp->bio_cmd) { + case BIO_READ: printf("BIO_READ"); break; + case BIO_WRITE: printf("BIO_WRITE"); break; + case BIO_DELETE: printf("BIO_DELETE"); break; + case BIO_GETATTR: printf("BIO_GETATTR"); break; + case BIO_FLUSH: printf("BIO_FLUSH"); break; + case BIO_CMD0: printf("BIO_CMD0"); break; + case BIO_CMD1: printf("BIO_CMD1"); break; + case BIO_CMD2: printf("BIO_CMD2"); break; + default: printf("UNKNOWN"); break; + } + printf("\n"); +} + +static void +db_print_bio_flags(struct bio *bp) +{ + int comma; + + comma = 0; + printf(" flags: "); + if (bp->bio_flags & BIO_ERROR) { + printf("BIO_ERROR"); + comma = 1; + } + if (bp->bio_flags & BIO_DONE) { + printf("%sBIO_ERROR", (comma ? ", " : "")); + comma = 1; + } + if (bp->bio_flags & BIO_ONQUEUE) + printf("%sBIO_ONQUEUE", (comma ? ", " : "")); + printf("\n"); +} + +/* + * Print useful information in a BIO + */ +DB_SHOW_COMMAND(bio, db_show_bio) +{ + struct bio *bp; + + if (have_addr) { + bp = (struct bio *)addr; + printf("BIO %p\n", bp); + db_print_bio_cmd(bp); + db_print_bio_flags(bp); + printf(" cflags: 0x%hhx\n", bp->bio_cflags); + printf(" pflags: 0x%hhx\n", bp->bio_pflags); + printf(" offset: %lld\n", bp->bio_offset); + printf(" length: %lld\n", bp->bio_length); + printf(" bcount: %ld\n", bp->bio_bcount); + printf(" resid: %ld\n", bp->bio_resid); + printf(" completed: %lld\n", bp->bio_completed); + printf(" children: %u\n", bp->bio_children); + printf(" inbed: %u\n", bp->bio_inbed); + printf(" error: %d\n", bp->bio_error); + printf(" parent: %p\n", bp->bio_parent); + printf(" driver1: %p\n", bp->bio_driver1); + printf(" driver2: %p\n", bp->bio_driver2); + printf(" caller1: %p\n", bp->bio_caller1); + printf(" caller2: %p\n", bp->bio_caller2); + printf(" bio_from: %p\n", bp->bio_from); + printf(" bio_to: %p\n", bp->bio_to); + } +} + #undef gprintf #undef gprintln #undef ADDFLAG From owner-svn-src-head@FreeBSD.ORG Tue May 26 07:32:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C70931065673; Tue, 26 May 2009 07:32:08 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AB8918FC0A; Tue, 26 May 2009 07:32:08 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4Q7W8J2050186; Tue, 26 May 2009 07:32:08 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4Q7W8JC050185; Tue, 26 May 2009 07:32:08 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <200905260732.n4Q7W8JC050185@svn.freebsd.org> From: Brian Somers Date: Tue, 26 May 2009 07:32:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192798 - head/usr.sbin/ppp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 07:32:09 -0000 Author: brian Date: Tue May 26 07:32:08 2009 New Revision: 192798 URL: http://svn.freebsd.org/changeset/base/192798 Log: Fix a race that can stall the timer when we remove a timer that has another timer with a <0.05 second delta next to it. This is done by avoiding the possibility of updating the first residual time delta in the timer list to zero. PR: 102747 Submitted by: Sergey Zaharchenko - doublef-ctm at yandex dot ru MFC after: 3 weeks Modified: head/usr.sbin/ppp/timer.c Modified: head/usr.sbin/ppp/timer.c ============================================================================== --- head/usr.sbin/ppp/timer.c Tue May 26 07:29:17 2009 (r192797) +++ head/usr.sbin/ppp/timer.c Tue May 26 07:32:08 2009 (r192798) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1996 - 2001 Brian Somers + * Copyright (c) 1996 - 2001, 2009 Brian Somers * based on work by Toshiharu OHNO * Internet Initiative Japan, Inc (IIJ) * All rights reserved. @@ -94,9 +94,12 @@ timer_Start(struct pppTimer *tp) return; } - /* Adjust our first delta so that it reflects what's really happening */ + /* + * We just need to insert tp in the correct relative place. We don't + * need to adjust TimerList->rest (yet). + */ if (TimerList && getitimer(ITIMER_REAL, &itimer) == 0) - TimerList->rest = RESTVAL(itimer); + ticks = RESTVAL(itimer) - TimerList->rest; pt = NULL; for (t = TimerList; t; t = t->next) { @@ -132,6 +135,7 @@ timer_Start(struct pppTimer *tp) static void StopTimerNoBlock(struct pppTimer *tp) { + struct itimerval itimer; struct pppTimer *t, *pt; /* @@ -156,14 +160,11 @@ StopTimerNoBlock(struct pppTimer *tp) timer_TermService(); /* Terminate Timer Service */ } if (t->next) { - if (!pt) { /* t (tp) was the first in the list */ - struct itimerval itimer; - - if (getitimer(ITIMER_REAL, &itimer) == 0) - t->rest = RESTVAL(itimer); - } - t->next->rest += t->rest; - if (!pt) /* t->next is now the first in the list */ + if (!pt && getitimer(ITIMER_REAL, &itimer) == 0) + t->next->rest += RESTVAL(itimer); /* t (tp) was the first in the list */ + else + t->next->rest += t->rest; + if (!pt && t->next->rest > 0) /* t->next is now the first in the list */ timer_InitService(1); } } else { @@ -235,11 +236,19 @@ timer_Show(int LogLevel, struct prompt * { struct itimerval itimer; struct pppTimer *pt; - u_long rest = 0; + long rest; - /* Adjust our first delta so that it reflects what's really happening */ + /* + * Adjust the base time so that the deltas reflect what's really + * happening. Changing TimerList->rest might cause it to become zero + * (if getitimer() returns a value close to zero), and the + * timer_InitService() call will call setitimer() with zero it_value, + * stopping the itimer... so be careful! + */ if (TimerList && getitimer(ITIMER_REAL, &itimer) == 0) - TimerList->rest = RESTVAL(itimer); + rest = RESTVAL(itimer) - TimerList->rest; + else + rest = 0; #define SECS(val) ((val) / SECTICKS) #define HSECS(val) (((val) % SECTICKS) * 100 / SECTICKS) From owner-svn-src-head@FreeBSD.ORG Tue May 26 07:40:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E8F8106564A; Tue, 26 May 2009 07:40:33 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3C71E8FC1E; Tue, 26 May 2009 07:40:33 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4Q7eX8I050428; Tue, 26 May 2009 07:40:33 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4Q7eXHe050427; Tue, 26 May 2009 07:40:33 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <200905260740.n4Q7eXHe050427@svn.freebsd.org> From: Brian Somers Date: Tue, 26 May 2009 07:40:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192799 - head/share/examples/ppp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 07:40:33 -0000 Author: brian Date: Tue May 26 07:40:32 2009 New Revision: 192799 URL: http://svn.freebsd.org/changeset/base/192799 Log: Mention the danger of running programs using ``!''. PR: 112481 MFC after: 1 week Modified: head/share/examples/ppp/ppp.linkup.sample Modified: head/share/examples/ppp/ppp.linkup.sample ============================================================================== --- head/share/examples/ppp/ppp.linkup.sample Tue May 26 07:32:08 2009 (r192798) +++ head/share/examples/ppp/ppp.linkup.sample Tue May 26 07:40:32 2009 (r192799) @@ -30,11 +30,16 @@ MYADDR: 192.244.176.32: add 192.244.176.0 0 HISADDR -#You may want to execute a script after connecting. This script can do +# You may want to execute a script after connecting. This script can do # nice things such as kick off "sendmail -q", "popclient my.isp" and # "slurp -d news". It can be passed MYADDR, HISADDR and INTERFACE # as arguments too - useful for informing a DNS of your assigned IP. # +# NOTE: It's vital that you use ``!bg'' rather than ``!'' if the program +# you're running will take some time or will require network +# connectivity. Using ``!'' will delay ppp 'till the completion +# of the program being run! +# # You may also want some sound effects.... # pmdemand: From owner-svn-src-head@FreeBSD.ORG Tue May 26 08:22:00 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9BA0F106564A; Tue, 26 May 2009 08:22:00 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 856E88FC14; Tue, 26 May 2009 08:22:00 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4Q8M0c7051290; Tue, 26 May 2009 08:22:00 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4Q8M0Zv051280; Tue, 26 May 2009 08:22:00 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200905260822.n4Q8M0Zv051280@svn.freebsd.org> From: Edward Tomasz Napierala Date: Tue, 26 May 2009 08:22:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192800 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris/common/acl cddl/contrib/opensolaris/uts/common/fs/zfs cddl/contrib/opensolaris/u... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 08:22:01 -0000 Author: trasz Date: Tue May 26 08:21:59 2009 New Revision: 192800 URL: http://svn.freebsd.org/changeset/base/192800 Log: MFp4 changes neccessary for NFSv4 ACLs support in ZFS. This is mostly about removing a few #ifdefs and providing compatibility wrappers and VOP implementations to get and set an ACL; ZFS does ACL enforcement all by itself. Note that the VOPs are ifdefed out for now, so this change should be a no-op. Reviewed by: pjd Added: head/sys/cddl/compat/opensolaris/kern/opensolaris_acl.c (contents, props changed) head/sys/cddl/compat/opensolaris/sys/acl.h (contents, props changed) Modified: head/sys/cddl/contrib/opensolaris/common/acl/acl_common.c head/sys/cddl/contrib/opensolaris/common/acl/acl_common.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h head/sys/cddl/contrib/opensolaris/uts/common/sys/acl_impl.h head/sys/modules/zfs/Makefile Added: head/sys/cddl/compat/opensolaris/kern/opensolaris_acl.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_acl.c Tue May 26 08:21:59 2009 (r192800) @@ -0,0 +1,216 @@ +/*- + * Copyright (c) 2008, 2009 Edward Tomasz Napierała + * 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. + * + * ALTHOUGH THIS SOFTWARE IS MADE OF WIN AND SCIENCE, IT 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 +#include +#include +#include + +struct zfs2bsd { + uint32_t zb_zfs; + int zb_bsd; +}; + +struct zfs2bsd perms[] = {{ACE_READ_DATA, ACL_READ_DATA}, + {ACE_WRITE_DATA, ACL_WRITE_DATA}, + {ACE_EXECUTE, ACL_EXECUTE}, + {ACE_APPEND_DATA, ACL_APPEND_DATA}, + {ACE_DELETE_CHILD, ACL_DELETE_CHILD}, + {ACE_DELETE, ACL_DELETE}, + {ACE_READ_ATTRIBUTES, ACL_READ_ATTRIBUTES}, + {ACE_WRITE_ATTRIBUTES, ACL_WRITE_ATTRIBUTES}, + {ACE_READ_NAMED_ATTRS, ACL_READ_NAMED_ATTRS}, + {ACE_WRITE_NAMED_ATTRS, ACL_WRITE_NAMED_ATTRS}, + {ACE_READ_ACL, ACL_READ_ACL}, + {ACE_WRITE_ACL, ACL_WRITE_ACL}, + {ACE_WRITE_OWNER, ACL_WRITE_OWNER}, + {ACE_SYNCHRONIZE, ACL_SYNCHRONIZE}, + {0, 0}}; + +struct zfs2bsd flags[] = {{ACE_FILE_INHERIT_ACE, + ACL_ENTRY_FILE_INHERIT}, + {ACE_DIRECTORY_INHERIT_ACE, + ACL_ENTRY_DIRECTORY_INHERIT}, + {ACE_NO_PROPAGATE_INHERIT_ACE, + ACL_ENTRY_NO_PROPAGATE_INHERIT}, + {ACE_INHERIT_ONLY_ACE, + ACL_ENTRY_INHERIT_ONLY}, + {ACE_SUCCESSFUL_ACCESS_ACE_FLAG, + ACL_ENTRY_SUCCESSFUL_ACCESS}, + {ACE_FAILED_ACCESS_ACE_FLAG, + ACL_ENTRY_FAILED_ACCESS}, + {0, 0}}; + +static int +_bsd_from_zfs(uint32_t zfs, const struct zfs2bsd *table) +{ + const struct zfs2bsd *tmp; + int bsd = 0; + + for (tmp = table; tmp->zb_zfs != 0; tmp++) { + if (zfs & tmp->zb_zfs) + bsd |= tmp->zb_bsd; + } + + return (bsd); +} + +static uint32_t +_zfs_from_bsd(int bsd, const struct zfs2bsd *table) +{ + const struct zfs2bsd *tmp; + uint32_t zfs = 0; + + for (tmp = table; tmp->zb_bsd != 0; tmp++) { + if (bsd & tmp->zb_bsd) + zfs |= tmp->zb_zfs; + } + + return (zfs); +} + +int +acl_from_aces(struct acl *aclp, const ace_t *aces, int nentries) +{ + int i; + struct acl_entry *entry; + const ace_t *ace; + + KASSERT(nentries >= 1, ("empty ZFS ACL")); + + if (nentries > ACL_MAX_ENTRIES) { + /* + * I believe it may happen only when moving a pool + * from SunOS to FreeBSD. + */ + printf("acl_from_aces: ZFS ACL too big to fit " + "into 'struct acl'; returning EINVAL.\n"); + return (EINVAL); + } + + bzero(aclp, sizeof(*aclp)); + aclp->acl_maxcnt = ACL_MAX_ENTRIES; + aclp->acl_cnt = nentries; + + for (i = 0; i < nentries; i++) { + entry = &(aclp->acl_entry[i]); + ace = &(aces[i]); + + if (ace->a_flags & ACE_OWNER) + entry->ae_tag = ACL_USER_OBJ; + else if (ace->a_flags & ACE_GROUP) + entry->ae_tag = ACL_GROUP_OBJ; + else if (ace->a_flags & ACE_EVERYONE) + entry->ae_tag = ACL_EVERYONE; + else if (ace->a_flags & ACE_IDENTIFIER_GROUP) + entry->ae_tag = ACL_GROUP; + else + entry->ae_tag = ACL_USER; + + if (entry->ae_tag == ACL_USER || entry->ae_tag == ACL_GROUP) + entry->ae_id = ace->a_who; + else + entry->ae_id = ACL_UNDEFINED_ID; + + entry->ae_perm = _bsd_from_zfs(ace->a_access_mask, perms); + entry->ae_flags = _bsd_from_zfs(ace->a_flags, flags); + + switch (ace->a_type) { + case ACE_ACCESS_ALLOWED_ACE_TYPE: + entry->ae_entry_type = ACL_ENTRY_TYPE_ALLOW; + break; + case ACE_ACCESS_DENIED_ACE_TYPE: + entry->ae_entry_type = ACL_ENTRY_TYPE_DENY; + break; + case ACE_SYSTEM_AUDIT_ACE_TYPE: + entry->ae_entry_type = ACL_ENTRY_TYPE_AUDIT; + break; + case ACE_SYSTEM_ALARM_ACE_TYPE: + entry->ae_entry_type = ACL_ENTRY_TYPE_ALARM; + break; + default: + panic("acl_from_aces: a_type is 0x%x", ace->a_type); + } + } + + return (0); +} + +void +aces_from_acl(ace_t *aces, int *nentries, const struct acl *aclp) +{ + int i; + const struct acl_entry *entry; + ace_t *ace; + + bzero(aces, sizeof(*aces) * aclp->acl_cnt); + + *nentries = aclp->acl_cnt; + + for (i = 0; i < aclp->acl_cnt; i++) { + entry = &(aclp->acl_entry[i]); + ace = &(aces[i]); + + ace->a_who = entry->ae_id; + + if (entry->ae_tag == ACL_USER_OBJ) + ace->a_flags = ACE_OWNER; + else if (entry->ae_tag == ACL_GROUP_OBJ) + ace->a_flags = (ACE_GROUP | ACE_IDENTIFIER_GROUP); + else if (entry->ae_tag == ACL_GROUP) + ace->a_flags = ACE_IDENTIFIER_GROUP; + else if (entry->ae_tag == ACL_EVERYONE) + ace->a_flags = ACE_EVERYONE; + else /* ACL_USER */ + ace->a_flags = 0; + + ace->a_access_mask = _zfs_from_bsd(entry->ae_perm, perms); + ace->a_flags |= _zfs_from_bsd(entry->ae_flags, flags); + + switch (entry->ae_entry_type) { + case ACL_ENTRY_TYPE_ALLOW: + ace->a_type = ACE_ACCESS_ALLOWED_ACE_TYPE; + break; + case ACL_ENTRY_TYPE_DENY: + ace->a_type = ACE_ACCESS_DENIED_ACE_TYPE; + break; + case ACL_ENTRY_TYPE_ALARM: + ace->a_type = ACE_SYSTEM_ALARM_ACE_TYPE; + break; + case ACL_ENTRY_TYPE_AUDIT: + ace->a_type = ACE_SYSTEM_AUDIT_ACE_TYPE; + break; + default: + panic("aces_from_acl: ae_entry_type is 0x%x", entry->ae_entry_type); + } + } +} Added: head/sys/cddl/compat/opensolaris/sys/acl.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/compat/opensolaris/sys/acl.h Tue May 26 08:21:59 2009 (r192800) @@ -0,0 +1,39 @@ +/*- + * Copyright (c) 2008, 2009 Edward Tomasz Napierała + * 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. + * + * ALTHOUGH THIS SOFTWARE IS MADE OF WIN AND SCIENCE, IT 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$ + */ + +#ifndef OPENSOLARIS_SYS_ACL_H +#define OPENSOLARIS_SYS_ACL_H + +#include_next + +struct acl; + +void aces_from_acl(ace_t *aces, int *nentries, const struct acl *aclp); +int acl_from_aces(struct acl *aclp, const ace_t *aces, int nentries); + +#endif /* OPENSOLARIS_SYS_ACL_H */ Modified: head/sys/cddl/contrib/opensolaris/common/acl/acl_common.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/common/acl/acl_common.c Tue May 26 07:40:32 2009 (r192799) +++ head/sys/cddl/contrib/opensolaris/common/acl/acl_common.c Tue May 26 08:21:59 2009 (r192800) @@ -424,7 +424,7 @@ cacl_free(void *ptr, size_t size) #endif } -#ifndef __FreeBSD__ +#if !defined(_KERNEL) acl_t * acl_alloc(enum acl_type type) { @@ -470,7 +470,6 @@ acl_free(acl_t *aclp) cacl_free(aclp, sizeof (acl_t)); } -#endif static uint32_t access_mask_set(int haswriteperm, int hasreadperm, int isowner, int isallow) @@ -1727,3 +1726,4 @@ out: return (error); #endif } +#endif /* _KERNEL */ Modified: head/sys/cddl/contrib/opensolaris/common/acl/acl_common.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/common/acl/acl_common.h Tue May 26 07:40:32 2009 (r192799) +++ head/sys/cddl/contrib/opensolaris/common/acl/acl_common.h Tue May 26 08:21:59 2009 (r192800) @@ -46,6 +46,7 @@ extern int ace_trivial(ace_t *acep, int extern int ace_trivial_common(void *, int, uint64_t (*walk)(void *, uint64_t, int aclcnt, uint16_t *, uint16_t *, uint32_t *mask)); +#if !defined(_KERNEL) extern acl_t *acl_alloc(acl_type_t); extern void acl_free(acl_t *aclp); extern int acl_translate(acl_t *aclp, int target_flavor, @@ -53,6 +54,7 @@ extern int acl_translate(acl_t *aclp, in void ksort(caddr_t v, int n, int s, int (*f)()); int cmp2acls(void *a, void *b); +#endif /* _KERNEL */ #ifdef __cplusplus } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h Tue May 26 07:40:32 2009 (r192799) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h Tue May 26 08:21:59 2009 (r192800) @@ -188,10 +188,8 @@ struct zfs_fuid_info; #ifdef _KERNEL void zfs_perm_init(struct znode *, struct znode *, int, vattr_t *, dmu_tx_t *, cred_t *, zfs_acl_t *, zfs_fuid_info_t **); -#ifdef TODO int zfs_getacl(struct znode *, vsecattr_t *, boolean_t, cred_t *); int zfs_setacl(struct znode *, vsecattr_t *, boolean_t, cred_t *); -#endif void zfs_acl_rele(void *); void zfs_oldace_byteswap(ace_t *, int); void zfs_ace_byteswap(void *, size_t, boolean_t); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Tue May 26 07:40:32 2009 (r192799) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Tue May 26 08:21:59 2009 (r192800) @@ -1909,7 +1909,6 @@ zfs_perm_init(znode_t *zp, znode_t *pare zfs_acl_free(aclp); } -#ifdef TODO /* * Retrieve a files ACL */ @@ -2005,7 +2004,6 @@ zfs_getacl(znode_t *zp, vsecattr_t *vsec return (0); } -#endif /* TODO */ int zfs_vsec_2_aclp(zfsvfs_t *zfsvfs, vtype_t obj_type, @@ -2062,7 +2060,6 @@ zfs_vsec_2_aclp(zfsvfs_t *zfsvfs, vtype_ return (0); } -#ifdef TODO /* * Set a files ACL */ @@ -2170,7 +2167,6 @@ done: return (error); } -#endif /* TODO */ /* * working_mode returns the permissions that were not granted Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue May 26 07:40:32 2009 (r192799) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue May 26 08:21:59 2009 (r192800) @@ -45,7 +45,6 @@ #include #include #include -#include #include #include #include @@ -67,6 +66,7 @@ #include #include #include +#include /* * Programming rules. @@ -3846,7 +3846,6 @@ zfs_pathconf(vnode_t *vp, int cmd, ulong } } -#ifdef TODO /*ARGSUSED*/ static int zfs_getsecattr(vnode_t *vp, vsecattr_t *vsecp, int flag, cred_t *cr, @@ -3864,9 +3863,7 @@ zfs_getsecattr(vnode_t *vp, vsecattr_t * return (error); } -#endif /* TODO */ -#ifdef TODO /*ARGSUSED*/ static int zfs_setsecattr(vnode_t *vp, vsecattr_t *vsecp, int flag, cred_t *cr, @@ -3883,7 +3880,6 @@ zfs_setsecattr(vnode_t *vp, vsecattr_t * ZFS_EXIT(zfsvfs); return (error); } -#endif /* TODO */ static int zfs_freebsd_open(ap) @@ -4777,6 +4773,90 @@ vop_listextattr { return (error); } +int +zfs_freebsd_getacl(ap) + struct vop_getacl_args /* { + struct vnode *vp; + acl_type_t type; + struct acl *aclp; + struct ucred *cred; + struct thread *td; + } */ *ap; +{ + int error; + vsecattr_t vsecattr; + + if (ap->a_type != ACL_TYPE_NFS4) + return (EOPNOTSUPP); + + vsecattr.vsa_mask = VSA_ACE | VSA_ACECNT; + if (error = zfs_getsecattr(ap->a_vp, &vsecattr, 0, ap->a_cred, NULL)) + return (error); + + error = acl_from_aces(ap->a_aclp, vsecattr.vsa_aclentp, vsecattr.vsa_aclcnt); + if (vsecattr.vsa_aclentp != NULL) + kmem_free(vsecattr.vsa_aclentp, vsecattr.vsa_aclentsz); + + return (error); +} + +int +zfs_freebsd_setacl(ap) + struct vop_setacl_args /* { + struct vnode *vp; + acl_type_t type; + struct acl *aclp; + struct ucred *cred; + struct thread *td; + } */ *ap; +{ + int error; + vsecattr_t vsecattr; + int aclbsize; /* size of acl list in bytes */ + aclent_t *aaclp; + + if (ap->a_type != ACL_TYPE_NFS4) + return (EOPNOTSUPP); + + if (ap->a_aclp->acl_cnt < 1 || ap->a_aclp->acl_cnt > MAX_ACL_ENTRIES) + return (EINVAL); + + /* + * With NFS4 ACLs, chmod(2) may need to add additional entries, + * splitting every entry into two and appending "canonical six" + * entries at the end. Don't allow for setting an ACL that would + * cause chmod(2) to run out of ACL entries. + */ + if (ap->a_aclp->acl_cnt * 2 + 6 > ACL_MAX_ENTRIES) + return (ENOSPC); + + vsecattr.vsa_mask = VSA_ACE; + aclbsize = ap->a_aclp->acl_cnt * sizeof(ace_t); + vsecattr.vsa_aclentp = kmem_alloc(aclbsize, KM_SLEEP); + aaclp = vsecattr.vsa_aclentp; + vsecattr.vsa_aclentsz = aclbsize; + + aces_from_acl(vsecattr.vsa_aclentp, &vsecattr.vsa_aclcnt, ap->a_aclp); + error = zfs_setsecattr(ap->a_vp, &vsecattr, 0, ap->a_cred, NULL); + kmem_free(aaclp, aclbsize); + + return (error); +} + +int +zfs_freebsd_aclcheck(ap) + struct vop_aclcheck_args /* { + struct vnode *vp; + acl_type_t type; + struct acl *aclp; + struct ucred *cred; + struct thread *td; + } */ *ap; +{ + + return (EOPNOTSUPP); +} + struct vop_vector zfs_vnodeops; struct vop_vector zfs_fifoops; @@ -4816,6 +4896,11 @@ struct vop_vector zfs_vnodeops = { .vop_deleteextattr = zfs_deleteextattr, .vop_setextattr = zfs_setextattr, .vop_listextattr = zfs_listextattr, +#ifdef notyet + .vop_getacl = zfs_freebsd_getacl, + .vop_setacl = zfs_freebsd_setacl, + .vop_aclcheck = zfs_freebsd_aclcheck, +#endif }; struct vop_vector zfs_fifoops = { @@ -4829,4 +4914,9 @@ struct vop_vector zfs_fifoops = { .vop_setattr = zfs_freebsd_setattr, .vop_write = VOP_PANIC, .vop_fid = zfs_freebsd_fid, +#ifdef notyet + .vop_getacl = zfs_freebsd_getacl, + .vop_setacl = zfs_freebsd_setacl, + .vop_aclcheck = zfs_freebsd_aclcheck, +#endif }; Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h Tue May 26 07:40:32 2009 (r192799) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h Tue May 26 08:21:59 2009 (r192800) @@ -31,12 +31,22 @@ #include #include +#if defined(_KERNEL) +/* + * When compiling OpenSolaris kernel code, this file is getting + * included instead of FreeBSD one. Pull the original sys/acl.h as well. + */ +#undef _SYS_ACL_H +#include_next +#define _SYS_ACL_H +#endif /* _KERNEL */ + #ifdef __cplusplus extern "C" { #endif #define MAX_ACL_ENTRIES (1024) /* max entries of each type */ -typedef struct acl { +typedef struct { int a_type; /* the type of ACL entry */ uid_t a_id; /* the entry in -uid or gid */ o_mode_t a_perm; /* the permission field */ @@ -49,7 +59,9 @@ typedef struct ace { uint16_t a_type; /* allow or deny */ } ace_t; +#if !defined(_KERNEL) typedef struct acl_info acl_t; +#endif /* * The following are Defined types for an aclent_t. Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/acl_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/acl_impl.h Tue May 26 07:40:32 2009 (r192799) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/acl_impl.h Tue May 26 08:21:59 2009 (r192800) @@ -44,10 +44,10 @@ extern "C" { typedef enum acl_type { ACLENT_T = 0, ACE_T = 1 -} acl_type_t; +} zfs_acl_type_t; struct acl_info { - acl_type_t acl_type; /* style of acl */ + zfs_acl_type_t acl_type; /* style of acl */ int acl_cnt; /* number of acl entries */ int acl_entry_size; /* sizeof acl entry */ int acl_flags; /* special flags about acl */ Modified: head/sys/modules/zfs/Makefile ============================================================================== --- head/sys/modules/zfs/Makefile Tue May 26 07:40:32 2009 (r192799) +++ head/sys/modules/zfs/Makefile Tue May 26 08:21:59 2009 (r192800) @@ -16,6 +16,7 @@ SRCS+= nvpair.c SRCS+= u8_textprep.c .PATH: ${.CURDIR}/../../cddl/compat/opensolaris/kern +SRCS+= opensolaris_acl.c SRCS+= opensolaris_kmem.c SRCS+= opensolaris_kobj.c SRCS+= opensolaris_kstat.c From owner-svn-src-head@FreeBSD.ORG Tue May 26 09:02:17 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D1D8106566B; Tue, 26 May 2009 09:02:17 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (chello087206045082.chello.pl [87.206.45.82]) by mx1.freebsd.org (Postfix) with ESMTP id 482058FC0C; Tue, 26 May 2009 09:02:12 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id ED1DC45CAC; Tue, 26 May 2009 10:30:14 +0200 (CEST) Received: from localhost (pjd.wheel.pl [10.0.1.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id F2C3E4569A; Tue, 26 May 2009 10:30:08 +0200 (CEST) Date: Tue, 26 May 2009 10:30:12 +0200 From: Pawel Jakub Dawidek To: Ulf Lilleengen Message-ID: <20090526083011.GB1491@garage.freebsd.pl> References: <200905260729.n4Q7TIDL050084@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="tjCHc7DPkfUGtrlw" Content-Disposition: inline In-Reply-To: <200905260729.n4Q7TIDL050084@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 8.0-CURRENT i386 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-5.9 required=3.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192797 - head/sys/geom X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 09:02:17 -0000 --tjCHc7DPkfUGtrlw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 26, 2009 at 07:29:18AM +0000, Ulf Lilleengen wrote: > Author: lulf > Date: Tue May 26 07:29:17 2009 > New Revision: 192797 > URL: http://svn.freebsd.org/changeset/base/192797 >=20 > Log: > - Add 'show bio' DDB command. > =20 > MFC after: 3 weeks >=20 > Modified: > head/sys/geom/geom_subr.c [...] > +static void > +db_print_bio_flags(struct bio *bp) > +{ > + int comma; > + > + comma =3D 0; > + printf(" flags: "); > + if (bp->bio_flags & BIO_ERROR) { > + printf("BIO_ERROR"); > + comma =3D 1; > + } > + if (bp->bio_flags & BIO_DONE) { > + printf("%sBIO_ERROR", (comma ? ", " : "")); I think you wanted BIO_DONE here. > +/* > + * Print useful information in a BIO > + */ > +DB_SHOW_COMMAND(bio, db_show_bio) > +{ > + struct bio *bp; > + > + if (have_addr) { > + bp =3D (struct bio *)addr; > + printf("BIO %p\n", bp); > + db_print_bio_cmd(bp); > + db_print_bio_flags(bp); > + printf(" cflags: 0x%hhx\n", bp->bio_cflags); > + printf(" pflags: 0x%hhx\n", bp->bio_pflags); > + printf(" offset: %lld\n", bp->bio_offset); > + printf(" length: %lld\n", bp->bio_length); > + printf(" bcount: %ld\n", bp->bio_bcount); > + printf(" resid: %ld\n", bp->bio_resid); > + printf(" completed: %lld\n", bp->bio_completed); > + printf(" children: %u\n", bp->bio_children); > + printf(" inbed: %u\n", bp->bio_inbed); > + printf(" error: %d\n", bp->bio_error); > + printf(" parent: %p\n", bp->bio_parent); > + printf(" driver1: %p\n", bp->bio_driver1); > + printf(" driver2: %p\n", bp->bio_driver2); > + printf(" caller1: %p\n", bp->bio_caller1); > + printf(" caller2: %p\n", bp->bio_caller2); > + printf(" bio_from: %p\n", bp->bio_from); > + printf(" bio_to: %p\n", bp->bio_to); > + } > +} In DDB functions you should use db_printf() instead of printf(). --=20 Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --tjCHc7DPkfUGtrlw Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFKG6iSForvXbEpPzQRAsuQAJ9l/RuwTaIfTc309YPqYG94yE354gCg34wW 7ENtPCpwRu1O4ESdljEpP9I= =kE2V -----END PGP SIGNATURE----- --tjCHc7DPkfUGtrlw-- From owner-svn-src-head@FreeBSD.ORG Tue May 26 09:19:21 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2249106564A; Tue, 26 May 2009 09:19:21 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B0CCA8FC08; Tue, 26 May 2009 09:19:21 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4Q9JLxJ052519; Tue, 26 May 2009 09:19:21 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4Q9JLkA052518; Tue, 26 May 2009 09:19:21 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200905260919.n4Q9JLkA052518@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 26 May 2009 09:19:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192802 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 09:19:22 -0000 Author: pjd Date: Tue May 26 09:19:21 2009 New Revision: 192802 URL: http://svn.freebsd.org/changeset/base/192802 Log: Add missing socket options. Modified: head/sys/kern/uipc_debug.c Modified: head/sys/kern/uipc_debug.c ============================================================================== --- head/sys/kern/uipc_debug.c Tue May 26 08:39:44 2009 (r192801) +++ head/sys/kern/uipc_debug.c Tue May 26 09:19:21 2009 (r192802) @@ -136,6 +136,14 @@ db_print_sooptions(short so_options) db_printf("%sSO_BINTIME", comma ? ", " : ""); comma = 1; } + if (so_options & SO_NO_OFFLOAD) { + db_printf("%sSO_NO_OFFLOAD", comma ? ", " : ""); + comma = 1; + } + if (so_options & SO_NO_DDP) { + db_printf("%sSO_NO_DDP", comma ? ", " : ""); + comma = 1; + } } static void From owner-svn-src-head@FreeBSD.ORG Tue May 26 10:03:44 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 758C41065675; Tue, 26 May 2009 10:03:44 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5937D8FC24; Tue, 26 May 2009 10:03:44 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QA3iA1053547; Tue, 26 May 2009 10:03:44 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QA3iB5053546; Tue, 26 May 2009 10:03:44 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200905261003.n4QA3iB5053546@svn.freebsd.org> From: Ulf Lilleengen Date: Tue, 26 May 2009 10:03:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192803 - head/sys/geom X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 10:03:44 -0000 Author: lulf Date: Tue May 26 10:03:44 2009 New Revision: 192803 URL: http://svn.freebsd.org/changeset/base/192803 Log: - Fix wrong print on BIO_DONE. - Use db_printf instead of printf. While here, apply this to other ddb commands as well. Pointed out by: pjd Modified: head/sys/geom/geom_subr.c Modified: head/sys/geom/geom_subr.c ============================================================================== --- head/sys/geom/geom_subr.c Tue May 26 09:19:21 2009 (r192802) +++ head/sys/geom/geom_subr.c Tue May 26 10:03:44 2009 (r192803) @@ -1048,12 +1048,12 @@ g_valid_obj(void const *ptr) #ifdef DDB #define gprintf(...) do { \ - printf("%*s", indent, ""); \ - printf(__VA_ARGS__); \ + db_printf("%*s", indent, ""); \ + db_printf(__VA_ARGS__); \ } while (0) #define gprintln(...) do { \ gprintf(__VA_ARGS__); \ - printf("\n"); \ + db_printf("\n"); \ } while (0) #define ADDFLAG(obj, flag, sflag) do { \ @@ -1118,8 +1118,8 @@ db_show_geom_consumer(int indent, struct cp->provider != NULL ? cp->provider->name : "none", cp->acr, cp->acw, cp->ace); if (cp->spoiled) - printf(", spoiled=%d", cp->spoiled); - printf("\n"); + db_printf(", spoiled=%d", cp->spoiled); + db_printf("\n"); } } @@ -1152,11 +1152,11 @@ db_show_geom_provider(int indent, struct gprintf("provider: %s (%p), access=r%dw%de%d", pp->name, pp, pp->acr, pp->acw, pp->ace); if (pp->flags != 0) { - printf(", flags=%s (0x%04x)", + db_printf(", flags=%s (0x%04x)", provider_flags_to_string(pp, flags, sizeof(flags)), pp->flags); } - printf("\n"); + db_printf("\n"); } if (!LIST_EMPTY(&pp->consumers)) { LIST_FOREACH(cp, &pp->consumers, consumers) { @@ -1187,11 +1187,11 @@ db_show_geom_geom(int indent, struct g_g } else { gprintf("geom: %s (%p), rank=%d", gp->name, gp, gp->rank); if (gp->flags != 0) { - printf(", flags=%s (0x%04x)", + db_printf(", flags=%s (0x%04x)", geom_flags_to_string(gp, flags, sizeof(flags)), gp->flags); } - printf("\n"); + db_printf("\n"); } if (!LIST_EMPTY(&gp->provider)) { LIST_FOREACH(pp, &gp->provider, provider) { @@ -1214,7 +1214,7 @@ db_show_geom_class(struct g_class *mp) { struct g_geom *gp; - printf("class: %s (%p)\n", mp->name, mp); + db_printf("class: %s (%p)\n", mp->name, mp); LIST_FOREACH(gp, &mp->geom, geom) { db_show_geom_geom(2, gp); if (db_pager_quit) @@ -1233,7 +1233,7 @@ DB_SHOW_COMMAND(geom, db_show_geom) /* No address given, print the entire topology. */ LIST_FOREACH(mp, &g_classes, class) { db_show_geom_class(mp); - printf("\n"); + db_printf("\n"); if (db_pager_quit) break; } @@ -1252,7 +1252,7 @@ DB_SHOW_COMMAND(geom, db_show_geom) db_show_geom_provider(0, (struct g_provider *)addr); break; default: - printf("Not a GEOM object.\n"); + db_printf("Not a GEOM object.\n"); break; } } @@ -1261,19 +1261,19 @@ DB_SHOW_COMMAND(geom, db_show_geom) static void db_print_bio_cmd(struct bio *bp) { - printf(" cmd: "); + db_printf(" cmd: "); switch (bp->bio_cmd) { - case BIO_READ: printf("BIO_READ"); break; - case BIO_WRITE: printf("BIO_WRITE"); break; - case BIO_DELETE: printf("BIO_DELETE"); break; - case BIO_GETATTR: printf("BIO_GETATTR"); break; - case BIO_FLUSH: printf("BIO_FLUSH"); break; - case BIO_CMD0: printf("BIO_CMD0"); break; - case BIO_CMD1: printf("BIO_CMD1"); break; - case BIO_CMD2: printf("BIO_CMD2"); break; - default: printf("UNKNOWN"); break; + case BIO_READ: db_printf("BIO_READ"); break; + case BIO_WRITE: db_printf("BIO_WRITE"); break; + case BIO_DELETE: db_printf("BIO_DELETE"); break; + case BIO_GETATTR: db_printf("BIO_GETATTR"); break; + case BIO_FLUSH: db_printf("BIO_FLUSH"); break; + case BIO_CMD0: db_printf("BIO_CMD0"); break; + case BIO_CMD1: db_printf("BIO_CMD1"); break; + case BIO_CMD2: db_printf("BIO_CMD2"); break; + default: db_printf("UNKNOWN"); break; } - printf("\n"); + db_printf("\n"); } static void @@ -1282,18 +1282,18 @@ db_print_bio_flags(struct bio *bp) int comma; comma = 0; - printf(" flags: "); + db_printf(" flags: "); if (bp->bio_flags & BIO_ERROR) { - printf("BIO_ERROR"); + db_printf("BIO_ERROR"); comma = 1; } if (bp->bio_flags & BIO_DONE) { - printf("%sBIO_ERROR", (comma ? ", " : "")); + db_printf("%sBIO_DONE", (comma ? ", " : "")); comma = 1; } if (bp->bio_flags & BIO_ONQUEUE) - printf("%sBIO_ONQUEUE", (comma ? ", " : "")); - printf("\n"); + db_printf("%sBIO_ONQUEUE", (comma ? ", " : "")); + db_printf("\n"); } /* @@ -1305,26 +1305,26 @@ DB_SHOW_COMMAND(bio, db_show_bio) if (have_addr) { bp = (struct bio *)addr; - printf("BIO %p\n", bp); + db_printf("BIO %p\n", bp); db_print_bio_cmd(bp); db_print_bio_flags(bp); - printf(" cflags: 0x%hhx\n", bp->bio_cflags); - printf(" pflags: 0x%hhx\n", bp->bio_pflags); - printf(" offset: %lld\n", bp->bio_offset); - printf(" length: %lld\n", bp->bio_length); - printf(" bcount: %ld\n", bp->bio_bcount); - printf(" resid: %ld\n", bp->bio_resid); - printf(" completed: %lld\n", bp->bio_completed); - printf(" children: %u\n", bp->bio_children); - printf(" inbed: %u\n", bp->bio_inbed); - printf(" error: %d\n", bp->bio_error); - printf(" parent: %p\n", bp->bio_parent); - printf(" driver1: %p\n", bp->bio_driver1); - printf(" driver2: %p\n", bp->bio_driver2); - printf(" caller1: %p\n", bp->bio_caller1); - printf(" caller2: %p\n", bp->bio_caller2); - printf(" bio_from: %p\n", bp->bio_from); - printf(" bio_to: %p\n", bp->bio_to); + db_printf(" cflags: 0x%hhx\n", bp->bio_cflags); + db_printf(" pflags: 0x%hhx\n", bp->bio_pflags); + db_printf(" offset: %lld\n", bp->bio_offset); + db_printf(" length: %lld\n", bp->bio_length); + db_printf(" bcount: %ld\n", bp->bio_bcount); + db_printf(" resid: %ld\n", bp->bio_resid); + db_printf(" completed: %lld\n", bp->bio_completed); + db_printf(" children: %u\n", bp->bio_children); + db_printf(" inbed: %u\n", bp->bio_inbed); + db_printf(" error: %d\n", bp->bio_error); + db_printf(" parent: %p\n", bp->bio_parent); + db_printf(" driver1: %p\n", bp->bio_driver1); + db_printf(" driver2: %p\n", bp->bio_driver2); + db_printf(" caller1: %p\n", bp->bio_caller1); + db_printf(" caller2: %p\n", bp->bio_caller2); + db_printf(" bio_from: %p\n", bp->bio_from); + db_printf(" bio_to: %p\n", bp->bio_to); } } From owner-svn-src-head@FreeBSD.ORG Tue May 26 10:06:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9BC1F106566C; Tue, 26 May 2009 10:06:06 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (chello087206045082.chello.pl [87.206.45.82]) by mx1.freebsd.org (Postfix) with ESMTP id D479F8FC17; Tue, 26 May 2009 10:06:00 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id F188945CD9; Tue, 26 May 2009 12:05:58 +0200 (CEST) Received: from localhost (pjd.wheel.pl [10.0.1.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id EC4C24569A; Tue, 26 May 2009 12:05:53 +0200 (CEST) Date: Tue, 26 May 2009 12:05:56 +0200 From: Pawel Jakub Dawidek To: Ulf Lilleengen Message-ID: <20090526100556.GC1491@garage.freebsd.pl> References: <200905261003.n4QA3iB5053546@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="lCAWRPmW1mITcIfM" Content-Disposition: inline In-Reply-To: <200905261003.n4QA3iB5053546@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 8.0-CURRENT i386 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-5.9 required=3.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192803 - head/sys/geom X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 10:06:07 -0000 --lCAWRPmW1mITcIfM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 26, 2009 at 10:03:44AM +0000, Ulf Lilleengen wrote: > Author: lulf > Date: Tue May 26 10:03:44 2009 > New Revision: 192803 > URL: http://svn.freebsd.org/changeset/base/192803 >=20 > Log: > - Fix wrong print on BIO_DONE. > - Use db_printf instead of printf. While here, apply this to other ddb = commands > as well. Thanks for fixing mine as well:) I realized after sending you the e-mail that I did the same mistake:) --=20 Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --lCAWRPmW1mITcIfM Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFKG78EForvXbEpPzQRAuhJAJ4+UdBQimpexNF7qqG8/8u/hcbUUACgtD7I wbx9v/EkEEPE/x8jqkI4T98= =l4Mu -----END PGP SIGNATURE----- --lCAWRPmW1mITcIfM-- From owner-svn-src-head@FreeBSD.ORG Tue May 26 10:28:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5485510656AE; Tue, 26 May 2009 10:28:48 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id E0DBF8FC0C; Tue, 26 May 2009 10:28:47 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 6FBE546C15; Tue, 26 May 2009 06:28:47 -0400 (EDT) Date: Tue, 26 May 2009 11:28:47 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Edward Tomasz Napierala In-Reply-To: <200905260822.n4Q8M0Zv051280@svn.freebsd.org> Message-ID: References: <200905260822.n4Q8M0Zv051280@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="621616949-1965451849-1243333727=:23177" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192800 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris/common/acl cddl/contrib/opensolaris/uts/common/fs/zfs cddl/contrib/opensolaris/u... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 10:28:49 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --621616949-1965451849-1243333727=:23177 Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT On Tue, 26 May 2009, Edward Tomasz Napierala wrote: > +/*- > + * Copyright (c) 2008, 2009 Edward Tomasz Napierała > + * 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. > + * > + * ALTHOUGH THIS SOFTWARE IS MADE OF WIN AND SCIENCE, IT IS PROVIDED BY THE Cute though this BSD license variation is, I'm pretty sure it's not on the approved license list. Sticking to the standard license templates potentially saves significant trouble later -- especially when people working on files are contractually constrained as to what licenses they use, in which case they may end up having to put extra licenses on files in order to meet those constraints, or if companies have to get all licenses in their software approved by lawyers... Please fix. Robert N M Watson Computer Laboratory University of Cambridge > + * 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 > +#include > +#include > +#include > + > +struct zfs2bsd { > + uint32_t zb_zfs; > + int zb_bsd; > +}; > + > +struct zfs2bsd perms[] = {{ACE_READ_DATA, ACL_READ_DATA}, > + {ACE_WRITE_DATA, ACL_WRITE_DATA}, > + {ACE_EXECUTE, ACL_EXECUTE}, > + {ACE_APPEND_DATA, ACL_APPEND_DATA}, > + {ACE_DELETE_CHILD, ACL_DELETE_CHILD}, > + {ACE_DELETE, ACL_DELETE}, > + {ACE_READ_ATTRIBUTES, ACL_READ_ATTRIBUTES}, > + {ACE_WRITE_ATTRIBUTES, ACL_WRITE_ATTRIBUTES}, > + {ACE_READ_NAMED_ATTRS, ACL_READ_NAMED_ATTRS}, > + {ACE_WRITE_NAMED_ATTRS, ACL_WRITE_NAMED_ATTRS}, > + {ACE_READ_ACL, ACL_READ_ACL}, > + {ACE_WRITE_ACL, ACL_WRITE_ACL}, > + {ACE_WRITE_OWNER, ACL_WRITE_OWNER}, > + {ACE_SYNCHRONIZE, ACL_SYNCHRONIZE}, > + {0, 0}}; > + > +struct zfs2bsd flags[] = {{ACE_FILE_INHERIT_ACE, > + ACL_ENTRY_FILE_INHERIT}, > + {ACE_DIRECTORY_INHERIT_ACE, > + ACL_ENTRY_DIRECTORY_INHERIT}, > + {ACE_NO_PROPAGATE_INHERIT_ACE, > + ACL_ENTRY_NO_PROPAGATE_INHERIT}, > + {ACE_INHERIT_ONLY_ACE, > + ACL_ENTRY_INHERIT_ONLY}, > + {ACE_SUCCESSFUL_ACCESS_ACE_FLAG, > + ACL_ENTRY_SUCCESSFUL_ACCESS}, > + {ACE_FAILED_ACCESS_ACE_FLAG, > + ACL_ENTRY_FAILED_ACCESS}, > + {0, 0}}; > + > +static int > +_bsd_from_zfs(uint32_t zfs, const struct zfs2bsd *table) > +{ > + const struct zfs2bsd *tmp; > + int bsd = 0; > + > + for (tmp = table; tmp->zb_zfs != 0; tmp++) { > + if (zfs & tmp->zb_zfs) > + bsd |= tmp->zb_bsd; > + } > + > + return (bsd); > +} > + > +static uint32_t > +_zfs_from_bsd(int bsd, const struct zfs2bsd *table) > +{ > + const struct zfs2bsd *tmp; > + uint32_t zfs = 0; > + > + for (tmp = table; tmp->zb_bsd != 0; tmp++) { > + if (bsd & tmp->zb_bsd) > + zfs |= tmp->zb_zfs; > + } > + > + return (zfs); > +} > + > +int > +acl_from_aces(struct acl *aclp, const ace_t *aces, int nentries) > +{ > + int i; > + struct acl_entry *entry; > + const ace_t *ace; > + > + KASSERT(nentries >= 1, ("empty ZFS ACL")); > + > + if (nentries > ACL_MAX_ENTRIES) { > + /* > + * I believe it may happen only when moving a pool > + * from SunOS to FreeBSD. > + */ > + printf("acl_from_aces: ZFS ACL too big to fit " > + "into 'struct acl'; returning EINVAL.\n"); > + return (EINVAL); > + } > + > + bzero(aclp, sizeof(*aclp)); > + aclp->acl_maxcnt = ACL_MAX_ENTRIES; > + aclp->acl_cnt = nentries; > + > + for (i = 0; i < nentries; i++) { > + entry = &(aclp->acl_entry[i]); > + ace = &(aces[i]); > + > + if (ace->a_flags & ACE_OWNER) > + entry->ae_tag = ACL_USER_OBJ; > + else if (ace->a_flags & ACE_GROUP) > + entry->ae_tag = ACL_GROUP_OBJ; > + else if (ace->a_flags & ACE_EVERYONE) > + entry->ae_tag = ACL_EVERYONE; > + else if (ace->a_flags & ACE_IDENTIFIER_GROUP) > + entry->ae_tag = ACL_GROUP; > + else > + entry->ae_tag = ACL_USER; > + > + if (entry->ae_tag == ACL_USER || entry->ae_tag == ACL_GROUP) > + entry->ae_id = ace->a_who; > + else > + entry->ae_id = ACL_UNDEFINED_ID; > + > + entry->ae_perm = _bsd_from_zfs(ace->a_access_mask, perms); > + entry->ae_flags = _bsd_from_zfs(ace->a_flags, flags); > + > + switch (ace->a_type) { > + case ACE_ACCESS_ALLOWED_ACE_TYPE: > + entry->ae_entry_type = ACL_ENTRY_TYPE_ALLOW; > + break; > + case ACE_ACCESS_DENIED_ACE_TYPE: > + entry->ae_entry_type = ACL_ENTRY_TYPE_DENY; > + break; > + case ACE_SYSTEM_AUDIT_ACE_TYPE: > + entry->ae_entry_type = ACL_ENTRY_TYPE_AUDIT; > + break; > + case ACE_SYSTEM_ALARM_ACE_TYPE: > + entry->ae_entry_type = ACL_ENTRY_TYPE_ALARM; > + break; > + default: > + panic("acl_from_aces: a_type is 0x%x", ace->a_type); > + } > + } > + > + return (0); > +} > + > +void > +aces_from_acl(ace_t *aces, int *nentries, const struct acl *aclp) > +{ > + int i; > + const struct acl_entry *entry; > + ace_t *ace; > + > + bzero(aces, sizeof(*aces) * aclp->acl_cnt); > + > + *nentries = aclp->acl_cnt; > + > + for (i = 0; i < aclp->acl_cnt; i++) { > + entry = &(aclp->acl_entry[i]); > + ace = &(aces[i]); > + > + ace->a_who = entry->ae_id; > + > + if (entry->ae_tag == ACL_USER_OBJ) > + ace->a_flags = ACE_OWNER; > + else if (entry->ae_tag == ACL_GROUP_OBJ) > + ace->a_flags = (ACE_GROUP | ACE_IDENTIFIER_GROUP); > + else if (entry->ae_tag == ACL_GROUP) > + ace->a_flags = ACE_IDENTIFIER_GROUP; > + else if (entry->ae_tag == ACL_EVERYONE) > + ace->a_flags = ACE_EVERYONE; > + else /* ACL_USER */ > + ace->a_flags = 0; > + > + ace->a_access_mask = _zfs_from_bsd(entry->ae_perm, perms); > + ace->a_flags |= _zfs_from_bsd(entry->ae_flags, flags); > + > + switch (entry->ae_entry_type) { > + case ACL_ENTRY_TYPE_ALLOW: > + ace->a_type = ACE_ACCESS_ALLOWED_ACE_TYPE; > + break; > + case ACL_ENTRY_TYPE_DENY: > + ace->a_type = ACE_ACCESS_DENIED_ACE_TYPE; > + break; > + case ACL_ENTRY_TYPE_ALARM: > + ace->a_type = ACE_SYSTEM_ALARM_ACE_TYPE; > + break; > + case ACL_ENTRY_TYPE_AUDIT: > + ace->a_type = ACE_SYSTEM_AUDIT_ACE_TYPE; > + break; > + default: > + panic("aces_from_acl: ae_entry_type is 0x%x", entry->ae_entry_type); > + } > + } > +} > > Added: head/sys/cddl/compat/opensolaris/sys/acl.h > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/cddl/compat/opensolaris/sys/acl.h Tue May 26 08:21:59 2009 (r192800) > @@ -0,0 +1,39 @@ > +/*- > + * Copyright (c) 2008, 2009 Edward Tomasz Napierała > + * 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. > + * > + * ALTHOUGH THIS SOFTWARE IS MADE OF WIN AND SCIENCE, IT 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$ > + */ > + > +#ifndef OPENSOLARIS_SYS_ACL_H > +#define OPENSOLARIS_SYS_ACL_H > + > +#include_next > + > +struct acl; > + > +void aces_from_acl(ace_t *aces, int *nentries, const struct acl *aclp); > +int acl_from_aces(struct acl *aclp, const ace_t *aces, int nentries); > + > +#endif /* OPENSOLARIS_SYS_ACL_H */ > > Modified: head/sys/cddl/contrib/opensolaris/common/acl/acl_common.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/common/acl/acl_common.c Tue May 26 07:40:32 2009 (r192799) > +++ head/sys/cddl/contrib/opensolaris/common/acl/acl_common.c Tue May 26 08:21:59 2009 (r192800) > @@ -424,7 +424,7 @@ cacl_free(void *ptr, size_t size) > #endif > } > > -#ifndef __FreeBSD__ > +#if !defined(_KERNEL) > acl_t * > acl_alloc(enum acl_type type) > { > @@ -470,7 +470,6 @@ acl_free(acl_t *aclp) > > cacl_free(aclp, sizeof (acl_t)); > } > -#endif > > static uint32_t > access_mask_set(int haswriteperm, int hasreadperm, int isowner, int isallow) > @@ -1727,3 +1726,4 @@ out: > return (error); > #endif > } > +#endif /* _KERNEL */ > > Modified: head/sys/cddl/contrib/opensolaris/common/acl/acl_common.h > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/common/acl/acl_common.h Tue May 26 07:40:32 2009 (r192799) > +++ head/sys/cddl/contrib/opensolaris/common/acl/acl_common.h Tue May 26 08:21:59 2009 (r192800) > @@ -46,6 +46,7 @@ extern int ace_trivial(ace_t *acep, int > extern int ace_trivial_common(void *, int, > uint64_t (*walk)(void *, uint64_t, int aclcnt, uint16_t *, uint16_t *, > uint32_t *mask)); > +#if !defined(_KERNEL) > extern acl_t *acl_alloc(acl_type_t); > extern void acl_free(acl_t *aclp); > extern int acl_translate(acl_t *aclp, int target_flavor, > @@ -53,6 +54,7 @@ extern int acl_translate(acl_t *aclp, in > void ksort(caddr_t v, int n, int s, int (*f)()); > int cmp2acls(void *a, void *b); > > +#endif /* _KERNEL */ > > #ifdef __cplusplus > } > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h Tue May 26 07:40:32 2009 (r192799) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h Tue May 26 08:21:59 2009 (r192800) > @@ -188,10 +188,8 @@ struct zfs_fuid_info; > #ifdef _KERNEL > void zfs_perm_init(struct znode *, struct znode *, int, vattr_t *, > dmu_tx_t *, cred_t *, zfs_acl_t *, zfs_fuid_info_t **); > -#ifdef TODO > int zfs_getacl(struct znode *, vsecattr_t *, boolean_t, cred_t *); > int zfs_setacl(struct znode *, vsecattr_t *, boolean_t, cred_t *); > -#endif > void zfs_acl_rele(void *); > void zfs_oldace_byteswap(ace_t *, int); > void zfs_ace_byteswap(void *, size_t, boolean_t); > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Tue May 26 07:40:32 2009 (r192799) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c Tue May 26 08:21:59 2009 (r192800) > @@ -1909,7 +1909,6 @@ zfs_perm_init(znode_t *zp, znode_t *pare > zfs_acl_free(aclp); > } > > -#ifdef TODO > /* > * Retrieve a files ACL > */ > @@ -2005,7 +2004,6 @@ zfs_getacl(znode_t *zp, vsecattr_t *vsec > > return (0); > } > -#endif /* TODO */ > > int > zfs_vsec_2_aclp(zfsvfs_t *zfsvfs, vtype_t obj_type, > @@ -2062,7 +2060,6 @@ zfs_vsec_2_aclp(zfsvfs_t *zfsvfs, vtype_ > return (0); > } > > -#ifdef TODO > /* > * Set a files ACL > */ > @@ -2170,7 +2167,6 @@ done: > > return (error); > } > -#endif /* TODO */ > > /* > * working_mode returns the permissions that were not granted > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue May 26 07:40:32 2009 (r192799) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue May 26 08:21:59 2009 (r192800) > @@ -45,7 +45,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -67,6 +66,7 @@ > #include > #include > #include > +#include > > /* > * Programming rules. > @@ -3846,7 +3846,6 @@ zfs_pathconf(vnode_t *vp, int cmd, ulong > } > } > > -#ifdef TODO > /*ARGSUSED*/ > static int > zfs_getsecattr(vnode_t *vp, vsecattr_t *vsecp, int flag, cred_t *cr, > @@ -3864,9 +3863,7 @@ zfs_getsecattr(vnode_t *vp, vsecattr_t * > > return (error); > } > -#endif /* TODO */ > > -#ifdef TODO > /*ARGSUSED*/ > static int > zfs_setsecattr(vnode_t *vp, vsecattr_t *vsecp, int flag, cred_t *cr, > @@ -3883,7 +3880,6 @@ zfs_setsecattr(vnode_t *vp, vsecattr_t * > ZFS_EXIT(zfsvfs); > return (error); > } > -#endif /* TODO */ > > static int > zfs_freebsd_open(ap) > @@ -4777,6 +4773,90 @@ vop_listextattr { > return (error); > } > > +int > +zfs_freebsd_getacl(ap) > + struct vop_getacl_args /* { > + struct vnode *vp; > + acl_type_t type; > + struct acl *aclp; > + struct ucred *cred; > + struct thread *td; > + } */ *ap; > +{ > + int error; > + vsecattr_t vsecattr; > + > + if (ap->a_type != ACL_TYPE_NFS4) > + return (EOPNOTSUPP); > + > + vsecattr.vsa_mask = VSA_ACE | VSA_ACECNT; > + if (error = zfs_getsecattr(ap->a_vp, &vsecattr, 0, ap->a_cred, NULL)) > + return (error); > + > + error = acl_from_aces(ap->a_aclp, vsecattr.vsa_aclentp, vsecattr.vsa_aclcnt); > + if (vsecattr.vsa_aclentp != NULL) > + kmem_free(vsecattr.vsa_aclentp, vsecattr.vsa_aclentsz); > + > + return (error); > +} > + > +int > +zfs_freebsd_setacl(ap) > + struct vop_setacl_args /* { > + struct vnode *vp; > + acl_type_t type; > + struct acl *aclp; > + struct ucred *cred; > + struct thread *td; > + } */ *ap; > +{ > + int error; > + vsecattr_t vsecattr; > + int aclbsize; /* size of acl list in bytes */ > + aclent_t *aaclp; > + > + if (ap->a_type != ACL_TYPE_NFS4) > + return (EOPNOTSUPP); > + > + if (ap->a_aclp->acl_cnt < 1 || ap->a_aclp->acl_cnt > MAX_ACL_ENTRIES) > + return (EINVAL); > + > + /* > + * With NFS4 ACLs, chmod(2) may need to add additional entries, > + * splitting every entry into two and appending "canonical six" > + * entries at the end. Don't allow for setting an ACL that would > + * cause chmod(2) to run out of ACL entries. > + */ > + if (ap->a_aclp->acl_cnt * 2 + 6 > ACL_MAX_ENTRIES) > + return (ENOSPC); > + > + vsecattr.vsa_mask = VSA_ACE; > + aclbsize = ap->a_aclp->acl_cnt * sizeof(ace_t); > + vsecattr.vsa_aclentp = kmem_alloc(aclbsize, KM_SLEEP); > + aaclp = vsecattr.vsa_aclentp; > + vsecattr.vsa_aclentsz = aclbsize; > + > + aces_from_acl(vsecattr.vsa_aclentp, &vsecattr.vsa_aclcnt, ap->a_aclp); > + error = zfs_setsecattr(ap->a_vp, &vsecattr, 0, ap->a_cred, NULL); > + kmem_free(aaclp, aclbsize); > + > + return (error); > +} > + > +int > +zfs_freebsd_aclcheck(ap) > + struct vop_aclcheck_args /* { > + struct vnode *vp; > + acl_type_t type; > + struct acl *aclp; > + struct ucred *cred; > + struct thread *td; > + } */ *ap; > +{ > + > + return (EOPNOTSUPP); > +} > + > struct vop_vector zfs_vnodeops; > struct vop_vector zfs_fifoops; > > @@ -4816,6 +4896,11 @@ struct vop_vector zfs_vnodeops = { > .vop_deleteextattr = zfs_deleteextattr, > .vop_setextattr = zfs_setextattr, > .vop_listextattr = zfs_listextattr, > +#ifdef notyet > + .vop_getacl = zfs_freebsd_getacl, > + .vop_setacl = zfs_freebsd_setacl, > + .vop_aclcheck = zfs_freebsd_aclcheck, > +#endif > }; > > struct vop_vector zfs_fifoops = { > @@ -4829,4 +4914,9 @@ struct vop_vector zfs_fifoops = { > .vop_setattr = zfs_freebsd_setattr, > .vop_write = VOP_PANIC, > .vop_fid = zfs_freebsd_fid, > +#ifdef notyet > + .vop_getacl = zfs_freebsd_getacl, > + .vop_setacl = zfs_freebsd_setacl, > + .vop_aclcheck = zfs_freebsd_aclcheck, > +#endif > }; > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h Tue May 26 07:40:32 2009 (r192799) > +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h Tue May 26 08:21:59 2009 (r192800) > @@ -31,12 +31,22 @@ > #include > #include > > +#if defined(_KERNEL) > +/* > + * When compiling OpenSolaris kernel code, this file is getting > + * included instead of FreeBSD one. Pull the original sys/acl.h as well. > + */ > +#undef _SYS_ACL_H > +#include_next > +#define _SYS_ACL_H > +#endif /* _KERNEL */ > + > #ifdef __cplusplus > extern "C" { > #endif > > #define MAX_ACL_ENTRIES (1024) /* max entries of each type */ > -typedef struct acl { > +typedef struct { > int a_type; /* the type of ACL entry */ > uid_t a_id; /* the entry in -uid or gid */ > o_mode_t a_perm; /* the permission field */ > @@ -49,7 +59,9 @@ typedef struct ace { > uint16_t a_type; /* allow or deny */ > } ace_t; > > +#if !defined(_KERNEL) > typedef struct acl_info acl_t; > +#endif > > /* > * The following are Defined types for an aclent_t. > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/acl_impl.h > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/sys/acl_impl.h Tue May 26 07:40:32 2009 (r192799) > +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/acl_impl.h Tue May 26 08:21:59 2009 (r192800) > @@ -44,10 +44,10 @@ extern "C" { > typedef enum acl_type { > ACLENT_T = 0, > ACE_T = 1 > -} acl_type_t; > +} zfs_acl_type_t; > > struct acl_info { > - acl_type_t acl_type; /* style of acl */ > + zfs_acl_type_t acl_type; /* style of acl */ > int acl_cnt; /* number of acl entries */ > int acl_entry_size; /* sizeof acl entry */ > int acl_flags; /* special flags about acl */ > > Modified: head/sys/modules/zfs/Makefile > ============================================================================== > --- head/sys/modules/zfs/Makefile Tue May 26 07:40:32 2009 (r192799) > +++ head/sys/modules/zfs/Makefile Tue May 26 08:21:59 2009 (r192800) > @@ -16,6 +16,7 @@ SRCS+= nvpair.c > SRCS+= u8_textprep.c > > .PATH: ${.CURDIR}/../../cddl/compat/opensolaris/kern > +SRCS+= opensolaris_acl.c > SRCS+= opensolaris_kmem.c > SRCS+= opensolaris_kobj.c > SRCS+= opensolaris_kstat.c > --621616949-1965451849-1243333727=:23177-- From owner-svn-src-head@FreeBSD.ORG Tue May 26 11:42:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EDFE11065672; Tue, 26 May 2009 11:42:06 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D9C908FC2B; Tue, 26 May 2009 11:42:06 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QBg6cH057218; Tue, 26 May 2009 11:42:06 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QBg6Sv057215; Tue, 26 May 2009 11:42:06 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200905261142.n4QBg6Sv057215@svn.freebsd.org> From: Edward Tomasz Napierala Date: Tue, 26 May 2009 11:42:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192804 - in head: lib/libc/posix1e sys/cddl/compat/opensolaris/kern sys/cddl/compat/opensolaris/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 11:42:08 -0000 Author: trasz Date: Tue May 26 11:42:06 2009 New Revision: 192804 URL: http://svn.freebsd.org/changeset/base/192804 Log: Change license to more bori^Wadul^Wcanonical. Submitted by: rwatson@ Modified: head/lib/libc/posix1e/acl_compat.c head/sys/cddl/compat/opensolaris/kern/opensolaris_acl.c head/sys/cddl/compat/opensolaris/sys/acl.h Modified: head/lib/libc/posix1e/acl_compat.c ============================================================================== --- head/lib/libc/posix1e/acl_compat.c Tue May 26 10:03:44 2009 (r192803) +++ head/lib/libc/posix1e/acl_compat.c Tue May 26 11:42:06 2009 (r192804) @@ -11,17 +11,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * ALTHOUGH THIS SOFTWARE IS MADE OF WIN AND SCIENCE, IT 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 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 Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_acl.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_acl.c Tue May 26 10:03:44 2009 (r192803) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_acl.c Tue May 26 11:42:06 2009 (r192804) @@ -11,17 +11,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * ALTHOUGH THIS SOFTWARE IS MADE OF WIN AND SCIENCE, IT 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 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 Modified: head/sys/cddl/compat/opensolaris/sys/acl.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/acl.h Tue May 26 10:03:44 2009 (r192803) +++ head/sys/cddl/compat/opensolaris/sys/acl.h Tue May 26 11:42:06 2009 (r192804) @@ -11,17 +11,17 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * ALTHOUGH THIS SOFTWARE IS MADE OF WIN AND SCIENCE, IT 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 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$ */ From owner-svn-src-head@FreeBSD.ORG Tue May 26 12:01:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0EC2B10656E5; Tue, 26 May 2009 12:01:38 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ED74D8FC18; Tue, 26 May 2009 12:01:37 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QC1bwS057662; Tue, 26 May 2009 12:01:37 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QC1b47057661; Tue, 26 May 2009 12:01:37 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200905261201.n4QC1b47057661@svn.freebsd.org> From: Ed Schouten Date: Tue, 26 May 2009 12:01:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192805 - head/sys/dev/bktr X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 12:01:40 -0000 Author: ed Date: Tue May 26 12:01:37 2009 New Revision: 192805 URL: http://svn.freebsd.org/changeset/base/192805 Log: Unbreak bktr(4). Modified: head/sys/dev/bktr/bktr_os.c Modified: head/sys/dev/bktr/bktr_os.c ============================================================================== --- head/sys/dev/bktr/bktr_os.c Tue May 26 11:42:06 2009 (r192804) +++ head/sys/dev/bktr/bktr_os.c Tue May 26 12:01:37 2009 (r192805) @@ -470,7 +470,7 @@ fail: if (bktr->res_irq) bus_release_resource(dev, SYS_RES_IRQ, bktr->irq_rid, bktr->res_irq); if (bktr->res_mem) - bus_release_resource(dev, SYS_RES_MEM, bktr->mem_rid, bktr->res_mem); + bus_release_resource(dev, SYS_RES_MEMORY, bktr->mem_rid, bktr->res_mem); return error; } From owner-svn-src-head@FreeBSD.ORG Tue May 26 13:24:28 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A86B21065672; Tue, 26 May 2009 13:24:28 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: from mail-fx0-f168.google.com (mail-fx0-f168.google.com [209.85.220.168]) by mx1.freebsd.org (Postfix) with ESMTP id 69A258FC1D; Tue, 26 May 2009 13:24:27 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: by fxm12 with SMTP id 12so3927055fxm.43 for ; Tue, 26 May 2009 06:24:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to:cc :content-type:content-transfer-encoding; bh=7TSmZcgycVJuuYPIUlK/GwaeiQGW3MXhPXEmVCQ3e7Q=; b=ZTM7PBPbj4llVMmSvHVGQIJh3zPcmjaOL02EWelH/Gm06yJHdK0BPkUH5jVXDM0MGI TwJkDa2cBz/WGtYaeJTr7jd3Ro9alQz91VL4Xdk8X/lp5cUUxBki895rYd5q2NdUcFy0 qsuqgnlZgE2fjkk47QshKMgAAiajwfLC9RjLE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=owLrj1WN2bvM1lV5VsMpvTYzhudLXlLtufgtHdkPKbw/q3GTt9TsTwig4pjI33U9W/ odWVL1bL8xN0HPM5WqFFIse2GvqaFtI732PxEAI6SKq5YIp3noNuKLpInJEJ8MtSnw1U 2ZsJnbrRf0JFXD8zijsJar8vLUlctfzt4ik+A= MIME-Version: 1.0 Sender: ivoras@gmail.com Received: by 10.204.62.135 with SMTP id x7mr8140287bkh.95.1243344266169; Tue, 26 May 2009 06:24:26 -0700 (PDT) In-Reply-To: References: <200905260822.n4Q8M0Zv051280@svn.freebsd.org> From: Ivan Voras Date: Tue, 26 May 2009 15:24:05 +0200 X-Google-Sender-Auth: 4c8d88febd9ae384 Message-ID: <9bbcef730905260624x289af079ue8524e821c1dc891@mail.gmail.com> To: Robert Watson Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Edward Tomasz Napierala Subject: Re: svn commit: r192800 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris/common/acl cddl/contrib/opensolaris/uts/common/fs/zfs cddl/contrib/opensolaris/u... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 13:24:29 -0000 2009/5/26 Robert Watson : > On Tue, 26 May 2009, Edward Tomasz Napierala wrote: > >> +/*- >> + * Copyright (c) 2008, 2009 Edward Tomasz Napiera=C5=82a >> + * 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 >> + * =C2=A0 =C2=A0notice, this list of conditions and the following discl= aimer. >> + * 2. Redistributions in binary form must reproduce the above copyright >> + * =C2=A0 =C2=A0notice, this list of conditions and the following discl= aimer in the >> + * =C2=A0 =C2=A0documentation and/or other materials provided with the >> distribution. >> + * >> + * ALTHOUGH THIS SOFTWARE IS MADE OF WIN AND SCIENCE, IT IS PROVIDED BY >> THE > > Cute though this BSD license variation is, I'm pretty sure it's not on th= e > approved license list. =C2=A0Sticking to the standard license templates > potentially saves significant trouble later -- especially when people Hmm, I'm sure that there exists some SVN magic which would allow authors to enter something $BSDL2 Charlie Root 2008,2009$ and it expands to a perfect boilerplate on checkout :) From owner-svn-src-head@FreeBSD.ORG Tue May 26 14:01:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 348481065670; Tue, 26 May 2009 14:01:38 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id C6F128FC23; Tue, 26 May 2009 14:01:37 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id C87621CF3C; Tue, 26 May 2009 16:01:36 +0200 (CEST) Date: Tue, 26 May 2009 16:01:36 +0200 From: Ed Schouten To: Ulf Lilleengen Message-ID: <20090526140136.GA48776@hoeg.nl> References: <200905261003.n4QA3iB5053546@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="sdtB3X0nJg68CQEu" Content-Disposition: inline In-Reply-To: <200905261003.n4QA3iB5053546@svn.freebsd.org> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192803 - head/sys/geom X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 14:01:39 -0000 --sdtB3X0nJg68CQEu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Ulf, * Ulf Lilleengen wrote: > + db_printf(" offset: %lld\n", bp->bio_offset); These printfs seem to break on 64-bit platforms. Yours, --=20 Ed Schouten WWW: http://80386.nl/ --sdtB3X0nJg68CQEu Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkob9kAACgkQ52SDGA2eCwVoQgCeJ2iDCIO8StIZtyDUdpCiCJqm EfkAn0Xan1nKgw5v6yGUL6+lLABHkKdn =epPr -----END PGP SIGNATURE----- --sdtB3X0nJg68CQEu-- From owner-svn-src-head@FreeBSD.ORG Tue May 26 14:05:47 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9581B1065670; Tue, 26 May 2009 14:05:47 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from bene2.itea.ntnu.no (bene2.itea.ntnu.no [IPv6:2001:700:300:3::57]) by mx1.freebsd.org (Postfix) with ESMTP id 187D78FC2F; Tue, 26 May 2009 14:05:47 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by bene2.itea.ntnu.no (Postfix) with ESMTP id 2B3649000E; Tue, 26 May 2009 16:05:45 +0200 (CEST) Received: from carrot.geeknest.org (gaupe.stud.ntnu.no [IPv6:2001:700:300:3::184]) by bene2.itea.ntnu.no (Postfix) with ESMTP id 5207D90014; Tue, 26 May 2009 16:05:42 +0200 (CEST) Date: Tue, 26 May 2009 16:05:42 +0200 From: Ulf Lilleengen To: Ed Schouten Message-ID: <20090526140542.GA1575@carrot.geeknest.org> References: <200905261003.n4QA3iB5053546@svn.freebsd.org> <20090526140136.GA48776@hoeg.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090526140136.GA48776@hoeg.nl> User-Agent: Mutt/1.5.19 (2009-01-05) X-Virus-Scanned: Debian amavisd-new at bene2.itea.ntnu.no Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192803 - head/sys/geom X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 14:05:48 -0000 On Tue, May 26, 2009 at 04:01:36PM +0200, Ed Schouten wrote: > Hi Ulf, > > * Ulf Lilleengen wrote: > > + db_printf(" offset: %lld\n", bp->bio_offset); > > These printfs seem to break on 64-bit platforms. > Ah, thanks for the notice. Fixing now. -- Ulf Lilleengen From owner-svn-src-head@FreeBSD.ORG Tue May 26 14:15:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C693F106568C; Tue, 26 May 2009 14:15:06 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B40838FC0C; Tue, 26 May 2009 14:15:06 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QEF6P5060569; Tue, 26 May 2009 14:15:06 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QEF64s060568; Tue, 26 May 2009 14:15:06 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200905261415.n4QEF64s060568@svn.freebsd.org> From: Ulf Lilleengen Date: Tue, 26 May 2009 14:15:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192808 - head/sys/geom X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 14:15:07 -0000 Author: lulf Date: Tue May 26 14:15:06 2009 New Revision: 192808 URL: http://svn.freebsd.org/changeset/base/192808 Log: - Unbreak 64 bit platforms by casting off_t to intmax. Modified: head/sys/geom/geom_subr.c Modified: head/sys/geom/geom_subr.c ============================================================================== --- head/sys/geom/geom_subr.c Tue May 26 14:13:12 2009 (r192807) +++ head/sys/geom/geom_subr.c Tue May 26 14:15:06 2009 (r192808) @@ -1310,11 +1310,11 @@ DB_SHOW_COMMAND(bio, db_show_bio) db_print_bio_flags(bp); db_printf(" cflags: 0x%hhx\n", bp->bio_cflags); db_printf(" pflags: 0x%hhx\n", bp->bio_pflags); - db_printf(" offset: %lld\n", bp->bio_offset); - db_printf(" length: %lld\n", bp->bio_length); + db_printf(" offset: %jd\n", (intmax_t)bp->bio_offset); + db_printf(" length: %jd\n", (intmax_t)bp->bio_length); db_printf(" bcount: %ld\n", bp->bio_bcount); db_printf(" resid: %ld\n", bp->bio_resid); - db_printf(" completed: %lld\n", bp->bio_completed); + db_printf(" completed: %jd\n", (intmax_t)bp->bio_completed); db_printf(" children: %u\n", bp->bio_children); db_printf(" inbed: %u\n", bp->bio_inbed); db_printf(" error: %d\n", bp->bio_error); From owner-svn-src-head@FreeBSD.ORG Tue May 26 15:19:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53D1E106564A; Tue, 26 May 2009 15:19:05 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E5ED8FC12; Tue, 26 May 2009 15:19:05 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QFJ5i9061944; Tue, 26 May 2009 15:19:05 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QFJ4Gh061933; Tue, 26 May 2009 15:19:04 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200905261519.n4QFJ4Gh061933@svn.freebsd.org> From: Rick Macklem Date: Tue, 26 May 2009 15:19:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192811 - in head/usr.sbin: . nfscbd nfsdumpstate nfsrevoke nfsuserd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 15:19:05 -0000 Author: rmacklem Date: Tue May 26 15:19:04 2009 New Revision: 192811 URL: http://svn.freebsd.org/changeset/base/192811 Log: Add two new utilities and two new daemons to /usr/src/usr.sbin that are specifically used by the experimental nfsv4 subsystem. nfscbd - The NFSv4 client callback daemon. nfsuserd - The NFSv4 daemon that maps between user and group name and their corresponding uid/gid numbers. nfsdumpstate - A utility that dumps out the NFSv4 Open/Lock state. nfsrevoke - Administratively revokes an NFSv4 client, releasing all NFSv4 Open/Lock state it holds on the server. Approved by: kib (mentor) Added: head/usr.sbin/nfscbd/ head/usr.sbin/nfscbd/Makefile (contents, props changed) head/usr.sbin/nfscbd/nfscbd.8 (contents, props changed) head/usr.sbin/nfscbd/nfscbd.c (contents, props changed) head/usr.sbin/nfsdumpstate/ head/usr.sbin/nfsdumpstate/Makefile (contents, props changed) head/usr.sbin/nfsdumpstate/nfsdumpstate.8 (contents, props changed) head/usr.sbin/nfsdumpstate/nfsdumpstate.c (contents, props changed) head/usr.sbin/nfsrevoke/ head/usr.sbin/nfsrevoke/Makefile (contents, props changed) head/usr.sbin/nfsrevoke/nfsrevoke.8 (contents, props changed) head/usr.sbin/nfsrevoke/nfsrevoke.c (contents, props changed) head/usr.sbin/nfsuserd/ head/usr.sbin/nfsuserd/Makefile (contents, props changed) head/usr.sbin/nfsuserd/nfsuserd.8 (contents, props changed) head/usr.sbin/nfsuserd/nfsuserd.c (contents, props changed) Modified: head/usr.sbin/Makefile Modified: head/usr.sbin/Makefile ============================================================================== --- head/usr.sbin/Makefile Tue May 26 14:43:44 2009 (r192810) +++ head/usr.sbin/Makefile Tue May 26 15:19:04 2009 (r192811) @@ -110,7 +110,11 @@ SUBDIR= ${_ac} \ ${_ndiscvt} \ ${_ndp} \ newsyslog \ + nfscbd \ nfsd \ + nfsdumpstate \ + nfsrevoke \ + nfsuserd \ ${_ngctl} \ ${_nghook} \ nologin \ Added: head/usr.sbin/nfscbd/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/nfscbd/Makefile Tue May 26 15:19:04 2009 (r192811) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +PROG= nfscbd +MAN= nfscbd.8 + +.include Added: head/usr.sbin/nfscbd/nfscbd.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/nfscbd/nfscbd.8 Tue May 26 15:19:04 2009 (r192811) @@ -0,0 +1,87 @@ +.\" Copyright (c) 2009 Rick Macklem, University of Guelph +.\" 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. +.\" +.\" $FreeBSD$ +.\" +.Dd April 25, 2009 +.Dt NFSCBD 8 +.Os +.Sh NAME +.Nm nfscbd +.Tn NFSv4 +client side callback daemon +.Sh SYNOPSIS +.Nm nfscbd +.Op Fl p Ar port_number +.Op Fl P Ar client_principal +.Sh DESCRIPTION +.Nm +runs on a client using +.Tn NFSv4 +to handle callback requests from the NFSv4 server. +If no +.Nm +is running, NFSv4 mounts will still work, but the server will never issue +Open Delegations to the client. +.Pp +One callback server and one master server +are always started. +.Pp +The following options are available: +.Bl -tag -width Ds +.It Fl p Ar port_number +Specifies what port# the callback server should use. +.It Fl P Ar client_principal +Specifies the host based principal name to be used as the target for +callbacks over RPCSEC_GSS. For KerberosV, it must be in the client's +default keytab file. +This client_principal should be the same one specified by the +.Cm gssname +argument being used by nfsv4 mounts. +If you do not specify this argument, callbacks will still work over AUTH_SYS, +which is what many extant servers use even for RPCSEC_GSS mounts, as of 2009. +.El +.Pp +For example, +.Dq Li "nfscbd -p 7654 -P root" +starts the daemon to handle callbacks on port# 7654 and is using the host based +principal root@. as the callback target. +.Pp +.Nm +listens for service requests at the port +defined by NFSV4_CBPORT in /usr/include/fs/nfs/nfs.h, unless +.Fl p +has been specified. +For more information on what callbacks and Open Delegations do, see +.%T "Network File System (NFS) Version 4 Protocol" , +RFC3530 . +.Pp +The +.Nm +utility exits 0 on success or >0 if an error occurred. +.Sh SEE ALSO +.Xr nfsv4 4 , +.Xr mount_nfs 8 +.Sh HISTORY +First introduced with the experimental nfs client for NFSv4 support in 2009. Added: head/usr.sbin/nfscbd/nfscbd.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/nfscbd/nfscbd.c Tue May 26 15:19:04 2009 (r192811) @@ -0,0 +1,380 @@ +/*- + * Copyright (c) 2009 Rick Macklem, University of Guelph + * 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 +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Global defs */ +#ifdef DEBUG +#define syslog(e, s) fprintf(stderr,(s)) +int debug = 1; +#else +int debug = 0; +#endif + +pid_t children; + +void nonfs(int); +void reapchild(int); +void usage(void); +void cleanup(int); +void child_cleanup(int); +void nfscbd_exit(int); +void killchildren(void); + +/* + * Nfs callback server daemon. + * + * 1 - do file descriptor and signal cleanup + * 2 - fork the nfscbd(s) + * 4 - create callback server socket(s) + * 5 - set up server socket for rpc + * + * For connectionless protocols, just pass the socket into the kernel via. + * nfssvc(). + * For connection based sockets, loop doing accepts. When you get a new + * socket from accept, pass the msgsock into the kernel via. nfssvc(). + */ +int +main(int argc, char *argv[], char **envp) +{ + struct group *grp; + struct nfscbd_args nfscbdargs; + struct nfsd_nfscbd_args nfscbdargs2; + struct passwd *pwd; + struct ucred *cr; + struct sockaddr_in inetaddr, inetpeer; + struct timeval ktv; + fd_set ready, sockbits; + int ch, connect_type_cnt, i, len, maxsock, msgsock, error; + int nfssvc_flag, on, sock, tcpsock, ret, mustfreeai = 0; + char *cp, **cpp, princname[128]; + char myname[MAXHOSTNAMELEN], *myfqdnname = NULL; + struct addrinfo *aip, hints; + pid_t pid; + sigset_t signew; + short myport = NFSV4_CBPORT; + + if (modfind("nfscl") < 0) { + /* Not present in kernel, try loading it */ + if (kldload("nfscl") < 0 || + modfind("nfscl") < 0) + errx(1, "nfscl is not available"); + } + /* + * First, get our fully qualified host name, if possible. + */ + if (gethostname(myname, MAXHOSTNAMELEN) >= 0) { + cp = strchr(myname, '.'); + if (cp != NULL && *(cp + 1) != '\0') { + cp = myname; + } else { + /* + * No domain on myname, so try looking it up. + */ + cp = NULL; + memset((void *)&hints, 0, sizeof (hints)); + hints.ai_flags = AI_CANONNAME; + error = getaddrinfo(myname, NULL, &hints, &aip); + if (error == 0) { + if (aip->ai_canonname != NULL && + (cp = strchr(aip->ai_canonname, '.')) != NULL + && *(cp + 1) != '\0') { + cp = aip->ai_canonname; + mustfreeai = 1; + } else { + freeaddrinfo(aip); + } + } + } + if (cp == NULL) + warnx("Can't get fully qualified host name"); + myfqdnname = cp; + } + + princname[0] = '\0'; +#define GETOPT "p:P:" +#define USAGE "[ -p port_num ] [ -P client_principal ]" + while ((ch = getopt(argc, argv, GETOPT)) != -1) + switch (ch) { + case 'p': + myport = atoi(optarg); + if (myport < 1) { + warnx("port# non-positive, reset to %d", + NFSV4_CBPORT); + myport = NFSV4_CBPORT; + } + break; + case 'P': + cp = optarg; + if (cp != NULL && strlen(cp) > 0 && + strlen(cp) < sizeof (princname)) { + if (strchr(cp, '@') == NULL && + myfqdnname != NULL) + snprintf(princname, sizeof (princname), + "%s@%s", cp, myfqdnname); + else + strlcpy(princname, cp, + sizeof (princname)); + } else { + warnx("client princ invalid. ignored\n"); + } + break; + default: + case '?': + usage(); + }; + argv += optind; + argc -= optind; + + if (argc > 0) + usage(); + + if (mustfreeai) + freeaddrinfo(aip); + nfscbdargs2.principal = (const char *)princname; + if (debug == 0) { + daemon(0, 0); + (void)signal(SIGTERM, SIG_IGN); + (void)signal(SIGHUP, SIG_IGN); + (void)signal(SIGINT, SIG_IGN); + (void)signal(SIGQUIT, SIG_IGN); + } + (void)signal(SIGSYS, nonfs); + (void)signal(SIGCHLD, reapchild); + + openlog("nfscbd:", LOG_PID, LOG_DAEMON); + + pid = fork(); + if (pid < 0) { + syslog(LOG_ERR, "fork: %m"); + nfscbd_exit(1); + } else if (pid > 0) { + children = pid; + } else { + (void)signal(SIGUSR1, child_cleanup); + setproctitle("server"); + nfssvc_flag = NFSSVC_NFSCBD; + if (nfssvc(nfssvc_flag, &nfscbdargs2) < 0) { + syslog(LOG_ERR, "nfssvc: %m"); + nfscbd_exit(1); + } + exit(0); + } + (void)signal(SIGUSR1, cleanup); + + if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { + syslog(LOG_ERR, "can't create udp socket"); + nfscbd_exit(1); + } + memset(&inetaddr, 0, sizeof inetaddr); + inetaddr.sin_family = AF_INET; + inetaddr.sin_addr.s_addr = INADDR_ANY; + inetaddr.sin_port = htons(myport); + inetaddr.sin_len = sizeof(inetaddr); + ret = bind(sock, (struct sockaddr *)&inetaddr, sizeof(inetaddr)); + /* If bind() fails, this is a restart, so just skip UDP. */ + if (ret == 0) { + len = sizeof(inetaddr); + if (getsockname(sock, (struct sockaddr *)&inetaddr, &len) < 0){ + syslog(LOG_ERR, "can't get bound addr"); + nfscbd_exit(1); + } + nfscbdargs.port = ntohs(inetaddr.sin_port); + if (nfscbdargs.port != myport) { + syslog(LOG_ERR, "BAD PORT#"); + nfscbd_exit(1); + } + nfscbdargs.sock = sock; + nfscbdargs.name = NULL; + nfscbdargs.namelen = 0; + if (nfssvc(NFSSVC_CBADDSOCK, &nfscbdargs) < 0) { + syslog(LOG_ERR, "can't Add UDP socket"); + nfscbd_exit(1); + } + } + (void)close(sock); + + /* Now set up the master server socket waiting for tcp connections. */ + on = 1; + FD_ZERO(&sockbits); + connect_type_cnt = 0; + if ((tcpsock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { + syslog(LOG_ERR, "can't create tcp socket"); + nfscbd_exit(1); + } + if (setsockopt(tcpsock, + SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) < 0) + syslog(LOG_ERR, "setsockopt SO_REUSEADDR: %m"); + /* sin_port is already set */ + inetaddr.sin_family = AF_INET; + inetaddr.sin_addr.s_addr = INADDR_ANY; + inetaddr.sin_port = htons(myport); + inetaddr.sin_len = sizeof(inetaddr); + if (bind(tcpsock, + (struct sockaddr *)&inetaddr, sizeof (inetaddr)) < 0) { + syslog(LOG_ERR, "can't bind tcp addr"); + nfscbd_exit(1); + } + if (listen(tcpsock, 5) < 0) { + syslog(LOG_ERR, "listen failed"); + nfscbd_exit(1); + } + FD_SET(tcpsock, &sockbits); + maxsock = tcpsock; + connect_type_cnt++; + + setproctitle("master"); + + /* + * Loop forever accepting connections and passing the sockets + * into the kernel for the mounts. + */ + for (;;) { + ready = sockbits; + if (connect_type_cnt > 1) { + if (select(maxsock + 1, + &ready, NULL, NULL, NULL) < 1) { + syslog(LOG_ERR, "select failed: %m"); + nfscbd_exit(1); + } + } + if (FD_ISSET(tcpsock, &ready)) { + len = sizeof(inetpeer); + if ((msgsock = accept(tcpsock, + (struct sockaddr *)&inetpeer, &len)) < 0) { + syslog(LOG_ERR, "accept failed: %m"); + nfscbd_exit(1); + } + memset(inetpeer.sin_zero, 0, + sizeof (inetpeer.sin_zero)); + if (setsockopt(msgsock, SOL_SOCKET, + SO_KEEPALIVE, (char *)&on, sizeof(on)) < 0) + syslog(LOG_ERR, + "setsockopt SO_KEEPALIVE: %m"); + nfscbdargs.sock = msgsock; + nfscbdargs.name = (caddr_t)&inetpeer; + nfscbdargs.namelen = sizeof(inetpeer); + nfssvc(NFSSVC_CBADDSOCK, &nfscbdargs); + (void)close(msgsock); + } + } +} + +void +usage(void) +{ + + errx(1, "usage: nfscbd %s", USAGE); +} + +void +nonfs(int signo) +{ + syslog(LOG_ERR, "missing system call: NFS not available"); +} + +void +reapchild(int signo) +{ + pid_t pid; + int i; + + while ((pid = wait3(NULL, WNOHANG, NULL)) > 0) { + if (pid == children) + children = -1; + } +} + +void +killchildren(void) +{ + int i; + + if (children > 0) + kill(children, SIGKILL); +} + +/* + * Cleanup master after SIGUSR1. + */ +void +cleanup(int signo) +{ + nfscbd_exit(0); +} + +/* + * Cleanup child after SIGUSR1. + */ +void +child_cleanup(int signo) +{ + exit(0); +} + +void +nfscbd_exit(int status) +{ + killchildren(); + exit(status); +} Added: head/usr.sbin/nfsdumpstate/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/nfsdumpstate/Makefile Tue May 26 15:19:04 2009 (r192811) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +PROG= nfsdumpstate +MAN= nfsdumpstate.8 + +.include Added: head/usr.sbin/nfsdumpstate/nfsdumpstate.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/nfsdumpstate/nfsdumpstate.8 Tue May 26 15:19:04 2009 (r192811) @@ -0,0 +1,71 @@ +.\" Copyright (c) 2009 Rick Macklem, University of Guelph +.\" 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. +.\" +.\" $FreeBSD$ +.\" +.Dd April 25, 2009 +.Dt NFSDUMPSTATE 8 +.Os +.Sh NAME +.Nm nfsdumpstate +.Nd display +.Tn NFSv4 +open/lock state +.Sh SYNOPSIS +.Nm nfsdumpstate +.Op Fl o +.Op Fl l Ar filename +.Sh DESCRIPTION +.Nm +displays open/lock state for the +.Tn NFSv4 +client and server in the experimental nfs subsystem. +.Pp +The options are as follows: +.Bl -tag -width Ds +.It Fl o +Displays a summary of Clients for NFSv4. Each line lists a Client with +the ClientID being the last field of the line. +.sp +.nf +The following are the client flag values displayed: +NC - Needs Confirmation +CB - Callbacks are enabled +GSS - Using RPCSEC_GSS +REV - Administratively Revoked, via nfsrevoke(8) +.fi +.sp +.It Fl l Ar filename +Displays a list of all NFSv4 Opens and Locks on the file specified by +the +.Ar filename . +The ClientID is the last field of each line. +.El +.Sh SEE ALSO +.Xr nfsv4 4 , +.Xr nfsrevoke 8 +.Sh HISTORY +The +.Nm +utility was introduced with the NFSv4 experimental subsystem in 2009. Added: head/usr.sbin/nfsdumpstate/nfsdumpstate.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/nfsdumpstate/nfsdumpstate.c Tue May 26 15:19:04 2009 (r192811) @@ -0,0 +1,280 @@ +/*- + * Copyright (c) 2009 Rick Macklem, University of Guelph + * 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 + +#include + +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#define DUMPSIZE 10000 + +static void dump_lockstate(char *); +static void dump_openstate(void); +static void usage(void); +static char *open_flags(uint32_t); +static char *deleg_flags(uint32_t); +static char *lock_flags(uint32_t); +static char *client_flags(uint32_t); + +static struct nfsd_dumpclients dp[DUMPSIZE]; +static struct nfsd_dumplocks lp[DUMPSIZE]; +static char flag_string[20]; + +int +main(int argc, char **argv) +{ + int ch, openstate; + char *lockfile; + + if (modfind("nfsd") < 0) + errx(1, "nfsd not loaded - self terminating"); + openstate = 0; + lockfile = NULL; + while ((ch = getopt(argc, argv, "ol")) != -1) + switch (ch) { + case 'o': + openstate = 1; + break; + case 'l': + lockfile = optarg; + break; + default: + usage(); + } + argc -= optind; + argv += optind; + + if (openstate == 0 && lockfile == NULL) + openstate = 1; + else if (openstate != 0 && lockfile != NULL) + errx(1, "-o and -l cannot both be specified"); + + /* + * For -o, dump all open/lock state. + * For -l, dump lock state for that file. + */ + if (openstate != 0) + dump_openstate(); + else + dump_lockstate(lockfile); + exit(0); +} + +static void +usage(void) +{ + + errx(1, "usage: nfsdumpstate [-o] [-l]"); +} + +/* + * Dump all open/lock state. + */ +static void +dump_openstate(void) +{ + struct nfsd_dumplist dumplist; + int cnt, i; + + dumplist.ndl_size = DUMPSIZE; + dumplist.ndl_list = (void *)dp; + if (nfssvc(NFSSVC_DUMPCLIENTS, &dumplist) < 0) + errx(1, "Can't perform dump clients syscall"); + + printf("%-13s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %-15s %s\n", + "Flags", "OpenOwner", "Open", "LockOwner", + "Lock", "Deleg", "OldDeleg", "Clientaddr", "ClientID"); + /* + * Loop through results, printing them out. + */ + cnt = 0; + while (dp[cnt].ndcl_clid.nclid_idlen > 0 && cnt < DUMPSIZE) { + printf("%-13s ", client_flags(dp[cnt].ndcl_flags)); + printf("%9d %9d %9d %9d %9d %9d ", + dp[cnt].ndcl_nopenowners, + dp[cnt].ndcl_nopens, + dp[cnt].ndcl_nlockowners, + dp[cnt].ndcl_nlocks, + dp[cnt].ndcl_ndelegs, + dp[cnt].ndcl_nolddelegs); + if (dp[cnt].ndcl_addrfam == AF_INET) + printf("%-15s ", + inet_ntoa(dp[cnt].ndcl_cbaddr.sin_addr)); + for (i = 0; i < dp[cnt].ndcl_clid.nclid_idlen; i++) + printf("%02x", dp[cnt].ndcl_clid.nclid_id[i]); + printf("\n"); + cnt++; + } +} + +/* + * Dump the lock state for a file. + */ +static void +dump_lockstate(char *fname) +{ + struct nfsd_dumplocklist dumplocklist; + int cnt, i; + + dumplocklist.ndllck_size = DUMPSIZE; + dumplocklist.ndllck_list = (void *)lp; + dumplocklist.ndllck_fname = fname; + if (nfssvc(NFSSVC_DUMPLOCKS, &dumplocklist) < 0) + errx(1, "Can't dump locks for %s\n", fname); + + printf("%-11s %-36s %-15s %s\n", + "Open/Lock", + " Stateid or Lock Range", + "Clientaddr", + "Owner and ClientID"); + /* + * Loop through results, printing them out. + */ + cnt = 0; + while (lp[cnt].ndlck_clid.nclid_idlen > 0 && cnt < DUMPSIZE) { + if (lp[cnt].ndlck_flags & NFSLCK_OPEN) + printf("%-11s %9d %08x %08x %08x ", + open_flags(lp[cnt].ndlck_flags), + lp[cnt].ndlck_stateid.seqid, + lp[cnt].ndlck_stateid.other[0], + lp[cnt].ndlck_stateid.other[1], + lp[cnt].ndlck_stateid.other[2]); + else if (lp[cnt].ndlck_flags & (NFSLCK_DELEGREAD | + NFSLCK_DELEGWRITE)) + printf("%-11s %9d %08x %08x %08x ", + deleg_flags(lp[cnt].ndlck_flags), + lp[cnt].ndlck_stateid.seqid, + lp[cnt].ndlck_stateid.other[0], + lp[cnt].ndlck_stateid.other[1], + lp[cnt].ndlck_stateid.other[2]); + else + printf("%-11s %17lld %17lld ", + lock_flags(lp[cnt].ndlck_flags), + lp[cnt].ndlck_first, + lp[cnt].ndlck_end); + if (lp[cnt].ndlck_addrfam == AF_INET) + printf("%-15s ", + inet_ntoa(lp[cnt].ndlck_cbaddr.sin_addr)); + else + printf("%-15s ", " "); + for (i = 0; i < lp[cnt].ndlck_owner.nclid_idlen; i++) + printf("%02x", lp[cnt].ndlck_owner.nclid_id[i]); + printf(" "); + for (i = 0; i < lp[cnt].ndlck_clid.nclid_idlen; i++) + printf("%02x", lp[cnt].ndlck_clid.nclid_id[i]); + printf("\n"); + cnt++; + } +} + +/* + * Parse the Open/Lock flag bits and create a string to be printed. + */ +static char * +open_flags(uint32_t flags) +{ + int i, j; + + strlcpy(flag_string, "Open ", sizeof (flag_string)); + i = 5; + if (flags & NFSLCK_READACCESS) + flag_string[i++] = 'R'; + if (flags & NFSLCK_WRITEACCESS) + flag_string[i++] = 'W'; + flag_string[i++] = ' '; + flag_string[i++] = 'D'; + flag_string[i] = 'N'; + j = i; + if (flags & NFSLCK_READDENY) + flag_string[i++] = 'R'; + if (flags & NFSLCK_WRITEDENY) + flag_string[i++] = 'W'; + if (i == j) + i++; + flag_string[i] = '\0'; + return (flag_string); +} + +static char * +deleg_flags(uint32_t flags) +{ + + if (flags & NFSLCK_DELEGREAD) + strlcpy(flag_string, "Deleg R", sizeof (flag_string)); + else + strlcpy(flag_string, "Deleg W", sizeof (flag_string)); + return (flag_string); +} + +static char * +lock_flags(uint32_t flags) +{ + + if (flags & NFSLCK_READ) + strlcpy(flag_string, "Lock R", sizeof (flag_string)); + else + strlcpy(flag_string, "Lock W", sizeof (flag_string)); + return (flag_string); +} + +static char * +client_flags(uint32_t flags) +{ + + flag_string[0] = '\0'; + if (flags & LCL_NEEDSCONFIRM) + strlcat(flag_string, "NC ", sizeof (flag_string)); + if (flags & LCL_CALLBACKSON) + strlcat(flag_string, "CB ", sizeof (flag_string)); + if (flags & LCL_GSS) + strlcat(flag_string, "GSS ", sizeof (flag_string)); + if (flags & LCL_ADMINREVOKED) + strlcat(flag_string, "REV", sizeof (flag_string)); + return (flag_string); +} Added: head/usr.sbin/nfsrevoke/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/nfsrevoke/Makefile Tue May 26 15:19:04 2009 (r192811) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +PROG= nfsrevoke +MAN= nfsrevoke.8 + +.include Added: head/usr.sbin/nfsrevoke/nfsrevoke.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/nfsrevoke/nfsrevoke.8 Tue May 26 15:19:04 2009 (r192811) @@ -0,0 +1,64 @@ +.\" Copyright (c) 2009 Rick Macklem, University of Guelph +.\" 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. +.\" +.\" $FreeBSD$ +.\" +.Dd April 25, 2009 +.Dt NFSREVOKE 8 +.Os +.Sh NAME +.Nm nfsrevoke +.Nd revoke +.Tn NFS +V4 client +.Sh SYNOPSIS +.Nm nfsrevoke +.Ar ClientId +.Sh DESCRIPTION +.Nm +This command is used by a system administrator to revoke a client's access +to the NFS Version 4 server. All Open/Lock state held by the client will +be released. +After revocation, the client will no longer be able to use state on the server +until it does a fresh SetClientID/SetClientIDConfirm operations sequence. +THIS SHOULD BE DONE AS A LAST RESORT ONLY, when clients are holding state +that must be released on the server. +.Pp +The +.Ar ClientId +argument is a hexadecimal string, which is the last field +of the +.Xr nfsdumpstate 8 +command's +.Fl o +and +.Fl l +options output. +.Sh SEE ALSO +.Xr nfsv4 4 , +.Xr nfsdumpstate 8 +.Sh HISTORY +The +.Nm +command was introduced as a part of the experimental nfs server subsystem. Added: head/usr.sbin/nfsrevoke/nfsrevoke.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/nfsrevoke/nfsrevoke.c Tue May 26 15:19:04 2009 (r192811) @@ -0,0 +1,124 @@ +/*- + * Copyright (c) 2009 Rick Macklem, University of Guelph + * 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 +#include +#include +#include + +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue May 26 17:01:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3629E106573F; Tue, 26 May 2009 17:01:01 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 19C868FC20; Tue, 26 May 2009 17:01:01 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QH10iq066156; Tue, 26 May 2009 17:01:00 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QH10bX066152; Tue, 26 May 2009 17:01:00 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200905261701.n4QH10bX066152@svn.freebsd.org> From: Edward Tomasz Napierala Date: Tue, 26 May 2009 17:01:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192818 - head/sys/fs/nfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 17:01:01 -0000 Author: trasz Date: Tue May 26 17:01:00 2009 New Revision: 192818 URL: http://svn.freebsd.org/changeset/base/192818 Log: Adapt to the new ACL #define names. Reviewed by: rmacklem@ Modified: head/sys/fs/nfs/nfs_commonacl.c Modified: head/sys/fs/nfs/nfs_commonacl.c ============================================================================== --- head/sys/fs/nfs/nfs_commonacl.c Tue May 26 16:35:05 2009 (r192817) +++ head/sys/fs/nfs/nfs_commonacl.c Tue May 26 17:01:00 2009 (r192818) @@ -66,7 +66,7 @@ nfsrv_dissectace(struct nfsrv_descript * acep->ae_tag = ACL_UNDEFINED_TAG; acep->ae_id = ACL_UNDEFINED_ID; acep->ae_perm = (acl_perm_t)0; - acep->ae_extended = ACL_EXTENDED_DENY; + acep->ae_entry_type = ACL_ENTRY_TYPE_DENY; if (acesizep) *acesizep = 4 * NFSX_UNSIGNED; return (0); @@ -128,11 +128,11 @@ nfsrv_dissectace(struct nfsrv_descript * } if (flag & NFSV4ACE_NOPROPAGATEINHERIT) { flag &= ~NFSV4ACE_NOPROPAGATEINHERIT; - acep->ae_flags |= ACL_ENTRY_LIMIT_INHERIT; + acep->ae_flags |= ACL_ENTRY_NO_PROPAGATE_INHERIT; } if (flag & NFSV4ACE_INHERITONLY) { flag &= ~NFSV4ACE_INHERITONLY; - acep->ae_flags |= ACL_ENTRY_ONLY_INHERIT; + acep->ae_flags |= ACL_ENTRY_INHERIT_ONLY; } if (flag & NFSV4ACE_SUCCESSFULACCESS) { flag &= ~NFSV4ACE_SUCCESSFULACCESS; @@ -143,16 +143,16 @@ nfsrv_dissectace(struct nfsrv_descript * acep->ae_flags |= ACL_ENTRY_FAILED_ACCESS; } /* - * Set ae_extended. + * Set ae_entry_type. */ if (acetype == NFSV4ACE_ALLOWEDTYPE) - acep->ae_extended = ACL_EXTENDED_ALLOW; + acep->ae_entry_type = ACL_ENTRY_TYPE_ALLOW; else if (acetype == NFSV4ACE_DENIEDTYPE) - acep->ae_extended = ACL_EXTENDED_DENY; + acep->ae_entry_type = ACL_ENTRY_TYPE_DENY; else if (acetype == NFSV4ACE_AUDITTYPE) - acep->ae_extended = ACL_EXTENDED_AUDIT; + acep->ae_entry_type = ACL_ENTRY_TYPE_AUDIT; else if (acetype == NFSV4ACE_ALARMTYPE) - acep->ae_extended = ACL_EXTENDED_ALARM; + acep->ae_entry_type = ACL_ENTRY_TYPE_ALARM; else aceerr = NFSERR_ATTRNOTSUPP; } @@ -466,11 +466,11 @@ nfsrv_buildace(struct nfsrv_descript *nd /* * Fill in the ace type. */ - if (ace->ae_extended & ACL_EXTENDED_ALLOW) + if (ace->ae_entry_type & ACL_ENTRY_TYPE_ALLOW) acetype = NFSV4ACE_ALLOWEDTYPE; - else if (ace->ae_extended & ACL_EXTENDED_DENY) + else if (ace->ae_entry_type & ACL_ENTRY_TYPE_DENY) acetype = NFSV4ACE_DENIEDTYPE; - else if (ace->ae_extended & ACL_EXTENDED_AUDIT) + else if (ace->ae_entry_type & ACL_ENTRY_TYPE_AUDIT) acetype = NFSV4ACE_AUDITTYPE; else acetype = NFSV4ACE_ALARMTYPE; @@ -483,9 +483,9 @@ nfsrv_buildace(struct nfsrv_descript *nd aceflag |= NFSV4ACE_FILEINHERIT; if (ace->ae_flags & ACL_ENTRY_DIRECTORY_INHERIT) aceflag |= NFSV4ACE_DIRECTORYINHERIT; - if (ace->ae_flags & ACL_ENTRY_LIMIT_INHERIT) + if (ace->ae_flags & ACL_ENTRY_NO_PROPAGATE_INHERIT) aceflag |= NFSV4ACE_NOPROPAGATEINHERIT; - if (ace->ae_flags & ACL_ENTRY_ONLY_INHERIT) + if (ace->ae_flags & ACL_ENTRY_INHERIT_ONLY) aceflag |= NFSV4ACE_INHERITONLY; if (ace->ae_flags & ACL_ENTRY_SUCCESSFUL_ACCESS) aceflag |= NFSV4ACE_SUCCESSFULACCESS; From owner-svn-src-head@FreeBSD.ORG Tue May 26 17:06:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33E2710656A3; Tue, 26 May 2009 17:06:37 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 178BD8FC08; Tue, 26 May 2009 17:06:37 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QH6acR066345; Tue, 26 May 2009 17:06:36 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QH6aAp066343; Tue, 26 May 2009 17:06:36 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200905261706.n4QH6aAp066343@svn.freebsd.org> From: Andrew Thompson Date: Tue, 26 May 2009 17:06:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192820 - head/sys/dev/usb/serial X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 17:06:37 -0000 Author: thompsa Date: Tue May 26 17:06:36 2009 New Revision: 192820 URL: http://svn.freebsd.org/changeset/base/192820 Log: Do not forcefully close the write transfer when closing the tty, it needs to run to completion and drain the tty queue. Modified: head/sys/dev/usb/serial/usb_serial.c head/sys/dev/usb/serial/usb_serial.h Modified: head/sys/dev/usb/serial/usb_serial.c ============================================================================== --- head/sys/dev/usb/serial/usb_serial.c Tue May 26 17:01:12 2009 (r192819) +++ head/sys/dev/usb/serial/usb_serial.c Tue May 26 17:06:36 2009 (r192820) @@ -589,13 +589,9 @@ usb2_com_cfg_close(struct usb2_proc_msg DPRINTF("\n"); if (sc->sc_flag & UCOM_FLAG_LL_READY) { - - sc->sc_flag &= ~(UCOM_FLAG_LL_READY | - UCOM_FLAG_GP_DATA); - - if (sc->sc_callback->usb2_com_cfg_close) { + sc->sc_flag &= ~UCOM_FLAG_LL_READY; + if (sc->sc_callback->usb2_com_cfg_close) (sc->sc_callback->usb2_com_cfg_close) (sc); - } } else { /* already closed */ } @@ -620,16 +616,11 @@ usb2_com_close(struct tty *tp) &sc->sc_close_task[0].hdr, &sc->sc_close_task[1].hdr); - sc->sc_flag &= ~(UCOM_FLAG_HL_READY | - UCOM_FLAG_WR_START | - UCOM_FLAG_RTS_IFLOW); + sc->sc_flag &= ~(UCOM_FLAG_HL_READY | UCOM_FLAG_RTS_IFLOW); if (sc->sc_callback->usb2_com_stop_read) { (sc->sc_callback->usb2_com_stop_read) (sc); } - if (sc->sc_callback->usb2_com_stop_write) { - (sc->sc_callback->usb2_com_stop_write) (sc); - } } static int @@ -1005,8 +996,6 @@ usb2_com_outwakeup(struct tty *tp) /* The higher layer is not ready */ return; } - sc->sc_flag |= UCOM_FLAG_WR_START; - usb2_com_start_transfers(sc); } @@ -1028,9 +1017,8 @@ usb2_com_get_data(struct usb2_com_softc mtx_assert(sc->sc_mtx, MA_OWNED); - if ((!(sc->sc_flag & UCOM_FLAG_HL_READY)) || - (!(sc->sc_flag & UCOM_FLAG_GP_DATA)) || - (!(sc->sc_flag & UCOM_FLAG_WR_START))) { + if (tty_gone(tp) || + !(sc->sc_flag & UCOM_FLAG_GP_DATA)) { actlen[0] = 0; return (0); /* multiport device polling */ } @@ -1076,10 +1064,9 @@ usb2_com_put_data(struct usb2_com_softc mtx_assert(sc->sc_mtx, MA_OWNED); - if ((!(sc->sc_flag & UCOM_FLAG_HL_READY)) || - (!(sc->sc_flag & UCOM_FLAG_GP_DATA))) { + if (tty_gone(tp)) return; /* multiport device polling */ - } + if (len == 0) return; /* no data */ Modified: head/sys/dev/usb/serial/usb_serial.h ============================================================================== --- head/sys/dev/usb/serial/usb_serial.h Tue May 26 17:01:12 2009 (r192819) +++ head/sys/dev/usb/serial/usb_serial.h Tue May 26 17:06:36 2009 (r192820) @@ -167,7 +167,6 @@ struct usb2_com_softc { #define UCOM_FLAG_GONE 0x02 /* the device is gone */ #define UCOM_FLAG_ATTACHED 0x04 /* set if attached */ #define UCOM_FLAG_GP_DATA 0x08 /* set if get and put data is possible */ -#define UCOM_FLAG_WR_START 0x10 /* set if write start was issued */ #define UCOM_FLAG_LL_READY 0x20 /* set if low layer is ready */ #define UCOM_FLAG_HL_READY 0x40 /* set if high layer is ready */ uint8_t sc_lsr; From owner-svn-src-head@FreeBSD.ORG Tue May 26 18:33:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDFAD106567C; Tue, 26 May 2009 18:33:36 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CCC148FC25; Tue, 26 May 2009 18:33:36 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QIXaFW068420; Tue, 26 May 2009 18:33:36 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QIXaUG068419; Tue, 26 May 2009 18:33:36 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200905261833.n4QIXaUG068419@svn.freebsd.org> From: Ed Schouten Date: Tue, 26 May 2009 18:33:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192827 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 18:33:38 -0000 Author: ed Date: Tue May 26 18:33:36 2009 New Revision: 192827 URL: http://svn.freebsd.org/changeset/base/192827 Log: Get rid of M_TEMP. Modified: head/sys/kern/tty.c Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Tue May 26 18:30:17 2009 (r192826) +++ head/sys/kern/tty.c Tue May 26 18:33:36 2009 (r192827) @@ -1069,7 +1069,7 @@ sysctl_kern_ttys(SYSCTL_HANDLER_ARGS) return (0); } - xtlist = xt = malloc(lsize, M_TEMP, M_WAITOK); + xtlist = xt = malloc(lsize, M_TTY, M_WAITOK); TAILQ_FOREACH(tp, &tty_list, t_list) { tty_lock(tp); @@ -1080,7 +1080,7 @@ sysctl_kern_ttys(SYSCTL_HANDLER_ARGS) sx_sunlock(&tty_list_sx); error = SYSCTL_OUT(req, xtlist, lsize); - free(xtlist, M_TEMP); + free(xtlist, M_TTY); return (error); } From owner-svn-src-head@FreeBSD.ORG Tue May 26 19:06:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A19C1065676; Tue, 26 May 2009 19:06:57 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F384B8FC1B; Tue, 26 May 2009 19:06:56 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QJ6uQL070253; Tue, 26 May 2009 19:06:56 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QJ6uRn070252; Tue, 26 May 2009 19:06:56 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200905261906.n4QJ6uRn070252@svn.freebsd.org> From: Ed Schouten Date: Tue, 26 May 2009 19:06:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192846 - head/usr.bin/ee X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 19:06:57 -0000 Author: ed Date: Tue May 26 19:06:56 2009 New Revision: 192846 URL: http://svn.freebsd.org/changeset/base/192846 Log: Remove unused curses replacement implementation from ee(1) sources. Deleted: head/usr.bin/ee/new_curse.c head/usr.bin/ee/new_curse.h From owner-svn-src-head@FreeBSD.ORG Tue May 26 20:00:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F9F41065675; Tue, 26 May 2009 20:00:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4ED7F8FC16; Tue, 26 May 2009 20:00:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QK0UI7071958; Tue, 26 May 2009 20:00:30 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QK0UVx071957; Tue, 26 May 2009 20:00:30 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200905262000.n4QK0UVx071957@svn.freebsd.org> From: John Baldwin Date: Tue, 26 May 2009 20:00:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192848 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 20:00:31 -0000 Author: jhb Date: Tue May 26 20:00:30 2009 New Revision: 192848 URL: http://svn.freebsd.org/changeset/base/192848 Log: Correct the sense of a test so that this filter always waits for the full request to arrive. Previously it would end up returning as soon as the request length stored in the first two bytes had arrived. Reviewed by: dwmalone MFC after: 1 week Modified: head/sys/netinet/accf_dns.c Modified: head/sys/netinet/accf_dns.c ============================================================================== --- head/sys/netinet/accf_dns.c Tue May 26 19:39:09 2009 (r192847) +++ head/sys/netinet/accf_dns.c Tue May 26 20:00:30 2009 (r192848) @@ -78,7 +78,7 @@ sohasdns(struct socket *so, void *arg, i if (sb->sb_cc >= sb->sb_hiwat || sb->sb_mbcnt >= sb->sb_mbmax) goto ready; - /* Check and see if we have a request. */ + /* Check to see if we have a request. */ if (skippacket(sb) == DNS_WAIT) return; @@ -128,7 +128,7 @@ skippacket(struct sockbuf *sb) { q.len = sb->sb_cc; GET16(p, packlen); - if (packlen + 2 < q.len) + if (packlen + 2 > q.len) return DNS_WAIT; return DNS_OK; From owner-svn-src-head@FreeBSD.ORG Tue May 26 20:09:16 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90376106564A; Tue, 26 May 2009 20:09:16 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (cl-162.ewr-01.us.sixxs.net [IPv6:2001:4830:1200:a1::2]) by mx1.freebsd.org (Postfix) with ESMTP id 0BEE58FC1F; Tue, 26 May 2009 20:09:15 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (localhost [127.0.0.1]) by lor.one-eyed-alien.net (8.14.3/8.14.3) with ESMTP id n4QK9PkX043304; Tue, 26 May 2009 15:09:25 -0500 (CDT) (envelope-from brooks@lor.one-eyed-alien.net) Received: (from brooks@localhost) by lor.one-eyed-alien.net (8.14.3/8.14.3/Submit) id n4QK9Psu043303; Tue, 26 May 2009 15:09:25 -0500 (CDT) (envelope-from brooks) Date: Tue, 26 May 2009 15:09:25 -0500 From: Brooks Davis To: Ivan Voras Message-ID: <20090526200925.GA41682@lor.one-eyed-alien.net> References: <200905260822.n4Q8M0Zv051280@svn.freebsd.org> <9bbcef730905260624x289af079ue8524e821c1dc891@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="r5Pyd7+fXNt84Ff3" Content-Disposition: inline In-Reply-To: <9bbcef730905260624x289af079ue8524e821c1dc891@mail.gmail.com> User-Agent: Mutt/1.5.17 (2007-11-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (lor.one-eyed-alien.net [127.0.0.1]); Tue, 26 May 2009 15:09:25 -0500 (CDT) Cc: svn-src-head@FreeBSD.org, Edward Tomasz Napierala , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Robert Watson Subject: Re: svn commit: r192800 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris/common/acl cddl/contrib/opensolaris/uts/common/fs/zfs cddl/contrib/opensolaris/u... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 20:09:17 -0000 --r5Pyd7+fXNt84Ff3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 26, 2009 at 03:24:05PM +0200, Ivan Voras wrote: > 2009/5/26 Robert Watson : > > On Tue, 26 May 2009, Edward Tomasz Napierala wrote: > > > >> +/*- > >> + * Copyright (c) 2008, 2009 Edward Tomasz Napiera??a > >> + * 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 copyrig= ht > >> + * ?? ??notice, this list of conditions and the following disclaimer = in the > >> + * ?? ??documentation and/or other materials provided with the > >> distribution. > >> + * > >> + * ALTHOUGH THIS SOFTWARE IS MADE OF WIN AND SCIENCE, IT IS PROVIDED = BY > >> THE > > > > Cute though this BSD license variation is, I'm pretty sure it's not on = the > > approved license list. ??Sticking to the standard license templates > > potentially saves significant trouble later -- especially when people >=20 > Hmm, I'm sure that there exists some SVN magic which would allow > authors to enter something >=20 > $BSDL2 Charlie Root 2008,2009$ >=20 > and it expands to a perfect boilerplate on checkout :) Such a change would result in a repository filled without license blocks. This might be appropriate in a corporate setting, but isn't worth considering here since copies of the repo would lack correct attributions. -- Brooks --r5Pyd7+fXNt84Ff3 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iD8DBQFKHEx0XY6L6fI4GtQRApfQAJwLpaXZ+jtsSz0NuPDBGOspcicY+gCfSuCT vWzfaKBT2OA6CZ20mEefbqM= =N3/v -----END PGP SIGNATURE----- --r5Pyd7+fXNt84Ff3-- From owner-svn-src-head@FreeBSD.ORG Tue May 26 20:13:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C45E1065676; Tue, 26 May 2009 20:13:07 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B3C18FC17; Tue, 26 May 2009 20:13:07 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QKD7v5072289; Tue, 26 May 2009 20:13:07 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QKD7bt072288; Tue, 26 May 2009 20:13:07 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200905262013.n4QKD7bt072288@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 26 May 2009 20:13:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192849 - head/tools/regression/vfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 20:13:08 -0000 Author: des Date: Tue May 26 20:13:06 2009 New Revision: 192849 URL: http://svn.freebsd.org/changeset/base/192849 Log: Add a regression test for kern/21768. MFC after: 1 week Added: head/tools/regression/vfs/ head/tools/regression/vfs/trailing_slash.t (contents, props changed) Added: head/tools/regression/vfs/trailing_slash.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/vfs/trailing_slash.t Tue May 26 20:13:06 2009 (r192849) @@ -0,0 +1,42 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# Tests vfs_lookup()'s handling of trailing slashes for symlinks that +# point to files. See kern/21768 +# + +testfile="/tmp/testfile-$$" +testlink="/tmp/testlink-$$" + +tests=" +$testfile:$testlink:$testfile:0 +$testfile:$testlink:$testfile/:1 +$testfile:$testlink:$testlink:0 +$testfile:$testlink:$testlink/:1 +$testfile/:$testlink:$testlink:1 +$testfile/:$testlink:$testlink/:1 +" + +touch $testfile || exit 1 +trap "rm $testfile $testlink" EXIT + +set $tests +echo "1..$#" +n=1 +for testspec ; do + ( + IFS=: + set $testspec + unset IFS + ln -fs "$1" "$2" || exit 1 + cat "$3" >/dev/null 2>&1 + ret=$? + if [ "$ret" -eq "$4" ] ; then + echo "ok $n" + else + echo "fail $n - expected $4, got $ret" + fi + n=$((n+1)) + ) +done From owner-svn-src-head@FreeBSD.ORG Tue May 26 20:13:17 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78A541065680; Tue, 26 May 2009 20:13:17 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E59E8FC26; Tue, 26 May 2009 20:13:17 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QKDH3i072323; Tue, 26 May 2009 20:13:17 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QKDHm7072322; Tue, 26 May 2009 20:13:17 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200905262013.n4QKDHm7072322@svn.freebsd.org> From: Ed Schouten Date: Tue, 26 May 2009 20:13:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192850 - head/contrib/ee X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 20:13:18 -0000 Author: ed Date: Tue May 26 20:13:17 2009 New Revision: 192850 URL: http://svn.freebsd.org/changeset/base/192850 Log: Copy ee 1.4.2 into the contrib directory. This allows me to merge our custom changes to ee(1) back on top of original sources, with correct mergeinfo. Added: head/contrib/ee/ - copied from r192830, vendor/ee/dist/ From owner-svn-src-head@FreeBSD.ORG Tue May 26 20:14:37 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D124A106567A; Tue, 26 May 2009 20:14:37 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id A6A398FC12; Tue, 26 May 2009 20:14:37 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 482CC46BA2; Tue, 26 May 2009 16:14:37 -0400 (EDT) Date: Tue, 26 May 2009 21:14:37 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Brooks Davis In-Reply-To: <20090526200925.GA41682@lor.one-eyed-alien.net> Message-ID: References: <200905260822.n4Q8M0Zv051280@svn.freebsd.org> <9bbcef730905260624x289af079ue8524e821c1dc891@mail.gmail.com> <20090526200925.GA41682@lor.one-eyed-alien.net> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Edward Tomasz Napierala , Ivan Voras Subject: Re: svn commit: r192800 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris/common/acl cddl/contrib/opensolaris/uts/common/fs/zfs cddl/contrib/opensolaris/u... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 20:14:38 -0000 On Tue, 26 May 2009, Brooks Davis wrote: >>> Cute though this BSD license variation is, I'm pretty sure it's not on the >>> approved license list. ??Sticking to the standard license templates >>> potentially saves significant trouble later -- especially when people >> >> Hmm, I'm sure that there exists some SVN magic which would allow authors to >> enter something >> >> $BSDL2 Charlie Root 2008,2009$ >> >> and it expands to a perfect boilerplate on checkout :) > > Such a change would result in a repository filled without license blocks. > This might be appropriate in a corporate setting, but isn't worth > considering here since copies of the repo would lack correct attributions. I'd assumed that it was a tongue-in-cheek proposal, myself :-). (It is, right?) Robert N M Watson Computer Laboratory University of Cambridge From owner-svn-src-head@FreeBSD.ORG Tue May 26 20:22:03 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1C44106566B; Tue, 26 May 2009 20:22:03 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A17018FC19; Tue, 26 May 2009 20:22:03 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QKM3C8072595; Tue, 26 May 2009 20:22:03 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QKM3A0072594; Tue, 26 May 2009 20:22:03 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200905262022.n4QKM3A0072594@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 26 May 2009 20:22:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192852 - head/sys/modules/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 20:22:04 -0000 Author: des Date: Tue May 26 20:22:03 2009 New Revision: 192852 URL: http://svn.freebsd.org/changeset/base/192852 Log: opt_apic.h is i386-only. MFC after: 1 week Modified: head/sys/modules/linux/Makefile Modified: head/sys/modules/linux/Makefile ============================================================================== --- head/sys/modules/linux/Makefile Tue May 26 20:14:52 2009 (r192851) +++ head/sys/modules/linux/Makefile Tue May 26 20:22:03 2009 (r192852) @@ -17,12 +17,12 @@ SRCS= linux${SFX}_dummy.c linux_emul.c l device_if.h bus_if.h assym.s # XXX: for assym.s -SRCS+= opt_kstack_pages.h opt_nfs.h opt_apic.h opt_compat.h opt_hwpmc_hooks.h +SRCS+= opt_kstack_pages.h opt_nfs.h opt_compat.h opt_hwpmc_hooks.h OBJS= linux${SFX}_locore.o linux${SFX}_support.o .if ${MACHINE_ARCH} == "i386" -SRCS+= linux_ptrace.c imgact_linux.c opt_cpu.h +SRCS+= linux_ptrace.c imgact_linux.c opt_apic.h opt_cpu.h .endif EXPORT_SYMS= From owner-svn-src-head@FreeBSD.ORG Tue May 26 20:28:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 87C69106564A; Tue, 26 May 2009 20:28:23 +0000 (UTC) (envelope-from sson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 73F908FC18; Tue, 26 May 2009 20:28:23 +0000 (UTC) (envelope-from sson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QKSNec072750; Tue, 26 May 2009 20:28:23 GMT (envelope-from sson@svn.freebsd.org) Received: (from sson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QKSNj3072741; Tue, 26 May 2009 20:28:23 GMT (envelope-from sson@svn.freebsd.org) Message-Id: <200905262028.n4QKSNj3072741@svn.freebsd.org> From: Stacey Son Date: Tue, 26 May 2009 20:28:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192853 - in head/sys: cddl/contrib/opensolaris/uts/common/dtrace cddl/dev/lockstat conf kern modules/dtrace modules/dtrace/dtraceall sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 20:28:24 -0000 Author: sson Date: Tue May 26 20:28:22 2009 New Revision: 192853 URL: http://svn.freebsd.org/changeset/base/192853 Log: Add the OpenSolaris dtrace lockstat provider. The lockstat provider adds probes for mutexes, reader/writer and shared/exclusive locks to gather contention statistics and other locking information for dtrace scripts, the lockstat(1M) command and other potential consumers. Reviewed by: attilio jhb jb Approved by: gnn (mentor) Added: head/sys/cddl/dev/lockstat/ head/sys/cddl/dev/lockstat/lockstat.c (contents, props changed) head/sys/kern/kern_lockstat.c (contents, props changed) head/sys/sys/lockstat.h (contents, props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c head/sys/conf/files head/sys/kern/kern_lock.c head/sys/kern/kern_mutex.c head/sys/kern/kern_rmlock.c head/sys/kern/kern_rwlock.c head/sys/kern/kern_sx.c head/sys/modules/dtrace/Makefile head/sys/modules/dtrace/dtraceall/dtraceall.c head/sys/sys/lock.h head/sys/sys/mutex.h head/sys/sys/rwlock.h head/sys/sys/sx.h Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Tue May 26 20:22:03 2009 (r192852) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Tue May 26 20:28:22 2009 (r192853) @@ -122,6 +122,7 @@ #include #include #include +#include #include #include #include @@ -3168,14 +3169,11 @@ dtrace_dif_subr(uint_t subr, uint_t rd, uintptr_t rw; } r; #else + struct thread *lowner; union { - struct mtx *mi; - uintptr_t mx; - } m; - union { - struct sx *si; - uintptr_t sx; - } s; + struct lock_object *li; + uintptr_t lx; + } l; #endif switch (subr) { @@ -3272,75 +3270,83 @@ dtrace_dif_subr(uint_t subr, uint_t rd, break; #else - /* - * XXX - The following code works because mutex, rwlocks, & sxlocks - * all have similar data structures in FreeBSD. This may not be - * good if someone changes one of the lock data structures. - * Ideally, it would be nice if all these shared a common lock - * object. - */ case DIF_SUBR_MUTEX_OWNED: - /* XXX - need to use dtrace_canload() and dtrace_loadptr() */ - m.mx = tupregs[0].dttk_value; - -#ifdef DOODAD - if (LO_CLASSINDEX(&(m.mi->lock_object)) < 2) { - regs[rd] = !(m.mi->mtx_lock & MTX_UNOWNED); - } else { - regs[rd] = !(m.mi->mtx_lock & SX_UNLOCKED); + if (!dtrace_canload(tupregs[0].dttk_value, + sizeof (struct lock_object), mstate, vstate)) { + regs[rd] = 0; + break; } -#endif + l.lx = dtrace_loadptr((uintptr_t)&tupregs[0].dttk_value); + regs[rd] = LOCK_CLASS(l.li)->lc_owner(l.li, &lowner); break; case DIF_SUBR_MUTEX_OWNER: - /* XXX - need to use dtrace_canload() and dtrace_loadptr() */ - m.mx = tupregs[0].dttk_value; - - if (LO_CLASSINDEX(&(m.mi->lock_object)) < 2) { - regs[rd] = m.mi->mtx_lock & ~MTX_FLAGMASK; - } else { - if (!(m.mi->mtx_lock & SX_LOCK_SHARED)) - regs[rd] = SX_OWNER(m.mi->mtx_lock); - else - regs[rd] = 0; + if (!dtrace_canload(tupregs[0].dttk_value, + sizeof (struct lock_object), mstate, vstate)) { + regs[rd] = 0; + break; } + l.lx = dtrace_loadptr((uintptr_t)&tupregs[0].dttk_value); + LOCK_CLASS(l.li)->lc_owner(l.li, &lowner); + regs[rd] = (uintptr_t)lowner; break; case DIF_SUBR_MUTEX_TYPE_ADAPTIVE: - /* XXX - need to use dtrace_canload() and dtrace_loadptr() */ - m.mx = tupregs[0].dttk_value; - - regs[rd] = (LO_CLASSINDEX(&(m.mi->lock_object)) != 0); + if (!dtrace_canload(tupregs[0].dttk_value, sizeof (struct mtx), + mstate, vstate)) { + regs[rd] = 0; + break; + } + l.lx = dtrace_loadptr((uintptr_t)&tupregs[0].dttk_value); + /* XXX - should be only LC_SLEEPABLE? */ + regs[rd] = (LOCK_CLASS(l.li)->lc_flags & + (LC_SLEEPLOCK | LC_SLEEPABLE)) != 0; break; case DIF_SUBR_MUTEX_TYPE_SPIN: - /* XXX - need to use dtrace_canload() and dtrace_loadptr() */ - m.mx = tupregs[0].dttk_value; - - regs[rd] = (LO_CLASSINDEX(&(m.mi->lock_object)) == 0); + if (!dtrace_canload(tupregs[0].dttk_value, sizeof (struct mtx), + mstate, vstate)) { + regs[rd] = 0; + break; + } + l.lx = dtrace_loadptr((uintptr_t)&tupregs[0].dttk_value); + regs[rd] = (LOCK_CLASS(l.li)->lc_flags & LC_SPINLOCK) != 0; break; case DIF_SUBR_RW_READ_HELD: case DIF_SUBR_SX_SHARED_HELD: - /* XXX - need to use dtrace_canload() and dtrace_loadptr() */ - s.sx = tupregs[0].dttk_value; - regs[rd] = ((s.si->sx_lock & SX_LOCK_SHARED) && - (SX_OWNER(s.si->sx_lock) >> SX_SHARERS_SHIFT) != 0); + if (!dtrace_canload(tupregs[0].dttk_value, sizeof (uintptr_t), + mstate, vstate)) { + regs[rd] = 0; + break; + } + l.lx = dtrace_loadptr((uintptr_t)&tupregs[0].dttk_value); + regs[rd] = LOCK_CLASS(l.li)->lc_owner(l.li, &lowner) && + lowner == NULL; break; case DIF_SUBR_RW_WRITE_HELD: case DIF_SUBR_SX_EXCLUSIVE_HELD: - /* XXX - need to use dtrace_canload() and dtrace_loadptr() */ - s.sx = tupregs[0].dttk_value; - regs[rd] = (SX_OWNER(s.si->sx_lock) == (uintptr_t) curthread); + if (!dtrace_canload(tupregs[0].dttk_value, sizeof (uintptr_t), + mstate, vstate)) { + regs[rd] = 0; + break; + } + l.lx = dtrace_loadptr(tupregs[0].dttk_value); + LOCK_CLASS(l.li)->lc_owner(l.li, &lowner); + regs[rd] = (lowner == curthread); break; case DIF_SUBR_RW_ISWRITER: case DIF_SUBR_SX_ISEXCLUSIVE: - /* XXX - need to use dtrace_canload() and dtrace_loadptr() */ - s.sx = tupregs[0].dttk_value; - regs[rd] = ((s.si->sx_lock & SX_LOCK_EXCLUSIVE_WAITERS) || - !(s.si->sx_lock & SX_LOCK_SHARED)); + if (!dtrace_canload(tupregs[0].dttk_value, sizeof (uintptr_t), + mstate, vstate)) { + regs[rd] = 0; + break; + } + l.lx = dtrace_loadptr(tupregs[0].dttk_value); + regs[rd] = LOCK_CLASS(l.li)->lc_owner(l.li, &lowner) && + lowner != NULL; break; #endif /* ! defined(sun) */ Added: head/sys/cddl/dev/lockstat/lockstat.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/cddl/dev/lockstat/lockstat.c Tue May 26 20:28:22 2009 (r192853) @@ -0,0 +1,327 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + * + * Portions Copyright (c) 2008-2009 Stacey Son + * + * $FreeBSD$ + * + */ + +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#include "opt_kdtrace.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#if defined(__i386__) || defined(__amd64__) +#define LOCKSTAT_AFRAMES 1 +#else +#error "architecture not supported" +#endif + +static d_open_t lockstat_open; +static void lockstat_provide(void *, dtrace_probedesc_t *); +static void lockstat_destroy(void *, dtrace_id_t, void *); +static void lockstat_enable(void *, dtrace_id_t, void *); +static void lockstat_disable(void *, dtrace_id_t, void *); +static void lockstat_load(void *); +static int lockstat_unload(void); + + +typedef struct lockstat_probe { + char *lsp_func; + char *lsp_name; + int lsp_probe; + dtrace_id_t lsp_id; +#ifdef __FreeBSD__ + int lsp_frame; +#endif +} lockstat_probe_t; + +#ifdef __FreeBSD__ +lockstat_probe_t lockstat_probes[] = +{ + /* Spin Locks */ + { LS_MTX_SPIN_LOCK, LSS_ACQUIRE, LS_MTX_SPIN_LOCK_ACQUIRE, + DTRACE_IDNONE, LOCKSTAT_AFRAMES }, + { LS_MTX_SPIN_LOCK, LSS_SPIN, LS_MTX_SPIN_LOCK_SPIN, + DTRACE_IDNONE, LOCKSTAT_AFRAMES }, + { LS_MTX_SPIN_UNLOCK, LSS_RELEASE, LS_MTX_SPIN_UNLOCK_RELEASE, + DTRACE_IDNONE, LOCKSTAT_AFRAMES }, + /* Adaptive Locks */ + { LS_MTX_LOCK, LSA_ACQUIRE, LS_MTX_LOCK_ACQUIRE, + DTRACE_IDNONE, (LOCKSTAT_AFRAMES + 1) }, + { LS_MTX_LOCK, LSA_BLOCK, LS_MTX_LOCK_BLOCK, + DTRACE_IDNONE, (LOCKSTAT_AFRAMES + 1) }, + { LS_MTX_LOCK, LSA_SPIN, LS_MTX_LOCK_SPIN, + DTRACE_IDNONE, (LOCKSTAT_AFRAMES + 1) }, + { LS_MTX_UNLOCK, LSA_RELEASE, LS_MTX_UNLOCK_RELEASE, + DTRACE_IDNONE, LOCKSTAT_AFRAMES }, + { LS_MTX_TRYLOCK, LSA_ACQUIRE, LS_MTX_TRYLOCK_ACQUIRE, + DTRACE_IDNONE, LOCKSTAT_AFRAMES }, + /* Reader/Writer Locks */ + { LS_RW_RLOCK, LSR_ACQUIRE, LS_RW_RLOCK_ACQUIRE, + DTRACE_IDNONE, LOCKSTAT_AFRAMES }, + { LS_RW_RLOCK, LSR_BLOCK, LS_RW_RLOCK_BLOCK, + DTRACE_IDNONE, LOCKSTAT_AFRAMES }, + { LS_RW_RLOCK, LSR_SPIN, LS_RW_RLOCK_SPIN, + DTRACE_IDNONE, LOCKSTAT_AFRAMES }, + { LS_RW_RUNLOCK, LSR_RELEASE, LS_RW_RUNLOCK_RELEASE, + DTRACE_IDNONE, LOCKSTAT_AFRAMES }, + { LS_RW_WLOCK, LSR_ACQUIRE, LS_RW_WLOCK_ACQUIRE, + DTRACE_IDNONE, LOCKSTAT_AFRAMES }, + { LS_RW_WLOCK, LSR_BLOCK, LS_RW_WLOCK_BLOCK, + DTRACE_IDNONE, LOCKSTAT_AFRAMES }, + { LS_RW_WLOCK, LSR_SPIN, LS_RW_WLOCK_SPIN, + DTRACE_IDNONE, LOCKSTAT_AFRAMES }, + { LS_RW_WUNLOCK, LSR_RELEASE, LS_RW_WUNLOCK_RELEASE, + DTRACE_IDNONE, LOCKSTAT_AFRAMES }, + { LS_RW_TRYUPGRADE, LSR_UPGRADE, LS_RW_TRYUPGRADE_UPGRADE, + DTRACE_IDNONE, LOCKSTAT_AFRAMES }, + { LS_RW_DOWNGRADE, LSR_DOWNGRADE, LS_RW_DOWNGRADE_DOWNGRADE, + DTRACE_IDNONE, LOCKSTAT_AFRAMES }, + /* Shared/Exclusive Locks */ + { LS_SX_SLOCK, LSX_ACQUIRE, LS_SX_SLOCK_ACQUIRE, + DTRACE_IDNONE, LOCKSTAT_AFRAMES }, + { LS_SX_SLOCK, LSX_BLOCK, LS_SX_SLOCK_BLOCK, + DTRACE_IDNONE, LOCKSTAT_AFRAMES }, + { LS_SX_SLOCK, LSX_SPIN, LS_SX_SLOCK_SPIN, + DTRACE_IDNONE, LOCKSTAT_AFRAMES }, + { LS_SX_SUNLOCK, LSX_RELEASE, LS_SX_SUNLOCK_RELEASE, + DTRACE_IDNONE, LOCKSTAT_AFRAMES }, + { LS_SX_XLOCK, LSX_ACQUIRE, LS_SX_XLOCK_ACQUIRE, + DTRACE_IDNONE, LOCKSTAT_AFRAMES }, + { LS_SX_XLOCK, LSX_BLOCK, LS_SX_XLOCK_BLOCK, + DTRACE_IDNONE, LOCKSTAT_AFRAMES }, + { LS_SX_XLOCK, LSX_SPIN, LS_SX_XLOCK_SPIN, + DTRACE_IDNONE, LOCKSTAT_AFRAMES }, + { LS_SX_XUNLOCK, LSX_RELEASE, LS_SX_XUNLOCK_RELEASE, + DTRACE_IDNONE, LOCKSTAT_AFRAMES }, + { LS_SX_TRYUPGRADE, LSX_UPGRADE, LS_SX_TRYUPGRADE_UPGRADE, + DTRACE_IDNONE, LOCKSTAT_AFRAMES }, + { LS_SX_DOWNGRADE, LSX_DOWNGRADE, LS_SX_DOWNGRADE_DOWNGRADE, + DTRACE_IDNONE, LOCKSTAT_AFRAMES }, + /* Thread Locks */ + { LS_THREAD_LOCK, LST_SPIN, LS_THREAD_LOCK_SPIN, + DTRACE_IDNONE, LOCKSTAT_AFRAMES }, + { NULL } +}; +#else +#error "OS not supported" +#endif + + +static struct cdevsw lockstat_cdevsw = { + .d_version = D_VERSION, + .d_open = lockstat_open, + .d_name = "lockstat", +}; + +static struct cdev *lockstat_cdev; +static dtrace_provider_id_t lockstat_id; + +/*ARGSUSED*/ +static void +lockstat_enable(void *arg, dtrace_id_t id, void *parg) +{ + lockstat_probe_t *probe = parg; + + ASSERT(!lockstat_probemap[probe->lsp_probe]); + + lockstat_probemap[probe->lsp_probe] = id; +#ifdef DOODAD + membar_producer(); +#endif + + lockstat_probe_func = dtrace_probe; +#ifdef DOODAD + membar_producer(); + + lockstat_hot_patch(); + membar_producer(); +#endif +} + +/*ARGSUSED*/ +static void +lockstat_disable(void *arg, dtrace_id_t id, void *parg) +{ + lockstat_probe_t *probe = parg; + int i; + + ASSERT(lockstat_probemap[probe->lsp_probe]); + + lockstat_probemap[probe->lsp_probe] = 0; +#ifdef DOODAD + lockstat_hot_patch(); + membar_producer(); +#endif + + /* + * See if we have any probes left enabled. + */ + for (i = 0; i < LS_NPROBES; i++) { + if (lockstat_probemap[i]) { + /* + * This probe is still enabled. We don't need to deal + * with waiting for all threads to be out of the + * lockstat critical sections; just return. + */ + return; + } + } + +} + +/*ARGSUSED*/ +static int +lockstat_open(struct cdev *dev __unused, int oflags __unused, + int devtype __unused, struct thread *td __unused) +{ + return (0); +} + +/*ARGSUSED*/ +static void +lockstat_provide(void *arg, dtrace_probedesc_t *desc) +{ + int i = 0; + + for (i = 0; lockstat_probes[i].lsp_func != NULL; i++) { + lockstat_probe_t *probe = &lockstat_probes[i]; + + if (dtrace_probe_lookup(lockstat_id, "kernel", + probe->lsp_func, probe->lsp_name) != 0) + continue; + + ASSERT(!probe->lsp_id); +#ifdef __FreeBSD__ + probe->lsp_id = dtrace_probe_create(lockstat_id, + "kernel", probe->lsp_func, probe->lsp_name, + probe->lsp_frame, probe); +#else + probe->lsp_id = dtrace_probe_create(lockstat_id, + "kernel", probe->lsp_func, probe->lsp_name, + LOCKSTAT_AFRAMES, probe); +#endif + } +} + +/*ARGSUSED*/ +static void +lockstat_destroy(void *arg, dtrace_id_t id, void *parg) +{ + lockstat_probe_t *probe = parg; + + ASSERT(!lockstat_probemap[probe->lsp_probe]); + probe->lsp_id = 0; +} + +static dtrace_pattr_t lockstat_attr = { +{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON }, +{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, +{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, +{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON }, +{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON }, +}; + +static dtrace_pops_t lockstat_pops = { + lockstat_provide, + NULL, + lockstat_enable, + lockstat_disable, + NULL, + NULL, + NULL, + NULL, + NULL, + lockstat_destroy +}; + +static void +lockstat_load(void *dummy) +{ + /* Create the /dev/dtrace/lockstat entry. */ + lockstat_cdev = make_dev(&lockstat_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, + "dtrace/lockstat"); + + if (dtrace_register("lockstat", &lockstat_attr, DTRACE_PRIV_USER, + NULL, &lockstat_pops, NULL, &lockstat_id) != 0) + return; +} + +static int +lockstat_unload() +{ + int error = 0; + + if ((error = dtrace_unregister(lockstat_id)) != 0) + return (error); + + destroy_dev(lockstat_cdev); + + return (error); +} + +/* ARGSUSED */ +static int +lockstat_modevent(module_t mod __unused, int type, void *data __unused) +{ + int error = 0; + + switch (type) { + case MOD_LOAD: + break; + + case MOD_UNLOAD: + break; + + case MOD_SHUTDOWN: + break; + + default: + error = EOPNOTSUPP; + break; + } + return (error); +} + +SYSINIT(lockstat_load, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, lockstat_load, NULL); +SYSUNINIT(lockstat_unload, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, lockstat_unload, NULL); + +DEV_MODULE(lockstat, lockstat_modevent, NULL); +MODULE_VERSION(lockstat, 1); +MODULE_DEPEND(lockstat, dtrace, 1, 1, 1); +MODULE_DEPEND(lockstat, opensolaris, 1, 1, 1); Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue May 26 20:22:03 2009 (r192852) +++ head/sys/conf/files Tue May 26 20:28:22 2009 (r192853) @@ -1917,6 +1917,7 @@ kern/kern_ktrace.c standard kern/kern_linker.c standard kern/kern_lock.c standard kern/kern_lockf.c standard +kern/kern_lockstat.c optional kdtrace_hooks kern/kern_malloc.c standard kern/kern_mbuf.c standard kern/kern_mib.c standard Modified: head/sys/kern/kern_lock.c ============================================================================== --- head/sys/kern/kern_lock.c Tue May 26 20:22:03 2009 (r192852) +++ head/sys/kern/kern_lock.c Tue May 26 20:28:22 2009 (r192853) @@ -27,6 +27,7 @@ */ #include "opt_ddb.h" +#include "opt_kdtrace.h" #include __FBSDID("$FreeBSD$"); @@ -126,6 +127,9 @@ static void assert_lockmgr(struct lock_ static void db_show_lockmgr(struct lock_object *lock); #endif static void lock_lockmgr(struct lock_object *lock, int how); +#ifdef KDTRACE_HOOKS +static int owner_lockmgr(struct lock_object *lock, struct thread **owner); +#endif static int unlock_lockmgr(struct lock_object *lock); struct lock_class lock_class_lockmgr = { @@ -136,7 +140,10 @@ struct lock_class lock_class_lockmgr = { .lc_ddb_show = db_show_lockmgr, #endif .lc_lock = lock_lockmgr, - .lc_unlock = unlock_lockmgr + .lc_unlock = unlock_lockmgr, +#ifdef KDTRACE_HOOKS + .lc_owner = owner_lockmgr, +#endif }; static __inline struct thread * @@ -293,6 +300,15 @@ unlock_lockmgr(struct lock_object *lock) panic("lockmgr locks do not support sleep interlocking"); } +#ifdef KDTRACE_HOOKS +static int +owner_lockmgr(struct lock_object *lock, struct thread **owner) +{ + + panic("lockmgr locks do not support owner inquiring"); +} +#endif + void lockinit(struct lock *lk, int pri, const char *wmesg, int timo, int flags) { Added: head/sys/kern/kern_lockstat.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/kern/kern_lockstat.c Tue May 26 20:28:22 2009 (r192853) @@ -0,0 +1,64 @@ +/*- + * Copyright 2008-2009 Stacey Son + * + * 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 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 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$ + */ + +/* + * Backend for the lock tracing (lockstat) kernel support. This is required + * to allow a module to load even though DTrace kernel support may not be + * present. + * + */ + +#include "opt_kdtrace.h" + +#ifdef KDTRACE_HOOKS + +#include +#include +#include + +/* + * The following must match the type definition of dtrace_probe. It is + * defined this way to avoid having to rely on CDDL code. + */ +uint32_t lockstat_probemap[LS_NPROBES]; +void (*lockstat_probe_func)(uint32_t, uintptr_t, uintptr_t, + uintptr_t, uintptr_t, uintptr_t); + + +uint64_t +lockstat_nsecs(void) +{ + struct bintime bt; + uint64_t ns; + + binuptime(&bt); + ns = bt.sec * (uint64_t)1000000000; + ns += ((uint64_t)1000000000 * (uint32_t)(bt.frac >> 32)) >> 32; + return (ns); +} + +#endif /* KDTRACE_HOOKS */ Modified: head/sys/kern/kern_mutex.c ============================================================================== --- head/sys/kern/kern_mutex.c Tue May 26 20:22:03 2009 (r192852) +++ head/sys/kern/kern_mutex.c Tue May 26 20:28:22 2009 (r192853) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include "opt_adaptive_mutexes.h" #include "opt_ddb.h" #include "opt_global.h" +#include "opt_kdtrace.h" #include "opt_sched.h" #include @@ -90,6 +91,9 @@ static void db_show_mtx(struct lock_obje #endif static void lock_mtx(struct lock_object *lock, int how); static void lock_spin(struct lock_object *lock, int how); +#ifdef KDTRACE_HOOKS +static int owner_mtx(struct lock_object *lock, struct thread **owner); +#endif static int unlock_mtx(struct lock_object *lock); static int unlock_spin(struct lock_object *lock); @@ -105,6 +109,9 @@ struct lock_class lock_class_mtx_sleep = #endif .lc_lock = lock_mtx, .lc_unlock = unlock_mtx, +#ifdef KDTRACE_HOOKS + .lc_owner = owner_mtx, +#endif }; struct lock_class lock_class_mtx_spin = { .lc_name = "spin mutex", @@ -115,6 +122,9 @@ struct lock_class lock_class_mtx_spin = #endif .lc_lock = lock_spin, .lc_unlock = unlock_spin, +#ifdef KDTRACE_HOOKS + .lc_owner = owner_mtx, +#endif }; /* @@ -162,6 +172,17 @@ unlock_spin(struct lock_object *lock) panic("spin locks can only use msleep_spin"); } +#ifdef KDTRACE_HOOKS +int +owner_mtx(struct lock_object *lock, struct thread **owner) +{ + struct mtx *m = (struct mtx *)lock; + + *owner = mtx_owner(m); + return (mtx_unowned(m) == 0); +} +#endif + /* * Function versions of the inlined __mtx_* macros. These are used by * modules and can also be called from assembly language if needed. @@ -202,7 +223,7 @@ _mtx_unlock_flags(struct mtx *m, int opt mtx_assert(m, MA_OWNED); if (m->mtx_recurse == 0) - lock_profile_release_lock(&m->lock_object); + LOCKSTAT_PROFILE_RELEASE_LOCK(LS_MTX_UNLOCK_RELEASE, m); _rel_sleep_lock(m, curthread, opts, file, line); } @@ -280,8 +301,8 @@ _mtx_trylock(struct mtx *m, int opts, co file, line); curthread->td_locks++; if (m->mtx_recurse == 0) - lock_profile_obtain_lock_success(&m->lock_object, contested, - waittime, file, line); + LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(LS_MTX_LOCK_ACQUIRE, + m, contested, waittime, file, line); } @@ -310,6 +331,11 @@ _mtx_lock_sleep(struct mtx *m, uintptr_t int contested = 0; uint64_t waittime = 0; #endif +#ifdef KDTRACE_HOOKS + uint64_t spin_cnt = 0; + uint64_t sleep_cnt = 0; + int64_t sleep_time = 0; +#endif if (mtx_owned(m)) { KASSERT((m->lock_object.lo_flags & LO_RECURSABLE) != 0, @@ -330,6 +356,9 @@ _mtx_lock_sleep(struct mtx *m, uintptr_t m->lock_object.lo_name, (void *)m->mtx_lock, file, line); while (!_obtain_lock(m, tid)) { +#ifdef KDTRACE_HOOKS + spin_cnt++; +#endif #ifdef ADAPTIVE_MUTEXES /* * If the owner is running on another CPU, spin until the @@ -344,8 +373,12 @@ _mtx_lock_sleep(struct mtx *m, uintptr_t "%s: spinning on %p held by %p", __func__, m, owner); while (mtx_owner(m) == owner && - TD_IS_RUNNING(owner)) + TD_IS_RUNNING(owner)) { cpu_spinwait(); +#ifdef KDTRACE_HOOKS + spin_cnt++; +#endif + } continue; } } @@ -408,7 +441,14 @@ _mtx_lock_sleep(struct mtx *m, uintptr_t /* * Block on the turnstile. */ +#ifdef KDTRACE_HOOKS + sleep_time -= lockstat_nsecs(); +#endif turnstile_wait(ts, mtx_owner(m), TS_EXCLUSIVE_QUEUE); +#ifdef KDTRACE_HOOKS + sleep_time += lockstat_nsecs(); + sleep_cnt++; +#endif } #ifdef KTR if (cont_logged) { @@ -417,8 +457,18 @@ _mtx_lock_sleep(struct mtx *m, uintptr_t m->lock_object.lo_name, (void *)tid, file, line); } #endif - lock_profile_obtain_lock_success(&m->lock_object, contested, + LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(LS_MTX_LOCK_ACQUIRE, m, contested, waittime, file, line); +#ifdef KDTRACE_HOOKS + if (sleep_time) + LOCKSTAT_RECORD1(LS_MTX_LOCK_BLOCK, m, sleep_time); + + /* + * Only record the loops spinning and not sleeping. + */ + if (spin_cnt > sleep_cnt) + LOCKSTAT_RECORD1(LS_MTX_LOCK_SPIN, m, (spin_cnt - sleep_cnt)); +#endif } static void @@ -482,8 +532,9 @@ _mtx_lock_spin(struct mtx *m, uintptr_t if (LOCK_LOG_TEST(&m->lock_object, opts)) CTR1(KTR_LOCK, "_mtx_lock_spin: %p spin done", m); - lock_profile_obtain_lock_success(&m->lock_object, contested, - waittime, (file), (line)); + LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(LS_MTX_SPIN_LOCK_ACQUIRE, m, + contested, waittime, (file), (line)); + LOCKSTAT_RECORD1(LS_MTX_SPIN_LOCK_SPIN, m, i); } #endif /* SMP */ @@ -497,6 +548,9 @@ _thread_lock_flags(struct thread *td, in int contested = 0; uint64_t waittime = 0; #endif +#ifdef KDTRACE_HOOKS + uint64_t spin_cnt = 0; +#endif i = 0; tid = (uintptr_t)curthread; @@ -516,6 +570,9 @@ retry: WITNESS_CHECKORDER(&m->lock_object, opts | LOP_NEWORDER | LOP_EXCLUSIVE, file, line, NULL); while (!_obtain_lock(m, tid)) { +#ifdef KDTRACE_HOOKS + spin_cnt++; +#endif if (m->mtx_lock == tid) { m->mtx_recurse++; break; @@ -541,13 +598,17 @@ retry: if (m == td->td_lock) break; _rel_spin_lock(m); /* does spinlock_exit() */ +#ifdef KDTRACE_HOOKS + spin_cnt++; +#endif } if (m->mtx_recurse == 0) - lock_profile_obtain_lock_success(&m->lock_object, contested, - waittime, (file), (line)); + LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(LS_MTX_SPIN_LOCK_ACQUIRE, + m, contested, waittime, (file), (line)); LOCK_LOG_LOCK("LOCK", &m->lock_object, opts, m->mtx_recurse, file, line); WITNESS_LOCK(&m->lock_object, opts | LOP_EXCLUSIVE, file, line); + LOCKSTAT_RECORD1(LS_THREAD_LOCK_SPIN, m, spin_cnt); } struct mtx * Modified: head/sys/kern/kern_rmlock.c ============================================================================== --- head/sys/kern/kern_rmlock.c Tue May 26 20:22:03 2009 (r192852) +++ head/sys/kern/kern_rmlock.c Tue May 26 20:28:22 2009 (r192853) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include "opt_ddb.h" +#include "opt_kdtrace.h" #include #include @@ -71,6 +72,9 @@ static __inline void compiler_memory_bar static void assert_rm(struct lock_object *lock, int what); static void lock_rm(struct lock_object *lock, int how); +#ifdef KDTRACE_HOOKS +static int owner_rm(struct lock_object *lock, struct thread **owner); +#endif static int unlock_rm(struct lock_object *lock); struct lock_class lock_class_rm = { @@ -84,6 +88,9 @@ struct lock_class lock_class_rm = { #endif .lc_lock = lock_rm, .lc_unlock = unlock_rm, +#ifdef KDTRACE_HOOKS + .lc_owner = owner_rm, +#endif }; static void @@ -107,6 +114,15 @@ unlock_rm(struct lock_object *lock) panic("unlock_rm called"); } +#ifdef KDTRACE_HOOKS +static int +owner_rm(struct lock_object *lock, struct thread **owner) +{ + + panic("owner_rm called"); +} +#endif + static struct mtx rm_spinlock; MTX_SYSINIT(rm_spinlock, &rm_spinlock, "rm_spinlock", MTX_SPIN); Modified: head/sys/kern/kern_rwlock.c ============================================================================== --- head/sys/kern/kern_rwlock.c Tue May 26 20:22:03 2009 (r192852) +++ head/sys/kern/kern_rwlock.c Tue May 26 20:28:22 2009 (r192853) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include "opt_ddb.h" +#include "opt_kdtrace.h" #include "opt_no_adaptive_rwlocks.h" #include @@ -71,6 +72,9 @@ static void db_show_rwlock(struct lock_o #endif static void assert_rw(struct lock_object *lock, int what); static void lock_rw(struct lock_object *lock, int how); +#ifdef KDTRACE_HOOKS +static int owner_rw(struct lock_object *lock, struct thread **owner); +#endif static int unlock_rw(struct lock_object *lock); struct lock_class lock_class_rw = { @@ -82,6 +86,9 @@ struct lock_class lock_class_rw = { #endif .lc_lock = lock_rw, .lc_unlock = unlock_rw, +#ifdef KDTRACE_HOOKS + .lc_owner = owner_rw, +#endif }; /* @@ -149,6 +156,19 @@ unlock_rw(struct lock_object *lock) } } +#ifdef KDTRACE_HOOKS +int +owner_rw(struct lock_object *lock, struct thread **owner) +{ + struct rwlock *rw = (struct rwlock *)lock; + uintptr_t x = rw->rw_lock; + + *owner = rw_wowner(rw); + return ((x & RW_LOCK_READ) != 0 ? (RW_READERS(x) != 0) : + (*owner != NULL)); +} +#endif + void rw_init_flags(struct rwlock *rw, const char *name, int opts) { @@ -258,7 +278,7 @@ _rw_wunlock(struct rwlock *rw, const cha LOCK_LOG_LOCK("WUNLOCK", &rw->lock_object, 0, rw->rw_recurse, file, line); if (!rw_recursed(rw)) - lock_profile_release_lock(&rw->lock_object); + LOCKSTAT_PROFILE_RELEASE_LOCK(LS_RW_WUNLOCK_RELEASE, rw); __rw_wunlock(rw, curthread, file, line); } /* @@ -287,6 +307,11 @@ _rw_rlock(struct rwlock *rw, const char int contested = 0; #endif uintptr_t v; +#ifdef KDTRACE_HOOKS + uint64_t spin_cnt = 0; + uint64_t sleep_cnt = 0; + int64_t sleep_time = 0; +#endif KASSERT(rw->rw_lock != RW_DESTROYED, ("rw_rlock() of destroyed rwlock @ %s:%d", file, line)); @@ -296,6 +321,9 @@ _rw_rlock(struct rwlock *rw, const char WITNESS_CHECKORDER(&rw->lock_object, LOP_NEWORDER, file, line, NULL); for (;;) { +#ifdef KDTRACE_HOOKS + spin_cnt++; +#endif /* * Handle the easy case. If no other thread has a write * lock, then try to bump up the count of read locks. Note @@ -342,8 +370,12 @@ _rw_rlock(struct rwlock *rw, const char "%s: spinning on %p held by %p", __func__, rw, owner); while ((struct thread*)RW_OWNER(rw->rw_lock) == - owner && TD_IS_RUNNING(owner)) + owner && TD_IS_RUNNING(owner)) { cpu_spinwait(); +#ifdef KDTRACE_HOOKS + spin_cnt++; +#endif + } continue; } } else if (spintries < rowner_retries) { @@ -423,7 +455,14 @@ _rw_rlock(struct rwlock *rw, const char if (LOCK_LOG_TEST(&rw->lock_object, 0)) CTR2(KTR_LOCK, "%s: %p blocking on turnstile", __func__, rw); +#ifdef KDTRACE_HOOKS + sleep_time -= lockstat_nsecs(); +#endif turnstile_wait(ts, rw_owner(rw), TS_SHARED_QUEUE); +#ifdef KDTRACE_HOOKS + sleep_time += lockstat_nsecs(); + sleep_cnt++; +#endif if (LOCK_LOG_TEST(&rw->lock_object, 0)) CTR2(KTR_LOCK, "%s: %p resuming from turnstile", __func__, rw); @@ -434,12 +473,22 @@ _rw_rlock(struct rwlock *rw, const char * however. turnstiles don't like owners changing between calls to * turnstile_wait() currently. */ - lock_profile_obtain_lock_success( &rw->lock_object, contested, + LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(LS_RW_RLOCK_ACQUIRE, rw, contested, waittime, file, line); LOCK_LOG_LOCK("RLOCK", &rw->lock_object, 0, 0, file, line); WITNESS_LOCK(&rw->lock_object, 0, file, line); curthread->td_locks++; curthread->td_rw_rlocks++; +#ifdef KDTRACE_HOOKS + if (sleep_time) + LOCKSTAT_RECORD1(LS_RW_RLOCK_BLOCK, rw, sleep_time); + + /* + * Record only the loops spinning and not sleeping. + */ + if (spin_cnt > sleep_cnt) + LOCKSTAT_RECORD1(LS_RW_RLOCK_SPIN, rw, (spin_cnt - sleep_cnt)); +#endif } int @@ -569,7 +618,7 @@ _rw_runlock(struct rwlock *rw, const cha turnstile_chain_unlock(&rw->lock_object); break; } - lock_profile_release_lock(&rw->lock_object); + LOCKSTAT_PROFILE_RELEASE_LOCK(LS_RW_RUNLOCK_RELEASE, rw); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue May 26 20:57:20 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53E9B1065675; Tue, 26 May 2009 20:57:20 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 435858FC39; Tue, 26 May 2009 20:57:20 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QKvKex073436; Tue, 26 May 2009 20:57:20 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QKvKAA073435; Tue, 26 May 2009 20:57:20 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200905262057.n4QKvKAA073435@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 26 May 2009 20:57:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192855 - head/sys/modules/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 20:57:20 -0000 Author: des Date: Tue May 26 20:57:19 2009 New Revision: 192855 URL: http://svn.freebsd.org/changeset/base/192855 Log: Move opt_apic.h closer to the "XXX: for assym.s" comment. Suggested by: jhb MFC after: 1 week Modified: head/sys/modules/linux/Makefile Modified: head/sys/modules/linux/Makefile ============================================================================== --- head/sys/modules/linux/Makefile Tue May 26 20:41:37 2009 (r192854) +++ head/sys/modules/linux/Makefile Tue May 26 20:57:19 2009 (r192855) @@ -18,11 +18,14 @@ SRCS= linux${SFX}_dummy.c linux_emul.c l # XXX: for assym.s SRCS+= opt_kstack_pages.h opt_nfs.h opt_compat.h opt_hwpmc_hooks.h +.if ${MACHINE_ARCH} == "i386" +SRCS+= opt_apic.h +.endif OBJS= linux${SFX}_locore.o linux${SFX}_support.o .if ${MACHINE_ARCH} == "i386" -SRCS+= linux_ptrace.c imgact_linux.c opt_apic.h opt_cpu.h +SRCS+= linux_ptrace.c imgact_linux.c opt_cpu.h .endif EXPORT_SYMS= From owner-svn-src-head@FreeBSD.ORG Tue May 26 21:06:52 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2314F106564A; Tue, 26 May 2009 21:06:52 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 110648FC1C; Tue, 26 May 2009 21:06:52 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QL6p35073703; Tue, 26 May 2009 21:06:51 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QL6p6n073700; Tue, 26 May 2009 21:06:51 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200905262106.n4QL6p6n073700@svn.freebsd.org> From: Ed Schouten Date: Tue, 26 May 2009 21:06:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192856 - in head: contrib/ee usr.bin/ee usr.bin/ee/nls/en_US.US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 21:06:52 -0000 Author: ed Date: Tue May 26 21:06:51 2009 New Revision: 192856 URL: http://svn.freebsd.org/changeset/base/192856 Log: Merge local changes to ee(1) into contrib space. The source file, manual page and English translation are now directly obtained from the contrib/ directory. This makes it a lot easier to merge a newer version of ee(1) into the tree. Thanks to: des and jhb Deleted: head/usr.bin/ee/Artistic head/usr.bin/ee/FREEBSD-upgrade head/usr.bin/ee/README head/usr.bin/ee/ee.1 head/usr.bin/ee/ee.c head/usr.bin/ee/ee.i18n.guide head/usr.bin/ee/nls/en_US.US-ASCII/ Modified: head/contrib/ee/ee.c (contents, props changed) head/contrib/ee/ee.msg (contents, props changed) head/usr.bin/ee/Makefile Modified: head/contrib/ee/ee.c ============================================================================== --- head/contrib/ee/ee.c Tue May 26 20:57:19 2009 (r192855) +++ head/contrib/ee/ee.c Tue May 26 21:06:51 2009 (r192856) @@ -53,6 +53,9 @@ | */ +#include +__FBSDID("$FreeBSD$"); + char *ee_copyright_message = "Copyright (c) 1986, 1990, 1991, 1992, 1993, 1994, 1995, 1996 Hugh Mahon "; @@ -66,39 +69,37 @@ char *version = "@(#) ee, version 1.4.1 #ifdef NCURSE #include "new_curse.h" +#elif HAS_NCURSES +#include #else #include #endif -#include +#ifdef HAS_CTYPE +#include +#endif +#include +#include #include +#include +#include +#include #include #include -#include -#include -#include - #ifdef HAS_SYS_WAIT #include #endif - -#ifdef HAS_STDLIB -#include -#endif - #ifdef HAS_STDARG #include #endif - +#ifdef HAS_STDLIB +#include +#endif +#include #ifdef HAS_UNISTD #include #endif -#ifdef HAS_CTYPE -#include -#endif - - #ifndef NO_CATGETS #include #include @@ -202,8 +203,11 @@ unsigned char *d_char; /* deleted chara unsigned char *d_word; /* deleted word */ unsigned char *d_line; /* deleted line */ char in_string[513]; /* buffer for reading a file */ -unsigned char *print_command = "lp"; /* string to use for the print command */ +unsigned char *print_command = "lpr"; /* string to use for the print command */ unsigned char *start_at_line = NULL; /* move to this line at start of session*/ +const char count_text_default[] = "==============================================================================="; +int count_text_len = sizeof(count_text_default); /* length of the line above */ +char count_text[sizeof(count_text_default)]; /* buffer for current position display */ int in; /* input character */ FILE *temp_fp; /* temporary file pointer */ @@ -219,6 +223,7 @@ WINDOW *com_win; WINDOW *text_win; WINDOW *help_win; WINDOW *info_win; +WINDOW *count_win; #if defined(__STDC__) || defined(__cplusplus) #define P_(s) s @@ -298,7 +303,7 @@ void finish P_((void)); int quit P_((int noverify)); void edit_abort P_((int arg)); void delete_text P_((void)); -int write_file P_((char *file_name)); +int write_file P_((char *file_name, int warn_if_exists)); int search P_((int display_message)); void search_prompt P_((void)); void del_char P_((void)); @@ -339,6 +344,7 @@ char *is_in_string P_((char *string, cha char *resolve_name P_((char *name)); int restrict_mode P_((void)); int unique_test P_((char *string, char *list[])); +void renumber_lines P_((struct text *firstline, int startnumber)); void strings_init P_((void)); #undef P_ @@ -535,28 +541,23 @@ char *more_above_str, *more_below_str; char *chinese_cmd, *nochinese_cmd; -#ifndef __STDC__ -#ifndef HAS_STDLIB -extern char *malloc(); -extern char *realloc(); -extern char *getenv(); -FILE *fopen(); /* declaration for open function */ -#endif /* HAS_STDLIB */ -#endif /* __STDC__ */ int main(argc, argv) /* beginning of main program */ int argc; char *argv[]; { - int counter; - - for (counter = 1; counter < 24; counter++) - signal(counter, SIG_IGN); + /* Always read from (and write to) a terminal. */ + if (!isatty(STDIN_FILENO) || !isatty(STDOUT_FILENO)) { + fprintf(stderr, "ee's standard input and output must be a terminal\n"); + exit(1); + } signal(SIGCHLD, SIG_DFL); signal(SIGSEGV, SIG_DFL); signal(SIGINT, edit_abort); + signal(SIGHUP, edit_abort); + d_char = malloc(3); /* provide a buffer for multi-byte chars */ d_word = malloc(150); *d_word = (char) NULL; @@ -577,7 +578,7 @@ char *argv[]; scr_pos =0; scr_vert = 0; scr_horz = 0; - bit_bucket = fopen("/dev/null", "w"); + bit_bucket = fopen(_PATH_DEVNULL, "w"); edit = TRUE; gold = case_sen = FALSE; shell_fork = TRUE; @@ -608,10 +609,23 @@ char *argv[]; while(edit) { - wrefresh(text_win); + if (info_window) + { + snprintf(count_text, count_text_len, "L: %d C: %d %s", \ + curr_line->line_number, scr_horz + 1, count_text_default); + wmove(count_win, 0, 0); + if (!nohighlight) + wstandout(count_win); + wprintw(count_win, count_text); + wstandend(count_win); + wnoutrefresh(count_win); + } + + wnoutrefresh(text_win); + doupdate(); in = wgetch(text_win); if (in == -1) - exit(0); + continue; resize_check(); @@ -810,6 +824,7 @@ int disp; if (temp_buff->next_line != NULL) temp_buff->next_line->prev_line = curr_line; curr_line->next_line = temp_buff->next_line; + renumber_lines(curr_line->next_line, curr_line->line_number + 1); temp2 = temp_buff->line; if (in == 8) { @@ -943,13 +958,13 @@ int column; } else { - waddch(window, (char)character ); + waddch(window, (unsigned char)character ); return(1); } } else { - waddch(window, (char)character); + waddch(window, (unsigned char)character); return(1); } for (i2 = 0; (string[i2] != (char) NULL) && (((column+i2+1)-horiz_offset) < last_col); i2++) @@ -1054,8 +1069,8 @@ int disp; temp_nod->line = extra= malloc(10); temp_nod->line_length = 1; temp_nod->max_length = 10; - temp_nod->line_number = curr_line->line_number + 1; temp_nod->next_line = curr_line->next_line; + renumber_lines(temp_nod, curr_line->line_number + 1); if (temp_nod->next_line != NULL) temp_nod->next_line->prev_line = temp_nod; temp_nod->prev_line = curr_line; @@ -1507,8 +1522,10 @@ function_key() /* process function ke left(TRUE); else if (in == KEY_RIGHT) right(TRUE); - else if ( in == KEY_HOME) - top(); + else if (in == KEY_HOME) + bol(); + else if (in == KEY_END) + eol(); else if ( in == KEY_UP) up(); else if (in == KEY_DOWN) @@ -1674,7 +1691,7 @@ char *cmd_str1; cmd_str = cmd_str2 = get_string(file_write_prompt_str, TRUE); } tmp_file = resolve_name(cmd_str); - write_file(tmp_file); + write_file(tmp_file, 1); if (tmp_file != cmd_str) free(tmp_file); } @@ -1855,7 +1872,7 @@ int advance; /* if true, skip leading s esc_flag = FALSE; in = wgetch(com_win); if (in == -1) - exit(0); + continue; if (((in == 8) || (in == 127) || (in == KEY_BACKSPACE)) && (g_pos > 0)) { tmp_int = g_horz; @@ -1880,7 +1897,7 @@ int advance; /* if true, skip leading s esc_flag = TRUE; in = wgetch(com_win); if (in == -1) - exit(0); + continue; } *nam_str = in; g_pos++; @@ -1954,7 +1971,7 @@ char *cmd_str; int number; int i; char *ptr; - char *direction; + char *direction = NULL; struct text *t_line; ptr = cmd_str; @@ -2025,9 +2042,10 @@ char *arguments[]; { char *buff; int count; - struct files *temp_names; + struct files *temp_names = NULL; char *name; char *ptr; + int no_more_opts = FALSE; /* | see if editor was invoked as 'ree' (restricted mode) @@ -2044,7 +2062,7 @@ char *arguments[]; input_file = FALSE; recv_file = FALSE; count = 1; - while (count < numargs) + while ((count < numargs) && (!no_more_opts)) { buff = arguments[count]; if (!strcmp("-i", buff)) @@ -2073,30 +2091,38 @@ char *arguments[]; buff++; start_at_line = buff; } - + else if (!(strcmp("--", buff))) + no_more_opts = TRUE; else { - if (top_of_stack == NULL) - { - temp_names = top_of_stack = name_alloc(); - } - else - { - temp_names->next_name = name_alloc(); - temp_names = temp_names->next_name; - } - ptr = temp_names->name = malloc(strlen(buff) + 1); - while (*buff != (char) NULL) - { - *ptr = *buff; - buff++; - ptr++; - } - *ptr = (char) NULL; - temp_names->next_name = NULL; - input_file = TRUE; - recv_file = TRUE; + count--; + no_more_opts = TRUE; + } + count++; + } + while (count < numargs) + { + buff = arguments[count]; + if (top_of_stack == NULL) + { + temp_names = top_of_stack = name_alloc(); + } + else + { + temp_names->next_name = name_alloc(); + temp_names = temp_names->next_name; } + ptr = temp_names->name = malloc(strlen(buff) + 1); + while (*buff != (char) NULL) + { + *ptr = *buff; + buff++; + ptr++; + } + *ptr = (char) NULL; + temp_names->next_name = NULL; + input_file = TRUE; + recv_file = TRUE; count++; } } @@ -2292,8 +2318,8 @@ int *append; /* TRUE if must append more if (!(*append)) /* if not append to current line, insert new one */ { tline = txtalloc(); /* allocate data structure for next line */ - tline->line_number = curr_line->line_number + 1; tline->next_line = curr_line->next_line; + renumber_lines(tline, curr_line->line_number + 1); tline->prev_line = curr_line; curr_line->next_line = tline; if (tline->next_line != NULL) @@ -2372,7 +2398,7 @@ finish() /* prepare to exit edit session file_name = tmp_file; } - if (write_file(file_name)) + if (write_file(file_name, 1)) { text_changes = FALSE; quit(0); @@ -2412,6 +2438,7 @@ int noverify; recv_file = TRUE; input_file = TRUE; check_fp(); + text_changes = FALSE; } return(0); } @@ -2448,8 +2475,9 @@ delete_text() } int -write_file(file_name) +write_file(file_name, warn_if_exists) char *file_name; +int warn_if_exists; { char cr; char *tmp_point; @@ -2459,7 +2487,8 @@ char *file_name; int write_flag = TRUE; charac = lines = 0; - if ((in_file_name == NULL) || strcmp(in_file_name, file_name)) + if (warn_if_exists && + ((in_file_name == NULL) || strcmp(in_file_name, file_name))) { if ((temp_fp = fopen(file_name, "r"))) { @@ -3125,9 +3154,8 @@ char *string; /* string containing user } for (value = 1; value < 24; value++) signal(value, SIG_DFL); - execl(path, last_slash, "-c", string, NULL); - printf(exec_err_msg, path); - exit(-1); + execl(path, last_slash, "-c", string, (char *)NULL); + errx(1, exec_err_msg, path); } else /* if the parent */ { @@ -3170,7 +3198,7 @@ char *string; /* string containing user } if (shell_fork) { - printf(continue_msg); + printf("%s", continue_msg); fflush(stdout); while ((in = getchar()) != '\n') ; @@ -3230,9 +3258,12 @@ set_up_term() /* set up the terminal fo if (info_window) { info_type = CONTROL_KEYS; - info_win = newwin(6, COLS, 0, 0); + info_win = newwin(5, COLS, 0, 0); werase(info_win); paint_info_win(); + count_win = newwin(1, COLS, 5, 0); + leaveok(count_win, TRUE); + wrefresh(count_win); } last_col = COLS - 1; @@ -3257,6 +3288,7 @@ resize_check() delwin(text_win); delwin(com_win); delwin(help_win); + delwin(count_win); set_up_term(); redraw(); wrefresh(text_win); @@ -3274,7 +3306,7 @@ struct menu_entries menu_list[]; int counter; int length; int input; - int temp; + int temp = 0; int list_size; int top_offset; /* offset from top where menu items start */ int vert_pos; /* vertical position */ @@ -3356,10 +3388,7 @@ struct menu_entries menu_list[]; wmove(temp_win, (counter + top_offset - off_start), 3); wrefresh(temp_win); - in = wgetch(temp_win); - input = in; - if (input == -1) - exit(0); + input = wgetch(temp_win); if (((tolower(input) >= 'a') && (tolower(input) <= 'z')) || ((input >= '0') && (input <= '9'))) @@ -3602,8 +3631,6 @@ help() wprintw(com_win, press_any_key_msg); wrefresh(com_win); counter = wgetch(com_win); - if (counter == -1) - exit(0); werase(com_win); wmove(com_win, 0, 0); werase(help_win); @@ -3631,11 +3658,6 @@ paint_info_win() else if (info_type == COMMANDS) waddstr(info_win, command_strings[counter]); } - wmove(info_win, 5, 0); - if (!nohighlight) - wstandout(info_win); - waddstr(info_win, "==============================================================================="); - wstandend(info_win); wrefresh(info_win); } @@ -3669,12 +3691,15 @@ create_info_window() idlok(text_win, TRUE); werase(text_win); info_window = TRUE; - info_win = newwin(6, COLS, 0, 0); + info_win = newwin(5, COLS, 0, 0); werase(info_win); info_type = CONTROL_KEYS; midscreen(min(scr_vert, last_line), point); clearok(info_win, TRUE); paint_info_win(); + count_win = newwin(1, COLS, 5, 0); + leaveok(count_win, TRUE); + wrefresh(count_win); wrefresh(text_win); clear_com_win = TRUE; } @@ -3705,7 +3730,7 @@ int arg; { string = get_string(file_write_prompt_str, TRUE); tmp_file = resolve_name(string); - write_file(tmp_file); + write_file(tmp_file, 1); if (tmp_file != string) free(tmp_file); free(string); @@ -3742,7 +3767,7 @@ int arg; string = tmp_file; } } - if (write_file(string)) + if (write_file(string, 1)) { in_file_name = string; text_changes = FALSE; @@ -4051,7 +4076,7 @@ Format() /* format the paragraph accordi } unsigned char *init_name[3] = { - "/usr/local/lib/init.ee", + "/usr/share/misc/init.ee", NULL, ".init.ee" }; @@ -4068,6 +4093,8 @@ ee_init() /* check for init file and rea int temp_int; string = getenv("HOME"); + if (!string) + string = "/root"; /* Set to reasonable default so we don't crash */ str1 = home = malloc(strlen(string)+10); strcpy(home, string); strcat(home, "/.init.ee"); @@ -4353,17 +4380,25 @@ spell_op() /* check spelling of words in void ispell_op() { - char name[128]; + char template[128], *name; char string[256]; - int pid; + int fd; if (restrict_mode()) { return; } - pid = getpid(); - sprintf(name, "/tmp/ee.%d", pid); - if (write_file(name)) + (void)sprintf(template, "/tmp/ee.XXXXXXXX"); + name = mktemp(&template[0]); + fd = open(name, O_CREAT | O_EXCL | O_RDWR, 0600); + if (fd < 0) { + wmove(com_win, 0, 0); + wprintw(com_win, create_file_fail_msg, name); + wrefresh(com_win); + return; + } + close(fd); + if (write_file(name, 0)) { sprintf(string, "ispell %s", name); sh_command(string); @@ -4961,6 +4996,19 @@ char *list[]; return(num_match); } +void +renumber_lines(firstline, startnumber) +struct text *firstline; +int startnumber; +{ + struct text *lineptr; + int i; + + i = startnumber; + for (lineptr = firstline; lineptr != NULL; lineptr = lineptr->next_line) + lineptr->line_number = i++; +} + #ifndef NO_CATGETS /* | Get the catalog entry, and if it got it from the catalog, @@ -5001,7 +5049,7 @@ strings_init() #ifndef NO_CATGETS setlocale(LC_ALL, ""); - catalog = catopen("ee", 0); + catalog = catopen("ee", NL_CAT_LOCALE); #endif /* NO_CATGETS */ modes_menu[0].item_string = catgetlocal( 1, "modes menu"); @@ -5047,7 +5095,7 @@ strings_init() help_text[6] = catgetlocal( 41, "^f undelete char ^n next page ^x search "); help_text[7] = catgetlocal( 42, "^g begin of line ^o end of line ^y delete line "); help_text[8] = catgetlocal( 43, "^h backspace ^p prev page ^z undelete line "); - help_text[9] = catgetlocal( 44, "^[ (escape) menu "); + help_text[9] = catgetlocal( 44, "^[ (escape) menu ESC-Enter: exit ee "); help_text[10] = catgetlocal( 45, " "); help_text[11] = catgetlocal( 46, "Commands: "); help_text[12] = catgetlocal( 47, "help : get this info file : print file name "); @@ -5064,7 +5112,7 @@ strings_init() control_keys[1] = catgetlocal( 58, "^a ascii code ^x search ^z undelete line ^d down ^n next page "); control_keys[2] = catgetlocal( 59, "^b bottom of text ^g begin of line ^w delete word ^l left "); control_keys[3] = catgetlocal( 60, "^t top of text ^o end of line ^v undelete word ^r right "); - control_keys[4] = catgetlocal( 61, "^c command ^k delete char ^f undelete char "); + control_keys[4] = catgetlocal( 61, "^c command ^k delete char ^f undelete char ESC-Enter: exit ee "); command_strings[0] = catgetlocal( 62, "help : get help info |file : print file name |line : print line # "); command_strings[1] = catgetlocal( 63, "read : read a file |char : ascii code of char |0-9 : go to line \"#\""); command_strings[2] = catgetlocal( 64, "write: write a file |case : case sensitive search |exit : leave and save "); @@ -5106,7 +5154,7 @@ strings_init() searching_msg = catgetlocal( 100, " ...searching"); str_not_found_msg = catgetlocal( 101, "string \"%s\" not found"); search_prompt_str = catgetlocal( 102, "search for: "); - exec_err_msg = catgetlocal( 103, "could not exec %s\n"); + exec_err_msg = catgetlocal( 103, "could not exec %s"); continue_msg = catgetlocal( 104, "press return to continue "); menu_cancel_msg = catgetlocal( 105, "press Esc to cancel"); menu_size_err_msg = catgetlocal( 106, "menu too large for window"); @@ -5154,8 +5202,8 @@ strings_init() mode_strings[7] = catgetlocal( 145, "emacs key bindings "); emacs_help_text[0] = help_text[0]; emacs_help_text[1] = catgetlocal( 146, "^a beginning of line ^i tab ^r restore word "); - emacs_help_text[2] = catgetlocal( 147, "^b back 1 char ^j undel char ^t top of text "); - emacs_help_text[3] = catgetlocal( 148, "^c command ^k delete line ^u bottom of text "); + emacs_help_text[2] = catgetlocal( 147, "^b back 1 char ^j undel char ^t begin of file "); + emacs_help_text[3] = catgetlocal( 148, "^c command ^k delete line ^u end of file "); emacs_help_text[4] = catgetlocal( 149, "^d delete char ^l undelete line ^v next page "); emacs_help_text[5] = catgetlocal( 150, "^e end of line ^m newline ^w delete word "); emacs_help_text[6] = catgetlocal( 151, "^f forward 1 char ^n next line ^x search "); @@ -5174,11 +5222,11 @@ strings_init() emacs_help_text[19] = help_text[19]; emacs_help_text[20] = help_text[20]; emacs_help_text[21] = help_text[21]; - emacs_control_keys[0] = catgetlocal( 154, "^[ (escape) menu ^y search prompt ^k delete line ^p prev li ^g prev page"); - emacs_control_keys[1] = catgetlocal( 155, "^o ascii code ^x search ^l undelete line ^n next li ^v next page"); - emacs_control_keys[2] = catgetlocal( 156, "^u end of file ^a begin of line ^w delete word ^b back 1 char "); - emacs_control_keys[3] = catgetlocal( 157, "^t top of text ^e end of line ^r restore word ^f forward 1 char "); - emacs_control_keys[4] = catgetlocal( 158, "^c command ^d delete char ^j undelete char ^z next word "); + emacs_control_keys[0] = catgetlocal( 154, "^[ (escape) menu ^y search prompt ^k delete line ^p prev line ^g prev page"); + emacs_control_keys[1] = catgetlocal( 155, "^o ascii code ^x search ^l undelete line ^n next line ^v next page"); + emacs_control_keys[2] = catgetlocal( 156, "^u end of file ^a begin of line ^w delete word ^b back char ^z next word"); + emacs_control_keys[3] = catgetlocal( 157, "^t begin of file ^e end of line ^r restore word ^f forward char "); + emacs_control_keys[4] = catgetlocal( 158, "^c command ^d delete char ^j undelete char ESC-Enter: exit"); EMACS_string = catgetlocal( 159, "EMACS"); NOEMACS_string = catgetlocal( 160, "NOEMACS"); usage4 = catgetlocal( 161, " +# put cursor at line #\n"); Modified: head/contrib/ee/ee.msg ============================================================================== --- head/contrib/ee/ee.msg Tue May 26 20:57:19 2009 (r192855) +++ head/contrib/ee/ee.msg Tue May 26 21:06:51 2009 (r192856) @@ -4,6 +4,7 @@ $ $ For ee patchlevel 3 $ $ $Header: /home/hugh/sources/old_ae/RCS/ee.msg,v 1.8 1996/11/30 03:23:40 hugh Exp $ +$ $FreeBSD$ $ $ $set 1 @@ -51,7 +52,7 @@ $quote " 41 "^f undelete char ^n next page ^x search " 42 "^g begin of line ^o end of line ^y delete line " 43 "^h backspace ^p prev page ^z undelete line " -44 "^[ (escape) menu " +44 "^[ (escape) menu ESC-Enter: exit ee " 45 " " 46 "Commands: " 47 "help : get this info file : print file name " @@ -68,7 +69,7 @@ $quote " 58 "^a ascii code ^x search ^z undelete line ^d down ^n next page " 59 "^b bottom of text ^g begin of line ^w delete word ^l left " 60 "^t top of text ^o end of line ^v undelete word ^r right " -61 "^c command ^k delete char ^f undelete char " +61 "^c command ^k delete char ^f undelete char ESC-Enter: exit ee " 62 "help : get help info |file : print file name |line : print line # " 63 "read : read a file |char : ascii code of char |0-9 : go to line \"#\"" 64 "write: write a file |case : case sensitive search |exit : leave and save " @@ -110,7 +111,7 @@ $quote " 100 " ...searching" 101 "string \"%s\" not found" 102 "search for: " -103 "could not exec %s\n" +103 "could not exec %s" 104 "press return to continue " 105 "press Esc to cancel" 106 "menu too large for window" @@ -154,8 +155,8 @@ $quote " 144 "NOEIGHTBIT" 145 "emacs key bindings " 146 "^a beginning of line ^i tab ^r restore word " -147 "^b back 1 char ^j undel char ^t top of text " -148 "^c command ^k delete line ^u bottom of text " +147 "^b back 1 char ^j undel char ^t begin of file " +148 "^c command ^k delete line ^u end of file " 149 "^d delete char ^l undelete line ^v next page " 150 "^e end of line ^m newline ^w delete word " 151 "^f forward 1 char ^n next line ^x search " @@ -164,7 +165,7 @@ $quote " 154 "^[ (escape) menu ^y search prompt ^k delete line ^p prev li ^g prev page" 155 "^o ascii code ^x search ^l undelete line ^n next li ^v next page" 156 "^u end of file ^a begin of line ^w delete word ^b back 1 char " -157 "^t top of text ^e end of line ^r restore word ^f forward 1 char " +157 "^t begin of file ^e end of line ^r restore word ^f forward 1 char " 158 "^c command ^d delete char ^j undelete char ^z next word " 159 "EMACS" 160 "NOEMACS" Modified: head/usr.bin/ee/Makefile ============================================================================== --- head/usr.bin/ee/Makefile Tue May 26 20:57:19 2009 (r192855) +++ head/usr.bin/ee/Makefile Tue May 26 21:06:51 2009 (r192856) @@ -1,5 +1,7 @@ # $FreeBSD$ +.PATH: ${.CURDIR}/../../contrib/ee + CFLAGS+= -DCAP -DHAS_NCURSES -DHAS_UNISTD -DHAS_STDARG -DHAS_STDLIB \ -DHAS_CTYPE -DHAS_SYS_IOCTL -DHAS_SYS_WAIT -DSLCT_HDR @@ -21,7 +23,11 @@ NLSLINKS_de_DE.ISO8859-1= de_AT.ISO8859- NLSSRCFILES=ee.msg .for lang in ${NLS} +. if exists(${.CURDIR}/nls/${lang}/ee.msg) NLSSRCDIR_${lang}= ${.CURDIR}/nls/${lang} +. else +NLSSRCDIR_${lang}= ${.CURDIR}/../../contrib/ee +. endif .endfor .include From owner-svn-src-head@FreeBSD.ORG Tue May 26 21:20:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E0A01065677; Tue, 26 May 2009 21:20:42 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8BF9F8FC29; Tue, 26 May 2009 21:20:42 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QLKg9o074041; Tue, 26 May 2009 21:20:42 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QLKgEe074039; Tue, 26 May 2009 21:20:42 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200905262120.n4QLKgEe074039@svn.freebsd.org> From: Andrew Thompson Date: Tue, 26 May 2009 21:20:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192857 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 21:20:43 -0000 Author: thompsa Date: Tue May 26 21:20:42 2009 New Revision: 192857 URL: http://svn.freebsd.org/changeset/base/192857 Log: Unifdef __NetBSD__ here, the usb stack as a whole doesnt support NetBSD and it obsfucates the code. Modified: head/sys/dev/usb/usb_busdma.c head/sys/dev/usb/usb_busdma.h Modified: head/sys/dev/usb/usb_busdma.c ============================================================================== --- head/sys/dev/usb/usb_busdma.c Tue May 26 21:06:51 2009 (r192856) +++ head/sys/dev/usb/usb_busdma.c Tue May 26 21:20:42 2009 (r192857) @@ -44,9 +44,6 @@ #if USB_HAVE_BUSDMA static void usb2_dma_tag_create(struct usb2_dma_tag *, usb2_size_t, usb2_size_t); static void usb2_dma_tag_destroy(struct usb2_dma_tag *); -#endif - -#if USB_HAVE_BUSDMA && defined(__FreeBSD__) static void usb2_dma_lock_cb(void *, bus_dma_lock_op_t); static void usb2_pc_alloc_mem_cb(void *, bus_dma_segment_t *, int, int); static void usb2_pc_load_mem_cb(void *, bus_dma_segment_t *, int, int); @@ -54,11 +51,6 @@ static void usb2_pc_common_mem_cb(void * uint8_t); #endif -#if USB_HAVE_BUSDMA && defined(__NetBSD__) -static void usb2_pc_common_mem_cb(struct usb2_page_cache *, - bus_dma_segment_t *, int, int, uint8_t); -#endif - /*------------------------------------------------------------------------* * usb2_get_page - lookup DMA-able memory for the given offset * @@ -186,11 +178,7 @@ struct usb2_m_copy_in_arg { }; static int -#ifdef __FreeBSD__ usb2_m_copy_in_cb(void *arg, void *src, uint32_t count) -#else -usb2_m_copy_in_cb(void *arg, caddr_t src, uint32_t count) -#endif { register struct usb2_m_copy_in_arg *ua = arg; @@ -325,7 +313,7 @@ usb2_bzero(struct usb2_page_cache *cache } } -#if USB_HAVE_BUSDMA && defined(__FreeBSD__) +#if USB_HAVE_BUSDMA /*------------------------------------------------------------------------* * usb2_dma_lock_cb - dummy callback @@ -740,385 +728,6 @@ usb2_pc_dmamap_destroy(struct usb2_page_ } } -#endif - -#if USB_HAVE_BUSDMA && defined(__NetBSD__) - -/*------------------------------------------------------------------------* - * usb2_dma_tag_create - allocate a DMA tag - * - * NOTE: If the "align" parameter has a value of 1 the DMA-tag will - * allow multi-segment mappings. Else all mappings are single-segment. - *------------------------------------------------------------------------*/ -static void -usb2_dma_tag_create(struct usb2_dma_tag *udt, - usb2_size_t size, usb2_size_t align) -{ - usb2_size_t nseg; - - if (align == 1) { - nseg = (2 + (size / USB_PAGE_SIZE)); - } else { - nseg = 1; - } - - udt->p_seg = malloc(nseg * sizeof(*(udt->p_seg)), - M_USB, M_WAITOK | M_ZERO); - - if (udt->p_seg == NULL) { - return; - } - udt->tag = udt->tag_parent->tag; - udt->n_seg = nseg; -} - -/*------------------------------------------------------------------------* - * usb2_dma_tag_free - free a DMA tag - *------------------------------------------------------------------------*/ -static void -usb2_dma_tag_destroy(struct usb2_dma_tag *udt) -{ - free(udt->p_seg, M_USB); -} - -/*------------------------------------------------------------------------* - * usb2_pc_common_mem_cb - BUS-DMA callback function - *------------------------------------------------------------------------*/ -static void -usb2_pc_common_mem_cb(struct usb2_page_cache *pc, bus_dma_segment_t *segs, - int nseg, int error, uint8_t isload, uint8_t dolock) -{ - struct usb2_dma_parent_tag *uptag; - struct usb2_page *pg; - usb2_size_t rem; - uint8_t ext_seg; /* extend last segment */ - - uptag = pc->tag_parent; - - if (error) { - goto done; - } - pg = pc->page_start; - pg->physaddr = segs->ds_addr & ~(USB_PAGE_SIZE - 1); - rem = segs->ds_addr & (USB_PAGE_SIZE - 1); - pc->page_offset_buf = rem; - pc->page_offset_end += rem; - if (nseg < ((pc->page_offset_end + - (USB_PAGE_SIZE - 1)) / USB_PAGE_SIZE)) { - ext_seg = 1; - } else { - ext_seg = 0; - } - nseg--; -#if (USB_DEBUG != 0) - if (rem != (USB_P2U(pc->buffer) & (USB_PAGE_SIZE - 1))) { - /* - * This check verifies that the physical address is correct: - */ - DPRINTFN(0, "Page offset was not preserved!\n"); - error = 1; - goto done; - } -#endif - while (nseg > 0) { - nseg--; - segs++; - pg++; - pg->physaddr = segs->ds_addr & ~(USB_PAGE_SIZE - 1); - } - - /* - * XXX The segments we get from BUS-DMA are not aligned, - * XXX so we need to extend the last segment if we are - * XXX unaligned and cross the segment boundary! - */ - if (ext_seg && pc->ismultiseg) { - (pg + 1)->physaddr = pg->physaddr + USB_PAGE_SIZE; - } -done: - if (dolock) - mtx_lock(uptag->mtx); - - uptag->dma_error = (error ? 1 : 0); - if (isload) { - (uptag->func) (uptag); - } - if (dolock) - mtx_unlock(uptag->mtx); -} - -/*------------------------------------------------------------------------* - * usb2_pc_alloc_mem - allocate DMA'able memory - * - * Returns: - * 0: Success - * Else: Failure - *------------------------------------------------------------------------*/ -uint8_t -usb2_pc_alloc_mem(struct usb2_page_cache *pc, struct usb2_page *pg, - usb2_size_t size, usb2_size_t align) -{ - struct usb2_dma_parent_tag *uptag; - struct usb2_dma_tag *utag; - caddr_t ptr = NULL; - bus_dmamap_t map; - int seg_count; - - uptag = pc->tag_parent; - - if (align != 1) { - /* - * The alignment must be greater or equal to the - * "size" else the object can be split between two - * memory pages and we get a problem! - */ - while (align < size) { - align *= 2; - if (align == 0) { - goto done_5; - } - } - } - /* get the correct DMA tag */ - utag = usb2_dma_tag_find(pc->tag_parent, size, align); - if (utag == NULL) { - goto done_5; - } - if (bus_dmamem_alloc(utag->tag, size, align, 0, utag->p_seg, - utag->n_seg, &seg_count, BUS_DMA_WAITOK)) { - goto done_4; - } - if (bus_dmamem_map(utag->tag, utag->p_seg, seg_count, size, - &ptr, BUS_DMA_WAITOK | BUS_DMA_COHERENT)) { - goto done_3; - } - if (bus_dmamap_create(utag->tag, size, utag->n_seg, (align == 1) ? - USB_PAGE_SIZE : size, 0, BUS_DMA_WAITOK, &map)) { - goto done_2; - } - if (bus_dmamap_load(utag->tag, map, ptr, size, NULL, - BUS_DMA_WAITOK)) { - goto done_1; - } - pc->p_seg = malloc(seg_count * sizeof(*(pc->p_seg)), - M_USB, M_WAITOK | M_ZERO); - if (pc->p_seg == NULL) { - goto done_0; - } - /* store number if actual segments used */ - pc->n_seg = seg_count; - - /* make a copy of the segments */ - bcopy(utag->p_seg, pc->p_seg, - seg_count * sizeof(*(pc->p_seg))); - - /* setup page cache */ - pc->buffer = ptr; - pc->page_start = pg; - pc->page_offset_buf = 0; - pc->page_offset_end = size; - pc->map = map; - pc->tag = utag->tag; - pc->ismultiseg = (align == 1); - - usb2_pc_common_mem_cb(pc, utag->p_seg, seg_count, 0, 0, 1); - - bzero(ptr, size); - - usb2_pc_cpu_flush(pc); - - return (0); - -done_0: - bus_dmamap_unload(utag->tag, map); -done_1: - bus_dmamap_destroy(utag->tag, map); -done_2: - bus_dmamem_unmap(utag->tag, ptr, size); -done_3: - bus_dmamem_free(utag->tag, utag->p_seg, seg_count); -done_4: - /* utag is destroyed later */ -done_5: - /* reset most of the page cache */ - pc->buffer = NULL; - pc->page_start = NULL; - pc->page_offset_buf = 0; - pc->page_offset_end = 0; - pc->map = NULL; - pc->tag = NULL; - pc->n_seg = 0; - pc->p_seg = NULL; - return (1); -} - -/*------------------------------------------------------------------------* - * usb2_pc_free_mem - free DMA memory - * - * This function is NULL safe. - *------------------------------------------------------------------------*/ -void -usb2_pc_free_mem(struct usb2_page_cache *pc) -{ - if (pc && pc->buffer) { - bus_dmamap_unload(pc->tag, pc->map); - bus_dmamap_destroy(pc->tag, pc->map); - bus_dmamem_unmap(pc->tag, pc->buffer, - pc->page_offset_end - pc->page_offset_buf); - bus_dmamem_free(pc->tag, pc->p_seg, pc->n_seg); - free(pc->p_seg, M_USB); - pc->buffer = NULL; - } -} - -/*------------------------------------------------------------------------* - * usb2_pc_load_mem - load virtual memory into DMA - * - * Return values: - * 0: Success - * Else: Error - *------------------------------------------------------------------------*/ -uint8_t -usb2_pc_load_mem(struct usb2_page_cache *pc, usb2_size_t size, uint8_t sync) -{ - int error; - - /* setup page cache */ - pc->page_offset_buf = 0; - pc->page_offset_end = size; - pc->ismultiseg = 1; - - if (size > 0) { - - /* - * We have to unload the previous loaded DMA - * pages before trying to load a new one! - */ - bus_dmamap_unload(pc->tag, pc->map); - - /* try to load memory into DMA using using no wait option */ - if (bus_dmamap_load(pc->tag, pc->map, pc->buffer, - size, NULL, BUS_DMA_NOWAIT)) { - error = ENOMEM; - } else { - error = 0; - } - - usb2_pc_common_mem_cb(pc, pc->map->dm_segs, - pc->map->dm_nsegs, error, !sync); - - if (error) { - return (1); - } - } else { - if (!sync) { - /* - * Call callback so that refcount is decremented - * properly: - */ - pc->tag_parent->dma_error = 0; - (pc->tag_parent->func) (pc->tag_parent); - } - } - return (0); -} - -/*------------------------------------------------------------------------* - * usb2_pc_cpu_invalidate - invalidate CPU cache - *------------------------------------------------------------------------*/ -void -usb2_pc_cpu_invalidate(struct usb2_page_cache *pc) -{ - usb2_size_t len; - - len = pc->page_offset_end - pc->page_offset_buf; - - if (len == 0) { - /* nothing has been loaded into this page cache */ - return; - } - bus_dmamap_sync(pc->tag, pc->map, 0, len, - BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD); -} - -/*------------------------------------------------------------------------* - * usb2_pc_cpu_flush - flush CPU cache - *------------------------------------------------------------------------*/ -void -usb2_pc_cpu_flush(struct usb2_page_cache *pc) -{ - usb2_size_t len; - - len = pc->page_offset_end - pc->page_offset_buf; - - if (len == 0) { - /* nothing has been loaded into this page cache */ - return; - } - bus_dmamap_sync(pc->tag, pc->map, 0, len, - BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); -} - -/*------------------------------------------------------------------------* - * usb2_pc_dmamap_create - create a DMA map - * - * Returns: - * 0: Success - * Else: Failure - *------------------------------------------------------------------------*/ -uint8_t -usb2_pc_dmamap_create(struct usb2_page_cache *pc, usb2_size_t size) -{ - struct usb2_xfer_root *info; - struct usb2_dma_tag *utag; - - /* get info */ - info = USB_DMATAG_TO_XROOT(pc->tag_parent); - - /* sanity check */ - if (info == NULL) { - goto error; - } - utag = usb2_dma_tag_find(pc->tag_parent, size, 1); - if (utag == NULL) { - goto error; - } - if (bus_dmamap_create(utag->tag, size, utag->n_seg, - USB_PAGE_SIZE, 0, BUS_DMA_WAITOK, &pc->map)) { - goto error; - } - pc->tag = utag->tag; - pc->p_seg = utag->p_seg; - pc->n_seg = utag->n_seg; - return 0; /* success */ - -error: - pc->map = NULL; - pc->tag = NULL; - pc->p_seg = NULL; - pc->n_seg = 0; - return 1; /* failure */ -} - -/*------------------------------------------------------------------------* - * usb2_pc_dmamap_destroy - * - * This function is NULL safe. - *------------------------------------------------------------------------*/ -void -usb2_pc_dmamap_destroy(struct usb2_page_cache *pc) -{ - if (pc && pc->tag) { - bus_dmamap_destroy(pc->tag, pc->map); - pc->tag = NULL; - pc->map = NULL; - } -} - -#endif - -#if USB_HAVE_BUSDMA - /*------------------------------------------------------------------------* * usb2_dma_tag_find - factored out code *------------------------------------------------------------------------*/ @@ -1172,10 +781,8 @@ usb2_dma_tag_setup(struct usb2_dma_paren /* something is corrupt */ return; } -#ifdef __FreeBSD__ /* initialise condition variable */ usb2_cv_init(udpt->cv, "USB DMA CV"); -#endif /* store some information */ udpt->mtx = mtx; @@ -1215,10 +822,8 @@ usb2_dma_tag_unsetup(struct usb2_dma_par } if (udpt->utag_max) { -#ifdef __FreeBSD__ /* destroy the condition variable */ usb2_cv_destroy(udpt->cv); -#endif } } Modified: head/sys/dev/usb/usb_busdma.h ============================================================================== --- head/sys/dev/usb/usb_busdma.h Tue May 26 21:06:51 2009 (r192856) +++ head/sys/dev/usb/usb_busdma.h Tue May 26 21:20:42 2009 (r192857) @@ -36,13 +36,11 @@ #define USB_PAGE_SIZE PAGE_SIZE /* use system PAGE_SIZE */ -#ifdef __FreeBSD__ #if (__FreeBSD_version >= 700020) #define USB_GET_DMA_TAG(dev) bus_get_dma_tag(dev) #else #define USB_GET_DMA_TAG(dev) NULL /* XXX */ #endif -#endif /* structure prototypes */ @@ -86,23 +84,13 @@ struct usb2_page_search { */ struct usb2_page_cache { -#if USB_HAVE_BUSDMA && defined(__FreeBSD__) - bus_dma_tag_t tag; - bus_dmamap_t map; -#endif -#if USB_HAVE_BUSDMA && defined(__NetBSD__) +#if USB_HAVE_BUSDMA bus_dma_tag_t tag; bus_dmamap_t map; - bus_dma_segment_t *p_seg; -#endif -#if USB_HAVE_BUSDMA struct usb2_page *page_start; #endif struct usb2_dma_parent_tag *tag_parent; /* always set */ void *buffer; /* virtual buffer pointer */ -#if USB_HAVE_BUSDMA && defined(_NetBSD__) - int n_seg; -#endif #if USB_HAVE_BUSDMA usb2_size_t page_offset_buf; usb2_size_t page_offset_end; @@ -118,9 +106,7 @@ struct usb2_page_cache { */ #if USB_HAVE_BUSDMA struct usb2_dma_parent_tag { -#if defined(__FreeBSD__) struct cv cv[1]; /* internal condition variable */ -#endif bus_dma_tag_t tag; /* always set */ struct mtx *mtx; /* private mutex, always set */ @@ -139,17 +125,10 @@ struct usb2_dma_parent_tag {}; /* empty */ #if USB_HAVE_BUSDMA struct usb2_dma_tag { -#if defined(__NetBSD__) - bus_dma_segment_t *p_seg; -#endif struct usb2_dma_parent_tag *tag_parent; bus_dma_tag_t tag; - usb2_size_t align; usb2_size_t size; -#if defined(__NetBSD__) - usb2_size_t n_seg; -#endif }; #else struct usb2_dma_tag {}; /* empty struct */ From owner-svn-src-head@FreeBSD.ORG Tue May 26 21:22:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDD2C1065745; Tue, 26 May 2009 21:22:13 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: from mail-bw0-f213.google.com (mail-bw0-f213.google.com [209.85.218.213]) by mx1.freebsd.org (Postfix) with ESMTP id 5BBA68FC0A; Tue, 26 May 2009 21:22:12 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: by bwz9 with SMTP id 9so4223120bwz.43 for ; Tue, 26 May 2009 14:22:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to:cc :content-type:content-transfer-encoding; bh=GdSmlQADYfTaogB8nUuglXpSJ7vj4GjIrGnhPeNNf/o=; b=nn4lEEJps0ZI6IG6s630Z6DY0HsNZZnkETBAXvsxFz29JaaGfVVonelkNsy9DaYome wYmz2b8slfKRPJUEIV4RRWFDvAwyHzAViLKVZcNAZN3v9QJrr/32halIEVPc565EXaGk qyTPjaugp6QYpRpxfQSOOCI2QDCOfUeTuwowM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=F9DwqovsyPMZcZyyrxI1eb9ncNS6uQVe8IztnPU39e2lcXjtNO+66NPWiVTrKerbMw ZjOjmV3M+XhaLKiUaDHX7Y5lDdV5l4eE21pzMb4wtoEF4a6IYD4P7pBD2CEpJCG3KiKl pLWZnmAjNxp1MmkdQ3uazHTP8pS9yGVj0xzKM= MIME-Version: 1.0 Sender: ivoras@gmail.com Received: by 10.204.31.78 with SMTP id x14mr8606408bkc.3.1243372930788; Tue, 26 May 2009 14:22:10 -0700 (PDT) In-Reply-To: References: <200905260822.n4Q8M0Zv051280@svn.freebsd.org> <9bbcef730905260624x289af079ue8524e821c1dc891@mail.gmail.com> <20090526200925.GA41682@lor.one-eyed-alien.net> From: Ivan Voras Date: Tue, 26 May 2009 23:21:49 +0200 X-Google-Sender-Auth: 3f7e761d137ff919 Message-ID: <9bbcef730905261421m10b4a4bfkcb17da401a237001@mail.gmail.com> To: Robert Watson Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Brooks Davis , Edward Tomasz Napierala , src-committers@freebsd.org Subject: Re: svn commit: r192800 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris/common/acl cddl/contrib/opensolaris/uts/common/fs/zfs cddl/contrib/opensolaris/u... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 21:22:14 -0000 2009/5/26 Robert Watson : > > On Tue, 26 May 2009, Brooks Davis wrote: > >>>> Cute though this BSD license variation is, I'm pretty sure it's not on >>>> the approved license list. ??Sticking to the standard license templates >>>> potentially saves significant trouble later -- especially when people >>> >>> Hmm, I'm sure that there exists some SVN magic which would allow authors >>> to enter something >>> >>> $BSDL2 Charlie Root 2008,2009$ >>> >>> and it expands to a perfect boilerplate on checkout :) >> >> Such a change would result in a repository filled without license blocks. >> This might be appropriate in a corporate setting, but isn't worth >> considering here since copies of the repo would lack correct attributions. > > I'd assumed that it was a tongue-in-cheek proposal, myself :-). > > (It is, right?) Yes, because I knew about the repository issue when I wrote it but then I started thinking about it some more. If statements like "please see LICENSE.TXT for licensing" are legally valid (and at least Sun thinks so because their standard license header basically says: "this is a CDDL-licensed file, see $url for details"), why wouldn't this be? It is of course an academic point if for nothing else then because an Open source project needs to be defensive and conservative in these matters but now I don't consider it invalid. From owner-svn-src-head@FreeBSD.ORG Tue May 26 21:29:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47071106566B; Tue, 26 May 2009 21:29:32 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 1A3168FC0C; Tue, 26 May 2009 21:29:32 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id AE5C346B09; Tue, 26 May 2009 17:29:31 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id C66FA8A028; Tue, 26 May 2009 17:29:30 -0400 (EDT) From: John Baldwin To: Dag-Erling Smorgrav Date: Tue, 26 May 2009 17:16:26 -0400 User-Agent: KMail/1.9.7 References: <200905262057.n4QKvKAA073435@svn.freebsd.org> In-Reply-To: <200905262057.n4QKvKAA073435@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200905261716.26728.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 26 May 2009 17:29:30 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192855 - head/sys/modules/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 21:29:32 -0000 On Tuesday 26 May 2009 4:57:20 pm Dag-Erling Smorgrav wrote: > Author: des > Date: Tue May 26 20:57:19 2009 > New Revision: 192855 > URL: http://svn.freebsd.org/changeset/base/192855 > > Log: > Move opt_apic.h closer to the "XXX: for assym.s" comment. > > Suggested by: jhb > MFC after: 1 week Thanks. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue May 26 21:39:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 745001065674; Tue, 26 May 2009 21:39:10 +0000 (UTC) (envelope-from sson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E6518FC16; Tue, 26 May 2009 21:39:10 +0000 (UTC) (envelope-from sson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QLdAUQ074539; Tue, 26 May 2009 21:39:10 GMT (envelope-from sson@svn.freebsd.org) Received: (from sson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QLd9pI074530; Tue, 26 May 2009 21:39:09 GMT (envelope-from sson@svn.freebsd.org) Message-Id: <200905262139.n4QLd9pI074530@svn.freebsd.org> From: Stacey Son Date: Tue, 26 May 2009 21:39:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192859 - in head: share/man/man4 sys/conf sys/dev/ksyms sys/kern sys/modules sys/modules/ksyms sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 21:39:11 -0000 Author: sson Date: Tue May 26 21:39:09 2009 New Revision: 192859 URL: http://svn.freebsd.org/changeset/base/192859 Log: Add the ksyms(4) pseudo driver. The ksyms driver allows a process to get a quick snapshot of the kernel's symbol table including the symbols from any loaded modules (the symbols are all merged into one symbol table). Unlike like other implementations, this ksyms driver maps memory in the process memory space to store the snapshot at the time /dev/ksyms is opened. It also checks to see if the process has already a snapshot open and won't allow it to open /dev/ksyms it again until it closes first. This prevents kernel and process memory from being exhausted. Note that /dev/ksyms is used by the lockstat(1) command. Reviewed by: gallatin kib (freebsd-arch) Approved by: gnn (mentor) Added: head/share/man/man4/ksyms.4 (contents, props changed) head/sys/dev/ksyms/ head/sys/dev/ksyms/ksyms.c (contents, props changed) head/sys/modules/ksyms/ head/sys/modules/ksyms/Makefile (contents, props changed) head/sys/sys/ksyms.h (contents, props changed) Modified: head/share/man/man4/Makefile head/sys/conf/NOTES head/sys/conf/files head/sys/kern/link_elf.c head/sys/kern/link_elf_obj.c head/sys/kern/linker_if.m head/sys/modules/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Tue May 26 21:34:43 2009 (r192858) +++ head/share/man/man4/Makefile Tue May 26 21:39:09 2009 (r192859) @@ -160,6 +160,7 @@ MAN= aac.4 \ kbdmux.4 \ keyboard.4 \ kld.4 \ + ksyms.4 \ ktr.4 \ kue.4 \ lagg.4 \ Added: head/share/man/man4/ksyms.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/ksyms.4 Tue May 26 21:39:09 2009 (r192859) @@ -0,0 +1,158 @@ +.\" Copyright (c) 2008-2009 Stacey Son +.\" The Regents of the University of California. 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" 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$ +.\" +.Dd April 5, 2009 +.Dt KSYMS 4 +.Os +.Sh NAME +.Nm ksyms +.Nd kernel symbol table interface +.Sh SYNOPSIS +.Cd "device ksyms" +.Sh DESCRIPTION +The +.Pa /dev/ksyms +character device provides a read-only interface to a snapshot of the kernel +symbol table. The in-kernel symbol manager is designed to be able to handle +many types of symbols tables, however, only +.Xr elf 5 +symbol tables are supported by this device. The ELF format image contains two +sections: a symbol table and a corresponding string table. +.Bl -tag -width indent -offset indent +.It Dv Symbol Table +The SYMTAB section contains the symbol table entries present in the current +running kernel, including the symbol table entries of any loaded modules. The +symbols are ordered by the kernel module load time starting with kernel file +symbols first, followed by the first loaded module's symbols and so on. +.It Dv String Table +The STRTAB section contains the symbol name strings from the kernel and any +loaded modules that the symbol table entries reference. +.El +.Pp +Elf formated symbol table data read from the +.Pa /dev/ksyms +file represents the state of the kernel at the time when the device is opened. +Since +.Pa /dev/ksyms +has no text or data, most of the fields are initialized to NULL. +The +.Nm +driver does not block the loading or unloading of modules into the kernel +while the +.Pa /dev/ksyms +file is open but may contain stale data. +.Sh IOCTLS +The +.Xr ioctl 2 +command codes below are defined in +.Aq Pa sys/ksyms.h . +.Pp +The (third) argument to the +.Xr ioctl 2 +should be a pointer to the type indicated. +.Bl -tag -width indent -offset indent +.It Dv KIOCGSIZE (size_t) +Returns the total size of the current symbol table. +This can be used when allocating a buffer to make a copy of +the kernel symbol table. +.It Dv KIOCGADDR (void *) +Returns the address of the kernel symbol table mapped in +the process memory. +.El +.Sh FILES +.Bl -tag -width /dev/ksymsX +.It Pa /dev/ksyms +.El +.Sh ERRORS +An +.Xr open 2 +of +.Pa /dev/ksyms +will fail if: +.Bl -tag -width Er +.It Bq Er EBUSY +The device is already open. A process must close +.Pa /dev/ksyms +before it can be opened again. +.It Bq Er ENOMEM +There is a resource shortage in the kernel. +.It Bq Er ENXIO +The driver was unsuccessful in creating a snapshot of the kernel symbol +table. This may occur if the kernel was in the process of loading or +unloading a module. +.El +.Sh SEE ALSO +.Xr ioctl 2 , +.Xr nlist 3 , +.Xr elf 5 , +.Xr kldload 8 +.Sh HISTORY +A +.Nm +device exists in many different operating systems. +This implementation is similar in function to the Solaris and NetBSD +.Nm +driver. +.Pp +The +.Nm +driver first appeared in +.Fx 8.0 +to support +.Xr lockstat 1 . +.Sh BUGS +Because files can be dynamically linked into the kernel at any time the symbol +information can vary. When you open the +.Pa /dev/ksyms +file, you have access to an ELF image which represents a snapshot of the state of the kernel symbol information at that instant in time. Keeping the device open does not block the loading or unloading of kernel modules. To get a new snapshot you must close and re-open the device. +.Pp +A process is only allowed to open the +.Pa /dev/ksyms +file once at a time. The process must close the +.Pa /dev/ksyms +before it is allowed to open it again. +.Pp +The +.Nm +driver uses the calling process' memory address space to store the snapshot. +.Xr ioctl 2 +can be used to get the memory address where the symbol table is stored to +save kernel memory. +.Xr mmap 2 +may also be used but it will map it to another address. +.Sh AUTHORS +The +.Nm +driver was written by +.An Stacey Son +.Aq sson@freebsd.org . Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Tue May 26 21:34:43 2009 (r192858) +++ head/sys/conf/NOTES Tue May 26 21:39:09 2009 (r192859) @@ -1080,6 +1080,9 @@ device random # The system memory devices; /dev/mem, /dev/kmem device mem +# The kernel symbol table device; /dev/ksyms +device ksyms + # Optional character code conversion support with LIBICONV. # Each option requires their base file system and LIBICONV. options CD9660_ICONV Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue May 26 21:34:43 2009 (r192858) +++ head/sys/conf/files Tue May 26 21:39:09 2009 (r192859) @@ -1085,6 +1085,7 @@ dev/joy/joy.c optional joy dev/joy/joy_isa.c optional joy isa dev/joy/joy_pccard.c optional joy pccard dev/kbdmux/kbdmux.c optional kbdmux +dev/ksyms/ksyms.c optional ksyms dev/le/am7990.c optional le dev/le/am79900.c optional le dev/le/if_le_pci.c optional le pci Added: head/sys/dev/ksyms/ksyms.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/ksyms/ksyms.c Tue May 26 21:39:09 2009 (r192859) @@ -0,0 +1,678 @@ +/*- + * Copyright (c) 2008-2009, Stacey Son + * 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. + * + * $FreeBSD$ + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include "linker_if.h" + +#define SHDR_NULL 0 +#define SHDR_SYMTAB 1 +#define SHDR_STRTAB 2 +#define SHDR_SHSTRTAB 3 + +#define SHDR_NUM 4 + +#define STR_SYMTAB ".symtab" +#define STR_STRTAB ".strtab" +#define STR_SHSTRTAB ".shstrtab" + +#define KSYMS_DNAME "ksyms" + +static d_open_t ksyms_open; +static d_read_t ksyms_read; +static d_close_t ksyms_close; +static d_ioctl_t ksyms_ioctl; +static d_mmap_t ksyms_mmap; + +static struct cdevsw ksyms_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_PSEUDO | D_TRACKCLOSE, + .d_open = ksyms_open, + .d_close = ksyms_close, + .d_read = ksyms_read, + .d_ioctl = ksyms_ioctl, + .d_mmap = ksyms_mmap, + .d_name = KSYMS_DNAME +}; + +struct ksyms_softc { + LIST_ENTRY(ksyms_softc) sc_list; + vm_offset_t sc_uaddr; + size_t sc_usize; + pmap_t sc_pmap; + struct proc *sc_proc; +}; + +static struct mtx ksyms_mtx; +static struct cdev *ksyms_dev; +static LIST_HEAD(, ksyms_softc) ksyms_list = + LIST_HEAD_INITIALIZER(&ksyms_list); + +static const char ksyms_shstrtab[] = + "\0" STR_SYMTAB "\0" STR_STRTAB "\0" STR_SHSTRTAB "\0"; + +struct ksyms_hdr { + Elf_Ehdr kh_ehdr; + Elf_Phdr kh_txtphdr; + Elf_Phdr kh_datphdr; + Elf_Shdr kh_shdr[SHDR_NUM]; + char kh_shstrtab[sizeof(ksyms_shstrtab)]; +}; + +struct tsizes { + size_t ts_symsz; + size_t ts_strsz; +}; + +struct toffsets { + vm_offset_t to_symoff; + vm_offset_t to_stroff; + unsigned to_stridx; + size_t to_resid; +}; + +static MALLOC_DEFINE(M_KSYMS, "KSYMS", "Kernel Symbol Table"); + +/* + * Get the symbol and string table sizes for a kernel module. Add it to the + * running total. + */ +static int +ksyms_size_permod(linker_file_t lf, void *arg) +{ + struct tsizes *ts; + Elf_Sym *symtab; + caddr_t strtab; + long syms; + + ts = arg; + + syms = LINKER_SYMTAB_GET(lf, &symtab); + ts->ts_symsz += syms * sizeof(Elf_Sym); + ts->ts_strsz += LINKER_STRTAB_GET(lf, &strtab); + + return (0); +} + +/* + * For kernel module get the symbol and string table sizes, returning the + * totals in *ts. + */ +static void +ksyms_size_calc(struct tsizes *ts) +{ + ts->ts_symsz = 0; + ts->ts_strsz = 0; + + (void) linker_file_foreach(ksyms_size_permod, ts); +} + +#define KSYMS_EMIT(src, des, sz) do { \ + copyout(src, (void *)des, sz); \ + des += sz; \ + } while (0) + +#define SYMBLKSZ 256 * sizeof (Elf_Sym) + +/* + * For a kernel module, add the symbol and string tables into the + * snapshot buffer. Fix up the offsets in the tables. + */ +static int +ksyms_add(linker_file_t lf, void *arg) +{ + struct toffsets *to; + Elf_Sym *symtab, *symp; + caddr_t strtab; + long symsz; + size_t strsz, numsyms; + linker_symval_t symval; + char *buf; + int i, nsyms, len; + + to = arg; + + MOD_SLOCK; + numsyms = LINKER_SYMTAB_GET(lf, &symtab); + strsz = LINKER_STRTAB_GET(lf, &strtab); + symsz = numsyms * sizeof(Elf_Sym); + + buf = malloc(SYMBLKSZ, M_KSYMS, M_WAITOK); + + while (symsz > 0) { + len = min(SYMBLKSZ, symsz); + bcopy(symtab, buf, len); + + /* + * Fix up symbol table for kernel modules: + * string offsets need adjusted + * symbol values made absolute + */ + symp = (Elf_Sym *) buf; + nsyms = len / sizeof (Elf_Sym); + for (i = 0; i < nsyms; i++) { + symp[i].st_name += to->to_stridx; + if (lf->id > 1 && LINKER_SYMBOL_VALUES(lf, + (c_linker_sym_t) &symtab[i], &symval) == 0) { + symp[i].st_value = (uintptr_t) symval.value; + } + } + + if (len > to->to_resid) { + MOD_SUNLOCK; + free(buf, M_KSYMS); + return (ENXIO); + } else + to->to_resid -= len; + KSYMS_EMIT(buf, to->to_symoff, len); + + symtab += nsyms; + symsz -= len; + } + free(buf, M_KSYMS); + MOD_SUNLOCK; + + if (strsz > to->to_resid) + return (ENXIO); + else + to->to_resid -= strsz; + KSYMS_EMIT(strtab, to->to_stroff, strsz); + to->to_stridx += strsz; + + return (0); +} + +/* + * Create a single ELF symbol table for the kernel and kernel modules loaded + * at this time. Write this snapshot out in the process address space. Return + * 0 on success, otherwise error. + */ +static int +ksyms_snapshot(struct tsizes *ts, vm_offset_t uaddr, size_t resid) +{ + + struct ksyms_hdr *hdr; + struct toffsets to; + int error = 0; + + /* Be kernel stack friendly */ + hdr = malloc(sizeof (*hdr), M_KSYMS, M_WAITOK|M_ZERO); + + /* + * Create the ELF header. + */ + hdr->kh_ehdr.e_ident[EI_PAD] = 0; + hdr->kh_ehdr.e_ident[EI_MAG0] = ELFMAG0; + hdr->kh_ehdr.e_ident[EI_MAG1] = ELFMAG1; + hdr->kh_ehdr.e_ident[EI_MAG2] = ELFMAG2; + hdr->kh_ehdr.e_ident[EI_MAG3] = ELFMAG3; + hdr->kh_ehdr.e_ident[EI_DATA] = ELF_DATA; + hdr->kh_ehdr.e_ident[EI_OSABI] = ELFOSABI_FREEBSD; + hdr->kh_ehdr.e_ident[EI_CLASS] = ELF_CLASS; + hdr->kh_ehdr.e_ident[EI_VERSION] = EV_CURRENT; + hdr->kh_ehdr.e_ident[EI_ABIVERSION] = 0; + hdr->kh_ehdr.e_type = ET_EXEC; + hdr->kh_ehdr.e_machine = ELF_ARCH; + hdr->kh_ehdr.e_version = EV_CURRENT; + hdr->kh_ehdr.e_entry = 0; + hdr->kh_ehdr.e_phoff = offsetof(struct ksyms_hdr, kh_txtphdr); + hdr->kh_ehdr.e_shoff = offsetof(struct ksyms_hdr, kh_shdr); + hdr->kh_ehdr.e_flags = 0; + hdr->kh_ehdr.e_ehsize = sizeof(Elf_Ehdr); + hdr->kh_ehdr.e_phentsize = sizeof(Elf_Phdr); + hdr->kh_ehdr.e_phnum = 2; /* Text and Data */ + hdr->kh_ehdr.e_shentsize = sizeof(Elf_Shdr); + hdr->kh_ehdr.e_shnum = SHDR_NUM; + hdr->kh_ehdr.e_shstrndx = SHDR_SHSTRTAB; + + /* + * Add both the text and data Program headers. + */ + hdr->kh_txtphdr.p_type = PT_LOAD; + /* XXX - is there a way to put the actual .text addr/size here? */ + hdr->kh_txtphdr.p_vaddr = 0; + hdr->kh_txtphdr.p_memsz = 0; + hdr->kh_txtphdr.p_flags = PF_R | PF_X; + + hdr->kh_datphdr.p_type = PT_LOAD; + /* XXX - is there a way to put the actual .data addr/size here? */ + hdr->kh_datphdr.p_vaddr = 0; + hdr->kh_datphdr.p_memsz = 0; + hdr->kh_datphdr.p_flags = PF_R | PF_W | PF_X; + + /* + * Add the Section headers: null, symtab, strtab, shstrtab, + */ + + /* First section header - null */ + + /* Second section header - symtab */ + hdr->kh_shdr[SHDR_SYMTAB].sh_name = 1; /* String offset (skip null) */ + hdr->kh_shdr[SHDR_SYMTAB].sh_type = SHT_SYMTAB; + hdr->kh_shdr[SHDR_SYMTAB].sh_flags = 0; + hdr->kh_shdr[SHDR_SYMTAB].sh_addr = 0; + hdr->kh_shdr[SHDR_SYMTAB].sh_offset = sizeof(*hdr); + hdr->kh_shdr[SHDR_SYMTAB].sh_size = ts->ts_symsz; + hdr->kh_shdr[SHDR_SYMTAB].sh_link = SHDR_STRTAB; + hdr->kh_shdr[SHDR_SYMTAB].sh_info = ts->ts_symsz / sizeof(Elf_Sym); + hdr->kh_shdr[SHDR_SYMTAB].sh_addralign = sizeof(long); + hdr->kh_shdr[SHDR_SYMTAB].sh_entsize = sizeof(Elf_Sym); + + /* Third section header - strtab */ + hdr->kh_shdr[SHDR_STRTAB].sh_name = 1 + sizeof(STR_SYMTAB); + hdr->kh_shdr[SHDR_STRTAB].sh_type = SHT_STRTAB; + hdr->kh_shdr[SHDR_STRTAB].sh_flags = 0; + hdr->kh_shdr[SHDR_STRTAB].sh_addr = 0; + hdr->kh_shdr[SHDR_STRTAB].sh_offset = + hdr->kh_shdr[SHDR_SYMTAB].sh_offset + ts->ts_symsz; + hdr->kh_shdr[SHDR_STRTAB].sh_size = ts->ts_strsz; + hdr->kh_shdr[SHDR_STRTAB].sh_link = 0; + hdr->kh_shdr[SHDR_STRTAB].sh_info = 0; + hdr->kh_shdr[SHDR_STRTAB].sh_addralign = sizeof(char); + hdr->kh_shdr[SHDR_STRTAB].sh_entsize = 0; + + /* Fourth section - shstrtab */ + hdr->kh_shdr[SHDR_SHSTRTAB].sh_name = 1 + sizeof(STR_SYMTAB) + + sizeof(STR_STRTAB); + hdr->kh_shdr[SHDR_SHSTRTAB].sh_type = SHT_STRTAB; + hdr->kh_shdr[SHDR_SHSTRTAB].sh_flags = 0; + hdr->kh_shdr[SHDR_SHSTRTAB].sh_addr = 0; + hdr->kh_shdr[SHDR_SHSTRTAB].sh_offset = + offsetof(struct ksyms_hdr, kh_shstrtab); + hdr->kh_shdr[SHDR_SHSTRTAB].sh_size = sizeof(ksyms_shstrtab); + hdr->kh_shdr[SHDR_SHSTRTAB].sh_link = 0; + hdr->kh_shdr[SHDR_SHSTRTAB].sh_info = 0; + hdr->kh_shdr[SHDR_SHSTRTAB].sh_addralign = 0 /* sizeof(char) */; + hdr->kh_shdr[SHDR_SHSTRTAB].sh_entsize = 0; + + /* Copy shstrtab into the header */ + bcopy(ksyms_shstrtab, hdr->kh_shstrtab, sizeof(ksyms_shstrtab)); + + to.to_symoff = uaddr + hdr->kh_shdr[SHDR_SYMTAB].sh_offset; + to.to_stroff = uaddr + hdr->kh_shdr[SHDR_STRTAB].sh_offset; + to.to_stridx = 0; + if (sizeof(struct ksyms_hdr) > resid) { + free(hdr, M_KSYMS); + return (ENXIO); + } + to.to_resid = resid - sizeof(struct ksyms_hdr); + + /* Emit Header */ + copyout(hdr, (void *)uaddr, sizeof(struct ksyms_hdr)); + + free(hdr, M_KSYMS); + + /* Add symbol and string tables for each kernelmodule */ + error = linker_file_foreach(ksyms_add, &to); + + if (to.to_resid != 0) + return (ENXIO); + + return (error); +} + +/* + * Map some anonymous memory in user space of size sz, rounded up to the page + * boundary. + */ +static int +ksyms_map(struct thread *td, vm_offset_t *addr, size_t sz) +{ + struct vmspace *vms = td->td_proc->p_vmspace; + int error; + vm_size_t size; + + + /* + * Map somewhere after heap in process memory. + */ + PROC_LOCK(td->td_proc); + *addr = round_page((vm_offset_t)vms->vm_daddr + + lim_max(td->td_proc, RLIMIT_DATA)); + PROC_UNLOCK(td->td_proc); + + /* round size up to page boundry */ + size = (vm_size_t) round_page(sz); + + error = vm_mmap(&vms->vm_map, addr, size, PROT_READ | PROT_WRITE, + VM_PROT_ALL, MAP_PRIVATE | MAP_ANON, OBJT_DEFAULT, NULL, 0); + + return (error); +} + +/* + * Unmap memory in user space. + */ +static int +ksyms_unmap(struct thread *td, vm_offset_t addr, size_t sz) +{ + vm_map_t map; + int error; + vm_size_t size; + + map = &td->td_proc->p_vmspace->vm_map; + + size = (vm_size_t) round_page(sz); + + /* check for address wrap-around */ + if (addr + size < addr || addr < vm_map_min(map) || + addr + size > vm_map_max(map)) + return (EINVAL); + + vm_map_lock(map); + /* make sure the pages are mapped */ + if (!vm_map_check_protection(map, addr, addr + size, VM_PROT_NONE)) { + vm_map_unlock(map); + return (EINVAL); + } + + error = vm_map_delete(map, addr, addr + size); + vm_map_unlock(map); + + return (error); +} + +static void +ksyms_cdevpriv_dtr(void *data) +{ + struct ksyms_softc *sc; + + sc = (struct ksyms_softc *)data; + + mtx_lock(&ksyms_mtx); + LIST_REMOVE(sc, sc_list); + mtx_unlock(&ksyms_mtx); + free(sc, M_KSYMS); +} + +/* ARGSUSED */ +static int +ksyms_open(struct cdev *dev, int flags, int fmt __unused, struct thread *td) +{ + struct tsizes ts; + size_t total_elf_sz; + int error, try; + struct ksyms_softc *sc; + + /* + * Limit one open() per process. The process must close() + * before open()'ing again. + */ + mtx_lock(&ksyms_mtx); + LIST_FOREACH(sc, &ksyms_list, sc_list) { + if (sc->sc_proc == td->td_proc) { + mtx_unlock(&ksyms_mtx); + return (EBUSY); + } + } + + sc = (struct ksyms_softc *) malloc(sizeof (*sc), M_KSYMS, + M_NOWAIT|M_ZERO); + + if (sc == NULL) { + mtx_unlock(&ksyms_mtx); + return (ENOMEM); + } + sc->sc_proc = td->td_proc; + sc->sc_pmap = &td->td_proc->p_vmspace->vm_pmap; + LIST_INSERT_HEAD(&ksyms_list, sc, sc_list); + mtx_unlock(&ksyms_mtx); + + error = devfs_set_cdevpriv(sc, ksyms_cdevpriv_dtr); + if (error) + goto failed; + + /* + * MOD_SLOCK doesn't work here (because of a lock reversal with + * KLD_SLOCK). Therefore, simply try upto 3 times to get a "clean" + * snapshot of the kernel symbol table. This should work fine in the + * rare case of a kernel module being loaded/unloaded at the same + * time. + */ + for(try = 0; try < 3; try++) { + /* + * Map a buffer in the calling process memory space and + * create a snapshot of the kernel symbol table in it. + */ + + /* Compute the size of buffer needed. */ + ksyms_size_calc(&ts); + total_elf_sz = sizeof(struct ksyms_hdr) + ts.ts_symsz + + ts.ts_strsz; + + error = ksyms_map(td, &(sc->sc_uaddr), + (vm_size_t) total_elf_sz); + if (error) + break; + sc->sc_usize = total_elf_sz; + + error = ksyms_snapshot(&ts, sc->sc_uaddr, total_elf_sz); + if (!error) { + /* Successful Snapshot */ + return (0); + } + + /* Snapshot failed, unmap the memory and try again */ + (void) ksyms_unmap(td, sc->sc_uaddr, sc->sc_usize); + } + +failed: + ksyms_cdevpriv_dtr(sc); + return (error); +} + +/* ARGSUSED */ +static int +ksyms_read(struct cdev *dev, struct uio *uio, int flags __unused) +{ + int error; + size_t len, sz; + struct ksyms_softc *sc; + off_t off; + char *buf; + vm_size_t ubase; + + error = devfs_get_cdevpriv((void **)&sc); + if (error) + return (error); + + off = uio->uio_offset; + len = uio->uio_resid; + + if (off < 0 || off > sc->sc_usize) + return (EFAULT); + + if (len > (sc->sc_usize - off)) + len = sc->sc_usize - off; + + if (len == 0) + return (0); + + /* + * Since the snapshot buffer is in the user space we have to copy it + * in to the kernel and then back out. The extra copy saves valuable + * kernel memory. + */ + buf = malloc(PAGE_SIZE, M_KSYMS, M_WAITOK); + ubase = sc->sc_uaddr + off; + + while (len) { + + sz = min(PAGE_SIZE, len); + if (copyin((void *)ubase, buf, sz)) + error = EFAULT; + else + error = uiomove(buf, sz, uio); + + if (error) + break; + + len -= sz; + ubase += sz; + } + free(buf, M_KSYMS); + + return (error); +} + +/* ARGSUSED */ +static int +ksyms_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int32_t flag __unused, + d_thread_t *td __unused) +{ + int error = 0; + struct ksyms_softc *sc; + + error = devfs_get_cdevpriv((void **)&sc); + if (error) + return (error); + + switch (cmd) { + case KIOCGSIZE: + /* + * Return the size (in bytes) of the symbol table + * snapshot. + */ + *(size_t *)data = sc->sc_usize; + break; + + case KIOCGADDR: + /* + * Return the address of the symbol table snapshot. + * XXX - compat32 version of this? + */ + *(void **)data = (void *)sc->sc_uaddr; + break; + + default: + error = ENOTTY; + break; + } + + return (error); +} + +/* ARGUSED */ +static int +ksyms_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, + int prot __unused) +{ + struct ksyms_softc *sc; + int error; + + error = devfs_get_cdevpriv((void **)&sc); + if (error) + return (error); + + /* + * XXX mmap() will actually map the symbol table into the process + * address space again. + */ + if (offset > round_page(sc->sc_usize) || + (*paddr = pmap_extract(sc->sc_pmap, + (vm_offset_t)sc->sc_uaddr + offset)) == 0) + return (-1); + + return (0); +} + +/* ARGUSED */ +static int +ksyms_close(struct cdev *dev, int flags __unused, int fmt __unused, + struct thread *td) +{ + int error = 0; + struct ksyms_softc *sc; + + error = devfs_get_cdevpriv((void **)&sc); + if (error) + return (error); + + /* Unmap the buffer from the process address space. */ + error = ksyms_unmap(td, sc->sc_uaddr, sc->sc_usize); + + devfs_clear_cdevpriv(); + + return (error); +} + +/* ARGSUSED */ +static int +ksyms_modevent(module_t mod __unused, int type, void *data __unused) +{ + int error = 0; + + switch (type) { + case MOD_LOAD: + mtx_init(&ksyms_mtx, "KSyms mtx", NULL, MTX_DEF); + ksyms_dev = make_dev(&ksyms_cdevsw, 0, UID_ROOT, GID_WHEEL, + 0444, KSYMS_DNAME); + break; + + case MOD_UNLOAD: + if (!LIST_EMPTY(&ksyms_list)) + return (EBUSY); + destroy_dev(ksyms_dev); + mtx_destroy(&ksyms_mtx); + break; + + case MOD_SHUTDOWN: + break; + + default: + error = EOPNOTSUPP; + break; + } + return (error); +} + +DEV_MODULE(ksyms, ksyms_modevent, NULL); +MODULE_VERSION(ksyms, 1); Modified: head/sys/kern/link_elf.c ============================================================================== --- head/sys/kern/link_elf.c Tue May 26 21:34:43 2009 (r192858) +++ head/sys/kern/link_elf.c Tue May 26 21:39:09 2009 (r192859) @@ -137,6 +137,8 @@ static int link_elf_each_function_nameva linker_function_nameval_callback_t, void *); static void link_elf_reloc_local(linker_file_t); +static long link_elf_symtab_get(linker_file_t, const Elf_Sym **); +static long link_elf_strtab_get(linker_file_t, caddr_t *); static Elf_Addr elf_lookup(linker_file_t lf, Elf_Size symidx, int deps); static kobj_method_t link_elf_methods[] = { @@ -151,6 +153,8 @@ static kobj_method_t link_elf_methods[] KOBJMETHOD(linker_each_function_name, link_elf_each_function_name), KOBJMETHOD(linker_each_function_nameval, link_elf_each_function_nameval), KOBJMETHOD(linker_ctf_get, link_elf_ctf_get), + KOBJMETHOD(linker_symtab_get, link_elf_symtab_get), + KOBJMETHOD(linker_strtab_get, link_elf_strtab_get), { 0, 0 } }; @@ -1390,3 +1394,29 @@ link_elf_reloc_local(linker_file_t lf) } } } + +static long +link_elf_symtab_get(linker_file_t lf, const Elf_Sym **symtab) +{ + elf_file_t ef = (elf_file_t)lf; + + *symtab = ef->ddbsymtab; + + if (*symtab == NULL) + return (0); + + return (ef->ddbsymcnt); +} + +static long +link_elf_strtab_get(linker_file_t lf, caddr_t *strtab) +{ + elf_file_t ef = (elf_file_t)lf; + + *strtab = ef->ddbstrtab; + + if (*strtab == NULL) + return (0); + + return (ef->ddbstrcnt); +} Modified: head/sys/kern/link_elf_obj.c ============================================================================== --- head/sys/kern/link_elf_obj.c Tue May 26 21:34:43 2009 (r192858) +++ head/sys/kern/link_elf_obj.c Tue May 26 21:39:09 2009 (r192859) @@ -140,6 +140,8 @@ static int link_elf_each_function_nameva linker_function_nameval_callback_t, void *); static void link_elf_reloc_local(linker_file_t); +static long link_elf_symtab_get(linker_file_t, Elf_Sym **); +static long link_elf_strtab_get(linker_file_t, caddr_t *); static Elf_Addr elf_obj_lookup(linker_file_t lf, Elf_Size symidx, int deps); @@ -155,6 +157,8 @@ static kobj_method_t link_elf_methods[] KOBJMETHOD(linker_each_function_name, link_elf_each_function_name), KOBJMETHOD(linker_each_function_nameval, link_elf_each_function_nameval), KOBJMETHOD(linker_ctf_get, link_elf_ctf_get), + KOBJMETHOD(linker_symtab_get, link_elf_symtab_get), + KOBJMETHOD(linker_strtab_get, link_elf_strtab_get), { 0, 0 } }; @@ -1286,3 +1290,29 @@ link_elf_reloc_local(linker_file_t lf) } } } + +static long +link_elf_symtab_get(linker_file_t lf, Elf_Sym **symtab) +{ + elf_file_t ef = (elf_file_t)lf; + + *symtab = ef->ddbsymtab; + + if (*symtab == NULL) + return (0); + + return (ef->ddbsymcnt); +} + +static long +link_elf_strtab_get(linker_file_t lf, caddr_t *strtab) +{ + elf_file_t ef = (elf_file_t)lf; + + *strtab = ef->ddbstrtab; + + if (*strtab == NULL) + return (0); + + return (ef->ddbstrcnt); +} Modified: head/sys/kern/linker_if.m ============================================================================== --- head/sys/kern/linker_if.m Tue May 26 21:34:43 2009 (r192858) +++ head/sys/kern/linker_if.m Tue May 26 21:39:09 2009 (r192859) @@ -105,6 +105,24 @@ METHOD int ctf_get { }; # +# Get the symbol table, returning it in **symtab. Return the +# number of symbols, otherwise zero. +# +METHOD long symtab_get { + linker_file_t file; + Elf_Sym **symtab; +}; + +# +# Get the string table, returning it in *strtab. Return the +# size (in bytes) of the string table, otherwise zero. +# +METHOD long strtab_get { + linker_file_t file; + caddr_t *strtab; +}; + +# # Load a file, returning the new linker_file_t in *result. If # the class does not recognise the file type, zero should be *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue May 26 22:21:55 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CEC9106564A; Tue, 26 May 2009 22:21:55 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8ABD28FC0A; Tue, 26 May 2009 22:21:55 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QMLta3075556; Tue, 26 May 2009 22:21:55 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QMLt46075555; Tue, 26 May 2009 22:21:55 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200905262221.n4QMLt46075555@svn.freebsd.org> From: Rick Macklem Date: Tue, 26 May 2009 22:21:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192861 - in head/sys/fs: nfs nfsserver X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 22:21:56 -0000 Author: rmacklem Date: Tue May 26 22:21:53 2009 New Revision: 192861 URL: http://svn.freebsd.org/changeset/base/192861 Log: Fix the experimental nfs subsystem so that it builds with the current NFSv4 ACLs, as defined in sys/acl.h. It still needs a way to test a mount point for NFSv4 ACL support before it will work. Until then, the NFSHASNFS4ACL() macro just always returns 0. Approved by: kib (mentor) Modified: head/sys/fs/nfs/nfs_commonacl.c head/sys/fs/nfs/nfs_commonsubs.c head/sys/fs/nfs/nfsport.h head/sys/fs/nfsserver/nfs_nfsdport.c head/sys/fs/nfsserver/nfs_nfsdserv.c Modified: head/sys/fs/nfs/nfs_commonacl.c ============================================================================== --- head/sys/fs/nfs/nfs_commonacl.c Tue May 26 21:40:15 2009 (r192860) +++ head/sys/fs/nfs/nfs_commonacl.c Tue May 26 22:21:53 2009 (r192861) @@ -224,7 +224,7 @@ nfsrv_acemasktoperm(u_int32_t acetype, u } if (mask & NFSV4ACE_SEARCH) { mask &= ~NFSV4ACE_SEARCH; - perm |= ACL_SEARCH; + perm |= ACL_EXECUTE; } if (mask & NFSV4ACE_DELETECHILD) { mask &= ~NFSV4ACE_DELETECHILD; @@ -505,7 +505,7 @@ nfsrv_buildace(struct nfsrv_descript *nd acemask |= NFSV4ACE_READNAMEDATTR; if (ace->ae_perm & ACL_WRITE_NAMED_ATTRS) acemask |= NFSV4ACE_WRITENAMEDATTR; - if (ace->ae_perm & ACL_SEARCH) + if (ace->ae_perm & ACL_EXECUTE) acemask |= NFSV4ACE_SEARCH; if (ace->ae_perm & ACL_DELETE_CHILD) acemask |= NFSV4ACE_DELETECHILD; Modified: head/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- head/sys/fs/nfs/nfs_commonsubs.c Tue May 26 21:40:15 2009 (r192860) +++ head/sys/fs/nfs/nfs_commonsubs.c Tue May 26 22:21:53 2009 (r192861) @@ -1018,7 +1018,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd if (nfsrv_useacl) { NFSACL_T *naclp; - naclp = acl_alloc(); + naclp = acl_alloc(M_WAITOK); error = nfsrv_dissectacl(nd, naclp, &aceerr, &cnt, p); if (error) { @@ -1933,7 +1933,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd } else { NFSCLRNOTFILLABLE_ATTRBIT(retbitp); #ifdef NFS4_ACL_EXTATTR_NAME - naclp = acl_alloc(); + naclp = acl_alloc(M_WAITOK); #endif aclp = naclp; } Modified: head/sys/fs/nfs/nfsport.h ============================================================================== --- head/sys/fs/nfs/nfsport.h Tue May 26 21:40:15 2009 (r192860) +++ head/sys/fs/nfs/nfsport.h Tue May 26 22:21:53 2009 (r192861) @@ -71,8 +71,6 @@ #include #include #include -/* until the nfsv4 acl stuff is all committed, undef NFS4_ACL_EXTATTR_NAME */ -#undef NFS4_ACL_EXTATTR_NAME #include #include #include @@ -789,7 +787,7 @@ void newnfs_realign(struct mbuf **); #define NFSSETWRITEVERF(n) ((n)->nm_state |= NFSSTA_HASWRITEVERF) #define NFSSETHASSETFSID(n) ((n)->nm_state |= NFSSTA_HASSETFSID) #ifdef NFS4_ACL_EXTATTR_NAME -#define NFSHASNFS4ACL(m) ((m)->mnt_flag & MNT_NFS4ACLS) +#define NFSHASNFS4ACL(m) 0 #else #define NFSHASNFS4ACL(m) 0 #endif Modified: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Tue May 26 21:40:15 2009 (r192860) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Tue May 26 22:21:53 2009 (r192861) @@ -187,7 +187,11 @@ nfsvno_accchk(struct vnode *vp, u_int32_ if (vpislocked == 0) NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY, p); -#ifdef NFS4_ACL_EXTATTR_NAME +#if defined(NFS4_ACL_EXTATTR_NAME) && defined(notyet) + /* + * This function should be called once FFS has NFSv4 ACL support + * in it. + */ /* * Should the override still be applied when ACLs are enabled? */ Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdserv.c Tue May 26 21:40:15 2009 (r192860) +++ head/sys/fs/nfsserver/nfs_nfsdserv.c Tue May 26 22:21:53 2009 (r192861) @@ -237,7 +237,7 @@ nfsrvd_setattr(struct nfsrv_descript *nd return (0); } #ifdef NFS4_ACL_EXTATTR_NAME - aclp = acl_alloc(); + aclp = acl_alloc(M_WAITOK); aclp->acl_cnt = 0; #endif NFSVNO_ATTRINIT(&nva); @@ -1041,7 +1041,7 @@ nfsrvd_mknod(struct nfsrv_descript *nd, return (0); } #ifdef NFS4_ACL_EXTATTR_NAME - aclp = acl_alloc(); + aclp = acl_alloc(M_WAITOK); aclp->acl_cnt = 0; #endif @@ -2418,7 +2418,7 @@ nfsrvd_open(struct nfsrv_descript *nd, _ NFSACL_T *aclp = NULL; #ifdef NFS4_ACL_EXTATTR_NAME - aclp = acl_alloc(); + aclp = acl_alloc(M_WAITOK); aclp->acl_cnt = 0; #endif NFSZERO_ATTRBIT(&attrbits); From owner-svn-src-head@FreeBSD.ORG Tue May 26 22:33:11 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46D37106566B; Tue, 26 May 2009 22:33:11 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2A3318FC18; Tue, 26 May 2009 22:33:11 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4QMXBIq075896; Tue, 26 May 2009 22:33:11 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4QMXBZn075894; Tue, 26 May 2009 22:33:11 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <200905262233.n4QMXBZn075894@svn.freebsd.org> From: Jilles Tjoelker Date: Tue, 26 May 2009 22:33:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192862 - head/bin/test X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 22:33:11 -0000 Author: jilles Date: Tue May 26 22:33:10 2009 New Revision: 192862 URL: http://svn.freebsd.org/changeset/base/192862 Log: Fix various cases with 3 or 4 parameters in test(1) to be POSIX compliant. More precisely, this gives precedence to an interpretation not using the '(', ')', '-a' and '-o' in their special meaning, if possible. For example, it is now safe to write [ "$a" = "$b" ] and assume it compares the two strings. The man page already says that test(1) works this way, so does not need to be changed. Interpretation of input with more parameters tries a bit harder to find a valid parse in some cases. Add various additional test cases to TEST.sh. PR: standards/133369 Approved by: ed (mentor) Modified: head/bin/test/TEST.sh head/bin/test/test.c Modified: head/bin/test/TEST.sh ============================================================================== --- head/bin/test/TEST.sh Tue May 26 22:21:53 2009 (r192861) +++ head/bin/test/TEST.sh Tue May 26 22:33:10 2009 (r192862) @@ -133,5 +133,45 @@ t 0 '"a" -a ! ""' t 1 '""' t 0 '! ""' +t 0 '!' +t 0 '\(' +t 0 '\)' + +t 1 '\( = \)' +t 0 '\( != \)' +t 0 '\( ! \)' +t 0 '\( \( \)' +t 0 '\( \) \)' +t 0 '! = !' +t 1 '! != !' +t 1 '-n = \)' +t 0 '! != \)' +t 1 '! = a' +t 0 '! != -n' +t 0 '! -c /etc/passwd' + +t 0 '! \( = \)' +t 1 '! \( != \)' +t 1 '! = = =' +t 0 '! = = \)' +t 0 '! "" -o ""' +t 1 '! "x" -o ""' +t 1 '! "" -o "x"' +t 1 '! "x" -o "x"' +t 0 '\( -f /etc/passwd \)' +t 1 '\( ! = \)' +t 0 '\( ! "" \)' +t 1 '\( ! -e \)' + +t 0 '0 -eq 0 -a -d /' +t 0 '-s = "" -o "" = ""' +t 0 '"" = "" -o -s = ""' +t 1 '-s = "" -o -s = ""' +t 0 '-z x -o x = "#" -o x = x' +t 1 '-z y -o y = "#" -o y = x' +t 0 '0 -ne 0 -o ! -f /' +t 0 '1 -ne 0 -o ! -f /etc/passwd' +t 1 '0 -ne 0 -o ! -f /etc/passwd' + echo "" echo "Syntax errors: $ERROR Failed: $FAILED" Modified: head/bin/test/test.c ============================================================================== --- head/bin/test/test.c Tue May 26 22:21:53 2009 (r192861) +++ head/bin/test/test.c Tue May 26 22:33:10 2009 (r192862) @@ -163,6 +163,7 @@ struct t_op { struct t_op const *t_wp_op; int nargc; char **t_wp; +int parenlevel; static int aexpr(enum token); static int binop(void); @@ -171,7 +172,9 @@ static int filstat(char *, enum token); static int getn(const char *); static intmax_t getq(const char *); static int intcmp(const char *, const char *); -static int isoperand(void); +static int isunopoperand(void); +static int islparenoperand(void); +static int isrparenoperand(void); static int newerf(const char *, const char *); static int nexpr(enum token); static int oexpr(enum token); @@ -205,7 +208,14 @@ main(int argc, char **argv) #endif nargc = argc; t_wp = &argv[1]; - res = !oexpr(t_lex(*t_wp)); + parenlevel = 0; + if (nargc == 4 && strcmp(*t_wp, "!") == 0) { + /* Things like ! "" -o x do not fit in the normal grammar. */ + --nargc; + ++t_wp; + res = oexpr(t_lex(*t_wp)); + } else + res = !oexpr(t_lex(*t_wp)); if (--nargc > 0) syntax(*t_wp, "unexpected operator"); @@ -268,12 +278,16 @@ primary(enum token n) if (n == EOI) return 0; /* missing expression */ if (n == LPAREN) { + parenlevel++; if ((nn = t_lex(nargc > 0 ? (--nargc, *++t_wp) : NULL)) == - RPAREN) + RPAREN) { + parenlevel--; return 0; /* missing expression */ + } res = oexpr(nn); if (t_lex(nargc > 0 ? (--nargc, *++t_wp) : NULL) != RPAREN) syntax(NULL, "closing paren expected"); + parenlevel--; return res; } if (t_wp_op && t_wp_op->op_type == UNOP) { @@ -410,8 +424,10 @@ t_lex(char *s) } while (op->op_text) { if (strcmp(s, op->op_text) == 0) { - if ((op->op_type == UNOP && isoperand()) || - (op->op_num == LPAREN && nargc == 1)) + if (((op->op_type == UNOP || op->op_type == BUNOP) + && isunopoperand()) || + (op->op_num == LPAREN && islparenoperand()) || + (op->op_num == RPAREN && isrparenoperand())) break; t_wp_op = op; return op->op_num; @@ -423,7 +439,7 @@ t_lex(char *s) } static int -isoperand(void) +isunopoperand(void) { struct t_op const *op = ops; char *s; @@ -431,19 +447,53 @@ isoperand(void) if (nargc == 1) return 1; - if (nargc == 2) - return 0; s = *(t_wp + 1); + if (nargc == 2) + return parenlevel == 1 && strcmp(s, ")") == 0; t = *(t_wp + 2); while (op->op_text) { if (strcmp(s, op->op_text) == 0) return op->op_type == BINOP && - (t[0] != ')' || t[1] != '\0'); + (parenlevel == 0 || t[0] != ')' || t[1] != '\0'); + op++; + } + return 0; +} + +static int +islparenoperand(void) +{ + struct t_op const *op = ops; + char *s; + + if (nargc == 1) + return 1; + s = *(t_wp + 1); + if (nargc == 2) + return parenlevel == 1 && strcmp(s, ")") == 0; + if (nargc != 3) + return 0; + while (op->op_text) { + if (strcmp(s, op->op_text) == 0) + return op->op_type == BINOP; op++; } return 0; } +static int +isrparenoperand(void) +{ + char *s; + + if (nargc == 1) + return 0; + s = *(t_wp + 1); + if (nargc == 2) + return parenlevel == 1 && strcmp(s, ")") == 0; + return 0; +} + /* atoi with error detection */ static int getn(const char *s) From owner-svn-src-head@FreeBSD.ORG Tue May 26 22:49:43 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 708F010656FB; Tue, 26 May 2009 22:49:43 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id F1F888FC1B; Tue, 26 May 2009 22:49:42 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id A9D9A46B2E; Tue, 26 May 2009 18:49:42 -0400 (EDT) Date: Tue, 26 May 2009 23:49:42 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Stacey Son In-Reply-To: <200905262139.n4QLd9pI074530@svn.freebsd.org> Message-ID: References: <200905262139.n4QLd9pI074530@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192859 - in head: share/man/man4 sys/conf sys/dev/ksyms sys/kern sys/modules sys/modules/ksyms sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2009 22:49:44 -0000 On Tue, 26 May 2009, Stacey Son wrote: > Add the ksyms(4) pseudo driver. The ksyms driver allows a process to > get a quick snapshot of the kernel's symbol table including the symbols > from any loaded modules (the symbols are all merged into one symbol > table). Unlike like other implementations, this ksyms driver maps > memory in the process memory space to store the snapshot at the time > /dev/ksyms is opened. It also checks to see if the process has already > a snapshot open and won't allow it to open /dev/ksyms it again until it > closes first. This prevents kernel and process memory from being > exhausted. Note that /dev/ksyms is used by the lockstat(1) command. > > Reviewed by: gallatin kib (freebsd-arch) > Approved by: gnn (mentor) One downside to the once-per-process limitation is that it means a library *and* an application using it can't both use ksyms at once. Obviously, not a limitation for the current use, but if we start to grow more consumers it might become one. Robert N M Watson Computer Laboratory University of Cambridge > > Added: > head/share/man/man4/ksyms.4 (contents, props changed) > head/sys/dev/ksyms/ > head/sys/dev/ksyms/ksyms.c (contents, props changed) > head/sys/modules/ksyms/ > head/sys/modules/ksyms/Makefile (contents, props changed) > head/sys/sys/ksyms.h (contents, props changed) > Modified: > head/share/man/man4/Makefile > head/sys/conf/NOTES > head/sys/conf/files > head/sys/kern/link_elf.c > head/sys/kern/link_elf_obj.c > head/sys/kern/linker_if.m > head/sys/modules/Makefile > > Modified: head/share/man/man4/Makefile > ============================================================================== > --- head/share/man/man4/Makefile Tue May 26 21:34:43 2009 (r192858) > +++ head/share/man/man4/Makefile Tue May 26 21:39:09 2009 (r192859) > @@ -160,6 +160,7 @@ MAN= aac.4 \ > kbdmux.4 \ > keyboard.4 \ > kld.4 \ > + ksyms.4 \ > ktr.4 \ > kue.4 \ > lagg.4 \ > > Added: head/share/man/man4/ksyms.4 > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/share/man/man4/ksyms.4 Tue May 26 21:39:09 2009 (r192859) > @@ -0,0 +1,158 @@ > +.\" Copyright (c) 2008-2009 Stacey Son > +.\" The Regents of the University of California. 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. > +.\" 3. All advertising materials mentioning features or use of this software > +.\" must display the following acknowledgement: > +.\" This product includes software developed by the University of > +.\" California, Berkeley and its contributors. > +.\" 4. Neither the name of the University nor the names of its contributors > +.\" may be used to endorse or promote products derived from this software > +.\" without specific prior written permission. > +.\" > +.\" 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$ > +.\" > +.Dd April 5, 2009 > +.Dt KSYMS 4 > +.Os > +.Sh NAME > +.Nm ksyms > +.Nd kernel symbol table interface > +.Sh SYNOPSIS > +.Cd "device ksyms" > +.Sh DESCRIPTION > +The > +.Pa /dev/ksyms > +character device provides a read-only interface to a snapshot of the kernel > +symbol table. The in-kernel symbol manager is designed to be able to handle > +many types of symbols tables, however, only > +.Xr elf 5 > +symbol tables are supported by this device. The ELF format image contains two > +sections: a symbol table and a corresponding string table. > +.Bl -tag -width indent -offset indent > +.It Dv Symbol Table > +The SYMTAB section contains the symbol table entries present in the current > +running kernel, including the symbol table entries of any loaded modules. The > +symbols are ordered by the kernel module load time starting with kernel file > +symbols first, followed by the first loaded module's symbols and so on. > +.It Dv String Table > +The STRTAB section contains the symbol name strings from the kernel and any > +loaded modules that the symbol table entries reference. > +.El > +.Pp > +Elf formated symbol table data read from the > +.Pa /dev/ksyms > +file represents the state of the kernel at the time when the device is opened. > +Since > +.Pa /dev/ksyms > +has no text or data, most of the fields are initialized to NULL. > +The > +.Nm > +driver does not block the loading or unloading of modules into the kernel > +while the > +.Pa /dev/ksyms > +file is open but may contain stale data. > +.Sh IOCTLS > +The > +.Xr ioctl 2 > +command codes below are defined in > +.Aq Pa sys/ksyms.h . > +.Pp > +The (third) argument to the > +.Xr ioctl 2 > +should be a pointer to the type indicated. > +.Bl -tag -width indent -offset indent > +.It Dv KIOCGSIZE (size_t) > +Returns the total size of the current symbol table. > +This can be used when allocating a buffer to make a copy of > +the kernel symbol table. > +.It Dv KIOCGADDR (void *) > +Returns the address of the kernel symbol table mapped in > +the process memory. > +.El > +.Sh FILES > +.Bl -tag -width /dev/ksymsX > +.It Pa /dev/ksyms > +.El > +.Sh ERRORS > +An > +.Xr open 2 > +of > +.Pa /dev/ksyms > +will fail if: > +.Bl -tag -width Er > +.It Bq Er EBUSY > +The device is already open. A process must close > +.Pa /dev/ksyms > +before it can be opened again. > +.It Bq Er ENOMEM > +There is a resource shortage in the kernel. > +.It Bq Er ENXIO > +The driver was unsuccessful in creating a snapshot of the kernel symbol > +table. This may occur if the kernel was in the process of loading or > +unloading a module. > +.El > +.Sh SEE ALSO > +.Xr ioctl 2 , > +.Xr nlist 3 , > +.Xr elf 5 , > +.Xr kldload 8 > +.Sh HISTORY > +A > +.Nm > +device exists in many different operating systems. > +This implementation is similar in function to the Solaris and NetBSD > +.Nm > +driver. > +.Pp > +The > +.Nm > +driver first appeared in > +.Fx 8.0 > +to support > +.Xr lockstat 1 . > +.Sh BUGS > +Because files can be dynamically linked into the kernel at any time the symbol > +information can vary. When you open the > +.Pa /dev/ksyms > +file, you have access to an ELF image which represents a snapshot of the state of the kernel symbol information at that instant in time. Keeping the device open does not block the loading or unloading of kernel modules. To get a new snapshot you must close and re-open the device. > +.Pp > +A process is only allowed to open the > +.Pa /dev/ksyms > +file once at a time. The process must close the > +.Pa /dev/ksyms > +before it is allowed to open it again. > +.Pp > +The > +.Nm > +driver uses the calling process' memory address space to store the snapshot. > +.Xr ioctl 2 > +can be used to get the memory address where the symbol table is stored to > +save kernel memory. > +.Xr mmap 2 > +may also be used but it will map it to another address. > +.Sh AUTHORS > +The > +.Nm > +driver was written by > +.An Stacey Son > +.Aq sson@freebsd.org . > > Modified: head/sys/conf/NOTES > ============================================================================== > --- head/sys/conf/NOTES Tue May 26 21:34:43 2009 (r192858) > +++ head/sys/conf/NOTES Tue May 26 21:39:09 2009 (r192859) > @@ -1080,6 +1080,9 @@ device random > # The system memory devices; /dev/mem, /dev/kmem > device mem > > +# The kernel symbol table device; /dev/ksyms > +device ksyms > + > # Optional character code conversion support with LIBICONV. > # Each option requires their base file system and LIBICONV. > options CD9660_ICONV > > Modified: head/sys/conf/files > ============================================================================== > --- head/sys/conf/files Tue May 26 21:34:43 2009 (r192858) > +++ head/sys/conf/files Tue May 26 21:39:09 2009 (r192859) > @@ -1085,6 +1085,7 @@ dev/joy/joy.c optional joy > dev/joy/joy_isa.c optional joy isa > dev/joy/joy_pccard.c optional joy pccard > dev/kbdmux/kbdmux.c optional kbdmux > +dev/ksyms/ksyms.c optional ksyms > dev/le/am7990.c optional le > dev/le/am79900.c optional le > dev/le/if_le_pci.c optional le pci > > Added: head/sys/dev/ksyms/ksyms.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/ksyms/ksyms.c Tue May 26 21:39:09 2009 (r192859) > @@ -0,0 +1,678 @@ > +/*- > + * Copyright (c) 2008-2009, Stacey Son > + * 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. > + * > + * $FreeBSD$ > + */ > + > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > + > +#include > +#include > +#include > +#include > + > +#include "linker_if.h" > + > +#define SHDR_NULL 0 > +#define SHDR_SYMTAB 1 > +#define SHDR_STRTAB 2 > +#define SHDR_SHSTRTAB 3 > + > +#define SHDR_NUM 4 > + > +#define STR_SYMTAB ".symtab" > +#define STR_STRTAB ".strtab" > +#define STR_SHSTRTAB ".shstrtab" > + > +#define KSYMS_DNAME "ksyms" > + > +static d_open_t ksyms_open; > +static d_read_t ksyms_read; > +static d_close_t ksyms_close; > +static d_ioctl_t ksyms_ioctl; > +static d_mmap_t ksyms_mmap; > + > +static struct cdevsw ksyms_cdevsw = { > + .d_version = D_VERSION, > + .d_flags = D_PSEUDO | D_TRACKCLOSE, > + .d_open = ksyms_open, > + .d_close = ksyms_close, > + .d_read = ksyms_read, > + .d_ioctl = ksyms_ioctl, > + .d_mmap = ksyms_mmap, > + .d_name = KSYMS_DNAME > +}; > + > +struct ksyms_softc { > + LIST_ENTRY(ksyms_softc) sc_list; > + vm_offset_t sc_uaddr; > + size_t sc_usize; > + pmap_t sc_pmap; > + struct proc *sc_proc; > +}; > + > +static struct mtx ksyms_mtx; > +static struct cdev *ksyms_dev; > +static LIST_HEAD(, ksyms_softc) ksyms_list = > + LIST_HEAD_INITIALIZER(&ksyms_list); > + > +static const char ksyms_shstrtab[] = > + "\0" STR_SYMTAB "\0" STR_STRTAB "\0" STR_SHSTRTAB "\0"; > + > +struct ksyms_hdr { > + Elf_Ehdr kh_ehdr; > + Elf_Phdr kh_txtphdr; > + Elf_Phdr kh_datphdr; > + Elf_Shdr kh_shdr[SHDR_NUM]; > + char kh_shstrtab[sizeof(ksyms_shstrtab)]; > +}; > + > +struct tsizes { > + size_t ts_symsz; > + size_t ts_strsz; > +}; > + > +struct toffsets { > + vm_offset_t to_symoff; > + vm_offset_t to_stroff; > + unsigned to_stridx; > + size_t to_resid; > +}; > + > +static MALLOC_DEFINE(M_KSYMS, "KSYMS", "Kernel Symbol Table"); > + > +/* > + * Get the symbol and string table sizes for a kernel module. Add it to the > + * running total. > + */ > +static int > +ksyms_size_permod(linker_file_t lf, void *arg) > +{ > + struct tsizes *ts; > + Elf_Sym *symtab; > + caddr_t strtab; > + long syms; > + > + ts = arg; > + > + syms = LINKER_SYMTAB_GET(lf, &symtab); > + ts->ts_symsz += syms * sizeof(Elf_Sym); > + ts->ts_strsz += LINKER_STRTAB_GET(lf, &strtab); > + > + return (0); > +} > + > +/* > + * For kernel module get the symbol and string table sizes, returning the > + * totals in *ts. > + */ > +static void > +ksyms_size_calc(struct tsizes *ts) > +{ > + ts->ts_symsz = 0; > + ts->ts_strsz = 0; > + > + (void) linker_file_foreach(ksyms_size_permod, ts); > +} > + > +#define KSYMS_EMIT(src, des, sz) do { \ > + copyout(src, (void *)des, sz); \ > + des += sz; \ > + } while (0) > + > +#define SYMBLKSZ 256 * sizeof (Elf_Sym) > + > +/* > + * For a kernel module, add the symbol and string tables into the > + * snapshot buffer. Fix up the offsets in the tables. > + */ > +static int > +ksyms_add(linker_file_t lf, void *arg) > +{ > + struct toffsets *to; > + Elf_Sym *symtab, *symp; > + caddr_t strtab; > + long symsz; > + size_t strsz, numsyms; > + linker_symval_t symval; > + char *buf; > + int i, nsyms, len; > + > + to = arg; > + > + MOD_SLOCK; > + numsyms = LINKER_SYMTAB_GET(lf, &symtab); > + strsz = LINKER_STRTAB_GET(lf, &strtab); > + symsz = numsyms * sizeof(Elf_Sym); > + > + buf = malloc(SYMBLKSZ, M_KSYMS, M_WAITOK); > + > + while (symsz > 0) { > + len = min(SYMBLKSZ, symsz); > + bcopy(symtab, buf, len); > + > + /* > + * Fix up symbol table for kernel modules: > + * string offsets need adjusted > + * symbol values made absolute > + */ > + symp = (Elf_Sym *) buf; > + nsyms = len / sizeof (Elf_Sym); > + for (i = 0; i < nsyms; i++) { > + symp[i].st_name += to->to_stridx; > + if (lf->id > 1 && LINKER_SYMBOL_VALUES(lf, > + (c_linker_sym_t) &symtab[i], &symval) == 0) { > + symp[i].st_value = (uintptr_t) symval.value; > + } > + } > + > + if (len > to->to_resid) { > + MOD_SUNLOCK; > + free(buf, M_KSYMS); > + return (ENXIO); > + } else > + to->to_resid -= len; > + KSYMS_EMIT(buf, to->to_symoff, len); > + > + symtab += nsyms; > + symsz -= len; > + } > + free(buf, M_KSYMS); > + MOD_SUNLOCK; > + > + if (strsz > to->to_resid) > + return (ENXIO); > + else > + to->to_resid -= strsz; > + KSYMS_EMIT(strtab, to->to_stroff, strsz); > + to->to_stridx += strsz; > + > + return (0); > +} > + > +/* > + * Create a single ELF symbol table for the kernel and kernel modules loaded > + * at this time. Write this snapshot out in the process address space. Return > + * 0 on success, otherwise error. > + */ > +static int > +ksyms_snapshot(struct tsizes *ts, vm_offset_t uaddr, size_t resid) > +{ > + > + struct ksyms_hdr *hdr; > + struct toffsets to; > + int error = 0; > + > + /* Be kernel stack friendly */ > + hdr = malloc(sizeof (*hdr), M_KSYMS, M_WAITOK|M_ZERO); > + > + /* > + * Create the ELF header. > + */ > + hdr->kh_ehdr.e_ident[EI_PAD] = 0; > + hdr->kh_ehdr.e_ident[EI_MAG0] = ELFMAG0; > + hdr->kh_ehdr.e_ident[EI_MAG1] = ELFMAG1; > + hdr->kh_ehdr.e_ident[EI_MAG2] = ELFMAG2; > + hdr->kh_ehdr.e_ident[EI_MAG3] = ELFMAG3; > + hdr->kh_ehdr.e_ident[EI_DATA] = ELF_DATA; > + hdr->kh_ehdr.e_ident[EI_OSABI] = ELFOSABI_FREEBSD; > + hdr->kh_ehdr.e_ident[EI_CLASS] = ELF_CLASS; > + hdr->kh_ehdr.e_ident[EI_VERSION] = EV_CURRENT; > + hdr->kh_ehdr.e_ident[EI_ABIVERSION] = 0; > + hdr->kh_ehdr.e_type = ET_EXEC; > + hdr->kh_ehdr.e_machine = ELF_ARCH; > + hdr->kh_ehdr.e_version = EV_CURRENT; > + hdr->kh_ehdr.e_entry = 0; > + hdr->kh_ehdr.e_phoff = offsetof(struct ksyms_hdr, kh_txtphdr); > + hdr->kh_ehdr.e_shoff = offsetof(struct ksyms_hdr, kh_shdr); > + hdr->kh_ehdr.e_flags = 0; > + hdr->kh_ehdr.e_ehsize = sizeof(Elf_Ehdr); > + hdr->kh_ehdr.e_phentsize = sizeof(Elf_Phdr); > + hdr->kh_ehdr.e_phnum = 2; /* Text and Data */ > + hdr->kh_ehdr.e_shentsize = sizeof(Elf_Shdr); > + hdr->kh_ehdr.e_shnum = SHDR_NUM; > + hdr->kh_ehdr.e_shstrndx = SHDR_SHSTRTAB; > + > + /* > + * Add both the text and data Program headers. > + */ > + hdr->kh_txtphdr.p_type = PT_LOAD; > + /* XXX - is there a way to put the actual .text addr/size here? */ > + hdr->kh_txtphdr.p_vaddr = 0; > + hdr->kh_txtphdr.p_memsz = 0; > + hdr->kh_txtphdr.p_flags = PF_R | PF_X; > + > + hdr->kh_datphdr.p_type = PT_LOAD; > + /* XXX - is there a way to put the actual .data addr/size here? */ > + hdr->kh_datphdr.p_vaddr = 0; > + hdr->kh_datphdr.p_memsz = 0; > + hdr->kh_datphdr.p_flags = PF_R | PF_W | PF_X; > + > + /* > + * Add the Section headers: null, symtab, strtab, shstrtab, > + */ > + > + /* First section header - null */ > + > + /* Second section header - symtab */ > + hdr->kh_shdr[SHDR_SYMTAB].sh_name = 1; /* String offset (skip null) */ > + hdr->kh_shdr[SHDR_SYMTAB].sh_type = SHT_SYMTAB; > + hdr->kh_shdr[SHDR_SYMTAB].sh_flags = 0; > + hdr->kh_shdr[SHDR_SYMTAB].sh_addr = 0; > + hdr->kh_shdr[SHDR_SYMTAB].sh_offset = sizeof(*hdr); > + hdr->kh_shdr[SHDR_SYMTAB].sh_size = ts->ts_symsz; > + hdr->kh_shdr[SHDR_SYMTAB].sh_link = SHDR_STRTAB; > + hdr->kh_shdr[SHDR_SYMTAB].sh_info = ts->ts_symsz / sizeof(Elf_Sym); > + hdr->kh_shdr[SHDR_SYMTAB].sh_addralign = sizeof(long); > + hdr->kh_shdr[SHDR_SYMTAB].sh_entsize = sizeof(Elf_Sym); > + > + /* Third section header - strtab */ > + hdr->kh_shdr[SHDR_STRTAB].sh_name = 1 + sizeof(STR_SYMTAB); > + hdr->kh_shdr[SHDR_STRTAB].sh_type = SHT_STRTAB; > + hdr->kh_shdr[SHDR_STRTAB].sh_flags = 0; > + hdr->kh_shdr[SHDR_STRTAB].sh_addr = 0; > + hdr->kh_shdr[SHDR_STRTAB].sh_offset = > + hdr->kh_shdr[SHDR_SYMTAB].sh_offset + ts->ts_symsz; > + hdr->kh_shdr[SHDR_STRTAB].sh_size = ts->ts_strsz; > + hdr->kh_shdr[SHDR_STRTAB].sh_link = 0; > + hdr->kh_shdr[SHDR_STRTAB].sh_info = 0; > + hdr->kh_shdr[SHDR_STRTAB].sh_addralign = sizeof(char); > + hdr->kh_shdr[SHDR_STRTAB].sh_entsize = 0; > + > + /* Fourth section - shstrtab */ > + hdr->kh_shdr[SHDR_SHSTRTAB].sh_name = 1 + sizeof(STR_SYMTAB) + > + sizeof(STR_STRTAB); > + hdr->kh_shdr[SHDR_SHSTRTAB].sh_type = SHT_STRTAB; > + hdr->kh_shdr[SHDR_SHSTRTAB].sh_flags = 0; > + hdr->kh_shdr[SHDR_SHSTRTAB].sh_addr = 0; > + hdr->kh_shdr[SHDR_SHSTRTAB].sh_offset = > + offsetof(struct ksyms_hdr, kh_shstrtab); > + hdr->kh_shdr[SHDR_SHSTRTAB].sh_size = sizeof(ksyms_shstrtab); > + hdr->kh_shdr[SHDR_SHSTRTAB].sh_link = 0; > + hdr->kh_shdr[SHDR_SHSTRTAB].sh_info = 0; > + hdr->kh_shdr[SHDR_SHSTRTAB].sh_addralign = 0 /* sizeof(char) */; > + hdr->kh_shdr[SHDR_SHSTRTAB].sh_entsize = 0; > + > + /* Copy shstrtab into the header */ > + bcopy(ksyms_shstrtab, hdr->kh_shstrtab, sizeof(ksyms_shstrtab)); > + > + to.to_symoff = uaddr + hdr->kh_shdr[SHDR_SYMTAB].sh_offset; > + to.to_stroff = uaddr + hdr->kh_shdr[SHDR_STRTAB].sh_offset; > + to.to_stridx = 0; > + if (sizeof(struct ksyms_hdr) > resid) { > + free(hdr, M_KSYMS); > + return (ENXIO); > + } > + to.to_resid = resid - sizeof(struct ksyms_hdr); > + > + /* Emit Header */ > + copyout(hdr, (void *)uaddr, sizeof(struct ksyms_hdr)); > + > + free(hdr, M_KSYMS); > + > + /* Add symbol and string tables for each kernelmodule */ > + error = linker_file_foreach(ksyms_add, &to); > + > + if (to.to_resid != 0) > + return (ENXIO); > + > + return (error); > +} > + > +/* > + * Map some anonymous memory in user space of size sz, rounded up to the page > + * boundary. > + */ > +static int > +ksyms_map(struct thread *td, vm_offset_t *addr, size_t sz) > +{ > + struct vmspace *vms = td->td_proc->p_vmspace; > + int error; > + vm_size_t size; > + > + > + /* > + * Map somewhere after heap in process memory. > + */ > + PROC_LOCK(td->td_proc); > + *addr = round_page((vm_offset_t)vms->vm_daddr + > + lim_max(td->td_proc, RLIMIT_DATA)); > + PROC_UNLOCK(td->td_proc); > + > + /* round size up to page boundry */ > + size = (vm_size_t) round_page(sz); > + > + error = vm_mmap(&vms->vm_map, addr, size, PROT_READ | PROT_WRITE, > + VM_PROT_ALL, MAP_PRIVATE | MAP_ANON, OBJT_DEFAULT, NULL, 0); > + > + return (error); > +} > + > +/* > + * Unmap memory in user space. > + */ > +static int > +ksyms_unmap(struct thread *td, vm_offset_t addr, size_t sz) > +{ > + vm_map_t map; > + int error; > + vm_size_t size; > + > + map = &td->td_proc->p_vmspace->vm_map; > + > + size = (vm_size_t) round_page(sz); > + > + /* check for address wrap-around */ > + if (addr + size < addr || addr < vm_map_min(map) || > + addr + size > vm_map_max(map)) > + return (EINVAL); > + > + vm_map_lock(map); > + /* make sure the pages are mapped */ > + if (!vm_map_check_protection(map, addr, addr + size, VM_PROT_NONE)) { > + vm_map_unlock(map); > + return (EINVAL); > + } > + > + error = vm_map_delete(map, addr, addr + size); > + vm_map_unlock(map); > + > + return (error); > +} > + > +static void > +ksyms_cdevpriv_dtr(void *data) > +{ > + struct ksyms_softc *sc; > + > + sc = (struct ksyms_softc *)data; > + > + mtx_lock(&ksyms_mtx); > + LIST_REMOVE(sc, sc_list); > + mtx_unlock(&ksyms_mtx); > + free(sc, M_KSYMS); > +} > + > +/* ARGSUSED */ > +static int > +ksyms_open(struct cdev *dev, int flags, int fmt __unused, struct thread *td) > +{ > + struct tsizes ts; > + size_t total_elf_sz; > + int error, try; > + struct ksyms_softc *sc; > + > + /* > + * Limit one open() per process. The process must close() > + * before open()'ing again. > + */ > + mtx_lock(&ksyms_mtx); > + LIST_FOREACH(sc, &ksyms_list, sc_list) { > + if (sc->sc_proc == td->td_proc) { > + mtx_unlock(&ksyms_mtx); > + return (EBUSY); > + } > + } > + > + sc = (struct ksyms_softc *) malloc(sizeof (*sc), M_KSYMS, > + M_NOWAIT|M_ZERO); > + > + if (sc == NULL) { > + mtx_unlock(&ksyms_mtx); > + return (ENOMEM); > + } > + sc->sc_proc = td->td_proc; > + sc->sc_pmap = &td->td_proc->p_vmspace->vm_pmap; > + LIST_INSERT_HEAD(&ksyms_list, sc, sc_list); > + mtx_unlock(&ksyms_mtx); > + > + error = devfs_set_cdevpriv(sc, ksyms_cdevpriv_dtr); > + if (error) > + goto failed; > + > + /* > + * MOD_SLOCK doesn't work here (because of a lock reversal with > + * KLD_SLOCK). Therefore, simply try upto 3 times to get a "clean" > + * snapshot of the kernel symbol table. This should work fine in the > + * rare case of a kernel module being loaded/unloaded at the same > + * time. > + */ > + for(try = 0; try < 3; try++) { > + /* > + * Map a buffer in the calling process memory space and > + * create a snapshot of the kernel symbol table in it. > + */ > + > + /* Compute the size of buffer needed. */ > + ksyms_size_calc(&ts); > + total_elf_sz = sizeof(struct ksyms_hdr) + ts.ts_symsz + > + ts.ts_strsz; > + > + error = ksyms_map(td, &(sc->sc_uaddr), > + (vm_size_t) total_elf_sz); > + if (error) > + break; > + sc->sc_usize = total_elf_sz; > + > + error = ksyms_snapshot(&ts, sc->sc_uaddr, total_elf_sz); > + if (!error) { > + /* Successful Snapshot */ > + return (0); > + } > + > + /* Snapshot failed, unmap the memory and try again */ > + (void) ksyms_unmap(td, sc->sc_uaddr, sc->sc_usize); > + } > + > +failed: > + ksyms_cdevpriv_dtr(sc); > + return (error); > +} > + > +/* ARGSUSED */ > +static int > +ksyms_read(struct cdev *dev, struct uio *uio, int flags __unused) > +{ > + int error; > + size_t len, sz; > + struct ksyms_softc *sc; > + off_t off; > + char *buf; > + vm_size_t ubase; > + > + error = devfs_get_cdevpriv((void **)&sc); > + if (error) > + return (error); > + > + off = uio->uio_offset; > + len = uio->uio_resid; > + > + if (off < 0 || off > sc->sc_usize) > + return (EFAULT); > + > + if (len > (sc->sc_usize - off)) > + len = sc->sc_usize - off; > + > + if (len == 0) > + return (0); > + > + /* > + * Since the snapshot buffer is in the user space we have to copy it > + * in to the kernel and then back out. The extra copy saves valuable > + * kernel memory. > + */ > + buf = malloc(PAGE_SIZE, M_KSYMS, M_WAITOK); > + ubase = sc->sc_uaddr + off; > + > + while (len) { > + > + sz = min(PAGE_SIZE, len); > + if (copyin((void *)ubase, buf, sz)) > + error = EFAULT; > + else > + error = uiomove(buf, sz, uio); > + > + if (error) > + break; > + > + len -= sz; > + ubase += sz; > + } > + free(buf, M_KSYMS); > + > + return (error); > +} > + > +/* ARGSUSED */ > +static int > +ksyms_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int32_t flag __unused, > + d_thread_t *td __unused) > +{ > + int error = 0; > + struct ksyms_softc *sc; > + > + error = devfs_get_cdevpriv((void **)&sc); > + if (error) > + return (error); > + > + switch (cmd) { > + case KIOCGSIZE: > + /* > + * Return the size (in bytes) of the symbol table > + * snapshot. > + */ > + *(size_t *)data = sc->sc_usize; > + break; > + > + case KIOCGADDR: > + /* > + * Return the address of the symbol table snapshot. > + * XXX - compat32 version of this? > + */ > + *(void **)data = (void *)sc->sc_uaddr; > + break; > + > + default: > + error = ENOTTY; > + break; > + } > + > + return (error); > +} > + > +/* ARGUSED */ > +static int > +ksyms_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, > + int prot __unused) > +{ > + struct ksyms_softc *sc; > + int error; > + > + error = devfs_get_cdevpriv((void **)&sc); > + if (error) > + return (error); > + > + /* > + * XXX mmap() will actually map the symbol table into the process > + * address space again. > + */ > + if (offset > round_page(sc->sc_usize) || > + (*paddr = pmap_extract(sc->sc_pmap, > + (vm_offset_t)sc->sc_uaddr + offset)) == 0) > + return (-1); > + > + return (0); > +} > + > +/* ARGUSED */ > +static int > +ksyms_close(struct cdev *dev, int flags __unused, int fmt __unused, > + struct thread *td) > +{ > + int error = 0; > + struct ksyms_softc *sc; > + > + error = devfs_get_cdevpriv((void **)&sc); > + if (error) > + return (error); > + > + /* Unmap the buffer from the process address space. */ > + error = ksyms_unmap(td, sc->sc_uaddr, sc->sc_usize); > + > + devfs_clear_cdevpriv(); > + > + return (error); > +} > + > +/* ARGSUSED */ > +static int > +ksyms_modevent(module_t mod __unused, int type, void *data __unused) > +{ > + int error = 0; > + > + switch (type) { > + case MOD_LOAD: > + mtx_init(&ksyms_mtx, "KSyms mtx", NULL, MTX_DEF); > + ksyms_dev = make_dev(&ksyms_cdevsw, 0, UID_ROOT, GID_WHEEL, > + 0444, KSYMS_DNAME); > + break; > + > + case MOD_UNLOAD: > + if (!LIST_EMPTY(&ksyms_list)) > + return (EBUSY); > + destroy_dev(ksyms_dev); > + mtx_destroy(&ksyms_mtx); > + break; > + > + case MOD_SHUTDOWN: > + break; > + > + default: > + error = EOPNOTSUPP; > + break; > + } > + return (error); > +} > + > +DEV_MODULE(ksyms, ksyms_modevent, NULL); > +MODULE_VERSION(ksyms, 1); > > Modified: head/sys/kern/link_elf.c > ============================================================================== > --- head/sys/kern/link_elf.c Tue May 26 21:34:43 2009 (r192858) > +++ head/sys/kern/link_elf.c Tue May 26 21:39:09 2009 (r192859) > @@ -137,6 +137,8 @@ static int link_elf_each_function_nameva > linker_function_nameval_callback_t, > void *); > static void link_elf_reloc_local(linker_file_t); > +static long link_elf_symtab_get(linker_file_t, const Elf_Sym **); > +static long link_elf_strtab_get(linker_file_t, caddr_t *); > static Elf_Addr elf_lookup(linker_file_t lf, Elf_Size symidx, int deps); > > static kobj_method_t link_elf_methods[] = { > @@ -151,6 +153,8 @@ static kobj_method_t link_elf_methods[] > KOBJMETHOD(linker_each_function_name, link_elf_each_function_name), > KOBJMETHOD(linker_each_function_nameval, link_elf_each_function_nameval), > KOBJMETHOD(linker_ctf_get, link_elf_ctf_get), > + KOBJMETHOD(linker_symtab_get, link_elf_symtab_get), > + KOBJMETHOD(linker_strtab_get, link_elf_strtab_get), > { 0, 0 } > }; > > @@ -1390,3 +1394,29 @@ link_elf_reloc_local(linker_file_t lf) > } > } > } > + > +static long > +link_elf_symtab_get(linker_file_t lf, const Elf_Sym **symtab) > +{ > + elf_file_t ef = (elf_file_t)lf; > + > + *symtab = ef->ddbsymtab; > + > + if (*symtab == NULL) > + return (0); > + > + return (ef->ddbsymcnt); > +} > + > +static long > +link_elf_strtab_get(linker_file_t lf, caddr_t *strtab) > +{ > + elf_file_t ef = (elf_file_t)lf; > + > + *strtab = ef->ddbstrtab; > + > + if (*strtab == NULL) > + return (0); > + > + return (ef->ddbstrcnt); > +} > > Modified: head/sys/kern/link_elf_obj.c > ============================================================================== > --- head/sys/kern/link_elf_obj.c Tue May 26 21:34:43 2009 (r192858) > +++ head/sys/kern/link_elf_obj.c Tue May 26 21:39:09 2009 (r192859) > @@ -140,6 +140,8 @@ static int link_elf_each_function_nameva > linker_function_nameval_callback_t, > void *); > static void link_elf_reloc_local(linker_file_t); > +static long link_elf_symtab_get(linker_file_t, Elf_Sym **); > +static long link_elf_strtab_get(linker_file_t, caddr_t *); > > static Elf_Addr elf_obj_lookup(linker_file_t lf, Elf_Size symidx, int deps); > > @@ -155,6 +157,8 @@ static kobj_method_t link_elf_methods[] > KOBJMETHOD(linker_each_function_name, link_elf_each_function_name), > KOBJMETHOD(linker_each_function_nameval, link_elf_each_function_nameval), > KOBJMETHOD(linker_ctf_get, link_elf_ctf_get), > + KOBJMETHOD(linker_symtab_get, link_elf_symtab_get), > + KOBJMETHOD(linker_strtab_get, link_elf_strtab_get), > { 0, 0 } > }; > > @@ -1286,3 +1290,29 @@ link_elf_reloc_local(linker_file_t lf) > } > } > } > + > +static long > +link_elf_symtab_get(linker_file_t lf, Elf_Sym **symtab) > +{ > + elf_file_t ef = (elf_file_t)lf; > + > + *symtab = ef->ddbsymtab; > + > + if (*symtab == NULL) > + return (0); > + > + return (ef->ddbsymcnt); > +} > + > +static long > +link_elf_strtab_get(linker_file_t lf, caddr_t *strtab) > +{ > + elf_file_t ef = (elf_file_t)lf; > + > + *strtab = ef->ddbstrtab; > + > + if (*strtab == NULL) > + return (0); > + > + return (ef->ddbstrcnt); > +} > > Modified: head/sys/kern/linker_if.m > ============================================================================== > --- head/sys/kern/linker_if.m Tue May 26 21:34:43 2009 (r192858) > +++ head/sys/kern/linker_if.m Tue May 26 21:39:09 2009 (r192859) > @@ -105,6 +105,24 @@ METHOD int ctf_get { > }; > > # > +# Get the symbol table, returning it in **symtab. Return the > +# number of symbols, otherwise zero. > +# > +METHOD long symtab_get { > + linker_file_t file; > + Elf_Sym **symtab; > +}; > + > +# > +# Get the string table, returning it in *strtab. Return the > +# size (in bytes) of the string table, otherwise zero. > +# > +METHOD long strtab_get { > + linker_file_t file; > + caddr_t *strtab; > +}; > + > +# > # Load a file, returning the new linker_file_t in *result. If > # the class does not recognise the file type, zero should be > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > From owner-svn-src-head@FreeBSD.ORG Wed May 27 00:22:08 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 206A6106564A; Wed, 27 May 2009 00:22:08 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id B15438FC1C; Wed, 27 May 2009 00:22:07 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id n4R0JFv3088387; Tue, 26 May 2009 18:19:15 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Tue, 26 May 2009 18:19:32 -0600 (MDT) Message-Id: <20090526.181932.915721576.imp@bsdimp.com> To: ivoras@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <9bbcef730905260624x289af079ue8524e821c1dc891@mail.gmail.com> References: <200905260822.n4Q8M0Zv051280@svn.freebsd.org> <9bbcef730905260624x289af079ue8524e821c1dc891@mail.gmail.com> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=utf-8 Content-Transfer-Encoding: base64 Cc: svn-src-head@FreeBSD.org, trasz@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, rwatson@FreeBSD.org Subject: Re: svn commit: r192800 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris/common/acl cddl/contrib/opensolaris/uts/common/fs/zfs cddl/contrib/opensolaris/u... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2009 00:22:08 -0000 SW4gbWVzc2FnZTogPDliYmNlZjczMDkwNTI2MDYyNHgyODlhZjA3OXVlODUyNGU4MjFjMWRjODkx QG1haWwuZ21haWwuY29tPg0KICAgICAgICAgICAgSXZhbiBWb3JhcyA8aXZvcmFzQEZyZWVCU0Qu b3JnPiB3cml0ZXM6DQo6IDIwMDkvNS8yNiBSb2JlcnQgV2F0c29uIDxyd2F0c29uQGZyZWVic2Qu b3JnPjoNCjogPiBPbiBUdWUsIDI2IE1heSAyMDA5LCBFZHdhcmQgVG9tYXN6IE5hcGllcmFsYSB3 cm90ZToNCjogPg0KOiA+PiArLyotDQo6ID4+ICsgKiBDb3B5cmlnaHQgKGMpIDIwMDgsIDIwMDkg RWR3YXJkIFRvbWFzeiBOYXBpZXJhxYJhIDx0cmFzekBGcmVlQlNELm9yZz4NCjogPj4gKyAqIEFs bCByaWdodHMgcmVzZXJ2ZWQuDQo6ID4+ICsgKg0KOiA+PiArICogUmVkaXN0cmlidXRpb24gYW5k IHVzZSBpbiBzb3VyY2UgYW5kIGJpbmFyeSBmb3Jtcywgd2l0aCBvciB3aXRob3V0DQo6ID4+ICsg KiBtb2RpZmljYXRpb24sIGFyZSBwZXJtaXR0ZWQgcHJvdmlkZWQgdGhhdCB0aGUgZm9sbG93aW5n IGNvbmRpdGlvbnMNCjogPj4gKyAqIGFyZSBtZXQ6DQo6ID4+ICsgKiAxLiBSZWRpc3RyaWJ1dGlv bnMgb2Ygc291cmNlIGNvZGUgbXVzdCByZXRhaW4gdGhlIGFib3ZlIGNvcHlyaWdodA0KOiA+PiAr ICogwqAgwqBub3RpY2UsIHRoaXMgbGlzdCBvZiBjb25kaXRpb25zIGFuZCB0aGUgZm9sbG93aW5n IGRpc2NsYWltZXIuDQo6ID4+ICsgKiAyLiBSZWRpc3RyaWJ1dGlvbnMgaW4gYmluYXJ5IGZvcm0g bXVzdCByZXByb2R1Y2UgdGhlIGFib3ZlIGNvcHlyaWdodA0KOiA+PiArICogwqAgwqBub3RpY2Us IHRoaXMgbGlzdCBvZiBjb25kaXRpb25zIGFuZCB0aGUgZm9sbG93aW5nIGRpc2NsYWltZXIgaW4g dGhlDQo6ID4+ICsgKiDCoCDCoGRvY3VtZW50YXRpb24gYW5kL29yIG90aGVyIG1hdGVyaWFscyBw cm92aWRlZCB3aXRoIHRoZQ0KOiA+PiBkaXN0cmlidXRpb24uDQo6ID4+ICsgKg0KOiA+PiArICog QUxUSE9VR0ggVEhJUyBTT0ZUV0FSRSBJUyBNQURFIE9GIFdJTiBBTkQgU0NJRU5DRSwgSVQgSVMg UFJPVklERUQgQlkNCjogPj4gVEhFDQo6ID4NCjogPiBDdXRlIHRob3VnaCB0aGlzIEJTRCBsaWNl bnNlIHZhcmlhdGlvbiBpcywgSSdtIHByZXR0eSBzdXJlIGl0J3Mgbm90IG9uIHRoZQ0KOiA+IGFw cHJvdmVkIGxpY2Vuc2UgbGlzdC4gwqBTdGlja2luZyB0byB0aGUgc3RhbmRhcmQgbGljZW5zZSB0 ZW1wbGF0ZXMNCjogPiBwb3RlbnRpYWxseSBzYXZlcyBzaWduaWZpY2FudCB0cm91YmxlIGxhdGVy IC0tIGVzcGVjaWFsbHkgd2hlbiBwZW9wbGUNCjogDQo6IEhtbSwgSSdtIHN1cmUgdGhhdCB0aGVy ZSBleGlzdHMgc29tZSBTVk4gbWFnaWMgd2hpY2ggd291bGQgYWxsb3cNCjogYXV0aG9ycyB0byBl bnRlciBzb21ldGhpbmcNCjogDQo6ICRCU0RMMiBDaGFybGllIFJvb3QgMjAwOCwyMDA5JA0KOiAN CjogYW5kIGl0IGV4cGFuZHMgdG8gYSBwZXJmZWN0IGJvaWxlcnBsYXRlIG9uIGNoZWNrb3V0IDop DQoNClllcywgd2hpbGUgcG9zc2libGUsIEknZCBhcmd1ZSBhZ2FpbnN0IGl0LiAgV2l0aCBleHBs aWNpdCBib2lsZXJwbGF0ZQ0KYWRkZWQgYnkgdGhlIGF1dGhvciwgaXQgaXMgY2xlYXIgd2hhdCB0 aGUgYXV0aG9yJ3MgaW50ZW50aW9ucyBhcmUuDQpUaGUgYWJvdmUgbWFjcm8sIGl0IGNvdWxkIGJl IGFyZ3VlZCwgbWF5IG5vdCBiZSB3ZWxsIHVuZGVyc3Rvb2QgZW5vdWdoDQpieSBldmVyeW9uZSB0 aGF0IGEgY2FzZSBjb3VsZCBiZSBtYWRlIHRoYXQgaXQgaXNuJ3QgYSB2YWxpZCBsaWNlbnNlDQpn cmFudC4uLg0KDQpXYXJuZXINCg== From owner-svn-src-head@FreeBSD.ORG Wed May 27 00:32:49 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98BD8106564A; Wed, 27 May 2009 00:32:49 +0000 (UTC) (envelope-from sson@freebsd.org) Received: from www.son.org (son.org [199.239.233.23]) by mx1.freebsd.org (Postfix) with ESMTP id 561978FC14; Wed, 27 May 2009 00:32:49 +0000 (UTC) (envelope-from sson@freebsd.org) Received: from NextStepNG.son.org (adsl-76-203-228-11.dsl.rcsntx.sbcglobal.net [76.203.228.11]) (authenticated bits=0) by www.son.org (8.13.6.20060614/8.13.6) with ESMTP id n4R0Im62021301; Tue, 26 May 2009 19:18:48 -0500 (CDT) Message-ID: <4A1C86E7.5060104@freebsd.org> Date: Tue, 26 May 2009 19:18:47 -0500 From: Stacey Son User-Agent: Thunderbird 2.0.0.21 (Macintosh/20090302) MIME-Version: 1.0 To: Robert Watson References: <200905262139.n4QLd9pI074530@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192859 - in head: share/man/man4 sys/conf sys/dev/ksyms sys/kern sys/modules sys/modules/ksyms sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2009 00:32:50 -0000 Robert Watson wrote: > On Tue, 26 May 2009, Stacey Son wrote: > >> Add the ksyms(4) pseudo driver. The ksyms driver allows a process to >> get a quick snapshot of the kernel's symbol table including the symbols >> from any loaded modules (the symbols are all merged into one symbol >> table). Unlike like other implementations, this ksyms driver maps >> memory in the process memory space to store the snapshot at the time >> /dev/ksyms is opened. It also checks to see if the process has already >> a snapshot open and won't allow it to open /dev/ksyms it again until it >> closes first. This prevents kernel and process memory from being >> exhausted. Note that /dev/ksyms is used by the lockstat(1) command. >> >> Reviewed by: gallatin kib (freebsd-arch) >> Approved by: gnn (mentor) > > One downside to the once-per-process limitation is that it means a > library *and* an application using it can't both use ksyms at once. > Obviously, not a limitation for the current use, but if we start to > grow more consumers it might become one. Yes, true. One solution may be to allow it to be opened again by the same process but simply use the same memory mapping and keep a reference count. -stacey. From owner-svn-src-head@FreeBSD.ORG Wed May 27 00:48:24 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D5BE6106566B; Wed, 27 May 2009 00:48:24 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 8F23F8FC15; Wed, 27 May 2009 00:48:24 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id n4R0l5lS088770; Tue, 26 May 2009 18:47:05 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Tue, 26 May 2009 18:47:25 -0600 (MDT) Message-Id: <20090526.184725.970724007.imp@bsdimp.com> To: rwatson@FreeBSD.org From: "M. Warner Losh" In-Reply-To: References: <9bbcef730905260624x289af079ue8524e821c1dc891@mail.gmail.com> <20090526200925.GA41682@lor.one-eyed-alien.net> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: brooks@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, ivoras@FreeBSD.org, svn-src-head@FreeBSD.org, trasz@FreeBSD.org Subject: Re: svn commit: r192800 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris/common/acl cddl/contrib/opensolaris/uts/common/fs/zfs cddl/contrib/opensolaris/u... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2009 00:48:25 -0000 In message: Robert Watson writes: : : On Tue, 26 May 2009, Brooks Davis wrote: : : >>> Cute though this BSD license variation is, I'm pretty sure it's not on the : >>> approved license list. ??Sticking to the standard license templates : >>> potentially saves significant trouble later -- especially when people : >> : >> Hmm, I'm sure that there exists some SVN magic which would allow authors to : >> enter something : >> : >> $BSDL2 Charlie Root 2008,2009$ : >> : >> and it expands to a perfect boilerplate on checkout :) : > : > Such a change would result in a repository filled without license blocks. : > This might be appropriate in a corporate setting, but isn't worth : > considering here since copies of the repo would lack correct attributions. : : I'd assumed that it was a tongue-in-cheek proposal, myself :-). : : (It is, right?) I assumed it as well, but just in case posted my "well, this won't work" message... Warner From owner-svn-src-head@FreeBSD.ORG Wed May 27 01:30:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 652CD106564A; Wed, 27 May 2009 01:30:23 +0000 (UTC) (envelope-from sson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4F9878FC0A; Wed, 27 May 2009 01:30:23 +0000 (UTC) (envelope-from sson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4R1UNDa079786; Wed, 27 May 2009 01:30:23 GMT (envelope-from sson@svn.freebsd.org) Received: (from sson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4R1UNxC079783; Wed, 27 May 2009 01:30:23 GMT (envelope-from sson@svn.freebsd.org) Message-Id: <200905270130.n4R1UNxC079783@svn.freebsd.org> From: Stacey Son Date: Wed, 27 May 2009 01:30:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192867 - in head/cddl: contrib/opensolaris/cmd/lockstat usr.sbin usr.sbin/lockstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2009 01:30:23 -0000 Author: sson Date: Wed May 27 01:30:23 2009 New Revision: 192867 URL: http://svn.freebsd.org/changeset/base/192867 Log: Add the OpenSolaris lockstat(1M) command. Requires the dtrace driver, the lockstat provider, and the ksyms(4) pseudo driver kernel modules. Approved by: gnn (mentor) Added: head/cddl/contrib/opensolaris/cmd/lockstat/ head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.1 (contents, props changed) head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c (contents, props changed) head/cddl/contrib/opensolaris/cmd/lockstat/sym.c (contents, props changed) head/cddl/usr.sbin/lockstat/ head/cddl/usr.sbin/lockstat/Makefile (contents, props changed) Modified: head/cddl/usr.sbin/Makefile Added: head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.1 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.1 Wed May 27 01:30:23 2009 (r192867) @@ -0,0 +1,875 @@ +'\" te +.\" CDDL HEADER START +.\" +.\" The contents of this file are subject to the terms of the +.\" Common Development and Distribution License (the "License"). +.\" You may not use this file except in compliance with the License. +.\" +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +.\" or http://www.opensolaris.org/os/licensing. +.\" See the License for the specific language governing permissions +.\" and limitations under the License. +.\" +.\" When distributing Covered Code, include this CDDL HEADER in each +.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. +.\" If applicable, add the following below this CDDL HEADER, with the +.\" fields enclosed by brackets "[]" replaced with your own identifying +.\" information: Portions Copyright [yyyy] [name of copyright owner] +.\" +.\" CDDL HEADER END +.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved. +.TH lockstat 1M "28 Feb 2008" "SunOS 5.11" "System Administration Commands" +.SH NAME +lockstat \- report kernel lock and profiling statistics +.SH SYNOPSIS +.LP +.nf +\fBlockstat\fR [\fB-ACEHI\fR] [\fB-e\fR \fIevent_list\fR] [\fB-i\fR \fIrate\fR] + [\fB-b\fR | \fB-t\fR | \fB-h\fR | \fB-s\fR \fIdepth\fR] [\fB-n\fR \fInrecords\fR] + [\fB-l\fR \fIlock\fR [, \fIsize\fR]] [\fB-d\fR \fIduration\fR] + [\fB-f\fR \fIfunction\fR [, \fIsize\fR]] [\fB-T\fR] [\fB-ckgwWRpP\fR] [\fB-D\fR \fIcount\fR] + [\fB-o\fR \fIfilename\fR] [\fB-x\fR \fIopt\fR [=val]] \fIcommand\fR [\fIargs\fR] +.fi + +.SH DESCRIPTION +.sp +.LP +The \fBlockstat\fR utility gathers and displays kernel locking and profiling statistics. \fBlockstat\fR allows you to specify which events to watch (for example, spin on adaptive mutex, block on read access to rwlock due to waiting writers, and so forth) how much +data to gather for each event, and how to display the data. By default, \fBlockstat\fR monitors all lock contention events, gathers frequency and timing data about those events, and displays the data in decreasing frequency order, so that the most common events appear first. +.sp +.LP +\fBlockstat\fR gathers data until the specified command completes. For example, to gather statistics for a fixed-time interval, use \fBsleep\fR(1) as +the command, as follows: +.sp +.LP +\fBexample#\fR \fBlockstat\fR \fBsleep\fR \fB5\fR +.sp +.LP +When the \fB-I\fR option is specified, \fBlockstat\fR establishes a per-processor high-level periodic interrupt source to gather profiling data. The interrupt handler simply generates a \fBlockstat\fR event whose caller is the interrupted PC (program counter). +The profiling event is just like any other \fBlockstat\fR event, so all of the normal \fBlockstat\fR options are applicable. +.sp +.LP +\fBlockstat\fR relies on DTrace to modify the running kernel's text to intercept events of interest. This imposes a small but measurable overhead on all system activity, so access to \fBlockstat\fR is restricted to super-user by default. The system administrator +can permit other users to use \fBlockstat\fR by granting them additional DTrace privileges. Refer to the \fISolaris Dynamic Tracing Guide\fR for more information about DTrace security features. +.SH OPTIONS +.sp +.LP +The following options are supported: +.SS "Event Selection" +.sp +.LP +If no event selection options are specified, the default is \fB-C\fR. +.sp +.ne 2 +.mk +.na +\fB\fB-A\fR\fR +.ad +.sp .6 +.RS 4n +Watch all lock events. \fB-A\fR is equivalent to \fB-CH\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-C\fR\fR +.ad +.sp .6 +.RS 4n +Watch contention events. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-E\fR\fR +.ad +.sp .6 +.RS 4n +Watch error events. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB\fR\fB-e\fR \fIevent_list\fR\fR +.ad +.sp .6 +.RS 4n +Only watch the specified events. \fIevent\fR \fIlist\fR is a comma-separated list of events or ranges of events such as 1,4-7,35. Run \fBlockstat\fR with no arguments to get a brief description of all events. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-H\fR\fR +.ad +.sp .6 +.RS 4n +Watch hold events. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-I\fR\fR +.ad +.sp .6 +.RS 4n +Watch profiling interrupt events. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB\fR\fB-i\fR \fIrate\fR\fR +.ad +.sp .6 +.RS 4n +Interrupt rate (per second) for \fB-I\fR. The default is 97 Hz, so that profiling doesn't run in lockstep with the clock interrupt (which runs at 100 Hz). +.RE + +.SS "Data Gathering" +.sp +.ne 2 +.mk +.na +\fB\fB-x\fR \fIarg\fR[=\fIval\fR]\fR +.ad +.sp .6 +.RS 4n +Enable or modify a DTrace runtime option or D compiler option. The list of options is found in the \fI\fR. Boolean options are enabled by specifying their name. Options with values are set by separating the option name and +value with an equals sign (=). +.RE + +.SS "Data Gathering (Mutually Exclusive)" +.sp +.ne 2 +.mk +.na +\fB\fB-b\fR\fR +.ad +.sp .6 +.RS 4n +Basic statistics: lock, caller, number of events. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-h\fR\fR +.ad +.sp .6 +.RS 4n +Histogram: Timing plus time-distribution histograms. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB\fR\fB-s\fR \fIdepth\fR\fR +.ad +.sp .6 +.RS 4n +Stack trace: Histogram plus stack traces up to \fIdepth\fR frames deep. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-t\fR\fR +.ad +.sp .6 +.RS 4n +Timing: Basic plus timing for all events [default]. +.RE + +.SS "Data Filtering" +.sp +.ne 2 +.mk +.na +\fB\fB\fR\fB-d\fR \fIduration\fR\fR +.ad +.sp .6 +.RS 4n +Only watch events longer than \fIduration\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB\fR\fB-f\fR \fIfunc[,size]\fR\fR +.ad +.sp .6 +.RS 4n +Only watch events generated by \fIfunc\fR, which can be specified as a symbolic name or hex address. \fIsize\fR defaults to the \fBELF\fR symbol size if available, or \fB1\fR if not. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB\fR\fB-l\fR \fIlock[,size]\fR\fR +.ad +.sp .6 +.RS 4n +Only watch \fIlock\fR, which can be specified as a symbolic name or hex address. \fBsize\fR defaults to the \fBELF\fR symbol size or \fB1\fR if the symbol size is not available. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB\fR\fB-n\fR \fInrecords\fR\fR +.ad +.sp .6 +.RS 4n +Maximum number of data records. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-T\fR\fR +.ad +.sp .6 +.RS 4n +Trace (rather than sample) events [off by default]. +.RE + +.SS "Data Reporting" +.sp +.ne 2 +.mk +.na +\fB\fB-c\fR\fR +.ad +.sp .6 +.RS 4n +Coalesce lock data for lock arrays (for example, \fBpse_mutex[]\fR). +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB\fR\fB-D\fR \fIcount\fR\fR +.ad +.sp .6 +.RS 4n +Only display the top \fIcount\fR events of each type. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-g\fR\fR +.ad +.sp .6 +.RS 4n +Show total events generated by function. For example, if \fBfoo()\fR calls \fBbar()\fR in a loop, the work done by \fBbar()\fR counts as work generated by \fBfoo()\fR (along with any work done by \fBfoo()\fR itself). +The \fB-g\fR option works by counting the total number of stack frames in which each function appears. This implies two things: (1) the data reported by \fB-g\fR can be misleading if the stack traces are not deep enough, and (2) functions that are called recursively might show +greater than 100% activity. In light of issue (1), the default data gathering mode when using \fB-g\fR is \fB-s\fR \fB50\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-k\fR\fR +.ad +.sp .6 +.RS 4n +Coalesce PCs within functions. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB\fR\fB-o\fR \fIfilename\fR\fR +.ad +.sp .6 +.RS 4n +Direct output to \fIfilename\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-P\fR\fR +.ad +.sp .6 +.RS 4n +Sort data by (\fIcount * time\fR) product. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-p\fR\fR +.ad +.sp .6 +.RS 4n +Parsable output format. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-R\fR\fR +.ad +.sp .6 +.RS 4n +Display rates (events per second) rather than counts. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-W\fR\fR +.ad +.sp .6 +.RS 4n +Whichever: distinguish events only by caller, not by lock. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fB-w\fR\fR +.ad +.sp .6 +.RS 4n +Wherever: distinguish events only by lock, not by caller. +.RE + +.SH DISPLAY FORMATS +.sp +.LP +The following headers appear over various columns of data. +.sp +.ne 2 +.mk +.na +\fB\fBCount\fR or \fBops/s\fR\fR +.ad +.sp .6 +.RS 4n +Number of times this event occurred, or the rate (times per second) if \fB-R\fR was specified. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBindv\fR\fR +.ad +.sp .6 +.RS 4n +Percentage of all events represented by this individual event. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBgenr\fR\fR +.ad +.sp .6 +.RS 4n +Percentage of all events generated by this function. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBcuml\fR\fR +.ad +.sp .6 +.RS 4n +Cumulative percentage; a running total of the individuals. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBrcnt\fR\fR +.ad +.sp .6 +.RS 4n +Average reference count. This will always be \fB1\fR for exclusive locks (mutexes, spin locks, rwlocks held as writer) but can be greater than \fB1\fR for shared locks (rwlocks held as reader). +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBnsec\fR\fR +.ad +.sp .6 +.RS 4n +Average duration of the events in nanoseconds, as appropriate for the event. For the profiling event, duration means interrupt latency. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBLock\fR\fR +.ad +.sp .6 +.RS 4n +Address of the lock; displayed symbolically if possible. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBCPU+PIL\fR\fR +.ad +.sp .6 +.RS 4n +\fBCPU\fR plus processor interrupt level (\fBPIL\fR). For example, if \fBCPU\fR 4 is interrupted while at \fBPIL\fR 6, this will be reported as \fBcpu[4]+6\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBCaller\fR\fR +.ad +.sp .6 +.RS 4n +Address of the caller; displayed symbolically if possible. +.RE + +.SH EXAMPLES +.LP +\fBExample 1 \fRMeasuring Kernel Lock Contention +.sp +.in +2 +.nf +example# \fBlockstat sleep 5\fR +Adaptive mutex spin: 2210 events in 5.055 seconds (437 events/sec) +.fi +.in -2 +.sp + +.sp +.in +2 +.nf +Count indv cuml rcnt nsec Lock Caller +------------------------------------------------------------------------ + 269 12% 12% 1.00 2160 service_queue background+0xdc + 249 11% 23% 1.00 86 service_queue qenable_locked+0x64 + 228 10% 34% 1.00 131 service_queue background+0x15c + 68 3% 37% 1.00 79 0x30000024070 untimeout+0x1c + 59 3% 40% 1.00 384 0x300066fa8e0 background+0xb0 + 43 2% 41% 1.00 30 rqcred_lock svc_getreq+0x3c + 42 2% 43% 1.00 341 0x30006834eb8 background+0xb0 + 41 2% 45% 1.00 135 0x30000021058 untimeout+0x1c + 40 2% 47% 1.00 39 rqcred_lock svc_getreq+0x260 + 37 2% 49% 1.00 2372 0x300068e83d0 hmestart+0x1c4 + 36 2% 50% 1.00 77 0x30000021058 timeout_common+0x4 + 36 2% 52% 1.00 354 0x300066fa120 background+0xb0 + 32 1% 53% 1.00 97 0x30000024070 timeout_common+0x4 + 31 1% 55% 1.00 2923 0x300069883d0 hmestart+0x1c4 + 29 1% 56% 1.00 366 0x300066fb290 background+0xb0 + 28 1% 57% 1.00 117 0x3000001e040 untimeout+0x1c + 25 1% 59% 1.00 93 0x3000001e040 timeout_common+0x4 + 22 1% 60% 1.00 25 0x30005161110 sync_stream_buf+0xdc + 21 1% 60% 1.00 291 0x30006834eb8 putq+0xa4 + 19 1% 61% 1.00 43 0x3000515dcb0 mdf_alloc+0xc + 18 1% 62% 1.00 456 0x30006834eb8 qenable+0x8 + 18 1% 63% 1.00 61 service_queue queuerun+0x168 + 17 1% 64% 1.00 268 0x30005418ee8 vmem_free+0x3c +[...] + +R/W reader blocked by writer: 76 events in 5.055 seconds (15 events/sec) + +Count indv cuml rcnt nsec Lock Caller +------------------------------------------------------------------------ + 23 30% 30% 1.00 22590137 0x300098ba358 ufs_dirlook+0xd0 + 17 22% 53% 1.00 5820995 0x3000ad815e8 find_bp+0x10 + 13 17% 70% 1.00 2639918 0x300098ba360 ufs_iget+0x198 + 4 5% 75% 1.00 3193015 0x300098ba360 ufs_getattr+0x54 + 3 4% 79% 1.00 7953418 0x3000ad817c0 find_bp+0x10 + 3 4% 83% 1.00 935211 0x3000ad815e8 find_read_lof+0x14 + 2 3% 86% 1.00 16357310 0x300073a4720 find_bp+0x10 + 2 3% 88% 1.00 2072433 0x300073a4720 find_read_lof+0x14 + 2 3% 91% 1.00 1606153 0x300073a4370 find_bp+0x10 + 1 1% 92% 1.00 2656909 0x300107e7400 ufs_iget+0x198 +[...] +.fi +.in -2 +.sp + +.LP +\fBExample 2 \fRMeasuring Hold Times +.sp +.in +2 +.nf +example# \fBlockstat -H -D 10 sleep 1\fR +Adaptive mutex spin: 513 events +.fi +.in -2 +.sp + +.sp +.in +2 +.nf +Count indv cuml rcnt nsec Lock Caller +------------------------------------------------------------------------- + 480 5% 5% 1.00 1136 0x300007718e8 putnext+0x40 + 286 3% 9% 1.00 666 0x3000077b430 getf+0xd8 + 271 3% 12% 1.00 537 0x3000077b430 msgio32+0x2fc + 270 3% 15% 1.00 3670 0x300007718e8 strgetmsg+0x3d4 + 270 3% 18% 1.00 1016 0x300007c38b0 getq_noenab+0x200 + 264 3% 20% 1.00 1649 0x300007718e8 strgetmsg+0xa70 + 216 2% 23% 1.00 6251 tcp_mi_lock tcp_snmp_get+0xfc + 206 2% 25% 1.00 602 thread_free_lock clock+0x250 + 138 2% 27% 1.00 485 0x300007c3998 putnext+0xb8 + 138 2% 28% 1.00 3706 0x300007718e8 strrput+0x5b8 +------------------------------------------------------------------------- +[...] +.fi +.in -2 +.sp + +.LP +\fBExample 3 \fRMeasuring Hold Times for Stack Traces Containing a Specific Function +.sp +.in +2 +.nf +example# \fBlockstat -H -f tcp_rput_data -s 50 -D 10 sleep 1\fR +Adaptive mutex spin: 11 events in 1.023 seconds (11 +events/sec) +.fi +.in -2 +.sp + +.sp +.in +2 +.nf +------------------------------------------------------------------------- +Count indv cuml rcnt nsec Lock Caller + 9 82% 82% 1.00 2540 0x30000031380 tcp_rput_data+0x2b90 + + nsec ------ Time Distribution ------ count Stack + 256 |@@@@@@@@@@@@@@@@ 5 tcp_rput_data+0x2b90 + 512 |@@@@@@ 2 putnext+0x78 + 1024 |@@@ 1 ip_rput+0xec4 + 2048 | 0 _c_putnext+0x148 + 4096 | 0 hmeread+0x31c + 8192 | 0 hmeintr+0x36c + 16384 |@@@ 1 +sbus_intr_wrapper+0x30 +[...] + +Count indv cuml rcnt nsec Lock Caller + 1 9% 91% 1.00 1036 0x30000055380 freemsg+0x44 + + nsec ------ Time Distribution ------ count Stack + 1024 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 freemsg+0x44 + tcp_rput_data+0x2fd0 + putnext+0x78 + ip_rput+0xec4 + _c_putnext+0x148 + hmeread+0x31c + hmeintr+0x36c + +sbus_intr_wrapper+0x30 +------------------------------------------------------------------------- +[...] +.fi +.in -2 +.sp + +.LP +\fBExample 4 \fRBasic Kernel Profiling +.sp +.LP +For basic profiling, we don't care whether the profiling interrupt sampled \fBfoo()\fR\fB+0x4c\fR or \fBfoo()\fR\fB+0x78\fR; we care only that it sampled somewhere in \fBfoo()\fR, so we use \fB-k\fR. The \fBCPU\fR and \fBPIL\fR aren't relevant to basic profiling because we are measuring the system as a whole, not a particular \fBCPU\fR or interrupt level, so we use \fB-W\fR. + +.sp +.in +2 +.nf +example# \fBlockstat -kIW -D 20 ./polltest\fR +Profiling interrupt: 82 events in 0.424 seconds (194 +events/sec) +.fi +.in -2 +.sp + +.sp +.in +2 +.nf +Count indv cuml rcnt nsec Hottest CPU+PIL Caller +----------------------------------------------------------------------- + 8 10% 10% 1.00 698 cpu[1] utl0 + 6 7% 17% 1.00 299 cpu[0] read + 5 6% 23% 1.00 124 cpu[1] getf + 4 5% 28% 1.00 327 cpu[0] fifo_read + 4 5% 33% 1.00 112 cpu[1] poll + 4 5% 38% 1.00 212 cpu[1] uiomove + 4 5% 43% 1.00 361 cpu[1] mutex_tryenter + 3 4% 46% 1.00 682 cpu[0] write + 3 4% 50% 1.00 89 cpu[0] pcache_poll + 3 4% 54% 1.00 118 cpu[1] set_active_fd + 3 4% 57% 1.00 105 cpu[0] syscall_trap32 + 3 4% 61% 1.00 640 cpu[1] (usermode) + 2 2% 63% 1.00 127 cpu[1] fifo_poll + 2 2% 66% 1.00 300 cpu[1] fifo_write + 2 2% 68% 1.00 669 cpu[0] releasef + 2 2% 71% 1.00 112 cpu[1] bt_getlowbit + 2 2% 73% 1.00 247 cpu[1] splx + 2 2% 76% 1.00 503 cpu[0] mutex_enter + 2 2% 78% 1.00 467 cpu[0]+10 disp_lock_enter + 2 2% 80% 1.00 139 cpu[1] default_copyin +----------------------------------------------------------------------- +[...] +.fi +.in -2 +.sp + +.LP +\fBExample 5 \fRGenerated-load Profiling +.sp +.LP +In the example above, 5% of the samples were in \fBpoll()\fR. This tells us how much time was spent inside \fBpoll()\fR itself, but tells us nothing about how much work was \fBgenerated\fR by \fBpoll()\fR; that is, how much time we spent +in functions called by \fBpoll()\fR. To determine that, we use the \fB-g\fR option. The example below shows that although \fBpolltest\fR spends only 5% of its time in \fBpoll()\fR itself, \fBpoll()\fR-induced work accounts for 34% of +the load. + +.sp +.LP +Note that the functions that generate the profiling interrupt (\fBlockstat_intr()\fR, \fBcyclic_fire()\fR, and so forth) appear in every stack trace, and therefore are considered to have generated 100% of the load. This illustrates an important point: the generated +load percentages do \fBnot\fR add up to 100% because they are not independent. If 72% of all stack traces contain both \fBfoo()\fR and \fBbar()\fR, then both \fBfoo()\fR and \fBbar()\fR are 72% load generators. + +.sp +.in +2 +.nf +example# \fBlockstat -kgIW -D 20 ./polltest\fR +Profiling interrupt: 80 events in 0.412 seconds (194 events/sec) +.fi +.in -2 +.sp + +.sp +.in +2 +.nf +Count genr cuml rcnt nsec Hottest CPU+PIL Caller +------------------------------------------------------------------------- + 80 100% ---- 1.00 310 cpu[1] lockstat_intr + 80 100% ---- 1.00 310 cpu[1] cyclic_fire + 80 100% ---- 1.00 310 cpu[1] cbe_level14 + 80 100% ---- 1.00 310 cpu[1] current_thread + 27 34% ---- 1.00 176 cpu[1] poll + 20 25% ---- 1.00 221 cpu[0] write + 19 24% ---- 1.00 249 cpu[1] read + 17 21% ---- 1.00 232 cpu[0] write32 + 17 21% ---- 1.00 207 cpu[1] pcache_poll + 14 18% ---- 1.00 319 cpu[0] fifo_write + 13 16% ---- 1.00 214 cpu[1] read32 + 10 12% ---- 1.00 208 cpu[1] fifo_read + 10 12% ---- 1.00 787 cpu[1] utl0 + 9 11% ---- 1.00 178 cpu[0] pcacheset_resolve + 9 11% ---- 1.00 262 cpu[0] uiomove + 7 9% ---- 1.00 506 cpu[1] (usermode) + 5 6% ---- 1.00 195 cpu[1] fifo_poll + 5 6% ---- 1.00 136 cpu[1] syscall_trap32 + 4 5% ---- 1.00 139 cpu[0] releasef + 3 4% ---- 1.00 277 cpu[1] polllock +------------------------------------------------------------------------- +[...] +.fi +.in -2 +.sp + +.LP +\fBExample 6 \fRGathering Lock Contention and Profiling Data for a Specific Module +.sp +.LP +In this example we use the \fB-f\fR option not to specify a single function, but rather to specify the entire text space of the \fBsbus\fR module. We gather both lock contention and profiling statistics so that contention can be correlated with overall load on the +module. + +.sp +.in +2 +.nf +example# \fBmodinfo | grep sbus\fR +24 102a8b6f b8b4 59 1 sbus (SBus (sysio) nexus driver) +.fi +.in -2 +.sp + +.sp +.in +2 +.nf +example# \fBlockstat -kICE -f 0x102a8b6f,0xb8b4 sleep 10\fR +Adaptive mutex spin: 39 events in 10.042 seconds (4 events/sec) +.fi +.in -2 +.sp + +.sp +.in +2 +.nf +Count indv cuml rcnt nsec Lock Caller +------------------------------------------------------------------------- + 15 38% 38% 1.00 206 0x30005160528 sync_stream_buf + 7 18% 56% 1.00 14 0x30005160d18 sync_stream_buf + 6 15% 72% 1.00 27 0x300060c3118 sync_stream_buf + 5 13% 85% 1.00 24 0x300060c3510 sync_stream_buf + 2 5% 90% 1.00 29 0x300060c2d20 sync_stream_buf + 2 5% 95% 1.00 24 0x30005161cf8 sync_stream_buf + 1 3% 97% 1.00 21 0x30005161110 sync_stream_buf + 1 3% 100% 1.00 23 0x30005160130 sync_stream_buf +[...] + +Adaptive mutex block: 9 events in 10.042 seconds (1 events/sec) + +Count indv cuml rcnt nsec Lock Caller +------------------------------------------------------------------------- + 4 44% 44% 1.00 156539 0x30005160528 sync_stream_buf + 2 22% 67% 1.00 763516 0x30005160d18 sync_stream_buf + 1 11% 78% 1.00 462130 0x300060c3510 sync_stream_buf + 1 11% 89% 1.00 288749 0x30005161110 sync_stream_buf + 1 11% 100% 1.00 1015374 0x30005160130 sync_stream_buf +[...] + +Profiling interrupt: 229 events in 10.042 seconds (23 events/sec) + +Count indv cuml rcnt nsec Hottest CPU+PIL Caller + +------------------------------------------------------------------------- + 89 39% 39% 1.00 426 cpu[0]+6 sync_stream_buf + 64 28% 67% 1.00 398 cpu[0]+6 sbus_intr_wrapper + 23 10% 77% 1.00 324 cpu[0]+6 iommu_dvma_kaddr_load + 21 9% 86% 1.00 512 cpu[0]+6 iommu_tlb_flush + 14 6% 92% 1.00 342 cpu[0]+6 iommu_dvma_unload + 13 6% 98% 1.00 306 cpu[1] iommu_dvma_sync + 5 2% 100% 1.00 389 cpu[1] iommu_dma_bindhdl +------------------------------------------------------------------------- +[...] +.fi +.in -2 +.sp + +.LP +\fBExample 7 \fRDetermining the Average PIL (processor interrupt level) for a CPU +.sp +.in +2 +.nf +example# \fBlockstat -Iw -l cpu[3] ./testprog\fR + +Profiling interrupt: 14791 events in 152.463 seconds (97 events/sec) + +Count indv cuml rcnt nsec CPU+PIL Hottest Caller + +----------------------------------------------------------------------- +13641 92% 92% 1.00 253 cpu[3] (usermode) + 579 4% 96% 1.00 325 cpu[3]+6 ip_ocsum+0xe8 + 375 3% 99% 1.00 411 cpu[3]+10 splx + 154 1% 100% 1.00 527 cpu[3]+4 fas_intr_svc+0x80 + 41 0% 100% 1.00 293 cpu[3]+13 send_mondo+0x18 + 1 0% 100% 1.00 266 cpu[3]+12 zsa_rxint+0x400 +----------------------------------------------------------------------- +[...] +.fi +.in -2 +.sp + +.LP +\fBExample 8 \fRDetermining which Subsystem is Causing the System to be Busy +.sp +.in +2 +.nf +example# \fBlockstat -s 10 -I sleep 20\fR + +Profiling interrupt: 4863 events in 47.375 seconds (103 events/sec) + +Count indv cuml rcnt nsec CPU+PIL Caller + +----------------------------------------------------------------------- +1929 40% 40% 0.00 3215 cpu[0] usec_delay+0x78 + nsec ------ Time Distribution ------ count Stack + 4096 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1872 ata_wait+0x90 + 8192 | 27 acersb_get_intr_status+0x34 +16384 | 29 ata_set_feature+0x124 +32768 | 1 ata_disk_start+0x15c + ata_hba_start+0xbc + ghd_waitq_process_and \e + _mutex_hold+0x70 + ghd_waitq_process_and \e + _mutex_exit+0x4 + ghd_transport+0x12c + ata_disk_tran_start+0x108 +----------------------------------------------------------------------- +[...] +.fi +.in -2 +.sp + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +AvailabilitySUNWdtrc +.TE + +.SH SEE ALSO +.sp +.LP +\fBdtrace\fR(1M), \fBplockstat\fR(1M), \fBattributes\fR(5), \fBlockstat\fR(7D), \fBmutex\fR(9F), \fBrwlock\fR(9F) +.sp +.LP +\fISolaris Dynamic Tracing Guide\fR +.SH NOTES +.sp +.LP +The profiling support provided by \fBlockstat\fR \fB-I\fR replaces the old (and undocumented) \fB/usr/bin/kgmon\fR and \fB/dev/profile\fR. +.sp +.LP +Tail-call elimination can affect call sites. For example, if \fBfoo()\fR\fB+0x50\fR calls \fBbar()\fR and the last thing \fBbar()\fR does is call \fBmutex_exit()\fR, the compiler can arrange for \fBbar()\fR to +branch to \fBmutex_exit()\fRwith a return address of \fBfoo()\fR\fB+0x58\fR. Thus, the \fBmutex_exit()\fR in \fBbar()\fR will appear as though it occurred at \fBfoo()\fR\fB+0x58\fR. +.sp +.LP +The \fBPC\fR in the stack frame in which an interrupt occurs can be bogus because, between function calls, the compiler is free to use the return address register for local storage. +.sp +.LP +When using the \fB-I\fR and \fB-s\fR options together, the interrupted PC will usually not appear anywhere in the stack since the interrupt handler is entered asynchronously, not by a function call from that \fBPC\fR. +.sp +.LP +The \fBlockstat\fR technology is provided on an as-is basis. The format and content of \fBlockstat\fR output reflect the current Solaris kernel implementation and are therefore subject to change in future releases. Added: head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c Wed May 27 01:30:23 2009 (r192867) @@ -0,0 +1,1917 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if !defined(sun) +/* needed for FreeBSD */ +#include +#include +typedef uintptr_t pc_t; + +#define mergesort(a, b, c, d) lsmergesort(a, b, c, d) +#endif + +#define LOCKSTAT_OPTSTR "x:bths:n:d:i:l:f:e:ckwWgCHEATID:RpPo:V" + +#define LS_MAX_STACK_DEPTH 50 +#define LS_MAX_EVENTS 64 + +typedef struct lsrec { + struct lsrec *ls_next; /* next in hash chain */ + uintptr_t ls_lock; /* lock address */ + uintptr_t ls_caller; /* caller address */ + uint32_t ls_count; /* cumulative event count */ + uint32_t ls_event; /* type of event */ + uintptr_t ls_refcnt; /* cumulative reference count */ + uint64_t ls_time; /* cumulative event duration */ + uint32_t ls_hist[64]; /* log2(duration) histogram */ + uintptr_t ls_stack[LS_MAX_STACK_DEPTH]; +} lsrec_t; + +typedef struct lsdata { + struct lsrec *lsd_next; /* next available */ + int lsd_count; /* number of records */ +} lsdata_t; + +/* + * Definitions for the types of experiments which can be run. They are + * listed in increasing order of memory cost and processing time cost. + * The numerical value of each type is the number of bytes needed per record. + */ +#define LS_BASIC offsetof(lsrec_t, ls_time) +#define LS_TIME offsetof(lsrec_t, ls_hist[0]) +#define LS_HIST offsetof(lsrec_t, ls_stack[0]) +#define LS_STACK(depth) offsetof(lsrec_t, ls_stack[depth]) + +static void report_stats(FILE *, lsrec_t **, size_t, uint64_t, uint64_t); +static void report_trace(FILE *, lsrec_t **); + +extern int symtab_init(void); +extern char *addr_to_sym(uintptr_t, uintptr_t *, size_t *); +extern uintptr_t sym_to_addr(char *name); +extern size_t sym_size(char *name); +extern char *strtok_r(char *, const char *, char **); + +#define DEFAULT_NRECS 10000 +#define DEFAULT_HZ 97 +#define MAX_HZ 1000 +#define MIN_AGGSIZE (16 * 1024) +#define MAX_AGGSIZE (32 * 1024 * 1024) + +static int g_stkdepth; +static int g_topn = INT_MAX; +static hrtime_t g_elapsed; +static int g_rates = 0; +static int g_pflag = 0; +static int g_Pflag = 0; +static int g_wflag = 0; +static int g_Wflag = 0; +static int g_cflag = 0; +static int g_kflag = 0; +static int g_gflag = 0; +static int g_Vflag = 0; +static int g_tracing = 0; +static size_t g_recsize; +static size_t g_nrecs; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed May 27 01:45:24 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5306B106564A; Wed, 27 May 2009 01:45:24 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 40EB18FC15; Wed, 27 May 2009 01:45:24 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4R1jOTC080109; Wed, 27 May 2009 01:45:24 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4R1jOne080108; Wed, 27 May 2009 01:45:24 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <200905270145.n4R1jOne080108@svn.freebsd.org> From: Adrian Chadd Date: Wed, 27 May 2009 01:45:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192868 - head/sys/dev/xen/netfront X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2009 01:45:24 -0000 Author: adrian Date: Wed May 27 01:45:23 2009 New Revision: 192868 URL: http://svn.freebsd.org/changeset/base/192868 Log: Add in some INVARIANT checks in the TX mbuf descriptor "freelist" management code. Slot 0 must always remain "free" and be a pointer to the first free entry in the mbuf descriptor list. It is thus an error to have code allocate or push slot 0 back into the list. Modified: head/sys/dev/xen/netfront/netfront.c Modified: head/sys/dev/xen/netfront/netfront.c ============================================================================== --- head/sys/dev/xen/netfront/netfront.c Wed May 27 01:30:23 2009 (r192867) +++ head/sys/dev/xen/netfront/netfront.c Wed May 27 01:45:23 2009 (r192868) @@ -310,6 +310,7 @@ struct netfront_rx_info { static inline void add_id_to_freelist(struct mbuf **list, unsigned short id) { + KASSERT(id != 0, ("add_id_to_freelist: the head item (0) must always be free.")); list[id] = list[0]; list[0] = (void *)(u_long)id; } @@ -318,6 +319,7 @@ static inline unsigned short get_id_from_freelist(struct mbuf **list) { u_int id = (u_int)(u_long)list[0]; + KASSERT(id != 0, ("get_id_from_freelist: the head item (0) must always remain free.")); list[0] = list[id]; return (id); } From owner-svn-src-head@FreeBSD.ORG Wed May 27 01:54:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ADF9E106566B; Wed, 27 May 2009 01:54:26 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 812C48FC18; Wed, 27 May 2009 01:54:26 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4R1sQdZ080316; Wed, 27 May 2009 01:54:26 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4R1sQEb080315; Wed, 27 May 2009 01:54:26 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <200905270154.n4R1sQEb080315@svn.freebsd.org> From: Adrian Chadd Date: Wed, 27 May 2009 01:54:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192869 - head/sys/dev/xen/netfront X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2009 01:54:27 -0000 Author: adrian Date: Wed May 27 01:54:26 2009 New Revision: 192869 URL: http://svn.freebsd.org/changeset/base/192869 Log: Flesh out some inline documentation which hopefully reflect the intended reality of these functions. Modified: head/sys/dev/xen/netfront/netfront.c Modified: head/sys/dev/xen/netfront/netfront.c ============================================================================== --- head/sys/dev/xen/netfront/netfront.c Wed May 27 01:45:23 2009 (r192868) +++ head/sys/dev/xen/netfront/netfront.c Wed May 27 01:54:26 2009 (r192869) @@ -685,6 +685,23 @@ xn_free_tx_ring(struct netfront_info *sc #endif } +/* + * Do some brief math on the number of descriptors available to + * determine how many slots are available. + * + * Firstly - wouldn't something with RING_FREE_REQUESTS() be more applicable? + * Secondly - MAX_SKB_FRAGS is a Linux construct which may not apply here. + * Thirdly - it isn't used here anyway; the magic constant '24' is possibly + * wrong? + * The "2" is presumably to ensure there are also enough slots available for + * the ring entries used for "options" (eg, the TSO entry before a packet + * is queued); I'm not sure why its 2 and not 1. Perhaps to make sure there's + * a "free" node in the tx mbuf list (node 0) to represent the freelist? + * + * This only figures out whether any xenbus ring descriptors are available; + * it doesn't at all reflect how many tx mbuf ring descriptors are also + * available. + */ static inline int netfront_tx_slot_available(struct netfront_info *np) { @@ -1389,6 +1406,12 @@ xn_start_locked(struct ifnet *ifp) if (m_head == NULL) break; + /* + * netfront_tx_slot_available() tries to do some math to + * ensure that there'll be enough xenbus ring slots available + * for the maximum number of packet fragments (and a couple more + * for what I guess are TSO and other ring entry items.) + */ if (!netfront_tx_slot_available(sc)) { IF_PREPEND(&ifp->if_snd, m_head); ifp->if_drv_flags |= IFF_DRV_OACTIVE; From owner-svn-src-head@FreeBSD.ORG Wed May 27 01:56:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E756106564A; Wed, 27 May 2009 01:56:38 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F06928FC15; Wed, 27 May 2009 01:56:37 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4R1ubCY080411; Wed, 27 May 2009 01:56:37 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4R1ubKq080410; Wed, 27 May 2009 01:56:37 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <200905270156.n4R1ubKq080410@svn.freebsd.org> From: Adrian Chadd Date: Wed, 27 May 2009 01:56:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192870 - head/sys/dev/xen/netfront X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2009 01:56:38 -0000 Author: adrian Date: Wed May 27 01:56:37 2009 New Revision: 192870 URL: http://svn.freebsd.org/changeset/base/192870 Log: Do the invariant check before the mbuf is dereferenced. Modified: head/sys/dev/xen/netfront/netfront.c Modified: head/sys/dev/xen/netfront/netfront.c ============================================================================== --- head/sys/dev/xen/netfront/netfront.c Wed May 27 01:54:26 2009 (r192869) +++ head/sys/dev/xen/netfront/netfront.c Wed May 27 01:56:37 2009 (r192870) @@ -1065,6 +1065,8 @@ xn_txeof(struct netfront_info *np) id = txr->id; m = np->xn_cdata.xn_tx_chain[id]; + KASSERT(m != NULL, ("mbuf not found in xn_tx_chain")); + M_ASSERTVALID(m); /* * Increment packet count if this is the last @@ -1072,8 +1074,6 @@ xn_txeof(struct netfront_info *np) */ if (!m->m_next) ifp->if_opackets++; - KASSERT(m != NULL, ("mbuf not found in xn_tx_chain")); - M_ASSERTVALID(m); if (unlikely(gnttab_query_foreign_access( np->grant_tx_ref[id]) != 0)) { printf("network_tx_buf_gc: warning " From owner-svn-src-head@FreeBSD.ORG Wed May 27 02:49:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C39D3106566B; Wed, 27 May 2009 02:49:08 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B15538FC14; Wed, 27 May 2009 02:49:08 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4R2n8DN081423; Wed, 27 May 2009 02:49:08 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4R2n8gs081422; Wed, 27 May 2009 02:49:08 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <200905270249.n4R2n8gs081422@svn.freebsd.org> From: Adrian Chadd Date: Wed, 27 May 2009 02:49:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192871 - head/sys/dev/xen/netfront X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2009 02:49:09 -0000 Author: adrian Date: Wed May 27 02:49:08 2009 New Revision: 192871 URL: http://svn.freebsd.org/changeset/base/192871 Log: Ensure that there are enough TX mbuf ring slots available before beginning to dequeue a packet. The tx path was trying to ensure that enough Xenbus TX ring slots existed but it didn't check to see whether the mbuf TX ring slots were also available. They get freed in xn_txeof() which occurs after transmission, rather than earlier on in the process. (The same happens under Linux too.) Due to whatever reason (CPU use, scheduling, memory constraints, whatever) the mbuf TX ring may not have enough slots free and would allocate slot 0. This is used as the freelist head pointer to represent "free" mbuf TX ring slots; setting this to an actual mbuf value rather than an id crashes the code. This commit introduces some basic code to track the TX mbuf ring use and then (hopefully!) ensures that enough slots are free in said TX mbuf ring before it enters the actual work loop. A few notes: * Similar logic needs to be introduced to check there are enough actual slots available in the xenbuf TX ring. There's some logic which is invoked earlier but it doesn't hard-check against the number of available ring slots. Its trivial to do; I'll do it in a subsequent commit. * As I've now commented in the source, it is likely possible to deadlock the driver under certain conditions where the rings aren't receiving any changes (which I should enumerate) and thus Xen doesn't send any further software interrupts. I need to make sure that the timer(s) are running right and the queues are periodically kicked. PR: 134926 Modified: head/sys/dev/xen/netfront/netfront.c Modified: head/sys/dev/xen/netfront/netfront.c ============================================================================== --- head/sys/dev/xen/netfront/netfront.c Wed May 27 01:56:37 2009 (r192870) +++ head/sys/dev/xen/netfront/netfront.c Wed May 27 02:49:08 2009 (r192871) @@ -176,6 +176,7 @@ static int xennet_get_responses(struct n */ struct xn_chain_data { struct mbuf *xn_tx_chain[NET_TX_RING_SIZE+1]; + int xn_tx_chain_cnt; struct mbuf *xn_rx_chain[NET_RX_RING_SIZE+1]; }; @@ -727,6 +728,10 @@ netif_release_tx_bufs(struct netfront_in np->grant_tx_ref[i]); np->grant_tx_ref[i] = GRANT_INVALID_REF; add_id_to_freelist(np->tx_mbufs, i); + np->xn_cdata.xn_tx_chain_cnt--; + if (np->xn_cdata.xn_tx_chain_cnt < 0) { + panic("netif_release_tx_bufs: tx_chain_cnt must be >= 0"); + } m_freem(m); } } @@ -1089,6 +1094,10 @@ xn_txeof(struct netfront_info *np) np->xn_cdata.xn_tx_chain[id] = NULL; add_id_to_freelist(np->xn_cdata.xn_tx_chain, id); + np->xn_cdata.xn_tx_chain_cnt--; + if (np->xn_cdata.xn_tx_chain_cnt < 0) { + panic("netif_release_tx_bufs: tx_chain_cnt must be >= 0"); + } m_free(m); } np->tx.rsp_cons = prod; @@ -1417,7 +1426,6 @@ xn_start_locked(struct ifnet *ifp) ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } - /* * Defragment the mbuf if necessary. @@ -1433,6 +1441,36 @@ xn_start_locked(struct ifnet *ifp) m_head = m; } + /* Determine how many fragments now exist */ + for (m = m_head, nfrags = 0; m; m = m->m_next) + nfrags++; + + /* + * Don't attempt to queue this packet if there aren't enough free entries in the chain. + * There isn't a 1:1 correspondance between the mbuf TX ring and the xenbus TX ring. + * xn_txeof() may need to be called to free up some slots. + * + * It is quite possible that this can be later eliminated if it turns out that partial + * packets can be pushed into the ringbuffer, with fragments pushed in when further slots + * free up. + * + * It is also quite possible that the driver will lock up - Xen may not send another + * interrupt to kick the tx/rx processing if the xenbus RX ring is full and xenbus TX ring + * is empty - no further TX work can be done until space is made in the TX mbuf ring and + * the RX side may be waiting for TX data to continue. It is quite possible some timer + * event should be created to kick TX/RX processing along in certain conditions. + */ + + /* its not +1 like the allocation because we need to keep slot [0] free for the freelist head */ + if (sc->xn_cdata.xn_tx_chain_cnt + nfrags >= NET_TX_RING_SIZE) { + printf("xn_start_locked: xn_tx_chain_cnt (%d) + nfrags %d >= NET_TX_RING_SIZE (%d); must be full!\n", + (int) sc->xn_cdata.xn_tx_chain_cnt, (int) nfrags, (int) NET_TX_RING_SIZE); + IF_PREPEND(&ifp->if_snd, m_head); + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + break; + } + + /* * Start packing the mbufs in this chain into * the fragment pointers. Stop when we run out @@ -1443,6 +1481,11 @@ xn_start_locked(struct ifnet *ifp) for (m = m_head; m; m = m->m_next) { tx = RING_GET_REQUEST(&sc->tx, i); id = get_id_from_freelist(sc->xn_cdata.xn_tx_chain); + if (id == 0) + panic("xn_start_locked: was allocated the freelist head!\n"); + sc->xn_cdata.xn_tx_chain_cnt++; + if (sc->xn_cdata.xn_tx_chain_cnt >= NET_TX_RING_SIZE+1) + panic("xn_start_locked: tx_chain_cnt must be < NET_TX_RING_SIZE+1\n"); sc->xn_cdata.xn_tx_chain[id] = m; tx->id = id; ref = gnttab_claim_grant_reference(&sc->gref_tx_head); From owner-svn-src-head@FreeBSD.ORG Wed May 27 03:57:39 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2CAD6106564A; Wed, 27 May 2009 03:57:39 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 18A278FC12; Wed, 27 May 2009 03:57:39 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4R3vcx6082977; Wed, 27 May 2009 03:57:38 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4R3vcK7082975; Wed, 27 May 2009 03:57:38 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <200905270357.n4R3vcK7082975@svn.freebsd.org> From: Weongyo Jeong Date: Wed, 27 May 2009 03:57:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192873 - in head/sys: dev/usb/wlan modules/usb/urtw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2009 03:57:39 -0000 Author: weongyo Date: Wed May 27 03:57:38 2009 New Revision: 192873 URL: http://svn.freebsd.org/changeset/base/192873 Log: ports urtw(4) for USB2. Additionally it supports a 8187B chipset weakly that it needs more stabilization. Added: head/sys/dev/usb/wlan/if_urtw.c (contents, props changed) head/sys/dev/usb/wlan/if_urtwreg.h (contents, props changed) head/sys/dev/usb/wlan/if_urtwvar.h (contents, props changed) head/sys/modules/usb/urtw/ head/sys/modules/usb/urtw/Makefile (contents, props changed) Added: head/sys/dev/usb/wlan/if_urtw.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/usb/wlan/if_urtw.c Wed May 27 03:57:38 2009 (r192873) @@ -0,0 +1,4241 @@ +/*- + * Copyright (c) 2008 Weongyo Jeong + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +__FBSDID("$FreeBSD$"); +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#ifdef INET +#include +#include +#include +#include +#include +#endif + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include "usbdevs.h" + +#include +#include + +SYSCTL_NODE(_hw_usb, OID_AUTO, urtw, CTLFLAG_RW, 0, "USB Realtek 8187L"); +#ifdef URTW_DEBUG +int urtw_debug = 0; +SYSCTL_INT(_hw_usb_urtw, OID_AUTO, debug, CTLFLAG_RW, &urtw_debug, 0, + "control debugging printfs"); +TUNABLE_INT("hw.usb.urtw.debug", &urtw_debug); +enum { + URTW_DEBUG_XMIT = 0x00000001, /* basic xmit operation */ + URTW_DEBUG_RECV = 0x00000002, /* basic recv operation */ + URTW_DEBUG_RESET = 0x00000004, /* reset processing */ + URTW_DEBUG_TX_PROC = 0x00000008, /* tx ISR proc */ + URTW_DEBUG_RX_PROC = 0x00000010, /* rx ISR proc */ + URTW_DEBUG_STATE = 0x00000020, /* 802.11 state transitions */ + URTW_DEBUG_STAT = 0x00000040, /* statistic */ + URTW_DEBUG_INIT = 0x00000080, /* initialization of dev */ + URTW_DEBUG_ANY = 0xffffffff +}; +#define DPRINTF(sc, m, fmt, ...) do { \ + if (sc->sc_debug & (m)) \ + printf(fmt, __VA_ARGS__); \ +} while (0) +#else +#define DPRINTF(sc, m, fmt, ...) do { \ + (void) sc; \ +} while (0) +#endif +int urtw_preamble_mode = URTW_PREAMBLE_MODE_LONG; +SYSCTL_INT(_hw_usb_urtw, OID_AUTO, preamble_mode, CTLFLAG_RW, + &urtw_preamble_mode, 0, "set the preable mode (long or short)"); +TUNABLE_INT("hw.usb.urtw.preamble_mode", &urtw_preamble_mode); + +/* recognized device vendors/products */ +#define urtw_lookup(v, p) \ + ((const struct urtw_type *)usb_lookup(urtw_devs, v, p)) +#define URTW_DEV_B(v,p) \ + { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, URTW_REV_RTL8187B) } +#define URTW_DEV_L(v,p) \ + { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, URTW_REV_RTL8187L) } +#define URTW_REV_RTL8187B 0 +#define URTW_REV_RTL8187L 1 +static const struct usb2_device_id urtw_devs[] = { + { USB_VPI(USB_VENDOR_BELKIN, 0x705e, URTW_REV_RTL8187B) }, + { USB_VPI(USB_VENDOR_REALTEK, 0x8189, URTW_REV_RTL8187B) }, + { USB_VPI(USB_VENDOR_REALTEK, 0x8197, URTW_REV_RTL8187B) }, + { USB_VPI(USB_VENDOR_REALTEK, 0x8198, URTW_REV_RTL8187B) }, + { USB_VPI(USB_VENDOR_NETGEAR, 0x4260, URTW_REV_RTL8187B) }, + { USB_VPI(0x1b75, 0x8187, URTW_REV_RTL8187L) }, + { USB_VPI(USB_VENDOR_ASUS, 0x171d, URTW_REV_RTL8187L) }, + { USB_VPI(USB_VENDOR_DICKSMITH, 0x9401, URTW_REV_RTL8187L) }, + { USB_VPI(USB_VENDOR_HP, 0xca02, URTW_REV_RTL8187L) }, + { USB_VPI(USB_VENDOR_LOGITEC, 0x010c, URTW_REV_RTL8187L) }, + { USB_VPI(USB_VENDOR_NETGEAR, 0x6100, URTW_REV_RTL8187L) }, + URTW_DEV_L(NETGEAR, WG111V2), + URTW_DEV_L(REALTEK, RTL8187), + { USB_VPI(USB_VENDOR_SITECOMEU, 0x000d, URTW_REV_RTL8187L) }, + { USB_VPI(USB_VENDOR_SPHAIRON, 0x0150, URTW_REV_RTL8187L) }, + { USB_VPI(USB_VENDOR_SURECOM, 0x11f2, URTW_REV_RTL8187L) }, + { USB_VPI(USB_VENDOR_QCOM, 0x6232, URTW_REV_RTL8187L) }, +#undef URTW_DEV_L +#undef URTW_DEV_B +}; + +#define urtw_read8_m(sc, val, data) do { \ + error = urtw_read8_c(sc, val, data); \ + if (error != 0) \ + goto fail; \ +} while (0) +#define urtw_write8_m(sc, val, data) do { \ + error = urtw_write8_c(sc, val, data); \ + if (error != 0) \ + goto fail; \ +} while (0) +#define urtw_read16_m(sc, val, data) do { \ + error = urtw_read16_c(sc, val, data); \ + if (error != 0) \ + goto fail; \ +} while (0) +#define urtw_write16_m(sc, val, data) do { \ + error = urtw_write16_c(sc, val, data); \ + if (error != 0) \ + goto fail; \ +} while (0) +#define urtw_read32_m(sc, val, data) do { \ + error = urtw_read32_c(sc, val, data); \ + if (error != 0) \ + goto fail; \ +} while (0) +#define urtw_write32_m(sc, val, data) do { \ + error = urtw_write32_c(sc, val, data); \ + if (error != 0) \ + goto fail; \ +} while (0) +#define urtw_8187_write_phy_ofdm(sc, val, data) do { \ + error = urtw_8187_write_phy_ofdm_c(sc, val, data); \ + if (error != 0) \ + goto fail; \ +} while (0) +#define urtw_8187_write_phy_cck(sc, val, data) do { \ + error = urtw_8187_write_phy_cck_c(sc, val, data); \ + if (error != 0) \ + goto fail; \ +} while (0) +#define urtw_8225_write(sc, val, data) do { \ + error = urtw_8225_write_c(sc, val, data); \ + if (error != 0) \ + goto fail; \ +} while (0) + +struct urtw_pair { + uint32_t reg; + uint32_t val; +}; + +static uint8_t urtw_8225_agc[] = { + 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9d, 0x9c, 0x9b, + 0x9a, 0x99, 0x98, 0x97, 0x96, 0x95, 0x94, 0x93, 0x92, 0x91, 0x90, + 0x8f, 0x8e, 0x8d, 0x8c, 0x8b, 0x8a, 0x89, 0x88, 0x87, 0x86, 0x85, + 0x84, 0x83, 0x82, 0x81, 0x80, 0x3f, 0x3e, 0x3d, 0x3c, 0x3b, 0x3a, + 0x39, 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x30, 0x2f, + 0x2e, 0x2d, 0x2c, 0x2b, 0x2a, 0x29, 0x28, 0x27, 0x26, 0x25, 0x24, + 0x23, 0x22, 0x21, 0x20, 0x1f, 0x1e, 0x1d, 0x1c, 0x1b, 0x1a, 0x19, + 0x18, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0x0e, + 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, + 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 +}; + +static uint8_t urtw_8225z2_agc[] = { + 0x5e, 0x5e, 0x5e, 0x5e, 0x5d, 0x5b, 0x59, 0x57, 0x55, 0x53, 0x51, + 0x4f, 0x4d, 0x4b, 0x49, 0x47, 0x45, 0x43, 0x41, 0x3f, 0x3d, 0x3b, + 0x39, 0x37, 0x35, 0x33, 0x31, 0x2f, 0x2d, 0x2b, 0x29, 0x27, 0x25, + 0x23, 0x21, 0x1f, 0x1d, 0x1b, 0x19, 0x17, 0x15, 0x13, 0x11, 0x0f, + 0x0d, 0x0b, 0x09, 0x07, 0x05, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x19, 0x19, + 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x20, 0x21, 0x22, 0x23, + 0x24, 0x25, 0x26, 0x26, 0x27, 0x27, 0x28, 0x28, 0x29, 0x2a, 0x2a, + 0x2a, 0x2b, 0x2b, 0x2b, 0x2c, 0x2c, 0x2c, 0x2d, 0x2d, 0x2d, 0x2d, + 0x2e, 0x2e, 0x2e, 0x2e, 0x2f, 0x2f, 0x2f, 0x30, 0x30, 0x31, 0x31, + 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, + 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31 +}; + +static uint32_t urtw_8225_channel[] = { + 0x0000, /* dummy channel 0 */ + 0x085c, /* 1 */ + 0x08dc, /* 2 */ + 0x095c, /* 3 */ + 0x09dc, /* 4 */ + 0x0a5c, /* 5 */ + 0x0adc, /* 6 */ + 0x0b5c, /* 7 */ + 0x0bdc, /* 8 */ + 0x0c5c, /* 9 */ + 0x0cdc, /* 10 */ + 0x0d5c, /* 11 */ + 0x0ddc, /* 12 */ + 0x0e5c, /* 13 */ + 0x0f72, /* 14 */ +}; + +static uint8_t urtw_8225_gain[] = { + 0x23, 0x88, 0x7c, 0xa5, /* -82dbm */ + 0x23, 0x88, 0x7c, 0xb5, /* -82dbm */ + 0x23, 0x88, 0x7c, 0xc5, /* -82dbm */ + 0x33, 0x80, 0x79, 0xc5, /* -78dbm */ + 0x43, 0x78, 0x76, 0xc5, /* -74dbm */ + 0x53, 0x60, 0x73, 0xc5, /* -70dbm */ + 0x63, 0x58, 0x70, 0xc5, /* -66dbm */ +}; + +static struct urtw_pair urtw_8225_rf_part1[] = { + { 0x00, 0x0067 }, { 0x01, 0x0fe0 }, { 0x02, 0x044d }, { 0x03, 0x0441 }, + { 0x04, 0x0486 }, { 0x05, 0x0bc0 }, { 0x06, 0x0ae6 }, { 0x07, 0x082a }, + { 0x08, 0x001f }, { 0x09, 0x0334 }, { 0x0a, 0x0fd4 }, { 0x0b, 0x0391 }, + { 0x0c, 0x0050 }, { 0x0d, 0x06db }, { 0x0e, 0x0029 }, { 0x0f, 0x0914 }, +}; + +static struct urtw_pair urtw_8225_rf_part2[] = { + { 0x00, 0x01 }, { 0x01, 0x02 }, { 0x02, 0x42 }, { 0x03, 0x00 }, + { 0x04, 0x00 }, { 0x05, 0x00 }, { 0x06, 0x40 }, { 0x07, 0x00 }, + { 0x08, 0x40 }, { 0x09, 0xfe }, { 0x0a, 0x09 }, { 0x0b, 0x80 }, + { 0x0c, 0x01 }, { 0x0e, 0xd3 }, { 0x0f, 0x38 }, { 0x10, 0x84 }, + { 0x11, 0x06 }, { 0x12, 0x20 }, { 0x13, 0x20 }, { 0x14, 0x00 }, + { 0x15, 0x40 }, { 0x16, 0x00 }, { 0x17, 0x40 }, { 0x18, 0xef }, + { 0x19, 0x19 }, { 0x1a, 0x20 }, { 0x1b, 0x76 }, { 0x1c, 0x04 }, + { 0x1e, 0x95 }, { 0x1f, 0x75 }, { 0x20, 0x1f }, { 0x21, 0x27 }, + { 0x22, 0x16 }, { 0x24, 0x46 }, { 0x25, 0x20 }, { 0x26, 0x90 }, + { 0x27, 0x88 } +}; + +static struct urtw_pair urtw_8225_rf_part3[] = { + { 0x00, 0x98 }, { 0x03, 0x20 }, { 0x04, 0x7e }, { 0x05, 0x12 }, + { 0x06, 0xfc }, { 0x07, 0x78 }, { 0x08, 0x2e }, { 0x10, 0x9b }, + { 0x11, 0x88 }, { 0x12, 0x47 }, { 0x13, 0xd0 }, { 0x19, 0x00 }, + { 0x1a, 0xa0 }, { 0x1b, 0x08 }, { 0x40, 0x86 }, { 0x41, 0x8d }, + { 0x42, 0x15 }, { 0x43, 0x18 }, { 0x44, 0x1f }, { 0x45, 0x1e }, + { 0x46, 0x1a }, { 0x47, 0x15 }, { 0x48, 0x10 }, { 0x49, 0x0a }, + { 0x4a, 0x05 }, { 0x4b, 0x02 }, { 0x4c, 0x05 } +}; + +static uint16_t urtw_8225_rxgain[] = { + 0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409, + 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541, + 0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583, + 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644, + 0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688, + 0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745, + 0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789, + 0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793, + 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d, + 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9, + 0x07aa, 0x07ab, 0x07ac, 0x07ad, 0x07b0, 0x07b1, 0x07b2, 0x07b3, + 0x07b4, 0x07b5, 0x07b8, 0x07b9, 0x07ba, 0x07bb, 0x07bb +}; + +static uint8_t urtw_8225_threshold[] = { + 0x8d, 0x8d, 0x8d, 0x8d, 0x9d, 0xad, 0xbd, +}; + +static uint8_t urtw_8225_tx_gain_cck_ofdm[] = { + 0x02, 0x06, 0x0e, 0x1e, 0x3e, 0x7e +}; + +static uint8_t urtw_8225_txpwr_cck[] = { + 0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02, + 0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02, + 0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02, + 0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02, + 0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03, + 0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03 +}; + +static uint8_t urtw_8225_txpwr_cck_ch14[] = { + 0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00, + 0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00, + 0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00, + 0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00, + 0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00 +}; + +static uint8_t urtw_8225_txpwr_ofdm[]={ + 0x80, 0x90, 0xa2, 0xb5, 0xcb, 0xe4 +}; + +static uint8_t urtw_8225v2_gain_bg[]={ + 0x23, 0x15, 0xa5, /* -82-1dbm */ + 0x23, 0x15, 0xb5, /* -82-2dbm */ + 0x23, 0x15, 0xc5, /* -82-3dbm */ + 0x33, 0x15, 0xc5, /* -78dbm */ + 0x43, 0x15, 0xc5, /* -74dbm */ + 0x53, 0x15, 0xc5, /* -70dbm */ + 0x63, 0x15, 0xc5, /* -66dbm */ +}; + +static struct urtw_pair urtw_8225v2_rf_part1[] = { + { 0x00, 0x02bf }, { 0x01, 0x0ee0 }, { 0x02, 0x044d }, { 0x03, 0x0441 }, + { 0x04, 0x08c3 }, { 0x05, 0x0c72 }, { 0x06, 0x00e6 }, { 0x07, 0x082a }, + { 0x08, 0x003f }, { 0x09, 0x0335 }, { 0x0a, 0x09d4 }, { 0x0b, 0x07bb }, + { 0x0c, 0x0850 }, { 0x0d, 0x0cdf }, { 0x0e, 0x002b }, { 0x0f, 0x0114 } +}; + +static struct urtw_pair urtw_8225v2b_rf_part1[] = { + { 0x00, 0x00b7 }, { 0x01, 0x0ee0 }, { 0x02, 0x044d }, { 0x03, 0x0441 }, + { 0x04, 0x08c3 }, { 0x05, 0x0c72 }, { 0x06, 0x00e6 }, { 0x07, 0x082a }, + { 0x08, 0x003f }, { 0x09, 0x0335 }, { 0x0a, 0x09d4 }, { 0x0b, 0x07bb }, + { 0x0c, 0x0850 }, { 0x0d, 0x0cdf }, { 0x0e, 0x002b }, { 0x0f, 0x0114 } +}; + +static struct urtw_pair urtw_8225v2_rf_part2[] = { + { 0x00, 0x01 }, { 0x01, 0x02 }, { 0x02, 0x42 }, { 0x03, 0x00 }, + { 0x04, 0x00 }, { 0x05, 0x00 }, { 0x06, 0x40 }, { 0x07, 0x00 }, + { 0x08, 0x40 }, { 0x09, 0xfe }, { 0x0a, 0x08 }, { 0x0b, 0x80 }, + { 0x0c, 0x01 }, { 0x0d, 0x43 }, { 0x0e, 0xd3 }, { 0x0f, 0x38 }, + { 0x10, 0x84 }, { 0x11, 0x07 }, { 0x12, 0x20 }, { 0x13, 0x20 }, + { 0x14, 0x00 }, { 0x15, 0x40 }, { 0x16, 0x00 }, { 0x17, 0x40 }, + { 0x18, 0xef }, { 0x19, 0x19 }, { 0x1a, 0x20 }, { 0x1b, 0x15 }, + { 0x1c, 0x04 }, { 0x1d, 0xc5 }, { 0x1e, 0x95 }, { 0x1f, 0x75 }, + { 0x20, 0x1f }, { 0x21, 0x17 }, { 0x22, 0x16 }, { 0x23, 0x80 }, + { 0x24, 0x46 }, { 0x25, 0x00 }, { 0x26, 0x90 }, { 0x27, 0x88 } +}; + +static struct urtw_pair urtw_8225v2b_rf_part2[] = { + { 0x00, 0x10 }, { 0x01, 0x0d }, { 0x02, 0x01 }, { 0x03, 0x00 }, + { 0x04, 0x14 }, { 0x05, 0xfb }, { 0x06, 0xfb }, { 0x07, 0x60 }, + { 0x08, 0x00 }, { 0x09, 0x60 }, { 0x0a, 0x00 }, { 0x0b, 0x00 }, + { 0x0c, 0x00 }, { 0x0d, 0x5c }, { 0x0e, 0x00 }, { 0x0f, 0x00 }, + { 0x10, 0x40 }, { 0x11, 0x00 }, { 0x12, 0x40 }, { 0x13, 0x00 }, + { 0x14, 0x00 }, { 0x15, 0x00 }, { 0x16, 0xa8 }, { 0x17, 0x26 }, + { 0x18, 0x32 }, { 0x19, 0x33 }, { 0x1a, 0x07 }, { 0x1b, 0xa5 }, + { 0x1c, 0x6f }, { 0x1d, 0x55 }, { 0x1e, 0xc8 }, { 0x1f, 0xb3 }, + { 0x20, 0x0a }, { 0x21, 0xe1 }, { 0x22, 0x2C }, { 0x23, 0x8a }, + { 0x24, 0x86 }, { 0x25, 0x83 }, { 0x26, 0x34 }, { 0x27, 0x0f }, + { 0x28, 0x4f }, { 0x29, 0x24 }, { 0x2a, 0x6f }, { 0x2b, 0xc2 }, + { 0x2c, 0x6b }, { 0x2d, 0x40 }, { 0x2e, 0x80 }, { 0x2f, 0x00 }, + { 0x30, 0xc0 }, { 0x31, 0xc1 }, { 0x32, 0x58 }, { 0x33, 0xf1 }, + { 0x34, 0x00 }, { 0x35, 0xe4 }, { 0x36, 0x90 }, { 0x37, 0x3e }, + { 0x38, 0x6d }, { 0x39, 0x3c }, { 0x3a, 0xfb }, { 0x3b, 0x07 } +}; + +static struct urtw_pair urtw_8225v2_rf_part3[] = { + { 0x00, 0x98 }, { 0x03, 0x20 }, { 0x04, 0x7e }, { 0x05, 0x12 }, + { 0x06, 0xfc }, { 0x07, 0x78 }, { 0x08, 0x2e }, { 0x09, 0x11 }, + { 0x0a, 0x17 }, { 0x0b, 0x11 }, { 0x10, 0x9b }, { 0x11, 0x88 }, + { 0x12, 0x47 }, { 0x13, 0xd0 }, { 0x19, 0x00 }, { 0x1a, 0xa0 }, + { 0x1b, 0x08 }, { 0x1d, 0x00 }, { 0x40, 0x86 }, { 0x41, 0x9d }, + { 0x42, 0x15 }, { 0x43, 0x18 }, { 0x44, 0x36 }, { 0x45, 0x35 }, + { 0x46, 0x2e }, { 0x47, 0x25 }, { 0x48, 0x1c }, { 0x49, 0x12 }, + { 0x4a, 0x09 }, { 0x4b, 0x04 }, { 0x4c, 0x05 } +}; + +static uint16_t urtw_8225v2_rxgain[] = { + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0008, 0x0009, + 0x000a, 0x000b, 0x0102, 0x0103, 0x0104, 0x0105, 0x0140, 0x0141, + 0x0142, 0x0143, 0x0144, 0x0145, 0x0180, 0x0181, 0x0182, 0x0183, + 0x0184, 0x0185, 0x0188, 0x0189, 0x018a, 0x018b, 0x0243, 0x0244, + 0x0245, 0x0280, 0x0281, 0x0282, 0x0283, 0x0284, 0x0285, 0x0288, + 0x0289, 0x028a, 0x028b, 0x028c, 0x0342, 0x0343, 0x0344, 0x0345, + 0x0380, 0x0381, 0x0382, 0x0383, 0x0384, 0x0385, 0x0388, 0x0389, + 0x038a, 0x038b, 0x038c, 0x038d, 0x0390, 0x0391, 0x0392, 0x0393, + 0x0394, 0x0395, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, + 0x03a0, 0x03a1, 0x03a2, 0x03a3, 0x03a4, 0x03a5, 0x03a8, 0x03a9, + 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3, + 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb +}; + +static uint16_t urtw_8225v2b_rxgain[] = { + 0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409, + 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541, + 0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583, + 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644, + 0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688, + 0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745, + 0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789, + 0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793, + 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d, + 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9, + 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3, + 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb +}; + +static uint8_t urtw_8225v2_tx_gain_cck_ofdm[] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, + 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, + 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, + 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, +}; + +static uint8_t urtw_8225v2_txpwr_cck[] = { + 0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04 +}; + +static uint8_t urtw_8225v2_txpwr_cck_ch14[] = { + 0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00 +}; + +static uint8_t urtw_8225v2b_txpwr_cck[] = { + 0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04, + 0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03, + 0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03, + 0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03 +}; + +static uint8_t urtw_8225v2b_txpwr_cck_ch14[] = { + 0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00, + 0x30, 0x2f, 0x29, 0x15, 0x00, 0x00, 0x00, 0x00, + 0x30, 0x2f, 0x29, 0x15, 0x00, 0x00, 0x00, 0x00, + 0x30, 0x2f, 0x29, 0x15, 0x00, 0x00, 0x00, 0x00 +}; + +static struct urtw_pair urtw_ratetable[] = { + { 2, 0 }, { 4, 1 }, { 11, 2 }, { 12, 4 }, { 18, 5 }, + { 22, 3 }, { 24, 6 }, { 36, 7 }, { 48, 8 }, { 72, 9 }, + { 96, 10 }, { 108, 11 } +}; + +static const uint8_t urtw_8187b_reg_table[][3] = { + { 0xf0, 0x32, 0 }, { 0xf1, 0x32, 0 }, { 0xf2, 0x00, 0 }, + { 0xf3, 0x00, 0 }, { 0xf4, 0x32, 0 }, { 0xf5, 0x43, 0 }, + { 0xf6, 0x00, 0 }, { 0xf7, 0x00, 0 }, { 0xf8, 0x46, 0 }, + { 0xf9, 0xa4, 0 }, { 0xfa, 0x00, 0 }, { 0xfb, 0x00, 0 }, + { 0xfc, 0x96, 0 }, { 0xfd, 0xa4, 0 }, { 0xfe, 0x00, 0 }, + { 0xff, 0x00, 0 }, { 0x58, 0x4b, 1 }, { 0x59, 0x00, 1 }, + { 0x5a, 0x4b, 1 }, { 0x5b, 0x00, 1 }, { 0x60, 0x4b, 1 }, + { 0x61, 0x09, 1 }, { 0x62, 0x4b, 1 }, { 0x63, 0x09, 1 }, + { 0xce, 0x0f, 1 }, { 0xcf, 0x00, 1 }, { 0xe0, 0xff, 1 }, + { 0xe1, 0x0f, 1 }, { 0xe2, 0x00, 1 }, { 0xf0, 0x4e, 1 }, + { 0xf1, 0x01, 1 }, { 0xf2, 0x02, 1 }, { 0xf3, 0x03, 1 }, + { 0xf4, 0x04, 1 }, { 0xf5, 0x05, 1 }, { 0xf6, 0x06, 1 }, + { 0xf7, 0x07, 1 }, { 0xf8, 0x08, 1 }, { 0x4e, 0x00, 2 }, + { 0x0c, 0x04, 2 }, { 0x21, 0x61, 2 }, { 0x22, 0x68, 2 }, + { 0x23, 0x6f, 2 }, { 0x24, 0x76, 2 }, { 0x25, 0x7d, 2 }, + { 0x26, 0x84, 2 }, { 0x27, 0x8d, 2 }, { 0x4d, 0x08, 2 }, + { 0x50, 0x05, 2 }, { 0x51, 0xf5, 2 }, { 0x52, 0x04, 2 }, + { 0x53, 0xa0, 2 }, { 0x54, 0x1f, 2 }, { 0x55, 0x23, 2 }, + { 0x56, 0x45, 2 }, { 0x57, 0x67, 2 }, { 0x58, 0x08, 2 }, + { 0x59, 0x08, 2 }, { 0x5a, 0x08, 2 }, { 0x5b, 0x08, 2 }, + { 0x60, 0x08, 2 }, { 0x61, 0x08, 2 }, { 0x62, 0x08, 2 }, + { 0x63, 0x08, 2 }, { 0x64, 0xcf, 2 }, { 0x72, 0x56, 2 }, + { 0x73, 0x9a, 2 }, { 0x34, 0xf0, 0 }, { 0x35, 0x0f, 0 }, + { 0x5b, 0x40, 0 }, { 0x84, 0x88, 0 }, { 0x85, 0x24, 0 }, + { 0x88, 0x54, 0 }, { 0x8b, 0xb8, 0 }, { 0x8c, 0x07, 0 }, + { 0x8d, 0x00, 0 }, { 0x94, 0x1b, 0 }, { 0x95, 0x12, 0 }, + { 0x96, 0x00, 0 }, { 0x97, 0x06, 0 }, { 0x9d, 0x1a, 0 }, + { 0x9f, 0x10, 0 }, { 0xb4, 0x22, 0 }, { 0xbe, 0x80, 0 }, + { 0xdb, 0x00, 0 }, { 0xee, 0x00, 0 }, { 0x91, 0x03, 0 }, + { 0x4c, 0x00, 2 }, { 0x9f, 0x00, 3 }, { 0x8c, 0x01, 0 }, + { 0x8d, 0x10, 0 }, { 0x8e, 0x08, 0 }, { 0x8f, 0x00, 0 } +}; + +static usb2_callback_t urtw_bulk_rx_callback; +static usb2_callback_t urtw_bulk_tx_callback; + +static const struct usb2_config urtw_8187b_usbconfig[URTW_8187B_N_XFERS] = { + [URTW_8187B_BULK_RX] = { + .type = UE_BULK, + .endpoint = 0x83, + .direction = UE_DIR_IN, + .bufsize = MCLBYTES, + .flags = { + .ext_buffer = 1, + .pipe_bof = 1, + .short_xfer_ok = 1 + }, + .callback = urtw_bulk_rx_callback + }, + [URTW_8187B_BULK_TX_BE] = { + .type = UE_BULK, + .endpoint = URTW_8187B_TXPIPE_BE, + .direction = UE_DIR_OUT, + .bufsize = URTW_TX_MAXSIZE, + .flags = { + .ext_buffer = 1, + .force_short_xfer = 1, + .pipe_bof = 1, + }, + .callback = urtw_bulk_tx_callback, + .timeout = URTW_DATA_TIMEOUT + }, + [URTW_8187B_BULK_TX_BK] = { + .type = UE_BULK, + .endpoint = URTW_8187B_TXPIPE_BK, + .direction = UE_DIR_OUT, + .bufsize = URTW_TX_MAXSIZE, + .flags = { + .ext_buffer = 1, + .force_short_xfer = 1, + .pipe_bof = 1, + }, + .callback = urtw_bulk_tx_callback, + .timeout = URTW_DATA_TIMEOUT + }, + [URTW_8187B_BULK_TX_VI] = { + .type = UE_BULK, + .endpoint = URTW_8187B_TXPIPE_VI, + .direction = UE_DIR_OUT, + .bufsize = URTW_TX_MAXSIZE, + .flags = { + .ext_buffer = 1, + .force_short_xfer = 1, + .pipe_bof = 1, + }, + .callback = urtw_bulk_tx_callback, + .timeout = URTW_DATA_TIMEOUT + }, + [URTW_8187B_BULK_TX_VO] = { + .type = UE_BULK, + .endpoint = URTW_8187B_TXPIPE_VO, + .direction = UE_DIR_OUT, + .bufsize = URTW_TX_MAXSIZE, + .flags = { + .ext_buffer = 1, + .force_short_xfer = 1, + .pipe_bof = 1, + }, + .callback = urtw_bulk_tx_callback, + .timeout = URTW_DATA_TIMEOUT + }, + [URTW_8187B_BULK_TX_EP12] = { + .type = UE_BULK, + .endpoint = 0xc, + .direction = UE_DIR_OUT, + .bufsize = URTW_TX_MAXSIZE, + .flags = { + .ext_buffer = 1, + .force_short_xfer = 1, + .pipe_bof = 1, + }, + .callback = urtw_bulk_tx_callback, + .timeout = URTW_DATA_TIMEOUT + } +}; + +static const struct usb2_config urtw_8187l_usbconfig[URTW_8187L_N_XFERS] = { + [URTW_8187L_BULK_RX] = { + .type = UE_BULK, + .endpoint = 0x81, + .direction = UE_DIR_IN, + .bufsize = MCLBYTES, + .flags = { + .ext_buffer = 1, + .pipe_bof = 1, + .short_xfer_ok = 1 + }, + .callback = urtw_bulk_rx_callback + }, + [URTW_8187L_BULK_TX_LOW] = { + .type = UE_BULK, + .endpoint = 0x2, + .direction = UE_DIR_OUT, + .bufsize = URTW_TX_MAXSIZE, + .flags = { + .ext_buffer = 1, + .force_short_xfer = 1, + .pipe_bof = 1, + }, + .callback = urtw_bulk_tx_callback, + .timeout = URTW_DATA_TIMEOUT + }, + [URTW_8187L_BULK_TX_NORMAL] = { + .type = UE_BULK, + .endpoint = 0x3, + .direction = UE_DIR_OUT, + .bufsize = URTW_TX_MAXSIZE, + .flags = { + .ext_buffer = 1, + .force_short_xfer = 1, + .pipe_bof = 1, + }, + .callback = urtw_bulk_tx_callback, + .timeout = URTW_DATA_TIMEOUT + }, +}; + +static struct ieee80211vap *urtw_vap_create(struct ieee80211com *, + const char name[IFNAMSIZ], int unit, int opmode, + int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]); +static void urtw_vap_delete(struct ieee80211vap *); +static void urtw_init(void *); +static void urtw_stop(struct ifnet *, int); +static void urtw_stop_locked(struct ifnet *, int); +static int urtw_ioctl(struct ifnet *, u_long, caddr_t); +static void urtw_start(struct ifnet *); +static int urtw_alloc_rx_data_list(struct urtw_softc *); +static int urtw_alloc_tx_data_list(struct urtw_softc *); +static int urtw_raw_xmit(struct ieee80211_node *, struct mbuf *, + const struct ieee80211_bpf_params *); +static void urtw_scan_start(struct ieee80211com *); +static void urtw_scan_end(struct ieee80211com *); +static void urtw_set_channel(struct ieee80211com *); +static void urtw_update_mcast(struct ifnet *); +static int urtw_tx_start(struct urtw_softc *, + struct ieee80211_node *, struct mbuf *, + struct urtw_data *, int); +static int urtw_newstate(struct ieee80211vap *, + enum ieee80211_state, int); +static void urtw_led_ch(void *); +static void urtw_ledtask(void *, int); +static void urtw_watchdog(void *); +static void urtw_set_multi(void *); +static int urtw_isbmode(uint16_t); +static uint16_t urtw_rate2rtl(int); +static uint16_t urtw_rtl2rate(int); +static usb2_error_t urtw_set_rate(struct urtw_softc *); +static usb2_error_t urtw_update_msr(struct urtw_softc *); +static usb2_error_t urtw_read8_c(struct urtw_softc *, int, uint8_t *); +static usb2_error_t urtw_read16_c(struct urtw_softc *, int, uint16_t *); +static usb2_error_t urtw_read32_c(struct urtw_softc *, int, uint32_t *); +static usb2_error_t urtw_write8_c(struct urtw_softc *, int, uint8_t); +static usb2_error_t urtw_write16_c(struct urtw_softc *, int, uint16_t); +static usb2_error_t urtw_write32_c(struct urtw_softc *, int, uint32_t); +static usb2_error_t urtw_eprom_cs(struct urtw_softc *, int); +static usb2_error_t urtw_eprom_ck(struct urtw_softc *); +static usb2_error_t urtw_eprom_sendbits(struct urtw_softc *, int16_t *, + int); +static usb2_error_t urtw_eprom_read32(struct urtw_softc *, uint32_t, + uint32_t *); +static usb2_error_t urtw_eprom_readbit(struct urtw_softc *, int16_t *); +static usb2_error_t urtw_eprom_writebit(struct urtw_softc *, int16_t); +static usb2_error_t urtw_get_macaddr(struct urtw_softc *); +static usb2_error_t urtw_get_txpwr(struct urtw_softc *); +static usb2_error_t urtw_get_rfchip(struct urtw_softc *); +static usb2_error_t urtw_led_init(struct urtw_softc *); +static usb2_error_t urtw_8185_rf_pins_enable(struct urtw_softc *); +static usb2_error_t urtw_8185_tx_antenna(struct urtw_softc *, uint8_t); +static usb2_error_t urtw_8187_write_phy(struct urtw_softc *, uint8_t, + uint32_t); +static usb2_error_t urtw_8187_write_phy_ofdm_c(struct urtw_softc *, + uint8_t, uint32_t); +static usb2_error_t urtw_8187_write_phy_cck_c(struct urtw_softc *, uint8_t, + uint32_t); +static usb2_error_t urtw_8225_setgain(struct urtw_softc *, int16_t); +static usb2_error_t urtw_8225_usb_init(struct urtw_softc *); +static usb2_error_t urtw_8225_write_c(struct urtw_softc *, uint8_t, + uint16_t); +static usb2_error_t urtw_8225_write_s16(struct urtw_softc *, uint8_t, int, + uint16_t *); +static usb2_error_t urtw_8225_read(struct urtw_softc *, uint8_t, + uint32_t *); +static usb2_error_t urtw_8225_rf_init(struct urtw_softc *); +static usb2_error_t urtw_8225_rf_set_chan(struct urtw_softc *, int); +static usb2_error_t urtw_8225_rf_set_sens(struct urtw_softc *, int); +static usb2_error_t urtw_8225_set_txpwrlvl(struct urtw_softc *, int); +static usb2_error_t urtw_8225_rf_stop(struct urtw_softc *); +static usb2_error_t urtw_8225v2_rf_init(struct urtw_softc *); +static usb2_error_t urtw_8225v2_rf_set_chan(struct urtw_softc *, int); +static usb2_error_t urtw_8225v2_set_txpwrlvl(struct urtw_softc *, int); +static usb2_error_t urtw_8225v2_setgain(struct urtw_softc *, int16_t); +static usb2_error_t urtw_8225_isv2(struct urtw_softc *, int *); +static usb2_error_t urtw_8225v2b_rf_init(struct urtw_softc *); +static usb2_error_t urtw_8225v2b_rf_set_chan(struct urtw_softc *, int); +static usb2_error_t urtw_read8e(struct urtw_softc *, int, uint8_t *); +static usb2_error_t urtw_write8e(struct urtw_softc *, int, uint8_t); +static usb2_error_t urtw_8180_set_anaparam(struct urtw_softc *, uint32_t); +static usb2_error_t urtw_8185_set_anaparam2(struct urtw_softc *, uint32_t); +static usb2_error_t urtw_intr_enable(struct urtw_softc *); +static usb2_error_t urtw_intr_disable(struct urtw_softc *); +static usb2_error_t urtw_reset(struct urtw_softc *); +static usb2_error_t urtw_led_on(struct urtw_softc *, int); +static usb2_error_t urtw_led_ctl(struct urtw_softc *, int); +static usb2_error_t urtw_led_blink(struct urtw_softc *); +static usb2_error_t urtw_led_mode0(struct urtw_softc *, int); +static usb2_error_t urtw_led_mode1(struct urtw_softc *, int); +static usb2_error_t urtw_led_mode2(struct urtw_softc *, int); +static usb2_error_t urtw_led_mode3(struct urtw_softc *, int); +static usb2_error_t urtw_rx_setconf(struct urtw_softc *); +static usb2_error_t urtw_rx_enable(struct urtw_softc *); +static usb2_error_t urtw_tx_enable(struct urtw_softc *sc); +static void urtw_free_tx_data_list(struct urtw_softc *); +static void urtw_free_rx_data_list(struct urtw_softc *); +static void urtw_free_data_list(struct urtw_softc *, + struct urtw_data data[], int, int); +static usb2_error_t urtw_adapter_start(struct urtw_softc *); +static usb2_error_t urtw_adapter_start_b(struct urtw_softc *); +static usb2_error_t urtw_set_mode(struct urtw_softc *, uint32_t); +static usb2_error_t urtw_8187b_cmd_reset(struct urtw_softc *); +static usb2_error_t urtw_write16_i(struct urtw_softc *, int, uint16_t, int); +static usb2_error_t urtw_write8_i(struct urtw_softc *, int, uint8_t, int); +static usb2_error_t urtw_write32_i(struct urtw_softc *, int, uint32_t, int); +static usb2_error_t urtw_do_request(struct urtw_softc *, + struct usb2_device_request *, void *); +static usb2_error_t urtw_8225v2b_set_txpwrlvl(struct urtw_softc *, int); +static usb2_error_t urtw_led_off(struct urtw_softc *, int); +static void urtw_abort_xfers(struct urtw_softc *); +static struct urtw_data * + urtw_getbuf(struct urtw_softc *sc); + +static int +urtw_match(device_t dev) +{ + struct usb2_attach_arg *uaa = device_get_ivars(dev); + + if (uaa->usb_mode != USB_MODE_HOST) + return (ENXIO); + if (uaa->info.bConfigIndex != URTW_CONFIG_INDEX) + return (ENXIO); + if (uaa->info.bIfaceIndex != URTW_IFACE_INDEX) + return (ENXIO); + + return (usb2_lookup_id_by_uaa(urtw_devs, sizeof(urtw_devs), uaa)); +} + +static int +urtw_attach(device_t dev) +{ + const struct usb2_config *setup_start; + int ret = ENXIO; + struct urtw_softc *sc = device_get_softc(dev); + struct usb2_attach_arg *uaa = device_get_ivars(dev); + struct ieee80211com *ic; + struct ifnet *ifp; + uint8_t bands, iface_index = URTW_IFACE_INDEX; /* XXX */ + uint16_t n_setup; + uint32_t data; + usb2_error_t error; + + device_set_usb2_desc(dev); + + sc->sc_dev = dev; + sc->sc_udev = uaa->device; + if (USB_GET_DRIVER_INFO(uaa) == URTW_REV_RTL8187B) + sc->sc_flags |= URTW_RTL8187B; +#ifdef URTW_DEBUG + sc->sc_debug = urtw_debug; +#endif + + mtx_init(&sc->sc_mtx, device_get_nameunit(sc->sc_dev), MTX_NETWORK_LOCK, + MTX_DEF); + usb2_callout_init_mtx(&sc->sc_led_ch, &sc->sc_mtx, 0); + TASK_INIT(&sc->sc_led_task, 0, urtw_ledtask, sc); + callout_init(&sc->sc_watchdog_ch, 0); + + if (sc->sc_flags & URTW_RTL8187B) { + setup_start = urtw_8187b_usbconfig; + n_setup = URTW_8187B_N_XFERS; + } else { + setup_start = urtw_8187l_usbconfig; + n_setup = URTW_8187L_N_XFERS; + } + + error = usb2_transfer_setup(uaa->device, &iface_index, sc->sc_xfer, + setup_start, n_setup, sc, &sc->sc_mtx); + if (error) { + device_printf(dev, "could not allocate USB transfers, " + "err=%s\n", usb2_errstr(error)); + ret = ENXIO; + goto fail0; + } + + URTW_LOCK(sc); + + urtw_read32_m(sc, URTW_RX, &data); + sc->sc_epromtype = (data & URTW_RX_9356SEL) ? URTW_EEPROM_93C56 : + URTW_EEPROM_93C46; + + error = urtw_get_rfchip(sc); + if (error != 0) + goto fail; + error = urtw_get_macaddr(sc); + if (error != 0) + goto fail; + error = urtw_get_txpwr(sc); + if (error != 0) + goto fail; + error = urtw_led_init(sc); + if (error != 0) + goto fail; + + URTW_UNLOCK(sc); + + sc->sc_rts_retry = URTW_DEFAULT_RTS_RETRY; + sc->sc_tx_retry = URTW_DEFAULT_TX_RETRY; + sc->sc_currate = 3; + sc->sc_preamble_mode = urtw_preamble_mode; + + ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211); + if (ifp == NULL) { + device_printf(sc->sc_dev, "can not allocate ifnet\n"); + ret = ENOMEM; + goto fail1; + } + + ifp->if_softc = sc; + if_initname(ifp, "urtw", device_get_unit(sc->sc_dev)); + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_init = urtw_init; + ifp->if_ioctl = urtw_ioctl; + ifp->if_start = urtw_start; + /* XXX URTW_TX_DATA_LIST_COUNT */ + IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); + ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_READY(&ifp->if_snd); + + ic = ifp->if_l2com; + ic->ic_ifp = ifp; + ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */ + ic->ic_opmode = IEEE80211_M_STA; /* default to BSS mode */ + + /* set device capabilities */ + ic->ic_caps = + IEEE80211_C_STA | /* station mode */ + IEEE80211_C_MONITOR | /* monitor mode supported */ + IEEE80211_C_TXPMGT | /* tx power management */ + IEEE80211_C_SHPREAMBLE | /* short preamble supported */ + IEEE80211_C_SHSLOT | /* short slot time supported */ + IEEE80211_C_BGSCAN | /* capable of bg scanning */ + IEEE80211_C_WPA; /* 802.11i */ + + bands = 0; + setbit(&bands, IEEE80211_MODE_11B); + setbit(&bands, IEEE80211_MODE_11G); + ieee80211_init_channels(ic, NULL, &bands); + + ieee80211_ifattach(ic, sc->sc_bssid); + ic->ic_raw_xmit = urtw_raw_xmit; + ic->ic_scan_start = urtw_scan_start; + ic->ic_scan_end = urtw_scan_end; + ic->ic_set_channel = urtw_set_channel; + + ic->ic_vap_create = urtw_vap_create; + ic->ic_vap_delete = urtw_vap_delete; + ic->ic_update_mcast = urtw_update_mcast; + + ieee80211_radiotap_attach(ic, + &sc->sc_txtap.wt_ihdr, sizeof(sc->sc_txtap), + URTW_TX_RADIOTAP_PRESENT, + &sc->sc_rxtap.wr_ihdr, sizeof(sc->sc_rxtap), + URTW_RX_RADIOTAP_PRESENT); + + if (bootverbose) + ieee80211_announce(ic); + return (0); + +fail: URTW_UNLOCK(sc); +fail1: usb2_transfer_unsetup(sc->sc_xfer, (sc->sc_flags & URTW_RTL8187B) ? + URTW_8187B_N_XFERS : URTW_8187L_N_XFERS); +fail0: + return (ret); +} + +static int +urtw_detach(device_t dev) +{ + struct urtw_softc *sc = device_get_softc(dev); + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + + if (!device_is_attached(dev)) + return (0); + + urtw_stop(ifp, 1); + ieee80211_draintask(ic, &sc->sc_led_task); + + usb2_callout_drain(&sc->sc_led_ch); + callout_drain(&sc->sc_watchdog_ch); + + usb2_transfer_unsetup(sc->sc_xfer, (sc->sc_flags & URTW_RTL8187B) ? + URTW_8187B_N_XFERS : URTW_8187L_N_XFERS); + ieee80211_ifdetach(ic); + + urtw_free_tx_data_list(sc); + urtw_free_rx_data_list(sc); + + if_free(ifp); + mtx_destroy(&sc->sc_mtx); + + return (0); +} + +static void +urtw_free_tx_data_list(struct urtw_softc *sc) +{ + + urtw_free_data_list(sc, sc->sc_tx, URTW_TX_DATA_LIST_COUNT, 0); +} + +static void +urtw_free_rx_data_list(struct urtw_softc *sc) +{ + + urtw_free_data_list(sc, sc->sc_rx, URTW_RX_DATA_LIST_COUNT, 1); +} + +static void +urtw_free_data_list(struct urtw_softc *sc, struct urtw_data data[], int ndata, + int fillmbuf) +{ + int i; + + for (i = 0; i < ndata; i++) { + struct urtw_data *dp = &data[i]; + + if (fillmbuf == 1) { + if (dp->m != NULL) { + m_freem(dp->m); + dp->m = NULL; + dp->buf = NULL; + } + } else { + if (dp->buf != NULL) { + free(dp->buf, M_USBDEV); + dp->buf = NULL; + } + } + if (dp->ni != NULL) { + ieee80211_free_node(dp->ni); + dp->ni = NULL; + } + } +} + +static struct ieee80211vap * +urtw_vap_create(struct ieee80211com *ic, + const char name[IFNAMSIZ], int unit, int opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) +{ + struct urtw_vap *uvp; + struct ieee80211vap *vap; + + if (!TAILQ_EMPTY(&ic->ic_vaps)) /* only one at a time */ + return (NULL); + uvp = (struct urtw_vap *) malloc(sizeof(struct urtw_vap), + M_80211_VAP, M_NOWAIT | M_ZERO); + if (uvp == NULL) + return (NULL); + vap = &uvp->vap; + /* enable s/w bmiss handling for sta mode */ + ieee80211_vap_setup(ic, vap, name, unit, opmode, + flags | IEEE80211_CLONE_NOBEACONS, bssid, mac); + + /* override state transition machine */ + uvp->newstate = vap->iv_newstate; + vap->iv_newstate = urtw_newstate; + + /* complete setup */ + ieee80211_vap_attach(vap, ieee80211_media_change, + ieee80211_media_status); + ic->ic_opmode = opmode; + return (vap); +} + +static void +urtw_vap_delete(struct ieee80211vap *vap) +{ + struct urtw_vap *uvp = URTW_VAP(vap); + + ieee80211_vap_detach(vap); + free(uvp, M_80211_VAP); +} + +static void +urtw_init_locked(void *arg) +{ + int ret; + struct urtw_softc *sc = arg; + struct ifnet *ifp = sc->sc_ifp; + usb2_error_t error; + + if (ifp->if_drv_flags & IFF_DRV_RUNNING) + urtw_stop_locked(ifp, 0); + + error = (sc->sc_flags & URTW_RTL8187B) ? urtw_adapter_start_b(sc) : + urtw_adapter_start(sc); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed May 27 05:37:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 239ED1065672; Wed, 27 May 2009 05:37:05 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC4F58FC14; Wed, 27 May 2009 05:37:04 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4R5b4lD084959; Wed, 27 May 2009 05:37:04 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4R5b4Ma084958; Wed, 27 May 2009 05:37:04 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <200905270537.n4R5b4Ma084958@svn.freebsd.org> From: Adrian Chadd Date: Wed, 27 May 2009 05:37:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192875 - head/sys/dev/xen/netfront X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2009 05:37:05 -0000 Author: adrian Date: Wed May 27 05:37:04 2009 New Revision: 192875 URL: http://svn.freebsd.org/changeset/base/192875 Log: Comment tidyup; comment where the next explicit check should appear. Modified: head/sys/dev/xen/netfront/netfront.c Modified: head/sys/dev/xen/netfront/netfront.c ============================================================================== --- head/sys/dev/xen/netfront/netfront.c Wed May 27 05:18:13 2009 (r192874) +++ head/sys/dev/xen/netfront/netfront.c Wed May 27 05:37:04 2009 (r192875) @@ -1446,30 +1446,42 @@ xn_start_locked(struct ifnet *ifp) nfrags++; /* - * Don't attempt to queue this packet if there aren't enough free entries in the chain. - * There isn't a 1:1 correspondance between the mbuf TX ring and the xenbus TX ring. + * Don't attempt to queue this packet if there aren't + * enough free entries in the chain. + * + * There isn't a 1:1 correspondance between the mbuf TX ring + * and the xenbus TX ring. * xn_txeof() may need to be called to free up some slots. * - * It is quite possible that this can be later eliminated if it turns out that partial - * packets can be pushed into the ringbuffer, with fragments pushed in when further slots + * It is quite possible that this can be later eliminated if + * it turns out that partial * packets can be pushed into + * the ringbuffer, with fragments pushed in when further slots * free up. * - * It is also quite possible that the driver will lock up - Xen may not send another - * interrupt to kick the tx/rx processing if the xenbus RX ring is full and xenbus TX ring - * is empty - no further TX work can be done until space is made in the TX mbuf ring and - * the RX side may be waiting for TX data to continue. It is quite possible some timer - * event should be created to kick TX/RX processing along in certain conditions. + * It is also quite possible that the driver will lock up + * if the TX queue fills up with no RX traffic, and + * the mbuf ring is exhausted. The queue may need + * a swift kick to continue. */ - /* its not +1 like the allocation because we need to keep slot [0] free for the freelist head */ + /* + * It is not +1 like the allocation because we need to keep + * slot [0] free for the freelist head + */ if (sc->xn_cdata.xn_tx_chain_cnt + nfrags >= NET_TX_RING_SIZE) { printf("xn_start_locked: xn_tx_chain_cnt (%d) + nfrags %d >= NET_TX_RING_SIZE (%d); must be full!\n", - (int) sc->xn_cdata.xn_tx_chain_cnt, (int) nfrags, (int) NET_TX_RING_SIZE); + (int) sc->xn_cdata.xn_tx_chain_cnt, + (int) nfrags, (int) NET_TX_RING_SIZE); IF_PREPEND(&ifp->if_snd, m_head); ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } + /* + * XXX TODO - make sure there's actually space available + * in the Xen TX ring for this rather than the hacky way + * its currently done. + */ /* * Start packing the mbufs in this chain into From owner-svn-src-head@FreeBSD.ORG Wed May 27 06:04:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CBEE106566B; Wed, 27 May 2009 06:04:38 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8BBAF8FC13; Wed, 27 May 2009 06:04:38 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4R64ctf085520; Wed, 27 May 2009 06:04:38 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4R64cRR085519; Wed, 27 May 2009 06:04:38 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <200905270604.n4R64cRR085519@svn.freebsd.org> From: Adrian Chadd Date: Wed, 27 May 2009 06:04:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192876 - head/sys/dev/xen/netfront X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2009 06:04:39 -0000 Author: adrian Date: Wed May 27 06:04:38 2009 New Revision: 192876 URL: http://svn.freebsd.org/changeset/base/192876 Log: Enforce that there are actually enough xenbus TX ring descriptors available before attempting to queue the packet. Modified: head/sys/dev/xen/netfront/netfront.c Modified: head/sys/dev/xen/netfront/netfront.c ============================================================================== --- head/sys/dev/xen/netfront/netfront.c Wed May 27 05:37:04 2009 (r192875) +++ head/sys/dev/xen/netfront/netfront.c Wed May 27 06:04:38 2009 (r192876) @@ -1478,10 +1478,20 @@ xn_start_locked(struct ifnet *ifp) } /* - * XXX TODO - make sure there's actually space available - * in the Xen TX ring for this rather than the hacky way - * its currently done. + * Make sure there's actually space available in the + * Xen TX ring for this. Overcompensate for the possibility + * of having a TCP offload fragment just in case for now + * (the +1) rather than adding logic to accurately calculate + * the required size. */ + if (RING_FREE_REQUESTS(&sc->tx) < (nfrags + 1)) { + printf("xn_start_locked: free ring slots (%d) < (nfrags + 1) (%d); must be full!\n", + (int) RING_FREE_REQUESTS(&sc->tx), + (int) (nfrags + 1)); + IF_PREPEND(&ifp->if_snd, m_head); + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + break; + } /* * Start packing the mbufs in this chain into From owner-svn-src-head@FreeBSD.ORG Wed May 27 07:14:34 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB8331065673; Wed, 27 May 2009 07:14:34 +0000 (UTC) (envelope-from maxim@macomnet.ru) Received: from mp2.macomnet.net (cl-2958.ham-01.de.sixxs.net [IPv6:2001:6f8:900:b8d::2]) by mx1.freebsd.org (Postfix) with ESMTP id 2032F8FC1E; Wed, 27 May 2009 07:14:33 +0000 (UTC) (envelope-from maxim@macomnet.ru) Received: from localhost (localhost [127.0.0.1]) by mp2.macomnet.net (8.14.3/8.14.3) with ESMTP id n4R7EVwI027213; Wed, 27 May 2009 11:14:32 +0400 (MSD) (envelope-from maxim@macomnet.ru) Date: Wed, 27 May 2009 11:14:31 +0400 (MSD) From: Maxim Konovalov To: Stacey Son In-Reply-To: <200905270130.n4R1UNxC079783@svn.freebsd.org> Message-ID: <20090527111413.S94371@mp2.macomnet.net> References: <200905270130.n4R1UNxC079783@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG Subject: Re: svn commit: r192867 - in head/cddl: contrib/opensolaris/cmd/lockstat usr.sbin usr.sbin/lockstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2009 07:14:35 -0000 On Wed, 27 May 2009, 01:30-0000, Stacey Son wrote: > Author: sson > Date: Wed May 27 01:30:23 2009 > New Revision: 192867 > URL: http://svn.freebsd.org/changeset/base/192867 > > Log: > Add the OpenSolaris lockstat(1M) command. Requires the dtrace driver, > the lockstat provider, and the ksyms(4) pseudo driver kernel modules. > Wow, very cool. -- Maxim Konovalov From owner-svn-src-head@FreeBSD.ORG Wed May 27 07:22:49 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2C761065672; Wed, 27 May 2009 07:22:49 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 76D168FC21; Wed, 27 May 2009 07:22:49 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 3698146C4B; Wed, 27 May 2009 03:22:48 -0400 (EDT) Date: Wed, 27 May 2009 08:22:48 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: "M. Warner Losh" In-Reply-To: <20090526.181932.915721576.imp@bsdimp.com> Message-ID: References: <200905260822.n4Q8M0Zv051280@svn.freebsd.org> <9bbcef730905260624x289af079ue8524e821c1dc891@mail.gmail.com> <20090526.181932.915721576.imp@bsdimp.com> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="621616949-1712872492-1243408968=:23177" Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, trasz@FreeBSD.org, ivoras@FreeBSD.org Subject: Re: svn commit: r192800 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris/common/acl cddl/contrib/opensolaris/uts/common/fs/zfs cddl/contrib/opensolaris/u... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2009 07:22:50 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --621616949-1712872492-1243408968=:23177 Content-Type: TEXT/PLAIN; charset=utf-8; format=flowed Content-Transfer-Encoding: 8BIT On Tue, 26 May 2009, M. Warner Losh wrote: > : > Cute though this BSD license variation is, I'm pretty sure it's not on the > : > approved license list.  Sticking to the standard license templates > : > potentially saves significant trouble later -- especially when people > : > : Hmm, I'm sure that there exists some SVN magic which would allow > : authors to enter something > : > : $BSDL2 Charlie Root 2008,2009$ > : > : and it expands to a perfect boilerplate on checkout :) > > Yes, while possible, I'd argue against it. With explicit boilerplate added > by the author, it is clear what the author's intentions are. The above > macro, it could be argued, may not be well understood enough by everyone > that a case could be made that it isn't a valid license grant... Similar concerns here. You certainly couldn't do the above without more formal paperwork between the project and individual developers so that placing the above became a specific license grant. Also, if it required any SVN customization, you'd need to be *quite* sure that a copy of the source never escaped without the expansion. Finally, the reason that folks like Apple, Sun, FSF, etc, use license references is that their licenses are *extremely* long. You'll notice that when Apple (just for example) uses the BSD license, they actually put it at the top of each file. One of the great virtues of the BSD license is its brevity... Robert N M Watson Computer Laboratory University of Cambridge --621616949-1712872492-1243408968=:23177-- From owner-svn-src-head@FreeBSD.ORG Wed May 27 09:31:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 77966106566B; Wed, 27 May 2009 09:31:50 +0000 (UTC) (envelope-from vanhu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 657438FC13; Wed, 27 May 2009 09:31:50 +0000 (UTC) (envelope-from vanhu@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4R9Vo4S089804; Wed, 27 May 2009 09:31:50 GMT (envelope-from vanhu@svn.freebsd.org) Received: (from vanhu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4R9VoG2089803; Wed, 27 May 2009 09:31:50 GMT (envelope-from vanhu@svn.freebsd.org) Message-Id: <200905270931.n4R9VoG2089803@svn.freebsd.org> From: VANHULLEBUS Yvan Date: Wed, 27 May 2009 09:31:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192880 - head/sys/netipsec X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2009 09:31:50 -0000 Author: vanhu Date: Wed May 27 09:31:50 2009 New Revision: 192880 URL: http://svn.freebsd.org/changeset/base/192880 Log: Only decrease refcnt once when flushing SPD entries, to avoid flushing entries which are still used. Approved by: gnn(mentor) Obtained from: NETASQ MFC after: 1 month Modified: head/sys/netipsec/key.c Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Wed May 27 07:30:32 2009 (r192879) +++ head/sys/netipsec/key.c Wed May 27 09:31:50 2009 (r192880) @@ -4103,10 +4103,21 @@ restart: if (sp->scangen == gen) /* previously handled */ continue; sp->scangen = gen; - if (sp->state == IPSEC_SPSTATE_DEAD) { - /* NB: clean entries created by key_spdflush */ + if (sp->state == IPSEC_SPSTATE_DEAD && + sp->refcnt == 1) { + /* + * Ensure that we only decrease refcnt once, + * when we're the last consumer. + * Directly call SP_DELREF/key_delsp instead + * of KEY_FREESP to avoid unlocking/relocking + * SPTREE_LOCK before key_delsp: may refcnt + * be increased again during that time ? + * NB: also clean entries created by + * key_spdflush + */ + SP_DELREF(sp); + key_delsp(sp); SPTREE_UNLOCK(); - KEY_FREESP(&sp); goto restart; } if (sp->lifetime == 0 && sp->validtime == 0) @@ -4116,7 +4127,6 @@ restart: sp->state = IPSEC_SPSTATE_DEAD; SPTREE_UNLOCK(); key_spdexpire(sp); - KEY_FREESP(&sp); goto restart; } } From owner-svn-src-head@FreeBSD.ORG Wed May 27 09:41:59 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 568A71065674; Wed, 27 May 2009 09:41:59 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 391AB8FC1B; Wed, 27 May 2009 09:41:59 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4R9fxgJ090070; Wed, 27 May 2009 09:41:59 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4R9fxso090068; Wed, 27 May 2009 09:41:59 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200905270941.n4R9fxso090068@svn.freebsd.org> From: Robert Watson Date: Wed, 27 May 2009 09:41:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192881 - head/sys/security/mac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2009 09:41:59 -0000 Author: rwatson Date: Wed May 27 09:41:58 2009 New Revision: 192881 URL: http://svn.freebsd.org/changeset/base/192881 Log: Convert the MAC Framework from using rwlocks to rmlocks to stabilize framework registration for non-sleepable entry points. Obtained from: TrustedBSD Project Modified: head/sys/security/mac/mac_framework.c head/sys/security/mac/mac_internal.h Modified: head/sys/security/mac/mac_framework.c ============================================================================== --- head/sys/security/mac/mac_framework.c Wed May 27 09:31:50 2009 (r192880) +++ head/sys/security/mac/mac_framework.c Wed May 27 09:41:58 2009 (r192881) @@ -78,7 +78,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include @@ -165,7 +165,7 @@ MALLOC_DEFINE(M_MACTEMP, "mactemp", "MAC * * The dynamic policy list is protected by two locks: modifying the list * requires both locks to be held exclusively. One of the locks, - * mac_policy_rw, is acquired over policy entry points that will never sleep; + * mac_policy_rm, is acquired over policy entry points that will never sleep; * the other, mac_policy_sx, is acquire over policy entry points that may * sleep. The former category will be used when kernel locks may be held * over calls to the MAC Framework, during network processing in ithreads, @@ -173,7 +173,7 @@ MALLOC_DEFINE(M_MACTEMP, "mactemp", "MAC * allocations, extended attribute I/O, etc. */ #ifndef MAC_STATIC -static struct rwlock mac_policy_rw; /* Non-sleeping entry points. */ +static struct rmlock mac_policy_rm; /* Non-sleeping entry points. */ static struct sx mac_policy_sx; /* Sleeping entry points. */ #endif @@ -185,14 +185,14 @@ static void mac_policy_xlock_assert(void static void mac_policy_xunlock(void); void -mac_policy_slock_nosleep(void) +mac_policy_slock_nosleep(struct rm_priotracker *tracker) { #ifndef MAC_STATIC if (!mac_late) return; - rw_rlock(&mac_policy_rw); + rm_rlock(&mac_policy_rm, tracker); #endif } @@ -212,14 +212,14 @@ mac_policy_slock_sleep(void) } void -mac_policy_sunlock_nosleep(void) +mac_policy_sunlock_nosleep(struct rm_priotracker *tracker) { #ifndef MAC_STATIC if (!mac_late) return; - rw_runlock(&mac_policy_rw); + rm_runlock(&mac_policy_rm, tracker); #endif } @@ -247,7 +247,7 @@ mac_policy_xlock(void) return; sx_xlock(&mac_policy_sx); - rw_wlock(&mac_policy_rw); + rm_wlock(&mac_policy_rm); #endif } @@ -259,7 +259,7 @@ mac_policy_xunlock(void) if (!mac_late) return; - rw_wunlock(&mac_policy_rw); + rm_wunlock(&mac_policy_rm); sx_xunlock(&mac_policy_sx); #endif } @@ -272,7 +272,7 @@ mac_policy_xlock_assert(void) if (!mac_late) return; - rw_assert(&mac_policy_rw, RA_WLOCKED); + /* XXXRW: rm_assert(&mac_policy_rm, RA_WLOCKED); */ sx_assert(&mac_policy_sx, SA_XLOCKED); #endif } @@ -289,7 +289,7 @@ mac_init(void) mac_labelzone_init(); #ifndef MAC_STATIC - rw_init(&mac_policy_rw, "mac_policy_rw"); + rm_init(&mac_policy_rm, "mac_policy_rm", 0); sx_init(&mac_policy_sx, "mac_policy_sx"); #endif } Modified: head/sys/security/mac/mac_internal.h ============================================================================== --- head/sys/security/mac/mac_internal.h Wed May 27 09:31:50 2009 (r192880) +++ head/sys/security/mac/mac_internal.h Wed May 27 09:41:58 2009 (r192881) @@ -55,6 +55,9 @@ #error "no user-serviceable parts inside" #endif +#include +#include + /* * MAC Framework sysctl namespace. */ @@ -194,9 +197,9 @@ extern struct mtx mac_ifnet_mtx; */ int mac_error_select(int error1, int error2); -void mac_policy_slock_nosleep(void); +void mac_policy_slock_nosleep(struct rm_priotracker *tracker); void mac_policy_slock_sleep(void); -void mac_policy_sunlock_nosleep(void); +void mac_policy_sunlock_nosleep(struct rm_priotracker *tracker); void mac_policy_sunlock_sleep(void); struct label *mac_labelzone_alloc(int flags); @@ -294,14 +297,16 @@ int vn_setlabel(struct vnode *vp, struct error); \ } \ if (!LIST_EMPTY(&mac_policy_list)) { \ - mac_policy_slock_nosleep(); \ + struct rm_priotracker tracker; \ + \ + mac_policy_slock_nosleep(&tracker); \ LIST_FOREACH(mpc, &mac_policy_list, mpc_list) { \ if (mpc->mpc_ops->mpo_ ## check != NULL) \ error = mac_error_select( \ mpc->mpc_ops->mpo_ ## check (args), \ error); \ } \ - mac_policy_sunlock_nosleep(); \ + mac_policy_sunlock_nosleep(&tracker); \ } \ } while (0) @@ -323,7 +328,9 @@ int vn_setlabel(struct vnode *vp, struct } \ } \ if (!LIST_EMPTY(&mac_policy_list)) { \ - mac_policy_slock_nosleep(); \ + struct rm_priotracker tracker; \ + \ + mac_policy_slock_nosleep(&tracker); \ LIST_FOREACH(mpc, &mac_policy_list, mpc_list) { \ if (mpc->mpc_ops->mpo_ ## check != NULL) { \ if (mpc->mpc_ops->mpo_ ## check (args) \ @@ -331,7 +338,7 @@ int vn_setlabel(struct vnode *vp, struct error = 0; \ } \ } \ - mac_policy_sunlock_nosleep(); \ + mac_policy_sunlock_nosleep(&tracker); \ } \ } while (0) @@ -371,14 +378,16 @@ int vn_setlabel(struct vnode *vp, struct mpc->mpc_ops->mpo_ ## operation (args); \ } \ if (!LIST_EMPTY(&mac_policy_list)) { \ - mac_policy_slock_nosleep(); \ + struct rm_priotracker tracker; \ + \ + mac_policy_slock_nosleep(&tracker); \ LIST_FOREACH(mpc, &mac_policy_list, mpc_list) { \ if (mpc->mpc_ops->mpo_ ## operation != NULL) \ result = result composition \ mpc->mpc_ops->mpo_ ## operation \ (args); \ } \ - mac_policy_sunlock_nosleep(); \ + mac_policy_sunlock_nosleep(&tracker); \ } \ } while (0) @@ -492,12 +501,14 @@ int vn_setlabel(struct vnode *vp, struct mpc->mpc_ops->mpo_ ## operation (args); \ } \ if (!LIST_EMPTY(&mac_policy_list)) { \ - mac_policy_slock_nosleep(); \ + struct rm_priotracker tracker; \ + \ + mac_policy_slock_nosleep(&tracker); \ LIST_FOREACH(mpc, &mac_policy_list, mpc_list) { \ if (mpc->mpc_ops->mpo_ ## operation != NULL) \ mpc->mpc_ops->mpo_ ## operation (args); \ } \ - mac_policy_sunlock_nosleep(); \ + mac_policy_sunlock_nosleep(&tracker); \ } \ } while (0) From owner-svn-src-head@FreeBSD.ORG Wed May 27 09:44:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1C0D1065678; Wed, 27 May 2009 09:44:14 +0000 (UTC) (envelope-from vanhu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F94C8FC1D; Wed, 27 May 2009 09:44:14 +0000 (UTC) (envelope-from vanhu@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4R9iEPu090160; Wed, 27 May 2009 09:44:14 GMT (envelope-from vanhu@svn.freebsd.org) Received: (from vanhu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4R9iEsI090159; Wed, 27 May 2009 09:44:14 GMT (envelope-from vanhu@svn.freebsd.org) Message-Id: <200905270944.n4R9iEsI090159@svn.freebsd.org> From: VANHULLEBUS Yvan Date: Wed, 27 May 2009 09:44:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192882 - head/sys/netipsec X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2009 09:44:15 -0000 Author: vanhu Date: Wed May 27 09:44:14 2009 New Revision: 192882 URL: http://svn.freebsd.org/changeset/base/192882 Log: Lock SPTREE before parsing it in key_spddump() Approved by: gnn(mentor) Obtained from: NETASQ MFC after: 2 weeks Modified: head/sys/netipsec/key.c Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Wed May 27 09:41:58 2009 (r192881) +++ head/sys/netipsec/key.c Wed May 27 09:44:14 2009 (r192882) @@ -2396,14 +2396,17 @@ key_spddump(so, m, mhp) /* search SPD entry and get buffer size. */ cnt = 0; + SPTREE_LOCK(); for (dir = 0; dir < IPSEC_DIR_MAX; dir++) { LIST_FOREACH(sp, &V_sptree[dir], chain) { cnt++; } } - if (cnt == 0) + if (cnt == 0) { + SPTREE_UNLOCK(); return key_senderror(so, m, ENOENT); + } for (dir = 0; dir < IPSEC_DIR_MAX; dir++) { LIST_FOREACH(sp, &V_sptree[dir], chain) { @@ -2416,6 +2419,7 @@ key_spddump(so, m, mhp) } } + SPTREE_UNLOCK(); m_freem(m); return 0; } From owner-svn-src-head@FreeBSD.ORG Wed May 27 09:52:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE9E310656A9; Wed, 27 May 2009 09:52:12 +0000 (UTC) (envelope-from vanhu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CC05C8FC19; Wed, 27 May 2009 09:52:12 +0000 (UTC) (envelope-from vanhu@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4R9qC3u090371; Wed, 27 May 2009 09:52:12 GMT (envelope-from vanhu@svn.freebsd.org) Received: (from vanhu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4R9qCJZ090370; Wed, 27 May 2009 09:52:12 GMT (envelope-from vanhu@svn.freebsd.org) Message-Id: <200905270952.n4R9qCJZ090370@svn.freebsd.org> From: VANHULLEBUS Yvan Date: Wed, 27 May 2009 09:52:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192883 - head/sys/crypto/via X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2009 09:52:13 -0000 Author: vanhu Date: Wed May 27 09:52:12 2009 New Revision: 192883 URL: http://svn.freebsd.org/changeset/base/192883 Log: Changed to M_NOWAIT when reallocing psc_buf in padlock_sha_update(), as we already hold the non sleepable crypto_driver_mutex. Approved by: gnn(mentor) Obtained from: NETASQ MFC after: 2 weeks Modified: head/sys/crypto/via/padlock_hash.c Modified: head/sys/crypto/via/padlock_hash.c ============================================================================== --- head/sys/crypto/via/padlock_hash.c Wed May 27 09:44:14 2009 (r192882) +++ head/sys/crypto/via/padlock_hash.c Wed May 27 09:52:12 2009 (r192883) @@ -171,7 +171,9 @@ padlock_sha_update(struct padlock_sha_ct if (ctx->psc_size - ctx->psc_offset < bufsize) { ctx->psc_size = MAX(ctx->psc_size * 2, ctx->psc_size + bufsize); ctx->psc_buf = realloc(ctx->psc_buf, ctx->psc_size, M_PADLOCK, - M_WAITOK); + M_NOWAIT); + if(ctx->psc_buf == NULL) + return (ENOMEM); } bcopy(buf, ctx->psc_buf + ctx->psc_offset, bufsize); ctx->psc_offset += bufsize; From owner-svn-src-head@FreeBSD.ORG Wed May 27 10:02:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 65BC010656C3; Wed, 27 May 2009 10:02:08 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5159C8FC2A; Wed, 27 May 2009 10:02:08 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RA28xc090832; Wed, 27 May 2009 10:02:08 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RA27oj090818; Wed, 27 May 2009 10:02:07 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200905271002.n4RA27oj090818@svn.freebsd.org> From: Edwin Groothuis Date: Wed, 27 May 2009 10:02:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192886 - head/share/zoneinfo X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 May 2009 10:02:09 -0000 Author: edwin Date: Wed May 27 10:02:07 2009 New Revision: 192886 URL: http://svn.freebsd.org/changeset/base/192886 Log: MFV of tzdata2009h: - Fix coordinates of Africa/Gaborone, Pacific/Noumea, Pacific/Tongatapu, Europe/Vatican - Fix URLs (=3D -> = etc) - Jordan doesn't go at last Friday of March 00:00 but no last Thursday of March 24:00 - Specifically state license for the data: public domain MFC after: 1 week Modified: head/share/zoneinfo/ (props changed) head/share/zoneinfo/africa head/share/zoneinfo/antarctica head/share/zoneinfo/asia head/share/zoneinfo/australasia head/share/zoneinfo/backward head/share/zoneinfo/etcetera head/share/zoneinfo/europe head/share/zoneinfo/factory head/share/zoneinfo/leapseconds head/share/zoneinfo/northamerica head/share/zoneinfo/pacificnew head/share/zoneinfo/southamerica head/share/zoneinfo/systemv head/share/zoneinfo/zone.tab Modified: head/share/zoneinfo/africa ============================================================================== --- head/share/zoneinfo/africa Wed May 27 09:57:36 2009 (r192885) +++ head/share/zoneinfo/africa Wed May 27 10:02:07 2009 (r192886) @@ -1,5 +1,7 @@ -# @(#)africa 8.19 #
+# @(#)africa	8.21
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 
 # This data is by no means authoritative; if you think you know better,
 # go ahead and edit the file (and please send any changes to
@@ -241,18 +243,18 @@ Rule	Egypt	2007	only	-	Sep	Thu>=1	23:00s
 # The following appeared in Red Hat bugzilla[1] (edited):
 #
 # > $ zdump -v /usr/share/zoneinfo/Africa/Cairo | grep 2009
-# > /usr/share/zoneinfo/Africa/Cairo  Thu Apr 23 21:59:59 2009 UTC =3D Thu =
+# > /usr/share/zoneinfo/Africa/Cairo  Thu Apr 23 21:59:59 2009 UTC = Thu =
 # Apr 23
-# > 23:59:59 2009 EET isdst=3D0 gmtoff=3D7200
-# > /usr/share/zoneinfo/Africa/Cairo  Thu Apr 23 22:00:00 2009 UTC =3D Fri =
+# > 23:59:59 2009 EET isdst=0 gmtoff=7200
+# > /usr/share/zoneinfo/Africa/Cairo  Thu Apr 23 22:00:00 2009 UTC = Fri =
 # Apr 24
-# > 01:00:00 2009 EEST isdst=3D1 gmtoff=3D10800
-# > /usr/share/zoneinfo/Africa/Cairo  Thu Aug 27 20:59:59 2009 UTC =3D Thu =
+# > 01:00:00 2009 EEST isdst=1 gmtoff=10800
+# > /usr/share/zoneinfo/Africa/Cairo  Thu Aug 27 20:59:59 2009 UTC = Thu =
 # Aug 27
-# > 23:59:59 2009 EEST isdst=3D1 gmtoff=3D10800
-# > /usr/share/zoneinfo/Africa/Cairo  Thu Aug 27 21:00:00 2009 UTC =3D Thu =
+# > 23:59:59 2009 EEST isdst=1 gmtoff=10800
+# > /usr/share/zoneinfo/Africa/Cairo  Thu Aug 27 21:00:00 2009 UTC = Thu =
 # Aug 27
-# > 23:00:00 2009 EET isdst=3D0 gmtoff=3D7200
+# > 23:00:00 2009 EET isdst=0 gmtoff=7200
 #
 # > end date should be Thu Sep 24 2009 (Last Thursday in September at 23:59=
 # :59)
@@ -260,11 +262,11 @@ Rule	Egypt	2007	only	-	Sep	Thu>=1	23:00s
 #
 # timeanddate[2] and another site I've found[3] also support that.
 #
-# [1] 
-# https://bugzilla.redhat.com/show_bug.cgi?id=3D492263
+# [1] 
+# https://bugzilla.redhat.com/show_bug.cgi?id=492263
 # 
-# [2] 
-# http://www.timeanddate.com/worldclock/clockchange.html?n=3D53
+# [2] 
+# http://www.timeanddate.com/worldclock/clockchange.html?n=53
 # 
 # [3] 
 # http://wwp.greenwichmeantime.com/time-zone/africa/egypt/
@@ -477,8 +479,8 @@ Zone Africa/Nouakchott	-1:03:48 -	LMT	19
 
 # From Riad M. Hossen Ally (2008-08-03):
 # The Government of Mauritius weblink
-# 
-# http://www.gov.mu/portal/site/pmosite/menuitem.4ca0efdee47462e7440a600248a521ca/?content_id=3D4728ca68b2a5b110VgnVCM1000000a04a8c0RCRD
+# 
+# http://www.gov.mu/portal/site/pmosite/menuitem.4ca0efdee47462e7440a600248a521ca/?content_id=4728ca68b2a5b110VgnVCM1000000a04a8c0RCRD
 # 
 # Cabinet Decision of July 18th, 2008 states as follows:
 #

Modified: head/share/zoneinfo/antarctica
==============================================================================
--- head/share/zoneinfo/antarctica	Wed May 27 09:57:36 2009	(r192885)
+++ head/share/zoneinfo/antarctica	Wed May 27 10:02:07 2009	(r192886)
@@ -1,5 +1,7 @@
-# @(#)antarctica	8.4
 # 
+# @(#)antarctica	8.5
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 
 # From Paul Eggert (1999-11-15):
 # To keep things manageable, we list only locations occupied year-round; see

Modified: head/share/zoneinfo/asia
==============================================================================
--- head/share/zoneinfo/asia	Wed May 27 09:57:36 2009	(r192885)
+++ head/share/zoneinfo/asia	Wed May 27 10:02:07 2009	(r192886)
@@ -1,5 +1,7 @@
-# @(#)asia	8.30
 # 
+# @(#)asia	8.32
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 
 # This data is by no means authoritative; if you think you know better,
 # go ahead and edit the file (and please send any changes to
@@ -1107,7 +1109,7 @@ Rule	Jordan	1995	1998	-	Sep	Fri>=15	0:00
 Rule	Jordan	1999	only	-	Jul	 1	0:00s	1:00	S
 Rule	Jordan	1999	2002	-	Sep	lastFri	0:00s	0	-
 Rule	Jordan	2000	2001	-	Mar	lastThu	0:00s	1:00	S
-Rule	Jordan	2002	max	-	Mar	lastFri	0:00s	1:00	S
+Rule	Jordan	2002	max	-	Mar	lastThu	24:00	1:00	S
 Rule	Jordan	2003	only	-	Oct	24	0:00s	0	-
 Rule	Jordan	2004	only	-	Oct	15	0:00s	0	-
 Rule	Jordan	2005	only	-	Sep	lastFri	0:00s	0	-

Modified: head/share/zoneinfo/australasia
==============================================================================
--- head/share/zoneinfo/australasia	Wed May 27 09:57:36 2009	(r192885)
+++ head/share/zoneinfo/australasia	Wed May 27 10:02:07 2009	(r192886)
@@ -1,5 +1,7 @@
-# @(#)australasia	8.9
 # 
+# @(#)australasia	8.11
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 
 # This file also includes Pacific islands.
 
@@ -1119,6 +1121,27 @@ Zone	Pacific/Wallis	12:15:20 -	LMT	1901
 # From Paul Eggert (2007-07-23):
 # See "southeast Australia" above for 2008 and later.
 
+# From Steffen Thorsen (2009-04-28):
+# According to the official press release, South Australia's extended daylight 
+# saving period will continue with the same rules as used during the 2008-2009 
+# summer (southern hemisphere).
+# 
+# From
+# 
+# http://www.safework.sa.gov.au/uploaded_files/DaylightDatesSet.pdf
+# 
+# The extended daylight saving period that South Australia has been trialling 
+# for over the last year is now set to be ongoing.
+# Daylight saving will continue to start on the first Sunday in October each 
+# year and finish on the first Sunday in April the following year.
+# Industrial Relations Minister, Paul Caica, says this provides South Australia 
+# with a consistent half hour time difference with NSW, Victoria, Tasmania and 
+# the ACT for all 52 weeks of the year...
+# 
+# We have a wrap-up here:
+# 
+# http://www.timeanddate.com/news/time/south-australia-extends-dst.html
+# 
 ###############################################################################
 
 # New Zealand

Modified: head/share/zoneinfo/backward
==============================================================================
--- head/share/zoneinfo/backward	Wed May 27 09:57:36 2009	(r192885)
+++ head/share/zoneinfo/backward	Wed May 27 10:02:07 2009	(r192886)
@@ -1,4 +1,7 @@
-# @(#)backward	8.7
+# 
+# @(#)backward	8.8
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 
 # This file provides links between current names for time zones
 # and their old names.  Many names changed in late 1993.

Modified: head/share/zoneinfo/etcetera
==============================================================================
--- head/share/zoneinfo/etcetera	Wed May 27 09:57:36 2009	(r192885)
+++ head/share/zoneinfo/etcetera	Wed May 27 10:02:07 2009	(r192886)
@@ -1,4 +1,7 @@
-# @(#)etcetera	8.1
+# 
+# @(#)etcetera	8.2
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 
 # These entries are mostly present for historical reasons, so that
 # people in areas not otherwise covered by the tz files could "zic -l"

Modified: head/share/zoneinfo/europe
==============================================================================
--- head/share/zoneinfo/europe	Wed May 27 09:57:36 2009	(r192885)
+++ head/share/zoneinfo/europe	Wed May 27 10:02:07 2009	(r192886)
@@ -1,5 +1,7 @@
-# @(#)europe	8.20
 # 
+# @(#)europe	8.21
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 
 # This data is by no means authoritative; if you think you know better,
 # go ahead and edit the file (and please send any changes to

Modified: head/share/zoneinfo/factory
==============================================================================
--- head/share/zoneinfo/factory	Wed May 27 09:57:36 2009	(r192885)
+++ head/share/zoneinfo/factory	Wed May 27 10:02:07 2009	(r192886)
@@ -1,4 +1,7 @@
-# @(#)factory	8.1
+# 
+# @(#)factory	8.2
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 
 # For companies who don't want to put time zone specification in
 # their installation procedures.  When users run date, they'll get the message.

Modified: head/share/zoneinfo/leapseconds
==============================================================================
--- head/share/zoneinfo/leapseconds	Wed May 27 09:57:36 2009	(r192885)
+++ head/share/zoneinfo/leapseconds	Wed May 27 10:02:07 2009	(r192886)
@@ -1,4 +1,7 @@
-# @(#)leapseconds	8.6
+# 
+# @(#)leapseconds	8.8
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 
 # Allowance for leapseconds added to each timezone file.
 

Modified: head/share/zoneinfo/northamerica
==============================================================================
--- head/share/zoneinfo/northamerica	Wed May 27 09:57:36 2009	(r192885)
+++ head/share/zoneinfo/northamerica	Wed May 27 10:02:07 2009	(r192886)
@@ -1,5 +1,7 @@
-# @(#)northamerica	8.27
 # 
+# @(#)northamerica	8.28
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 
 # also includes Central America and the Caribbean
 

Modified: head/share/zoneinfo/pacificnew
==============================================================================
--- head/share/zoneinfo/pacificnew	Wed May 27 09:57:36 2009	(r192885)
+++ head/share/zoneinfo/pacificnew	Wed May 27 10:02:07 2009	(r192886)
@@ -1,4 +1,7 @@
-# @(#)pacificnew	8.1
+# 
+# @(#)pacificnew	8.2
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 
 # From Arthur David Olson (1989-04-05):
 # On 1989-04-05, the U. S. House of Representatives passed (238-154) a bill

Modified: head/share/zoneinfo/southamerica
==============================================================================
--- head/share/zoneinfo/southamerica	Wed May 27 09:57:36 2009	(r192885)
+++ head/share/zoneinfo/southamerica	Wed May 27 10:02:07 2009	(r192886)
@@ -1,5 +1,7 @@
-# @(#)southamerica	8.34
 # 
+# @(#)southamerica	8.36
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 
 # This data is by no means authoritative; if you think you know better,
 # go ahead and edit the file (and please send any changes to
@@ -674,8 +676,8 @@ Zone	America/La_Paz	-4:32:36 -	LMT	1890
 
 # From Rodrigo Severo (2008-06-24):
 # Just correcting the URL:
-# 
-# https://www.in.gov.br/imprensa/visualiza/index.jsp?jornal=3Ddo&secao=3D1&pagina=3D1&data=3D25/04/2008
+# 
+# https://www.in.gov.br/imprensa/visualiza/index.jsp?jornal=do&secao=1&pagina=1&data=25/04/2008
 # 
 #
 # As a result of the above Decree I believe the America/Rio_Branco

Modified: head/share/zoneinfo/systemv
==============================================================================
--- head/share/zoneinfo/systemv	Wed May 27 09:57:36 2009	(r192885)
+++ head/share/zoneinfo/systemv	Wed May 27 10:02:07 2009	(r192886)
@@ -1,4 +1,7 @@
-# @(#)systemv	8.1
+# 
+# @(#)systemv	8.2
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 
 # Old rules, should the need arise.
 # No attempt is made to handle Newfoundland, since it cannot be expressed

Modified: head/share/zoneinfo/zone.tab
==============================================================================
--- head/share/zoneinfo/zone.tab	Wed May 27 09:57:36 2009	(r192885)
+++ head/share/zoneinfo/zone.tab	Wed May 27 10:02:07 2009	(r192886)
@@ -1,4 +1,7 @@
-# @(#)zone.tab	8.26
+# 
+# @(#)zone.tab	8.28
+# This file is in the public domain, so clarified as of
+# 2009-05-17 by Arthur David Olson.
 #
 # TZ zone descriptions
 #
@@ -101,7 +104,7 @@ BR	-0640-06952	America/Eirunepe	W Amazon
 BR	-0958-06748	America/Rio_Branco	Acre
 BS	+2505-07721	America/Nassau
 BT	+2728+08939	Asia/Thimphu
-BW	-2545+02555	Africa/Gaborone
+BW	-2439+02555	Africa/Gaborone
 BY	+5354+02734	Europe/Minsk
 BZ	+1730-08812	America/Belize
 CA	+4734-05243	America/St_Johns	Newfoundland Time, including SE Labrador
@@ -285,7 +288,7 @@ MY	+0310+10142	Asia/Kuala_Lumpur	peninsu
 MY	+0133+11020	Asia/Kuching	Sabah & Sarawak
 MZ	-2558+03235	Africa/Maputo
 NA	-2234+01706	Africa/Windhoek
-NC	-2216+16530	Pacific/Noumea
+NC	-2216+16627	Pacific/Noumea
 NE	+1331+00207	Africa/Niamey
 NF	-2903+16758	Pacific/Norfolk
 NG	+0627+00324	Africa/Lagos
@@ -365,7 +368,7 @@ TK	-0922-17114	Pacific/Fakaofo
 TL	-0833+12535	Asia/Dili
 TM	+3757+05823	Asia/Ashgabat
 TN	+3648+01011	Africa/Tunis
-TO	-2110+17510	Pacific/Tongatapu
+TO	-2110-17510	Pacific/Tongatapu
 TR	+4101+02858	Europe/Istanbul
 TT	+1039-06131	America/Port_of_Spain
 TV	-0831+17913	Pacific/Funafuti
@@ -409,7 +412,7 @@ US	+211825-1575130	Pacific/Honolulu	Hawa
 UY	-3453-05611	America/Montevideo
 UZ	+3940+06648	Asia/Samarkand	west Uzbekistan
 UZ	+4120+06918	Asia/Tashkent	east Uzbekistan
-VA	+4154+01227	Europe/Vatican
+VA	+415408+0122711	Europe/Vatican
 VC	+1309-06114	America/St_Vincent
 VE	+1030-06656	America/Caracas
 VG	+1827-06437	America/Tortola

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 11:17:49 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D700C106566C;
	Wed, 27 May 2009 11:17:49 +0000 (UTC)
	(envelope-from kostikbel@gmail.com)
Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147])
	by mx1.freebsd.org (Postfix) with ESMTP id 59C0C8FC22;
	Wed, 27 May 2009 11:17:49 +0000 (UTC)
	(envelope-from kostikbel@gmail.com)
Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua)
	by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256)
	(Exim 4.63 (FreeBSD)) (envelope-from )
	id 1M9H8l-000Hrk-QO; Wed, 27 May 2009 14:17:47 +0300
Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua
	[10.1.1.148])
	by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n4RBHfuL040550
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Wed, 27 May 2009 14:17:42 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1])
	by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id
	n4RBHfut050612; Wed, 27 May 2009 14:17:41 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
Received: (from kostik@localhost)
	by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n4RBHfR1050611; 
	Wed, 27 May 2009 14:17:41 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to
	kostikbel@gmail.com using -f
Date: Wed, 27 May 2009 14:17:41 +0300
From: Kostik Belousov 
To: Stacey Son 
Message-ID: <20090527111741.GH1927@deviant.kiev.zoral.com.ua>
References: <200905262139.n4QLd9pI074530@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="RzyRI1FIOvhQ4MGO"
Content-Disposition: inline
In-Reply-To: <200905262139.n4QLd9pI074530@svn.freebsd.org>
User-Agent: Mutt/1.4.2.3i
X-Virus-Scanned: clamav-milter 0.95.1 at skuns.kiev.zoral.com.ua
X-Virus-Status: Clean
X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00
	autolearn=ham version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on
	skuns.kiev.zoral.com.ua
X-Virus-Scanned: mail.terabit.net.ua 1M9H8l-000Hrk-QO
	20d0fe7fe45db0791fcb4a7a4a63b780
X-Terabit: YES
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r192859 - in head: share/man/man4 sys/conf
	sys/dev/ksyms sys/kern sys/modules sys/modules/ksyms sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 11:17:50 -0000


--RzyRI1FIOvhQ4MGO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, May 26, 2009 at 09:39:09PM +0000, Stacey Son wrote:
> Author: sson
> Date: Tue May 26 21:39:09 2009
> New Revision: 192859
> URL: http://svn.freebsd.org/changeset/base/192859
>=20
> Log:
>   Add the ksyms(4) pseudo driver.  The ksyms driver allows a process to
>   get a quick snapshot of the kernel's symbol table including the symbols
>   from any loaded modules (the symbols are all merged into one symbol
>   table).  Unlike like other implementations, this ksyms driver maps
>   memory in the process memory space to store the snapshot at the time
>   /dev/ksyms is opened.  It also checks to see if the process has already
>   a snapshot open and won't allow it to open /dev/ksyms it again until it
>   closes first.  This prevents kernel and process memory from being
>   exhausted.  Note that /dev/ksyms is used by the lockstat(1) command.
>  =20
>   Reviewed by:	gallatin kib (freebsd-arch)
>   Approved by:	gnn (mentor)

What is the reason to have ksyms_unmap() ? Why do you think that checking
for the present mapping of the freed region is neccessary ?

--RzyRI1FIOvhQ4MGO
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEARECAAYFAkodIVUACgkQC3+MBN1Mb4itswCfZeXrSd7daKZO+83GSb240R+l
jlYAoO8Qm5k3Iaz6qI7OLKjj5u7OqFPW
=oLsD
-----END PGP SIGNATURE-----

--RzyRI1FIOvhQ4MGO--

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 12:18:39 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B0AEB106564A;
	Wed, 27 May 2009 12:18:39 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9D9948FC14;
	Wed, 27 May 2009 12:18:39 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RCIdo3096538;
	Wed, 27 May 2009 12:18:39 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RCIdWe096532;
	Wed, 27 May 2009 12:18:39 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200905271218.n4RCIdWe096532@svn.freebsd.org>
From: Edwin Groothuis 
Date: Wed, 27 May 2009 12:18:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192890 - in head: lib/libc/stdtime usr.sbin/zic
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 12:18:40 -0000

Author: edwin
Date: Wed May 27 12:18:39 2009
New Revision: 192890
URL: http://svn.freebsd.org/changeset/base/192890

Log:
  MFV of tzcode2009h revision r192887
  
  - Clarify the license for the tzcode: public domain
  
  MFC after:	1 month

Modified:
  head/lib/libc/stdtime/time2posix.3
  head/usr.sbin/zic/README
  head/usr.sbin/zic/Theory
  head/usr.sbin/zic/zdump.8
  head/usr.sbin/zic/zdump.c
  head/usr.sbin/zic/zic.8

Modified: head/lib/libc/stdtime/time2posix.3
==============================================================================
--- head/lib/libc/stdtime/time2posix.3	Wed May 27 11:03:14 2009	(r192889)
+++ head/lib/libc/stdtime/time2posix.3	Wed May 27 12:18:39 2009	(r192890)
@@ -118,6 +118,6 @@ degenerate to the identity function.
 .Xr localtime 3 ,
 .Xr mktime 3 ,
 .Xr time 3
-.\" @(#)time2posix.3  8.1
+.\" @(#)time2posix.3  8.2
 .\" This file is in the public domain, so clarified as of
 .\" 1996-06-05 by Arthur David Olson.

Modified: head/usr.sbin/zic/README
==============================================================================
--- head/usr.sbin/zic/README	Wed May 27 11:03:14 2009	(r192889)
+++ head/usr.sbin/zic/README	Wed May 27 12:18:39 2009	(r192890)
@@ -1,4 +1,7 @@
-@(#)README	8.2
+@(#)README	8.3
+This file is in the public domain, so clarified as of
+2009-05-17 by Arthur David Olson.
+
 $FreeBSD$
 
 "What time is it?" -- Richard Deacon as The King

Modified: head/usr.sbin/zic/Theory
==============================================================================
--- head/usr.sbin/zic/Theory	Wed May 27 11:03:14 2009	(r192889)
+++ head/usr.sbin/zic/Theory	Wed May 27 12:18:39 2009	(r192890)
@@ -1,4 +1,6 @@
-@(#)Theory	8.2
+@(#)Theory	8.3
+This file is in the public domain, so clarified as of
+2009-05-17 by Arthur David Olson.
 $FreeBSD$
 
 ----- Outline -----
@@ -9,7 +11,6 @@ $FreeBSD$
 	Calendrical issues
 	Time and time zones on Mars
 
-
 ----- Time and date functions -----
 
 These time and date functions are upwards compatible with POSIX,

Modified: head/usr.sbin/zic/zdump.8
==============================================================================
--- head/usr.sbin/zic/zdump.8	Wed May 27 11:03:14 2009	(r192889)
+++ head/usr.sbin/zic/zdump.8	Wed May 27 12:18:39 2009	(r192890)
@@ -1,5 +1,7 @@
 .\"
-.\"	@(#)zdump.8	7.3
+.\"	@(#)zdump.8	8.2
+.\" This file is in the public domain, so clarified as of
+.\" 2009-05-17 by Arthur David Olson.
 .\" $FreeBSD$
 .\"
 .Dd June 20, 2004

Modified: head/usr.sbin/zic/zdump.c
==============================================================================
--- head/usr.sbin/zic/zdump.c	Wed May 27 11:03:14 2009	(r192889)
+++ head/usr.sbin/zic/zdump.c	Wed May 27 12:18:39 2009	(r192890)
@@ -1,7 +1,12 @@
+/*
+** This file is in the public domain, so clarified as of
+** 2009-05-17 by Arthur David Olson.
+*/
+
 #ifndef lint
 static const char rcsid[] =
   "$FreeBSD$";
-static char	elsieid[] = "@(#)zdump.c	8.8";
+static char	elsieid[] = "@(#)zdump.c	8.9";
 #endif /* not lint */
 
 /*

Modified: head/usr.sbin/zic/zic.8
==============================================================================
--- head/usr.sbin/zic/zic.8	Wed May 27 11:03:14 2009	(r192889)
+++ head/usr.sbin/zic/zic.8	Wed May 27 12:18:39 2009	(r192890)
@@ -460,4 +460,6 @@ standard directory used for created file
 .Xr ctime 3 ,
 .Xr tzfile 5 ,
 .Xr zdump 8
-.\" @(#)zic.8	8.4
+.\" @(#)zic.8	8.5
+.\" This file is in the public domain, so clarified as of
+.\" 2009-05-17 by Arthur David Olson.

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 12:31:56 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4FB221065694;
	Wed, 27 May 2009 12:31:56 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3D78B8FC1D;
	Wed, 27 May 2009 12:31:56 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RCVunt096926;
	Wed, 27 May 2009 12:31:56 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RCVuqd096925;
	Wed, 27 May 2009 12:31:56 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200905271231.n4RCVuqd096925@svn.freebsd.org>
From: Edwin Groothuis 
Date: Wed, 27 May 2009 12:31:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192891 - head/tools/regression
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 12:31:57 -0000

Author: edwin
Date: Wed May 27 12:31:55 2009
New Revision: 192891
URL: http://svn.freebsd.org/changeset/base/192891

Log:
  Add the regression test for bin/date.

Modified:
  head/tools/regression/README

Modified: head/tools/regression/README
==============================================================================
--- head/tools/regression/README	Wed May 27 12:18:39 2009	(r192890)
+++ head/tools/regression/README	Wed May 27 12:31:55 2009	(r192891)
@@ -86,3 +86,4 @@ sysvmsg 	SysV IPC Message Queue Regressi
 sysvsem 	SysV IPC Semaphore Regression Utility
 sysvshm 	SysV IPC Shared Memory Regression Utility
 gaithrstress	General threaded getaddrinfo(3) exerciser
+date		Date(1) + format string regression test

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 12:44:36 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9983F1065680;
	Wed, 27 May 2009 12:44:36 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6CC0A8FC0C;
	Wed, 27 May 2009 12:44:36 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RCiaKD097326;
	Wed, 27 May 2009 12:44:36 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RCiaRP097325;
	Wed, 27 May 2009 12:44:36 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <200905271244.n4RCiaRP097325@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Wed, 27 May 2009 12:44:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192893 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 12:44:37 -0000

Author: trasz
Date: Wed May 27 12:44:36 2009
New Revision: 192893
URL: http://svn.freebsd.org/changeset/base/192893

Log:
  Don't discard packets with 'Destination Unreachable' at the beginning
  of ip_forward(), if the IPSEC is compiled in.  It is possible that there
  is an SPD that this packets will go through, even if there is no matching
  route.  If not, ICMP will be sent anyway, after ip_output().
  
  This is somewhat similar in purpose to r191621, except that one was
  for the packets sent from the host, while this one is for packets
  being forwarded by the host.
  
  Reviewed by:	bz@
  Sponsored by:	Wheel Sp. z o.o. (http://www.wheel.pl)

Modified:
  head/sys/netinet/ip_input.c

Modified: head/sys/netinet/ip_input.c
==============================================================================
--- head/sys/netinet/ip_input.c	Wed May 27 12:33:57 2009	(r192892)
+++ head/sys/netinet/ip_input.c	Wed May 27 12:44:36 2009	(r192893)
@@ -1356,7 +1356,7 @@ ip_forward(struct mbuf *m, int srcrt)
 {
 	INIT_VNET_INET(curvnet);
 	struct ip *ip = mtod(m, struct ip *);
-	struct in_ifaddr *ia = NULL;
+	struct in_ifaddr *ia;
 	struct mbuf *mcopy;
 	struct in_addr dest;
 	struct route ro;
@@ -1380,10 +1380,17 @@ ip_forward(struct mbuf *m, int srcrt)
 #endif
 
 	ia = ip_rtaddr(ip->ip_dst, M_GETFIB(m));
+#ifndef IPSEC
+	/*
+	 * 'ia' may be NULL if there is no route for this destination.
+	 * In case of IPsec, Don't discard it just yet, but pass it to
+	 * ip_output in case of outgoing IPsec policy.
+	 */
 	if (!srcrt && ia == NULL) {
 		icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, 0, 0);
 		return;
 	}
+#endif
 
 	/*
 	 * Save the IP header and at most 8 bytes of the payload,
@@ -1435,7 +1442,8 @@ ip_forward(struct mbuf *m, int srcrt)
 	 * or a route modified by a redirect.
 	 */
 	dest.s_addr = 0;
-	if (!srcrt && V_ipsendredirects && ia->ia_ifp == m->m_pkthdr.rcvif) {
+	if (!srcrt && V_ipsendredirects &&
+	    ia != NULL && ia->ia_ifp == m->m_pkthdr.rcvif) {
 		struct sockaddr_in *sin;
 		struct rtentry *rt;
 
@@ -1502,7 +1510,7 @@ ip_forward(struct mbuf *m, int srcrt)
 		/* type, code set above */
 		break;
 
-	case ENETUNREACH:		/* shouldn't happen, checked above */
+	case ENETUNREACH:
 	case EHOSTUNREACH:
 	case ENETDOWN:
 	case EHOSTDOWN:

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 13:59:18 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 31DFE1065670;
	Wed, 27 May 2009 13:59:18 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 203BF8FC19;
	Wed, 27 May 2009 13:59:18 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RDxI7v098924;
	Wed, 27 May 2009 13:59:18 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RDxIkW098923;
	Wed, 27 May 2009 13:59:18 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <200905271359.n4RDxIkW098923@svn.freebsd.org>
From: Adrian Chadd 
Date: Wed, 27 May 2009 13:59:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192894 - head/sys/dev/xen/netfront
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 13:59:18 -0000

Author: adrian
Date: Wed May 27 13:59:17 2009
New Revision: 192894
URL: http://svn.freebsd.org/changeset/base/192894

Log:
  Clear IFF_DRV_OACTIVE if at least one TX xen/mbuf ring slot has been freed.

Modified:
  head/sys/dev/xen/netfront/netfront.c

Modified: head/sys/dev/xen/netfront/netfront.c
==============================================================================
--- head/sys/dev/xen/netfront/netfront.c	Wed May 27 12:44:36 2009	(r192893)
+++ head/sys/dev/xen/netfront/netfront.c	Wed May 27 13:59:17 2009	(r192894)
@@ -1099,6 +1099,8 @@ xn_txeof(struct netfront_info *np)
 				panic("netif_release_tx_bufs: tx_chain_cnt must be >= 0");
 			}
 			m_free(m);
+			/* Only mark the queue active if we've freed up at least one slot to try */
+			ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
 		}
 		np->tx.rsp_cons = prod;
 		
@@ -1115,7 +1117,6 @@ xn_txeof(struct netfront_info *np)
 		    prod + ((np->tx.sring->req_prod - prod) >> 1) + 1;
 
 		mb();
-		
 	} while (prod != np->tx.sring->rsp_prod);
 	
  out: 

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 14:11:24 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3089E106567A;
	Wed, 27 May 2009 14:11:24 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1A0498FC25;
	Wed, 27 May 2009 14:11:24 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4REBO6n099221;
	Wed, 27 May 2009 14:11:24 GMT (envelope-from jamie@svn.freebsd.org)
Received: (from jamie@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4REBNKa099209;
	Wed, 27 May 2009 14:11:23 GMT (envelope-from jamie@svn.freebsd.org)
Message-Id: <200905271411.n4REBNKa099209@svn.freebsd.org>
From: Jamie Gritton 
Date: Wed, 27 May 2009 14:11:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192895 - in head: . lib/libc/sys sys/compat/freebsd32
	sys/compat/linux sys/contrib/ipfilter/netinet sys/fs/procfs
	sys/kern sys/net sys/netinet sys/netinet6 sys/nfsserver
	sys/security/m...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 14:11:24 -0000

Author: jamie
Date: Wed May 27 14:11:23 2009
New Revision: 192895
URL: http://svn.freebsd.org/changeset/base/192895

Log:
  Add hierarchical jails.  A jail may further virtualize its environment
  by creating a child jail, which is visible to that jail and to any
  parent jails.  Child jails may be restricted more than their parents,
  but never less.  Jail names reflect this hierarchy, being MIB-style
  dot-separated strings.
  
  Every thread now points to a jail, the default being prison0, which
  contains information about the physical system.  Prison0's root
  directory is the same as rootvnode; its hostname is the same as the
  global hostname, and its securelevel replaces the global securelevel.
  Note that the variable "securelevel" has actually gone away, which
  should not cause any problems for code that properly uses
  securelevel_gt() and securelevel_ge().
  
  Some jail-related permissions that were kept in global variables and
  set via sysctls are now per-jail settings.  The sysctls still exist for
  backward compatibility, used only by the now-deprecated jail(2) system
  call.
  
  Approved by:	bz (mentor)

Modified:
  head/UPDATING
  head/lib/libc/sys/jail.2
  head/sys/compat/freebsd32/freebsd32_misc.c
  head/sys/compat/linux/linux_mib.c
  head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
  head/sys/contrib/ipfilter/netinet/ip_nat.c
  head/sys/fs/procfs/procfs_status.c
  head/sys/kern/init_main.c
  head/sys/kern/kern_cpuset.c
  head/sys/kern/kern_descrip.c
  head/sys/kern/kern_exit.c
  head/sys/kern/kern_fork.c
  head/sys/kern/kern_jail.c
  head/sys/kern/kern_linker.c
  head/sys/kern/kern_mib.c
  head/sys/kern/kern_proc.c
  head/sys/kern/kern_prot.c
  head/sys/kern/sysv_msg.c
  head/sys/kern/sysv_sem.c
  head/sys/kern/sysv_shm.c
  head/sys/kern/vfs_lookup.c
  head/sys/kern/vfs_mount.c
  head/sys/kern/vfs_subr.c
  head/sys/kern/vfs_syscalls.c
  head/sys/net/rtsock.c
  head/sys/netinet/in_pcb.c
  head/sys/netinet/udp_usrreq.c
  head/sys/netinet6/in6.c
  head/sys/netinet6/in6_ifattach.c
  head/sys/netinet6/in6_pcb.c
  head/sys/nfsserver/nfs_srvsock.c
  head/sys/security/mac_bsdextended/mac_bsdextended.c
  head/sys/sys/cpuset.h
  head/sys/sys/jail.h
  head/sys/sys/param.h
  head/sys/sys/syscallsubr.h
  head/sys/sys/systm.h
  head/sys/ufs/ufs/ufs_vnops.c

Modified: head/UPDATING
==============================================================================
--- head/UPDATING	Wed May 27 13:59:17 2009	(r192894)
+++ head/UPDATING	Wed May 27 14:11:23 2009	(r192895)
@@ -22,6 +22,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.
 	to maximize performance.  (To disable malloc debugging, run
 	ln -s aj /etc/malloc.conf.)
 
+20090527:
+	Add support for hierarchical jails.  Remove global securelevel.
+	Bump __FreeBSD_version to 800091.
+
 20090523:
 	The layout of struct vnet_net has changed, therefore modules
 	need to be rebuilt.

Modified: head/lib/libc/sys/jail.2
==============================================================================
--- head/lib/libc/sys/jail.2	Wed May 27 13:59:17 2009	(r192894)
+++ head/lib/libc/sys/jail.2	Wed May 27 14:11:23 2009	(r192895)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 29, 2009
+.Dd May 27, 2009
 .Dt JAIL 2
 .Os
 .Sh NAME
@@ -283,7 +283,7 @@ of the jail for the given address family
 It is possible to identify a process as jailed by examining
 .Dq Li /proc//status :
 it will show a field near the end of the line, either as
-a single hyphen for a process at large, or the hostname currently
+a single hyphen for a process at large, or the name currently
 set for the prison for jailed processes.
 .Sh ERRORS
 The
@@ -292,7 +292,10 @@ system call
 will fail if:
 .Bl -tag -width Er
 .It Bq Er EPERM
-This process is not allowed to create a jail.
+This process is not allowed to create a jail, either because it is not
+the super-user, or because it is in a jail where the
+.Va allow.jails
+parameter is not set.
 .It Bq Er EFAULT
 .Fa jail
 points to an address outside the allocated address space of the process.
@@ -308,7 +311,10 @@ system call
 will fail if:
 .Bl -tag -width Er
 .It Bq Er EPERM
-This process is not allowed to create a jail.
+This process is not allowed to create a jail, either because it is not
+the super-user, or because it is in a jail where the
+.Va allow.jails
+parameter is not set.
 .It Bq Er EPERM
 A jail parameter was set to a less restrictive value then the current
 environment.
@@ -324,6 +330,11 @@ or
 parameter does not exist, and the
 .Dv JAIL_CREATE
 flag is not set.
+.It Bq Er ENOENT
+The jail referred to by a
+.Va jid
+is not accessible by the process, because the process is in a different
+jail. 
 .It Bq Er EEXIST
 The jail referred to by a
 .Va jid
@@ -368,6 +379,11 @@ or
 .Va name
 parameter does not exist.
 .It Bq Er ENOENT
+The jail referred to by a
+.Va jid
+is not accessible by the process, because the process is in a different
+jail. 
+.It Bq Er ENOENT
 The
 .Va lastjid
 parameter is greater than the highest current jail ID.
@@ -429,4 +445,4 @@ for R&D Associates
 who contributed it to
 .Fx .
 .An James Gritton
-added the extensible jail parameters.
+added the extensible jail parameters and hierarchical jails.

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_misc.c	Wed May 27 13:59:17 2009	(r192894)
+++ head/sys/compat/freebsd32/freebsd32_misc.c	Wed May 27 14:11:23 2009	(r192895)
@@ -112,8 +112,6 @@ CTASSERT(sizeof(struct msghdr32) == 28);
 CTASSERT(sizeof(struct stat32) == 96);
 CTASSERT(sizeof(struct sigaction32) == 24);
 
-extern int jail_max_af_ips;
-
 static int freebsd32_kevent_copyout(void *arg, struct kevent *kevp, int count);
 static int freebsd32_kevent_copyin(void *arg, struct kevent *kevp, int count);
 
@@ -2044,17 +2042,9 @@ freebsd32_sysctl(struct thread *td, stru
 int
 freebsd32_jail(struct thread *td, struct freebsd32_jail_args *uap)
 {
-	struct iovec optiov[10];
-	struct uio opt;
-	char *u_path, *u_hostname, *u_name;
-#ifdef INET
-	struct in_addr *u_ip4;
-#endif
-#ifdef INET6
-	struct in6_addr *u_ip6;
-#endif
 	uint32_t version;
 	int error;
+	struct jail j;
 
 	error = copyin(uap->jail, &version, sizeof(uint32_t));
 	if (error)
@@ -2066,45 +2056,14 @@ freebsd32_jail(struct thread *td, struct
 		/* FreeBSD single IPv4 jails. */
 		struct jail32_v0 j32_v0;
 
+		bzero(&j, sizeof(struct jail));
 		error = copyin(uap->jail, &j32_v0, sizeof(struct jail32_v0));
 		if (error)
 			return (error);
-		u_path = malloc(MAXPATHLEN + MAXHOSTNAMELEN, M_TEMP, M_WAITOK);
-		u_hostname = u_path + MAXPATHLEN;
-		opt.uio_iov = optiov;
-		opt.uio_iovcnt = 4;
-		opt.uio_offset = -1;
-		opt.uio_resid = -1;
-		opt.uio_segflg = UIO_SYSSPACE;
-		opt.uio_rw = UIO_READ;
-		opt.uio_td = td;
-		optiov[0].iov_base = "path";
-		optiov[0].iov_len = sizeof("path");
-		optiov[1].iov_base = u_path;
-		error = copyinstr(PTRIN(j32_v0.path), u_path, MAXPATHLEN,
-		    &optiov[1].iov_len);
-		if (error) {
-			free(u_path, M_TEMP);
-			return (error);
-		}
-		optiov[2].iov_base = "host.hostname";
-		optiov[2].iov_len = sizeof("host.hostname");
-		optiov[3].iov_base = u_hostname;
-		error = copyinstr(PTRIN(j32_v0.hostname), u_hostname,
-		    MAXHOSTNAMELEN, &optiov[3].iov_len);
-		if (error) {
-			free(u_path, M_TEMP);
-			return (error);
-		}
-#ifdef INET
-		optiov[opt.uio_iovcnt].iov_base = "ip4.addr";
-		optiov[opt.uio_iovcnt].iov_len = sizeof("ip4.addr");
-		opt.uio_iovcnt++;
-		optiov[opt.uio_iovcnt].iov_base = &j32_v0.ip_number;
-		j32_v0.ip_number = htonl(j32_v0.ip_number);
-		optiov[opt.uio_iovcnt].iov_len = sizeof(j32_v0.ip_number);
-		opt.uio_iovcnt++;
-#endif
+		CP(j32_v0, j, version);
+		PTRIN_CP(j32_v0, j, path);
+		PTRIN_CP(j32_v0, j, hostname);
+		j.ip4s = j32_v0.ip_number;
 		break;
 	}
 
@@ -2119,109 +2078,18 @@ freebsd32_jail(struct thread *td, struct
 	{
 		/* FreeBSD multi-IPv4/IPv6,noIP jails. */
 		struct jail32 j32;
-		size_t tmplen;
 
 		error = copyin(uap->jail, &j32, sizeof(struct jail32));
 		if (error)
 			return (error);
-		tmplen = MAXPATHLEN + MAXHOSTNAMELEN + MAXHOSTNAMELEN;
-#ifdef INET
-		if (j32.ip4s > jail_max_af_ips)
-			return (EINVAL);
-		tmplen += j32.ip4s * sizeof(struct in_addr);
-#else
-		if (j32.ip4s > 0)
-			return (EINVAL);
-#endif
-#ifdef INET6
-		if (j32.ip6s > jail_max_af_ips)
-			return (EINVAL);
-		tmplen += j32.ip6s * sizeof(struct in6_addr);
-#else
-		if (j32.ip6s > 0)
-			return (EINVAL);
-#endif
-		u_path = malloc(tmplen, M_TEMP, M_WAITOK);
-		u_hostname = u_path + MAXPATHLEN;
-		u_name = u_hostname + MAXHOSTNAMELEN;
-#ifdef INET
-		u_ip4 =  (struct in_addr *)(u_name + MAXHOSTNAMELEN);
-#endif
-#ifdef INET6
-#ifdef INET
-		u_ip6 = (struct in6_addr *)(u_ip4 + j32.ip4s);
-#else
-		u_ip6 = (struct in6_addr *)(u_name + MAXHOSTNAMELEN);
-#endif
-#endif
-		opt.uio_iov = optiov;
-		opt.uio_iovcnt = 4;
-		opt.uio_offset = -1;
-		opt.uio_resid = -1;
-		opt.uio_segflg = UIO_SYSSPACE;
-		opt.uio_rw = UIO_READ;
-		opt.uio_td = td;
-		optiov[0].iov_base = "path";
-		optiov[0].iov_len = sizeof("path");
-		optiov[1].iov_base = u_path;
-		error = copyinstr(PTRIN(j32.path), u_path, MAXPATHLEN,
-		    &optiov[1].iov_len);
-		if (error) {
-			free(u_path, M_TEMP);
-			return (error);
-		}
-		optiov[2].iov_base = "host.hostname";
-		optiov[2].iov_len = sizeof("host.hostname");
-		optiov[3].iov_base = u_hostname;
-		error = copyinstr(PTRIN(j32.hostname), u_hostname,
-		    MAXHOSTNAMELEN, &optiov[3].iov_len);
-		if (error) {
-			free(u_path, M_TEMP);
-			return (error);
-		}
-		if (PTRIN(j32.jailname) != NULL) {
-			optiov[opt.uio_iovcnt].iov_base = "name";
-			optiov[opt.uio_iovcnt].iov_len = sizeof("name");
-			opt.uio_iovcnt++;
-			optiov[opt.uio_iovcnt].iov_base = u_name;
-			error = copyinstr(PTRIN(j32.jailname), u_name,
-			    MAXHOSTNAMELEN, &optiov[opt.uio_iovcnt].iov_len);
-			if (error) {
-				free(u_path, M_TEMP);
-				return (error);
-			}
-			opt.uio_iovcnt++;
-		}
-#ifdef INET
-		optiov[opt.uio_iovcnt].iov_base = "ip4.addr";
-		optiov[opt.uio_iovcnt].iov_len = sizeof("ip4.addr");
-		opt.uio_iovcnt++;
-		optiov[opt.uio_iovcnt].iov_base = u_ip4;
-		optiov[opt.uio_iovcnt].iov_len =
-		    j32.ip4s * sizeof(struct in_addr);
-		error = copyin(PTRIN(j32.ip4), u_ip4,
-		    optiov[opt.uio_iovcnt].iov_len);
-		if (error) {
-			free(u_path, M_TEMP);
-			return (error);
-		}
-		opt.uio_iovcnt++;
-#endif
-#ifdef INET6
-		optiov[opt.uio_iovcnt].iov_base = "ip6.addr";
-		optiov[opt.uio_iovcnt].iov_len = sizeof("ip6.addr");
-		opt.uio_iovcnt++;
-		optiov[opt.uio_iovcnt].iov_base = u_ip6;
-		optiov[opt.uio_iovcnt].iov_len =
-		    j32.ip6s * sizeof(struct in6_addr);
-		error = copyin(PTRIN(j32.ip6), u_ip6,
-		    optiov[opt.uio_iovcnt].iov_len);
-		if (error) {
-			free(u_path, M_TEMP);
-			return (error);
-		}
-		opt.uio_iovcnt++;
-#endif
+		CP(j32, j, version);
+		PTRIN_CP(j32, j, path);
+		PTRIN_CP(j32, j, hostname);
+		PTRIN_CP(j32, j, jailname);
+		CP(j32, j, ip4s);
+		CP(j32, j, ip6s);
+		PTRIN_CP(j32, j, ip4);
+		PTRIN_CP(j32, j, ip6);
 		break;
 	}
 
@@ -2229,9 +2097,7 @@ freebsd32_jail(struct thread *td, struct
 		/* Sci-Fi jails are not supported, sorry. */
 		return (EINVAL);
 	}
-	error = kern_jail_set(td, &opt, JAIL_CREATE | JAIL_ATTACH);
-	free(u_path, M_TEMP);
-	return (error);
+	return (kern_jail(td, &j));
 }
 
 int

Modified: head/sys/compat/linux/linux_mib.c
==============================================================================
--- head/sys/compat/linux/linux_mib.c	Wed May 27 13:59:17 2009	(r192894)
+++ head/sys/compat/linux/linux_mib.c	Wed May 27 14:11:23 2009	(r192895)
@@ -57,16 +57,18 @@ struct linux_prison {
 	int	pr_osrel;
 };
 
+static struct linux_prison lprison0 = {
+	.pr_osname =		"Linux",
+	.pr_osrelease =		"2.6.16",
+	.pr_oss_version =	0x030600,
+	.pr_osrel =		2006016
+};
+
 static unsigned linux_osd_jail_slot;
 
 SYSCTL_NODE(_compat, OID_AUTO, linux, CTLFLAG_RW, 0,
 	    "Linux mode");
 
-static struct mtx osname_lock;
-MTX_SYSINIT(linux_osname, &osname_lock, "linux osname", MTX_DEF);
-
-static char	linux_osname[LINUX_MAX_UTSNAME] = "Linux";
-
 static int
 linux_sysctl_osname(SYSCTL_HANDLER_ARGS)
 {
@@ -86,9 +88,6 @@ SYSCTL_PROC(_compat_linux, OID_AUTO, osn
 	    0, 0, linux_sysctl_osname, "A",
 	    "Linux kernel OS name");
 
-static char	linux_osrelease[LINUX_MAX_UTSNAME] = "2.6.16";
-static int	linux_osrel = 2006016;
-
 static int
 linux_sysctl_osrelease(SYSCTL_HANDLER_ARGS)
 {
@@ -108,8 +107,6 @@ SYSCTL_PROC(_compat_linux, OID_AUTO, osr
 	    0, 0, linux_sysctl_osrelease, "A",
 	    "Linux kernel OS release");
 
-static int	linux_oss_version = 0x030600;
-
 static int
 linux_sysctl_oss_version(SYSCTL_HANDLER_ARGS)
 {
@@ -161,69 +158,74 @@ linux_map_osrel(char *osrelease, int *os
 }
 
 /*
- * Returns holding the prison mutex if return non-NULL.
+ * Find a prison with Linux info.
+ * Return the Linux info and the (locked) prison.
  */
 static struct linux_prison *
-linux_get_prison(struct thread *td, struct prison **prp)
+linux_find_prison(struct prison *spr, struct prison **prp)
 {
 	struct prison *pr;
 	struct linux_prison *lpr;
 
-	KASSERT(td == curthread, ("linux_get_prison() called on !curthread"));
-	*prp = pr = td->td_ucred->cr_prison;
-	if (pr == NULL || !linux_osd_jail_slot)
-		return (NULL);
-	mtx_lock(&pr->pr_mtx);
-	lpr = osd_jail_get(pr, linux_osd_jail_slot);
-	if (lpr == NULL)
+	if (!linux_osd_jail_slot)
+		/* In case osd_register failed. */
+		spr = &prison0;
+	for (pr = spr;; pr = pr->pr_parent) {
+		mtx_lock(&pr->pr_mtx);
+		lpr = (pr == &prison0)
+		    ? &lprison0
+		    : osd_jail_get(pr, linux_osd_jail_slot);
+		if (lpr != NULL)
+			break;
 		mtx_unlock(&pr->pr_mtx);
+	}
+	*prp = pr;
 	return (lpr);
 }
 
 /*
- * Ensure a prison has its own Linux info.  The prison should be locked on
- * entrance and will be locked on exit (though it may get unlocked in the
- * interrim).
+ * Ensure a prison has its own Linux info.  If lprp is non-null, point it to
+ * the Linux info and lock the prison.
  */
 static int
 linux_alloc_prison(struct prison *pr, struct linux_prison **lprp)
 {
+	struct prison *ppr;
 	struct linux_prison *lpr, *nlpr;
 	int error;
 
 	/* If this prison already has Linux info, return that. */
 	error = 0;
-	mtx_assert(&pr->pr_mtx, MA_OWNED);
-	lpr = osd_jail_get(pr, linux_osd_jail_slot);
-	if (lpr != NULL)
+	lpr = linux_find_prison(pr, &ppr);
+	if (ppr == pr)
 		goto done;
 	/*
 	 * Allocate a new info record.  Then check again, in case something
 	 * changed during the allocation.
 	 */
-	mtx_unlock(&pr->pr_mtx);
+	mtx_unlock(&ppr->pr_mtx);
 	nlpr = malloc(sizeof(struct linux_prison), M_PRISON, M_WAITOK);
-	mtx_lock(&pr->pr_mtx);
-	lpr = osd_jail_get(pr, linux_osd_jail_slot);
-	if (lpr != NULL) {
+	lpr = linux_find_prison(pr, &ppr);
+	if (ppr == pr) {
 		free(nlpr, M_PRISON);
 		goto done;
 	}
+	/* Inherit the initial values from the ancestor. */
+	mtx_lock(&pr->pr_mtx);
 	error = osd_jail_set(pr, linux_osd_jail_slot, nlpr);
-	if (error)
-		free(nlpr, M_PRISON);
-	else {
+	if (error == 0) {
+		bcopy(lpr, nlpr, sizeof(*lpr));
 		lpr = nlpr;
-		mtx_lock(&osname_lock);
-		strncpy(lpr->pr_osname, linux_osname, LINUX_MAX_UTSNAME);
-		strncpy(lpr->pr_osrelease, linux_osrelease, LINUX_MAX_UTSNAME);
-		lpr->pr_oss_version = linux_oss_version;
-		lpr->pr_osrel = linux_osrel;
-		mtx_unlock(&osname_lock);
+	} else {
+		free(nlpr, M_PRISON);
+		lpr = NULL;
 	}
-done:
+	mtx_unlock(&ppr->pr_mtx);
+ done:
 	if (lprp != NULL)
 		*lprp = lpr;
+	else
+		mtx_unlock(&pr->pr_mtx);
 	return (error);
 }
 
@@ -233,7 +235,6 @@ done:
 static int
 linux_prison_create(void *obj, void *data)
 {
-	int error;
 	struct prison *pr = obj;
 	struct vfsoptlist *opts = data;
 
@@ -243,10 +244,7 @@ linux_prison_create(void *obj, void *dat
 	 * Inherit a prison's initial values from its parent
 	 * (different from NULL which also inherits changes).
 	 */
-	mtx_lock(&pr->pr_mtx);
-	error = linux_alloc_prison(pr, NULL);
-	mtx_unlock(&pr->pr_mtx);
-	return (error);
+	return linux_alloc_prison(pr, NULL);
 }
 
 static int
@@ -254,7 +252,7 @@ linux_prison_check(void *obj __unused, v
 {
 	struct vfsoptlist *opts = data;
 	char *osname, *osrelease;
-	int error, len, oss_version;
+	int error, len, osrel, oss_version;
 
 	/* Check that the parameters are correct. */
 	(void)vfs_flagopt(opts, "linux", NULL, 0);
@@ -280,6 +278,11 @@ linux_prison_check(void *obj __unused, v
 			vfs_opterror(opts, "linux.osrelease too long");
 			return (ENAMETOOLONG);
 		}
+		error = linux_map_osrel(osrelease, &osrel);
+		if (error != 0) {
+			vfs_opterror(opts, "linux.osrelease format error");
+			return (error);
+		}
 	}
 	error = vfs_copyopt(opts, "linux.oss_version", &oss_version,
 	    sizeof(oss_version));
@@ -310,7 +313,7 @@ linux_prison_set(void *obj, void *data)
 		yeslinux = 1;
 	error = vfs_copyopt(opts, "linux.oss_version", &oss_version,
 	    sizeof(oss_version));
-	gotversion = error == 0;
+	gotversion = (error == 0);
 	yeslinux |= gotversion;
 	if (nolinux) {
 		/* "nolinux": inherit the parent's Linux info. */
@@ -322,7 +325,6 @@ linux_prison_set(void *obj, void *data)
 		 * "linux" or "linux.*":
 		 * the prison gets its own Linux info.
 		 */
-		mtx_lock(&pr->pr_mtx);
 		error = linux_alloc_prison(pr, &lpr);
 		if (error) {
 			mtx_unlock(&pr->pr_mtx);
@@ -360,14 +362,16 @@ static int
 linux_prison_get(void *obj, void *data)
 {
 	struct linux_prison *lpr;
+	struct prison *ppr;
 	struct prison *pr = obj;
 	struct vfsoptlist *opts = data;
 	int error, i;
 
-	mtx_lock(&pr->pr_mtx);
-	/* Tell whether this prison has its own Linux info. */
-	lpr = osd_jail_get(pr, linux_osd_jail_slot);
-	i = lpr != NULL;
+	static int version0;
+
+	/* See if this prison is the one with the Linux info. */
+	lpr = linux_find_prison(pr, &ppr);
+	i = (ppr == pr);
 	error = vfs_setopt(opts, "linux", &i, sizeof(i));
 	if (error != 0 && error != ENOENT)
 		goto done;
@@ -375,39 +379,37 @@ linux_prison_get(void *obj, void *data)
 	error = vfs_setopt(opts, "nolinux", &i, sizeof(i));
 	if (error != 0 && error != ENOENT)
 		goto done;
-	/*
-	 * It's kind of bogus to give the root info, but leave it to the caller
-	 * to check the above flag.
-	 */
-	if (lpr != NULL) {
-		error = vfs_setopts(opts, "linux.osname", lpr->pr_osname);
+	if (i) {
+		/*
+		 * If this prison is inheriting its Linux info, report
+		 * empty/zero parameters.
+		 */
+		error = vfs_setopts(opts, "linux.osname", "");
 		if (error != 0 && error != ENOENT)
 			goto done;
-		error = vfs_setopts(opts, "linux.osrelease", lpr->pr_osrelease);
+		error = vfs_setopts(opts, "linux.osrelease", "");
 		if (error != 0 && error != ENOENT)
 			goto done;
-		error = vfs_setopt(opts, "linux.oss_version",
-		    &lpr->pr_oss_version, sizeof(lpr->pr_oss_version));
+		error = vfs_setopt(opts, "linux.oss_version", &version0,
+		    sizeof(lpr->pr_oss_version));
 		if (error != 0 && error != ENOENT)
 			goto done;
 	} else {
-		mtx_lock(&osname_lock);
-		error = vfs_setopts(opts, "linux.osname", linux_osname);
+		error = vfs_setopts(opts, "linux.osname", lpr->pr_osname);
 		if (error != 0 && error != ENOENT)
 			goto done;
-		error = vfs_setopts(opts, "linux.osrelease", linux_osrelease);
+		error = vfs_setopts(opts, "linux.osrelease", lpr->pr_osrelease);
 		if (error != 0 && error != ENOENT)
 			goto done;
 		error = vfs_setopt(opts, "linux.oss_version",
-		    &linux_oss_version, sizeof(linux_oss_version));
+		    &lpr->pr_oss_version, sizeof(lpr->pr_oss_version));
 		if (error != 0 && error != ENOENT)
 			goto done;
-		mtx_unlock(&osname_lock);
 	}
 	error = 0;
 
  done:
-	mtx_unlock(&pr->pr_mtx);
+	mtx_unlock(&ppr->pr_mtx);
 	return (error);
 }
 
@@ -434,11 +436,8 @@ linux_osd_jail_register(void)
 	if (linux_osd_jail_slot > 0) {
 		/* Copy the system linux info to any current prisons. */
 		sx_xlock(&allprison_lock);
-		TAILQ_FOREACH(pr, &allprison, pr_list) {
-			mtx_lock(&pr->pr_mtx);
+		TAILQ_FOREACH(pr, &allprison, pr_list)
 			(void)linux_alloc_prison(pr, NULL);
-			mtx_unlock(&pr->pr_mtx);
-		}
 		sx_xunlock(&allprison_lock);
 	}
 }
@@ -457,15 +456,9 @@ linux_get_osname(struct thread *td, char
 	struct prison *pr;
 	struct linux_prison *lpr;
 
-	lpr = linux_get_prison(td, &pr);
-	if (lpr != NULL) {
-		bcopy(lpr->pr_osname, dst, LINUX_MAX_UTSNAME);
-		mtx_unlock(&pr->pr_mtx);
-	} else {
-		mtx_lock(&osname_lock);
-		bcopy(linux_osname, dst, LINUX_MAX_UTSNAME);
-		mtx_unlock(&osname_lock);
-	}
+	lpr = linux_find_prison(td->td_ucred->cr_prison, &pr);
+	bcopy(lpr->pr_osname, dst, LINUX_MAX_UTSNAME);
+	mtx_unlock(&pr->pr_mtx);
 }
 
 int
@@ -474,16 +467,9 @@ linux_set_osname(struct thread *td, char
 	struct prison *pr;
 	struct linux_prison *lpr;
 
-	lpr = linux_get_prison(td, &pr);
-	if (lpr != NULL) {
-		strlcpy(lpr->pr_osname, osname, LINUX_MAX_UTSNAME);
-		mtx_unlock(&pr->pr_mtx);
-	} else {
-		mtx_lock(&osname_lock);
-		strcpy(linux_osname, osname);
-		mtx_unlock(&osname_lock);
-	}
-
+	lpr = linux_find_prison(td->td_ucred->cr_prison, &pr);
+	strlcpy(lpr->pr_osname, osname, LINUX_MAX_UTSNAME);
+	mtx_unlock(&pr->pr_mtx);
 	return (0);
 }
 
@@ -493,15 +479,9 @@ linux_get_osrelease(struct thread *td, c
 	struct prison *pr;
 	struct linux_prison *lpr;
 
-	lpr = linux_get_prison(td, &pr);
-	if (lpr != NULL) {
-		bcopy(lpr->pr_osrelease, dst, LINUX_MAX_UTSNAME);
-		mtx_unlock(&pr->pr_mtx);
-	} else {
-		mtx_lock(&osname_lock);
-		bcopy(linux_osrelease, dst, LINUX_MAX_UTSNAME);
-		mtx_unlock(&osname_lock);
-	}
+	lpr = linux_find_prison(td->td_ucred->cr_prison, &pr);
+	bcopy(lpr->pr_osrelease, dst, LINUX_MAX_UTSNAME);
+	mtx_unlock(&pr->pr_mtx);
 }
 
 int
@@ -511,12 +491,9 @@ linux_kernver(struct thread *td)
 	struct linux_prison *lpr;
 	int osrel;
 
-	lpr = linux_get_prison(td, &pr);
-	if (lpr != NULL) {
-		osrel = lpr->pr_osrel;
-		mtx_unlock(&pr->pr_mtx);
-	} else
-		osrel = linux_osrel;
+	lpr = linux_find_prison(td->td_ucred->cr_prison, &pr);
+	osrel = lpr->pr_osrel;
+	mtx_unlock(&pr->pr_mtx);
 	return (osrel);
 }
 
@@ -527,27 +504,12 @@ linux_set_osrelease(struct thread *td, c
 	struct linux_prison *lpr;
 	int error;
 
-	lpr = linux_get_prison(td, &pr);
-	if (lpr != NULL) {
-		error = linux_map_osrel(osrelease, &lpr->pr_osrel);
-		if (error) {
-			mtx_unlock(&pr->pr_mtx);
-			return (error);
-		}
+	lpr = linux_find_prison(td->td_ucred->cr_prison, &pr);
+	error = linux_map_osrel(osrelease, &lpr->pr_osrel);
+	if (error == 0)
 		strlcpy(lpr->pr_osrelease, osrelease, LINUX_MAX_UTSNAME);
-		mtx_unlock(&pr->pr_mtx);
-	} else {
-		mtx_lock(&osname_lock);
-		error = linux_map_osrel(osrelease, &linux_osrel);
-		if (error) {
-			mtx_unlock(&osname_lock);
-			return (error);
-		}
-		strcpy(linux_osrelease, osrelease);
-		mtx_unlock(&osname_lock);
-	}
-
-	return (0);
+	mtx_unlock(&pr->pr_mtx);
+	return (error);
 }
 
 int
@@ -557,12 +519,9 @@ linux_get_oss_version(struct thread *td)
 	struct linux_prison *lpr;
 	int version;
 
-	lpr = linux_get_prison(td, &pr);
-	if (lpr != NULL) {
-		version = lpr->pr_oss_version;
-		mtx_unlock(&pr->pr_mtx);
-	} else
-		version = linux_oss_version;
+	lpr = linux_find_prison(td->td_ucred->cr_prison, &pr);
+	version = lpr->pr_oss_version;
+	mtx_unlock(&pr->pr_mtx);
 	return (version);
 }
 
@@ -572,16 +531,9 @@ linux_set_oss_version(struct thread *td,
 	struct prison *pr;
 	struct linux_prison *lpr;
 
-	lpr = linux_get_prison(td, &pr);
-	if (lpr != NULL) {
-		lpr->pr_oss_version = oss_version;
-		mtx_unlock(&pr->pr_mtx);
-	} else {
-		mtx_lock(&osname_lock);
-		linux_oss_version = oss_version;
-		mtx_unlock(&osname_lock);
-	}
-
+	lpr = linux_find_prison(td->td_ucred->cr_prison, &pr);
+	lpr->pr_oss_version = oss_version;
+	mtx_unlock(&pr->pr_mtx);
 	return (0);
 }
 

Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
==============================================================================
--- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c	Wed May 27 13:59:17 2009	(r192894)
+++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c	Wed May 27 14:11:23 2009	(r192895)
@@ -318,8 +318,10 @@ int iplioctl(dev, cmd, data, mode
 #  if (__FreeBSD_version >= 500024)
 struct thread *p;
 #   if (__FreeBSD_version >= 500043)
+#    define	p_cred	td_ucred
 #    define	p_uid	td_ucred->cr_ruid
 #   else
+#    define	p_cred	t_proc->p_cred
 #    define	p_uid	t_proc->p_cred->p_ruid
 #   endif
 #  else
@@ -342,7 +344,11 @@ int mode;
 	SPL_INT(s);
 
 #if (BSD >= 199306) && defined(_KERNEL)
+# if (__FreeBSD_version >= 500034)
+	if (securelevel_ge(p->p_cred, 3) && (mode & FWRITE))
+# else
 	if ((securelevel >= 3) && (mode & FWRITE))
+# endif
 		return EPERM;
 #endif
 

Modified: head/sys/contrib/ipfilter/netinet/ip_nat.c
==============================================================================
--- head/sys/contrib/ipfilter/netinet/ip_nat.c	Wed May 27 13:59:17 2009	(r192894)
+++ head/sys/contrib/ipfilter/netinet/ip_nat.c	Wed May 27 14:11:23 2009	(r192895)
@@ -662,7 +662,11 @@ void *ctx;
 		return EPERM;
 	}
 # else
+#  if defined(__FreeBSD_version) && (__FreeBSD_version >= 500034)
+	if (securelevel_ge(curthread->td_ucred, 3) && (mode & FWRITE)) {
+#  else
 	if ((securelevel >= 3) && (mode & FWRITE)) {
+#  endif
 		return EPERM;
 	}
 # endif

Modified: head/sys/fs/procfs/procfs_status.c
==============================================================================
--- head/sys/fs/procfs/procfs_status.c	Wed May 27 13:59:17 2009	(r192894)
+++ head/sys/fs/procfs/procfs_status.c	Wed May 27 14:11:23 2009	(r192895)
@@ -151,10 +151,11 @@ procfs_doprocstatus(PFS_FILL_ARGS)
 		sbuf_printf(sb, ",%lu", (u_long)cr->cr_groups[i]);
 	}
 
-	if (jailed(p->p_ucred)) {
-		mtx_lock(&p->p_ucred->cr_prison->pr_mtx);
-		sbuf_printf(sb, " %s", p->p_ucred->cr_prison->pr_host);
-		mtx_unlock(&p->p_ucred->cr_prison->pr_mtx);
+	if (jailed(cr)) {
+		mtx_lock(&cr->cr_prison->pr_mtx);
+		sbuf_printf(sb, " %s",
+		    prison_name(td->td_ucred->cr_prison, cr->cr_prison));
+		mtx_unlock(&cr->cr_prison->pr_mtx);
 	} else {
 		sbuf_printf(sb, " -");
 	}

Modified: head/sys/kern/init_main.c
==============================================================================
--- head/sys/kern/init_main.c	Wed May 27 13:59:17 2009	(r192894)
+++ head/sys/kern/init_main.c	Wed May 27 14:11:23 2009	(r192895)
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -436,6 +437,7 @@ proc0_init(void *dummy __unused)
 	td->td_oncpu = 0;
 	td->td_flags = TDF_INMEM|TDP_KTHREAD;
 	td->td_cpuset = cpuset_thread0();
+	prison0.pr_cpuset = cpuset_ref(td->td_cpuset);
 	p->p_peers = 0;
 	p->p_leader = p;
 
@@ -452,7 +454,7 @@ proc0_init(void *dummy __unused)
 	p->p_ucred->cr_ngroups = 1;	/* group 0 */
 	p->p_ucred->cr_uidinfo = uifind(0);
 	p->p_ucred->cr_ruidinfo = uifind(0);
-	p->p_ucred->cr_prison = NULL;	/* Don't jail it. */
+	p->p_ucred->cr_prison = &prison0;
 #ifdef VIMAGE
 	KASSERT(LIST_FIRST(&vimage_head) != NULL, ("vimage_head empty"));
 	P_TO_VIMAGE(p) =  LIST_FIRST(&vimage_head); /* set ucred->cr_vimage */

Modified: head/sys/kern/kern_cpuset.c
==============================================================================
--- head/sys/kern/kern_cpuset.c	Wed May 27 13:59:17 2009	(r192894)
+++ head/sys/kern/kern_cpuset.c	Wed May 27 14:11:23 2009	(r192895)
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -53,7 +54,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 		/* Must come after sys/proc.h */
 
 #include 
 
@@ -225,23 +225,16 @@ cpuset_lookup(cpusetid_t setid, struct t
 
 	KASSERT(td != NULL, ("[%s:%d] td is NULL", __func__, __LINE__));
 	if (set != NULL && jailed(td->td_ucred)) {
-		struct cpuset *rset, *jset;
-		struct prison *pr;
-
-		rset = cpuset_refroot(set);
-
-		pr = td->td_ucred->cr_prison;
-		mtx_lock(&pr->pr_mtx);
-		cpuset_ref(pr->pr_cpuset);
-		jset = pr->pr_cpuset;
-		mtx_unlock(&pr->pr_mtx);
+		struct cpuset *jset, *tset;
 
-		if (jset->cs_id != rset->cs_id) {
+		jset = td->td_ucred->cr_prison->pr_cpuset;
+		for (tset = set; tset != NULL; tset = tset->cs_parent)
+			if (tset == jset)
+				break;
+		if (tset == NULL) {
 			cpuset_rel(set);
 			set = NULL;
 		}
-		cpuset_rel(jset);
-		cpuset_rel(rset);
 	}
 
 	return (set);
@@ -456,25 +449,14 @@ cpuset_which(cpuwhich_t which, id_t id, 
 		struct prison *pr;
 
 		sx_slock(&allprison_lock);
-		pr = prison_find(id);
+		pr = prison_find_child(curthread->td_ucred->cr_prison, id);
 		sx_sunlock(&allprison_lock);
 		if (pr == NULL)
 			return (ESRCH);
-		if (jailed(curthread->td_ucred)) {
-			if (curthread->td_ucred->cr_prison == pr) {
-				cpuset_ref(pr->pr_cpuset);
-				set = pr->pr_cpuset;
-			}
-		} else {
-			cpuset_ref(pr->pr_cpuset);
-			set = pr->pr_cpuset;
-		}
+		cpuset_ref(pr->pr_cpuset);
+		*setp = pr->pr_cpuset;
 		mtx_unlock(&pr->pr_mtx);
-		if (set) {
-			*setp = set;
-			return (0);
-		}
-		return (ESRCH);
+		return (0);
 	}
 	case CPU_WHICH_IRQ:
 		return (0);
@@ -731,21 +713,15 @@ cpuset_thread0(void)
  * In case of no error, returns the set in *setp locked with a reference.
  */
 int
-cpuset_create_root(struct thread *td, struct cpuset **setp)
+cpuset_create_root(struct prison *pr, struct cpuset **setp)
 {
-	struct cpuset *root;
 	struct cpuset *set;
 	int error;
 
-	KASSERT(td != NULL, ("[%s:%d] invalid td", __func__, __LINE__));
+	KASSERT(pr != NULL, ("[%s:%d] invalid pr", __func__, __LINE__));
 	KASSERT(setp != NULL, ("[%s:%d] invalid setp", __func__, __LINE__));
 
-	thread_lock(td);
-	root = cpuset_refroot(td->td_cpuset);
-	thread_unlock(td);
-
-	error = cpuset_create(setp, td->td_cpuset, &root->cs_mask);
-	cpuset_rel(root);
+	error = cpuset_create(setp, pr->pr_cpuset, &pr->pr_cpuset->cs_mask);
 	if (error)
 		return (error);
 

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c	Wed May 27 13:59:17 2009	(r192894)
+++ head/sys/kern/kern_descrip.c	Wed May 27 14:11:23 2009	(r192895)
@@ -2416,24 +2416,25 @@ dupfdopen(struct thread *td, struct file
 }
 
 /*
- * Scan all active processes to see if any of them have a current or root
- * directory of `olddp'. If so, replace them with the new mount point.
+ * Scan all active processes and prisons to see if any of them have a current
+ * or root directory of `olddp'. If so, replace them with the new mount point.
  */
 void
 mountcheckdirs(struct vnode *olddp, struct vnode *newdp)
 {
 	struct filedesc *fdp;
+	struct prison *pr;
 	struct proc *p;
 	int nrele;
 
 	if (vrefcnt(olddp) == 1)
 		return;
+	nrele = 0;
 	sx_slock(&allproc_lock);
 	FOREACH_PROC_IN_SYSTEM(p) {
 		fdp = fdhold(p);
 		if (fdp == NULL)
 			continue;
-		nrele = 0;
 		FILEDESC_XLOCK(fdp);
 		if (fdp->fd_cdir == olddp) {
 			vref(newdp);
@@ -2445,17 +2446,40 @@ mountcheckdirs(struct vnode *olddp, stru
 			fdp->fd_rdir = newdp;
 			nrele++;
 		}
+		if (fdp->fd_jdir == olddp) {
+			vref(newdp);
+			fdp->fd_jdir = newdp;
+			nrele++;
+		}
 		FILEDESC_XUNLOCK(fdp);
 		fddrop(fdp);
-		while (nrele--)
-			vrele(olddp);
 	}
 	sx_sunlock(&allproc_lock);
 	if (rootvnode == olddp) {
-		vrele(rootvnode);
 		vref(newdp);
 		rootvnode = newdp;
+		nrele++;
+	}
+	mtx_lock(&prison0.pr_mtx);
+	if (prison0.pr_root == olddp) {
+		vref(newdp);
+		prison0.pr_root = newdp;
+		nrele++;
+	}
+	mtx_unlock(&prison0.pr_mtx);
+	sx_slock(&allprison_lock);
+	TAILQ_FOREACH(pr, &allprison, pr_list) {
+		mtx_lock(&pr->pr_mtx);
+		if (pr->pr_root == olddp) {
+			vref(newdp);
+			pr->pr_root = newdp;
+			nrele++;
+		}
+		mtx_unlock(&pr->pr_mtx);
 	}
+	sx_sunlock(&allprison_lock);
+	while (nrele--)
+		vrele(olddp);
 }
 
 struct filedesc_to_leader *

Modified: head/sys/kern/kern_exit.c
==============================================================================
--- head/sys/kern/kern_exit.c	Wed May 27 13:59:17 2009	(r192894)
+++ head/sys/kern/kern_exit.c	Wed May 27 14:11:23 2009	(r192895)
@@ -455,9 +455,8 @@ exit1(struct thread *td, int rv)
 	p->p_xstat = rv;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 14:30:26 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AC8A01065689;
	Wed, 27 May 2009 14:30:26 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 97AB38FC2B;
	Wed, 27 May 2009 14:30:26 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4REUQZH099705;
	Wed, 27 May 2009 14:30:26 GMT (envelope-from jamie@svn.freebsd.org)
Received: (from jamie@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4REUQRO099699;
	Wed, 27 May 2009 14:30:26 GMT (envelope-from jamie@svn.freebsd.org)
Message-Id: <200905271430.n4REUQRO099699@svn.freebsd.org>
From: Jamie Gritton 
Date: Wed, 27 May 2009 14:30:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192896 - in head: sys/sys usr.bin/killall
	usr.sbin/jail usr.sbin/jexec usr.sbin/jls
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 14:30:27 -0000

Author: jamie
Date: Wed May 27 14:30:26 2009
New Revision: 192896
URL: http://svn.freebsd.org/changeset/base/192896

Log:
  Add support for the arbitrary named jail parameters used by jail_set(2)
  and jail_get(2).  Jail(8) can now create jails using a "name=value"
  format instead of just specifying a limited set of fixed parameters; it
  can also modify parameters of existing jails.  Jls(8) can display all
  parameters of jails, or a specified set of parameters.  The available
  parameters are gathered from the kernel, and not hard-coded into these
  programs.
  
  Small patches on killall(1) and jexec(8) to support jail names with
  jail_get(2).
  
  Approved by:	bz (mentor)

Modified:
  head/sys/sys/jail.h
  head/usr.bin/killall/killall.1
  head/usr.bin/killall/killall.c
  head/usr.sbin/jail/jail.8
  head/usr.sbin/jail/jail.c
  head/usr.sbin/jexec/Makefile
  head/usr.sbin/jexec/jexec.8
  head/usr.sbin/jexec/jexec.c
  head/usr.sbin/jls/Makefile
  head/usr.sbin/jls/jls.8
  head/usr.sbin/jls/jls.c

Modified: head/sys/sys/jail.h
==============================================================================
--- head/sys/sys/jail.h	Wed May 27 14:11:23 2009	(r192895)
+++ head/sys/sys/jail.h	Wed May 27 14:30:26 2009	(r192896)
@@ -84,19 +84,11 @@ struct xprison {
 	struct in6_addr	 pr_ip6[];
 #endif
 };
-#define	XPRISON_VERSION	3
+#define	XPRISON_VERSION		3
 
-static const struct prison_state {
-	int		pr_state;
-	const char *	state_name;
-} prison_states[] = {
-#define	PRISON_STATE_INVALID		0
-	{ PRISON_STATE_INVALID,		"INVALID" },
-#define	PRISON_STATE_ALIVE		1
-	{ PRISON_STATE_ALIVE,		"ALIVE" },
-#define	PRISON_STATE_DYING		2
-	{ PRISON_STATE_DYING,		"DYING" },
-};
+#define	PRISON_STATE_INVALID	0
+#define	PRISON_STATE_ALIVE	1
+#define	PRISON_STATE_DYING	2
 
 /*
  * Flags for jail_set and jail_get.

Modified: head/usr.bin/killall/killall.1
==============================================================================
--- head/usr.bin/killall/killall.1	Wed May 27 14:11:23 2009	(r192895)
+++ head/usr.bin/killall/killall.1	Wed May 27 14:30:26 2009	(r192896)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 9, 2007
+.Dd May 27, 2009
 .Os
 .Dt KILLALL 1
 .Sh NAME
@@ -34,7 +34,7 @@
 .Nm
 .Op Fl delmsvz
 .Op Fl help
-.Op Fl j Ar jid
+.Op Fl j Ar jail
 .Op Fl u Ar user
 .Op Fl t Ar tty
 .Op Fl c Ar procname
@@ -91,9 +91,9 @@ The signal may be specified either as a 
 (with or without a leading
 .Dq Li SIG ) ,
 or numerically.
-.It Fl j Ar jid
-Kill processes in the jail specified by
-.Ar jid .
+.It Fl j Ar jail
+Kill processes in the specified
+.Ar jail .
 .It Fl u Ar user
 Limit potentially matching processes to those belonging to
 the specified

Modified: head/usr.bin/killall/killall.c
==============================================================================
--- head/usr.bin/killall/killall.c	Wed May 27 14:11:23 2009	(r192895)
+++ head/usr.bin/killall/killall.c	Wed May 27 14:30:26 2009	(r192896)
@@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -51,7 +52,7 @@ static void __dead2
 usage(void)
 {
 
-	fprintf(stderr, "usage: killall [-delmsvz] [-help] [-j jid]\n");
+	fprintf(stderr, "usage: killall [-delmsvz] [-help] [-j jail]\n");
 	fprintf(stderr,
 	    "               [-u user] [-t tty] [-c cmd] [-SIGNAL] [cmd]...\n");
 	fprintf(stderr, "At least one option or argument to specify processes must be given.\n");
@@ -100,6 +101,7 @@ nosig(char *name)
 int
 main(int ac, char **av)
 {
+	struct iovec	jparams[2];
 	struct kinfo_proc *procs = NULL, *newprocs;
 	struct stat	sb;
 	struct passwd	*pw;
@@ -159,12 +161,21 @@ main(int ac, char **av)
 				}
 				jflag++;
 				if (*av == NULL)
-				    	errx(1, "must specify jid");
-				jid = strtol(*av, &ep, 10);
-				if (!*av || *ep)
-					errx(1, "illegal jid: %s", *av);
+				    	errx(1, "must specify jail");
+				jid = strtoul(*av, &ep, 10);
+				if (!**av || *ep) {
+					*(const void **)&jparams[0].iov_base =
+					    "name";
+					jparams[0].iov_len = sizeof("name");
+					jparams[1].iov_base = *av;
+					jparams[1].iov_len = strlen(*av) + 1;
+					jid = jail_get(jparams, 2, 0);
+					if (jid < 0)
+						errx(1, "unknown jail: %s",
+						    *av);
+				}
 				if (jail_attach(jid) == -1)
-					err(1, "jail_attach(): %d", jid);
+					err(1, "jail_attach(%d)", jid);
 				break;
 			case 'u':
 				++*av;

Modified: head/usr.sbin/jail/jail.8
==============================================================================
--- head/usr.sbin/jail/jail.8	Wed May 27 14:11:23 2009	(r192895)
+++ head/usr.sbin/jail/jail.8	Wed May 27 14:30:26 2009	(r192896)
@@ -1,5 +1,6 @@
 .\"
 .\" Copyright (c) 2000, 2003 Robert N. M. Watson
+.\" Copyright (c) 2008 James Gritton
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -33,49 +34,67 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 24, 2009
+.Dd May 27, 2009
 .Dt JAIL 8
 .Os
 .Sh NAME
 .Nm jail
-.Nd "imprison process and its descendants"
+.Nd "create or modify a system jail"
 .Sh SYNOPSIS
 .Nm
+.Op Fl dhi
+.Op Fl J Ar jid_file
+.Op Fl l u Ar username | Fl U Ar username
+.Op Fl c | m
+.Op Ar parameter=value ...
+.Br
+.Nm
 .Op Fl hi
 .Op Fl n Ar jailname
 .Op Fl J Ar jid_file
 .Op Fl s Ar securelevel
 .Op Fl l u Ar username | Fl U Ar username
-.Ar path hostname [ip[,..]] command ...
+.Op Ar path hostname [ip[,..]] command ...
+.Br
+.Nm
+.Op Fl r Ar jail
 .Sh DESCRIPTION
 The
 .Nm
-utility imprisons a process and all future descendants.
+utility creates a new jail or modifies an existing jail, optionally
+imprisoning the current process (and future descendants) inside it.
 .Pp
 The options are as follows:
-.Bl -tag -width ".Fl u Ar username"
+.Bl -tag -width indent
+.It Fl d
+Allow making changes to a
+.Va
+dying jail.
 .It Fl h
-Resolve
-.Va hostname
+Resolve the
+.Va host.hostname
+parameter (or
+.Va hostname )
 and add all IP addresses returned by the resolver
 to the list of
-.Va ip-addresses
-for this prison.
+.Va ip
+addresses for this prison.
 This may affect default address selection for outgoing IPv4 connections
 of prisons.
 The address first returned by the resolver for each address family
 will be used as primary address.
-See
-.Va ip-addresses
-further down for details.
+See the
+.Va ip4.addr
+and
+.Va ip6.addr
+parameters further down for details.
 .It Fl i
 Output the jail identifier of the newly created jail.
 .It Fl n Ar jailname
-Assign and administrative name to the jail that can be used for management
-or auditing purposes.
-The system will
-.Sy not enforce
-the name to be unique.
+Set the jail's name.
+This is deprecated and is equivalent to setting the
+.Va name
+parameter.
 .It Fl J Ar jid_file
 Write a
 .Ar jid_file
@@ -98,9 +117,12 @@ is imported from the current environment
 The environment variables from the login class capability database for the
 target login are also set.
 .It Fl s Ar securelevel
-Sets the
+Set the
 .Va kern.securelevel
-sysctl variable to the specified value inside the newly created jail.
+MIB entry to the specified value inside the newly created jail.
+This is deprecated and is equivalent to setting the
+.Va securelevel
+parameter.
 .It Fl u Ar username
 The user name from host environment as whom the
 .Ar command
@@ -109,20 +131,241 @@ should run.
 The user name from jailed environment as whom the
 .Ar command
 should run.
-.It Ar path
+.It Fl c
+Create a new jail.
+The
+.Va jid
+and
+.Va name
+parameters (if specified) must not refer to an existing jail.
+.It Fl m
+Modify an existing jail.
+One of the
+.Va jid
+or
+.Va name
+parameters must exist and refer to an existing jail.
+.It Fl cm
+Create a jail if it does not exist, or modify a jail if it does exist.
+.It Fl r
+Remove the
+.Ar jail
+specified by jid or name.
+All jailed processes are killed, and all children of this jail are also
+removed.
+.El
+.Pp
+At least one of the
+.Fl c ,
+.Fl m
+or
+.Fl r
+options must be specified.
+.Pp
+.Ar Parameters
+are listed in
+.Dq name=value
+form, following the options.
+Some parameters are boolean, and do not have a value but are set by the
+name alone with or without a
+.Dq no
+prefix, e.g.
+.Va persist
+or
+.Va nopersist .
+Any parameters not set will be given default values, often based on the
+current environment.
+.Pp
+The pseudo-parameter
+.Va command
+specifies that the current process should enter the new (or modified) jail,
+and run the specified command.
+It must be the last parameter specified, because it includes not only
+the value following the
+.Sq =
+sign, but also passes the rest of the arguments to the command.
+.Pp
+Instead of supplying named
+.Ar parameters ,
+four fixed parameters may be supplied in order on the command line:
+.Ar path ,
+.Ar hostname ,
+.Ar ip ,
+and
+.Ar command .
+As the
+.Va jid
+and
+.Va name
+parameters aren't in this list, this mode will always create a new jail, and
+the
+.Fl c
+and
+.Fl o
+options don't apply (and must not exist).
+.Pp
+Jails have a set a core parameters, and modules can add their own jail
+parameters.
+The current set of available parameters can be retrieved via
+.Dq Nm sysctl Fl d Va security.jail.param .
+The core parameters are:
+.Bl -tag -width indent
+.It Va jid
+The jail identifier.
+This will be assigned automatically to a new jail (or can be explicitly
+set), and can be used to identify the jail for later modification, or
+for such commands as
+.Xr jls 8
+or
+.Xr jexec 8 .
+.It Va name
+The jail name.
+This is an arbitrary string that identifies a jail (except it may not
+contain a
+.Sq \&. ) .
+Like the
+.Va jid ,
+it can be passed to later
+.Nm
+commands, or to
+.Xr jls 8
+or
+.Xr jexec 8 .
+If no
+.Va name
+is supplied, a default is assumed that is the same as the
+.Va jid .
+.It Va path
 Directory which is to be the root of the prison.
-.It Ar hostname
-Hostname of the prison.
-.It Ar ip-addresses
-None, one or more IPv4 and IPv6 addresses assigned to the prison.
-The first address of each address family that was assigned to the jail will
-be used as the source address in case source address selection on unbound
-sockets cannot find a better match.
+The
+.Va command
+(if any) is run from this directory, as are commands from
+.Xr jexec 8 .
+.It Va ip4.addr
+A comma-separated list of IPv4 addresses assigned to the prison.
+If this is set, the jail is restricted to using only these address.
+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
+match.
 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 for the address family in question.
-.It Ar command
-Pathname of the program which is to be executed.
+assigned to itself.
+.Pp
+A list of zero elements (an empty string) will stop the jail from using IPv4
+entirely; setting the boolean parameter
+.Ar noip4
+will not restrict the jail at all.
+.It Va ip6.addr
+A list of IPv6 addresses assigned to the prison, the counterpart to
+.Ar ip4.addr
+above.
+.It Va host.hostname
+Hostname of the prison.
+If not specified, a jail will use the system hostname.
+.It Va securelevel
+The value of the jail's
+.Va kern.securelevel
+sysctl.
+A jail never has a lower securelevel than the default 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.
+.It Va enforce_statfs
+This determines which 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
+and
+.Xr fhstatfs 2
+(as well as similar compatibility syscalls).
+When set to 0, all mount points are available without any restrictions.
+When set to 1, only mount points below the jail's chroot directory are
+visible.
+In addition to that, the path to the jail's chroot directory is removed
+from the front of their pathnames.
+When set to 2 (default), above syscalls can operate only on a mount-point
+where the jail's chroot directory is located.
+.It Va persist
+Setting this boolean parameter allows a jail to exist without any
+processes.
+Normally, a jail is destroyed as its last process exits.
+A new jail must have either the
+.Va persist
+parameter or
+.Va command
+pseudo-parameter set.
+.It Va cpuset
+The ID of the cpuset associated with this jail (read-only).
+.It Va dying
+This is true if the jail is in the process of shutting down (read-only).
+.It Va parent
+The
+.Va jid
+of the parent of this jail, or zero if this is a top-level jail
+(read-only).
+.It Va allow.*
+Some restrictions of the jail environment may be set on a per-jail
+basis.
+With the exception of
+.Va allow.set_hostname ,
+these boolean parameters are off by default.
+.Bl -tag -width indent
+.It Va allow.set_hostname
+The jail's hostname may be changed via
+.Xr hostname 1
+or
+.Xr sethostname 3 .
+.It Va allow.sysvipc
+A process within the jail has access to System V IPC primitives.
+In the current jail implementation, System V primitives share a single
+namespace across the host and jail environments, meaning that processes
+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.
+Setting this parameter allows utilities like
+.Xr ping 8
+and
+.Xr traceroute 8
+to operate inside the prison.
+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
+.Dv IP_HDRINCL
+flag has been set on the socket.
+Since raw sockets can be used to configure and interact with various
+network subsystems, extra caution should be used where privileged access
+to jails is given out to untrusted parties.
+.It Va allow.chflags
+Normally, priveleged users inside a jail are treated as unprivileged by
+.Xr chflags 2 .
+When this parameter is set, such users are treated as privileged, and
+may manipulate system file flags subject to the usual constraints on
+.Va kern.securelevel .
+.It Va allow.mount
+privileged users inside the jail will be able to mount and unmount file
+system types marked as jail-friendly.
+The
+.Xr lsvfs 1
+command can be used to find file system types available for mount from
+within a jail.
+.It Va allow.quotas
+The prison 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
+Sockets within a jail are normally restricted to IPv4, IPv6, local
+(UNIX), and route.  This allows access to other protocol stacks that
+have not had jail functionality added to them.
+.It Va allow.jails
+The prison root may create child jails under this jail.  See the
+.Va "Hierarchical Jails"
+section for more information.
+.El
 .El
 .Pp
 Jails are typically set up using one of two philosophies: either to
@@ -142,10 +385,6 @@ process.
 This manual page documents the configuration steps necessary to support
 either of these steps, although the configuration steps may be
 refined based on local requirements.
-.Pp
-Please see the
-.Xr jail 2
-man page for further details.
 .Sh EXAMPLES
 .Ss "Setting up a Jail Directory Tree"
 To set up a jail directory tree containing an entire
@@ -289,7 +528,10 @@ or for running a virtual server.
 .Pp
 Start a shell in the jail:
 .Pp
-.Dl "jail /data/jail/192.0.2.100 testhostname 192.0.2.100 /bin/sh"
+.Bd -literal -offset indent
+jail path=/data/jail/192.0.2.100 host.hostname=testhostname \\
+	ip4.addr=192.0.2.100 command=/bin/sh
+.Ed
 .Pp
 Assuming no errors, you will end up with a shell prompt within the jail.
 You can now run
@@ -359,20 +601,11 @@ To do this, first bring up the
 virtual host interface, and then start the jail's
 .Pa /etc/rc
 script from within the jail.
-.Pp
-NOTE: If you plan to allow untrusted users to have root access inside the
-jail, you may wish to consider setting the
-.Va security.jail.set_hostname_allowed
-sysctl variable to 0.
-Please see the management discussion later in this document as to why this
-may be a good idea.
-If you do decide to set this variable,
-it must be set before starting any jails, and once each boot.
 .Bd -literal -offset indent
 ifconfig ed0 inet alias 192.0.2.100/32
 mount -t procfs proc /data/jail/192.0.2.100/proc
-jail /data/jail/192.0.2.100 testhostname 192.0.2.100 \\
-	/bin/sh /etc/rc
+jail path=/data/jail/192.0.2.100 host.hostname=testhostname \\
+	ip4=addr.192.0.2.100 command=/bin/sh /etc/rc
 .Ed
 .Pp
 A few warnings will be produced, because most
@@ -442,10 +675,15 @@ To kill processes from outside the jail,
 utility in conjunction with the one of the
 .Xr kill 1
 commands above.
+You may also remove the jail with
+.Nm
+.Ar -r ,
+which will killall the jail's processes with
+.Dv SIGKILL .
 .Pp
 The
 .Pa /proc/ Ns Ar pid Ns Pa /status
-file contains, as its last field, the hostname of the jail in which the
+file contains, as its last field, the name of the jail in which the
 process runs, or
 .Dq Li -
 to indicate that the process is not running within a jail.
@@ -454,20 +692,6 @@ The
 command also shows a
 .Ql J
 flag for processes in a jail.
-However, the hostname for a jail may be, by
-default, modified from within the jail, so the
-.Pa /proc
-status entry is unreliable by default.
-To disable the setting of the hostname
-from within a jail, set the
-.Va security.jail.set_hostname_allowed
-sysctl variable in the host environment to 0, which will affect all jails.
-You can have this sysctl set on each boot using
-.Xr sysctl.conf 5 .
-Just add the following line to
-.Pa /etc/sysctl.conf :
-.Pp
-.Dl security.jail.set_hostname_allowed=0
 .Pp
 You can also list/kill processes based on their jail ID.
 To show processes and their jail ID, use the following command:
@@ -488,12 +712,9 @@ It is not possible to
 or
 .Xr umount 8
 any file system inside a jail unless the file system is marked
-jail-friendly.
-See
-.Va security.jail.mount_allowed
-in the
-.Va "Sysctl MIB Entries"
-section.
+jail-friendly and the jail's
+.Va allow.mount
+parameter is set.
 .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
@@ -506,132 +727,77 @@ This means the same user ID in two jails
 system quota.
 One would need to use one file system per jail to make this working.
 .Ss "Sysctl MIB Entries"
-Certain aspects of the jail containments environment may be modified from
-the host environment using
-.Xr sysctl 8
-MIB variables.
-Currently, these variables affect all jails on the system, although in
-the future this functionality may be finer grained.
-.Bl -tag -width XXX
-.It Va security.jail.allow_raw_sockets
-This MIB entry determines whether or not prison root is allowed to
-create raw sockets.
-Setting this MIB to 1 allows utilities like
-.Xr ping 8
-and
-.Xr traceroute 8
-to operate inside the prison.
-If this MIB
-is set, the source IP addresses are enforced to comply
-with the IP address bound to the jail, regardless of whether or not
-the
-.Dv IP_HDRINCL
-flag has been set on the socket.
-Since raw sockets can be used to configure
-and interact with various network subsystems, extra caution should be used
-where privileged access to jails is given out to untrusted parties.
-As such,
-by default this option is disabled.
-.It Va security.jail.enforce_statfs
-This MIB entry determines which 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
-and
-.Xr fhstatfs 2
-(as well as similar compatibility syscalls).
-When set to 0, all mount-points are available without any restrictions.
-When set to 1, only mount-points below the jail's chroot directory are
-visible.
-In addition to that, the path to the jail's chroot directory is removed
-from the front of their pathnames.
-When set to 2 (default), above syscalls can operate only on a mount-point
-where the jail's chroot directory is located.
-.It Va security.jail.set_hostname_allowed
-This MIB entry determines whether or not processes within a jail are
-allowed to change their hostname via
-.Xr hostname 1
-or
-.Xr sethostname 3 .
-In the current jail implementation, the ability to set the hostname from
-within the jail can impact management tools relying on the accuracy of jail
-information in
-.Pa /proc .
-As such, this should be disabled in environments where privileged access to
-jails is given out to untrusted parties.
-.It Va security.jail.socket_unixiproute_only
-The jail functionality binds an IPv4 address to each jail, and limits
-access to other network addresses in the IPv4 space that may be available
-in the host environment.
-However, jail is not currently able to limit access to other network
-protocol stacks that have not had jail functionality added to them.
-As such, by default, processes within jails may only access protocols
-in the following domains:
-.Dv PF_LOCAL , PF_INET ,
-and
-.Dv PF_ROUTE ,
-permitting them access to
-.Ux
-domain sockets,
-IPv4 addresses, and routing sockets.
-To enable access to other domains, this MIB variable may be set to
-0.
-.It Va security.jail.sysvipc_allowed
-This MIB entry determines whether or not processes within a jail have access
-to System V IPC primitives.
-In the current jail implementation, System V primitives share a single
-namespace across the host and jail environments, meaning that processes
-within a jail would be able to communicate with (and potentially interfere
-with) processes outside of the jail, and in other jails.
-As such, this functionality is disabled by default, but can be enabled
-by setting this MIB entry to 1.
-.It Va security.jail.chflags_allowed
-This MIB entry determines how a privileged user inside a jail will be
-treated by
-.Xr chflags 2 .
-If zero, such users are treated as unprivileged, and are unable to set
-or clear system file flags; if non-zero, such users are treated as
-privileged, and may manipulate system file flags subject to the usual
-constraints on
-.Va kern.securelevel .
-.It Va security.jail.mount_allowed
-This MIB entry determines if a privileged user inside a jail will be
-able to mount and unmount file system types marked as jail-friendly.
-The
-.Xr lsvfs 1
-command can be used to find file system types available for mount from within
-a jail.
-This functionality is disabled by default, but can be enabled by setting this
-MIB entry to 1.
-.It Va security.jail.jail_max_af_ips
-This MIB entry determines how may address per address family a prison
-may have. The default is 255.
-.El
-.Pp
-The read-only sysctl variable
+The read-only entry
 .Va security.jail.jailed
 can be used to determine if a process is running inside a jail (value
 is one) or not (value is zero).
 .Pp
-The
-.Va security.jail.list
-MIB entry is read-only and it returns an array of
-.Vt "struct xprison"
-defined in
-.In sys/jail.h .
-It is recommended to use the
-.Xr jls 8
-utility to see current active list of jails.
+The variable
+.Va security.jail.max_af_ips
+determines how may address per address family a prison may have.
+The default is 255.
 .Pp
-There are currently two MIB related variables that have per-jail settings.
+There are currently two MIB variables that have per-jail settings.
 Changes to these variables by a jailed process do not effect the host
 environment, only the jail environment.
 The variables are
 .Va kern.securelevel
 and
 .Va kern.hostname .
+.Ss "Hierarchical Jails"
+By setting a jail's
+.Va allow.jails
+parameter, processes within a jail may be able to create jails of their own.
+These child jails are kept in a hierarchy, with jails only able to see and/or
+modify the jails they created (or those jails' children).
+Each jail has a read-only
+.Va parent
+parameter, containing the
+.Va jid
+of the jail that created it; a
+.Va jid
+of 0 indicates the jail is a child of the current jail (or is a top-level
+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
+.Va allow.nomount ,
+it is not able to create a jail with
+.Va allow.mount
+set.
+Similarly, such restrictions as
+.Va ip4.addr
+and
+.Va securelevel
+may not be bypassed in child jails.
+.Pp
+A child jail may in turn create its own child jails if its own
+.Va allow.jails
+parameter is set (remember it is off by default).
+These jails are visible to and can be modified by their parent and all
+ancestors.
+.Pp
+Jail names reflect this hierarchy, with a full name being an MIB-type string
+separated by dots.
+For example, if a base system process creates a jail
+.Dq foo ,
+and a process under that jail creates another jail
+.Dq bar ,
+then the second jail will be seen as
+.Dq foo.bar
+in the base system (though it is only seen as
+.Dq bar
+to any processes inside jail
+.Dq foo ) .
+Jids on the other hand exist in a single space, and each jail must have a
+unique jid.
+.Pp
+Like the names, a child jail's
+.Va path
+is relative to its creator's own
+.Va path .
+This is by virtue of the child jail being created in the chrooted
+environment of the first jail.
 .Sh SEE ALSO
 .Xr killall 1 ,
 .Xr lsvfs 1 ,
@@ -641,7 +807,7 @@ and
 .Xr ps 1 ,
 .Xr quota 1 ,
 .Xr chroot 2 ,
-.Xr jail 2 ,
+.Xr jail_set 2 ,
 .Xr jail_attach 2 ,
 .Xr procfs 5 ,
 .Xr rc.conf 5 ,
@@ -665,6 +831,8 @@ The
 .Nm
 utility appeared in
 .Fx 4.0 .
+Hierarchical/extensible jails were introduced in
+.Fx 8.0 .
 .Sh AUTHORS
 .An -nosplit
 The jail feature was written by
@@ -683,6 +851,9 @@ added multi-IP jail support for IPv4 and
 originally done by
 .An Pawel Jakub Dawidek
 for IPv4.
+.Pp
+.An James Gritton
+added the extensible jail parameters and hierchical jails.
 .Sh BUGS
 Jail currently lacks the ability to allow access to
 specific jail information via

Modified: head/usr.sbin/jail/jail.c
==============================================================================
--- head/usr.sbin/jail/jail.c	Wed May 27 14:11:23 2009	(r192895)
+++ head/usr.sbin/jail/jail.c	Wed May 27 14:30:26 2009	(r192896)
@@ -1,5 +1,6 @@
 /*-
  * Copyright (c) 1999 Poul-Henning Kamp.
+ * Copyright (c) 2009 James Gritton
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -29,50 +30,53 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
 #include 
 #include 
-#include 
+#include 
 
-#include 
 #include 
-#include 
+#include 
 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
-static void		usage(void);
-static int		add_addresses(struct addrinfo *);
-static struct in_addr	*copy_addr4(void);
+#define	SJPARAM		"security.jail.param"
+#define	ERRMSG_SIZE	256
+
+struct param {
+	struct iovec name;
+	struct iovec value;
+};
+
+static struct param *params;
+static char **param_values;
+static int nparams;
+
+static char *ip4_addr;
 #ifdef INET6
-static struct in6_addr	*copy_addr6(void);
+static char *ip6_addr;
 #endif
 
-extern char	**environ;
-
-struct addr4entry {
-	STAILQ_ENTRY(addr4entry)	addr4entries;
-	struct in_addr			ip4;
-	int				count;
-};
-struct addr6entry {
-	STAILQ_ENTRY(addr6entry)	addr6entries;
+static void add_ip_addr(char **addrp, char *newaddr);
 #ifdef INET6
-	struct in6_addr			ip6;
+static void add_ip_addr46(char *newaddr);
 #endif
-	int				count;
-};
-STAILQ_HEAD(addr4head, addr4entry) addr4 = STAILQ_HEAD_INITIALIZER(addr4);
-STAILQ_HEAD(addr6head, addr6entry) addr6 = STAILQ_HEAD_INITIALIZER(addr6);
+static void add_ip_addrinfo(int ai_flags, char *value);
+static void quoted_print(FILE *fp, char *str);
+static void set_param(const char *name, char *value);
+static void usage(void);
+
+extern char **environ;
 
 #define GET_USER_INFO do {						\
 	pwd = getpwnam(username);					\
@@ -94,25 +98,28 @@ int
 main(int argc, char **argv)
 {
 	login_cap_t *lcap = NULL;
-	struct jail j;
+	struct iovec rparams[2];
 	struct passwd *pwd = NULL;
 	gid_t groups[NGROUPS];
-	int ch, error, i, ngroups, securelevel;
-	int hflag, iflag, Jflag, lflag, uflag, Uflag;
-	char path[PATH_MAX], *jailname, *ep, *username, *JidFile, *ip;
+	int ch, cmdarg, i, jail_set_flags, jid, ngroups;
+	int hflag, iflag, Jflag, lflag, rflag, uflag, Uflag;
+	char *ep, *jailname, *securelevel, *username, *JidFile;
+	char errmsg[ERRMSG_SIZE];
 	static char *cleanenv;
 	const char *shell, *p = NULL;
-	long ltmp;
 	FILE *fp;
-	struct addrinfo hints, *res0;
 
-	hflag = iflag = Jflag = lflag = uflag = Uflag = 0;
-	securelevel = -1;
-	jailname = username = JidFile = cleanenv = NULL;
+	hflag = iflag = Jflag = lflag = rflag = uflag = Uflag =
+	    jail_set_flags = 0;
+	cmdarg = jid = -1;
+	jailname = securelevel = username = JidFile = cleanenv = NULL;
 	fp = NULL;
 
-	while ((ch = getopt(argc, argv, "hiln:s:u:U:J:")) != -1) {
+	while ((ch = getopt(argc, argv, "cdhilmn:r:s:u:U:J:")) != -1) {
 		switch (ch) {
+		case 'd':
+			jail_set_flags |= JAIL_DYING;
+			break;
 		case 'h':
 			hflag = 1;
 			break;
@@ -127,10 +134,7 @@ main(int argc, char **argv)
 			jailname = optarg;
 			break;
 		case 's':
-			ltmp = strtol(optarg, &ep, 0);
-			if (*ep || ep == optarg || ltmp > INT_MAX || !ltmp)
-				errx(1, "invalid securelevel: `%s'", optarg);
-			securelevel = ltmp;
+			securelevel = optarg;
 			break;
 		case 'u':
 			username = optarg;
@@ -143,13 +147,39 @@ main(int argc, char **argv)
 		case 'l':
 			lflag = 1;
 			break;
+		case 'c':
+			jail_set_flags |= JAIL_CREATE;
+			break;
+		case 'm':
+			jail_set_flags |= JAIL_UPDATE;
+			break;
+		case 'r':
+			jid = strtoul(optarg, &ep, 10);
+			if (!*optarg || *ep) {
+				*(const void **)&rparams[0].iov_base = "name";
+				rparams[0].iov_len = sizeof("name");
+				rparams[1].iov_base = optarg;
+				rparams[1].iov_len = strlen(optarg) + 1;
+				jid = jail_get(rparams, 2, 0);
+				if (jid < 0)
+					errx(1, "unknown jail: %s", optarg);
+			}
+			rflag = 1;
+			break;
 		default:
 			usage();
 		}
 	}
 	argc -= optind;
 	argv += optind;
-	if (argc < 4)
+	if (rflag) {
+		if (argc > 0 || iflag || Jflag || lflag || uflag || Uflag)
+			usage();
+		if (jail_remove(jid) < 0)
+			err(1, "jail_remove");
+		exit (0);
+	}
+	if (argc == 0)
 		usage();
 	if (uflag && Uflag)
 		usage();
@@ -157,92 +187,118 @@ main(int argc, char **argv)
 		usage();
 	if (uflag)
 		GET_USER_INFO;
-	if (realpath(argv[0], path) == NULL)
-		err(1, "realpath: %s", argv[0]);
-	if (chdir(path) != 0)
-		err(1, "chdir: %s", path);
-	/* Initialize struct jail. */
-	memset(&j, 0, sizeof(j));
-	j.version = JAIL_API_VERSION;
-	j.path = path;
-	j.hostname = argv[1];
-	if (jailname != NULL)
-		j.jailname = jailname;
-
-	/* Handle IP addresses. If requested resolve hostname too. */
-	bzero(&hints, sizeof(struct addrinfo));
-	hints.ai_protocol = IPPROTO_TCP;
-	hints.ai_socktype = SOCK_STREAM;
-	if (JAIL_API_VERSION < 2)
-		hints.ai_family = PF_INET;
-	else
-		hints.ai_family = PF_UNSPEC;
-	/* Handle hostname. */
-	if (hflag != 0) {

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 14:32:04 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 53D3D1065696;
	Wed, 27 May 2009 14:32:04 +0000 (UTC)
	(envelope-from sson@freebsd.org)
Received: from www.son.org (son.org [199.239.233.23])
	by mx1.freebsd.org (Postfix) with ESMTP id 18B648FC23;
	Wed, 27 May 2009 14:32:03 +0000 (UTC)
	(envelope-from sson@freebsd.org)
Received: from NextStepNG.son.org (adsl-76-203-228-11.dsl.rcsntx.sbcglobal.net
	[76.203.228.11]) (authenticated bits=0)
	by www.son.org (8.13.6.20060614/8.13.6) with ESMTP id n4REW1gv048660;
	Wed, 27 May 2009 09:32:01 -0500 (CDT)
Message-ID: <4A1D4EE1.5040902@freebsd.org>
Date: Wed, 27 May 2009 09:32:01 -0500
From: Stacey Son 
User-Agent: Thunderbird 2.0.0.21 (Macintosh/20090302)
MIME-Version: 1.0
To: Kostik Belousov 
References: <200905262139.n4QLd9pI074530@svn.freebsd.org>
	<20090527111741.GH1927@deviant.kiev.zoral.com.ua>
In-Reply-To: <20090527111741.GH1927@deviant.kiev.zoral.com.ua>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r192859 - in head: share/man/man4 sys/conf
 sys/dev/ksyms sys/kern sys/modules sys/modules/ksyms sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 14:32:05 -0000

Kostik Belousov wrote:
> On Tue, May 26, 2009 at 09:39:09PM +0000, Stacey Son wrote:
>   
>> Author: sson
>> Date: Tue May 26 21:39:09 2009
>> New Revision: 192859
>> URL: http://svn.freebsd.org/changeset/base/192859
>>
>> Log:
>>   Add the ksyms(4) pseudo driver.  The ksyms driver allows a process to
>>   get a quick snapshot of the kernel's symbol table including the symbols
>>   from any loaded modules (the symbols are all merged into one symbol
>>   table).  Unlike like other implementations, this ksyms driver maps
>>   memory in the process memory space to store the snapshot at the time
>>   /dev/ksyms is opened.  It also checks to see if the process has already
>>   a snapshot open and won't allow it to open /dev/ksyms it again until it
>>   closes first.  This prevents kernel and process memory from being
>>   exhausted.  Note that /dev/ksyms is used by the lockstat(1) command.
>>   
>>   Reviewed by:	gallatin kib (freebsd-arch)
>>   Approved by:	gnn (mentor)
>>     
>
> What is the reason to have ksyms_unmap() ?
 

ksyms_unmap() is used to free the mapping of the memory when /dev/ksyms 
is closed or if the driver fails to create the symbol table snapshot.

> Why do you think that checking
> for the present mapping of the freed region is neccessary ?

ksyms_unmap() does check to make sure the memory region is mapped since 
it is possible that the process could have unmap it or changed its 
protection before calling close().   I haven't looked at vm_map_delete() 
closely but maybe it make makes this check as well.  If so, this check 
might be redundant.

-stacey.



From owner-svn-src-head@FreeBSD.ORG  Wed May 27 14:38:09 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7E0201065674;
	Wed, 27 May 2009 14:38:09 +0000 (UTC)
	(envelope-from kostikbel@gmail.com)
Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147])
	by mx1.freebsd.org (Postfix) with ESMTP id 1ADBF8FC13;
	Wed, 27 May 2009 14:38:08 +0000 (UTC)
	(envelope-from kostikbel@gmail.com)
Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua)
	by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256)
	(Exim 4.63 (FreeBSD)) (envelope-from )
	id 1M9KGd-000GOY-Mo; Wed, 27 May 2009 17:38:07 +0300
Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua
	[10.1.1.148])
	by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n4REc32x054250
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Wed, 27 May 2009 17:38:03 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1])
	by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id
	n4REc3uI052307; Wed, 27 May 2009 17:38:03 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
Received: (from kostik@localhost)
	by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n4REc2vn052306; 
	Wed, 27 May 2009 17:38:02 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to
	kostikbel@gmail.com using -f
Date: Wed, 27 May 2009 17:38:02 +0300
From: Kostik Belousov 
To: Stacey Son 
Message-ID: <20090527143802.GJ1927@deviant.kiev.zoral.com.ua>
References: <200905262139.n4QLd9pI074530@svn.freebsd.org>
	<20090527111741.GH1927@deviant.kiev.zoral.com.ua>
	<4A1D4EE1.5040902@freebsd.org>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="eC/ZNrsTjQGziECw"
Content-Disposition: inline
In-Reply-To: <4A1D4EE1.5040902@freebsd.org>
User-Agent: Mutt/1.4.2.3i
X-Virus-Scanned: clamav-milter 0.95.1 at skuns.kiev.zoral.com.ua
X-Virus-Status: Clean
X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00
	autolearn=ham version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on
	skuns.kiev.zoral.com.ua
X-Virus-Scanned: mail.terabit.net.ua 1M9KGd-000GOY-Mo
	aa2b7cd58086ea54cc8cd3c8bc60b08b
X-Terabit: YES
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r192859 - in head: share/man/man4 sys/conf
	sys/dev/ksyms sys/kern sys/modules sys/modules/ksyms sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 14:38:10 -0000


--eC/ZNrsTjQGziECw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, May 27, 2009 at 09:32:01AM -0500, Stacey Son wrote:
> Kostik Belousov wrote:
> >On Tue, May 26, 2009 at 09:39:09PM +0000, Stacey Son wrote:
> > =20
> >>Author: sson
> >>Date: Tue May 26 21:39:09 2009
> >>New Revision: 192859
> >>URL: http://svn.freebsd.org/changeset/base/192859
> >>
> >>Log:
> >>  Add the ksyms(4) pseudo driver.  The ksyms driver allows a process to
> >>  get a quick snapshot of the kernel's symbol table including the symbo=
ls
> >>  from any loaded modules (the symbols are all merged into one symbol
> >>  table).  Unlike like other implementations, this ksyms driver maps
> >>  memory in the process memory space to store the snapshot at the time
> >>  /dev/ksyms is opened.  It also checks to see if the process has alrea=
dy
> >>  a snapshot open and won't allow it to open /dev/ksyms it again until =
it
> >>  closes first.  This prevents kernel and process memory from being
> >>  exhausted.  Note that /dev/ksyms is used by the lockstat(1) command.
> >> =20
> >>  Reviewed by:	gallatin kib (freebsd-arch)
> >>  Approved by:	gnn (mentor)
> >>   =20
> >
> >What is the reason to have ksyms_unmap() ?
>=20
>=20
> ksyms_unmap() is used to free the mapping of the memory when /dev/ksyms=
=20
> is closed or if the driver fails to create the symbol table snapshot.
That was introduction sentence for the next question. And actually, it
should be formulated as "why you did not used vm_map_remove()".

>=20
> >Why do you think that checking
> >for the present mapping of the freed region is neccessary ?
>=20
> ksyms_unmap() does check to make sure the memory region is mapped since=
=20
> it is possible that the process could have unmap it or changed its=20
> protection before calling close().   I haven't looked at vm_map_delete()=
=20
> closely but maybe it make makes this check as well.  If so, this check=20
> might be redundant.

How this check verifies that process did not unmapped the region and
then mapped something other over it ?

My point is that this check is not needed at all. If user mode unmapped
this area, so be it. If it mapped something over it, then it should be
ready to loose the mapping on ksyms close. Replace the ksyms_unmap()
with vm_map_remove.

--eC/ZNrsTjQGziECw
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEARECAAYFAkodUEkACgkQC3+MBN1Mb4iSQgCeMPSPiCOMr78jgxn8dIjiml8c
rv0AoIJRTlobWNVFdxDvbMqzDw9/W7n5
=w6fj
-----END PGP SIGNATURE-----

--eC/ZNrsTjQGziECw--

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 15:02:32 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 66C01106564A;
	Wed, 27 May 2009 15:02:32 +0000 (UTC)
	(envelope-from sson@freebsd.org)
Received: from www.son.org (son.org [199.239.233.23])
	by mx1.freebsd.org (Postfix) with ESMTP id 118A38FC18;
	Wed, 27 May 2009 15:02:31 +0000 (UTC)
	(envelope-from sson@freebsd.org)
Received: from NextStepNG.son.org (adsl-76-203-228-11.dsl.rcsntx.sbcglobal.net
	[76.203.228.11]) (authenticated bits=0)
	by www.son.org (8.13.6.20060614/8.13.6) with ESMTP id n4RF2UOC057024;
	Wed, 27 May 2009 10:02:31 -0500 (CDT)
Message-ID: <4A1D5606.70807@freebsd.org>
Date: Wed, 27 May 2009 10:02:30 -0500
From: Stacey Son 
User-Agent: Thunderbird 2.0.0.21 (Macintosh/20090302)
MIME-Version: 1.0
To: Kostik Belousov 
References: <200905262139.n4QLd9pI074530@svn.freebsd.org>
	<20090527111741.GH1927@deviant.kiev.zoral.com.ua>
	<4A1D4EE1.5040902@freebsd.org>
	<20090527143802.GJ1927@deviant.kiev.zoral.com.ua>
In-Reply-To: <20090527143802.GJ1927@deviant.kiev.zoral.com.ua>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r192859 - in head: share/man/man4 sys/conf
 sys/dev/ksyms sys/kern sys/modules sys/modules/ksyms sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 15:02:32 -0000

Kostik Belousov wrote:
> "why you did not used vm_map_remove()".
>   
Yes, indeed...  I should have just used vm_map_remove() since it does 
the same thing.  I will make that change.

Thanks,

-stacey.

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 15:15:58 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A05F2106579D;
	Wed, 27 May 2009 15:15:58 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8E1C58FC1C;
	Wed, 27 May 2009 15:15:58 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RFFwlW000925;
	Wed, 27 May 2009 15:15:58 GMT (envelope-from des@svn.freebsd.org)
Received: (from des@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RFFwg5000924;
	Wed, 27 May 2009 15:15:58 GMT (envelope-from des@svn.freebsd.org)
Message-Id: <200905271515.n4RFFwg5000924@svn.freebsd.org>
From: Dag-Erling Smorgrav 
Date: Wed, 27 May 2009 15:15:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192897 - head/tools/regression/vfs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 15:15:59 -0000

Author: des
Date: Wed May 27 15:15:58 2009
New Revision: 192897
URL: http://svn.freebsd.org/changeset/base/192897

Log:
  Increment the counter outside the subshell.

Modified:
  head/tools/regression/vfs/trailing_slash.t

Modified: head/tools/regression/vfs/trailing_slash.t
==============================================================================
--- head/tools/regression/vfs/trailing_slash.t	Wed May 27 14:30:26 2009	(r192896)
+++ head/tools/regression/vfs/trailing_slash.t	Wed May 27 15:15:58 2009	(r192897)
@@ -37,6 +37,6 @@ for testspec ; do
 		else
 			echo "fail $n - expected $4, got $ret"
 		fi
-		n=$((n+1))
 	)
+	n=$((n+1))
 done

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 15:16:56 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E13F210656C6;
	Wed, 27 May 2009 15:16:56 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CD7C58FC12;
	Wed, 27 May 2009 15:16:56 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RFGu5F000996;
	Wed, 27 May 2009 15:16:56 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RFGu2A000994;
	Wed, 27 May 2009 15:16:56 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Message-Id: <200905271516.n4RFGu2A000994@svn.freebsd.org>
From: Rick Macklem 
Date: Wed, 27 May 2009 15:16:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192898 - head/sys/fs/nfs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 15:16:59 -0000

Author: rmacklem
Date: Wed May 27 15:16:56 2009
New Revision: 192898
URL: http://svn.freebsd.org/changeset/base/192898

Log:
  Add a function to the experimental nfs subsystem that tests to see
  if a local file system supports NFSv4 ACLs. This allows the
  NFSHASNFS4ACL() macro to be correctly implemented. The NFSv4 ACL
  support should now work when the server exports a ZFS volume.
  
  Approved by:	kib (mentor)

Modified:
  head/sys/fs/nfs/nfs_commonport.c
  head/sys/fs/nfs/nfsport.h

Modified: head/sys/fs/nfs/nfs_commonport.c
==============================================================================
--- head/sys/fs/nfs/nfs_commonport.c	Wed May 27 15:15:58 2009	(r192897)
+++ head/sys/fs/nfs/nfs_commonport.c	Wed May 27 15:16:56 2009	(r192898)
@@ -426,6 +426,28 @@ newnfs_portinit(void)
 	mtx_init(&nfs_state_mutex, "nfs_state_mutex", NULL, MTX_DEF);
 }
 
+#ifdef NFS4_ACL_EXTATTR_NAME
+/*
+ * Determine if the file system supports NFSv4 ACLs.
+ * Return 1 if it does, 0 otherwise.
+ */
+int
+nfs_supportsnfsv4acls(struct mount *mp)
+{
+
+	if (mp->mnt_stat.f_fstypename == NULL)
+		return (0);
+	if (strcmp(mp->mnt_stat.f_fstypename, "ufs") == 0) {
+		/* Not yet */
+		return (0);
+	} else if (strcmp(mp->mnt_stat.f_fstypename, "zfs") == 0) {
+		/* Always supports them */
+		return (1);
+	}
+	return (0);
+}
+#endif	/* NFS4_ACL_EXTATTR_NAME */
+
 extern int (*nfsd_call_nfscommon)(struct thread *, struct nfssvc_args *);
 
 /*

Modified: head/sys/fs/nfs/nfsport.h
==============================================================================
--- head/sys/fs/nfs/nfsport.h	Wed May 27 15:15:58 2009	(r192897)
+++ head/sys/fs/nfs/nfsport.h	Wed May 27 15:16:56 2009	(r192898)
@@ -787,7 +787,8 @@ void newnfs_realign(struct mbuf **);
 #define	NFSSETWRITEVERF(n)	((n)->nm_state |= NFSSTA_HASWRITEVERF)
 #define	NFSSETHASSETFSID(n)	((n)->nm_state |= NFSSTA_HASSETFSID)
 #ifdef NFS4_ACL_EXTATTR_NAME
-#define	NFSHASNFS4ACL(m)	0
+#define	NFSHASNFS4ACL(m)	nfs_supportsnfsv4acls(m)
+int nfs_supportsnfsv4acls(struct mount *);
 #else
 #define	NFSHASNFS4ACL(m)	0
 #endif

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 15:23:13 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 47D511065688;
	Wed, 27 May 2009 15:23:13 +0000 (UTC) (envelope-from avg@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 35D478FC22;
	Wed, 27 May 2009 15:23:13 +0000 (UTC) (envelope-from avg@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RFNDme001263;
	Wed, 27 May 2009 15:23:13 GMT (envelope-from avg@svn.freebsd.org)
Received: (from avg@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RFND0x001262;
	Wed, 27 May 2009 15:23:13 GMT (envelope-from avg@svn.freebsd.org)
Message-Id: <200905271523.n4RFND0x001262@svn.freebsd.org>
From: Andriy Gapon 
Date: Wed, 27 May 2009 15:23:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192899 - head/sys/compat/linux
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 15:23:14 -0000

Author: avg
Date: Wed May 27 15:23:12 2009
New Revision: 192899
URL: http://svn.freebsd.org/changeset/base/192899

Log:
  linux_ioctl_cdrom: reduce stack usage
  
  ... by moving two ~2KB structures from stack to heap allocation.
  I experienced stack overflow in linux emulation on i386 (8K stack)
  when LINUX_DVD_READ_STRUCT ioctl was performed on atapicam cd
  device and there was an error that resulted in additional quite
  heavy stack use in cam layer.
  
  Reviewed by:	dchagin
  Approved by:	jhb (mentor)

Modified:
  head/sys/compat/linux/linux_ioctl.c

Modified: head/sys/compat/linux/linux_ioctl.c
==============================================================================
--- head/sys/compat/linux/linux_ioctl.c	Wed May 27 15:16:56 2009	(r192898)
+++ head/sys/compat/linux/linux_ioctl.c	Wed May 27 15:23:12 2009	(r192899)
@@ -1556,23 +1556,28 @@ linux_ioctl_cdrom(struct thread *td, str
 	/* LINUX_CDROMAUDIOBUFSIZ */
 
 	case LINUX_DVD_READ_STRUCT: {
-		l_dvd_struct lds;
-		struct dvd_struct bds;
+		l_dvd_struct *lds;
+		struct dvd_struct *bds;
 
-		error = copyin((void *)args->arg, &lds, sizeof(lds));
+		lds = malloc(sizeof(*lds), M_LINUX, M_WAITOK);
+		bds = malloc(sizeof(*bds), M_LINUX, M_WAITOK);
+		error = copyin((void *)args->arg, lds, sizeof(*lds));
 		if (error)
-			break;
-		error = linux_to_bsd_dvd_struct(&lds, &bds);
+			goto out;
+		error = linux_to_bsd_dvd_struct(lds, bds);
 		if (error)
-			break;
-		error = fo_ioctl(fp, DVDIOCREADSTRUCTURE, (caddr_t)&bds,
+			goto out;
+		error = fo_ioctl(fp, DVDIOCREADSTRUCTURE, (caddr_t)bds,
 		    td->td_ucred, td);
 		if (error)
-			break;
-		error = bsd_to_linux_dvd_struct(&bds, &lds);
+			goto out;
+		error = bsd_to_linux_dvd_struct(bds, lds);
 		if (error)
-			break;
-		error = copyout(&lds, (void *)args->arg, sizeof(lds));
+			goto out;
+		error = copyout(lds, (void *)args->arg, sizeof(*lds));
+	out:
+		free(bds, M_LINUX);
+		free(lds, M_LINUX);
 		break;
 	}
 

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 15:46:24 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 777F4106566B;
	Wed, 27 May 2009 15:46:24 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 65C8E8FC19;
	Wed, 27 May 2009 15:46:24 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RFkMTE002001;
	Wed, 27 May 2009 15:46:22 GMT (envelope-from des@svn.freebsd.org)
Received: (from des@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RFkMEq002000;
	Wed, 27 May 2009 15:46:22 GMT (envelope-from des@svn.freebsd.org)
Message-Id: <200905271546.n4RFkMEq002000@svn.freebsd.org>
From: Dag-Erling Smorgrav 
Date: Wed, 27 May 2009 15:46:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192900 - head/sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 15:46:24 -0000

Author: des
Date: Wed May 27 15:46:22 2009
New Revision: 192900
URL: http://svn.freebsd.org/changeset/base/192900

Log:
  Expand namei flag definitions to the full eight nybbles.
  
  MFC after:	3 weeks

Modified:
  head/sys/sys/namei.h

Modified: head/sys/sys/namei.h
==============================================================================
--- head/sys/sys/namei.h	Wed May 27 15:23:12 2009	(r192899)
+++ head/sys/sys/namei.h	Wed May 27 15:46:22 2009	(r192900)
@@ -123,26 +123,26 @@ struct nameidata {
  * name being sought. The caller is responsible for releasing the
  * buffer and for vrele'ing ni_startdir.
  */
-#define	RDONLY		0x0000200 /* lookup with read-only semantics */
-#define	HASBUF		0x0000400 /* has allocated pathname buffer */
-#define	SAVENAME	0x0000800 /* save pathname buffer */
-#define	SAVESTART	0x0001000 /* save starting directory */
-#define ISDOTDOT	0x0002000 /* current component name is .. */
-#define MAKEENTRY	0x0004000 /* entry is to be added to name cache */
-#define ISLASTCN	0x0008000 /* this is last component of pathname */
-#define ISSYMLINK	0x0010000 /* symlink needs interpretation */
-#define	ISWHITEOUT	0x0020000 /* found whiteout */
-#define	DOWHITEOUT	0x0040000 /* do whiteouts */
-#define	WILLBEDIR	0x0080000 /* new files will be dirs; allow trailing / */
-#define	ISUNICODE	0x0100000 /* current component name is unicode*/
-#define	ISOPEN		0x0200000 /* caller is opening; return a real vnode. */
-#define	NOCROSSMOUNT	0x0400000 /* do not cross mount points */
-#define	NOMACCHECK	0x0800000 /* do not perform MAC checks */
-#define	MPSAFE		0x1000000 /* namei() must acquire Giant if needed. */
-#define	GIANTHELD	0x2000000 /* namei() is holding giant. */
-#define	AUDITVNODE1	0x4000000 /* audit the looked up vnode information */
-#define	AUDITVNODE2 	0x8000000 /* audit the looked up vnode information */
-#define	PARAMASK	0xffffe00 /* mask of parameter descriptors */
+#define	RDONLY		0x00000200 /* lookup with read-only semantics */
+#define	HASBUF		0x00000400 /* has allocated pathname buffer */
+#define	SAVENAME	0x00000800 /* save pathname buffer */
+#define	SAVESTART	0x00001000 /* save starting directory */
+#define	ISDOTDOT	0x00002000 /* current component name is .. */
+#define	MAKEENTRY	0x00004000 /* entry is to be added to name cache */
+#define	ISLASTCN	0x00008000 /* this is last component of pathname */
+#define	ISSYMLINK	0x00010000 /* symlink needs interpretation */
+#define	ISWHITEOUT	0x00020000 /* found whiteout */
+#define	DOWHITEOUT	0x00040000 /* do whiteouts */
+#define	WILLBEDIR	0x00080000 /* new files will be dirs; allow trailing / */
+#define	ISUNICODE	0x00100000 /* current component name is unicode*/
+#define	ISOPEN		0x00200000 /* caller is opening; return a real vnode. */
+#define	NOCROSSMOUNT	0x00400000 /* do not cross mount points */
+#define	NOMACCHECK	0x00800000 /* do not perform MAC checks */
+#define	MPSAFE		0x01000000 /* namei() must acquire Giant if needed. */
+#define	GIANTHELD	0x02000000 /* namei() is holding giant. */
+#define	AUDITVNODE1	0x04000000 /* audit the looked up vnode information */
+#define	AUDITVNODE2 	0x08000000 /* audit the looked up vnode information */
+#define	PARAMASK	0x0ffffe00 /* mask of parameter descriptors */
 
 #define	NDHASGIANT(NDP)	(((NDP)->ni_cnd.cn_flags & GIANTHELD) != 0)
 

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 16:16:57 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6E21D106566C;
	Wed, 27 May 2009 16:16:57 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 594F18FC0C;
	Wed, 27 May 2009 16:16:57 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RGGv0v003028;
	Wed, 27 May 2009 16:16:57 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RGGu6Q003019;
	Wed, 27 May 2009 16:16:56 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200905271616.n4RGGu6Q003019@svn.freebsd.org>
From: Andrew Thompson 
Date: Wed, 27 May 2009 16:16:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192901 - in head: . etc/mtree include sys/arm/at91
	sys/arm/conf sys/arm/xscale/ixp425 sys/conf sys/legacy usr.bin/kdump
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 16:16:57 -0000

Author: thompsa
Date: Wed May 27 16:16:56 2009
New Revision: 192901
URL: http://svn.freebsd.org/changeset/base/192901

Log:
  Delete the old USB stack. The new stack has settled in and has all the
  drivers/functionality and then some.

Deleted:
  head/sys/arm/at91/ohci_atmelarm.c
  head/sys/legacy/
Modified:
  head/ObsoleteFiles.inc
  head/etc/mtree/BSD.include.dist
  head/include/Makefile
  head/sys/arm/conf/AVILA
  head/sys/arm/xscale/ixp425/files.ixp425
  head/sys/conf/files
  head/sys/conf/kern.pre.mk
  head/usr.bin/kdump/mkioctls

Modified: head/ObsoleteFiles.inc
==============================================================================
--- head/ObsoleteFiles.inc	Wed May 27 15:46:22 2009	(r192900)
+++ head/ObsoleteFiles.inc	Wed May 27 16:16:56 2009	(r192901)
@@ -14,6 +14,39 @@
 # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last.
 #
 
+# 20090527: removal of legacy USB stack
+OLD_FILES+=usr/include/legacy/dev/usb/dsbr100io.h
+OLD_FILES+=usr/include/legacy/dev/usb/ehcireg.h
+OLD_FILES+=usr/include/legacy/dev/usb/ehcivar.h
+OLD_FILES+=usr/include/legacy/dev/usb/hid.h
+OLD_FILES+=usr/include/legacy/dev/usb/if_urtwreg.h
+OLD_FILES+=usr/include/legacy/dev/usb/if_urtwvar.h
+OLD_FILES+=usr/include/legacy/dev/usb/ohcireg.h
+OLD_FILES+=usr/include/legacy/dev/usb/ohcivar.h
+OLD_FILES+=usr/include/legacy/dev/usb/rio500_usb.h
+OLD_FILES+=usr/include/legacy/dev/usb/rt2573_ucode.h
+OLD_FILES+=usr/include/legacy/dev/usb/sl811hsreg.h
+OLD_FILES+=usr/include/legacy/dev/usb/sl811hsvar.h
+OLD_FILES+=usr/include/legacy/dev/usb/ubser.h
+OLD_FILES+=usr/include/legacy/dev/usb/ucomvar.h
+OLD_FILES+=usr/include/legacy/dev/usb/udbp.h
+OLD_FILES+=usr/include/legacy/dev/usb/uftdireg.h
+OLD_FILES+=usr/include/legacy/dev/usb/ugraphire_rdesc.h
+OLD_FILES+=usr/include/legacy/dev/usb/uhcireg.h
+OLD_FILES+=usr/include/legacy/dev/usb/uhcivar.h
+OLD_FILES+=usr/include/legacy/dev/usb/usb.h
+OLD_FILES+=usr/include/legacy/dev/usb/usb_mem.h
+OLD_FILES+=usr/include/legacy/dev/usb/usb_port.h
+OLD_FILES+=usr/include/legacy/dev/usb/usb_quirks.h
+OLD_FILES+=usr/include/legacy/dev/usb/usbcdc.h
+OLD_FILES+=usr/include/legacy/dev/usb/usbdi.h
+OLD_FILES+=usr/include/legacy/dev/usb/usbdi_util.h
+OLD_FILES+=usr/include/legacy/dev/usb/usbdivar.h
+OLD_FILES+=usr/include/legacy/dev/usb/usbhid.h
+OLD_FILES+=usr/include/legacy/dev/usb/uxb360gp_rdesc.h
+OLD_DIRS+=usr/include/legacy/dev/usb
+OLD_DIRS+=usr/include/legacy/dev
+OLD_DIRS+=usr/include/legacy
 # 20090522: removal of University of Michigan NFSv4 client
 OLD_FILES+=etc/rc.d/idmapd
 OLD_FILES+=sbin/idmapd

Modified: head/etc/mtree/BSD.include.dist
==============================================================================
--- head/etc/mtree/BSD.include.dist	Wed May 27 15:46:22 2009	(r192900)
+++ head/etc/mtree/BSD.include.dist	Wed May 27 16:16:56 2009	(r192901)
@@ -197,12 +197,6 @@
     ..
     kadm5
     ..
-    legacy
-        dev
-            usb
-            ..
-        ..
-    ..
     libmilter
     ..
     lwres

Modified: head/include/Makefile
==============================================================================
--- head/include/Makefile	Wed May 27 15:46:22 2009	(r192900)
+++ head/include/Makefile	Wed May 27 16:16:56 2009	(r192901)
@@ -54,7 +54,7 @@ LSUBDIRS=	cam/scsi \
 	security/mac_mls security/mac_partition \
 	ufs/ffs ufs/ufs
 
-LSUBSUBDIRS=	dev/mpt/mpilib legacy/dev/usb
+LSUBSUBDIRS=	dev/mpt/mpilib
 
 .if ${MACHINE_ARCH} == "powerpc"
 _dev_powermac_nvram=	dev/powermac_nvram

Modified: head/sys/arm/conf/AVILA
==============================================================================
--- head/sys/arm/conf/AVILA	Wed May 27 15:46:22 2009	(r192900)
+++ head/sys/arm/conf/AVILA	Wed May 27 16:16:56 2009	(r192901)
@@ -132,15 +132,14 @@ device		ath_ar5416
 options 	AH_SUPPORT_AR5416
 device		ath_ar9160
 
-makeoptions	WITH_LEGACY
-device		ousb
+device		usb
 #options 	USB_DEBUG
-device		oohci
-device		oehci
-device		oumass
+device		ohci
+device		ehci
+device		umass
 device		scbus		# SCSI bus (required for SCSI)
 device		da		# Direct Access (disks)
 
-#device		oural
-#device		ozyd
+#device		ural
+#device		zyd
 #device		wlan_amrr

Modified: head/sys/arm/xscale/ixp425/files.ixp425
==============================================================================
--- head/sys/arm/xscale/ixp425/files.ixp425	Wed May 27 15:46:22 2009	(r192900)
+++ head/sys/arm/xscale/ixp425/files.ixp425	Wed May 27 16:16:56 2009	(r192901)
@@ -47,4 +47,3 @@ IxNpeMicrocode.dat			optional npe_fw			\
 arm/xscale/ixp425/ixp425_qmgr.c		optional qmgr
 #
 dev/usb/controller/ehci_ixp4xx.c	optional ehci usb
-legacy/dev/usb/ehci_ixp4xx.c		optional oehci ousb

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Wed May 27 15:46:22 2009	(r192900)
+++ head/sys/conf/files	Wed May 27 16:16:56 2009	(r192901)
@@ -80,12 +80,12 @@ teken_state.h		optional sc					   \
 	compile-with	"${AWK} -f $S/dev/syscons/teken/gensequences $S/dev/syscons/teken/sequences > teken_state.h" \
 	no-obj no-implicit-rule before-depend				   \
 	clean		"teken_state.h"
-usbdevs.h			optional usb | ousb			   \
+usbdevs.h			optional usb				   \
 	dependency	"$S/tools/usbdevs2h.awk $S/dev/usb/usbdevs" \
 	compile-with	"${AWK} -f $S/tools/usbdevs2h.awk $S/dev/usb/usbdevs -h" \
 	no-obj no-implicit-rule before-depend				   \
 	clean		"usbdevs.h"
-usbdevs_data.h			optional usb | ousb			   \
+usbdevs_data.h			optional usb				   \
 	dependency	"$S/tools/usbdevs2h.awk $S/dev/usb/usbdevs" \
 	compile-with	"${AWK} -f $S/tools/usbdevs2h.awk $S/dev/usb/usbdevs -d" \
 	no-obj no-implicit-rule before-depend				   \
@@ -503,7 +503,6 @@ dev/ata/chipsets/ata-via.c	optional ata 
 dev/ata/ata-disk.c		optional atadisk
 dev/ata/ata-raid.c		optional ataraid
 dev/ata/ata-usb.c		optional atausb usb
-legacy/dev/ata/ata-usb.c	optional atausb ousb
 dev/ata/atapi-cd.c		optional atapicd
 dev/ata/atapi-fd.c		optional atapifd
 dev/ata/atapi-tape.c		optional atapist
@@ -1421,8 +1420,6 @@ dev/sound/pcm/sound.c		optional sound
 dev/sound/pcm/vchan.c		optional sound
 dev/sound/usb/uaudio.c		optional snd_uaudio usb
 dev/sound/usb/uaudio_pcm.c	optional snd_uaudio usb
-legacy/dev/sound/usb/uaudio.c		optional snd_uaudio ousb
-legacy/dev/sound/usb/uaudio_pcm.c	optional snd_uaudio ousb
 dev/sound/midi/midi.c		optional sound
 dev/sound/midi/mpu401.c		optional sound
 dev/sound/midi/mpu_if.m		optional sound
@@ -1502,51 +1499,6 @@ dev/uart/uart_subr.c		optional uart
 dev/uart/uart_tty.c		optional uart
 dev/ubsec/ubsec.c		optional ubsec
 #
-# USB support
-legacy/dev/usb/ehci.c		optional oehci
-legacy/dev/usb/ehci_ddb.c	optional oehci
-legacy/dev/usb/ehci_pci.c	optional oehci pci
-legacy/dev/usb/hid.c		optional ousb
-legacy/dev/usb/ohci.c		optional oohci
-legacy/dev/usb/ohci_pci.c	optional oohci pci
-legacy/dev/usb/sl811hs.c	optional oslhci
-legacy/dev/usb/slhci_pccard.c	optional oslhci pccard
-legacy/dev/usb/uark.c		optional ouark
-legacy/dev/usb/u3g.c		optional ou3g
-legacy/dev/usb/ubsa.c		optional oubsa
-legacy/dev/usb/ubser.c		optional oubser
-legacy/dev/usb/ucom.c		optional oucom
-legacy/dev/usb/ucycom.c		optional oucycom
-legacy/dev/usb/udbp.c		optional oudbp
-legacy/dev/usb/ufoma.c		optional oufoma
-legacy/dev/usb/ufm.c		optional oufm
-legacy/dev/usb/uftdi.c		optional ouftdi
-legacy/dev/usb/ugen.c		optional ougen
-legacy/dev/usb/uhci.c		optional ouhci
-legacy/dev/usb/uhci_pci.c	optional ouhci pci
-legacy/dev/usb/uhid.c		optional ouhid
-legacy/dev/usb/uhub.c		optional ousb
-legacy/dev/usb/uipaq.c		optional ouipaq
-legacy/dev/usb/ukbd.c		optional oukbd
-legacy/dev/usb/ulpt.c		optional oulpt
-legacy/dev/usb/umass.c		optional oumass
-legacy/dev/usb/umct.c		optional oumct
-legacy/dev/usb/umodem.c		optional oumodem
-legacy/dev/usb/ums.c		optional oums
-legacy/dev/usb/uplcom.c		optional ouplcom
-legacy/dev/usb/urio.c		optional ourio
-legacy/dev/usb/usb.c		optional ousb
-legacy/dev/usb/usb_if.m		optional ousb
-legacy/dev/usb/usb_mem.c	optional ousb
-legacy/dev/usb/usb_quirks.c	optional ousb
-legacy/dev/usb/usb_subr.c	optional ousb
-legacy/dev/usb/usbdi.c		optional ousb
-legacy/dev/usb/usbdi_util.c	optional ousb
-legacy/dev/usb/uscanner.c	optional ouscanner
-legacy/dev/usb/uslcom.c		optional ouslcom
-legacy/dev/usb/uvisor.c		optional ouvisor
-legacy/dev/usb/uvscom.c		optional ouvscom
-#
 # USB controller drivers
 #
 dev/usb/controller/at91dci.c		optional at91dci
@@ -2252,8 +2204,6 @@ netgraph/atm/uni/ng_uni.c	optional ngatm
 netgraph/bluetooth/common/ng_bluetooth.c optional netgraph_bluetooth
 netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c optional netgraph_bluetooth_bt3c
 netgraph/bluetooth/drivers/h4/ng_h4.c optional netgraph_bluetooth_h4
-netgraph/bluetooth/drivers/ubt/ng_ubt.c optional netgraph_bluetooth_ubt ousb
-netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c optional netgraph_bluetooth_ubtbcmfw ousb
 netgraph/bluetooth/hci/ng_hci_cmds.c optional netgraph_bluetooth_hci
 netgraph/bluetooth/hci/ng_hci_evnt.c optional netgraph_bluetooth_hci
 netgraph/bluetooth/hci/ng_hci_main.c optional netgraph_bluetooth_hci

Modified: head/sys/conf/kern.pre.mk
==============================================================================
--- head/sys/conf/kern.pre.mk	Wed May 27 15:46:22 2009	(r192900)
+++ head/sys/conf/kern.pre.mk	Wed May 27 16:16:56 2009	(r192901)
@@ -53,11 +53,7 @@ C_DIALECT= -std=c99
 NOSTDINC= -nostdinc
 .endif
 
-.if defined(WITH_LEGACY)
-LEGACY_INC= -I$S/legacy
-.endif
-
-INCLUDES= ${NOSTDINC} ${INCLMAGIC} -I. ${LEGACY_INC} -I$S
+INCLUDES= ${NOSTDINC} ${INCLMAGIC} -I. -I$S
 
 # This hack lets us use the OpenBSD altq code without spamming a new
 # include path into contrib'ed source files.

Modified: head/usr.bin/kdump/mkioctls
==============================================================================
--- head/usr.bin/kdump/mkioctls	Wed May 27 15:46:22 2009	(r192900)
+++ head/usr.bin/kdump/mkioctls	Wed May 27 16:16:56 2009	(r192901)
@@ -18,14 +18,11 @@ fi
 
 LC_ALL=C; export LC_ALL
 
-# include subdirs to exclude from the search
-exclude="^legacy/.*"
-
 # Build a list of headers that have ioctls in them.
 # XXX should we use an ANSI cpp?
 ioctl_includes=`
 	cd $1
-	find -H -s * -name '*.h' \! -regex $exclude |
+	find -H -s * -name '*.h' |
 		xargs egrep -l \
 '^#[ 	]*define[ 	]+[A-Za-z_][A-Za-z0-9_]*[ 	]+_IO[^a-z0-9_]' |
 		awk '{printf("#include <%s>\\\\n", $1)}'

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 16:20:47 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 221BE1065678;
	Wed, 27 May 2009 16:20:47 +0000 (UTC)
	(envelope-from sson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1051A8FC13;
	Wed, 27 May 2009 16:20:47 +0000 (UTC)
	(envelope-from sson@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RGKktN003134;
	Wed, 27 May 2009 16:20:46 GMT (envelope-from sson@svn.freebsd.org)
Received: (from sson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RGKk9e003133;
	Wed, 27 May 2009 16:20:46 GMT (envelope-from sson@svn.freebsd.org)
Message-Id: <200905271620.n4RGKk9e003133@svn.freebsd.org>
From: Stacey Son 
Date: Wed, 27 May 2009 16:20:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192902 - head/sys/dev/ksyms
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 16:20:47 -0000

Author: sson
Date: Wed May 27 16:20:46 2009
New Revision: 192902
URL: http://svn.freebsd.org/changeset/base/192902

Log:
  Change from using vm_map_delete() to vm_map_remove().
  
  Approved by:	gnn (mentor)
  Obtained from:	kib

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

Modified: head/sys/dev/ksyms/ksyms.c
==============================================================================
--- head/sys/dev/ksyms/ksyms.c	Wed May 27 16:16:56 2009	(r192901)
+++ head/sys/dev/ksyms/ksyms.c	Wed May 27 16:20:46 2009	(r192902)
@@ -395,29 +395,15 @@ static int
 ksyms_unmap(struct thread *td, vm_offset_t addr, size_t sz)
 {
 	vm_map_t map;
-	int error;
 	vm_size_t size;
     
 	map = &td->td_proc->p_vmspace->vm_map;
-
 	size = (vm_size_t) round_page(sz);	
 
-	/* check for address wrap-around */
-	if (addr + size < addr || addr < vm_map_min(map) || 
-	    addr + size > vm_map_max(map))
-		return (EINVAL);
-
-	vm_map_lock(map);
-	/* make sure the pages are mapped */
-	if (!vm_map_check_protection(map, addr, addr + size, VM_PROT_NONE)) {
-		vm_map_unlock(map);
+	if (!vm_map_remove(map, addr, addr + size))
 		return (EINVAL);
-	}
-
-	error = vm_map_delete(map, addr, addr + size);
-	vm_map_unlock(map);
 
-	return (error);
+	return (0);
 }
 
 static void

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 16:29:57 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 25AED106567F;
	Wed, 27 May 2009 16:29:57 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id ECCCB8FC18;
	Wed, 27 May 2009 16:29:56 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RGTuED003474;
	Wed, 27 May 2009 16:29:56 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RGTuFw003473;
	Wed, 27 May 2009 16:29:56 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200905271629.n4RGTuFw003473@svn.freebsd.org>
From: Andrew Thompson 
Date: Wed, 27 May 2009 16:29:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192903 - in head/sys/netgraph/bluetooth/drivers: ubt
	ubtbcmfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 16:29:58 -0000

Author: thompsa
Date: Wed May 27 16:29:56 2009
New Revision: 192903
URL: http://svn.freebsd.org/changeset/base/192903

Log:
  Delete the bluetooth drivers for the old usb stack.

Deleted:
  head/sys/netgraph/bluetooth/drivers/ubt/TODO
  head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
  head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h
  head/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 16:30:35 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2CD7C1065673;
	Wed, 27 May 2009 16:30:34 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 19D7C8FC28;
	Wed, 27 May 2009 16:30:34 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RGUXoi003533;
	Wed, 27 May 2009 16:30:33 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RGUXTX003532;
	Wed, 27 May 2009 16:30:33 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200905271630.n4RGUXTX003532@svn.freebsd.org>
From: Bruce M Simpson 
Date: Wed, 27 May 2009 16:30:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192904 - head/share/man/man4
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 16:30:36 -0000

Author: bms
Date: Wed May 27 16:30:33 2009
New Revision: 192904
URL: http://svn.freebsd.org/changeset/base/192904

Log:
  Add mld(4) man page.

Added:
  head/share/man/man4/mld.4   (contents, props changed)

Added: head/share/man/man4/mld.4
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/share/man/man4/mld.4	Wed May 27 16:30:33 2009	(r192904)
@@ -0,0 +1,107 @@
+.\"
+.\" Copyright (c) 2009 Bruce Simpson.
+.\"
+.\" 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.
+.\" 3. Neither the name of the project nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT 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 PROJECT 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 May 27, 2009
+.Dt MLD 4
+.Os
+.Sh NAME
+.Nm mld
+.Nd Multicast Listener Discovery Protocol
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In netinet/in.h
+.In netinet/in_systm.h
+.In netinet/ip6.h
+.In netinet/icmp6.h
+.In netinet6/mld6.h
+.Ft int
+.Fn socket AF_INET6 SOCK_RAW IPPROTO_ICMPV6
+.Sh DESCRIPTION
+.Tn MLD
+is a control plane protocol used by IPv6 hosts and routers to
+propagate multicast group membership information.
+Normally this protocol is not used directly, except by the kernel
+itself, in response to multicast membership requests by user
+applications.
+Multicast routing protocol daemons may open a raw socket to directly
+interact with
+.Nm 
+and receive membership reports.
+.Pp
+As of
+.Fx 8.0 ,
+MLD version 2 is implemented.
+This adds support for Source-Specific Multicast (SSM), whereby
+applications may communicate to upstream multicast routers that
+they are only interested in receiving multicast streams from
+particular sources.
+The retransmission of state-change reports adds some robustness
+to the protocol.
+.\"
+.Sh SYSCTL VARIABLES
+.Pp
+.Bl -tag -width indent
+.\"
+.It net.inet6.mld.stats
+This opaque read-only variable exposes the stack-wide MLDv2
+protocol statistics to
+.Xr netstat 1 .
+.\"
+.It net.inet6.mld.ifinfo
+This opaque read-only variable exposes the per-link MLDv2 status to
+.Xr ifmcstat 8 .
+.\"
+.It net.inet6.mld.gsrdelay
+This variable specifies the time threshold, in seconds, for processing
+Group-and-Source Specific Queries (GSR).
+As GSR query processing requires maintaining state on the host,
+it may cause memory to be allocated, and is therefore a potential
+attack point for Denial-of-Service (DoS).
+If more than one GSR query is received within this threshold,
+it will be dropped, to mitigate the potential for DoS.
+.\"
+.It net.inet6.mld.v1enable
+If this variable is non-zero, then MLDv1 membership queries (and host
+reports) will be processed by this host, and backwards compatibility
+will be enabled until the v1 'Older Version Querier Present' timer expires.
+This sysctl is normally enabled by default.
+.\"
+.El
+.Sh SEE ALSO
+.Xr ifmcstat 8 ,
+.Xr inet 4 ,
+.Xr multicast 4 ,
+.Xr netstat 1 ,
+.Xr sourcefilter 3
+.Sh HISTORY
+The
+.Nm
+manual page appeared in
+.Fx 8.0 .

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 16:32:06 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 04C4C106566B;
	Wed, 27 May 2009 16:32:06 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E549B8FC0C;
	Wed, 27 May 2009 16:32:05 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RGW5ga003613;
	Wed, 27 May 2009 16:32:05 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RGW578003612;
	Wed, 27 May 2009 16:32:05 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200905271632.n4RGW578003612@svn.freebsd.org>
From: Andrew Thompson 
Date: Wed, 27 May 2009 16:32:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192905 - in head/sys: dev/usb/bluetooth
	netgraph/bluetooth/drivers/ubtbcmfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 16:32:06 -0000

Author: thompsa
Date: Wed May 27 16:32:05 2009
New Revision: 192905
URL: http://svn.freebsd.org/changeset/base/192905

Log:
  move ubtbcmfw.c back to its original place

Added:
  head/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c   (props changed)
     - copied unchanged from r192904, head/sys/dev/usb/bluetooth/ubtbcmfw.c
Deleted:
  head/sys/dev/usb/bluetooth/ubtbcmfw.c

Copied: head/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c (from r192904, head/sys/dev/usb/bluetooth/ubtbcmfw.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c	Wed May 27 16:32:05 2009	(r192905, copy of r192904, head/sys/dev/usb/bluetooth/ubtbcmfw.c)
@@ -0,0 +1,427 @@
+/*
+ * ubtbcmfw.c
+ */
+
+/*-
+ * Copyright (c) 2003-2009 Maksim Yevmenkin 
+ * 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.
+ *
+ * $Id: ubtbcmfw.c,v 1.3 2003/10/10 19:15:08 max Exp $
+ * $FreeBSD$
+ */
+
+#include "usbdevs.h"
+#include 
+#include 
+#include 
+#include 
+
+#define	USB_DEBUG_VAR usb2_debug
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * Download firmware to BCM2033.
+ */
+
+#define	UBTBCMFW_CONFIG_NO	1	/* Config number */
+#define	UBTBCMFW_IFACE_IDX	0	/* Control interface */
+
+#define	UBTBCMFW_BSIZE		1024
+#define	UBTBCMFW_IFQ_MAXLEN	2
+
+enum {
+	UBTBCMFW_BULK_DT_WR = 0,
+	UBTBCMFW_INTR_DT_RD,
+	UBTBCMFW_N_TRANSFER,
+};
+
+struct ubtbcmfw_softc {
+	struct usb2_device	*sc_udev;
+	struct mtx		sc_mtx;
+	struct usb2_xfer	*sc_xfer[UBTBCMFW_N_TRANSFER];
+	struct usb2_fifo_sc	sc_fifo;
+};
+
+/*
+ * Prototypes
+ */
+
+static device_probe_t		ubtbcmfw_probe;
+static device_attach_t		ubtbcmfw_attach;
+static device_detach_t		ubtbcmfw_detach;
+
+static usb2_callback_t		ubtbcmfw_write_callback;
+static usb2_callback_t		ubtbcmfw_read_callback;
+
+static usb2_fifo_close_t	ubtbcmfw_close;
+static usb2_fifo_cmd_t		ubtbcmfw_start_read;
+static usb2_fifo_cmd_t		ubtbcmfw_start_write;
+static usb2_fifo_cmd_t		ubtbcmfw_stop_read;
+static usb2_fifo_cmd_t		ubtbcmfw_stop_write;
+static usb2_fifo_ioctl_t	ubtbcmfw_ioctl;
+static usb2_fifo_open_t		ubtbcmfw_open;
+
+static struct usb2_fifo_methods	ubtbcmfw_fifo_methods = 
+{
+	.f_close =		&ubtbcmfw_close,
+	.f_ioctl =		&ubtbcmfw_ioctl,
+	.f_open =		&ubtbcmfw_open,
+	.f_start_read =		&ubtbcmfw_start_read,
+	.f_start_write =	&ubtbcmfw_start_write,
+	.f_stop_read =		&ubtbcmfw_stop_read,
+	.f_stop_write =		&ubtbcmfw_stop_write,
+	.basename[0] =		"ubtbcmfw",
+	.basename[1] =		"ubtbcmfw",
+	.basename[2] =		"ubtbcmfw",
+	.postfix[0] =		"",
+	.postfix[1] =		".1",
+	.postfix[2] =		".2",
+};
+
+/*
+ * Device's config structure
+ */
+
+static const struct usb2_config	ubtbcmfw_config[UBTBCMFW_N_TRANSFER] =
+{
+	[UBTBCMFW_BULK_DT_WR] = {
+		.type =		UE_BULK,
+		.endpoint =	0x02,	/* fixed */
+		.direction =	UE_DIR_OUT,
+		.if_index =	UBTBCMFW_IFACE_IDX,
+		.bufsize =	UBTBCMFW_BSIZE,
+		.flags =	{ .pipe_bof = 1, .force_short_xfer = 1,
+				  .proxy_buffer = 1, },
+		.callback =	&ubtbcmfw_write_callback,
+	},
+
+	[UBTBCMFW_INTR_DT_RD] = {
+		.type =		UE_INTERRUPT,
+		.endpoint =	0x01,	/* fixed */
+		.direction =	UE_DIR_IN,
+		.if_index =	UBTBCMFW_IFACE_IDX,
+		.bufsize =	UBTBCMFW_BSIZE,
+		.flags =	{ .pipe_bof = 1, .short_xfer_ok = 1,
+				  .proxy_buffer = 1, },
+		.callback =	&ubtbcmfw_read_callback,
+	},
+};
+
+/*
+ * Module
+ */
+
+static devclass_t	ubtbcmfw_devclass;
+
+static device_method_t	ubtbcmfw_methods[] =
+{
+	DEVMETHOD(device_probe, ubtbcmfw_probe),
+	DEVMETHOD(device_attach, ubtbcmfw_attach),
+	DEVMETHOD(device_detach, ubtbcmfw_detach),
+	{0, 0}
+};
+
+static driver_t		ubtbcmfw_driver =
+{
+	.name =		"ubtbcmfw",
+	.methods =	ubtbcmfw_methods,
+	.size =		sizeof(struct ubtbcmfw_softc),
+};
+
+DRIVER_MODULE(ubtbcmfw, uhub, ubtbcmfw_driver, ubtbcmfw_devclass, NULL, 0);
+MODULE_DEPEND(ubtbcmfw, usb, 1, 1, 1);
+
+/*
+ * Probe for a USB Bluetooth device
+ */
+
+static int
+ubtbcmfw_probe(device_t dev)
+{
+	const struct usb2_device_id	devs[] = {
+	/* Broadcom BCM2033 devices only */
+	{ USB_VPI(USB_VENDOR_BROADCOM, USB_PRODUCT_BROADCOM_BCM2033, 0) },
+	};
+
+	struct usb2_attach_arg	*uaa = device_get_ivars(dev);
+
+	if (uaa->usb_mode != USB_MODE_HOST)
+		return (ENXIO);
+
+	if (uaa->info.bIfaceIndex != 0)
+		return (ENXIO);
+
+	return (usb2_lookup_id_by_uaa(devs, sizeof(devs), uaa));
+} /* ubtbcmfw_probe */
+
+/*
+ * Attach the device
+ */
+
+static int
+ubtbcmfw_attach(device_t dev)
+{
+	struct usb2_attach_arg	*uaa = device_get_ivars(dev);
+	struct ubtbcmfw_softc	*sc = device_get_softc(dev);
+	uint8_t			iface_index;
+	int			error;
+
+	sc->sc_udev = uaa->device;
+
+	device_set_usb2_desc(dev);
+
+	mtx_init(&sc->sc_mtx, "ubtbcmfw lock", NULL, MTX_DEF | MTX_RECURSE);
+
+	iface_index = UBTBCMFW_IFACE_IDX;
+	error = usb2_transfer_setup(uaa->device, &iface_index, sc->sc_xfer,
+				ubtbcmfw_config, UBTBCMFW_N_TRANSFER,
+				sc, &sc->sc_mtx);
+	if (error != 0) {
+		device_printf(dev, "allocating USB transfers failed. %s\n",
+			usb2_errstr(error));
+		goto detach;
+	}
+
+	error = usb2_fifo_attach(uaa->device, sc, &sc->sc_mtx,
+			&ubtbcmfw_fifo_methods, &sc->sc_fifo,
+			device_get_unit(dev), 0 - 1, uaa->info.bIfaceIndex,
+			UID_ROOT, GID_OPERATOR, 0644);
+	if (error != 0) {
+		device_printf(dev, "could not attach fifo. %s\n",
+			usb2_errstr(error));
+		goto detach;
+	}
+
+	return (0);	/* success */
+
+detach:
+	ubtbcmfw_detach(dev);
+
+	return (ENXIO);	/* failure */
+} /* ubtbcmfw_attach */ 
+
+/*
+ * Detach the device
+ */
+
+static int
+ubtbcmfw_detach(device_t dev)
+{
+	struct ubtbcmfw_softc	*sc = device_get_softc(dev);
+
+	usb2_fifo_detach(&sc->sc_fifo);
+
+	usb2_transfer_unsetup(sc->sc_xfer, UBTBCMFW_N_TRANSFER);
+
+	mtx_destroy(&sc->sc_mtx);
+
+	return (0);
+} /* ubtbcmfw_detach */
+
+/*
+ * USB write callback
+ */
+
+static void
+ubtbcmfw_write_callback(struct usb2_xfer *xfer)
+{
+	struct ubtbcmfw_softc	*sc = xfer->priv_sc;
+	struct usb2_fifo	*f = sc->sc_fifo.fp[USB_FIFO_TX];
+	uint32_t		actlen;
+
+	switch (USB_GET_STATE(xfer)) {
+	case USB_ST_SETUP:
+	case USB_ST_TRANSFERRED:
+setup_next:
+		if (usb2_fifo_get_data(f, xfer->frbuffers, 0,
+				xfer->max_data_length, &actlen, 0)) {
+			xfer->frlengths[0] = actlen;
+			usb2_start_hardware(xfer);
+		}
+		break;
+
+	default: /* Error */
+		if (xfer->error != USB_ERR_CANCELLED) {
+			/* try to clear stall first */
+			xfer->flags.stall_pipe = 1;
+			goto setup_next;
+		}
+		break;
+	}
+} /* ubtbcmfw_write_callback */
+
+/*
+ * USB read callback
+ */
+
+static void
+ubtbcmfw_read_callback(struct usb2_xfer *xfer)
+{
+	struct ubtbcmfw_softc	*sc = xfer->priv_sc;
+	struct usb2_fifo	*fifo = sc->sc_fifo.fp[USB_FIFO_RX];
+
+	switch (USB_GET_STATE(xfer)) {
+	case USB_ST_TRANSFERRED:
+		usb2_fifo_put_data(fifo, xfer->frbuffers, 0, xfer->actlen, 1);
+		/* FALLTHROUGH */
+
+	case USB_ST_SETUP:
+setup_next:
+		if (usb2_fifo_put_bytes_max(fifo) > 0) {
+			xfer->frlengths[0] = xfer->max_data_length;
+			usb2_start_hardware(xfer);
+		}
+		break;
+
+	default: /* Error */
+		if (xfer->error != USB_ERR_CANCELLED) {
+			/* try to clear stall first */
+			xfer->flags.stall_pipe = 1;
+			goto setup_next;
+		}
+		break;
+	}
+} /* ubtbcmfw_read_callback */
+
+/*
+ * Called when we about to start read()ing from the device
+ */
+
+static void
+ubtbcmfw_start_read(struct usb2_fifo *fifo)
+{
+	struct ubtbcmfw_softc	*sc = fifo->priv_sc0;
+
+	usb2_transfer_start(sc->sc_xfer[UBTBCMFW_INTR_DT_RD]);
+} /* ubtbcmfw_start_read */
+
+/*
+ * Called when we about to stop reading (i.e. closing fifo)
+ */
+
+static void
+ubtbcmfw_stop_read(struct usb2_fifo *fifo)
+{
+	struct ubtbcmfw_softc	*sc = fifo->priv_sc0;
+
+	usb2_transfer_stop(sc->sc_xfer[UBTBCMFW_INTR_DT_RD]);
+} /* ubtbcmfw_stop_read */
+
+/*
+ * Called when we about to start write()ing to the device, poll()ing
+ * for write or flushing fifo
+ */
+
+static void
+ubtbcmfw_start_write(struct usb2_fifo *fifo)
+{
+	struct ubtbcmfw_softc	*sc = fifo->priv_sc0;
+
+	usb2_transfer_start(sc->sc_xfer[UBTBCMFW_BULK_DT_WR]);
+} /* ubtbcmfw_start_write */
+
+/*
+ * Called when we about to stop writing (i.e. closing fifo)
+ */
+
+static void
+ubtbcmfw_stop_write(struct usb2_fifo *fifo)
+{
+	struct ubtbcmfw_softc	*sc = fifo->priv_sc0;
+
+	usb2_transfer_stop(sc->sc_xfer[UBTBCMFW_BULK_DT_WR]);
+} /* ubtbcmfw_stop_write */
+
+/*
+ * Called when fifo is open
+ */
+
+static int
+ubtbcmfw_open(struct usb2_fifo *fifo, int fflags)
+{
+	struct ubtbcmfw_softc	*sc = fifo->priv_sc0;
+	struct usb2_xfer	*xfer;
+
+	/*
+	 * f_open fifo method can only be called with either FREAD
+	 * or FWRITE flag set at one time.
+	 */
+
+	if (fflags & FREAD)
+		xfer = sc->sc_xfer[UBTBCMFW_INTR_DT_RD];
+	else if (fflags & FWRITE)
+		xfer = sc->sc_xfer[UBTBCMFW_BULK_DT_WR];
+	else
+		return (EINVAL);	/* should not happen */
+
+	if (usb2_fifo_alloc_buffer(fifo, xfer->max_data_length,
+			UBTBCMFW_IFQ_MAXLEN) != 0)
+		return (ENOMEM);
+
+	return (0);
+} /* ubtbcmfw_open */
+
+/* 
+ * Called when fifo is closed
+ */
+
+static void
+ubtbcmfw_close(struct usb2_fifo *fifo, int fflags)
+{
+	if (fflags & (FREAD | FWRITE))
+		usb2_fifo_free_buffer(fifo);
+} /* ubtbcmfw_close */
+
+/*
+ * Process ioctl() on USB device
+ */
+
+static int
+ubtbcmfw_ioctl(struct usb2_fifo *fifo, u_long cmd, void *data,
+    int fflags)
+{
+	struct ubtbcmfw_softc	*sc = fifo->priv_sc0;
+	int			error = 0;
+
+	switch (cmd) {
+	case USB_GET_DEVICE_DESC:
+		memcpy(data, usb2_get_device_descriptor(sc->sc_udev),
+			sizeof(struct usb2_device_descriptor));
+		break;
+
+	default:
+		error = EINVAL;
+		break;
+	}
+
+	return (error);
+} /* ubtbcmfw_ioctl */

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 16:33:08 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5E51910656D4;
	Wed, 27 May 2009 16:33:08 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4A5078FC25;
	Wed, 27 May 2009 16:33:08 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RGX89s003702;
	Wed, 27 May 2009 16:33:08 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RGX8N2003701;
	Wed, 27 May 2009 16:33:08 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200905271633.n4RGX8N2003701@svn.freebsd.org>
From: Andrew Thompson 
Date: Wed, 27 May 2009 16:33:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192906 - in head/sys: dev/usb/bluetooth
	netgraph/bluetooth/drivers/ubt
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 16:33:09 -0000

Author: thompsa
Date: Wed May 27 16:33:08 2009
New Revision: 192906
URL: http://svn.freebsd.org/changeset/base/192906

Log:
  move ng_ubt.c back to its original place

Added:
  head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c   (props changed)
     - copied unchanged from r192905, head/sys/dev/usb/bluetooth/ng_ubt.c
Deleted:
  head/sys/dev/usb/bluetooth/ng_ubt.c

Copied: head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c (from r192905, head/sys/dev/usb/bluetooth/ng_ubt.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c	Wed May 27 16:33:08 2009	(r192906, copy of r192905, head/sys/dev/usb/bluetooth/ng_ubt.c)
@@ -0,0 +1,1722 @@
+/*
+ * ng_ubt.c
+ */
+
+/*-
+ * Copyright (c) 2001-2009 Maksim Yevmenkin 
+ * 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.
+ *
+ * $Id: ng_ubt.c,v 1.16 2003/10/10 19:15:06 max Exp $
+ * $FreeBSD$
+ */
+
+/*
+ * NOTE: ng_ubt2 driver has a split personality. On one side it is
+ * a USB device driver and on the other it is a Netgraph node. This
+ * driver will *NOT* create traditional /dev/ enties, only Netgraph 
+ * node.
+ *
+ * NOTE ON LOCKS USED: ng_ubt2 drives uses 2 locks (mutexes)
+ *
+ * 1) sc_if_mtx - lock for device's interface #0 and #1. This lock is used
+ *    by USB for any USB request going over device's interface #0 and #1,
+ *    i.e. interrupt, control, bulk and isoc. transfers.
+ * 
+ * 2) sc_ng_mtx - this lock is used to protect shared (between USB, Netgraph
+ *    and Taskqueue) data, such as outgoing mbuf queues, task flags and hook
+ *    pointer. This lock *SHOULD NOT* be grabbed for a long time. In fact,
+ *    think of it as a spin lock.
+ *
+ * NOTE ON LOCKING STRATEGY: ng_ubt2 driver operates in 3 different contexts.
+ *
+ * 1) USB context. This is where all the USB related stuff happens. All
+ *    callbacks run in this context. All callbacks are called (by USB) with
+ *    appropriate interface lock held. It is (generally) allowed to grab
+ *    any additional locks.
+ *
+ * 2) Netgraph context. This is where all the Netgraph related stuff happens.
+ *    Since we mark node as WRITER, the Netgraph node will be "locked" (from
+ *    Netgraph point of view). Any variable that is only modified from the
+ *    Netgraph context does not require any additonal locking. It is generally
+ *    *NOT* allowed to grab *ANY* additional locks. Whatever you do, *DO NOT*
+ *    grab any lock in the Netgraph context that could cause de-scheduling of
+ *    the Netgraph thread for significant amount of time. In fact, the only
+ *    lock that is allowed in the Netgraph context is the sc_ng_mtx lock.
+ *    Also make sure that any code that is called from the Netgraph context
+ *    follows the rule above.
+ *
+ * 3) Taskqueue context. This is where ubt_task runs. Since we are generally
+ *    NOT allowed to grab any lock that could cause de-scheduling in the
+ *    Netgraph context, and, USB requires us to grab interface lock before
+ *    doing things with transfers, it is safer to transition from the Netgraph
+ *    context to the Taskqueue context before we can call into USB subsystem.
+ *
+ * So, to put everything together, the rules are as follows.
+ *	It is OK to call from the USB context or the Taskqueue context into
+ * the Netgraph context (i.e. call NG_SEND_xxx functions). In other words
+ * it is allowed to call into the Netgraph context with locks held.
+ *	Is it *NOT* OK to call from the Netgraph context into the USB context,
+ * because USB requires us to grab interface locks, and, it is safer to
+ * avoid it. So, to make things safer we set task flags to indicate which
+ * actions we want to perform and schedule ubt_task which would run in the
+ * Taskqueue context.
+ *	Is is OK to call from the Taskqueue context into the USB context,
+ * and, ubt_task does just that (i.e. grabs appropriate interface locks
+ * before calling into USB).
+ *	Access to the outgoing queues, task flags and hook pointer is
+ * controlled by the sc_ng_mtx lock. It is an unavoidable evil. Again,
+ * sc_ng_mtx should really be a spin lock (and it is very likely to an
+ * equivalent of spin lock due to adaptive nature of FreeBSD mutexes).
+ *	All USB callbacks accept softc pointer as a private data. USB ensures
+ * that this pointer is valid.
+ */
+
+#include "usbdevs.h"
+#include 
+#include 
+#include 
+
+#define	USB_DEBUG_VAR usb2_debug
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+static int		ubt_modevent(module_t, int, void *);
+static device_probe_t	ubt_probe;
+static device_attach_t	ubt_attach;
+static device_detach_t	ubt_detach;
+
+static void		ubt_task_schedule(ubt_softc_p, int);
+static task_fn_t	ubt_task;
+
+#define	ubt_xfer_start(sc, i)	usb2_transfer_start((sc)->sc_xfer[(i)])
+
+/* Netgraph methods */
+static ng_constructor_t	ng_ubt_constructor;
+static ng_shutdown_t	ng_ubt_shutdown;
+static ng_newhook_t	ng_ubt_newhook;
+static ng_connect_t	ng_ubt_connect;
+static ng_disconnect_t	ng_ubt_disconnect;
+static ng_rcvmsg_t	ng_ubt_rcvmsg;
+static ng_rcvdata_t	ng_ubt_rcvdata;
+
+/* Queue length */
+static const struct ng_parse_struct_field	ng_ubt_node_qlen_type_fields[] =
+{
+	{ "queue", &ng_parse_int32_type, },
+	{ "qlen",  &ng_parse_int32_type, },
+	{ NULL, }
+};
+static const struct ng_parse_type		ng_ubt_node_qlen_type =
+{
+	&ng_parse_struct_type,
+	&ng_ubt_node_qlen_type_fields
+};
+
+/* Stat info */
+static const struct ng_parse_struct_field	ng_ubt_node_stat_type_fields[] =
+{
+	{ "pckts_recv", &ng_parse_uint32_type, },
+	{ "bytes_recv", &ng_parse_uint32_type, },
+	{ "pckts_sent", &ng_parse_uint32_type, },
+	{ "bytes_sent", &ng_parse_uint32_type, },
+	{ "oerrors",    &ng_parse_uint32_type, },
+	{ "ierrors",    &ng_parse_uint32_type, },
+	{ NULL, }
+};
+static const struct ng_parse_type		ng_ubt_node_stat_type =
+{
+	&ng_parse_struct_type,
+	&ng_ubt_node_stat_type_fields
+};
+
+/* Netgraph node command list */
+static const struct ng_cmdlist			ng_ubt_cmdlist[] =
+{
+	{
+		NGM_UBT_COOKIE,
+		NGM_UBT_NODE_SET_DEBUG,
+		"set_debug",
+		&ng_parse_uint16_type,
+		NULL
+	},
+	{
+		NGM_UBT_COOKIE,
+		NGM_UBT_NODE_GET_DEBUG,
+		"get_debug",
+		NULL,
+		&ng_parse_uint16_type
+	},
+	{
+		NGM_UBT_COOKIE,
+		NGM_UBT_NODE_SET_QLEN,
+		"set_qlen",
+		&ng_ubt_node_qlen_type,
+		NULL
+	},
+	{
+		NGM_UBT_COOKIE,
+		NGM_UBT_NODE_GET_QLEN,
+		"get_qlen",
+		&ng_ubt_node_qlen_type,
+		&ng_ubt_node_qlen_type
+	},
+	{
+		NGM_UBT_COOKIE,
+		NGM_UBT_NODE_GET_STAT,
+		"get_stat",
+		NULL,
+		&ng_ubt_node_stat_type
+	},
+	{
+		NGM_UBT_COOKIE,
+		NGM_UBT_NODE_RESET_STAT,
+		"reset_stat",
+		NULL,
+		NULL
+	},
+	{ 0, }
+};
+
+/* Netgraph node type */
+static struct ng_type	typestruct =
+{
+	.version = 	NG_ABI_VERSION,
+	.name =		NG_UBT_NODE_TYPE,
+	.constructor =	ng_ubt_constructor,
+	.rcvmsg =	ng_ubt_rcvmsg,
+	.shutdown =	ng_ubt_shutdown,
+	.newhook =	ng_ubt_newhook,
+	.connect =	ng_ubt_connect,
+	.rcvdata =	ng_ubt_rcvdata,
+	.disconnect =	ng_ubt_disconnect,
+	.cmdlist =	ng_ubt_cmdlist
+};
+
+/****************************************************************************
+ ****************************************************************************
+ **                              USB specific
+ ****************************************************************************
+ ****************************************************************************/
+
+/* USB methods */
+static usb2_callback_t	ubt_ctrl_write_callback;
+static usb2_callback_t	ubt_intr_read_callback;
+static usb2_callback_t	ubt_bulk_read_callback;
+static usb2_callback_t	ubt_bulk_write_callback;
+static usb2_callback_t	ubt_isoc_read_callback;
+static usb2_callback_t	ubt_isoc_write_callback;
+
+static int		ubt_fwd_mbuf_up(ubt_softc_p, struct mbuf **);
+static int		ubt_isoc_read_one_frame(struct usb2_xfer *, int);
+
+/*
+ * USB config
+ * 
+ * The following desribes usb transfers that could be submitted on USB device.
+ *
+ * Interface 0 on the USB device must present the following endpoints
+ *	1) Interrupt endpoint to receive HCI events
+ *	2) Bulk IN endpoint to receive ACL data
+ *	3) Bulk OUT endpoint to send ACL data
+ *
+ * Interface 1 on the USB device must present the following endpoints
+ *	1) Isochronous IN endpoint to receive SCO data
+ *	2) Isochronous OUT endpoint to send SCO data
+ */
+
+static const struct usb2_config		ubt_config[UBT_N_TRANSFER] =
+{
+	/*
+	 * Interface #0
+ 	 */
+
+	/* Outgoing bulk transfer - ACL packets */
+	[UBT_IF_0_BULK_DT_WR] = {
+		.type =		UE_BULK,
+		.endpoint =	UE_ADDR_ANY,
+		.direction =	UE_DIR_OUT,
+		.if_index = 	0,
+		.bufsize =	UBT_BULK_WRITE_BUFFER_SIZE,
+		.flags =	{ .pipe_bof = 1, .force_short_xfer = 1, },
+		.callback =	&ubt_bulk_write_callback,
+	},
+	/* Incoming bulk transfer - ACL packets */
+	[UBT_IF_0_BULK_DT_RD] = {
+		.type =		UE_BULK,
+		.endpoint =	UE_ADDR_ANY,
+		.direction =	UE_DIR_IN,
+		.if_index = 	0,
+		.bufsize =	UBT_BULK_READ_BUFFER_SIZE,
+		.flags =	{ .pipe_bof = 1, .short_xfer_ok = 1, },
+		.callback =	&ubt_bulk_read_callback,
+	},
+	/* Incoming interrupt transfer - HCI events */
+	[UBT_IF_0_INTR_DT_RD] = {
+		.type =		UE_INTERRUPT,
+		.endpoint =	UE_ADDR_ANY,
+		.direction =	UE_DIR_IN,
+		.if_index = 	0,
+		.flags =	{ .pipe_bof = 1, .short_xfer_ok = 1, },
+		.bufsize =	UBT_INTR_BUFFER_SIZE,
+		.callback =	&ubt_intr_read_callback,
+	},
+	/* Outgoing control transfer - HCI commands */
+	[UBT_IF_0_CTRL_DT_WR] = {
+		.type =		UE_CONTROL,
+		.endpoint =	0x00,	/* control pipe */
+		.direction =	UE_DIR_ANY,
+		.if_index = 	0,
+		.bufsize =	UBT_CTRL_BUFFER_SIZE,
+		.callback =	&ubt_ctrl_write_callback,
+		.timeout =	5000,	/* 5 seconds */
+	},
+
+	/*
+	 * Interface #1
+ 	 */
+
+	/* Incoming isochronous transfer #1 - SCO packets */
+	[UBT_IF_1_ISOC_DT_RD1] = {
+		.type =		UE_ISOCHRONOUS,
+		.endpoint =	UE_ADDR_ANY,
+		.direction =	UE_DIR_IN,
+		.if_index = 	1,
+		.bufsize =	0,	/* use "wMaxPacketSize * frames" */
+		.frames =	UBT_ISOC_NFRAMES,
+		.flags =	{ .short_xfer_ok = 1, },
+		.callback =	&ubt_isoc_read_callback,
+	},
+	/* Incoming isochronous transfer #2 - SCO packets */
+	[UBT_IF_1_ISOC_DT_RD2] = {
+		.type =		UE_ISOCHRONOUS,
+		.endpoint =	UE_ADDR_ANY,
+		.direction =	UE_DIR_IN,
+		.if_index = 	1,
+		.bufsize =	0,	/* use "wMaxPacketSize * frames" */
+		.frames =	UBT_ISOC_NFRAMES,
+		.flags =	{ .short_xfer_ok = 1, },
+		.callback =	&ubt_isoc_read_callback,
+	},
+	/* Outgoing isochronous transfer #1 - SCO packets */
+	[UBT_IF_1_ISOC_DT_WR1] = {
+		.type =		UE_ISOCHRONOUS,
+		.endpoint =	UE_ADDR_ANY,
+		.direction =	UE_DIR_OUT,
+		.if_index = 	1,
+		.bufsize =	0,	/* use "wMaxPacketSize * frames" */
+		.frames =	UBT_ISOC_NFRAMES,
+		.flags =	{ .short_xfer_ok = 1, },
+		.callback =	&ubt_isoc_write_callback,
+	},
+	/* Outgoing isochronous transfer #2 - SCO packets */
+	[UBT_IF_1_ISOC_DT_WR2] = {
+		.type =		UE_ISOCHRONOUS,
+		.endpoint =	UE_ADDR_ANY,
+		.direction =	UE_DIR_OUT,
+		.if_index = 	1,
+		.bufsize =	0,	/* use "wMaxPacketSize * frames" */
+		.frames =	UBT_ISOC_NFRAMES,
+		.flags =	{ .short_xfer_ok = 1, },
+		.callback =	&ubt_isoc_write_callback,
+	},
+};
+
+/*
+ * If for some reason device should not be attached then put
+ * VendorID/ProductID pair into the list below. The format is
+ * as follows:
+ *
+ *	{ USB_VPI(VENDOR_ID, PRODUCT_ID, 0) },
+ *
+ * where VENDOR_ID and PRODUCT_ID are hex numbers.
+ */
+
+static const struct usb2_device_id ubt_ignore_devs[] = 
+{
+	/* AVM USB Bluetooth-Adapter BlueFritz! v1.0 */
+	{ USB_VPI(USB_VENDOR_AVM, 0x2200, 0) },
+};
+
+/* List of supported bluetooth devices */
+static const struct usb2_device_id ubt_devs[] =
+{
+	/* Generic Bluetooth class devices */
+	{ USB_IFACE_CLASS(UDCLASS_WIRELESS),
+	  USB_IFACE_SUBCLASS(UDSUBCLASS_RF),
+	  USB_IFACE_PROTOCOL(UDPROTO_BLUETOOTH) },
+
+	/* AVM USB Bluetooth-Adapter BlueFritz! v2.0 */
+	{ USB_VPI(USB_VENDOR_AVM, 0x3800, 0) },
+};
+
+/*
+ * Probe for a USB Bluetooth device.
+ * USB context.
+ */
+
+static int
+ubt_probe(device_t dev)
+{
+	struct usb2_attach_arg	*uaa = device_get_ivars(dev);
+
+	if (uaa->usb_mode != USB_MODE_HOST)
+		return (ENXIO);
+
+	if (uaa->info.bIfaceIndex != 0)
+		return (ENXIO);
+
+	if (uaa->use_generic == 0)
+		return (ENXIO);
+
+	if (usb2_lookup_id_by_uaa(ubt_ignore_devs,
+			sizeof(ubt_ignore_devs), uaa) == 0)
+		return (ENXIO);
+
+	return (usb2_lookup_id_by_uaa(ubt_devs, sizeof(ubt_devs), uaa));
+} /* ubt_probe */
+
+/*
+ * Attach the device.
+ * USB context.
+ */
+
+static int
+ubt_attach(device_t dev)
+{
+	struct usb2_attach_arg		*uaa = device_get_ivars(dev);
+	struct ubt_softc		*sc = device_get_softc(dev);
+	struct usb2_endpoint_descriptor	*ed;
+	struct usb2_interface_descriptor *id;
+	uint16_t			wMaxPacketSize;
+	uint8_t				alt_index, i, j;
+	uint8_t				iface_index[2] = { 0, 1 };
+
+	device_set_usb2_desc(dev);
+
+	sc->sc_dev = dev;
+	sc->sc_debug = NG_UBT_WARN_LEVEL;
+
+	/* 
+	 * Create Netgraph node
+	 */
+
+	if (ng_make_node_common(&typestruct, &sc->sc_node) != 0) {
+		UBT_ALERT(sc, "could not create Netgraph node\n");
+		return (ENXIO);
+	}
+
+	/* Name Netgraph node */
+	if (ng_name_node(sc->sc_node, device_get_nameunit(dev)) != 0) {
+		UBT_ALERT(sc, "could not name Netgraph node\n");
+		NG_NODE_UNREF(sc->sc_node);
+		return (ENXIO);
+	}
+	NG_NODE_SET_PRIVATE(sc->sc_node, sc);
+	NG_NODE_FORCE_WRITER(sc->sc_node);
+
+	/*
+	 * Initialize device softc structure
+	 */
+
+	/* initialize locks */
+	mtx_init(&sc->sc_ng_mtx, "ubt ng", NULL, MTX_DEF);
+	mtx_init(&sc->sc_if_mtx, "ubt if", NULL, MTX_DEF | MTX_RECURSE);
+
+	/* initialize packet queues */
+	NG_BT_MBUFQ_INIT(&sc->sc_cmdq, UBT_DEFAULT_QLEN);
+	NG_BT_MBUFQ_INIT(&sc->sc_aclq, UBT_DEFAULT_QLEN);
+	NG_BT_MBUFQ_INIT(&sc->sc_scoq, UBT_DEFAULT_QLEN);
+
+	/* initialize glue task */
+	TASK_INIT(&sc->sc_task, 0, ubt_task, sc);
+
+	/*
+	 * Configure Bluetooth USB device. Discover all required USB
+	 * interfaces and endpoints.
+	 *
+	 * USB device must present two interfaces:
+	 * 1) Interface 0 that has 3 endpoints
+	 *	1) Interrupt endpoint to receive HCI events
+	 *	2) Bulk IN endpoint to receive ACL data
+	 *	3) Bulk OUT endpoint to send ACL data
+	 *
+	 * 2) Interface 1 then has 2 endpoints
+	 *	1) Isochronous IN endpoint to receive SCO data
+ 	 *	2) Isochronous OUT endpoint to send SCO data
+	 *
+	 * Interface 1 (with isochronous endpoints) has several alternate
+	 * configurations with different packet size.
+	 */
+
+	/*
+	 * For interface #1 search alternate settings, and find
+	 * the descriptor with the largest wMaxPacketSize
+	 */
+
+	wMaxPacketSize = 0;
+	alt_index = 0;
+	i = 0;
+	j = 0;
+	ed = NULL;
+
+	/* 
+	 * Search through all the descriptors looking for the largest
+	 * packet size:
+	 */
+	while ((ed = (struct usb2_endpoint_descriptor *)usb2_desc_foreach(
+	    usb2_get_config_descriptor(uaa->device), 
+	    (struct usb2_descriptor *)ed))) {
+
+		if ((ed->bDescriptorType == UDESC_INTERFACE) &&
+		    (ed->bLength >= sizeof(*id))) {
+			id = (struct usb2_interface_descriptor *)ed;
+			i = id->bInterfaceNumber;
+			j = id->bAlternateSetting;
+		}
+
+		if ((ed->bDescriptorType == UDESC_ENDPOINT) &&
+		    (ed->bLength >= sizeof(*ed)) &&
+		    (i == 1)) {
+			uint16_t temp;
+
+			temp = UGETW(ed->wMaxPacketSize);
+			if (temp > wMaxPacketSize) {
+				wMaxPacketSize = temp;
+				alt_index = j;
+			}
+		}
+	}
+
+	/* Set alt configuration on interface #1 only if we found it */
+	if (wMaxPacketSize > 0 &&
+	    usb2_set_alt_interface_index(uaa->device, 1, alt_index)) {
+		UBT_ALERT(sc, "could not set alternate setting %d " \
+			"for interface 1!\n", alt_index);
+		goto detach;
+	}
+
+	/* Setup transfers for both interfaces */
+	if (usb2_transfer_setup(uaa->device, iface_index, sc->sc_xfer,
+			ubt_config, UBT_N_TRANSFER, sc, &sc->sc_if_mtx)) {
+		UBT_ALERT(sc, "could not allocate transfers\n");
+		goto detach;
+	}
+
+	/* Claim all interfaces on the device */
+	for (i = 1; usb2_get_iface(uaa->device, i) != NULL; i ++)
+		usb2_set_parent_iface(uaa->device, i, uaa->info.bIfaceIndex);
+
+	return (0); /* success */
+
+detach:
+	ubt_detach(dev);
+
+	return (ENXIO);
+} /* ubt_attach */
+
+/*
+ * Detach the device.
+ * USB context.
+ */
+
+int
+ubt_detach(device_t dev)
+{
+	struct ubt_softc	*sc = device_get_softc(dev);
+	node_p			node = sc->sc_node;
+
+	/* Destroy Netgraph node */
+	if (node != NULL) {
+		sc->sc_node = NULL;
+		NG_NODE_REALLY_DIE(node);
+		ng_rmnode_self(node);
+	}
+
+	/* Make sure ubt_task in gone */
+	taskqueue_drain(taskqueue_swi, &sc->sc_task);
+
+	/* Free USB transfers, if any */
+	usb2_transfer_unsetup(sc->sc_xfer, UBT_N_TRANSFER);
+
+	/* Destroy queues */
+	UBT_NG_LOCK(sc);
+	NG_BT_MBUFQ_DESTROY(&sc->sc_cmdq);
+	NG_BT_MBUFQ_DESTROY(&sc->sc_aclq);
+	NG_BT_MBUFQ_DESTROY(&sc->sc_scoq);
+	UBT_NG_UNLOCK(sc);
+
+	mtx_destroy(&sc->sc_if_mtx);
+	mtx_destroy(&sc->sc_ng_mtx);
+
+	return (0);
+} /* ubt_detach */
+
+/* 
+ * Called when outgoing control request (HCI command) has completed, i.e.
+ * HCI command was sent to the device.
+ * USB context.
+ */
+
+static void
+ubt_ctrl_write_callback(struct usb2_xfer *xfer)
+{
+	struct ubt_softc		*sc = xfer->priv_sc;
+	struct usb2_device_request	req;
+	struct mbuf			*m;
+
+	switch (USB_GET_STATE(xfer)) {
+	case USB_ST_TRANSFERRED:
+		UBT_INFO(sc, "sent %d bytes to control pipe\n", xfer->actlen);
+		UBT_STAT_BYTES_SENT(sc, xfer->actlen);
+		UBT_STAT_PCKTS_SENT(sc);
+		/* FALLTHROUGH */
+
+	case USB_ST_SETUP:
+send_next:
+		/* Get next command mbuf, if any */
+		UBT_NG_LOCK(sc);
+		NG_BT_MBUFQ_DEQUEUE(&sc->sc_cmdq, m);
+		UBT_NG_UNLOCK(sc);
+
+		if (m == NULL) {
+			UBT_INFO(sc, "HCI command queue is empty\n");
+			break;	/* transfer complete */
+		}
+
+		/* Initialize a USB control request and then schedule it */
+		bzero(&req, sizeof(req));
+		req.bmRequestType = UBT_HCI_REQUEST;
+		USETW(req.wLength, m->m_pkthdr.len);
+
+		UBT_INFO(sc, "Sending control request, " \
+			"bmRequestType=0x%02x, wLength=%d\n",
+			req.bmRequestType, UGETW(req.wLength));
+
+		usb2_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
+		usb2_m_copy_in(xfer->frbuffers + 1, 0, m, 0, m->m_pkthdr.len);
+
+		xfer->frlengths[0] = sizeof(req);
+		xfer->frlengths[1] = m->m_pkthdr.len;
+		xfer->nframes = 2;
+
+		NG_FREE_M(m);
+
+		usb2_start_hardware(xfer);
+		break;
+
+	default: /* Error */
+		if (xfer->error != USB_ERR_CANCELLED) {
+			UBT_WARN(sc, "control transfer failed: %s\n",
+				usb2_errstr(xfer->error));
+
+			UBT_STAT_OERROR(sc);
+			goto send_next;
+		}
+
+		/* transfer cancelled */
+		break;
+	}
+} /* ubt_ctrl_write_callback */
+
+/* 
+ * Called when incoming interrupt transfer (HCI event) has completed, i.e.
+ * HCI event was received from the device.
+ * USB context.
+ */
+
+static void
+ubt_intr_read_callback(struct usb2_xfer *xfer)
+{
+	struct ubt_softc	*sc = xfer->priv_sc;
+	struct mbuf		*m;
+	ng_hci_event_pkt_t	*hdr;
+
+	m = NULL;
+
+	switch (USB_GET_STATE(xfer)) {
+	case USB_ST_TRANSFERRED:
+		/* Allocate a new mbuf */
+		MGETHDR(m, M_DONTWAIT, MT_DATA);
+		if (m == NULL) {
+			UBT_STAT_IERROR(sc);
+			goto submit_next;
+		}
+
+		MCLGET(m, M_DONTWAIT);
+		if (!(m->m_flags & M_EXT)) {
+			UBT_STAT_IERROR(sc);
+			goto submit_next;
+		}
+
+		/* Add HCI packet type */
+		*mtod(m, uint8_t *)= NG_HCI_EVENT_PKT;
+		m->m_pkthdr.len = m->m_len = 1;
+
+		if (xfer->actlen > MCLBYTES - 1)
+			xfer->actlen = MCLBYTES - 1;
+
+		usb2_copy_out(xfer->frbuffers, 0, mtod(m, uint8_t *) + 1,
+			xfer->actlen);
+		m->m_pkthdr.len += xfer->actlen;
+		m->m_len += xfer->actlen;
+
+		UBT_INFO(sc, "got %d bytes from interrupt pipe\n",
+			xfer->actlen);
+
+		/* Validate packet and send it up the stack */
+		if (m->m_pkthdr.len < sizeof(*hdr)) {
+			UBT_INFO(sc, "HCI event packet is too short\n");
+
+			UBT_STAT_IERROR(sc);
+			goto submit_next;
+		}
+
+		hdr = mtod(m, ng_hci_event_pkt_t *);
+		if (hdr->length != (m->m_pkthdr.len - sizeof(*hdr))) {
+			UBT_ERR(sc, "Invalid HCI event packet size, " \
+				"length=%d, pktlen=%d\n",
+				hdr->length, m->m_pkthdr.len);
+
+			UBT_STAT_IERROR(sc);
+			goto submit_next;
+		}
+
+		UBT_INFO(sc, "got complete HCI event frame, pktlen=%d, " \
+			"length=%d\n", m->m_pkthdr.len, hdr->length);
+
+		UBT_STAT_PCKTS_RECV(sc);
+		UBT_STAT_BYTES_RECV(sc, m->m_pkthdr.len);
+
+		ubt_fwd_mbuf_up(sc, &m);
+		/* m == NULL at this point */
+		/* FALLTHROUGH */
+
+	case USB_ST_SETUP:
+submit_next:
+		NG_FREE_M(m); /* checks for m != NULL */
+
+		xfer->frlengths[0] = xfer->max_data_length;
+		usb2_start_hardware(xfer);
+		break;
+
+	default: /* Error */
+		if (xfer->error != USB_ERR_CANCELLED) {
+			UBT_WARN(sc, "interrupt transfer failed: %s\n",
+				usb2_errstr(xfer->error));
+
+			/* Try to clear stall first */
+			xfer->flags.stall_pipe = 1;
+			goto submit_next;
+		}
+			/* transfer cancelled */
+		break;
+	}
+} /* ubt_intr_read_callback */
+
+/*
+ * Called when incoming bulk transfer (ACL packet) has completed, i.e.
+ * ACL packet was received from the device.
+ * USB context.
+ */
+
+static void
+ubt_bulk_read_callback(struct usb2_xfer *xfer)
+{
+	struct ubt_softc	*sc = xfer->priv_sc;
+	struct mbuf		*m;
+	ng_hci_acldata_pkt_t	*hdr;
+	uint16_t		len;
+
+	m = NULL;
+
+	switch (USB_GET_STATE(xfer)) {
+	case USB_ST_TRANSFERRED:
+		/* Allocate new mbuf */
+		MGETHDR(m, M_DONTWAIT, MT_DATA);
+		if (m == NULL) {
+			UBT_STAT_IERROR(sc);
+			goto submit_next;
+		}
+
+		MCLGET(m, M_DONTWAIT);
+		if (!(m->m_flags & M_EXT)) {
+			UBT_STAT_IERROR(sc);
+			goto submit_next;
+		}
+
+		/* Add HCI packet type */
+		*mtod(m, uint8_t *)= NG_HCI_ACL_DATA_PKT;
+		m->m_pkthdr.len = m->m_len = 1;
+
+		if (xfer->actlen > MCLBYTES - 1)
+			xfer->actlen = MCLBYTES - 1;
+
+		usb2_copy_out(xfer->frbuffers, 0, mtod(m, uint8_t *) + 1,
+			xfer->actlen);
+		m->m_pkthdr.len += xfer->actlen;
+		m->m_len += xfer->actlen;
+
+		UBT_INFO(sc, "got %d bytes from bulk-in pipe\n",
+			xfer->actlen);
+
+		/* Validate packet and send it up the stack */
+		if (m->m_pkthdr.len < sizeof(*hdr)) {
+			UBT_INFO(sc, "HCI ACL packet is too short\n");
+
+			UBT_STAT_IERROR(sc);
+			goto submit_next;
+		}
+
+		hdr = mtod(m, ng_hci_acldata_pkt_t *);
+		len = le16toh(hdr->length);
+		if (len != (m->m_pkthdr.len - sizeof(*hdr))) {
+			UBT_ERR(sc, "Invalid ACL packet size, length=%d, " \
+				"pktlen=%d\n", len, m->m_pkthdr.len);
+
+			UBT_STAT_IERROR(sc);
+			goto submit_next;
+		}
+
+		UBT_INFO(sc, "got complete ACL data packet, pktlen=%d, " \
+			"length=%d\n", m->m_pkthdr.len, len);
+
+		UBT_STAT_PCKTS_RECV(sc);
+		UBT_STAT_BYTES_RECV(sc, m->m_pkthdr.len);
+
+		ubt_fwd_mbuf_up(sc, &m);
+		/* m == NULL at this point */
+		/* FALLTHOUGH */
+
+	case USB_ST_SETUP:
+submit_next:
+		NG_FREE_M(m); /* checks for m != NULL */
+
+		xfer->frlengths[0] = xfer->max_data_length;
+		usb2_start_hardware(xfer);
+		break;
+
+	default: /* Error */
+		if (xfer->error != USB_ERR_CANCELLED) {
+			UBT_WARN(sc, "bulk-in transfer failed: %s\n",
+				usb2_errstr(xfer->error));
+
+			/* Try to clear stall first */
+			xfer->flags.stall_pipe = 1;
+			goto submit_next;
+		}
+			/* transfer cancelled */
+		break;
+	}
+} /* ubt_bulk_read_callback */
+
+/*
+ * Called when outgoing bulk transfer (ACL packet) has completed, i.e.
+ * ACL packet was sent to the device.
+ * USB context.
+ */
+
+static void
+ubt_bulk_write_callback(struct usb2_xfer *xfer)
+{
+	struct ubt_softc	*sc = xfer->priv_sc;
+	struct mbuf		*m;
+
+	switch (USB_GET_STATE(xfer)) {
+	case USB_ST_TRANSFERRED:
+		UBT_INFO(sc, "sent %d bytes to bulk-out pipe\n", xfer->actlen);
+		UBT_STAT_BYTES_SENT(sc, xfer->actlen);
+		UBT_STAT_PCKTS_SENT(sc);
+		/* FALLTHROUGH */
+
+	case USB_ST_SETUP:
+send_next:
+		/* Get next mbuf, if any */
+		UBT_NG_LOCK(sc);
+		NG_BT_MBUFQ_DEQUEUE(&sc->sc_aclq, m);
+		UBT_NG_UNLOCK(sc);
+
+		if (m == NULL) {
+			UBT_INFO(sc, "ACL data queue is empty\n");
+			break; /* transfer completed */
+		}
+
+		/*
+		 * Copy ACL data frame back to a linear USB transfer buffer
+		 * and schedule transfer
+		 */
+
+		usb2_m_copy_in(xfer->frbuffers, 0, m, 0, m->m_pkthdr.len);
+		xfer->frlengths[0] = m->m_pkthdr.len;
+
+		UBT_INFO(sc, "bulk-out transfer has been started, len=%d\n",
+			m->m_pkthdr.len);
+
+		NG_FREE_M(m);
+
+		usb2_start_hardware(xfer);
+		break;
+
+	default: /* Error */
+		if (xfer->error != USB_ERR_CANCELLED) {
+			UBT_WARN(sc, "bulk-out transfer failed: %s\n",
+				usb2_errstr(xfer->error));
+
+			UBT_STAT_OERROR(sc);
+
+			/* try to clear stall first */
+			xfer->flags.stall_pipe = 1;
+			goto send_next;
+		}
+			/* transfer cancelled */
+		break;
+	}
+} /* ubt_bulk_write_callback */
+
+/*
+ * Called when incoming isoc transfer (SCO packet) has completed, i.e.
+ * SCO packet was received from the device.
+ * USB context.
+ */
+
+static void
+ubt_isoc_read_callback(struct usb2_xfer *xfer)
+{
+	struct ubt_softc	*sc = xfer->priv_sc;
+	int			n;
+
+	switch (USB_GET_STATE(xfer)) {
+	case USB_ST_TRANSFERRED:
+		for (n = 0; n < xfer->nframes; n ++)
+			if (ubt_isoc_read_one_frame(xfer, n) < 0)
+				break;
+		/* FALLTHROUGH */
+
+	case USB_ST_SETUP:
+read_next:
+		for (n = 0; n < xfer->nframes; n ++)
+			xfer->frlengths[n] = xfer->max_frame_size;
+
+		usb2_start_hardware(xfer);
+		break;
+
+	default: /* Error */
+                if (xfer->error != USB_ERR_CANCELLED) {
+                        UBT_STAT_IERROR(sc);
+                        goto read_next;
+                }
+
+		/* transfer cancelled */
+		break;
+	}
+} /* ubt_isoc_read_callback */
+
+/*
+ * Helper function. Called from ubt_isoc_read_callback() to read
+ * SCO data from one frame.
+ * USB context.
+ */
+
+static int
+ubt_isoc_read_one_frame(struct usb2_xfer *xfer, int frame_no)
+{
+	struct ubt_softc	*sc = xfer->priv_sc;
+	struct mbuf		*m;
+	int			len, want, got;
+
+	/* Get existing SCO reassembly buffer */
+	m = sc->sc_isoc_in_buffer;
+	sc->sc_isoc_in_buffer = NULL;
+
+	/* While we have data in the frame */
+	while ((len = xfer->frlengths[frame_no]) > 0) {
+		if (m == NULL) {
+			/* Start new reassembly buffer */
+			MGETHDR(m, M_DONTWAIT, MT_DATA);
+			if (m == NULL) {
+				UBT_STAT_IERROR(sc);
+				return (-1);	/* XXX out of sync! */
+			}
+
+			MCLGET(m, M_DONTWAIT);
+			if (!(m->m_flags & M_EXT)) {
+				UBT_STAT_IERROR(sc);
+				NG_FREE_M(m);
+				return (-1);	/* XXX out of sync! */
+			}
+
+			/* Expect SCO header */
+			*mtod(m, uint8_t *) = NG_HCI_SCO_DATA_PKT;
+			m->m_pkthdr.len = m->m_len = got = 1;
+			want = sizeof(ng_hci_scodata_pkt_t);
+		} else {
+			/*
+			 * Check if we have SCO header and if so 
+			 * adjust amount of data we want
+			 */
+			got = m->m_pkthdr.len;
+			want = sizeof(ng_hci_scodata_pkt_t);

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 16:34:08 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B69D310656B2;
	Wed, 27 May 2009 16:34:08 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A34338FC1E;
	Wed, 27 May 2009 16:34:08 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RGY8Cl003782;
	Wed, 27 May 2009 16:34:08 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RGY8P8003781;
	Wed, 27 May 2009 16:34:08 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200905271634.n4RGY8P8003781@svn.freebsd.org>
From: Andrew Thompson 
Date: Wed, 27 May 2009 16:34:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192907 - in head/sys: dev/usb/bluetooth
	netgraph/bluetooth/drivers/ubt
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 16:34:09 -0000

Author: thompsa
Date: Wed May 27 16:34:08 2009
New Revision: 192907
URL: http://svn.freebsd.org/changeset/base/192907

Log:
  move ng_ubt_var.h back to its original place

Added:
  head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h   (props changed)
     - copied unchanged from r192906, head/sys/dev/usb/bluetooth/ng_ubt_var.h
Deleted:
  head/sys/dev/usb/bluetooth/ng_ubt_var.h

Copied: head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h (from r192906, head/sys/dev/usb/bluetooth/ng_ubt_var.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h	Wed May 27 16:34:08 2009	(r192907, copy of r192906, head/sys/dev/usb/bluetooth/ng_ubt_var.h)
@@ -0,0 +1,131 @@
+/*
+ * ng_ubt_var.h
+ */
+
+/*-
+ * Copyright (c) 2001-2009 Maksim Yevmenkin 
+ * 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.
+ *
+ * $Id: ng_ubt_var.h,v 1.2 2003/03/22 23:44:36 max Exp $
+ * $FreeBSD$
+ */
+
+#ifndef _NG_UBT_VAR_H_
+#define	_NG_UBT_VAR_H_	1
+
+/* Debug printf's */
+#define	UBT_DEBUG(level, sc, fmt, ...)				\
+do {								\
+	if ((sc)->sc_debug >= (level))				\
+		device_printf((sc)->sc_dev, "%s:%d: " fmt, 	\
+			__FUNCTION__, __LINE__,## __VA_ARGS__);	\
+} while (0)
+
+#define	UBT_ALERT(...)		UBT_DEBUG(NG_UBT_ALERT_LEVEL, __VA_ARGS__)
+#define	UBT_ERR(...)		UBT_DEBUG(NG_UBT_ERR_LEVEL, __VA_ARGS__)
+#define	UBT_WARN(...)		UBT_DEBUG(NG_UBT_WARN_LEVEL, __VA_ARGS__)
+#define	UBT_INFO(...)		UBT_DEBUG(NG_UBT_INFO_LEVEL, __VA_ARGS__)
+
+#define UBT_NG_LOCK(sc)		mtx_lock(&(sc)->sc_ng_mtx)
+#define UBT_NG_UNLOCK(sc)	mtx_unlock(&(sc)->sc_ng_mtx)
+
+/* Bluetooth USB control request type */
+#define	UBT_HCI_REQUEST		0x20
+#define	UBT_DEFAULT_QLEN	64
+#define	UBT_ISOC_NFRAMES	32	/* should be factor of 8 */
+
+/* Bluetooth USB defines */
+enum {
+	/* Interface #0 transfers */
+	UBT_IF_0_BULK_DT_WR = 0,
+	UBT_IF_0_BULK_DT_RD,
+	UBT_IF_0_INTR_DT_RD,
+	UBT_IF_0_CTRL_DT_WR,
+	
+	/* Interface #1 transfers */
+	UBT_IF_1_ISOC_DT_RD1,
+	UBT_IF_1_ISOC_DT_RD2,
+	UBT_IF_1_ISOC_DT_WR1,
+	UBT_IF_1_ISOC_DT_WR2,
+
+	UBT_N_TRANSFER,		/* total number of transfers */
+};
+
+/* USB device softc structure */
+struct ubt_softc {
+	device_t		sc_dev;		/* for debug printf */
+
+	/* State */
+	ng_ubt_node_debug_ep	sc_debug;	/* debug level */
+
+	ng_ubt_node_stat_ep	sc_stat;	/* statistic */
+#define	UBT_STAT_PCKTS_SENT(sc)		(sc)->sc_stat.pckts_sent ++
+#define	UBT_STAT_BYTES_SENT(sc, n)	(sc)->sc_stat.bytes_sent += (n)
+#define	UBT_STAT_PCKTS_RECV(sc)		(sc)->sc_stat.pckts_recv ++
+#define	UBT_STAT_BYTES_RECV(sc, n)	(sc)->sc_stat.bytes_recv += (n)
+#define	UBT_STAT_OERROR(sc)		(sc)->sc_stat.oerrors ++
+#define	UBT_STAT_IERROR(sc)		(sc)->sc_stat.ierrors ++
+#define	UBT_STAT_RESET(sc)	bzero(&(sc)->sc_stat, sizeof((sc)->sc_stat))
+
+	/* USB device specific */
+	struct mtx		sc_if_mtx;	/* interfaces lock */
+	struct usb2_xfer	*sc_xfer[UBT_N_TRANSFER];
+
+	struct mtx		sc_ng_mtx;	/* lock for shared NG data */
+
+	/* HCI commands */
+	struct ng_bt_mbufq	sc_cmdq;	/* HCI command queue */
+#define	UBT_CTRL_BUFFER_SIZE	(sizeof(struct usb2_device_request) +	\
+				 sizeof(ng_hci_cmd_pkt_t) + NG_HCI_CMD_PKT_SIZE)
+#define	UBT_INTR_BUFFER_SIZE	(MCLBYTES-1)	/* reserve 1 byte for ID-tag */
+
+	/* ACL data */
+	struct ng_bt_mbufq	sc_aclq;	/* ACL data queue */
+#define	UBT_BULK_READ_BUFFER_SIZE (MCLBYTES-1)	/* reserve 1 byte for ID-tag */
+#define	UBT_BULK_WRITE_BUFFER_SIZE (MCLBYTES)
+
+	/* SCO data */
+	struct ng_bt_mbufq	sc_scoq;	/* SCO data queue */
+	struct mbuf		*sc_isoc_in_buffer; /* SCO reassembly buffer */
+
+	/* Netgraph specific */
+	node_p			sc_node;	/* pointer back to node */
+	hook_p			sc_hook;	/* upstream hook */
+
+	/* Glue */
+	int			sc_task_flags;	/* task flags */
+#define UBT_FLAG_T_PENDING	(1 << 0)	/* task pending */
+#define UBT_FLAG_T_STOP_ALL	(1 << 1)	/* stop all xfers */
+#define UBT_FLAG_T_START_ALL	(1 << 2)	/* start all read and isoc
+						   write xfers */
+#define UBT_FLAG_T_START_CTRL	(1 << 3)	/* start control xfer (write) */
+#define UBT_FLAG_T_START_BULK	(1 << 4)	/* start bulk xfer (write) */
+
+	struct task		sc_task;
+};
+typedef struct ubt_softc	ubt_softc_t;
+typedef struct ubt_softc *	ubt_softc_p;
+
+#endif /* ndef _NG_UBT_VAR_H_ */
+

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 16:36:55 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2DB0A10656DB;
	Wed, 27 May 2009 16:36:55 +0000 (UTC) (envelope-from zml@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B19478FC1C;
	Wed, 27 May 2009 16:36:54 +0000 (UTC) (envelope-from zml@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RGasCl003929;
	Wed, 27 May 2009 16:36:54 GMT (envelope-from zml@svn.freebsd.org)
Received: (from zml@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RGasNe003922;
	Wed, 27 May 2009 16:36:54 GMT (envelope-from zml@svn.freebsd.org)
Message-Id: <200905271636.n4RGasNe003922@svn.freebsd.org>
From: Zachary Loafman 
Date: Wed, 27 May 2009 16:36:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192908 - in head: share/man/man9 sys/conf sys/kern
	sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 16:36:58 -0000

Author: zml
Date: Wed May 27 16:36:54 2009
New Revision: 192908
URL: http://svn.freebsd.org/changeset/base/192908

Log:
  fail(9) support:
  
  Add support for kernel fault injection using KFAIL_POINT_* macros and
  fail_point_* infrastructure. Add example fail point in vfs_bio.c to
  simulate VM buf pressure.
  
  Approved by:        dfr (mentor)

Added:
  head/share/man/man9/fail.9   (contents, props changed)
  head/sys/kern/kern_fail.c   (contents, props changed)
  head/sys/sys/fail.h   (contents, props changed)
Modified:
  head/share/man/man9/Makefile
  head/sys/conf/files
  head/sys/kern/vfs_bio.c
  head/sys/sys/queue.h

Modified: head/share/man/man9/Makefile
==============================================================================
--- head/share/man/man9/Makefile	Wed May 27 16:34:08 2009	(r192907)
+++ head/share/man/man9/Makefile	Wed May 27 16:36:54 2009	(r192908)
@@ -99,6 +99,7 @@ MAN=	accept_filter.9 \
 	DRIVER_MODULE.9 \
 	EVENTHANDLER.9 \
 	extattr.9 \
+	fail.9 \
 	fetch.9 \
 	firmware.9 \
 	g_access.9 \

Added: head/share/man/man9/fail.9
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/share/man/man9/fail.9	Wed May 27 16:36:54 2009	(r192908)
@@ -0,0 +1,197 @@
+.\"
+.\" Copyright (c) 2009 Isilon Inc http://www.isilon.com/
+.\"
+.\" 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(s), this list of conditions and the following disclaimer as
+.\"    the first lines of this file unmodified other than the possible
+.\"    addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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 May 10, 2009
+.Dt FAIL 9
+.Os
+.Sh NAME
+.Nm KFAIL_POINT_CODE ,
+.Nm KFAIL_POINT_RETURN ,
+.Nm KFAIL_POINT_RETURN_VOID ,
+.Nm KFAIL_POINT_ERROR ,
+.Nm KFAIL_POINT_GOTO ,
+.Nm fail_point ,
+.Nm DEBUG_FP
+.
+.Nd fail points
+.Sh SYNOPSIS
+.In sys/fail.h
+.Fn KFAIL_POINT_CODE "parent" "name" "code"
+.Fn KFAIL_POINT_RETURN "parent" "name"
+.Fn KFAIL_POINT_RETURN_VOID "parent" "name"
+.Fn KFAIL_POINT_ERROR "parent" "name" "error_var"
+.Fn KFAIL_POINT_GOTO "parent" "name" "error_var" "label"
+.Sh DESCRIPTION
+Fail points are used to add code points where errors may be injected
+in a user controlled fashion. Fail points provide a convenient wrapper
+around user provided error injection code, providing a
+.Xr sysctl 9 MIB , and a parser for that MIB that describes how the error
+injection code should fire.
+.Pp
+The base fail point macro is
+.Fn KFAIL_POINT_CODE
+where
+.Fa parent
+is a sysctl tree (frequently
+.Sy DEBUG_FP
+for kernel fail points, but various subsystems may wish to provide
+their own fail point trees), and
+.Fa name
+is the name of the MIB in that tree, and
+.Fa code
+is the error injection code. The
+.Fa code
+argument does not require braces, but it is considered good style to
+use braces for any multi-line code arguments. Inside the
+.Fa code
+argument, the evaluation of
+.Sy RETURN_VALUE
+is derived from the
+.Fn return
+value set in the sysctl MIB. See
+.Sx SYSCTL SETTINGS
+below.
+.Pp
+The remaining
+.Fn KFAIL_POINT_*
+macros are wrappers around common error injection paths:
+.Bl -tag -width 8
+.It Fn KFAIL_POINT_RETURN parent name
+is the equivalent of
+.Sy KFAIL_POINT_CODE(..., return RETURN_VALUE)
+.It Fn KFAIL_POINT_RETURN_VOID parent name
+is the equivalent of
+.Sy KFAIL_POINT_CODE(..., return)
+.It Fn KFAIL_POINT_ERROR parent name error_var
+is the equivalent of
+.Sy KFAIL_POINT_CODE(..., error_var = RETURN_VALUE)
+.It Fn KFAIL_POINT_GOTO parent name error_var label
+is the equivalent of
+.Sy KFAIL_POINT_CODE(...,
+  { error_var = RETURN_VALUE; goto label;})
+.El
+.Pp
+.Sh SYSCTL VARIABLES
+The
+.Fn KFAIL_POINT_*
+macros add sysctl MIBs where specified. Many base kernel MIBs can be
+found in the
+.Sy debug.fail_point
+tree (referenced in code by
+.Sy DEBUG_FP
+).
+.Pp
+The sysctl setting recognizes the following grammar:
+.Pp
+   ::
+       ( "->"  )*
+.Pp
+   ::
+      ( ( "%") | ( "*" ) )*
+      
+      [ "("  ")" ]
+.Pp
+   ::
+       [ "."  ] |
+      "." 
+.Pp
+   ::
+      "off" | "return" | "sleep" | "panic" | "break" | "print"
+.Pp
+The 
+argument specifies which action to take:
+.Bl -tag -width ".Dv return"
+.It Sy off
+Take no action (does not trigger fail point code)
+.It Sy return
+Trigger fail point code with specified argument
+.It Sy sleep
+Sleep the specified number of milliseconds
+.It Sy panic
+Panic
+.It Sy break
+Break into the debugger.
+.It Sy print
+Print that the fail point executed
+.El
+.Pp
+The % and * modifiers prior to  control when
+ is executed. The % form (e.g. "1.2%") can be used to
+specify a probability that  will execute. The * form
+(e.g. "5*") can be used to specify the number of times  should
+be executed before this  is disabled. Only the last probability
+and the last count are used if multiple are specified, i.e. "1.2%2%"
+is the same as "2%". When both a probability and a count are
+specified, the probability is evaluated before the count, i.e. "2%5*"
+means "2% of the time, but only execute it 5 times total".
+.Pp
+The operator -> can be used to express cascading terms. If you specify
+->, it means that if  doesn't 'execute', 
+is evaluated. For the purpose of this operator, the return() and
+print() operators are the only types that cascade. A return() term
+only cascades if the code executes, and a print() term only cascades
+when passed a non-zero argument.
+.Pp
+.Sh EXAMPLES
+.Bl -tag
+.It Sy sysctl debug.fail_point.foobar="2.1%return(5)"
+21/1000ths of the time, execute
+.Fa code
+with RETURN_VALUE set to 5.
+.It Sy sysctl debug.fail_point.foobar="2%return(5)->5%return(22)"
+2/100th of the time, execute
+.Fa code
+with RETURN_VALUE set to 5. If that doesn't happen, 5% of the time
+execute
+.Fa code
+with RETURN_VALUE set to 22.
+.It Sy sysctl debug.fail_point.foobar="5*return(5)->0.1%return(22)"
+For 5 times, return 5. After that, 1/1000ths of the time, return 22.
+.It Sy sysctl debug.fail_point.foobar="0.1%5*return(5)"
+Return 5 for 1 in 1000 executions, but only execute 5 times total.
+.It Sy sysctl debug.fail_point.foobar="1%*sleep(50)"
+1/100ths of the time, sleep 50ms.
+.El
+.Pp
+.Sh CAVEATS
+It's easy to shoot yourself in the foot by setting fail points too
+aggressively or setting too many in combination. For example, forcing
+.Fn malloc
+to fail consistently is potentially harmful to uptime.
+.Pp
+The
+.Fn sleep
+sysctl setting may not be appropriate in all situations. Currently,
+.Fn fail_point_eval
+does not verify whether the context is appropriate for calling
+.Fn msleep .
+.Pp
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An Zach Loafman Aq zml@FreeBSD.org .

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Wed May 27 16:34:08 2009	(r192907)
+++ head/sys/conf/files	Wed May 27 16:36:54 2009	(r192908)
@@ -1860,6 +1860,7 @@ kern/kern_environment.c		standard
 kern/kern_event.c		standard
 kern/kern_exec.c		standard
 kern/kern_exit.c		standard
+kern/kern_fail.c		standard
 kern/kern_fork.c		standard
 kern/kern_idle.c		standard
 kern/kern_intr.c		standard

Added: head/sys/kern/kern_fail.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/kern/kern_fail.c	Wed May 27 16:36:54 2009	(r192908)
@@ -0,0 +1,575 @@
+/*-
+ * Copyright (c) 2009 Isilon Inc http://www.isilon.com/
+ *
+ * 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.
+ */
+/**
+ * @file
+ *
+ * fail(9) Facility.
+ *
+ * @ingroup failpoint_private
+ */
+/**
+ * @defgroup failpoint fail(9) Facility
+ *
+ * Failpoints allow for injecting fake errors into running code on the fly,
+ * without modifying code or recompiling with flags.  Failpoints are always
+ * present, and are very efficient when disabled.  Failpoints are described
+ * in man fail(9).
+ */
+/**
+ * @defgroup failpoint_private Private fail(9) Implementation functions
+ *
+ * Private implementations for the actual failpoint code.
+ *
+ * @ingroup failpoint
+ */
+/**
+ * @addtogroup failpoint_private
+ * @{
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#ifdef ILOG_DEFINE_FOR_FILE
+ILOG_DEFINE_FOR_FILE(L_ISI_FAIL_POINT, L_ILOG, fail_point);
+#endif
+
+MALLOC_DEFINE(M_FAIL_POINT, "Fail Points", "fail points system");
+#define fp_free(ptr) free(ptr, M_FAIL_POINT)
+#define fp_malloc(size, flags) malloc((size), M_FAIL_POINT, (flags))
+
+static struct mtx g_fp_mtx;
+MTX_SYSINIT(g_fp_mtx, &g_fp_mtx, "fail point mtx", MTX_DEF);
+#define FP_LOCK()	mtx_lock(&g_fp_mtx)
+#define FP_UNLOCK()	mtx_unlock(&g_fp_mtx)
+
+static inline void
+fail_point_sleep(struct fail_point *fp, struct fail_point_entry *ent,
+    int msecs, enum fail_point_return_code *pret)
+{
+	/* convert from millisecs to ticks, rounding up */
+	int timo = ((msecs * hz) + 999) / 1000;
+
+	if (timo) {
+		if (fp->fp_sleep_fn == NULL) {
+			msleep(fp, &g_fp_mtx, PWAIT, "failpt", timo);
+		} else {
+			timeout(fp->fp_sleep_fn, fp->fp_sleep_arg, timo);
+			*pret = FAIL_POINT_RC_QUEUED;
+		}
+	}
+}
+
+
+/**
+ * Defines stating the equivalent of probablilty one (100%)
+ */
+enum {
+	PROB_MAX = 1000000,	/* probability between zero and this number */
+	PROB_DIGITS = 6,        /* number of zero's in above number */
+};
+
+static const char *fail_type_strings[] = {
+	"off",
+	"panic",
+	"return",
+	"break",
+	"print",
+	"sleep",
+};
+
+static char *parse_fail_point(struct fail_point_entries *, char *);
+static char *parse_term(struct fail_point_entries *, char *);
+static char *parse_number(int *out_units, int *out_decimal, char *);
+static char *parse_type(struct fail_point_entry *, char *);
+static void free_entry(struct fail_point_entries *, struct fail_point_entry *);
+static void clear_entries(struct fail_point_entries *);
+
+/**
+ * Initialize a fail_point.  The name is formed in a printf-like fashion
+ * from "fmt" and subsequent arguments.  This function is generally used
+ * for custom failpoints located at odd places in the sysctl tree, and is
+ * not explicitly needed for standard in-line-declared failpoints.
+ *
+ * @ingroup failpoint
+ */
+void
+fail_point_init(struct fail_point *fp, const char *fmt, ...)
+{
+	va_list ap;
+	char *name;
+	int n;
+
+	TAILQ_INIT(&fp->fp_entries);
+	fp->fp_flags = 0;
+
+	/* Figure out the size of the name. */
+	va_start(ap, fmt);
+	n = vsnprintf(NULL, 0, fmt, ap);
+	va_end(ap);
+
+	/* Allocate the name and fill it in. */
+	name = fp_malloc(n + 1, M_WAITOK);
+	if (name != NULL) {
+		va_start(ap, fmt);
+		vsnprintf(name, n + 1, fmt, ap);
+		va_end(ap);
+	}
+	fp->fp_name = name;
+	fp->fp_flags |= FAIL_POINT_DYNAMIC_NAME;
+	fp->fp_sleep_fn = NULL;
+	fp->fp_sleep_arg = NULL;
+}
+
+/**
+ * Free the resources held by a fail_point.
+ *
+ * @ingroup failpoint
+ */
+void
+fail_point_destroy(struct fail_point *fp)
+{
+	struct fail_point_entry *ent;
+
+	if (fp->fp_flags & FAIL_POINT_DYNAMIC_NAME && fp->fp_name != NULL) {
+		fp_free((void *)(intptr_t)fp->fp_name);
+		fp->fp_name = NULL;
+	}
+	fp->fp_flags = 0;
+
+	while (!TAILQ_EMPTY(&fp->fp_entries)) {
+		ent = TAILQ_FIRST(&fp->fp_entries);
+		TAILQ_REMOVE(&fp->fp_entries, ent, fe_entries);
+		fp_free(ent);
+	}
+}
+
+/**
+ * This does the real work of evaluating a fail point. If the fail point tells
+ * us to return a value, this function returns 1 and fills in 'return_value'
+ * (return_value is allowed to be null). If the fail point tells us to panic,
+ * we never return. Otherwise we just return 0 after doing some work, which
+ * means "keep going".
+ */
+enum fail_point_return_code
+fail_point_eval_nontrivial(struct fail_point *fp, int *return_value)
+{
+	enum fail_point_return_code ret = FAIL_POINT_RC_CONTINUE;
+	struct fail_point_entry *ent, *next;
+	int msecs;
+
+	FP_LOCK();
+
+	ent = TAILQ_FIRST(&fp->fp_entries);
+	while (ent) {
+		int cont = 0; /* don't continue by default */
+		next = TAILQ_NEXT(ent, fe_entries);
+
+		if (ent->fe_prob < PROB_MAX &&
+		    ent->fe_prob < random() % PROB_MAX) {
+			cont = 1;
+			goto loop_end;
+		}
+
+		switch (ent->fe_type) {
+		case FAIL_POINT_PANIC:
+			panic("fail point %s panicking", fp->fp_name);
+			/* NOTREACHED */
+
+		case FAIL_POINT_RETURN:
+			if (return_value)
+				*return_value = ent->fe_arg;
+			ret = FAIL_POINT_RC_RETURN;
+			break;
+
+		case FAIL_POINT_BREAK:
+			printf("fail point %s breaking to debugger\n", fp->fp_name);
+			breakpoint();
+			break;
+
+		case FAIL_POINT_PRINT:
+			printf("fail point %s executing\n", fp->fp_name);
+			cont = ent->fe_arg;
+			break;
+
+		case FAIL_POINT_SLEEP:
+			/*
+			 * Free the entry now if necessary, since
+			 * we're about to drop the mutex and sleep.
+			 */
+			msecs = ent->fe_arg;
+			if (ent->fe_count > 0 && --ent->fe_count == 0) {
+				free_entry(&fp->fp_entries, ent);
+				ent = NULL;
+			}
+
+			if (msecs)
+				fail_point_sleep(fp, ent, msecs, &ret);
+			break;
+
+		default:
+			break;
+		}
+
+		if (ent && ent->fe_count > 0 && --ent->fe_count == 0)
+			free_entry(&fp->fp_entries, ent);
+
+loop_end:
+		if (cont)
+			ent = next;
+		else
+			break;
+	}
+
+	/* Get rid of "off"s at the end. */
+	while ((ent = TAILQ_LAST(&fp->fp_entries, fail_point_entries)) &&
+	       ent->fe_type == FAIL_POINT_OFF)
+		free_entry(&fp->fp_entries, ent);
+
+	FP_UNLOCK();
+
+	return ret;
+}
+
+/**
+ * Translate internal fail_point structure into human-readable text.
+ */
+static void
+fail_point_get(struct fail_point *fp, struct sbuf *sb)
+{
+	struct fail_point_entry *ent;
+
+	FP_LOCK();
+
+	TAILQ_FOREACH(ent, &fp->fp_entries, fe_entries) {
+		if (ent->fe_prob < PROB_MAX) {
+			int decimal = ent->fe_prob % (PROB_MAX / 100);
+			int units = ent->fe_prob / (PROB_MAX / 100);
+			sbuf_printf(sb, "%d", units);
+			if (decimal) {
+				int digits = PROB_DIGITS - 2;
+				while (!(decimal % 10)) {
+					digits--;
+					decimal /= 10;
+				}
+				sbuf_printf(sb, ".%0*d", digits, decimal);
+			}
+			sbuf_printf(sb, "%%");
+		}
+		if (ent->fe_count > 0)
+			sbuf_printf(sb, "%d*", ent->fe_count);
+		sbuf_printf(sb, "%s", fail_type_strings[ent->fe_type]);
+		if (ent->fe_arg)
+			sbuf_printf(sb, "(%d)", ent->fe_arg);
+		if (TAILQ_NEXT(ent, fe_entries))
+			sbuf_printf(sb, "->");
+	}
+	if (TAILQ_EMPTY(&fp->fp_entries))
+		sbuf_printf(sb, "off");
+
+	FP_UNLOCK();
+}
+
+/**
+ * Set an internal fail_point structure from a human-readable failpoint string
+ * in a lock-safe manner.
+ */
+static int
+fail_point_set(struct fail_point *fp, char *buf)
+{
+	int error = 0;
+	struct fail_point_entry *ent, *ent_next;
+	struct fail_point_entries new_entries;
+
+	/* Parse new entries. */
+	TAILQ_INIT(&new_entries);
+	if (!parse_fail_point(&new_entries, buf)) {
+	        clear_entries(&new_entries);
+		error = EINVAL;
+		goto end;
+	}
+
+	FP_LOCK();
+
+	/* Move new entries in. */
+	TAILQ_SWAP(&fp->fp_entries, &new_entries, fail_point_entry, fe_entries);
+	clear_entries(&new_entries);
+
+	/* Get rid of useless zero probability entries. */
+	TAILQ_FOREACH_SAFE(ent, &fp->fp_entries, fe_entries, ent_next) {
+		if (ent->fe_prob == 0)
+			free_entry(&fp->fp_entries, ent);
+	}
+
+	/* Get rid of "off"s at the end. */
+	while ((ent = TAILQ_LAST(&fp->fp_entries, fail_point_entries)) &&
+		ent->fe_type == FAIL_POINT_OFF)
+		free_entry(&fp->fp_entries, ent);
+
+	FP_UNLOCK();
+
+ end:
+#ifdef IWARNING
+	if (error)
+		IWARNING("Failed to set %s (%s) to %s",
+		    fp->fp_name, fp->fp_location, buf);
+	else
+		INOTICE("Set %s (%s) to %s",
+		    fp->fp_name, fp->fp_location, buf);
+#endif /* IWARNING */
+
+	return error;
+}
+
+#define MAX_FAIL_POINT_BUF	1023
+
+/**
+ * Handle kernel failpoint set/get.
+ */
+int
+fail_point_sysctl(SYSCTL_HANDLER_ARGS)
+{
+	struct fail_point *fp = arg1;
+	char *buf = NULL;
+	struct sbuf sb;
+	int error;
+
+	/* Retrieving */
+	sbuf_new(&sb, NULL, 128, SBUF_AUTOEXTEND);
+	fail_point_get(fp, &sb);
+	sbuf_trim(&sb);
+	sbuf_finish(&sb);
+	error = SYSCTL_OUT(req, sbuf_data(&sb), sbuf_len(&sb));
+	sbuf_delete(&sb);
+
+	/* Setting */
+	if (!error && req->newptr) {
+		if (req->newlen > MAX_FAIL_POINT_BUF) {
+			error = EINVAL;
+			goto out;
+		}
+
+		buf = fp_malloc(req->newlen + 1, M_WAITOK);
+
+		error = SYSCTL_IN(req, buf, req->newlen);
+		if (error)
+			goto out;
+		buf[req->newlen] = '\0';
+
+		error = fail_point_set(fp, buf);
+        }
+
+out:
+	if (buf)
+		fp_free(buf);
+	return error;
+}
+
+/**
+ * Internal helper function to translate a human-readable failpoint string
+ * into a internally-parsable fail_point structure.
+ */
+static char *
+parse_fail_point(struct fail_point_entries *ents, char *p)
+{
+	/*   ::
+	 *       ( "->"  )*
+	 */
+	if (!(p = parse_term(ents, p)))
+		return 0;
+	while (*p)
+		if (p[0] != '-' || p[1] != '>' || !(p = parse_term(ents, p+2)))
+			return 0;
+	return p;
+}
+
+/**
+ * Internal helper function to parse an individual term from a failpoint.
+ */
+static char *
+parse_term(struct fail_point_entries *ents, char *p)
+{
+	struct fail_point_entry *ent;
+
+	ent = fp_malloc(sizeof *ent, M_WAITOK | M_ZERO);
+	ent->fe_prob = PROB_MAX;
+	TAILQ_INSERT_TAIL(ents, ent, fe_entries);
+
+	/*
+	 *  ::
+	 *     ( ( "%") | ( "*" ) )*
+	 *     
+	 *     [ "("  ")" ]
+	 */
+
+	/* ( ( "%") | ( "*" ) )* */
+	while (('0' <= *p && *p <= '9') || *p == '.') {
+		int units, decimal;
+
+		if (!(p = parse_number(&units, &decimal, p)))
+			return 0;
+
+		if (*p == '%') {
+			if (units > 100) /* prevent overflow early */
+				units = 100;
+			ent->fe_prob = units * (PROB_MAX / 100) + decimal;
+			if (ent->fe_prob > PROB_MAX)
+				ent->fe_prob = PROB_MAX;
+
+		} else if (*p == '*') {
+			if (!units || decimal)
+				return 0;
+			ent->fe_count = units;;
+
+		} else {
+			return 0;
+		}
+
+		p++;
+	}
+
+	/*  */
+	if (!(p = parse_type(ent, p)))
+		return 0;
+	if (*p == '\0')
+		return p;
+
+	/* [ "("  ")" ] */
+	if (*p != '(')
+		return p;
+	p++;
+	if (('0' <= *p && *p <= '9') || *p == '-')
+		ent->fe_arg = strtol(p, &p, 0);
+	else
+		return 0;
+	if (*p++ != ')')
+		return 0;
+
+	return p;
+}
+
+/**
+ * Internal helper function to parse a numeric for a failpoint term.
+ */
+static char *
+parse_number(int *out_units, int *out_decimal, char *p)
+{
+	char *old_p;
+
+	/*
+	 *   ::
+	 *       [ "."  ] |
+	 *      "." 
+	 */
+
+	/* whole part */
+	old_p = p;
+	*out_units = strtol(p, &p, 10);;
+	if (p == old_p && *p != '.')
+		return 0;
+
+	/* fractional part */
+	*out_decimal = 0;
+	if (*p == '.') {
+		int digits = 0;
+		p++;
+		while ('0' <= *p && *p <= '9') {
+			int digit = *p - '0';
+			if (digits < PROB_DIGITS - 2)
+				*out_decimal = *out_decimal * 10 + digit;
+			else if (digits == PROB_DIGITS - 2 && digit >= 5)
+				(*out_decimal)++;
+			digits++;
+			p++;
+		}
+		if (!digits) /* need at least one digit after '.' */
+			return 0;
+		while (digits++ < PROB_DIGITS - 2) /* add implicit zeros */
+			*out_decimal *= 10;
+	}
+
+	return p; /* success */
+}
+
+/**
+ * Internal helper function to parse an individual type for a failpoint term.
+ */
+static char *
+parse_type(struct fail_point_entry *ent, char *beg)
+{
+	enum fail_point_t type;
+	char *end = beg;
+	while ('a' <= *end && *end <= 'z')
+		end++;
+	if (beg == end)
+		return 0;
+	for (type = FAIL_POINT_OFF; type != FAIL_POINT_INVALID; type++) {
+		const char *p = fail_type_strings[type];
+		const char *q = beg;
+		while (q < end && *p++ == *q++);
+		if (q == end && *p == '\0') {
+			ent->fe_type = type;
+			return end;
+		}
+	}
+	return 0;
+}
+
+/**
+ * Internal helper function to free an individual failpoint term.
+ */
+static void
+free_entry(struct fail_point_entries *ents, struct fail_point_entry *ent)
+{
+	TAILQ_REMOVE(ents, ent, fe_entries);
+	fp_free(ent);
+}
+
+/**
+ * Internal helper function to clear out all failpoint terms for a single
+ * failpoint.
+ */
+static void
+clear_entries(struct fail_point_entries *ents)
+{
+	struct fail_point_entry *ent, *ent_next;
+	TAILQ_FOREACH_SAFE(ent, ents, fe_entries, ent_next)
+		fp_free(ent);
+	TAILQ_INIT(ents);
+}
+
+/* The fail point sysctl tree. */
+SYSCTL_NODE(_debug, OID_AUTO, fail_point, CTLFLAG_RW, 0, "fail points");

Modified: head/sys/kern/vfs_bio.c
==============================================================================
--- head/sys/kern/vfs_bio.c	Wed May 27 16:34:08 2009	(r192907)
+++ head/sys/kern/vfs_bio.c	Wed May 27 16:36:54 2009	(r192908)
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1167,6 +1168,15 @@ buf_dirty_count_severe(void)
 	return(numdirtybuffers >= hidirtybuffers);
 }
 
+static __noinline int
+buf_vm_page_count_severe(void)
+{
+
+	KFAIL_POINT_CODE(DEBUG_FP, buf_pressure, return 1);
+
+	return vm_page_count_severe();
+}
+
 /*
  *	brelse:
  *
@@ -1233,7 +1243,7 @@ brelse(struct buf *bp)
 	 */
 	if (bp->b_flags & B_DELWRI)
 		bp->b_flags &= ~B_RELBUF;
-	else if (vm_page_count_severe()) {
+	else if (buf_vm_page_count_severe()) {
 		/*
 		 * The locking of the BO_LOCK is not necessary since
 		 * BKGRDINPROG cannot be set while we hold the buf
@@ -1502,7 +1512,7 @@ bqrelse(struct buf *bp)
 		 * lock, it can only be cleared if it is already
 		 * pending.
 		 */
-		if (!vm_page_count_severe() || (bp->b_vflags & BV_BKGRDINPROG)) {
+		if (!buf_vm_page_count_severe() || (bp->b_vflags & BV_BKGRDINPROG)) {
 			bp->b_qindex = QUEUE_CLEAN;
 			TAILQ_INSERT_TAIL(&bufqueues[QUEUE_CLEAN], bp,
 			    b_freelist);
@@ -1571,7 +1581,7 @@ vfs_vmio_release(struct buf *bp)
 				vm_page_free(m);
 			} else if (bp->b_flags & B_DIRECT) {
 				vm_page_try_to_free(m);
-			} else if (vm_page_count_severe()) {
+			} else if (buf_vm_page_count_severe()) {
 				vm_page_try_to_cache(m);
 			}
 		}

Added: head/sys/sys/fail.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/sys/fail.h	Wed May 27 16:36:54 2009	(r192908)
@@ -0,0 +1,260 @@
+/*-
+ * Copyright (c) 2009 Isilon Inc http://www.isilon.com/
+ *
+ * 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$
+ */
+/**
+ * @file
+ *
+ * Main header for failpoint facility.
+ */
+#ifndef _SYS_FAIL_H_
+#define _SYS_FAIL_H_
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+
+/**
+ * Failpoint types.
+ * Don't change these without changing fail_type_strings in fail.c.
+ * @ingroup failpoint_private
+ */
+enum fail_point_t {
+	FAIL_POINT_OFF,		/**< don't fail */
+	FAIL_POINT_PANIC,	/**< panic */
+	FAIL_POINT_RETURN,	/**< return an errorcode */
+	FAIL_POINT_BREAK,	/**< break into the debugger */
+	FAIL_POINT_PRINT,	/**< print a message */
+	FAIL_POINT_SLEEP,	/**< sleep for some msecs */
+	FAIL_POINT_INVALID,	/**< placeholder */
+};
+
+/**
+ * Failpoint return codes, used internally.
+ * @ingroup failpoint_private
+ */
+enum fail_point_return_code {
+	FAIL_POINT_RC_CONTINUE = 0,	/**< Continue with normal execution */
+	FAIL_POINT_RC_RETURN,		/**< FP evaluated to 'return' */
+	FAIL_POINT_RC_QUEUED,		/**< sleep_fn will be called */
+};
+
+TAILQ_HEAD(fail_point_entries, fail_point_entry);
+/**
+ * Internal failpoint structure, tracking all the current details of the
+ * failpoint.  This structure is the core component shared between the
+ * failure-injection code and the user-interface.
+ * @ingroup failpoint_private
+ */
+struct fail_point {
+	const char *fp_name;		/**< name of fail point */
+	const char *fp_location;	/**< file:line of fail point */
+	struct fail_point_entries fp_entries;	/**< list of entries */
+	int fp_flags;
+	void (*fp_sleep_fn)(void *);	/**< Function to call at end of
+					 * sleep for sleep failpoints */
+	void *fp_sleep_arg;		/**< Arg for sleep_fn */
+};
+
+#define	FAIL_POINT_DYNAMIC_NAME	0x01	/**< Must free name on destroy */
+
+/**
+ * Internal structure tracking a single term of a complete failpoint.
+ * @ingroup failpoint_private
+ */
+struct fail_point_entry {
+	enum fail_point_t fe_type;	/**< type of entry */
+	int		fe_arg;		/**< argument to type (e.g. return value) */
+	int		fe_prob;	/**< likelihood of firing in millionths */
+	int		fe_count;	/**< number of times to fire, 0 means always */
+
+	TAILQ_ENTRY(fail_point_entry) fe_entries; /**< next entry in fail point */
+};
+
+/* Private failpoint eval function -- use fail_point_eval() instead. */
+enum fail_point_return_code fail_point_eval_nontrivial(struct fail_point *,
+	int *ret);
+
+/**
+ * @addtogroup failpoint
+ * @{
+ */
+/*
+ * Initialize a fail-point.  The name is formed in printf-like fashion
+ * from "fmt" and the subsequent arguments.
+ * Pair with fail_point_destroy().
+ */
+void fail_point_init(struct fail_point *, const char *fmt, ...)
+    __printflike(2, 3);
+
+/**
+ * Set the sleep function for a fail point
+ * If sleep_fn is specified, then FAIL_POINT_SLEEP will result in a
+ * (*fp->sleep_fn)(fp->sleep_arg) call by the timer thread.  Otherwise,
+ * if sleep_fn is NULL (default), then FAIL_POINT_SLEEP will result in the
+ * fail_point_eval() call sleeping.
+ */
+static __inline void
+fail_point_sleep_set_func(struct fail_point *fp, void (*sleep_fn)(void *))
+{
+	fp->fp_sleep_fn = sleep_fn;
+}
+
+/**
+ * Set the argument for the sleep function for a fail point
+ */
+static __inline void
+fail_point_sleep_set_arg(struct fail_point *fp, void *sleep_arg)
+{
+	fp->fp_sleep_arg = sleep_arg;
+}
+
+/**
+ * Free the resources used by a fail-point.  Pair with fail_point_init().
+ */
+void fail_point_destroy(struct fail_point *);
+
+/**
+ * Evaluate a failpoint.
+ */
+static __inline enum fail_point_return_code

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 16:43:41 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EA4071065679;
	Wed, 27 May 2009 16:43:40 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CCF768FC08;
	Wed, 27 May 2009 16:43:40 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RGhe9K004189;
	Wed, 27 May 2009 16:43:40 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RGheA1004184;
	Wed, 27 May 2009 16:43:40 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200905271643.n4RGheA1004184@svn.freebsd.org>
From: Andrew Thompson 
Date: Wed, 27 May 2009 16:43:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192909 - in head/sys: conf
	modules/netgraph/bluetooth/ubt
	modules/netgraph/bluetooth/ubtbcmfw modules/usb
	netgraph/bluetooth/drivers/ubt
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 16:43:42 -0000

Author: thompsa
Date: Wed May 27 16:43:40 2009
New Revision: 192909
URL: http://svn.freebsd.org/changeset/base/192909

Log:
  Hook ubt and ubtbcmfw back up to the build.

Modified:
  head/sys/conf/files
  head/sys/modules/netgraph/bluetooth/ubt/Makefile
  head/sys/modules/netgraph/bluetooth/ubtbcmfw/Makefile
  head/sys/modules/usb/Makefile
  head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Wed May 27 16:36:54 2009	(r192908)
+++ head/sys/conf/files	Wed May 27 16:43:40 2009	(r192909)
@@ -1588,11 +1588,6 @@ dev/usb/serial/uvscom.c		optional uvscom
 dev/usb/serial/usb_serial.c 	optional ucom | \
 	(u3g | uark | ubsa | ubser | uchcom | ucycom | ufoma | uftdi | ugensa | uipaq | ulpt | umct | umodem | umoscom | uplcom | uslcom | uvisor | uvscom)
 #
-# USB bluetooth drivers
-#
-dev/usb/bluetooth/ng_ubt.c		optional netgraph_bluetooth_ubt usb
-dev/usb/bluetooth/ubtbcmfw.c		optional netgraph_bluetooth_ubtbcmfw usb
-#
 # USB misc drivers
 #
 dev/usb/misc/ufm.c		optional ufm
@@ -2205,6 +2200,8 @@ netgraph/atm/uni/ng_uni.c	optional ngatm
 netgraph/bluetooth/common/ng_bluetooth.c optional netgraph_bluetooth
 netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c optional netgraph_bluetooth_bt3c
 netgraph/bluetooth/drivers/h4/ng_h4.c optional netgraph_bluetooth_h4
+netgraph/bluetooth/drivers/ubt/ng_ubt.c optional netgraph_bluetooth_ubt usb
+netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c optional netgraph_bluetooth_ubtbcmfw usb
 netgraph/bluetooth/hci/ng_hci_cmds.c optional netgraph_bluetooth_hci
 netgraph/bluetooth/hci/ng_hci_evnt.c optional netgraph_bluetooth_hci
 netgraph/bluetooth/hci/ng_hci_main.c optional netgraph_bluetooth_hci

Modified: head/sys/modules/netgraph/bluetooth/ubt/Makefile
==============================================================================
--- head/sys/modules/netgraph/bluetooth/ubt/Makefile	Wed May 27 16:36:54 2009	(r192908)
+++ head/sys/modules/netgraph/bluetooth/ubt/Makefile	Wed May 27 16:43:40 2009	(r192909)
@@ -1,12 +1,13 @@
 # $Id: Makefile,v 1.2 2003/03/22 23:44:34 max Exp $
 # $FreeBSD$
 
-S=	${.CURDIR}/../../../..
+.PATH: ${.CURDIR}/../../../../netgraph/bluetooth/drivers/ubt
 
-.PATH: $S/dev/usb/bluetooth
+CFLAGS+=	-I${.CURDIR}/../../../../netgraph/bluetooth/include \
+		-I${.CURDIR}/../../../../netgraph/bluetooth/drivers/ubt
 
-KMOD=	ng_ubt
-SRCS=	opt_bus.h opt_usb.h device_if.h bus_if.h usb_if.h usbdevs.h \
-	ng_ubt.c
+KMOD=		ng_ubt
+SRCS=		ng_ubt.c opt_bus.h opt_usb.h device_if.h bus_if.h \
+		usb_if.h usbdevs.h
 
 .include 

Modified: head/sys/modules/netgraph/bluetooth/ubtbcmfw/Makefile
==============================================================================
--- head/sys/modules/netgraph/bluetooth/ubtbcmfw/Makefile	Wed May 27 16:36:54 2009	(r192908)
+++ head/sys/modules/netgraph/bluetooth/ubtbcmfw/Makefile	Wed May 27 16:43:40 2009	(r192909)
@@ -1,12 +1,13 @@
 # $Id: Makefile,v 1.1 2003/04/27 00:22:12 max Exp $
 # $FreeBSD$
 
-S=	${.CURDIR}/../../../..
+.PATH: ${.CURDIR}/../../../../netgraph/bluetooth/drivers/ubtbcmfw
 
-.PATH: $S/dev/usb/bluetooth
+CFLAGS+=	-I${.CURDIR}/../../../../netgraph/bluetooth/include \
+		-I${.CURDIR}/../../../../netgraph/bluetooth/drivers/ubtbcmfw
 
-KMOD=	ubtbcmfw
-SRCS=	opt_bus.h opt_usb.h device_if.h bus_if.h usb_if.h vnode_if.h usbdevs.h \
-	ubtbcmfw.c
+KMOD=		ubtbcmfw
+SRCS=		ubtbcmfw.c opt_bus.h opt_usb.h device_if.h bus_if.h \
+		usb_if.h vnode_if.h usbdevs.h
 
 .include 

Modified: head/sys/modules/usb/Makefile
==============================================================================
--- head/sys/modules/usb/Makefile	Wed May 27 16:36:54 2009	(r192908)
+++ head/sys/modules/usb/Makefile	Wed May 27 16:43:40 2009	(r192909)
@@ -26,7 +26,6 @@
 #
 
 SUBDIR = usb
-#SUBDIR += ubt bluetooth_ng ubtfw
 SUBDIR += ehci musb ohci uhci uss820dci ${_at91dci} ${_atmegadci}
 SUBDIR += rum uath upgt ural zyd
 SUBDIR += uhid ukbd ums udbp ufm

Modified: head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
==============================================================================
--- head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c	Wed May 27 16:36:54 2009	(r192908)
+++ head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c	Wed May 27 16:43:40 2009	(r192909)
@@ -117,8 +117,7 @@
 #include 
 #include 
 #include 
-
-#include 
+#include 
 
 static int		ubt_modevent(module_t, int, void *);
 static device_probe_t	ubt_probe;

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 16:44:44 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 23C1F1065716;
	Wed, 27 May 2009 16:44:44 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EBE668FC19;
	Wed, 27 May 2009 16:44:43 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RGih37004273;
	Wed, 27 May 2009 16:44:43 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RGihmY004272;
	Wed, 27 May 2009 16:44:43 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200905271644.n4RGihmY004272@svn.freebsd.org>
From: Andrew Thompson 
Date: Wed, 27 May 2009 16:44:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192910 - head/sys/dev/usb/bluetooth
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 16:44:44 -0000

Author: thompsa
Date: Wed May 27 16:44:43 2009
New Revision: 192910
URL: http://svn.freebsd.org/changeset/base/192910

Log:
  Remove empty dir.

Deleted:
  head/sys/dev/usb/bluetooth/

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 17:02:00 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 584591065672;
	Wed, 27 May 2009 17:02:00 +0000 (UTC) (envelope-from zml@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3BC698FC1D;
	Wed, 27 May 2009 17:02:00 +0000 (UTC) (envelope-from zml@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RH20ew004785;
	Wed, 27 May 2009 17:02:00 GMT (envelope-from zml@svn.freebsd.org)
Received: (from zml@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RH209s004783;
	Wed, 27 May 2009 17:02:00 GMT (envelope-from zml@svn.freebsd.org)
Message-Id: <200905271702.n4RH209s004783@svn.freebsd.org>
From: Zachary Loafman 
Date: Wed, 27 May 2009 17:02:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192911 - in head/lib/libc: include net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 17:02:01 -0000

Author: zml
Date: Wed May 27 17:01:59 2009
New Revision: 192911
URL: http://svn.freebsd.org/changeset/base/192911

Log:
  Fix an issue when nss fallback routines are used in a multithreaded application.
  
  Reviewed by:        bushman
  Approved by:        dfr (mentor)

Modified:
  head/lib/libc/include/nss_tls.h
  head/lib/libc/net/nsdispatch.c

Modified: head/lib/libc/include/nss_tls.h
==============================================================================
--- head/lib/libc/include/nss_tls.h	Wed May 27 16:44:43 2009	(r192910)
+++ head/lib/libc/include/nss_tls.h	Wed May 27 17:01:59 2009	(r192911)
@@ -67,6 +67,7 @@ name##_getstate(struct name##_state **p)
 	*p = calloc(1, sizeof(**p));				\
 	if (*p == NULL)						\
 		return (ENOMEM);				\
+	memset(*p, 0, sizeof(**p));				\
 	rv = _pthread_setspecific(name##_state_key, *p);	\
 	if (rv != 0) {						\
 		free(*p);					\

Modified: head/lib/libc/net/nsdispatch.c
==============================================================================
--- head/lib/libc/net/nsdispatch.c	Wed May 27 16:44:43 2009	(r192910)
+++ head/lib/libc/net/nsdispatch.c	Wed May 27 17:01:59 2009	(r192911)
@@ -80,12 +80,14 @@ __FBSDID("$FreeBSD$");
 #define _NS_PRIVATE
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include "un-namespace.h"
+#include "nss_tls.h"
 #include "libc_private.h"
 #ifdef NS_CACHING
 #include "nscache.h"
@@ -143,7 +145,11 @@ static	void			*nss_cache_cycle_preventio
  *     which in turn calls nsdispatch, which should call fallback
  *     function) are not supported
  */
-static	int			fallback_dispatch = 0;
+struct fb_state {
+	int	fb_dispatch;
+};
+static	void	fb_endstate(void *);
+NSS_TLS_HANDLING(fb);
 
 /*
  * Attempt to spew relatively uniform messages to syslog.
@@ -598,6 +604,11 @@ nss_method_lookup(const char *source, co
 	return (NULL);
 }
 
+static void
+fb_endstate(void *p)
+{
+	free(p);
+}
 
 __weak_reference(_nsdispatch, nsdispatch);
 
@@ -611,6 +622,7 @@ _nsdispatch(void *retval, const ns_dtab 
 	nss_method	 method, fb_method;
 	void		*mdata;
 	int		 isthreaded, serrno, i, result, srclistsize;
+	struct fb_state	*st;
 
 #ifdef NS_CACHING
 	nss_cache_data	 cache_data;
@@ -630,12 +642,19 @@ _nsdispatch(void *retval, const ns_dtab 
 			goto fin;
 		}
 	}
+
+	result = fb_getstate(&st);
+	if (result != 0) {
+		result = NS_UNAVAIL;
+		goto fin;
+	}
+
 	result = nss_configure();
 	if (result != 0) {
 		result = NS_UNAVAIL;
 		goto fin;
 	}
-	if (fallback_dispatch == 0) {
+	if (st->fb_dispatch == 0) {
 		dbt = vector_search(&database, _nsmap, _nsmapsize, sizeof(*_nsmap),
 		    string_compare);
 		fb_method = nss_method_lookup(NSSRC_FALLBACK, database,
@@ -702,12 +721,12 @@ _nsdispatch(void *retval, const ns_dtab 
 				break;
 		} else {
 			if (fb_method != NULL) {
-				fallback_dispatch = 1;
+				st->fb_dispatch = 1;
 				va_start(ap, defaults);
 				result = fb_method(retval,
 				    (void *)srclist[i].name, ap);
 				va_end(ap);
-				fallback_dispatch = 0;
+				st->fb_dispatch = 0;
 			} else
 				nss_log(LOG_DEBUG, "%s, %s, %s, not found, "
 				    "and no fallback provided",

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 17:02:10 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7BB21106574C;
	Wed, 27 May 2009 17:02:10 +0000 (UTC) (envelope-from zml@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 665278FC14;
	Wed, 27 May 2009 17:02:10 +0000 (UTC) (envelope-from zml@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RH2AL8004833;
	Wed, 27 May 2009 17:02:10 GMT (envelope-from zml@svn.freebsd.org)
Received: (from zml@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RH2A2O004832;
	Wed, 27 May 2009 17:02:10 GMT (envelope-from zml@svn.freebsd.org)
Message-Id: <200905271702.n4RH2A2O004832@svn.freebsd.org>
From: Zachary Loafman 
Date: Wed, 27 May 2009 17:02:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192912 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 17:02:12 -0000

Author: zml
Date: Wed May 27 17:02:10 2009
New Revision: 192912
URL: http://svn.freebsd.org/changeset/base/192912

Log:
  Correct handling of SYN packets that are to the left of the current window of an ESTABLISHED connection.
  
  Reviewed by:        net@, gnn
  Approved by:        dfr (mentor)

Modified:
  head/sys/netinet/tcp_input.c

Modified: head/sys/netinet/tcp_input.c
==============================================================================
--- head/sys/netinet/tcp_input.c	Wed May 27 17:01:59 2009	(r192911)
+++ head/sys/netinet/tcp_input.c	Wed May 27 17:02:10 2009	(r192912)
@@ -1818,7 +1818,11 @@ tcp_do_segment(struct mbuf *m, struct tc
 
 	todrop = tp->rcv_nxt - th->th_seq;
 	if (todrop > 0) {
-		if (thflags & TH_SYN) {
+		/*
+		 * If this is a duplicate SYN for our current connection,
+		 * advance over it and pretend and it's not a SYN.
+		 */
+		if (thflags & TH_SYN && th->th_seq == tp->irs) {
 			thflags &= ~TH_SYN;
 			th->th_seq++;
 			if (th->th_urp > 1)

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 17:02:16 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4CEFF1065697;
	Wed, 27 May 2009 17:02:16 +0000 (UTC) (envelope-from zml@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 140498FC18;
	Wed, 27 May 2009 17:02:16 +0000 (UTC) (envelope-from zml@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RH2Fqt004876;
	Wed, 27 May 2009 17:02:15 GMT (envelope-from zml@svn.freebsd.org)
Received: (from zml@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RH2FLo004874;
	Wed, 27 May 2009 17:02:15 GMT (envelope-from zml@svn.freebsd.org)
Message-Id: <200905271702.n4RH2FLo004874@svn.freebsd.org>
From: Zachary Loafman 
Date: Wed, 27 May 2009 17:02:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192913 - head/lib/libc/rpc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 17:02:20 -0000

Author: zml
Date: Wed May 27 17:02:15 2009
New Revision: 192913
URL: http://svn.freebsd.org/changeset/base/192913

Log:
  Handle UDP RPC replies correctly on a multi-homed system, in userland RPC. Corrects an issue with mountd replies to OS X.
  
  Approved by:        dfr (mentor)

Modified:
  head/lib/libc/rpc/svc_dg.c
  head/lib/libc/rpc/svc_generic.c

Modified: head/lib/libc/rpc/svc_dg.c
==============================================================================
--- head/lib/libc/rpc/svc_dg.c	Wed May 27 17:02:10 2009	(r192912)
+++ head/lib/libc/rpc/svc_dg.c	Wed May 27 17:02:15 2009	(r192913)
@@ -98,6 +98,7 @@ int svc_dg_enablecache(SVCXPRT *, u_int)
 static const char svc_dg_str[] = "svc_dg_create: %s";
 static const char svc_dg_err1[] = "could not get transport information";
 static const char svc_dg_err2[] = " transport does not support data transfer";
+static const char svc_dg_err3[] = "getsockname failed";
 static const char __no_mem_str[] = "out of memory";
 
 SVCXPRT *
@@ -146,8 +147,10 @@ svc_dg_create(fd, sendsize, recvsize)
 	xprt->xp_rtaddr.maxlen = sizeof (struct sockaddr_storage);
 
 	slen = sizeof ss;
-	if (_getsockname(fd, (struct sockaddr *)(void *)&ss, &slen) < 0)
-		goto freedata;
+	if (_getsockname(fd, (struct sockaddr *)(void *)&ss, &slen) < 0) {
+		warnx(svc_dg_str, svc_dg_err3);
+		goto freedata_nowarn;
+	}
 	xprt->xp_ltaddr.buf = mem_alloc(sizeof (struct sockaddr_storage));
 	xprt->xp_ltaddr.maxlen = sizeof (struct sockaddr_storage);
 	xprt->xp_ltaddr.len = slen;
@@ -157,6 +160,7 @@ svc_dg_create(fd, sendsize, recvsize)
 	return (xprt);
 freedata:
 	(void) warnx(svc_dg_str, __no_mem_str);
+freedata_nowarn:
 	if (xprt) {
 		if (su)
 			(void) mem_free(su, sizeof (*su));
@@ -173,6 +177,58 @@ svc_dg_stat(xprt)
 	return (XPRT_IDLE);
 }
 
+static int
+svc_dg_recvfrom(int fd, char *buf, int buflen,
+    struct sockaddr *raddr, socklen_t *raddrlen,
+    struct sockaddr *laddr, socklen_t *laddrlen)
+{
+	struct msghdr msg;
+	struct iovec msg_iov[1];
+	struct sockaddr_in *lin = (struct sockaddr_in *)laddr;
+	int rlen;
+	bool_t have_lin = FALSE;
+	char tmp[CMSG_LEN(sizeof(*lin))];
+	struct cmsghdr *cmsg;
+
+	memset((char *)&msg, 0, sizeof(msg));
+	msg_iov[0].iov_base = buf;
+	msg_iov[0].iov_len = buflen;
+	msg.msg_iov = msg_iov;
+	msg.msg_iovlen = 1;
+	msg.msg_namelen = *raddrlen;
+	msg.msg_name = (char *)raddr;
+	msg.msg_control = (caddr_t)tmp;
+	msg.msg_controllen = CMSG_LEN(sizeof(*lin));
+	rlen = _recvmsg(fd, &msg, 0);
+	if (rlen >= 0)
+		*raddrlen = msg.msg_namelen;
+
+	if (rlen == -1 || !laddr ||
+	    msg.msg_controllen < sizeof(struct cmsghdr) ||
+	    msg.msg_flags & MSG_CTRUNC)
+		return rlen;
+
+	for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL;
+	     cmsg = CMSG_NXTHDR(&msg, cmsg)){
+		if (cmsg->cmsg_level == IPPROTO_IP &&
+		    cmsg->cmsg_type == IP_RECVDSTADDR) {
+			have_lin = TRUE;
+			memcpy(&lin->sin_addr,
+			    (struct in_addr *)CMSG_DATA(cmsg), sizeof(struct in_addr));
+			break;
+		}
+	}
+
+	if (!have_lin)
+		return rlen;
+
+	lin->sin_family = AF_INET;
+	lin->sin_port = 0;
+	*laddrlen = sizeof(struct sockaddr_in);
+
+	return rlen;
+}
+
 static bool_t
 svc_dg_recv(xprt, msg)
 	SVCXPRT *xprt;
@@ -188,8 +244,9 @@ svc_dg_recv(xprt, msg)
 
 again:
 	alen = sizeof (struct sockaddr_storage);
-	rlen = _recvfrom(xprt->xp_fd, rpc_buffer(xprt), su->su_iosz, 0,
-	    (struct sockaddr *)(void *)&ss, &alen);
+	rlen = svc_dg_recvfrom(xprt->xp_fd, rpc_buffer(xprt), su->su_iosz,
+	    (struct sockaddr *)(void *)&ss, &alen,
+	    (struct sockaddr *)xprt->xp_ltaddr.buf, &xprt->xp_ltaddr.len);
 	if (rlen == -1 && errno == EINTR)
 		goto again;
 	if (rlen == -1 || (rlen < (ssize_t)(4 * sizeof (u_int32_t))))
@@ -223,6 +280,39 @@ again:
 	return (TRUE);
 }
 
+static int
+svc_dg_sendto(int fd, char *buf, int buflen,
+    const struct sockaddr *raddr, socklen_t raddrlen,
+    const struct sockaddr *laddr, socklen_t laddrlen)
+{
+	struct msghdr msg;
+	struct iovec msg_iov[1];
+	struct sockaddr_in *laddr_in = (struct sockaddr_in *)laddr;
+	struct in_addr *lin = &laddr_in->sin_addr;
+	char tmp[CMSG_SPACE(sizeof(*lin))];
+	struct cmsghdr *cmsg;
+
+	memset((char *)&msg, 0, sizeof(msg));
+	msg_iov[0].iov_base = buf;
+	msg_iov[0].iov_len = buflen;
+	msg.msg_iov = msg_iov;
+	msg.msg_iovlen = 1;
+	msg.msg_namelen = raddrlen;
+	msg.msg_name = (char *)raddr;
+
+	if (laddr->sa_family == AF_INET) {
+		msg.msg_control = (caddr_t)tmp;
+		msg.msg_controllen = CMSG_LEN(sizeof(*lin));
+		cmsg = CMSG_FIRSTHDR(&msg);
+		cmsg->cmsg_len = CMSG_LEN(sizeof(*lin));
+		cmsg->cmsg_level = IPPROTO_IP;
+		cmsg->cmsg_type = IP_SENDSRCADDR;
+		memcpy(CMSG_DATA(cmsg), lin, sizeof(*lin));
+	}
+
+	return _sendmsg(fd, &msg, 0);
+}
+
 static bool_t
 svc_dg_reply(xprt, msg)
 	SVCXPRT *xprt;
@@ -253,9 +343,11 @@ svc_dg_reply(xprt, msg)
 	}
 	if (stat) {
 		slen = XDR_GETPOS(xdrs);
-		if (_sendto(xprt->xp_fd, rpc_buffer(xprt), slen, 0,
+		if (svc_dg_sendto(xprt->xp_fd, rpc_buffer(xprt), slen,
 		    (struct sockaddr *)xprt->xp_rtaddr.buf,
-		    (socklen_t)xprt->xp_rtaddr.len) == (ssize_t) slen) {
+		    (socklen_t)xprt->xp_rtaddr.len,
+		    (struct sockaddr *)xprt->xp_ltaddr.buf,
+		    xprt->xp_ltaddr.len) == (ssize_t) slen) {
 			stat = TRUE;
 			if (su->su_cache)
 				cache_set(xprt, slen);

Modified: head/lib/libc/rpc/svc_generic.c
==============================================================================
--- head/lib/libc/rpc/svc_generic.c	Wed May 27 17:02:10 2009	(r192912)
+++ head/lib/libc/rpc/svc_generic.c	Wed May 27 17:02:15 2009	(r192913)
@@ -199,6 +199,7 @@ svc_tli_create(fd, nconf, bindaddr, send
 	struct __rpc_sockinfo si;
 	struct sockaddr_storage ss;
 	socklen_t slen;
+	static const uint32_t true_value = 1;
 
 	if (fd == RPC_ANYFD) {
 		if (nconf == NULL) {
@@ -225,6 +226,14 @@ svc_tli_create(fd, nconf, bindaddr, send
 		}
 	}
 
+	if (si.si_af == AF_INET && si.si_socktype == SOCK_DGRAM) {
+		if (_setsockopt(fd, IPPROTO_IP, IP_RECVDSTADDR,
+			        &true_value, sizeof(true_value))) {
+			warnx("svc_tli_create: cannot set IP_RECVDSTADDR");
+			return (NULL);
+		}
+	}
+
 	/*
 	 * If the fd is unbound, try to bind it.
 	 */

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 17:05:47 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8EE0A10656A9;
	Wed, 27 May 2009 17:05:47 +0000 (UTC)
	(envelope-from minimarmot@gmail.com)
Received: from mail-bw0-f213.google.com (mail-bw0-f213.google.com
	[209.85.218.213])
	by mx1.freebsd.org (Postfix) with ESMTP id 443DC8FC2C;
	Wed, 27 May 2009 17:05:45 +0000 (UTC)
	(envelope-from minimarmot@gmail.com)
Received: by bwz9 with SMTP id 9so4893344bwz.43
	for ; Wed, 27 May 2009 10:05:45 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:received:in-reply-to:references
	:date:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	bh=drpRuGlKDkXWE+fBEhJEa9qKwG63cDZcl/afVqtaTFQ=;
	b=cMhaTr06M73qwKXM9Getljd/qGqxS1+k63hfbGbKP4GSydFnPim1p6NTeEJyw4faCA
	JnZC5p0TRNCSPORpgjJXrK/BIwUhwue3zQWmBzQE4RLmTa47kSITIYVMJ95xY88X+5ec
	qNWiT057c48XlOAPKXYXllMUYprGlXYyqvT38=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type:content-transfer-encoding;
	b=MeXg9vcp5sXiXgI5WjCXpr/D77NIxD69syGP84IIJRsrqZ1wPpjTkB9gDnRKFLXkTu
	CZX1Lrr5nPKKQj2GBU3yqj2jH7AYxV6F4FqrHJZo3OP+phsVVM4z30AU6BncTZs/NP09
	5kVwdWbWAE7WQf3ql+lt+nsryiKCkC2jAa9jU=
MIME-Version: 1.0
Received: by 10.223.113.9 with SMTP id y9mr236448fap.61.1243443944782; Wed, 27 
	May 2009 10:05:44 -0700 (PDT)
In-Reply-To: <200905271636.n4RGasNe003922@svn.freebsd.org>
References: <200905271636.n4RGasNe003922@svn.freebsd.org>
Date: Wed, 27 May 2009 13:05:44 -0400
Message-ID: <47d0403c0905271005t7f57f9b9h3d0721bbb1fbedc2@mail.gmail.com>
From: Ben Kaduk 
To: Zachary Loafman 
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r192908 - in head: share/man/man9 sys/conf sys/kern
	sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 17:05:48 -0000

On Wed, May 27, 2009 at 12:36 PM, Zachary Loafman  wrote:
> Author: zml
> Date: Wed May 27 16:36:54 2009
> New Revision: 192908
> URL: http://svn.freebsd.org/changeset/base/192908
>
> Log:
>  fail(9) support:
>
>  Add support for kernel fault injection using KFAIL_POINT_* macros and
>  fail_point_* infrastructure. Add example fail point in vfs_bio.c to
>  simulate VM buf pressure.

Very cool!  A few (doc and grammar) style points below.


>
>  Approved by:        dfr (mentor)
>
> Added:
>  head/share/man/man9/fail.9   (contents, props changed)
>  head/sys/kern/kern_fail.c   (contents, props changed)
>  head/sys/sys/fail.h   (contents, props changed)
> Modified:
>  head/share/man/man9/Makefile
>  head/sys/conf/files
>  head/sys/kern/vfs_bio.c
>  head/sys/sys/queue.h
>
> Modified: head/share/man/man9/Makefile
> ==============================================================================
> --- head/share/man/man9/Makefile        Wed May 27 16:34:08 2009        (r192907)
> +++ head/share/man/man9/Makefile        Wed May 27 16:36:54 2009        (r192908)
> @@ -99,6 +99,7 @@ MAN=  accept_filter.9 \
>        DRIVER_MODULE.9 \
>        EVENTHANDLER.9 \
>        extattr.9 \
> +       fail.9 \
>        fetch.9 \
>        firmware.9 \
>        g_access.9 \
>
> Added: head/share/man/man9/fail.9
> ==============================================================================
> --- /dev/null   00:00:00 1970   (empty, because file is newly added)
> +++ head/share/man/man9/fail.9  Wed May 27 16:36:54 2009        (r192908)
> @@ -0,0 +1,197 @@
> +.\"
> +.\" Copyright (c) 2009 Isilon Inc http://www.isilon.com/
> +.\"
> +.\" 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(s), this list of conditions and the following disclaimer as
> +.\"    the first lines of this file unmodified other than the possible
> +.\"    addition of one or more copyright notices.
> +.\" 2. Redistributions in binary form must reproduce the above copyright
> +.\"    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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 May 10, 2009
> +.Dt FAIL 9
> +.Os
> +.Sh NAME
> +.Nm KFAIL_POINT_CODE ,
> +.Nm KFAIL_POINT_RETURN ,
> +.Nm KFAIL_POINT_RETURN_VOID ,
> +.Nm KFAIL_POINT_ERROR ,
> +.Nm KFAIL_POINT_GOTO ,
> +.Nm fail_point ,
> +.Nm DEBUG_FP
> +.
> +.Nd fail points
> +.Sh SYNOPSIS
> +.In sys/fail.h
> +.Fn KFAIL_POINT_CODE "parent" "name" "code"
> +.Fn KFAIL_POINT_RETURN "parent" "name"
> +.Fn KFAIL_POINT_RETURN_VOID "parent" "name"
> +.Fn KFAIL_POINT_ERROR "parent" "name" "error_var"
> +.Fn KFAIL_POINT_GOTO "parent" "name" "error_var" "label"
> +.Sh DESCRIPTION
> +Fail points are used to add code points where errors may be injected
> +in a user controlled fashion. Fail points provide a convenient wrapper
> +around user provided error injection code, providing a

The pedant in me would prefer the hyphenated "user-provided"


> +.Xr sysctl 9 MIB , and a parser for that MIB that describes how the error

I think it is traditional to put the macro and its arguments on its own
line, starting a new one for the rest of the text.

> +injection code should fire.
> +.Pp
> +The base fail point macro is
> +.Fn KFAIL_POINT_CODE
> +where
> +.Fa parent
> +is a sysctl tree (frequently
> +.Sy DEBUG_FP
> +for kernel fail points, but various subsystems may wish to provide
> +their own fail point trees), and
> +.Fa name
> +is the name of the MIB in that tree, and
> +.Fa code
> +is the error injection code. The

Our man page style says that new sentences should start on new lines.
(Since the '.' character is used for defining macros, and sometimes
the processor can get confused.)

> +.Fa code
> +argument does not require braces, but it is considered good style to
> +use braces for any multi-line code arguments. Inside the

Likewise here.

> +.Fa code
> +argument, the evaluation of
> +.Sy RETURN_VALUE
> +is derived from the
> +.Fn return
> +value set in the sysctl MIB. See

And here.

> +.Sx SYSCTL SETTINGS
> +below.
> +.Pp
> +The remaining
> +.Fn KFAIL_POINT_*
> +macros are wrappers around common error injection paths:
> +.Bl -tag -width 8
> +.It Fn KFAIL_POINT_RETURN parent name
> +is the equivalent of
> +.Sy KFAIL_POINT_CODE(..., return RETURN_VALUE)
> +.It Fn KFAIL_POINT_RETURN_VOID parent name
> +is the equivalent of
> +.Sy KFAIL_POINT_CODE(..., return)
> +.It Fn KFAIL_POINT_ERROR parent name error_var
> +is the equivalent of
> +.Sy KFAIL_POINT_CODE(..., error_var = RETURN_VALUE)
> +.It Fn KFAIL_POINT_GOTO parent name error_var label
> +is the equivalent of
> +.Sy KFAIL_POINT_CODE(...,
> +  { error_var = RETURN_VALUE; goto label;})
> +.El
> +.Pp
> +.Sh SYSCTL VARIABLES
> +The
> +.Fn KFAIL_POINT_*
> +macros add sysctl MIBs where specified. Many base kernel MIBs can be

Ditto.

> +found in the
> +.Sy debug.fail_point
> +tree (referenced in code by
> +.Sy DEBUG_FP
> +).
> +.Pp
> +The sysctl setting recognizes the following grammar:

I'm not entirely sure that I understand this sentence correctly.
The following is describing the ways that I can set the sysctl
variable and have it do something useful, right?  It might be
better to s/setting/variable/ .


> +.Pp
> +   ::
> +       ( "->"  )*
> +.Pp
> +   ::
> +      ( ( "%") | ( "*" ) )*
> +      
> +      [ "("  ")" ]
> +.Pp
> +   ::
> +       [ "."  ] |
> +      "." 
> +.Pp
> +   ::
> +      "off" | "return" | "sleep" | "panic" | "break" | "print"
> +.Pp
> +The 
> +argument specifies which action to take:
> +.Bl -tag -width ".Dv return"
> +.It Sy off
> +Take no action (does not trigger fail point code)
> +.It Sy return
> +Trigger fail point code with specified argument
> +.It Sy sleep
> +Sleep the specified number of milliseconds
> +.It Sy panic
> +Panic
> +.It Sy break
> +Break into the debugger.

What happens if there is no debugger support compiled into the kernel?


> +.It Sy print
> +Print that the fail point executed
> +.El
> +.Pp
> +The % and * modifiers prior to  control when
> + is executed. The % form (e.g. "1.2%") can be used to
> +specify a probability that  will execute. The * form
> +(e.g. "5*") can be used to specify the number of times  should
> +be executed before this  is disabled. Only the last probability
> +and the last count are used if multiple are specified, i.e. "1.2%2%"
> +is the same as "2%". When both a probability and a count are
> +specified, the probability is evaluated before the count, i.e. "2%5*"
> +means "2% of the time, but only execute it 5 times total".

There is a disparity in these two clauses.  I think:
"2% of the time, but only 5 times total".
would be better.

> +.Pp
> +The operator -> can be used to express cascading terms. If you specify
> +->, it means that if  doesn't 'execute', 
> +is evaluated. For the purpose of this operator, the return() and
> +print() operators are the only types that cascade. A return() term
> +only cascades if the code executes, and a print() term only cascades
> +when passed a non-zero argument.

Quite a few new sentences here; new lines for all

> +.Pp
> +.Sh EXAMPLES
> +.Bl -tag
> +.It Sy sysctl debug.fail_point.foobar="2.1%return(5)"
> +21/1000ths of the time, execute
> +.Fa code
> +with RETURN_VALUE set to 5.
> +.It Sy sysctl debug.fail_point.foobar="2%return(5)->5%return(22)"
> +2/100th of the time, execute
> +.Fa code
> +with RETURN_VALUE set to 5. If that doesn't happen, 5% of the time

And here.

> +execute
> +.Fa code
> +with RETURN_VALUE set to 22.
> +.It Sy sysctl debug.fail_point.foobar="5*return(5)->0.1%return(22)"
> +For 5 times, return 5. After that, 1/1000ths of the time, return 22.

ditto.  I guess 1/1000th is singular, too.

> +.It Sy sysctl debug.fail_point.foobar="0.1%5*return(5)"
> +Return 5 for 1 in 1000 executions, but only execute 5 times total.
> +.It Sy sysctl debug.fail_point.foobar="1%*sleep(50)"
> +1/100ths of the time, sleep 50ms.
> +.El
> +.Pp
> +.Sh CAVEATS
> +It's easy to shoot yourself in the foot by setting fail points too
> +aggressively or setting too many in combination. For example, forcing

new sentence, new line

> +.Fn malloc
> +to fail consistently is potentially harmful to uptime.
> +.Pp
> +The
> +.Fn sleep
> +sysctl setting may not be appropriate in all situations. Currently,

ditto

> +.Fn fail_point_eval
> +does not verify whether the context is appropriate for calling
> +.Fn msleep .
> +.Pp
> +.Sh AUTHORS
> +.An -nosplit
> +This manual page was written by
> +.An Zach Loafman Aq zml@FreeBSD.org .
>


Many thanks for getting this into the tree!

-Ben Kaduk

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 17:27:04 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 662AD1065785;
	Wed, 27 May 2009 17:27:04 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3A86A8FC1E;
	Wed, 27 May 2009 17:27:04 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RHR4o8005598;
	Wed, 27 May 2009 17:27:04 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RHR3qm005592;
	Wed, 27 May 2009 17:27:03 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200905271727.n4RHR3qm005592@svn.freebsd.org>
From: Ed Schouten 
Date: Wed, 27 May 2009 17:27:03 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192914 - in head: contrib/ee usr.bin/ee
	usr.bin/ee/nls/de_DE.ISO8859-1 usr.bin/ee/nls/fr_FR.ISO8859-1
	usr.bin/ee/nls/pl_PL.ISO8859-2 usr.bin/ee/nls/ru_RU.KOI8-R
	usr.bin/ee/nls/uk_UA.KO...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 17:27:05 -0000

Author: ed
Date: Wed May 27 17:27:03 2009
New Revision: 192914
URL: http://svn.freebsd.org/changeset/base/192914

Log:
  Update ee(1) in the base system to version 1.5.0.
  
  This version is now licensed under a 2-clause BSD license, instead of
  the Artistic license. I've reverted a lot of local modifications we made
  to ee, because they have been integrated upstream as well.
  
  Only local modifications include:
  
  - $FreeBSD$ ID.
  - Pathname to init.ee.
  - catopen() call, to honor LC_MESSAGES instead of LANG.
  
  To keep SVN happy, I'm putting an application/octet-stream mime type on
  the KOI8 translations.
  
  Reviewed by:	current@

Added:
  head/contrib/ee/Changes
     - copied unchanged from r192856, vendor/ee/dist/Changes
  head/contrib/ee/ee_version.h
     - copied unchanged from r192856, vendor/ee/dist/ee_version.h
Deleted:
  head/contrib/ee/Artistic
Modified:
  head/contrib/ee/   (props changed)
  head/contrib/ee/README.ee
  head/contrib/ee/create.make
  head/contrib/ee/ee.1
  head/contrib/ee/ee.c
  head/contrib/ee/ee.msg
  head/contrib/ee/new_curse.c
  head/usr.bin/ee/Makefile
  head/usr.bin/ee/nls/de_DE.ISO8859-1/ee.msg
  head/usr.bin/ee/nls/fr_FR.ISO8859-1/ee.msg
  head/usr.bin/ee/nls/pl_PL.ISO8859-2/ee.msg
  head/usr.bin/ee/nls/ru_RU.KOI8-R/ee.msg   (contents, props changed)
  head/usr.bin/ee/nls/uk_UA.KOI8-U/ee.msg   (contents, props changed)

Copied: head/contrib/ee/Changes (from r192856, vendor/ee/dist/Changes)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/contrib/ee/Changes	Wed May 27 17:27:03 2009	(r192914, copy of r192856, vendor/ee/dist/Changes)
@@ -0,0 +1,40 @@
+version 1.5.0 (2/16/2009)
+- added display of line number, column, and lines from top to separator line 
+  for info window
+- minor changes to reduce number of warnings when using -pedantic option
+
+version 1.4.7 (2/10/2009)
+- changed how strings are terminated from the old usage of NULL to the current 
+  use of character zero, '\0'
+- changed the licensing since the Artistic License is now considered 
+  restrictive
+
+version 1.4.6
+- modified new_curse.c to handle different subdirectory naming in terminfo 
+  directory; first noted on Mac OS 10.2
+
+version 1.4.5a (12/23/2001)
+- modified get_options to be cleaner for arg handling
+
+version 1.4.5 (12/15/2001)
+- made changes to check usage of arguments provided so that if a file is
+  specified options are no longer accepted (that is, they are treated as file
+  names)
+- changed to use ee_version.h to allow changing version number without need
+  to change ee.c directly
+
+version 1.4.4 (8/17/2001)
+- added code to check if the parent process has died, and if so to exit 
+  gracefully
+
+version 1.4.3 (6/25/2001)
+- modified create.make and new_curse.c to allow defining TERMCAP file 
+  location (since some distributions move the file)
+- source directory now has version number attached to directory name
+
+version 1.4.2 (1/19/2001)
+- change to create.make script to add unistd.h to files to search for 
+  select() declaration
+- change to new_curse.c for proper raw mode operation
+
+

Modified: head/contrib/ee/README.ee
==============================================================================
--- head/contrib/ee/README.ee	Wed May 27 17:02:15 2009	(r192913)
+++ head/contrib/ee/README.ee	Wed May 27 17:27:03 2009	(r192914)
@@ -1,26 +1,29 @@
-          THIS MATERIAL IS PROVIDED "AS IS".  THERE ARE NO WARRANTIES OF 
-          ANY KIND WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT 
-          LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 
-          FITNESS FOR A PARTICULAR PURPOSE.  Neither Hewlett-Packard nor 
-          Hugh Mahon shall be liable for errors contained herein, nor for 
-          incidental or consequential damages in connection with the 
-          furnishing, performance or use of this material.  Neither 
-          Hewlett-Packard nor Hugh Mahon assumes any responsibility for 
-          the use or reliability of this software or documentation.  This 
-          software and documentation is totally UNSUPPORTED.  There is no 
-          support contract available.  Hewlett-Packard has done NO 
-          Quality Assurance on ANY of the program or documentation.  You 
-          may find the quality of the materials inferior to supported 
-          materials. 
+Copyright (c) 2009, Hugh Mahon
+All rights reserved.
 
-      This software may be distributed under the terms of Larry Wall's 
-      Artistic license, a copy of which is included in this distribution. 
-
-      This notice must be included with this software and any 
-      derivatives. 
-
-      Any modifications to this software by anyone but the original author 
-      must be so noted. 
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * 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 COPYRIGHT HOLDERS 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
+COPYRIGHT OWNER 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.
 
 
 The editor 'ee' (easy editor) is intended to be a simple, easy to use 
@@ -51,7 +54,7 @@ completely replaced by graphical user in
 years, I'd like to do what I can to make using computers with less 
 glamorous interfaces as easy to use as possible.  If terminal interfaces 
 are still used in ten years, I hope neophytes won't still be stuck with 
-only vi.  
+only vi.
 
 For a text editor to be easy to use requires a certain set of abilities.  In 
 order for ee to work, a terminal must have the ability to position the cursor 
@@ -110,7 +113,7 @@ are: 
            people.
 
 Hugh Mahon              |___|     
-h_mahon@fc.hp.com       |   |     
+hugh4242@yahoo.com      |   |     
                             |\  /|
                             | \/ |
 

Modified: head/contrib/ee/create.make
==============================================================================
--- head/contrib/ee/create.make	Wed May 27 17:02:15 2009	(r192913)
+++ head/contrib/ee/create.make	Wed May 27 17:27:03 2009	(r192914)
@@ -4,14 +4,27 @@
 #	This script will determine if the system is a System V or BSD based
 #	UNIX system and create a makefile for ee appropriate for the system.
 #
-# $Header: /home/hugh/sources/old_ae/RCS/create.make,v 1.7 2001/01/20 04:57:17 hugh Exp hugh $
+# $Header: /home/hugh/sources/old_ae/RCS/create.make,v 1.13 2002/09/23 04:18:13 hugh Exp $
 #
 
+#set -x
+
+name_string="`uname`"
+
 # test for existence of termcap (exists on both BSD and SysV systems)
 
 if [ -f /etc/termcap -o -f /usr/share/lib/termcap -o -f /usr/share/misc/termcap ]
 then
-	termcap_exists="TRUE"
+	if [ -f /usr/share/lib/termcap ]
+	then
+		termcap_exists="-DTERMCAP=\"\\\"/usr/share/lib/termcap\\\"\""
+	elif [ -f /usr/share/misc/termcap ]
+	then
+		termcap_exists="-DTERMCAP=\"\\\"/usr/share/misc/termcap\\\"\""
+	elif [ -f /etc/termcap ]
+	then
+		termcap_exists="-DTERMCAP=\"\\\"/etc/termcap\\\"\""
+	fi
 else
 	termcap_exists=""
 fi
@@ -212,16 +225,27 @@ else
 fi
 
 
-if [ -n "$CFLAGS" ]
+if [ "$name_string" = "Darwin" ]
 then
-	if [ -z "`echo $CFLAGS | grep '[-]g'`" ]
+	if [ -n "$CFLAGS" ]
 	then
-		other_cflags="${CFLAGS} -s"
+		other_cflags="${CFLAGS} -DNO_CATGETS"
 	else
-		other_cflags="${CFLAGS}"
+		other_cflags="-DNO_CATGETS"
 	fi
 else
-	other_cflags="-s"
+
+	if [ -n "$CFLAGS" ]
+	then
+		if [ -z "`echo $CFLAGS | grep '[-]g'`" ]
+		then
+			other_cflags="${CFLAGS} -s"
+		else
+			other_cflags="${CFLAGS}"
+		fi
+	else
+		other_cflags="-s"
+	fi
 fi
 
 # time to write the makefile
@@ -235,7 +259,7 @@ fi
 
 echo "DEFINES =	$termio $terminfo_exists $BSD_SELECT $catgets $select $curses " > make.local
 echo "" >> make.local
-echo "CFLAGS =	$HAS_UNISTD $HAS_STDARG $HAS_STDLIB $HAS_CTYPE $HAS_SYS_IOCTL $HAS_SYS_WAIT $five_lib $five_include $select_hdr $other_cflags" >> make.local
+echo "CFLAGS =	$HAS_UNISTD $HAS_STDARG $HAS_STDLIB $HAS_CTYPE $HAS_SYS_IOCTL $HAS_SYS_WAIT $five_lib $five_include $select_hdr $other_cflags $termcap_exists" >> make.local
 echo "" >> make.local
 echo "" >> make.local
 echo "all :	$TARGET" >> make.local

Modified: head/contrib/ee/ee.1
==============================================================================
--- head/contrib/ee/ee.1	Wed May 27 17:02:15 2009	(r192913)
+++ head/contrib/ee/ee.1	Wed May 27 17:27:03 2009	(r192914)
@@ -4,7 +4,7 @@
 .\"
 .\"    nroff -man ee.1
 .\"
-.\"  $Header: /home/hugh/sources/old_ae/RCS/ee.1,v 1.19 1995/11/29 04:03:15 hugh Exp hugh $
+.\"  $Header: /home/hugh/sources/old_ae/RCS/ee.1,v 1.22 2001/12/16 04:49:27 hugh Exp $
 .\"
 .\"
 .TH ee 1 "" "" "" ""
@@ -29,6 +29,10 @@ is the same as 
 but restricted to editing the named 
 file (no file operations, or shell escapes are allowed).
 .PP
+An editor with similar user-friendly qualities but more features is available 
+and is called 
+.I aee.
+.PP
 For 
 .I ee
 to work properly, the environment variable 
@@ -402,7 +406,7 @@ cursor location.  The old information wo
 .PP
 Since different users have different preferences, \fIee\fR allows some 
 slight configurability.  There are three possible locations for an 
-initialization file for ee:  the file \fI/usr/local/lib/init.ee\fR, the 
+initialization file for ee:  the file \fI/usr/share/misc/init.ee\fR, the 
 file \fI.init.ee\fR in the user's home directory, or the file \fI.init.ee\fR 
 in the current directory (if different from the home 
 directory).  This allows system administrators to set some preferences for 
@@ -410,7 +414,7 @@ the users on a system-wide basis (for ex
 and the user to customize settings for particular directories (like one 
 for correspondence, and a different directory for programming).
 .PP
-The file \fI\/usr/local/lib/init.ee\fR is read first, then 
+The file \fI\/usr/share/misc/init.ee\fR is read first, then 
 \fI$HOME/.init.ee\fR, then \fI.init.ee\fR, with the settings specified by the 
 most recent file read taking precedence.
 .PP
@@ -517,7 +521,7 @@ The automatic paragraph formatting opera
 may be too slow for slower systems.
 .SH FILES
 .PP
-.I /usr/local/lib/init.ee
+.I /usr/share/misc/init.ee
 .br
 .I $HOME/.init.ee
 .br
@@ -532,8 +536,8 @@ This software and documentation contains
 proprietary information which is protected by 
 copyright.  All rights are reserved. 
 .PP
-Copyright (c) 1990, 1991, 1992, 1993, 1995, 1996 Hugh Mahon.
+Copyright (c) 1990, 1991, 1992, 1993, 1995, 1996, 2001 Hugh Mahon.
 .SH "SEE ALSO"
 .PP
-termcap(4), terminfo(4), environ(5), spell(1), ispell(1), lp(1)
+termcap(4), terminfo(4), environ(5), spell(1), ispell(1), lp(1), aee(1)
 

Modified: head/contrib/ee/ee.c
==============================================================================
--- head/contrib/ee/ee.c	Wed May 27 17:02:15 2009	(r192913)
+++ head/contrib/ee/ee.c	Wed May 27 17:27:03 2009	(r192914)
@@ -5,34 +5,35 @@
  |
  |	written by Hugh Mahon
  |
- |	THIS MATERIAL IS PROVIDED "AS IS".  THERE ARE
- |	NO WARRANTIES OF ANY KIND WITH REGARD TO THIS
- |	MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE
- |	IMPLIED WARRANTIES OF MERCHANTABILITY AND
- |	FITNESS FOR A PARTICULAR PURPOSE.  Neither
- |	Hewlett-Packard nor Hugh Mahon shall be liable
- |	for errors contained herein, nor for
- |	incidental or consequential damages in
- |	connection with the furnishing, performance or
- |	use of this material.  Neither Hewlett-Packard
- |	nor Hugh Mahon assumes any responsibility for
- |	the use or reliability of this software or
- |	documentation.  This software and
- |	documentation is totally UNSUPPORTED.  There
- |	is no support contract available.  Hewlett-
- |	Packard has done NO Quality Assurance on ANY
- |	of the program or documentation.  You may find
- |	the quality of the materials inferior to
- |	supported materials.
  |
- |	This software is not a product of Hewlett-Packard, Co., or any 
- |	other company.  No support is implied or offered with this software.
- |	You've got the source, and you're on your own.
+ |      Copyright (c) 2009, Hugh Mahon
+ |      All rights reserved.
+ |      
+ |      Redistribution and use in source and binary forms, with or without
+ |      modification, are permitted provided that the following conditions
+ |      are met:
+ |      
+ |          * Redistributions of source code must retain the above copyright
+ |            notice, this list of conditions and the following disclaimer.
+ |          * 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 COPYRIGHT HOLDERS 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
+ |      COPYRIGHT OWNER 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 software may be distributed under the terms of Larry Wall's 
- |	Artistic license, a copy of which is included in this distribution. 
- |
- |	This notice must be included with this software and any derivatives.
+ |     -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  |
  |	This editor was purposely developed to be simple, both in 
  |	interface and implementation.  This editor was developed to 
@@ -49,7 +50,7 @@
  |	proprietary information which is protected by
  |	copyright.  All rights are reserved.
  |
- |	$Header: /home/hugh/sources/old_ae/RCS/ee.c,v 1.96 1998/07/14 05:02:30 hugh Exp $
+ |	$Header: /home/hugh/sources/old_ae/RCS/ee.c,v 1.102 2009/02/17 03:22:50 hugh Exp hugh $
  |
  */
 
@@ -57,15 +58,11 @@
 __FBSDID("$FreeBSD$");
 
 char *ee_copyright_message = 
-"Copyright (c) 1986, 1990, 1991, 1992, 1993, 1994, 1995, 1996 Hugh Mahon ";
+"Copyright (c) 1986, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2009 Hugh Mahon ";
 
-char *ee_long_notice[] = {
-	"This software and documentation contains", 
-	"proprietary information which is protected by", 
-	"copyright.  All rights are reserved."
-	};
+#include "ee_version.h"
 
-char *version = "@(#) ee, version 1.4.1  $Revision: 1.96 $";
+char *version = "@(#) ee, version "  EE_VERSION  " $Revision: 1.102 $";
 
 #ifdef NCURSE
 #include "new_curse.h"
@@ -78,28 +75,32 @@ char *version = "@(#) ee, version 1.4.1 
 #ifdef HAS_CTYPE
 #include 
 #endif
-#include 
-#include 
-#include 
-#include 
-#include 
+
 #include 
+#include 
 #include 
 #include 
+#include 
+#include 
+#include 
+
 #ifdef HAS_SYS_WAIT
 #include 
 #endif
-#ifdef HAS_STDARG
-#include 
-#endif
+
 #ifdef HAS_STDLIB
 #include 
 #endif
-#include 
+
+#ifdef HAS_STDARG
+#include 
+#endif
+
 #ifdef HAS_UNISTD
 #include 
 #endif
 
+
 #ifndef NO_CATGETS
 #include 
 #include 
@@ -151,6 +152,7 @@ int position;			/* offset in bytes from 
 int scr_pos;			/* horizontal position			*/
 int scr_vert;			/* vertical position on screen		*/
 int scr_horz;			/* horizontal position on screen	*/
+int absolute_lin;		/* number of lines from top		*/
 int tmp_vert, tmp_horz;
 int input_file;			/* indicate to read input file		*/
 int recv_file;			/* indicate reading a file		*/
@@ -203,11 +205,8 @@ unsigned char *d_char;		/* deleted chara
 unsigned char *d_word;		/* deleted word				*/
 unsigned char *d_line;		/* deleted line				*/
 char in_string[513];	/* buffer for reading a file		*/
-unsigned char *print_command = "lpr";	/* string to use for the print command 	*/
+unsigned char *print_command = (unsigned char *)"lpr";	/* string to use for the print command 	*/
 unsigned char *start_at_line = NULL;	/* move to this line at start of session*/
-const char count_text_default[] = "===============================================================================";
-int count_text_len = sizeof(count_text_default);	/* length of the line above	*/
-char count_text[sizeof(count_text_default)];	/* buffer for current position display	*/
 int in;				/* input character			*/
 
 FILE *temp_fp;			/* temporary file pointer		*/
@@ -223,7 +222,6 @@ WINDOW *com_win;
 WINDOW *text_win;
 WINDOW *help_win;
 WINDOW *info_win;
-WINDOW *count_win;
 
 #if defined(__STDC__) || defined(__cplusplus)
 #define P_(s) s
@@ -344,7 +342,6 @@ char *is_in_string P_((char *string, cha
 char *resolve_name P_((char *name));
 int restrict_mode P_((void));
 int unique_test P_((char *string, char *list[]));
-void renumber_lines P_((struct text *firstline, int startnumber));
 void strings_init P_((void));
 
 #undef P_
@@ -538,29 +535,35 @@ char *ree_no_file_msg;
 char *cancel_string;
 char *menu_too_lrg_msg;
 char *more_above_str, *more_below_str;
+char *separator = "===============================================================================";
 
 char *chinese_cmd, *nochinese_cmd;
 
+#ifndef __STDC__
+#ifndef HAS_STDLIB
+extern char *malloc();
+extern char *realloc();
+extern char *getenv();
+FILE *fopen();			/* declaration for open function	*/
+#endif /* HAS_STDLIB */
+#endif /* __STDC__ */
 
 int
 main(argc, argv)		/* beginning of main program		*/
 int argc;
 char *argv[];
 {
-	/* Always read from (and write to) a terminal. */
-	if (!isatty(STDIN_FILENO) || !isatty(STDOUT_FILENO)) {
-		fprintf(stderr, "ee's standard input and output must be a terminal\n");
-		exit(1);
-	}
+	int counter;
+
+	for (counter = 1; counter < 24; counter++)
+		signal(counter, SIG_IGN);
 
 	signal(SIGCHLD, SIG_DFL);
 	signal(SIGSEGV, SIG_DFL);
 	signal(SIGINT, edit_abort);
-	signal(SIGHUP, edit_abort);
-
 	d_char = malloc(3);	/* provide a buffer for multi-byte chars */
 	d_word = malloc(150);
-	*d_word = (char) NULL;
+	*d_word = '\0';
 	d_line = NULL;
 	dlt_line = txtalloc();
 	dlt_line->line = d_line;
@@ -578,7 +581,8 @@ char *argv[];
 	scr_pos =0;
 	scr_vert = 0;
 	scr_horz = 0;
-	bit_bucket = fopen(_PATH_DEVNULL, "w");
+	absolute_lin = 1;
+	bit_bucket = fopen("/dev/null", "w");
 	edit = TRUE;
 	gold = case_sen = FALSE;
 	shell_fork = TRUE;
@@ -607,25 +611,32 @@ char *argv[];
 
 	clear_com_win = TRUE;
 
+	counter = 0;
+
 	while(edit) 
 	{
+		/*
+		 |  display line and column information
+		 */
 		if (info_window)
 		{
-			snprintf(count_text, count_text_len, "L: %d C: %d %s", \
-				curr_line->line_number, scr_horz + 1, count_text_default);
-			wmove(count_win, 0, 0);
 			if (!nohighlight)
-				wstandout(count_win);
-			wprintw(count_win, count_text);
-			wstandend(count_win);
-			wnoutrefresh(count_win);
+				wstandout(info_win);
+			wmove(info_win, 5, 0);
+			wprintw(info_win, separator);
+			wmove(info_win, 5, 5);
+			wprintw(info_win, "line %d col %d lines from top %d ", 
+			          curr_line->line_number, scr_horz, absolute_lin);
+			wstandend(info_win);
+			wrefresh(info_win);
 		}
 
-		wnoutrefresh(text_win);
-		doupdate();
+		wrefresh(text_win);
 		in = wgetch(text_win);
 		if (in == -1)
-			continue;
+			exit(0);  /* without this exit ee will go into an 
+			             infinite loop if the network 
+			             session detaches */
 
 		resize_check();
 
@@ -800,7 +811,7 @@ int disp;
 				d_char[0] = *point;
 				d_char[1] = *(point + 1);
 			}
-			d_char[del_width] = (unsigned char) NULL;
+			d_char[del_width] = '\0';
 		}
 		while (temp_pos <= curr_line->line_length)
 		{
@@ -817,6 +828,7 @@ int disp;
 	}
 	else if (curr_line->prev_line != NULL)
 	{
+		absolute_lin--;
 		text_changes = TRUE;
 		left(disp);			/* go to previous line	*/
 		temp_buff = curr_line->next_line;
@@ -824,12 +836,11 @@ int disp;
 		if (temp_buff->next_line != NULL)
 			temp_buff->next_line->prev_line = curr_line;
 		curr_line->next_line = temp_buff->next_line;
-		renumber_lines(curr_line->next_line, curr_line->line_number + 1);
 		temp2 = temp_buff->line;
 		if (in == 8)
 		{
 			d_char[0] = '\n';
-			d_char[1] = (unsigned char) NULL;
+			d_char[1] = '\0';
 		}
 		tp = point;
 		temp_pos = 1;
@@ -841,7 +852,7 @@ int disp;
 			tp++;
 			temp2++;
 		}
-		*tp = (char) NULL;
+		*tp = '\0';
 		free(temp_buff->line);
 		free(temp_buff);
 		temp_buff = curr_line;
@@ -930,7 +941,7 @@ char character;
 int column;
 {
 	int i1, i2;
-	unsigned char *string;
+	char *string;
 	char string2[8];
 
 	if (character == TAB)
@@ -958,16 +969,16 @@ int column;
 		}
 		else
 		{
-			waddch(window, (unsigned char)character );
+			waddch(window, (char)character );
 			return(1);
 		}
 	}
 	else
 	{
-		waddch(window, (unsigned char)character);
+		waddch(window, (char)character);
 		return(1);
 	}
-	for (i2 = 0; (string[i2] != (char) NULL) && (((column+i2+1)-horiz_offset) < last_col); i2++)
+	for (i2 = 0; (string[i2] != '\0') && (((column+i2+1)-horiz_offset) < last_col); i2++)
 		waddch(window, string[i2]);
 	return(strlen(string));
 }
@@ -1069,8 +1080,8 @@ int disp;
 	temp_nod->line = extra= malloc(10);
 	temp_nod->line_length = 1;
 	temp_nod->max_length = 10;
+	temp_nod->line_number = curr_line->line_number + 1;
 	temp_nod->next_line = curr_line->next_line;
-	renumber_lines(temp_nod, curr_line->line_number + 1);
 	if (temp_nod->next_line != NULL)
 		temp_nod->next_line->prev_line = temp_nod;
 	temp_nod->prev_line = curr_line;
@@ -1092,13 +1103,14 @@ int disp;
 			temp++;
 		}
 		temp=point;
-		*temp = (char) NULL;
+		*temp = '\0';
 		temp = resiz_line((1 - temp_nod->line_length), curr_line, position);
 		curr_line->line_length = 1 + temp - curr_line->line;
 	}
 	curr_line->line_length = position;
+	absolute_lin++;
 	curr_line = temp_nod;
-	*extra = (char) NULL;
+	*extra = '\0';
 	position = 1;
 	point= curr_line->line;
 	if (disp)
@@ -1141,9 +1153,9 @@ struct files *name_alloc()	/* allocate s
 unsigned char *next_word(string)		/* move to next word in string		*/
 unsigned char *string;
 {
-	while ((*string != (char) NULL) && ((*string != 32) && (*string != 9)))
+	while ((*string != '\0') && ((*string != 32) && (*string != 9)))
 		string++;
-	while ((*string != (char) NULL) && ((*string == 32) || (*string == 9)))
+	while ((*string != '\0') && ((*string == 32) || (*string == 9)))
 		string++;
 	return(string);
 }
@@ -1177,7 +1189,7 @@ control()			/* use control for commands	
 	if (in == 1)		/* control a	*/
 	{
 		string = get_string(ascii_code_str, TRUE);
-		if (*string != (char) NULL)
+		if (*string != '\0')
 		{
 			in = atoi(string);
 			wmove(text_win, scr_vert, (scr_horz - horiz_offset));
@@ -1285,7 +1297,7 @@ emacs_control()
 	else if (in == 15)	/* control o	*/
 	{
 		string = get_string(ascii_code_str, TRUE);
-		if (*string != (char) NULL)
+		if (*string != '\0')
 		{
 			in = atoi(string);
 			wmove(text_win, scr_vert, (scr_horz - horiz_offset));
@@ -1325,7 +1337,10 @@ void 
 bottom()			/* go to bottom of file			*/
 {
 	while (curr_line->next_line != NULL)
+	{
 		curr_line = curr_line->next_line;
+		absolute_lin++;
+	}
 	point = curr_line->line;
 	if (horiz_offset)
 		horiz_offset = 0;
@@ -1338,7 +1353,10 @@ void 
 top()				/* go to top of file			*/
 {
 	while (curr_line->prev_line != NULL)
+	{
 		curr_line = curr_line->prev_line;
+		absolute_lin--;
+	}
 	point = curr_line->line;
 	if (horiz_offset)
 		horiz_offset = 0;
@@ -1351,6 +1369,7 @@ void 
 nextline()			/* move pointers to start of next line	*/
 {
 	curr_line = curr_line->next_line;
+	absolute_lin++;
 	point = curr_line->line;
 	position = 1;
 	if (scr_vert == last_line)
@@ -1369,6 +1388,7 @@ void 
 prevline()			/* move pointers to start of previous line*/
 {
 	curr_line = curr_line->prev_line;
+	absolute_lin--;
 	point = curr_line->line;
 	position = 1;
 	if (scr_vert == 0)
@@ -1406,6 +1426,7 @@ int disp;
 	{
 		if (!disp)
 		{
+			absolute_lin--;
 			curr_line = curr_line->prev_line;
 			point = curr_line->line + curr_line->line_length;
 			position = curr_line->line_length;
@@ -1441,6 +1462,7 @@ int disp;
 	{
 		if (!disp)
 		{
+			absolute_lin++;
 			curr_line = curr_line->next_line;
 			point = curr_line->line;
 			position = 1;
@@ -1526,7 +1548,7 @@ function_key()				/* process function ke
 		bol();
 	else if (in == KEY_END)
 		eol();
-	else if ( in == KEY_UP)
+	else if (in == KEY_UP)
 		up();
 	else if (in == KEY_DOWN)
 		down();
@@ -1686,7 +1708,7 @@ char *cmd_str1;
 			return;
 		}
 		cmd_str = next_word(cmd_str);
-		if (*cmd_str == (char) NULL)
+		if (*cmd_str == '\0')
 		{
 			cmd_str = cmd_str2 = get_string(file_write_prompt_str, TRUE);
 		}
@@ -1702,7 +1724,7 @@ char *cmd_str1;
 			return;
 		}
 		cmd_str = next_word(cmd_str);
-		if (*cmd_str == (char) NULL)
+		if (*cmd_str == '\0')
 		{
 			cmd_str = cmd_str2 = get_string(file_read_prompt_str, TRUE);
 		}
@@ -1872,7 +1894,7 @@ int advance;		/* if true, skip leading s
 		esc_flag = FALSE;
 		in = wgetch(com_win);
 		if (in == -1)
-			continue;
+			exit(0);
 		if (((in == 8) || (in == 127) || (in == KEY_BACKSPACE)) && (g_pos > 0))
 		{
 			tmp_int = g_horz;
@@ -1897,7 +1919,7 @@ int advance;		/* if true, skip leading s
 				esc_flag = TRUE;
 				in = wgetch(com_win);
 				if (in == -1)
-					continue;
+					exit(0);
 			}
 			*nam_str = in;
 			g_pos++;
@@ -1913,9 +1935,9 @@ int advance;		/* if true, skip leading s
 		}
 		wrefresh(com_win);
 		if (esc_flag)
-			in = (char) NULL;
+			in = '\0';
 	} while ((in != '\n') && (in != '\r'));
-	*nam_str = (char) NULL;
+	*nam_str = '\0';
 	nam_str = tmp_string;
 	if (((*nam_str == ' ') || (*nam_str == 9)) && (advance))
 		nam_str = next_word(nam_str);
@@ -1940,7 +1962,7 @@ int sensitive;
 	strng1 = string1;
 	strng2 = string2;
 	tmp = 0;
-	if ((strng1 == NULL) || (strng2 == NULL) || (*strng1 == (char) NULL) || (*strng2 == (char) NULL))
+	if ((strng1 == NULL) || (strng2 == NULL) || (*strng1 == '\0') || (*strng2 == '\0'))
 		return(FALSE);
 	equal = TRUE;
 	while (equal)
@@ -1957,7 +1979,7 @@ int sensitive;
 		}
 		strng1++;
 		strng2++;
-		if ((*strng1 == (char) NULL) || (*strng2 == (char) NULL) || (*strng1 == ' ') || (*strng2 == ' '))
+		if ((*strng1 == '\0') || (*strng2 == '\0') || (*strng1 == ' ') || (*strng2 == ' '))
 			break;
 		tmp++;
 	}
@@ -2002,6 +2024,14 @@ char *cmd_str;
 	}
 	else
 	{
+		if (!strcmp(direction, "d"))
+		{
+			absolute_lin += i;
+		}
+		else
+		{
+			absolute_lin -= i;
+		}
 		curr_line = t_line;
 		point = curr_line->line;
 		position = 1;
@@ -2062,7 +2092,7 @@ char *arguments[];
 	input_file = FALSE;
 	recv_file = FALSE;
 	count = 1;
-	while ((count < numargs) && (!no_more_opts))
+	while ((count < numargs)&& (!no_more_opts))
 	{
 		buff = arguments[count];
 		if (!strcmp("-i", buff))
@@ -2086,7 +2116,7 @@ char *arguments[];
 			fprintf(stderr, usage4);
 			exit(1);
 		}
-		else if (*buff == '+')
+		else if ((*buff == '+') && (start_at_line == NULL))
 		{
 			buff++;
 			start_at_line = buff;
@@ -2113,13 +2143,13 @@ char *arguments[];
 			temp_names = temp_names->next_name;
 		}
 		ptr = temp_names->name = malloc(strlen(buff) + 1);
-		while (*buff != (char) NULL)
+		while (*buff != '\0')
 		{
 			*ptr = *buff;
 			buff++;
 			ptr++;
 		}
-		*ptr = (char) NULL;
+		*ptr = '\0';
 		temp_names->next_name = NULL;
 		input_file = TRUE;
 		recv_file = TRUE;
@@ -2201,7 +2231,7 @@ check_fp()		/* open or close files accor
 		wmove(com_win, 0, 0);
 		wclrtoeol(com_win);
 		text_changes = TRUE;
-		if ((tmp_file != NULL) && (*tmp_file != (char) NULL))
+		if ((tmp_file != NULL) && (*tmp_file != '\0'))
 			wprintw(com_win, file_read_fin_msg, tmp_file);
 	}
 	wrefresh(com_win);
@@ -2318,8 +2348,8 @@ int *append;	/* TRUE if must append more
 		if (!(*append))	/* if not append to current line, insert new one */
 		{
 			tline = txtalloc();	/* allocate data structure for next line */
+			tline->line_number = curr_line->line_number + 1;
 			tline->next_line = curr_line->next_line;
-			renumber_lines(tline, curr_line->line_number + 1);
 			tline->prev_line = curr_line;
 			curr_line->next_line = tline;
 			if (tline->next_line != NULL)
@@ -2340,7 +2370,7 @@ int *append;	/* TRUE if must append more
 			point++;
 			str1++;
 		}
-		*point = (char) NULL;
+		*point = '\0';
 		*append = FALSE;
 		if ((num == length) && (*str2 != '\n'))
 			*append = TRUE;
@@ -2378,10 +2408,10 @@ finish()	/* prepare to exit edit session
 	 |	portion of file_op()
 	 */
 
-	if ((file_name == NULL) || (*file_name == (char) NULL))
+	if ((file_name == NULL) || (*file_name == '\0'))
 		file_name = get_string(save_file_name_prompt, TRUE);
 
-	if ((file_name == NULL) || (*file_name == (char) NULL))
+	if ((file_name == NULL) || (*file_name == '\0'))
 	{
 		wmove(com_win, 0, 0);
 		wprintw(com_win, file_not_saved_msg);
@@ -2438,7 +2468,6 @@ int noverify;
 		recv_file = TRUE;
 		input_file = TRUE;
 		check_fp();
-		text_changes = FALSE;
 	}
 	return(0);
 }
@@ -2463,10 +2492,11 @@ delete_text()
 	{
 		free(curr_line->line);
 		curr_line = curr_line->prev_line;
+		absolute_lin--;
 		free(curr_line->next_line);
 	}
 	curr_line->next_line = NULL;
-	*curr_line->line = (char) NULL;
+	*curr_line->line = '\0';
 	curr_line->line_length = 1;
 	curr_line->line_number = 1;
 	point = curr_line->line;
@@ -2558,7 +2588,7 @@ int display_message;
 	int iter;
 	int found;
 
-	if ((srch_str == NULL) || (*srch_str == (char) NULL))
+	if ((srch_str == NULL) || (*srch_str == '\0'))
 		return(FALSE);
 	if (display_message)
 	{
@@ -2583,7 +2613,7 @@ int display_message;
 			if (case_sen)	/* if case sensitive		*/
 			{
 				srch_3 = srch_str;
-			while ((*srch_2 == *srch_3) && (*srch_3 != (char) NULL))
+			while ((*srch_2 == *srch_3) && (*srch_3 != '\0'))
 				{
 					found = TRUE;
 					srch_2++;
@@ -2593,14 +2623,14 @@ int display_message;
 			else		/* if not case sensitive	*/
 			{
 				srch_3 = u_srch_str;
-			while ((toupper(*srch_2) == *srch_3) && (*srch_3 != (char) NULL))
+			while ((toupper(*srch_2) == *srch_3) && (*srch_3 != '\0'))
 				{
 					found = TRUE;
 					srch_2++;
 					srch_3++;
 				}
 			}	/* end else	*/
-			if (!((*srch_3 == (char) NULL) && (found)))
+			if (!((*srch_3 == '\0') && (found)))
 			{
 				found = FALSE;
 				if (iter < srch_line->line_length)
@@ -2640,6 +2670,7 @@ int display_message;
 			}
 			else 
 			{
+				absolute_lin += lines_moved;
 				curr_line = srch_line;
 				point = srch_1;
 				position = iter;
@@ -2668,19 +2699,19 @@ search_prompt()		/* prompt and read sear
 {
 	if (srch_str != NULL)
 		free(srch_str);
-	if ((u_srch_str != NULL) && (*u_srch_str != (char) NULL))
+	if ((u_srch_str != NULL) && (*u_srch_str != '\0'))
 		free(u_srch_str);
 	srch_str = get_string(search_prompt_str, FALSE);
 	gold = FALSE;
 	srch_3 = srch_str;
 	srch_1 = u_srch_str = malloc(strlen(srch_str) + 1);
-	while (*srch_3 != (char) NULL)
+	while (*srch_3 != '\0')
 	{
 		*srch_1 = toupper(*srch_3);
 		srch_1++;
 		srch_3++;
 	}
-	*srch_1 = (char) NULL;
+	*srch_1 = '\0';
 	search(TRUE);
 }
 
@@ -2717,7 +2748,7 @@ undel_char()			/* undelete last deleted 
 	{
 		in = d_char[0];
 		insert(in);
-		if (d_char[1] != (unsigned char) NULL)
+		if (d_char[1] != '\0')
 		{
 			in = d_char[1];
 			insert(in);
@@ -2759,7 +2790,7 @@ del_word()			/* delete word in front of 
 		d_word2++;
 		d_word3++;
 	}
-	*d_word2 = (char) NULL;
+	*d_word2 = '\0';
 	d_wrd_len = difference = d_word2 - d_word;
 	d_word2 = point;
 	while (tposit < curr_line->line_length)
@@ -2770,7 +2801,7 @@ del_word()			/* delete word in front of 
 		d_word3++;
 	}
 	curr_line->line_length -= difference;
-	*d_word2 = (char) NULL;
+	*d_word2 = '\0';
 	draw_line(scr_vert, scr_horz,point,position,curr_line->line_length);
 	d_char[0] = tmp_char[0];
 	d_char[1] = tmp_char[1];
@@ -2823,7 +2854,7 @@ undel_word()		/* undelete last deleted w
 	}
 	curr_line->line_length += d_wrd_len;
 	tmp_old_ptr = point;
-	*tmp_ptr = (char) NULL;
+	*tmp_ptr = '\0';
 	tmp_ptr = tmp_space;
 	tposit = 1;
 	/*
@@ -2836,7 +2867,7 @@ undel_word()		/* undelete last deleted w
 		tmp_ptr++;
 		tmp_old_ptr++;
 	}
-	*tmp_old_ptr = (char) NULL;
+	*tmp_old_ptr = '\0';
 	free(tmp_space);
 	draw_line(scr_vert, scr_horz, point, position, curr_line->line_length);
 }
@@ -2862,8 +2893,8 @@ del_line()			/* delete from cursor to en
 		tposit++;
 	}
 	dlt_line->line_length = 1 + tposit - position;
-	*dl1 = (char) NULL;
-	*point = (char) NULL;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 18:11:12 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B0A3E1065677;
	Wed, 27 May 2009 18:11:12 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9F6E88FC22;
	Wed, 27 May 2009 18:11:12 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RIBCcQ006882;
	Wed, 27 May 2009 18:11:12 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RIBC1P006880;
	Wed, 27 May 2009 18:11:12 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <200905271811.n4RIBC1P006880@svn.freebsd.org>
From: Doug Barton 
Date: Wed, 27 May 2009 18:11:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192916 - head
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 18:11:13 -0000

Author: dougb
Date: Wed May 27 18:11:12 2009
New Revision: 192916
URL: http://svn.freebsd.org/changeset/base/192916

Log:
  Note the removal of makekey(8)
  
  Requested by:	bz

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==============================================================================
--- head/ObsoleteFiles.inc	Wed May 27 18:07:18 2009	(r192915)
+++ head/ObsoleteFiles.inc	Wed May 27 18:11:12 2009	(r192916)
@@ -47,6 +47,9 @@ OLD_FILES+=usr/include/legacy/dev/usb/ux
 OLD_DIRS+=usr/include/legacy/dev/usb
 OLD_DIRS+=usr/include/legacy/dev
 OLD_DIRS+=usr/include/legacy
+# 20090526: removal of makekey(8)
+OLD_FILES+=libexec/makekey
+OLD_FILES+=usr/share/man/man8/makekey.8.gz
 # 20090522: removal of University of Michigan NFSv4 client
 OLD_FILES+=etc/rc.d/idmapd
 OLD_FILES+=sbin/idmapd

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 18:12:11 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 150121065670;
	Wed, 27 May 2009 18:12:11 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0445D8FC1A;
	Wed, 27 May 2009 18:12:11 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RICARY006941;
	Wed, 27 May 2009 18:12:10 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RICAWx006940;
	Wed, 27 May 2009 18:12:10 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <200905271812.n4RICAWx006940@svn.freebsd.org>
From: Alan Cox 
Date: Wed, 27 May 2009 18:12:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192917 - head/sys/fs/tmpfs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 18:12:11 -0000

Author: alc
Date: Wed May 27 18:12:10 2009
New Revision: 192917
URL: http://svn.freebsd.org/changeset/base/192917

Log:
  Eliminate redundant setting of a page's valid bits and pointless clearing
  of the same page's dirty bits.

Modified:
  head/sys/fs/tmpfs/tmpfs_vnops.c

Modified: head/sys/fs/tmpfs/tmpfs_vnops.c
==============================================================================
--- head/sys/fs/tmpfs/tmpfs_vnops.c	Wed May 27 18:11:12 2009	(r192916)
+++ head/sys/fs/tmpfs/tmpfs_vnops.c	Wed May 27 18:12:10 2009	(r192917)
@@ -606,8 +606,8 @@ out:
 		VM_OBJECT_LOCK(vobj);
 	vm_page_lock_queues();
 	if (error == 0) {
-		vm_page_set_validclean(tpg, offset, tlen);
-		vm_page_zero_invalid(tpg, TRUE);
+		KASSERT(tpg->valid == VM_PAGE_BITS_ALL,
+		    ("parts of tpg invalid"));
 		vm_page_dirty(tpg);
 	}
 	vm_page_unwire(tpg, TRUE);

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 18:12:27 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E01011065786;
	Wed, 27 May 2009 18:12:27 +0000 (UTC)
	(envelope-from rink@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CEEA08FC20;
	Wed, 27 May 2009 18:12:27 +0000 (UTC)
	(envelope-from rink@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RICR7C006979;
	Wed, 27 May 2009 18:12:27 GMT (envelope-from rink@svn.freebsd.org)
Received: (from rink@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RICRJd006978;
	Wed, 27 May 2009 18:12:27 GMT (envelope-from rink@svn.freebsd.org)
Message-Id: <200905271812.n4RICRJd006978@svn.freebsd.org>
From: Rink Springer 
Date: Wed, 27 May 2009 18:12:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192918 - head/sys/ia64/ia64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 18:12:28 -0000

Author: rink
Date: Wed May 27 18:12:27 2009
New Revision: 192918
URL: http://svn.freebsd.org/changeset/base/192918

Log:
  ia64: Move MCA information retrieval to a per-CPU kthread
  
  Once AP's are launched, their MCA state information is stored and later obtainable using a sysctl. Since the size of the MCA state information is unknown, it will be malloc'ed as needed. However, when 'ia64_ap_startup' runs, it's not yet safe to call malloc and this may cause 'panic: blockable sleep lock (sleep mutex) 8192 @ /usr/src/sys/vm/uma_core.c'. This commit avoids this issue by scheduling a separate kthread to obtain this information, which immediately terminates afterwards.

Modified:
  head/sys/ia64/ia64/mp_machdep.c

Modified: head/sys/ia64/ia64/mp_machdep.c
==============================================================================
--- head/sys/ia64/ia64/mp_machdep.c	Wed May 27 18:12:10 2009	(r192917)
+++ head/sys/ia64/ia64/mp_machdep.c	Wed May 27 18:12:27 2009	(r192918)
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -89,6 +90,28 @@ cpu_topo(void)
 	return smp_topo_none();
 }
 
+static void
+ia64_store_mca_state(void* arg)
+{
+	unsigned int ncpu = (unsigned int)(uintptr_t)arg;
+	struct thread* td;
+
+	/* ia64_mca_save_state() is CPU-sensitive, so bind ourself to our target CPU */
+	td = curthread;
+	thread_lock(td);
+	sched_bind(td, ncpu);
+	thread_unlock(td);
+
+	/*
+	 * Get and save the CPU specific MCA records. Should we get the
+	 * MCA state for each processor, or just the CMC state?
+	 */
+	ia64_mca_save_state(SAL_INFO_MCA);
+	ia64_mca_save_state(SAL_INFO_CMC);
+
+	kproc_exit(0);
+}
+
 void
 ia64_ap_startup(void)
 {
@@ -118,13 +141,6 @@ ia64_ap_startup(void)
 	KASSERT(PCPU_GET(idlethread) != NULL, ("no idle thread"));
 	PCPU_SET(curthread, PCPU_GET(idlethread));
 
-	/*
-	 * Get and save the CPU specific MCA records. Should we get the
-	 * MCA state for each processor, or just the CMC state?
-	 */
-	ia64_mca_save_state(SAL_INFO_MCA);
-	ia64_mca_save_state(SAL_INFO_CMC);
-
 	atomic_add_int(&ap_awake, 1);
 	while (!smp_started)
 		cpu_spinwait();
@@ -285,8 +301,10 @@ cpu_mp_unleash(void *dummy)
 	smp_cpus = 0;
 	SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
 		cpus++;
-		if (pc->pc_awake)
+		if (pc->pc_awake) {
+			kproc_create(ia64_store_mca_state, (void*)((uintptr_t)pc->pc_cpuid), NULL, 0, 0, "mca %u", pc->pc_cpuid);
 			smp_cpus++;
+		}
 	}
 
 	ap_awake = 1;

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 18:13:16 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 47FCC106568E;
	Wed, 27 May 2009 18:13:16 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1DC158FC20;
	Wed, 27 May 2009 18:13:16 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RIDGcK007036;
	Wed, 27 May 2009 18:13:16 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RIDFWf007033;
	Wed, 27 May 2009 18:13:15 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <200905271813.n4RIDFWf007033@svn.freebsd.org>
From: Joel Dahl 
Date: Wed, 27 May 2009 18:13:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192919 - head/sys/dev/sound/pci
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 18:13:17 -0000

Author: joel (doc committer)
Date: Wed May 27 18:13:15 2009
New Revision: 192919
URL: http://svn.freebsd.org/changeset/base/192919

Log:
  Separate comments from the license text.

Modified:
  head/sys/dev/sound/pci/cmi.c
  head/sys/dev/sound/pci/cs4281.c
  head/sys/dev/sound/pci/vibes.c

Modified: head/sys/dev/sound/pci/cmi.c
==============================================================================
--- head/sys/dev/sound/pci/cmi.c	Wed May 27 18:12:27 2009	(r192918)
+++ head/sys/dev/sound/pci/cmi.c	Wed May 27 18:13:15 2009	(r192919)
@@ -22,7 +22,9 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THEPOSSIBILITY OF
  * SUCH DAMAGE.
- *
+ */
+
+/*
  * This driver exists largely as a result of other people's efforts.
  * Much of register handling is based on NetBSD CMI8x38 audio driver
  * by Takuya Shiozaki .  Chen-Li Tien

Modified: head/sys/dev/sound/pci/cs4281.c
==============================================================================
--- head/sys/dev/sound/pci/cs4281.c	Wed May 27 18:12:27 2009	(r192918)
+++ head/sys/dev/sound/pci/cs4281.c	Wed May 27 18:13:15 2009	(r192919)
@@ -22,7 +22,9 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THEPOSSIBILITY OF
  * SUCH DAMAGE.
- *
+ */
+
+/*
  * The order of pokes in the initiation sequence is based on Linux
  * driver by Thomas Sailer, gw boynton (wesb@crystal.cirrus.com), tom
  * woller (twoller@crystal.cirrus.com).  Shingo Watanabe (nabe@nabechan.org)

Modified: head/sys/dev/sound/pci/vibes.c
==============================================================================
--- head/sys/dev/sound/pci/vibes.c	Wed May 27 18:12:27 2009	(r192918)
+++ head/sys/dev/sound/pci/vibes.c	Wed May 27 18:13:15 2009	(r192919)
@@ -22,7 +22,9 @@
  * 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 card has the annoying habit of "clicking" when attached and
  * detached, haven't been able to remedy this with any combination of
  * muting.

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 18:16:53 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E65E81065688;
	Wed, 27 May 2009 18:16:53 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D539B8FC21;
	Wed, 27 May 2009 18:16:53 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RIGrtB007151;
	Wed, 27 May 2009 18:16:53 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RIGrFu007150;
	Wed, 27 May 2009 18:16:53 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <200905271816.n4RIGrFu007150@svn.freebsd.org>
From: Joel Dahl 
Date: Wed, 27 May 2009 18:16:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192920 - head/sys/dev/sound/pcm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 18:16:55 -0000

Author: joel (doc committer)
Date: Wed May 27 18:16:53 2009
New Revision: 192920
URL: http://svn.freebsd.org/changeset/base/192920

Log:
  Slightly adjust copyright text.
  
  Approved by:	luigi

Modified:
  head/sys/dev/sound/pcm/sound.c

Modified: head/sys/dev/sound/pcm/sound.c
==============================================================================
--- head/sys/dev/sound/pcm/sound.c	Wed May 27 18:13:15 2009	(r192919)
+++ head/sys/dev/sound/pcm/sound.c	Wed May 27 18:16:53 2009	(r192920)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 1999 Cameron Grant 
- * (C) 1997 Luigi Rizzo
+ * Copyright (c) 1997 Luigi Rizzo
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 18:17:59 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 61E441065673;
	Wed, 27 May 2009 18:17:59 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2DB968FC0A;
	Wed, 27 May 2009 18:17:59 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RIHxvF007216;
	Wed, 27 May 2009 18:17:59 GMT (envelope-from joel@svn.freebsd.org)
Received: (from joel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RIHxWA007215;
	Wed, 27 May 2009 18:17:59 GMT (envelope-from joel@svn.freebsd.org)
Message-Id: <200905271817.n4RIHxWA007215@svn.freebsd.org>
From: Joel Dahl 
Date: Wed, 27 May 2009 18:17:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192921 - head/sys/dev/sound/pcm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 18:17:59 -0000

Author: joel (doc committer)
Date: Wed May 27 18:17:58 2009
New Revision: 192921
URL: http://svn.freebsd.org/changeset/base/192921

Log:
  Slightly adjust copyright text.
  
  Approved by:	Hannu Savolainen 

Modified:
  head/sys/dev/sound/pcm/sound.h

Modified: head/sys/dev/sound/pcm/sound.h
==============================================================================
--- head/sys/dev/sound/pcm/sound.h	Wed May 27 18:16:53 2009	(r192920)
+++ head/sys/dev/sound/pcm/sound.h	Wed May 27 18:17:58 2009	(r192921)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 1999 Cameron Grant 
- * Copyright by Hannu Savolainen 1995
+ * Copyright (c) 1995 Hannu Savolainen
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 18:19:17 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6D24F106567F;
	Wed, 27 May 2009 18:19:17 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from mail.vnode.se (mail.vnode.se [62.119.52.82])
	by mx1.freebsd.org (Postfix) with ESMTP id 207D28FC1C;
	Wed, 27 May 2009 18:19:16 +0000 (UTC)
	(envelope-from joel@FreeBSD.org)
Received: from iMac.local (pgw.vnode.se [77.110.37.134])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.vnode.se (Postfix) with ESMTPSA id 48FA3E9F4E8;
	Wed, 27 May 2009 20:01:36 +0200 (CEST)
Message-ID: <4A1D7FFF.8060707@FreeBSD.org>
Date: Wed, 27 May 2009 20:01:35 +0200
From: Joel Dahl 
User-Agent: Thunderbird 2.0.0.21 (Macintosh/20090302)
MIME-Version: 1.0
To: Ed Schouten 
References: <200905271727.n4RHR3qm005592@svn.freebsd.org>
In-Reply-To: <200905271727.n4RHR3qm005592@svn.freebsd.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r192914 - in head: contrib/ee usr.bin/ee
 usr.bin/ee/nls/de_DE.ISO8859-1
 usr.bin/ee/nls/fr_FR.ISO8859-1 usr.bin/ee/nls/pl_PL.ISO8859-2
 usr.bin/ee/nls/ru_RU.KOI8-R usr.bin/ee/nls/uk_UA.KO...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 18:19:18 -0000

Ed Schouten skrev:
> Author: ed
> Date: Wed May 27 17:27:03 2009
> New Revision: 192914
> URL: http://svn.freebsd.org/changeset/base/192914
> 
> Log:
>   Update ee(1) in the base system to version 1.5.0.

Thank you!

--
Joel

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 18:28:08 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7ECC0106564A;
	Wed, 27 May 2009 18:28:08 +0000 (UTC) (envelope-from ed@hoeg.nl)
Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211])
	by mx1.freebsd.org (Postfix) with ESMTP id 438A18FC1D;
	Wed, 27 May 2009 18:28:08 +0000 (UTC) (envelope-from ed@hoeg.nl)
Received: by palm.hoeg.nl (Postfix, from userid 1000)
	id 73FFF1CEB5; Wed, 27 May 2009 20:28:07 +0200 (CEST)
Date: Wed, 27 May 2009 20:28:07 +0200
From: Ed Schouten 
To: Zachary Loafman 
Message-ID: <20090527182807.GG48776@hoeg.nl>
References: <200905271636.n4RGasNe003922@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="sDKAb4OeUBrWWL6P"
Content-Disposition: inline
In-Reply-To: <200905271636.n4RGasNe003922@svn.freebsd.org>
User-Agent: Mutt/1.5.19 (2009-01-05)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r192908 - in head: share/man/man9 sys/conf
	sys/kern sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 18:28:08 -0000


--sDKAb4OeUBrWWL6P
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi Zach,

* Zachary Loafman  wrote:
>   head/sys/sys/queue.h

This part of the patch is not in the email, so I'll just link it here:

	http://svn.freebsd.org/viewvc/base/head/sys/sys/queue.h?r1=3D191535&r2=3D1=
92908

In other macros in this header file, we try to use as many _NEXT() and
_PREV() invocations as possible, to abstract the structure field names.
Maybe we could change _SWAP() macros to do the same?

Cheers,
--=20
 Ed Schouten 
 WWW: http://80386.nl/

--sDKAb4OeUBrWWL6P
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEARECAAYFAkodhjcACgkQ52SDGA2eCwUmMgCfbMQcbDr1dPbU3ve6yyxj9nhX
TNgAn2UffUOY8ssvqI9WwkvjUPqMOraF
=APea
-----END PGP SIGNATURE-----

--sDKAb4OeUBrWWL6P--

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 18:39:37 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AAB221065674
	for ; Wed, 27 May 2009 18:39:37 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4])
	by mx1.freebsd.org (Postfix) with ESMTP id 394328FC16
	for ; Wed, 27 May 2009 18:39:37 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: (qmail 11996 invoked by uid 399); 27 May 2009 18:11:30 -0000
Received: from localhost (HELO foreign.dougb.net)
	(dougb@dougbarton.us@127.0.0.1)
	by localhost with ESMTPAM; 27 May 2009 18:11:30 -0000
X-Originating-IP: 127.0.0.1
X-Sender: dougb@dougbarton.us
Message-ID: <4A1D8250.1000905@FreeBSD.org>
Date: Wed, 27 May 2009 11:11:28 -0700
From: Doug Barton 
Organization: http://www.FreeBSD.org/
User-Agent: Thunderbird 2.0.0.21 (X11/20090423)
MIME-Version: 1.0
To: "Bjoern A. Zeeb" 
References: <200905260007.n4Q072JS040447@svn.freebsd.org>
	<20090526060526.L72053@maildrop.int.zabbadoz.net>
In-Reply-To: <20090526060526.L72053@maildrop.int.zabbadoz.net>
X-Enigmail-Version: 0.95.7
OpenPGP: id=D5B2F0FB
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r192776 - in head/libexec: . makekey
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 18:39:38 -0000

Done, thanks for the reminder.

Doug


Bjoern A. Zeeb wrote:
> On Tue, 26 May 2009, Doug Barton wrote:
> 
>> Author: dougb
>> Date: Tue May 26 00:07:02 2009
>> New Revision: 192776
>> URL: http://svn.freebsd.org/changeset/base/192776
>>
>> Log:
>>  Per the man page:
>>  The makekey utility has been deprecated and will be removed in a future
>>  release of FreeBSD.
>>
>>  Actually removing it was approved back on 10/29/2007 by re (kensmith)
>> but
>>  I dropped the ball on actually removing it. It's doubtful that it's
>> become
>>  more relevant/useful in the intervening time.
>>
>> Deleted:
>>  head/libexec/makekey/
> 
> Can you also update OboseletesFiles.inc?
> 
>> Modified:
>>  head/libexec/Makefile
>>
>> Modified: head/libexec/Makefile
>> ==============================================================================
>>
>> --- head/libexec/Makefile    Mon May 25 23:06:46 2009    (r192775)
>> +++ head/libexec/Makefile    Tue May 26 00:07:02 2009    (r192776)
>> @@ -11,7 +11,6 @@ SUBDIR=    ${_atrun} \
>>     getty \
>>     lukemftpd \
>>     ${_mail.local} \
>> -    makekey \
>>     ${_mknetid} \
>>     ${_pppoed} \
>>     rbootd \
>>
> 


-- 

    This .signature sanitized for your protection


From owner-svn-src-head@FreeBSD.ORG  Wed May 27 18:54:33 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7DF071065677;
	Wed, 27 May 2009 18:54:33 +0000 (UTC) (envelope-from dfr@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6C46B8FC17;
	Wed, 27 May 2009 18:54:33 +0000 (UTC) (envelope-from dfr@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RIsXE7008342;
	Wed, 27 May 2009 18:54:33 GMT (envelope-from dfr@svn.freebsd.org)
Received: (from dfr@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RIsX9d008341;
	Wed, 27 May 2009 18:54:33 GMT (envelope-from dfr@svn.freebsd.org)
Message-Id: <200905271854.n4RIsX9d008341@svn.freebsd.org>
From: Doug Rabson 
Date: Wed, 27 May 2009 18:54:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192922 - head/libexec/rtld-elf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 18:54:34 -0000

Author: dfr
Date: Wed May 27 18:54:31 2009
New Revision: 192922
URL: http://svn.freebsd.org/changeset/base/192922

Log:
  Increase the size of the static TLS area slightly (required for the NVidia's
  OpenGL driver on amd64).

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

Modified: head/libexec/rtld-elf/rtld.h
==============================================================================
--- head/libexec/rtld-elf/rtld.h	Wed May 27 18:17:58 2009	(r192921)
+++ head/libexec/rtld-elf/rtld.h	Wed May 27 18:54:31 2009	(r192922)
@@ -231,7 +231,7 @@ typedef struct Struct_Obj_Entry {
 #define RTLD_MAGIC	0xd550b87a
 #define RTLD_VERSION	1
 
-#define RTLD_STATIC_TLS_EXTRA	64
+#define RTLD_STATIC_TLS_EXTRA	128
 
 /* Flags to be passed into symlook_ family of functions. */
 #define SYMLOOK_IN_PLT	0x01	/* Lookup for PLT symbol */

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 18:57:14 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 62840106566C;
	Wed, 27 May 2009 18:57:14 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4ED898FC08;
	Wed, 27 May 2009 18:57:14 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RIvEYG008470;
	Wed, 27 May 2009 18:57:14 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RIvEJ2008462;
	Wed, 27 May 2009 18:57:14 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200905271857.n4RIvEJ2008462@svn.freebsd.org>
From: Bruce M Simpson 
Date: Wed, 27 May 2009 18:57:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192923 - in head: share/man/man4 sys/netinet6
	usr.sbin/ifmcstat
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 18:57:14 -0000

Author: bms
Date: Wed May 27 18:57:13 2009
New Revision: 192923
URL: http://svn.freebsd.org/changeset/base/192923

Log:
  Merge final round of MLD changes from p4:
   ip6_input.c, in6.h:
   * Add netinet6-specific mbuf flag M_RTALERT_MLD, shadowing M_PROTO6.
    * Always set this flag if HBH Router Alert option is present for MLD,
      even when not forwarding.
  
   icmp6.c:
   * In icmp6_input(), spell m->m_pkthdr.rcvif as ifp to be consistent.
   * Use scope ID for verifying input. Do not apply SSM filters here, no inpcb.
    * Check for M_RTALERT_MLD when validating MLD traffic, as we can't see
      IPv6 hop options outside of ip6_input().
  
   in6_mcast.c:
   * Use KAME scope/zone ID in in6_multi.
     * Update net.inet6.ip6.mcast.filters implementation to use scope IDs
       for comparisons.
   * Fix scope ID treatment in multicast socket option processing.
     Scope IDs passed in from userland will be ignored as other less
     ambiguous APIs exist for specifying the link.
   * Tighten userland input checks in IPv6 SSM delta and full-state ops.
     * Source filter embedded scope IDs need to be revisited, for now
       just clear them and ignore them on input.
   * Adapt KAME behaviour of looking up the scope ID in the default zone
     for multicast leaves, when the interface is ambiguous.
  
   mld6.c:
   * Tighten origin checks on MLD traffic as per RFC3810 Section 6.2:
    * ip6_src MAY be the unspecified address for MLDv1 reports.
    * ip6_src MAY have link-local address scope for MLDv1 reports,
      MLDv1 queries, and MLDv2 queries.
    * Perform address field validation *before* accepting queries.
   * Use KAME scope/zone ID in query/report processing.
     * Break const correctness for mld_v1_input_report(), mld_v1_input_query()
       as we temporarily modify the input mbuf chain.
     * Clear the scope ID before handoff to userland MLD daemon.
   * Fix MLDv1 old querier present timer processing.
     With the protocol defaults, hosts should revert to MLDv2 after 260s.
   * Add net.inet6.mld.v1enable sysctl, default to on.
  
   ifmcstat.c:
   * Use sysctl by default; -K requests kvm(3) if so compiled.
  
   mld.4:
   * Connect man page to build.
  
  Tested using PCS.

Modified:
  head/share/man/man4/Makefile
  head/share/man/man4/multicast.4
  head/sys/netinet6/icmp6.c
  head/sys/netinet6/in6.h
  head/sys/netinet6/in6_mcast.c
  head/sys/netinet6/ip6_input.c
  head/sys/netinet6/mld6.c
  head/usr.sbin/ifmcstat/ifmcstat.8
  head/usr.sbin/ifmcstat/ifmcstat.c

Modified: head/share/man/man4/Makefile
==============================================================================
--- head/share/man/man4/Makefile	Wed May 27 18:54:31 2009	(r192922)
+++ head/share/man/man4/Makefile	Wed May 27 18:57:13 2009	(r192923)
@@ -191,6 +191,7 @@ MAN=	aac.4 \
 	meteor.4 \
 	mfi.4 \
 	miibus.4 \
+	mld.4 \
 	mlx.4 \
 	mly.4 \
 	mmc.4 \

Modified: head/share/man/man4/multicast.4
==============================================================================
--- head/share/man/man4/multicast.4	Wed May 27 18:54:31 2009	(r192922)
+++ head/share/man/man4/multicast.4	Wed May 27 18:57:13 2009	(r192923)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 13, 2009
+.Dd May 27, 2009
 .Dt MULTICAST 4
 .Os
 .\"
@@ -962,6 +962,7 @@ after the previous upcall.
 .Xr intro 4 ,
 .Xr ip 4 ,
 .Xr ip6 4 ,
+.Xr mld 4 ,
 .Xr pim 4
 .\"
 .Sh HISTORY
@@ -1002,6 +1003,8 @@ monitoring were implemented by
 in collaboration with
 .An Chris Brown
 (NextHop).
+The IGMPv3 and MLDv2 multicast support was implemented by
+.An Bruce Simpson .
 .Pp
 This manual page was written by
 .An Pavlin Radoslavov

Modified: head/sys/netinet6/icmp6.c
==============================================================================
--- head/sys/netinet6/icmp6.c	Wed May 27 18:54:31 2009	(r192922)
+++ head/sys/netinet6/icmp6.c	Wed May 27 18:57:13 2009	(r192923)
@@ -403,6 +403,7 @@ icmp6_input(struct mbuf **mp, int *offp,
 	INIT_VNET_INET6(curvnet);
 	INIT_VPROCG(TD_TO_VPROCG(curthread)); /* XXX V_hostname needs this */
 	struct mbuf *m = *mp, *n;
+	struct ifnet *ifp;
 	struct ip6_hdr *ip6, *nip6;
 	struct icmp6_hdr *icmp6, *nicmp6;
 	int off = *offp;
@@ -410,6 +411,8 @@ icmp6_input(struct mbuf **mp, int *offp,
 	int code, sum, noff;
 	char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
 
+	ifp = m->m_pkthdr.rcvif;
+
 #ifndef PULLDOWN_TEST
 	IP6_EXTHDR_CHECK(m, off, sizeof(struct icmp6_hdr), IPPROTO_DONE);
 	/* m might change if M_LOOP.  So, call mtod after this */
@@ -431,10 +434,8 @@ icmp6_input(struct mbuf **mp, int *offp,
 	 * Note: SSM filters are not applied for ICMPv6 traffic.
 	 */
 	if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) {
-		struct ifnet *ifp;
-		struct in6_multi *inm;
+		struct in6_multi	*inm;
 
-		ifp = m->m_pkthdr.rcvif;
 		inm = in6m_lookup(ifp, &ip6->ip6_dst);
 		if (inm == NULL) {
 			IP6STAT_INC(ip6s_notmember);
@@ -483,19 +484,19 @@ icmp6_input(struct mbuf **mp, int *offp,
 	}
 
 	ICMP6STAT_INC(icp6s_inhist[icmp6->icmp6_type]);
-	icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_msg);
+	icmp6_ifstat_inc(ifp, ifs6_in_msg);
 	if (icmp6->icmp6_type < ICMP6_INFOMSG_MASK)
-		icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_error);
+		icmp6_ifstat_inc(ifp, ifs6_in_error);
 
 	switch (icmp6->icmp6_type) {
 	case ICMP6_DST_UNREACH:
-		icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_dstunreach);
+		icmp6_ifstat_inc(ifp, ifs6_in_dstunreach);
 		switch (code) {
 		case ICMP6_DST_UNREACH_NOROUTE:
 			code = PRC_UNREACH_NET;
 			break;
 		case ICMP6_DST_UNREACH_ADMIN:
-			icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_adminprohib);
+			icmp6_ifstat_inc(ifp, ifs6_in_adminprohib);
 			code = PRC_UNREACH_PROTOCOL; /* is this a good code? */
 			break;
 		case ICMP6_DST_UNREACH_ADDR:
@@ -515,7 +516,7 @@ icmp6_input(struct mbuf **mp, int *offp,
 		break;
 
 	case ICMP6_PACKET_TOO_BIG:
-		icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_pkttoobig);
+		icmp6_ifstat_inc(ifp, ifs6_in_pkttoobig);
 
 		/* validation is made in icmp6_mtudisc_update */
 
@@ -529,7 +530,7 @@ icmp6_input(struct mbuf **mp, int *offp,
 		break;
 
 	case ICMP6_TIME_EXCEEDED:
-		icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_timeexceed);
+		icmp6_ifstat_inc(ifp, ifs6_in_timeexceed);
 		switch (code) {
 		case ICMP6_TIME_EXCEED_TRANSIT:
 			code = PRC_TIMXCEED_INTRANS;
@@ -544,7 +545,7 @@ icmp6_input(struct mbuf **mp, int *offp,
 		break;
 
 	case ICMP6_PARAM_PROB:
-		icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_paramprob);
+		icmp6_ifstat_inc(ifp, ifs6_in_paramprob);
 		switch (code) {
 		case ICMP6_PARAMPROB_NEXTHEADER:
 			code = PRC_UNREACH_PROTOCOL;
@@ -560,7 +561,7 @@ icmp6_input(struct mbuf **mp, int *offp,
 		break;
 
 	case ICMP6_ECHO_REQUEST:
-		icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_echo);
+		icmp6_ifstat_inc(ifp, ifs6_in_echo);
 		if (code != 0)
 			goto badcode;
 		if ((n = m_copy(m, 0, M_COPYALL)) == NULL) {
@@ -623,7 +624,7 @@ icmp6_input(struct mbuf **mp, int *offp,
 		break;
 
 	case ICMP6_ECHO_REPLY:
-		icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_echoreply);
+		icmp6_ifstat_inc(ifp, ifs6_in_echoreply);
 		if (code != 0)
 			goto badcode;
 		break;
@@ -633,11 +634,15 @@ icmp6_input(struct mbuf **mp, int *offp,
 	case MLD_LISTENER_DONE:
 	case MLDV2_LISTENER_REPORT:
 		/*
-		 * Drop MLD traffic which is not link-local.
+		 * Drop MLD traffic which is not link-local, has a hop limit
+		 * of greater than 1 hop, or which does not have the
+		 * IPv6 HBH Router Alert option.
+		 * As IPv6 HBH options are stripped in ip6_input() we must
+		 * check an mbuf header flag.
 		 * XXX Should we also sanity check that these messages
 		 * were directed to a link-local multicast prefix?
 		 */
-		if (ip6->ip6_hlim != 1)
+		if ((ip6->ip6_hlim != 1) || (m->m_flags & M_RTALERT_MLD) == 0)
 			goto freeit;
 		if (mld_input(m, off, icmp6len) != 0)
 			return (IPPROTO_DONE);
@@ -748,7 +753,7 @@ icmp6_input(struct mbuf **mp, int *offp,
 		break;
 
 	case ND_ROUTER_SOLICIT:
-		icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_routersolicit);
+		icmp6_ifstat_inc(ifp, ifs6_in_routersolicit);
 		if (code != 0)
 			goto badcode;
 		if (icmp6len < sizeof(struct nd_router_solicit))
@@ -764,7 +769,7 @@ icmp6_input(struct mbuf **mp, int *offp,
 		break;
 
 	case ND_ROUTER_ADVERT:
-		icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_routeradvert);
+		icmp6_ifstat_inc(ifp, ifs6_in_routeradvert);
 		if (code != 0)
 			goto badcode;
 		if (icmp6len < sizeof(struct nd_router_advert))
@@ -780,7 +785,7 @@ icmp6_input(struct mbuf **mp, int *offp,
 		break;
 
 	case ND_NEIGHBOR_SOLICIT:
-		icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_neighborsolicit);
+		icmp6_ifstat_inc(ifp, ifs6_in_neighborsolicit);
 		if (code != 0)
 			goto badcode;
 		if (icmp6len < sizeof(struct nd_neighbor_solicit))
@@ -796,7 +801,7 @@ icmp6_input(struct mbuf **mp, int *offp,
 		break;
 
 	case ND_NEIGHBOR_ADVERT:
-		icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_neighboradvert);
+		icmp6_ifstat_inc(ifp, ifs6_in_neighboradvert);
 		if (code != 0)
 			goto badcode;
 		if (icmp6len < sizeof(struct nd_neighbor_advert))
@@ -812,7 +817,7 @@ icmp6_input(struct mbuf **mp, int *offp,
 		break;
 
 	case ND_REDIRECT:
-		icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_redirect);
+		icmp6_ifstat_inc(ifp, ifs6_in_redirect);
 		if (code != 0)
 			goto badcode;
 		if (icmp6len < sizeof(struct nd_redirect))
@@ -840,7 +845,7 @@ icmp6_input(struct mbuf **mp, int *offp,
 		    "icmp6_input: unknown type %d(src=%s, dst=%s, ifid=%d)\n",
 		    icmp6->icmp6_type, ip6_sprintf(ip6bufs, &ip6->ip6_src),
 		    ip6_sprintf(ip6bufd, &ip6->ip6_dst),
-		    m->m_pkthdr.rcvif ? m->m_pkthdr.rcvif->if_index : 0));
+		    ifp ? ifp->if_index : 0));
 		if (icmp6->icmp6_type < ICMP6_ECHO_REQUEST) {
 			/* ICMPv6 error: MUST deliver it by spec... */
 			code = PRC_NCMDS;

Modified: head/sys/netinet6/in6.h
==============================================================================
--- head/sys/netinet6/in6.h	Wed May 27 18:54:31 2009	(r192922)
+++ head/sys/netinet6/in6.h	Wed May 27 18:57:13 2009	(r192923)
@@ -619,6 +619,7 @@ struct ip6_mtuinfo {
 #define	M_DECRYPTED	M_PROTO3
 #define	M_LOOP		M_PROTO4
 #define	M_AUTHIPDGM	M_PROTO5
+#define	M_RTALERT_MLD	M_PROTO6
 
 #ifdef _KERNEL
 struct cmsghdr;

Modified: head/sys/netinet6/in6_mcast.c
==============================================================================
--- head/sys/netinet6/in6_mcast.c	Wed May 27 18:54:31 2009	(r192922)
+++ head/sys/netinet6/in6_mcast.c	Wed May 27 18:57:13 2009	(r192923)
@@ -305,6 +305,10 @@ im6o_match_group(const struct ip6_moptio
  * Find an IPv6 multicast source entry for this imo which matches
  * the given group index for this socket, and source address.
  *
+ * XXX TODO: The scope ID, if present in src, is stripped before
+ * any comparison. We SHOULD enforce scope/zone checks where the source
+ * filter entry has a link scope.
+ *
  * NOTE: This does not check if the entry is in-mode, merely if
  * it exists, which may not be the desired behaviour.
  */
@@ -328,6 +332,7 @@ im6o_match_source(const struct ip6_mopti
 
 	psa = (const sockunion_t *)src;
 	find.im6s_addr = psa->sin6.sin6_addr;
+	in6_clearscope(&find.im6s_addr);		/* XXX */
 	ims = RB_FIND(ip6_msource_tree, &imf->im6f_sources, &find);
 
 	return ((struct in6_msource *)ims);
@@ -1159,6 +1164,20 @@ in6_mc_join_locked(struct ifnet *ifp, co
 	char			 ip6tbuf[INET6_ADDRSTRLEN];
 #endif
 
+#ifdef INVARIANTS
+	/*
+	 * Sanity: Check scope zone ID was set for ifp, if and
+	 * only if group is scoped to an interface.
+	 */
+	KASSERT(IN6_IS_ADDR_MULTICAST(mcaddr),
+	    ("%s: not a multicast address", __func__));
+	if (IN6_IS_ADDR_MC_LINKLOCAL(mcaddr) ||
+	    IN6_IS_ADDR_MC_INTFACELOCAL(mcaddr)) {
+		KASSERT(mcaddr->s6_addr16[1] != 0,
+		    ("%s: scope zone ID not set", __func__));
+	}
+#endif
+
 	IN6_MULTI_LOCK_ASSERT();
 
 	CTR4(KTR_MLD, "%s: join %s on %p(%s))", __func__,
@@ -1360,6 +1379,8 @@ in6p_block_unblock_source(struct inpcb *
 	if (!IN6_IS_ADDR_MULTICAST(&gsa->sin6.sin6_addr))
 		return (EINVAL);
 
+	(void)in6_setscope(&gsa->sin6.sin6_addr, ifp, NULL);
+
 	/*
 	 * Check if we are actually a member of this group.
 	 */
@@ -1566,19 +1587,26 @@ in6p_get_source_filters(struct inpcb *in
 	if (error)
 		return (error);
 
-	if (msfr.msfr_ifindex == 0 || V_if_index < msfr.msfr_ifindex)
+	if (msfr.msfr_group.ss_family != AF_INET6 ||
+	    msfr.msfr_group.ss_len != sizeof(struct sockaddr_in6))
+		return (EINVAL);
+
+	gsa = (sockunion_t *)&msfr.msfr_group;
+	if (!IN6_IS_ADDR_MULTICAST(&gsa->sin6.sin6_addr))
 		return (EINVAL);
 
+	if (msfr.msfr_ifindex == 0 || V_if_index < msfr.msfr_ifindex)
+		return (EADDRNOTAVAIL);
 	ifp = ifnet_byindex(msfr.msfr_ifindex);
 	if (ifp == NULL)
-		return (EINVAL);
+		return (EADDRNOTAVAIL);
+	(void)in6_setscope(&gsa->sin6.sin6_addr, ifp, NULL);
 
 	INP_WLOCK(inp);
 
 	/*
 	 * Lookup group on the socket.
 	 */
-	gsa = (sockunion_t *)&msfr.msfr_group;
 	idx = im6o_match_group(imo, ifp, &gsa->sa);
 	if (idx == -1 || imo->im6o_mfilters == NULL) {
 		INP_WUNLOCK(inp);
@@ -1803,6 +1831,12 @@ in6p_join_group(struct inpcb *inp, struc
 	ssa = (sockunion_t *)&gsr.gsr_source;
 	ssa->ss.ss_family = AF_UNSPEC;
 
+	/*
+	 * Chew everything into struct group_source_req.
+	 * Overwrite the port field if present, as the sockaddr
+	 * being copied in may be matched with a binary comparison.
+	 * Ignore passed-in scope ID.
+	 */
 	switch (sopt->sopt_name) {
 	case IPV6_JOIN_GROUP: {
 		struct ipv6_mreq mreq;
@@ -1846,16 +1880,20 @@ in6p_join_group(struct inpcb *inp, struc
 		    gsa->sin6.sin6_len != sizeof(struct sockaddr_in6))
 			return (EINVAL);
 
-		/*
-		 * Overwrite the port field if present, as the sockaddr
-		 * being copied in may be matched with a binary comparison.
-		 */
-		gsa->sin6.sin6_port = 0;
 		if (sopt->sopt_name == MCAST_JOIN_SOURCE_GROUP) {
 			if (ssa->sin6.sin6_family != AF_INET6 ||
 			    ssa->sin6.sin6_len != sizeof(struct sockaddr_in6))
 				return (EINVAL);
+			if (IN6_IS_ADDR_MULTICAST(&ssa->sin6.sin6_addr))
+				return (EINVAL);
+			/*
+			 * TODO: Validate embedded scope ID in source
+			 * list entry against passed-in ifp, if and only
+			 * if source list filter entry is iface or node local.
+			 */
+			in6_clearscope(&ssa->sin6.sin6_addr);
 			ssa->sin6.sin6_port = 0;
+			ssa->sin6.sin6_scope_id = 0;
 		}
 
 		if (gsr.gsr_interface == 0 || V_if_index < gsr.gsr_interface)
@@ -1870,34 +1908,22 @@ in6p_join_group(struct inpcb *inp, struc
 		break;
 	}
 
-#ifdef notyet
-	/*
-	 * FIXME: Check for unspecified address (all groups).
-	 * Do we have a normative reference for this 'feature'?
-	 *
-	 * We use the unspecified address to specify to accept
-	 * all multicast addresses. Only super user is allowed
-	 * to do this.
-	 * XXX-BZ might need a better PRIV_NETINET_x for this
-	 */
-	if (IN6_IS_ADDR_UNSPECIFIED(&gsa->sin6.sin6_addr)) {
-		error = priv_check(curthread, PRIV_NETINET_MROUTE);
-		if (error)
-		break;
-	} else
-#endif
 	if (!IN6_IS_ADDR_MULTICAST(&gsa->sin6.sin6_addr))
 		return (EINVAL);
 
 	if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0)
 		return (EADDRNOTAVAIL);
 
-#ifdef notyet
+	gsa->sin6.sin6_port = 0;
+	gsa->sin6.sin6_scope_id = 0;
+
 	/*
-	 * FIXME: Set interface scope in group address.
+	 * Always set the scope zone ID on memberships created from userland.
+	 * Use the passed-in ifp to do this.
+	 * XXX The in6_setscope() return value is meaningless.
+	 * XXX SCOPE6_LOCK() is taken by in6_setscope().
 	 */
-	(void)in6_setscope(&gsa->sin6.sin_addr, ifp, NULL);
-#endif
+	(void)in6_setscope(&gsa->sin6.sin6_addr, ifp, NULL);
 
 	/*
 	 * MCAST_JOIN_SOURCE on an exclusive membership is an error.
@@ -2031,6 +2057,8 @@ static int
 in6p_leave_group(struct inpcb *inp, struct sockopt *sopt)
 {
 	INIT_VNET_NET(curvnet);
+	INIT_VNET_INET6(curvnet);
+	struct ipv6_mreq		 mreq;
 	struct group_source_req		 gsr;
 	sockunion_t			*gsa, *ssa;
 	struct ifnet			*ifp;
@@ -2038,6 +2066,7 @@ in6p_leave_group(struct inpcb *inp, stru
 	struct ip6_moptions		*imo;
 	struct in6_msource		*ims;
 	struct in6_multi		*inm;
+	uint32_t			 ifindex;
 	size_t				 idx;
 	int				 error, is_final;
 #ifdef KTR
@@ -2045,6 +2074,7 @@ in6p_leave_group(struct inpcb *inp, stru
 #endif
 
 	ifp = NULL;
+	ifindex = 0;
 	error = 0;
 	is_final = 1;
 
@@ -2054,39 +2084,26 @@ in6p_leave_group(struct inpcb *inp, stru
 	ssa = (sockunion_t *)&gsr.gsr_source;
 	ssa->ss.ss_family = AF_UNSPEC;
 
+	/*
+	 * Chew everything passed in up into a struct group_source_req
+	 * as that is easier to process.
+	 * Note: Any embedded scope ID in the multicast group passed
+	 * in by userland is ignored, the interface index is the recommended
+	 * mechanism to specify an interface; see below.
+	 */
 	switch (sopt->sopt_name) {
-	case IPV6_LEAVE_GROUP: {
-		struct ipv6_mreq mreq;
-
+	case IPV6_LEAVE_GROUP:
 		error = sooptcopyin(sopt, &mreq, sizeof(struct ipv6_mreq),
 		    sizeof(struct ipv6_mreq));
 		if (error)
 			return (error);
-
 		gsa->sin6.sin6_family = AF_INET6;
 		gsa->sin6.sin6_len = sizeof(struct sockaddr_in6);
 		gsa->sin6.sin6_addr = mreq.ipv6mr_multiaddr;
-
-		if (mreq.ipv6mr_interface == 0) {
-#ifdef notyet
-			/*
-			 * FIXME: Resolve scope ambiguity when interface
-			 * index is unspecified.
-			 */
-			ifp = in6p_lookup_mcast_ifp(inp, &gsa->sin6);
-#else
-			return (EADDRNOTAVAIL);
-#endif
-		} else {
-			if (mreq.ipv6mr_interface < 0 ||
-			    V_if_index < mreq.ipv6mr_interface)
-				return (EADDRNOTAVAIL);
-			ifp = ifnet_byindex(mreq.ipv6mr_interface);
-		}
-
-		CTR3(KTR_MLD, "%s: ipv6mr_interface = %d, ifp = %p",
-		    __func__, mreq.ipv6mr_interface, ifp);
-	} break;
+		gsa->sin6.sin6_port = 0;
+		gsa->sin6.sin6_scope_id = 0;
+		ifindex = mreq.ipv6mr_interface;
+		break;
 
 	case MCAST_LEAVE_GROUP:
 	case MCAST_LEAVE_SOURCE_GROUP:
@@ -2105,17 +2122,22 @@ in6p_leave_group(struct inpcb *inp, stru
 		if (gsa->sin6.sin6_family != AF_INET6 ||
 		    gsa->sin6.sin6_len != sizeof(struct sockaddr_in6))
 			return (EINVAL);
-
 		if (sopt->sopt_name == MCAST_LEAVE_SOURCE_GROUP) {
 			if (ssa->sin6.sin6_family != AF_INET6 ||
 			    ssa->sin6.sin6_len != sizeof(struct sockaddr_in6))
 				return (EINVAL);
+			if (IN6_IS_ADDR_MULTICAST(&ssa->sin6.sin6_addr))
+				return (EINVAL);
+			/*
+			 * TODO: Validate embedded scope ID in source
+			 * list entry against passed-in ifp, if and only
+			 * if source list filter entry is iface or node local.
+			 */
+			in6_clearscope(&ssa->sin6.sin6_addr);
 		}
-
-		if (gsr.gsr_interface == 0 || V_if_index < gsr.gsr_interface)
-			return (EADDRNOTAVAIL);
-
-		ifp = ifnet_byindex(gsr.gsr_interface);
+		gsa->sin6.sin6_port = 0;
+		gsa->sin6.sin6_scope_id = 0;
+		ifindex = gsr.gsr_interface;
 		break;
 
 	default:
@@ -2128,14 +2150,39 @@ in6p_leave_group(struct inpcb *inp, stru
 	if (!IN6_IS_ADDR_MULTICAST(&gsa->sin6.sin6_addr))
 		return (EINVAL);
 
-#ifdef notyet
 	/*
-	 * FIXME: Need to embed ifp's scope ID in the address
-	 * handed down to MLD.
-	 * See KAME IPV6_LEAVE_GROUP implementation.
+	 * Validate interface index if provided. If no interface index
+	 * was provided separately, attempt to look the membership up
+	 * from the default scope as a last resort to disambiguate
+	 * the membership we are being asked to leave.
+	 * XXX SCOPE6 lock potentially taken here.
 	 */
-	(void)in6_setscope(&mreq->ipv6mr_multiaddr, ifp, NULL);
-#endif
+	if (ifindex != 0) {
+		if (ifindex < 0 || V_if_index < ifindex)
+			return (EADDRNOTAVAIL);
+		ifp = ifnet_byindex(ifindex);
+		if (ifp == NULL)
+			return (EADDRNOTAVAIL);
+		(void)in6_setscope(&gsa->sin6.sin6_addr, ifp, NULL);
+	} else {
+		error = sa6_embedscope(&gsa->sin6, V_ip6_use_defzone);
+		if (error)
+			return (EADDRNOTAVAIL);
+		/*
+		 * XXX For now, stomp on zone ID for the corner case.
+		 * This is not the 'KAME way', but we need to see the ifp
+		 * directly until such time as this implementation is
+		 * refactored, assuming the scope IDs are the way to go.
+		 */
+		ifindex = ntohs(gsa->sin6.sin6_addr.s6_addr16[1]);
+		KASSERT(ifindex != 0, ("%s: bad zone ID", __func__));
+		ifp = ifnet_byindex(ifindex);
+		if (ifp == NULL)
+			return (EADDRNOTAVAIL);
+	}
+
+	CTR2(KTR_MLD, "%s: ifp = %p", __func__, ifp);
+	KASSERT(ifp != NULL, ("%s: ifp did not resolve", __func__));
 
 	/*
 	 * Find the membership in the membership array.
@@ -2312,10 +2359,10 @@ in6p_set_source_filters(struct inpcb *in
 
 	if (msfr.msfr_ifindex == 0 || V_if_index < msfr.msfr_ifindex)
 		return (EADDRNOTAVAIL);
-
 	ifp = ifnet_byindex(msfr.msfr_ifindex);
 	if (ifp == NULL)
 		return (EADDRNOTAVAIL);
+	(void)in6_setscope(&gsa->sin6.sin6_addr, ifp, NULL);
 
 	/*
 	 * Take the INP write lock.
@@ -2393,6 +2440,16 @@ in6p_set_source_filters(struct inpcb *in
 				error = EINVAL;
 				break;
 			}
+			if (IN6_IS_ADDR_MULTICAST(&psin->sin6_addr)) {
+				error = EINVAL;
+				break;
+			}
+			/*
+			 * TODO: Validate embedded scope ID in source
+			 * list entry against passed-in ifp, if and only
+			 * if source list filter entry is iface or node local.
+			 */
+			in6_clearscope(&psin->sin6_addr);
 			error = im6f_get_source(imf, psin, &lims);
 			if (error)
 				break;
@@ -2560,7 +2617,7 @@ static int
 sysctl_ip6_mcast_filters(SYSCTL_HANDLER_ARGS)
 {
 	INIT_VNET_NET(curvnet);
-	struct in6_addr			*pgina;
+	struct in6_addr			 mcaddr;
 	struct in6_addr			 src;
 	struct ifnet			*ifp;
 	struct ifmultiaddr		*ifma;
@@ -2591,10 +2648,10 @@ sysctl_ip6_mcast_filters(SYSCTL_HANDLER_
 		return (ENOENT);
 	}
 
-	pgina = (struct in6_addr *)&name[1];
-	if (!IN6_IS_ADDR_MULTICAST(pgina)) {
+	memcpy(&mcaddr, &name[1], sizeof(struct in6_addr));
+	if (!IN6_IS_ADDR_MULTICAST(&mcaddr)) {
 		CTR2(KTR_MLD, "%s: group %s is not multicast",
-		    __func__, ip6_sprintf(ip6tbuf, pgina));
+		    __func__, ip6_sprintf(ip6tbuf, &mcaddr));
 		return (EINVAL);
 	}
 
@@ -2604,6 +2661,10 @@ sysctl_ip6_mcast_filters(SYSCTL_HANDLER_
 		    __func__, ifindex);
 		return (ENOENT);
 	}
+	/*
+	 * Internal MLD lookups require that scope/zone ID is set.
+	 */
+	(void)in6_setscope(&mcaddr, ifp, NULL);
 
 	retval = sysctl_wire_old_buffer(req,
 	    sizeof(uint32_t) + (in6_mcast_maxgrpsrc * sizeof(struct in6_addr)));
@@ -2618,7 +2679,7 @@ sysctl_ip6_mcast_filters(SYSCTL_HANDLER_
 		    ifma->ifma_protospec == NULL)
 			continue;
 		inm = (struct in6_multi *)ifma->ifma_protospec;
-		if (!IN6_ARE_ADDR_EQUAL(&inm->in6m_addr, pgina))
+		if (!IN6_ARE_ADDR_EQUAL(&inm->in6m_addr, &mcaddr))
 			continue;
 		fmode = inm->in6m_st[1].iss_fmode;
 		retval = SYSCTL_OUT(req, &fmode, sizeof(uint32_t));

Modified: head/sys/netinet6/ip6_input.c
==============================================================================
--- head/sys/netinet6/ip6_input.c	Wed May 27 18:54:31 2009	(r192922)
+++ head/sys/netinet6/ip6_input.c	Wed May 27 18:57:13 2009	(r192923)
@@ -773,10 +773,11 @@ passin:
 		 * case we should pass the packet to the multicast routing
 		 * daemon.
 		 */
-		if (rtalert != ~0 && V_ip6_forwarding) {
+		if (rtalert != ~0) {
 			switch (rtalert) {
 			case IP6OPT_RTALERT_MLD:
-				ours = 1;
+				if (V_ip6_forwarding)
+					ours = 1;
 				break;
 			default:
 				/*
@@ -820,6 +821,9 @@ passin:
 		 * The packet is returned (relatively) intact; if
 		 * ip6_mforward() returns a non-zero value, the packet
 		 * must be discarded, else it may be accepted below.
+		 *
+		 * XXX TODO: Check hlim and multicast scope here to avoid
+		 * unnecessarily calling into ip6_mforward().
 		 */
 		if (ip6_mforward &&
 		    ip6_mforward(ip6, m->m_pkthdr.rcvif, m)) {
@@ -882,6 +886,14 @@ passin:
 		if (ip6_ipsec_input(m, nxt))
 			goto bad;
 #endif /* IPSEC */
+
+		/*
+		 * Use mbuf flags to propagate Router Alert option to
+		 * ICMPv6 layer, as hop-by-hop options have been stripped.
+		 */
+		if (nxt == IPPROTO_ICMPV6 && rtalert != ~0)
+			m->m_flags |= M_RTALERT_MLD;
+
 		nxt = (*inet6sw[ip6_protox[nxt]].pr_input)(&m, &off, nxt);
 	}
 	goto out;

Modified: head/sys/netinet6/mld6.c
==============================================================================
--- head/sys/netinet6/mld6.c	Wed May 27 18:54:31 2009	(r192922)
+++ head/sys/netinet6/mld6.c	Wed May 27 18:57:13 2009	(r192923)
@@ -122,9 +122,9 @@ static void	mld_slowtimo_vnet(void);
 static void	mld_sysinit(void);
 static void	mld_sysuninit(void);
 static int	mld_v1_input_query(struct ifnet *, const struct ip6_hdr *,
-		    const struct mld_hdr *);
+		    /*const*/ struct mld_hdr *);
 static int	mld_v1_input_report(struct ifnet *, const struct ip6_hdr *,
-		    const struct mld_hdr *);
+		    /*const*/ struct mld_hdr *);
 static void	mld_v1_process_group_timer(struct in6_multi *, const int);
 static void	mld_v1_process_querier_timers(struct mld_ifinfo *);
 static int	mld_v1_transmit_report(struct in6_multi *, const int);
@@ -239,6 +239,11 @@ SYSCTL_V_PROC(V_NET, vnet_inet6, _net_in
 SYSCTL_NODE(_net_inet6_mld, OID_AUTO, ifinfo, CTLFLAG_RD | CTLFLAG_MPSAFE,
     sysctl_mld_ifinfo, "Per-interface MLDv2 state");
 
+static int	mld_v1enable = 1;
+SYSCTL_INT(_net_inet6_mld, OID_AUTO, v1enable, CTLFLAG_RW,
+    &mld_v1enable, 0, "Enable fallback to MLDv1");
+TUNABLE_INT("net.inet6.mld.v1enable", &mld_v1enable);
+
 /*
  * Packed Router Alert option structure declaration.
  */
@@ -615,36 +620,97 @@ mli_delete_locked(const struct ifnet *if
 /*
  * Process a received MLDv1 general or address-specific query.
  * Assumes that the query header has been pulled up to sizeof(mld_hdr).
+ *
+ * NOTE: Can't be fully const correct as we temporarily embed scope ID in
+ * mld_addr. This is OK as we own the mbuf chain.
  */
 static int
 mld_v1_input_query(struct ifnet *ifp, const struct ip6_hdr *ip6,
-    const struct mld_hdr *mld)
+    /*const*/ struct mld_hdr *mld)
 {
 	struct ifmultiaddr	*ifma;
 	struct mld_ifinfo	*mli;
 	struct in6_multi	*inm;
+	int			 is_general_query;
 	uint16_t		 timer;
 #ifdef KTR
 	char			 ip6tbuf[INET6_ADDRSTRLEN];
 #endif
 
+	is_general_query = 0;
+
+	if (!mld_v1enable) {
+		CTR3(KTR_MLD, "ignore v1 query %s on ifp %p(%s)",
+		    ip6_sprintf(ip6tbuf, &mld->mld_addr),
+		    ifp, ifp->if_xname);
+		return (0);
+	}
+
+	/*
+	 * RFC3810 Section 6.2: MLD queries must originate from
+	 * a router's link-local address.
+	 */
+	if (!IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_src)) {
+		CTR3(KTR_MLD, "ignore v1 query src %s on ifp %p(%s)",
+		    ip6_sprintf(ip6tbuf, &ip6->ip6_src),
+		    ifp, ifp->if_xname);
+		return (0);
+	}
+
+	/*
+	 * Do address field validation upfront before we accept
+	 * the query.
+	 */
+	if (IN6_IS_ADDR_UNSPECIFIED(&mld->mld_addr)) {
+		/*
+		 * MLDv1 General Query.
+		 * If this was not sent to the all-nodes group, ignore it.
+		 */
+		struct in6_addr		 dst;
+
+		dst = ip6->ip6_dst;
+		in6_clearscope(&dst);
+		if (!IN6_ARE_ADDR_EQUAL(&dst, &in6addr_linklocal_allnodes))
+			return (EINVAL);
+		is_general_query = 1;
+	} else {
+		/*
+		 * Embed scope ID of receiving interface in MLD query for
+		 * lookup whilst we don't hold other locks.
+		 */
+		in6_setscope(&mld->mld_addr, ifp, NULL);
+	}
+
 	IN6_MULTI_LOCK();
 	MLD_LOCK();
 	IF_ADDR_LOCK(ifp);
 
-	mli = MLD_IFINFO(ifp);
-	KASSERT(mli != NULL, ("%s: no mld_ifinfo for ifp %p", __func__, ifp));
-
 	/*
 	 * Switch to MLDv1 host compatibility mode.
 	 */
+	mli = MLD_IFINFO(ifp);
+	KASSERT(mli != NULL, ("%s: no mld_ifinfo for ifp %p", __func__, ifp));
 	mld_set_version(mli, MLD_VERSION_1);
 
-	timer = ntohs(mld->mld_maxdelay) * PR_FASTHZ / MLD_TIMER_SCALE;
+	timer = (ntohs(mld->mld_maxdelay) * PR_FASTHZ) / MLD_TIMER_SCALE;
 	if (timer == 0)
 		timer = 1;
 
-	if (!IN6_IS_ADDR_UNSPECIFIED(&mld->mld_addr)) {
+	if (is_general_query) {
+		/*
+		 * For each reporting group joined on this
+		 * interface, kick the report timer.
+		 */
+		CTR2(KTR_MLD, "process v1 general query on ifp %p(%s)",
+		    ifp, ifp->if_xname);
+		TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
+			if (ifma->ifma_addr->sa_family != AF_INET6 ||
+			    ifma->ifma_protospec == NULL)
+				continue;
+			inm = (struct in6_multi *)ifma->ifma_protospec;
+			mld_v1_update_group(inm, timer);
+		}
+	} else {
 		/*
 		 * MLDv1 Group-Specific Query.
 		 * If this is a group-specific MLDv1 query, we need only
@@ -657,32 +723,8 @@ mld_v1_input_query(struct ifnet *ifp, co
 			    ifp, ifp->if_xname);
 			mld_v1_update_group(inm, timer);
 		}
-	} else {
-		/*
-		 * MLDv1 General Query.
-		 * If this was not sent to the all-nodes group, ignore it.
-		 */
-		struct in6_addr dst;
-
-		dst = ip6->ip6_dst;
-		in6_clearscope(&dst);
-		if (IN6_ARE_ADDR_EQUAL(&dst, &in6addr_linklocal_allnodes)) {
-			/*
-			 * For each reporting group joined on this
-			 * interface, kick the report timer.
-			 */
-			CTR2(KTR_MLD,
-			    "process v1 general query on ifp %p(%s)",
-			    ifp, ifp->if_xname);
-
-			TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
-				if (ifma->ifma_addr->sa_family != AF_INET6 ||
-				    ifma->ifma_protospec == NULL)
-					continue;
-				inm = (struct in6_multi *)ifma->ifma_protospec;
-				mld_v1_update_group(inm, timer);
-			}
-		}
+		/* XXX Clear embedded scope ID as userland won't expect it. */
+		in6_clearscope(&mld->mld_addr);
 	}
 
 	IF_ADDR_UNLOCK(ifp);
@@ -769,18 +811,38 @@ mld_v2_input_query(struct ifnet *ifp, co
 	struct mldv2_query	*mld;
 	struct in6_multi	*inm;
 	uint32_t		 maxdelay, nsrc, qqi;
+	int			 is_general_query;
 	uint16_t		 timer;
 	uint8_t			 qrv;
+#ifdef KTR
+	char			 ip6tbuf[INET6_ADDRSTRLEN];
+#endif
+
+	is_general_query = 0;
+
+	/*
+	 * RFC3810 Section 6.2: MLD queries must originate from
+	 * a router's link-local address.
+	 */
+	if (!IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_src)) {
+		CTR3(KTR_MLD, "ignore v1 query src %s on ifp %p(%s)",
+		    ip6_sprintf(ip6tbuf, &ip6->ip6_src),
+		    ifp, ifp->if_xname);
+		return (0);
+	}
 
-	CTR2(KTR_MLD, "process v2 query on ifp %p(%s)", ifp, ifp->if_xname);
+	CTR2(KTR_MLD, "input v2 query on ifp %p(%s)", ifp, ifp->if_xname);
 
 	mld = (struct mldv2_query *)(mtod(m, uint8_t *) + off);
 
 	maxdelay = ntohs(mld->mld_maxdelay);	/* in 1/10ths of a second */
 	if (maxdelay >= 32678) {
-		maxdelay = (MLD_MRC_MANT(mld->mld_maxdelay) | 0x1000) <<
-			   (MLD_MRC_EXP(mld->mld_maxdelay) + 3);
+		maxdelay = (MLD_MRC_MANT(maxdelay) | 0x1000) <<
+			   (MLD_MRC_EXP(maxdelay) + 3);
 	}
+	timer = (maxdelay * PR_FASTHZ) / MLD_TIMER_SCALE;
+	if (timer == 0)
+		timer = 1;
 
 	qrv = MLD_QRV(mld->mld_misc);
 	if (qrv < 2) {
@@ -795,10 +857,6 @@ mld_v2_input_query(struct ifnet *ifp, co
 		     (MLD_QQIC_EXP(mld->mld_qqi) + 3);
 	}
 
-	timer = maxdelay * PR_FASTHZ / MLD_TIMER_SCALE;
-	if (timer == 0)
-		timer = 1;
-
 	nsrc = ntohs(mld->mld_numsrc);
 	if (nsrc > MLD_MAX_GS_SOURCES)
 		return (EMSGSIZE);
@@ -806,6 +864,33 @@ mld_v2_input_query(struct ifnet *ifp, co
 	    (nsrc * sizeof(struct in6_addr)))
 		return (EMSGSIZE);
 
+	/*
+	 * Do further input validation upfront to avoid resetting timers
+	 * should we need to discard this query.
+	 */
+	if (IN6_IS_ADDR_UNSPECIFIED(&mld->mld_addr)) {
+		/*
+		 * General Queries SHOULD be directed to ff02::1.
+		 * A general query with a source list has undefined
+		 * behaviour; discard it.
+		 */
+		struct in6_addr		 dst;
+
+		dst = ip6->ip6_dst;
+		in6_clearscope(&dst);
+		if (!IN6_ARE_ADDR_EQUAL(&dst, &in6addr_linklocal_allnodes) ||
+		    nsrc > 0)
+			return (EINVAL);
+		is_general_query = 1;
+	} else {
+		/*
+		 * Embed scope ID of receiving interface in MLD query for
+		 * lookup whilst we don't hold other locks (due to KAME
+		 * locking lameness). We own this mbuf chain just now.
+		 */
+		in6_setscope(&mld->mld_addr, ifp, NULL);
+	}
+
 	IN6_MULTI_LOCK();
 	MLD_LOCK();
 	IF_ADDR_LOCK(ifp);
@@ -813,8 +898,15 @@ mld_v2_input_query(struct ifnet *ifp, co
 	mli = MLD_IFINFO(ifp);
 	KASSERT(mli != NULL, ("%s: no mld_ifinfo for ifp %p", __func__, ifp));
 
-	mld_set_version(mli, MLD_VERSION_2);
+	/*
+	 * Discard the v2 query if we're in Compatibility Mode.
+	 * The RFC is pretty clear that hosts need to stay in MLDv1 mode
+	 * until the Old Version Querier Present timer expires.
+	 */
+	if (mli->mli_version != MLD_VERSION_2)
+		goto out_locked;
 
+	mld_set_version(mli, MLD_VERSION_2);
 	mli->mli_rv = qrv;
 	mli->mli_qi = qqi;
 	mli->mli_qri = maxdelay;
@@ -822,39 +914,20 @@ mld_v2_input_query(struct ifnet *ifp, co
 	CTR4(KTR_MLD, "%s: qrv %d qi %d maxdelay %d", __func__, qrv, qqi,
 	    maxdelay);
 
-	if (IN6_IS_ADDR_UNSPECIFIED(&mld->mld_addr)) {
+	if (is_general_query) {
 		/*
 		 * MLDv2 General Query.
 		 *
 		 * Schedule a current-state report on this ifp for
 		 * all groups, possibly containing source lists.
 		 *
-		 * Strip scope ID embedded by ip6_input(). We do not need
-		 * to do this for the MLD payload.
-		 */
-		struct in6_addr dst;
-
-		dst = ip6->ip6_dst;
-		in6_clearscope(&dst);
-		if (!IN6_ARE_ADDR_EQUAL(&dst, &in6addr_linklocal_allnodes) ||
-		    nsrc > 0) {
-			/*
-			 * General Queries SHOULD be directed to ff02::1.
-			 * A general query with a source list has undefined
-			 * behaviour; discard it.
-			 */
-			goto out_locked;
-		}
-
-		CTR2(KTR_MLD, "process v2 general query on ifp %p(%s)",
-		    ifp, ifp->if_xname);
-
-		/*
 		 * If there is a pending General Query response
 		 * scheduled earlier than the selected delay, do
 		 * not schedule any other reports.
 		 * Otherwise, reset the interface timer.
 		 */
+		CTR2(KTR_MLD, "process v2 general query on ifp %p(%s)",
+		    ifp, ifp->if_xname);
 		if (mli->mli_v2_timer == 0 || mli->mli_v2_timer >= timer) {
 			mli->mli_v2_timer = MLD_RANDOM_DELAY(timer);
 			V_interface_timers_running6 = 1;
@@ -890,6 +963,9 @@ mld_v2_input_query(struct ifnet *ifp, co
 		 */
 		if (mli->mli_v2_timer == 0 || mli->mli_v2_timer >= timer)
 			mld_v2_process_group_query(inm, mli, timer, m, off);
+
+		/* XXX Clear embedded scope ID as userland won't expect it. */
+		in6_clearscope(&mld->mld_addr);
 	}
 
 out_locked:
@@ -1017,27 +1093,57 @@ mld_v2_process_group_query(struct in6_mu
 /*
  * Process a received MLDv1 host membership report.
  * Assumes mld points to mld_hdr in pulled up mbuf chain.
+ *
+ * NOTE: Can't be fully const correct as we temporarily embed scope ID in
+ * mld_addr. This is OK as we own the mbuf chain.
  */
 static int
 mld_v1_input_report(struct ifnet *ifp, const struct ip6_hdr *ip6,
-    const struct mld_hdr *mld)
+    /*const*/ struct mld_hdr *mld)
 {
+	struct in6_addr		 src, dst;
 	struct in6_ifaddr	*ia;
 	struct in6_multi	*inm;
-	struct in6_addr		 src, dst;
 #ifdef KTR
 	char			 ip6tbuf[INET6_ADDRSTRLEN];
 #endif
 
+	if (!mld_v1enable) {
+		CTR3(KTR_MLD, "ignore v1 report %s on ifp %p(%s)",
+		    ip6_sprintf(ip6tbuf, &mld->mld_addr),
+		    ifp, ifp->if_xname);
+		return (0);
+	}
+
 	if (ifp->if_flags & IFF_LOOPBACK)
 		return (0);

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 19:21:31 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AC7EE1065677;
	Wed, 27 May 2009 19:21:31 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 80BED8FC0C;
	Wed, 27 May 2009 19:21:31 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RJLUHS009110;
	Wed, 27 May 2009 19:21:30 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RJLU5I009109;
	Wed, 27 May 2009 19:21:30 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200905271921.n4RJLU5I009109@svn.freebsd.org>
From: Andrew Thompson 
Date: Wed, 27 May 2009 19:21:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192924 - head/usr.sbin/usbconfig
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 19:21:32 -0000

Author: thompsa
Date: Wed May 27 19:21:29 2009
New Revision: 192924
URL: http://svn.freebsd.org/changeset/base/192924

Log:
  Fix xref name.

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

Modified: head/usr.sbin/usbconfig/usbconfig.8
==============================================================================
--- head/usr.sbin/usbconfig/usbconfig.8	Wed May 27 18:57:13 2009	(r192923)
+++ head/usr.sbin/usbconfig/usbconfig.8	Wed May 27 19:21:29 2009	(r192924)
@@ -50,4 +50,4 @@ Should only be used in conjunction with 
 Show help and available commands.
 .El
 .Sh SEE ALSO
-.Xr usb2_core 4
+.Xr usb 4

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 19:24:40 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1872A1065679;
	Wed, 27 May 2009 19:24:40 +0000 (UTC) (envelope-from xcllnt@mac.com)
Received: from asmtpout011.mac.com (asmtpout011.mac.com [17.148.16.86])
	by mx1.freebsd.org (Postfix) with ESMTP id 0188F8FC1B;
	Wed, 27 May 2009 19:24:39 +0000 (UTC) (envelope-from xcllnt@mac.com)
MIME-version: 1.0
Content-transfer-encoding: 7BIT
Content-type: text/plain; charset=US-ASCII; format=flowed
Received: from ajain-mbp.jnpr.net (natint3.juniper.net [66.129.224.36])
	by asmtp011.mac.com
	(Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008;
	32bit)) with ESMTPSA id <0KKB00FO4HWQWX80@asmtp011.mac.com>; Wed,
	27 May 2009 12:24:29 -0700 (PDT)
Message-id: 
From: Marcel Moolenaar 
To: Rink Springer 
In-reply-to: <200905271812.n4RICRJd006978@svn.freebsd.org>
Date: Wed, 27 May 2009 12:24:26 -0700
References: <200905271812.n4RICRJd006978@svn.freebsd.org>
X-Mailer: Apple Mail (2.935.3)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r192918 - head/sys/ia64/ia64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 19:24:40 -0000


On May 27, 2009, at 11:12 AM, Rink Springer wrote:

> Author: rink
> Date: Wed May 27 18:12:27 2009
> New Revision: 192918
> URL: http://svn.freebsd.org/changeset/base/192918
>
> Log:
>  ia64: Move MCA information retrieval to a per-CPU kthread

Nice!

-- 
Marcel Moolenaar
xcllnt@mac.com




From owner-svn-src-head@FreeBSD.ORG  Wed May 27 19:27:30 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4CE5610656C6;
	Wed, 27 May 2009 19:27:30 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 39EB28FC1B;
	Wed, 27 May 2009 19:27:30 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RJRUM4009291;
	Wed, 27 May 2009 19:27:30 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RJRUH8009289;
	Wed, 27 May 2009 19:27:30 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200905271927.n4RJRUH8009289@svn.freebsd.org>
From: Andrew Thompson 
Date: Wed, 27 May 2009 19:27:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192925 - in head/sys/dev/usb: . input
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 19:27:31 -0000

Author: thompsa
Date: Wed May 27 19:27:29 2009
New Revision: 192925
URL: http://svn.freebsd.org/changeset/base/192925

Log:
  Add support for the Apple MacBook Pro keyboard
  - add key mappings for fn keys
  - byte swapping for certain models
  - Fix leds for keyboards which require an ID byte for the HID output structures
  
  Submitted by:	Hans Petter Selasky

Modified:
  head/sys/dev/usb/input/ukbd.c
  head/sys/dev/usb/usbhid.h

Modified: head/sys/dev/usb/input/ukbd.c
==============================================================================
--- head/sys/dev/usb/input/ukbd.c	Wed May 27 19:21:29 2009	(r192924)
+++ head/sys/dev/usb/input/ukbd.c	Wed May 27 19:27:29 2009	(r192925)
@@ -113,13 +113,13 @@ struct ukbd_data {
 #define	MOD_WIN_R	0x80
 	uint8_t	reserved;
 	uint8_t	keycode[UKBD_NKEYCODE];
-} __packed;
+	uint8_t exten[8];
+};
 
 enum {
 	UKBD_INTR_DT,
-	UKBD_INTR_CS,
 	UKBD_CTRL_LED,
-	UKBD_N_TRANSFER = 3,
+	UKBD_N_TRANSFER,
 };
 
 struct ukbd_softc {
@@ -127,6 +127,8 @@ struct ukbd_softc {
 	keymap_t sc_keymap;
 	accentmap_t sc_accmap;
 	fkeytab_t sc_fkeymap[UKBD_NFKEY];
+	struct hid_location sc_loc_apple_eject;
+	struct hid_location sc_loc_apple_fn;
 	struct usb2_callout sc_callout;
 	struct ukbd_data sc_ndata;
 	struct ukbd_data sc_odata;
@@ -144,12 +146,14 @@ struct ukbd_softc {
 	uint32_t sc_buffered_char[2];
 #endif
 	uint32_t sc_flags;		/* flags */
-#define	UKBD_FLAG_COMPOSE    0x0001
-#define	UKBD_FLAG_POLLING    0x0002
-#define	UKBD_FLAG_SET_LEDS   0x0004
-#define	UKBD_FLAG_INTR_STALL 0x0008
-#define	UKBD_FLAG_ATTACHED   0x0010
-#define	UKBD_FLAG_GONE       0x0020
+#define	UKBD_FLAG_COMPOSE	0x0001
+#define	UKBD_FLAG_POLLING	0x0002
+#define	UKBD_FLAG_SET_LEDS	0x0004
+#define	UKBD_FLAG_ATTACHED	0x0010
+#define	UKBD_FLAG_GONE		0x0020
+#define	UKBD_FLAG_APPLE_EJECT	0x0040
+#define	UKBD_FLAG_APPLE_FN	0x0080
+#define	UKBD_FLAG_APPLE_SWAP	0x0100
 
 	int32_t	sc_mode;		/* input mode (K_XLATE,K_RAW,K_CODE) */
 	int32_t	sc_state;		/* shift/lock key state */
@@ -162,6 +166,8 @@ struct ukbd_softc {
 	uint8_t	sc_leds;		/* store for async led requests */
 	uint8_t	sc_iface_index;
 	uint8_t	sc_iface_no;
+	uint8_t sc_kbd_id;
+	uint8_t sc_led_id;
 };
 
 #define	KEY_ERROR	  0x01
@@ -451,16 +457,25 @@ ukbd_timeout(void *arg)
 	usb2_callout_reset(&sc->sc_callout, hz / 40, &ukbd_timeout, sc);
 }
 
-static void
-ukbd_clear_stall_callback(struct usb2_xfer *xfer)
-{
-	struct ukbd_softc *sc = xfer->priv_sc;
-	struct usb2_xfer *xfer_other = sc->sc_xfer[UKBD_INTR_DT];
+static uint8_t
+ukbd_apple_fn(uint8_t keycode) {
+	switch (keycode) {
+	case 0x28: return 0x49; /* RETURN -> INSERT */
+	case 0x2a: return 0x4c; /* BACKSPACE -> DEL */
+	case 0x50: return 0x4a; /* LEFT ARROW -> HOME */
+	case 0x4f: return 0x4d; /* RIGHT ARROW -> END */
+	case 0x52: return 0x4b; /* UP ARROW -> PGUP */
+	case 0x51: return 0x4e; /* DOWN ARROW -> PGDN */
+	default: return keycode;
+	}
+}
 
-	if (usb2_clear_stall_callback(xfer, xfer_other)) {
-		DPRINTF("stall cleared\n");
-		sc->sc_flags &= ~UKBD_FLAG_INTR_STALL;
-		usb2_transfer_start(xfer_other);
+static uint8_t
+ukbd_apple_swap(uint8_t keycode) {
+	switch (keycode) {
+	case 0x35: return 0x64;
+	case 0x64: return 0x35;
+	default: return keycode;
 	}
 }
 
@@ -470,18 +485,59 @@ ukbd_intr_callback(struct usb2_xfer *xfe
 	struct ukbd_softc *sc = xfer->priv_sc;
 	uint16_t len = xfer->actlen;
 	uint8_t i;
+	uint8_t offset;
+	uint8_t id;
+	uint8_t apple_fn;
+	uint8_t apple_eject;
 
 	switch (USB_GET_STATE(xfer)) {
 	case USB_ST_TRANSFERRED:
 		DPRINTF("actlen=%d bytes\n", len);
 
+		if (len == 0) {
+			DPRINTF("zero length data\n");
+			goto tr_setup;
+		}
+
+		if (sc->sc_kbd_id != 0) {
+			/* check and remove HID ID byte */
+			usb2_copy_out(xfer->frbuffers, 0, &id, 1);
+			if (id != sc->sc_kbd_id) {
+				DPRINTF("wrong HID ID\n");
+				goto tr_setup;
+			}
+			offset = 1;
+			len--;
+		} else {
+			offset = 0;
+		}
+
 		if (len > sizeof(sc->sc_ndata)) {
 			len = sizeof(sc->sc_ndata);
 		}
+
 		if (len) {
-			bzero(&sc->sc_ndata, sizeof(sc->sc_ndata));
-			usb2_copy_out(xfer->frbuffers, 0, &sc->sc_ndata, len);
+			memset(&sc->sc_ndata, 0, sizeof(sc->sc_ndata));
+			usb2_copy_out(xfer->frbuffers, offset, 
+			    &sc->sc_ndata, len);
+
+			if ((sc->sc_flags & UKBD_FLAG_APPLE_EJECT) &&
+			    hid_get_data((uint8_t *)&sc->sc_ndata,
+				len, &sc->sc_loc_apple_eject))
+				apple_eject = 1;
+			else
+				apple_eject = 0;
+
+			if ((sc->sc_flags & UKBD_FLAG_APPLE_FN) &&
+			    hid_get_data((uint8_t *)&sc->sc_ndata,
+				len, &sc->sc_loc_apple_fn))
+				apple_fn = 1;
+			else
+				apple_fn = 0;
 #if USB_DEBUG
+			DPRINTF("apple_eject=%u apple_fn=%u\n",
+			    apple_eject, apple_fn);
+
 			if (sc->sc_ndata.modifiers) {
 				DPRINTF("mod: 0x%04x\n", sc->sc_ndata.modifiers);
 			}
@@ -491,30 +547,42 @@ ukbd_intr_callback(struct usb2_xfer *xfe
 				}
 			}
 #endif					/* USB_DEBUG */
+
+			if (apple_fn) {
+				for (i = 0; i < UKBD_NKEYCODE; i++) {
+					sc->sc_ndata.keycode[i] = 
+					    ukbd_apple_fn(sc->sc_ndata.keycode[i]);
+				}
+			}
+
+			if (sc->sc_flags & UKBD_FLAG_APPLE_SWAP) {
+				for (i = 0; i < UKBD_NKEYCODE; i++) {
+					sc->sc_ndata.keycode[i] = 
+					    ukbd_apple_swap(sc->sc_ndata.keycode[i]);
+				}
+			}
+
 			ukbd_interrupt(sc);
 		}
 	case USB_ST_SETUP:
-		if (sc->sc_flags & UKBD_FLAG_INTR_STALL) {
-			usb2_transfer_start(sc->sc_xfer[UKBD_INTR_CS]);
-			return;
-		}
+tr_setup:
 		if (sc->sc_inputs < UKBD_IN_BUF_FULL) {
 			xfer->frlengths[0] = xfer->max_data_length;
 			usb2_start_hardware(xfer);
 		} else {
 			DPRINTF("input queue is full!\n");
 		}
-		return;
+		break;
 
 	default:			/* Error */
 		DPRINTF("error=%s\n", usb2_errstr(xfer->error));
 
 		if (xfer->error != USB_ERR_CANCELLED) {
 			/* try to clear stall first */
-			sc->sc_flags |= UKBD_FLAG_INTR_STALL;
-			usb2_transfer_start(sc->sc_xfer[UKBD_INTR_CS]);
+			xfer->flags.stall_pipe = 1;
+			goto tr_setup;
 		}
-		return;
+		break;
 	}
 }
 
@@ -522,7 +590,7 @@ static void
 ukbd_set_leds_callback(struct usb2_xfer *xfer)
 {
 	struct usb2_device_request req;
-	uint8_t buf[1];
+	uint8_t buf[2];
 	struct ukbd_softc *sc = xfer->priv_sc;
 
 	switch (USB_GET_STATE(xfer)) {
@@ -536,15 +604,24 @@ ukbd_set_leds_callback(struct usb2_xfer 
 			USETW2(req.wValue, UHID_OUTPUT_REPORT, 0);
 			req.wIndex[0] = sc->sc_iface_no;
 			req.wIndex[1] = 0;
-			USETW(req.wLength, 1);
+			req.wLength[1] = 0;
 
-			buf[0] = sc->sc_leds;
+			/* check if we need to prefix an ID byte */
+			if (sc->sc_led_id != 0) {
+				req.wLength[0] = 2;
+				buf[0] = sc->sc_led_id;
+				buf[1] = sc->sc_leds;
+			} else {
+				req.wLength[0] = 1;
+				buf[0] = sc->sc_leds;
+				buf[1] = 0;
+			}
 
 			usb2_copy_in(xfer->frbuffers, 0, &req, sizeof(req));
 			usb2_copy_in(xfer->frbuffers + 1, 0, buf, sizeof(buf));
 
 			xfer->frlengths[0] = sizeof(req);
-			xfer->frlengths[1] = sizeof(buf);
+			xfer->frlengths[1] = req.wLength[0];
 			xfer->nframes = 2;
 			usb2_start_hardware(xfer);
 		}
@@ -567,21 +644,11 @@ static const struct usb2_config ukbd_con
 		.callback = &ukbd_intr_callback,
 	},
 
-	[UKBD_INTR_CS] = {
-		.type = UE_CONTROL,
-		.endpoint = 0x00,	/* Control pipe */
-		.direction = UE_DIR_ANY,
-		.bufsize = sizeof(struct usb2_device_request),
-		.callback = &ukbd_clear_stall_callback,
-		.timeout = 1000,	/* 1 second */
-		.interval = 50,	/* 50ms */
-	},
-
 	[UKBD_CTRL_LED] = {
 		.type = UE_CONTROL,
 		.endpoint = 0x00,	/* Control pipe */
 		.direction = UE_DIR_ANY,
-		.bufsize = sizeof(struct usb2_device_request) + 1,
+		.bufsize = sizeof(struct usb2_device_request) + 8,
 		.callback = &ukbd_set_leds_callback,
 		.timeout = 1000,	/* 1 second */
 	},
@@ -620,8 +687,11 @@ ukbd_attach(device_t dev)
 	struct usb2_attach_arg *uaa = device_get_ivars(dev);
 	int32_t unit = device_get_unit(dev);
 	keyboard_t *kbd = &sc->sc_kbd;
+	void *hid_ptr = NULL;
 	usb2_error_t err;
+	uint32_t flags;
 	uint16_t n;
+	uint16_t hid_len;
 
 	mtx_assert(&Giant, MA_OWNED);
 
@@ -669,6 +739,46 @@ ukbd_attach(device_t dev)
 	 */
 	KBD_PROBE_DONE(kbd);
 
+	/* figure out if there is an ID byte in the data */
+	err = usb2_req_get_hid_desc(uaa->device, NULL, &hid_ptr,
+	    &hid_len, M_TEMP, uaa->info.bIfaceIndex);
+	if (err == 0) {
+		uint8_t temp_id;
+
+		/* investigate if this is an Apple Keyboard */
+		if (hid_locate(hid_ptr, hid_len,
+		    HID_USAGE2(HUP_CONSUMER, HUG_APPLE_EJECT),
+		    hid_input, 0, &sc->sc_loc_apple_eject, &flags,
+		    &sc->sc_kbd_id)) {
+			if (flags & HIO_VARIABLE)
+				sc->sc_flags |= UKBD_FLAG_APPLE_EJECT | 
+				    UKBD_FLAG_APPLE_SWAP;
+			if (hid_locate(hid_ptr, hid_len,
+			    HID_USAGE2(0xFFFF, 0x0003),
+			    hid_input, 0, &sc->sc_loc_apple_fn, &flags,
+			    &temp_id)) {
+				if (flags & HIO_VARIABLE)
+					sc->sc_flags |= UKBD_FLAG_APPLE_FN |
+					    UKBD_FLAG_APPLE_SWAP;
+				if (temp_id != sc->sc_kbd_id) {
+					DPRINTF("HID IDs mismatch\n");
+				}
+			}
+		} else {
+			/* 
+			 * Assume the first HID ID contains the
+			 * keyboard data
+			 */
+			hid_report_size(hid_ptr, hid_len,
+			    hid_input, &sc->sc_kbd_id);
+		}
+
+		/* investigate if we need an ID-byte for the leds */
+		hid_report_size(hid_ptr, hid_len, hid_output, &sc->sc_led_id);
+
+		free(hid_ptr, M_TEMP);
+	}
+
 	/* ignore if SETIDLE fails, hence it is not crucial */
 	err = usb2_req_set_idle(sc->sc_udev, &Giant, sc->sc_iface_index, 0, 0);
 

Modified: head/sys/dev/usb/usbhid.h
==============================================================================
--- head/sys/dev/usb/usbhid.h	Wed May 27 19:21:29 2009	(r192924)
+++ head/sys/dev/usb/usbhid.h	Wed May 27 19:27:29 2009	(r192925)
@@ -128,6 +128,7 @@ struct usb2_hid_descriptor {
 #define	HUG_SYSTEM_MENU_LEFT	0x008b
 #define	HUG_SYSTEM_MENU_UP	0x008c
 #define	HUG_SYSTEM_MENU_DOWN	0x008d
+#define	HUG_APPLE_EJECT		0x00b8
 
 /* Usages Digitizers */
 #define	HUD_UNDEFINED		0x0000

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 19:28:05 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 669C5106566B;
	Wed, 27 May 2009 19:28:05 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5394F8FC1F;
	Wed, 27 May 2009 19:28:05 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RJS5f5009343;
	Wed, 27 May 2009 19:28:05 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RJS5tg009337;
	Wed, 27 May 2009 19:28:05 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200905271928.n4RJS5tg009337@svn.freebsd.org>
From: Ed Schouten 
Date: Wed, 27 May 2009 19:28:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192926 - in head: . lib/libc/gen share/man/man3 sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 19:28:06 -0000

Author: ed
Date: Wed May 27 19:28:04 2009
New Revision: 192926
URL: http://svn.freebsd.org/changeset/base/192926

Log:
  Rename the queue macros I introduced last year.
  
  Last year I added SLIST_REMOVE_NEXT and STAILQ_REMOVE_NEXT, to remove
  entries behind an element in the list, using O(1) time. I recently
  discovered NetBSD also has a similar macro, called SLIST_REMOVE_AFTER.
  In my opinion this approach is a lot better:
  
  - It doesn't have the unused first argument of the list pointer. I added
    this, mainly because OpenBSD also had it.
  
  - The _AFTER suffix makes a lot more sense, because it is related to
    SLIST_INSERT_AFTER. _NEXT is only used to iterate through the list.
  
  The reason why I want to rename this now, is to make sure we don't
  release a major version with the badly named macros.

Modified:
  head/ObsoleteFiles.inc
  head/lib/libc/gen/popen.c
  head/share/man/man3/Makefile
  head/share/man/man3/queue.3
  head/sys/sys/queue.h

Modified: head/ObsoleteFiles.inc
==============================================================================
--- head/ObsoleteFiles.inc	Wed May 27 19:27:29 2009	(r192925)
+++ head/ObsoleteFiles.inc	Wed May 27 19:28:04 2009	(r192926)
@@ -14,6 +14,9 @@
 # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last.
 #
 
+# 20090527: renaming of S{LIST,TAILQ}_REMOVE_NEXT() to _REMOVE_AFTER()
+OLD_FILES+=usr/share/man/man3/SLIST_REMOVE_NEXT.3.gz
+OLD_FILES+=usr/share/man/man3/STAILQ_REMOVE_NEXT.3.gz
 # 20090527: removal of legacy USB stack
 OLD_FILES+=usr/include/legacy/dev/usb/dsbr100io.h
 OLD_FILES+=usr/include/legacy/dev/usb/ehcireg.h

Modified: head/lib/libc/gen/popen.c
==============================================================================
--- head/lib/libc/gen/popen.c	Wed May 27 19:27:29 2009	(r192925)
+++ head/lib/libc/gen/popen.c	Wed May 27 19:28:04 2009	(r192926)
@@ -191,7 +191,7 @@ pclose(iop)
 	if (last == NULL)
 		SLIST_REMOVE_HEAD(&pidlist, next);
 	else
-		SLIST_REMOVE_NEXT(&pidlist, last, next);
+		SLIST_REMOVE_AFTER(last, next);
 	THREAD_UNLOCK();
 
 	(void)fclose(iop);

Modified: head/share/man/man3/Makefile
==============================================================================
--- head/share/man/man3/Makefile	Wed May 27 19:27:29 2009	(r192925)
+++ head/share/man/man3/Makefile	Wed May 27 19:28:04 2009	(r192926)
@@ -65,8 +65,8 @@ MLINKS+=	queue.3 LIST_EMPTY.3 \
 		queue.3 SLIST_INSERT_HEAD.3 \
 		queue.3 SLIST_NEXT.3 \
 		queue.3 SLIST_REMOVE.3 \
+		queue.3 SLIST_REMOVE_AFTER.3 \
 		queue.3 SLIST_REMOVE_HEAD.3 \
-		queue.3 SLIST_REMOVE_NEXT.3 \
 		queue.3 STAILQ_CONCAT.3 \
 		queue.3 STAILQ_EMPTY.3 \
 		queue.3 STAILQ_ENTRY.3 \
@@ -82,8 +82,8 @@ MLINKS+=	queue.3 LIST_EMPTY.3 \
 		queue.3 STAILQ_LAST.3 \
 		queue.3 STAILQ_NEXT.3 \
 		queue.3 STAILQ_REMOVE.3 \
+		queue.3 STAILQ_REMOVE_AFTER.3 \
 		queue.3 STAILQ_REMOVE_HEAD.3 \
-		queue.3 STAILQ_REMOVE_NEXT.3 \
 		queue.3 TAILQ_CONCAT.3 \
 		queue.3 TAILQ_EMPTY.3 \
 		queue.3 TAILQ_ENTRY.3 \

Modified: head/share/man/man3/queue.3
==============================================================================
--- head/share/man/man3/queue.3	Wed May 27 19:27:29 2009	(r192925)
+++ head/share/man/man3/queue.3	Wed May 27 19:28:04 2009	(r192926)
@@ -47,8 +47,8 @@
 .Nm SLIST_INSERT_AFTER ,
 .Nm SLIST_INSERT_HEAD ,
 .Nm SLIST_NEXT ,
+.Nm SLIST_REMOVE_AFTER ,
 .Nm SLIST_REMOVE_HEAD ,
-.Nm SLIST_REMOVE_NEXT ,
 .Nm SLIST_REMOVE ,
 .Nm STAILQ_CONCAT ,
 .Nm STAILQ_EMPTY ,
@@ -64,8 +64,8 @@
 .Nm STAILQ_INSERT_TAIL ,
 .Nm STAILQ_LAST ,
 .Nm STAILQ_NEXT ,
+.Nm STAILQ_REMOVE_AFTER ,
 .Nm STAILQ_REMOVE_HEAD ,
-.Nm STAILQ_REMOVE_NEXT ,
 .Nm STAILQ_REMOVE ,
 .Nm LIST_EMPTY ,
 .Nm LIST_ENTRY ,
@@ -115,8 +115,8 @@ lists and tail queues
 .Fn SLIST_INSERT_AFTER "TYPE *listelm" "TYPE *elm" "SLIST_ENTRY NAME"
 .Fn SLIST_INSERT_HEAD "SLIST_HEAD *head" "TYPE *elm" "SLIST_ENTRY NAME"
 .Fn SLIST_NEXT "TYPE *elm" "SLIST_ENTRY NAME"
+.Fn SLIST_REMOVE_AFTER "TYPE *elm" "SLIST_ENTRY NAME"
 .Fn SLIST_REMOVE_HEAD "SLIST_HEAD *head" "SLIST_ENTRY NAME"
-.Fn SLIST_REMOVE_NEXT "SLIST_HEAD *head" "TYPE *elm" "SLIST_ENTRY NAME"
 .Fn SLIST_REMOVE "SLIST_HEAD *head" "TYPE *elm" "TYPE" "SLIST_ENTRY NAME"
 .\"
 .Fn STAILQ_CONCAT "STAILQ_HEAD *head1" "STAILQ_HEAD *head2"
@@ -133,8 +133,8 @@ lists and tail queues
 .Fn STAILQ_INSERT_TAIL "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME"
 .Fn STAILQ_LAST "STAILQ_HEAD *head" "TYPE" "STAILQ_ENTRY NAME"
 .Fn STAILQ_NEXT "TYPE *elm" "STAILQ_ENTRY NAME"
+.Fn STAILQ_REMOVE_AFTER "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME"
 .Fn STAILQ_REMOVE_HEAD "STAILQ_HEAD *head" "STAILQ_ENTRY NAME"
-.Fn STAILQ_REMOVE_NEXT "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME"
 .Fn STAILQ_REMOVE "STAILQ_HEAD *head" "TYPE *elm" "TYPE" "STAILQ_ENTRY NAME"
 .\"
 .Fn LIST_EMPTY "LIST_HEAD *head"
@@ -380,6 +380,14 @@ The macro
 returns the next element in the list.
 .Pp
 The macro
+.Nm SLIST_REMOVE_AFTER
+removes the element after
+.Fa elm
+from the list. Unlike
+.Fa SLIST_REMOVE ,
+this macro does not traverse the entire list.
+.Pp
+The macro
 .Nm SLIST_REMOVE_HEAD
 removes the element
 .Fa elm
@@ -391,14 +399,6 @@ this macro instead of the generic
 macro.
 .Pp
 The macro
-.Nm SLIST_REMOVE_NEXT
-removes the element after
-.Fa elm
-from the list. Unlike
-.Fa SLIST_REMOVE ,
-this macro does not traverse the entire list.
-.Pp
-The macro
 .Nm SLIST_REMOVE
 removes the element
 .Fa elm
@@ -564,6 +564,14 @@ The macro
 returns the next item on the tail queue, or NULL this item is the last.
 .Pp
 The macro
+.Nm STAILQ_REMOVE_AFTER
+removes the element after
+.Fa elm
+from the tail queue. Unlike
+.Fa STAILQ_REMOVE ,
+this macro does not traverse the entire tail queue.
+.Pp
+The macro
 .Nm STAILQ_REMOVE_HEAD
 removes the element at the head of the tail queue.
 For optimum efficiency,
@@ -573,14 +581,6 @@ use this macro explicitly rather than th
 macro.
 .Pp
 The macro
-.Nm STAILQ_REMOVE_NEXT
-removes the element after
-.Fa elm
-from the tail queue. Unlike
-.Fa STAILQ_REMOVE ,
-this macro does not traverse the entire tail queue.
-.Pp
-The macro
 .Nm STAILQ_REMOVE
 removes the element
 .Fa elm

Modified: head/sys/sys/queue.h
==============================================================================
--- head/sys/sys/queue.h	Wed May 27 19:27:29 2009	(r192925)
+++ head/sys/sys/queue.h	Wed May 27 19:28:04 2009	(r192926)
@@ -96,8 +96,8 @@
  * _INSERT_AFTER		+	+	+	+
  * _INSERT_TAIL			-	-	+	+
  * _CONCAT			-	-	+	+
+ * _REMOVE_AFTER		+	-	+	-
  * _REMOVE_HEAD			+	-	+	-
- * _REMOVE_NEXT			+	-	+	-
  * _REMOVE			+	+	+	+
  *
  */
@@ -196,12 +196,12 @@ struct {								\
 		struct type *curelm = SLIST_FIRST((head));		\
 		while (SLIST_NEXT(curelm, field) != (elm))		\
 			curelm = SLIST_NEXT(curelm, field);		\
-		SLIST_REMOVE_NEXT(head, curelm, field);			\
+		SLIST_REMOVE_AFTER(curelm, field);			\
 	}								\
 	TRASHIT((elm)->field.sle_next);					\
 } while (0)
 
-#define SLIST_REMOVE_NEXT(head, elm, field) do {				\
+#define SLIST_REMOVE_AFTER(elm, field) do {				\
 	SLIST_NEXT(elm, field) =					\
 	    SLIST_NEXT(SLIST_NEXT(elm, field), field);			\
 } while (0)
@@ -292,7 +292,7 @@ struct {								\
 		struct type *curelm = STAILQ_FIRST((head));		\
 		while (STAILQ_NEXT(curelm, field) != (elm))		\
 			curelm = STAILQ_NEXT(curelm, field);		\
-		STAILQ_REMOVE_NEXT(head, curelm, field);		\
+		STAILQ_REMOVE_AFTER(head, curelm, field);		\
 	}								\
 	TRASHIT((elm)->field.stqe_next);				\
 } while (0)
@@ -303,7 +303,7 @@ struct {								\
 		(head)->stqh_last = &STAILQ_FIRST((head));		\
 } while (0)
 
-#define STAILQ_REMOVE_NEXT(head, elm, field) do {			\
+#define STAILQ_REMOVE_AFTER(head, elm, field) do {			\
 	if ((STAILQ_NEXT(elm, field) =					\
 	     STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL)	\
 		(head)->stqh_last = &STAILQ_NEXT((elm), field);		\

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 19:31:51 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 18C68106567E;
	Wed, 27 May 2009 19:31:51 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 05D0D8FC27;
	Wed, 27 May 2009 19:31:51 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RJVoqj009473;
	Wed, 27 May 2009 19:31:50 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RJVoI3009472;
	Wed, 27 May 2009 19:31:50 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <200905271931.n4RJVoI3009472@svn.freebsd.org>
From: Adrian Chadd 
Date: Wed, 27 May 2009 19:31:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192927 - head/sys/dev/xen/netfront
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 19:31:52 -0000

Author: adrian
Date: Wed May 27 19:31:50 2009
New Revision: 192927
URL: http://svn.freebsd.org/changeset/base/192927

Log:
  Delete useless #ifdef; make it more obvious if setting TSO fails.

Modified:
  head/sys/dev/xen/netfront/netfront.c

Modified: head/sys/dev/xen/netfront/netfront.c
==============================================================================
--- head/sys/dev/xen/netfront/netfront.c	Wed May 27 19:28:04 2009	(r192926)
+++ head/sys/dev/xen/netfront/netfront.c	Wed May 27 19:31:50 2009	(r192927)
@@ -352,9 +352,6 @@ xennet_get_rx_ref(struct netfront_info *
 	return ref;
 }
 
-#ifdef DEBUG
-
-#endif
 #define IPRINTK(fmt, args...) \
     printf("[XEN] " fmt, ##args)
 #define WPRINTK(fmt, args...) \
@@ -1738,7 +1735,7 @@ xn_ioctl(struct ifnet *ifp, u_long cmd, 
 				ifp->if_capenable |= IFCAP_TSO4;
 				ifp->if_hwassist |= CSUM_TSO;
 			} else {
-				DPRINTK("Xen requires tx checksum offload"
+				IPRINTK("Xen requires tx checksum offload"
 				    " be enabled to use TSO\n");
 				error = EINVAL;
 			}

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 19:41:29 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DCD131065A1D;
	Wed, 27 May 2009 19:41:29 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CB7F38FC27;
	Wed, 27 May 2009 19:41:29 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RJfTtS009783;
	Wed, 27 May 2009 19:41:29 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RJfT1H009782;
	Wed, 27 May 2009 19:41:29 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Message-Id: <200905271941.n4RJfT1H009782@svn.freebsd.org>
From: Rick Macklem 
Date: Wed, 27 May 2009 19:41:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192928 - head/sys/fs/nfsclient
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 19:41:30 -0000

Author: rmacklem
Date: Wed May 27 19:41:29 2009
New Revision: 192928
URL: http://svn.freebsd.org/changeset/base/192928

Log:
  Fix handling of NFSv4 Close operations in ncl_inactive(). Only
  do them for NFSv4 and flush writes to the server before doing
  the Close(s), as required. Also, use the a_td argument instead of
  curthread.
  
  Approved by:	kib (mentor)

Modified:
  head/sys/fs/nfsclient/nfs_clnode.c

Modified: head/sys/fs/nfsclient/nfs_clnode.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clnode.c	Wed May 27 19:31:50 2009	(r192927)
+++ head/sys/fs/nfsclient/nfs_clnode.c	Wed May 27 19:41:29 2009	(r192928)
@@ -185,17 +185,23 @@ ncl_inactive(struct vop_inactive_args *a
 {
 	struct nfsnode *np;
 	struct sillyrename *sp;
-	struct thread *td = curthread;	/* XXX */
 
 	np = VTONFS(ap->a_vp);
 	if (prtactive && vrefcnt(ap->a_vp) != 0)
 		vprint("ncl_inactive: pushing active", ap->a_vp);
 
-	/*
-	 * Since mmap()'d files to I/O after VOP_CLOSE(), the NFSv4 Close
-	 * operations are delayed until now.
-	 */
-	(void) nfsrpc_close(ap->a_vp, 1, td);
+	if (NFS_ISV4(ap->a_vp)) {
+		/*
+		 * Since mmap()'d files do I/O after VOP_CLOSE(), the NFSv4
+		 * Close operations are delayed until now. Any dirty buffers
+		 * must be flushed before the close, so that the stateid is
+		 * available for the writes.
+		 */
+		if (nfscl_mustflush(ap->a_vp))
+			(void) ncl_flush(ap->a_vp, MNT_WAIT, NULL, ap->a_td,
+			    1);
+		(void) nfsrpc_close(ap->a_vp, 1, ap->a_td);
+	}
 
 	if (ap->a_vp->v_type != VDIR) {
 		sp = np->n_sillyrename;
@@ -203,7 +209,7 @@ ncl_inactive(struct vop_inactive_args *a
 	} else
 		sp = NULL;
 	if (sp) {
-		(void)ncl_vinvalbuf(ap->a_vp, 0, td, 1);
+		(void)ncl_vinvalbuf(ap->a_vp, 0, ap->a_td, 1);
 		/*
 		 * Remove the silly file that was rename'd earlier
 		 */

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 19:45:04 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B72A51065AF6;
	Wed, 27 May 2009 19:45:04 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A5A448FC20;
	Wed, 27 May 2009 19:45:04 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RJj4WC009912;
	Wed, 27 May 2009 19:45:04 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RJj4Fo009911;
	Wed, 27 May 2009 19:45:04 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200905271945.n4RJj4Fo009911@svn.freebsd.org>
From: Andrew Thompson 
Date: Wed, 27 May 2009 19:45:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192929 - head/sys/dev/sound/usb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 19:45:05 -0000

Author: thompsa
Date: Wed May 27 19:45:04 2009
New Revision: 192929
URL: http://svn.freebsd.org/changeset/base/192929

Log:
  Provide a workaround for USB devices that do not support mono or stereo
  operation by overriding the channel count.
  
  Submitted by:	Hans Petter Selasky
  Reported by:	MIHIRA Sanpei Yoshiro

Modified:
  head/sys/dev/sound/usb/uaudio.c

Modified: head/sys/dev/sound/usb/uaudio.c
==============================================================================
--- head/sys/dev/sound/usb/uaudio.c	Wed May 27 19:41:29 2009	(r192928)
+++ head/sys/dev/sound/usb/uaudio.c	Wed May 27 19:45:04 2009	(r192929)
@@ -97,6 +97,7 @@ SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, def
 
 #define	MAKE_WORD(h,l) (((h) << 8) | (l))
 #define	BIT_TEST(bm,bno) (((bm)[(bno) / 8] >> (7 - ((bno) % 8))) & 1)
+#define	UAUDIO_MAX_CHAN(x) (((x) < 2) ? (x) : 2)	/* XXX fixme later */
 
 struct uaudio_mixer_node {
 	int32_t	minval;
@@ -936,7 +937,7 @@ uaudio_chan_fill_info_sub(struct uaudio_
 #endif
 
 			wFormat = UGETW(asid->wFormatTag);
-			bChannels = asf1d->bNrChannels;
+			bChannels = UAUDIO_MAX_CHAN(asf1d->bNrChannels);
 			bBitResolution = asf1d->bBitResolution;
 
 			if (asf1d->bSamFreqType == 0) {
@@ -1020,7 +1021,8 @@ uaudio_chan_fill_info_sub(struct uaudio_
 						chan->usb2_cfg =
 						    uaudio_cfg_play;
 
-					sample_size = ((chan->p_asf1d->bNrChannels *
+					sample_size = ((
+					    UAUDIO_MAX_CHAN(chan->p_asf1d->bNrChannels) *
 					    chan->p_asf1d->bBitResolution) / 8);
 
 					/*
@@ -1334,7 +1336,7 @@ uaudio_chan_init(struct uaudio_softc *sc
 
 	ch->pcm_cap.fmtlist[0] = ch->p_fmt->freebsd_fmt;
 
-	if (ch->p_asf1d->bNrChannels == 2) {
+	if (ch->p_asf1d->bNrChannels >= 2) {
 		ch->pcm_cap.fmtlist[0] |= AFMT_STEREO;
 	}
 	ch->pcm_cap.fmtlist[1] = 0;

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 19:56:52 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0CD3F106566B;
	Wed, 27 May 2009 19:56:52 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id ED6EF8FC19;
	Wed, 27 May 2009 19:56:51 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RJupRH010215;
	Wed, 27 May 2009 19:56:51 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RJup4u010211;
	Wed, 27 May 2009 19:56:51 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Message-Id: <200905271956.n4RJup4u010211@svn.freebsd.org>
From: Rick Macklem 
Date: Wed, 27 May 2009 19:56:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192930 - in head/sbin: mount mount_nfs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 19:56:52 -0000

Author: rmacklem
Date: Wed May 27 19:56:51 2009
New Revision: 192930
URL: http://svn.freebsd.org/changeset/base/192930

Log:
  Add support for the experimental nfs client to mount_nfs. The
  experimental client is used when the fstype is "newnfs" or the "nfsv4"
  option is specified. It includes the addition of the option:
    gssname - to specify a client side initiator host based principal name
  which is specific to NFSv4.
  It also includes a change to mount.c, so that it knows about
  mount_newnfs, but not mount_nfs4.
  
  Reviewed by:	dfr
  Approved by:	kib (mentor)

Modified:
  head/sbin/mount/mount.c
  head/sbin/mount_nfs/Makefile
  head/sbin/mount_nfs/mount_nfs.8
  head/sbin/mount_nfs/mount_nfs.c

Modified: head/sbin/mount/mount.c
==============================================================================
--- head/sbin/mount/mount.c	Wed May 27 19:45:04 2009	(r192929)
+++ head/sbin/mount/mount.c	Wed May 27 19:56:51 2009	(r192930)
@@ -140,7 +140,7 @@ use_mountprog(const char *vfstype)
 	 */
 	unsigned int i;
 	const char *fs[] = {
-	"cd9660", "mfs", "msdosfs", "nfs", "nfs4", "ntfs",
+	"cd9660", "mfs", "msdosfs", "newnfs", "nfs", "ntfs",
 	"nwfs", "nullfs", "portalfs", "smbfs", "udf", "unionfs",
 	NULL
 	};

Modified: head/sbin/mount_nfs/Makefile
==============================================================================
--- head/sbin/mount_nfs/Makefile	Wed May 27 19:45:04 2009	(r192929)
+++ head/sbin/mount_nfs/Makefile	Wed May 27 19:56:51 2009	(r192930)
@@ -5,13 +5,15 @@
 PROG=	mount_nfs
 SRCS=	mount_nfs.c getmntopts.c mounttab.c
 MAN=	mount_nfs.8
-MLINKS=	mount_nfs.8
+MLINKS=	mount_nfs.8 mount_newnfs.8
 
 MOUNT=	${.CURDIR}/../mount
 UMNTALL= ${.CURDIR}/../../usr.sbin/rpc.umntall
 CFLAGS+= -DNFS -I${MOUNT} -I${UMNTALL}
 WARNS?=	3
 
+LINKS=	${BINDIR}/mount_nfs ${BINDIR}/mount_newnfs
+
 .PATH: ${MOUNT} ${UMNTALL}
 
 .include 

Modified: head/sbin/mount_nfs/mount_nfs.8
==============================================================================
--- head/sbin/mount_nfs/mount_nfs.8	Wed May 27 19:45:04 2009	(r192929)
+++ head/sbin/mount_nfs/mount_nfs.8	Wed May 27 19:56:51 2009	(r192930)
@@ -132,6 +132,47 @@ short.
 .It Cm fg
 Same as not specifying
 .Cm bg .
+.It Cm gssname Ns = Ns Aq Ar name
+For the RPCSEC_GSS security flavors, such as krb5, krb5i and krb5p when being
+used for an NFSv4 mount, this option specifies the host based principal
+name to be used for the state related operations SetClientID,
+SetClientIDConfirm, ReleaseLockOwner and Renew.
+It is also used for other operations, such as Getattr for
+.Xr statfs 2
+information and during open/lock state recovery.
+An entry for this principal must exist
+in the client machine's default keytab file.
+If possible, the keytab entry should be created using DES_CBC_CRC
+encryption. If another encryption algorithm is used, the sysctl variable
+.Va vfs.newnfs.keytab_enctype
+must be set to the numeric value representing that encryption algorithm.
+(The numeric values can be found in /usr/include/krb5_asn1.h. Look
+for constants named ETYPE_xxx.)
+If this option is given
+as a name without an ``@'', such as ``root'' or ``nfs'',
+``@'' will be appended to it.
+.sp
+If this option is not specified
+for NFSv4 mounts using krb5[ip], the above operations will be done using the
+user principal for the user that performed the mount. This
+only works for mounts done by a user other than ``root'' and the user must
+have a valid TGT in their credentials cache at the time the mount is done.
+(Setting the
+.Va vfs.usermount
+to non-zero will allow users to do mounts.)
+Because the user's TGT is used to acquire credentials for these operations,
+it is important that that user's TGT does not expire before
+.Xr umount 8
+is done.
+.It Cm allgssname
+This option can be used along with
+.Cm gssname
+to indicate that all accesses to the mount point are to be done using
+the host based principal specified by the
+.Cm gssname
+option.
+This might be useful for nfsv4 mounts using sec=krb5[ip] that are being accessed
+by batch utilities over long periods of time.
 .It Cm hard
 Same as not specifying
 .Cm soft .
@@ -157,6 +198,12 @@ then version 2).
 Note that NFS version 2 has a file size limit of 2 gigabytes.
 .It Cm nfsv3
 Use the NFS Version 3 protocol.
+.It Cm nfsv4
+Use the NFS Version 4 protocol.
+This option will force the mount to use the experimental nfs subsystem and
+TCP transport.
+To use the experimental nfs subsystem for nfsv2 and nfsv3 mounts, you
+must specify the ``newnfs'' file system type instead of ``nfs''.
 .It Cm noconn
 For UDP mount points, do not do a
 .Xr connect 2 .
@@ -192,6 +239,11 @@ servers on the client.
 Note that this option will only be honored when performing the
 initial mount, it will be silently ignored if used while updating
 the mount options.
+.It Cm principal
+For the RPCSEC_GSS security flavors, such as krb5, krb5i and krb5p,
+this option sets the name of the host based principal name expected
+by the server. This option overrides the default, which will be
+``nfs@'' and should normally be sufficient.
 .It Cm noresvport
 Do
 .Em not
@@ -200,8 +252,10 @@ use a reserved socket port number (see b
 Use specified port number for NFS requests.
 The default is to query the portmapper for the NFS port.
 .It Cm rdirplus
-Used with NQNFS and NFSV3 to specify that the \fBReaddirPlus\fR RPC should
+Used with NFSV3 to specify that the \fBReaddirPlus\fR RPC should
 be used.
+For NFSV4, setting this option has a similar effect, in that it will make
+the Readdir Operation get more attributes.
 This option reduces RPC traffic for cases such as
 .Dq "ls -l" ,
 but tends to flood the attribute and name caches with prefetched entries.
@@ -248,6 +302,18 @@ with the
 option to see what the
 .Dq "fragments dropped due to timeout"
 value is.)
+.It Cm sec Ns = Ns Aq Ar flavor
+This option specifies what security flavor should be used for the mount.
+Currently, they are:
+.Bd -literal
+krb5 -  Use KerberosV authentication
+krb5i - Use KerberosV authentication and
+        apply integrity checksums to RPCs
+krb5p - Use KerberosV authentication and
+        encrypt the RPC data
+sys -   The default AUTH_SYS, which uses a
+        uid + gid list authenticator
+.Ed
 .It Cm soft
 A soft mount, which implies that file system calls will fail
 after
@@ -368,8 +434,19 @@ Same as
 .Sh SEE ALSO
 .Xr nmount 2 ,
 .Xr unmount 2 ,
+.Xr nfsv4 4 ,
 .Xr fstab 5 ,
+.Xr gssd 8 ,
 .Xr mount 8 ,
 .Xr nfsd 8 ,
 .Xr nfsiod 8 ,
 .Xr showmount 8
+.Sh BUGS
+Since nfsv4 performs open/lock operations that have their ordering strictly
+enforced by the server, the options
+.Cm intr
+and
+.Cm soft
+cannot be safely used.
+.Cm hard
+nfsv4 mounts are strongly recommended.

Modified: head/sbin/mount_nfs/mount_nfs.c
==============================================================================
--- head/sbin/mount_nfs/mount_nfs.c	Wed May 27 19:45:04 2009	(r192929)
+++ head/sbin/mount_nfs/mount_nfs.c	Wed May 27 19:56:51 2009	(r192930)
@@ -45,6 +45,8 @@ static char sccsid[] = "@(#)mount_nfs.c	
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -111,11 +113,13 @@ int addrlen = 0;
 u_char *fh = NULL;
 int fhsize = 0;
 int secflavor = -1;
+int got_principal = 0;
 
 enum mountmode {
 	ANY,
 	V2,
 	V3,
+	V4
 } mountmode = ANY;
 
 /* Return codes for nfs_tryproto. */
@@ -150,11 +154,13 @@ main(int argc, char *argv[])
 	int osversion;
 	char *name, *p, *spec, *fstype;
 	char mntpath[MAXPATHLEN], errmsg[255];
+	char hostname[MAXHOSTNAMELEN + 1], *gssname, gssn[MAXHOSTNAMELEN + 50];
 
 	mntflags = 0;
 	iov = NULL;
 	iovlen = 0;
 	memset(errmsg, 0, sizeof(errmsg));
+	gssname = NULL;
 
 	fstype = strrchr(argv[0], '_');
 	if (fstype == NULL)
@@ -242,6 +248,9 @@ main(int argc, char *argv[])
 				} else if (strcmp(opt, "fg") == 0) {
 					/* same as not specifying -o bg */
 					pass_flag_to_nmount=0;
+				} else if (strcmp(opt, "gssname") == 0) {
+					pass_flag_to_nmount = 0;
+					gssname = val;
 				} else if (strcmp(opt, "mntudp") == 0) {
 					mnttcp_ok = 0;
 					nfsproto = IPPROTO_UDP;
@@ -262,12 +271,21 @@ main(int argc, char *argv[])
 					mountmode = V2;
 				} else if (strcmp(opt, "nfsv3") == 0) {
 					mountmode = V3;
+				} else if (strcmp(opt, "nfsv4") == 0) {
+					pass_flag_to_nmount=0;
+					mountmode = V4;
+					fstype = "newnfs";
+					nfsproto = IPPROTO_TCP;
+					if (portspec == NULL)
+						portspec = "2049";
 				} else if (strcmp(opt, "port") == 0) {
 					pass_flag_to_nmount=0;
 					asprintf(&portspec, "%d",
 					    atoi(val));
 					if (portspec == NULL)
 						err(1, "asprintf");
+				} else if (strcmp(opt, "principal") == 0) {
+					got_principal = 1;
 				} else if (strcmp(opt, "sec") == 0) {
 					/*
 					 * Don't add this option to
@@ -363,6 +381,37 @@ main(int argc, char *argv[])
 		/* The default is to keep retrying forever. */
 		retrycnt = 0;
 
+	/*
+	 * If the experimental nfs subsystem is loaded into the kernel
+	 * and the regular one is not, use it. Otherwise, use it if the
+	 * fstype is set to "newnfs", either via "mount -t newnfs ..."
+	 * or by specifying an nfsv4 mount.
+	 */
+	if (modfind("nfscl") >= 0 && modfind("nfs") < 0) {
+		fstype = "newnfs";
+	} else if (strcmp(fstype, "newnfs") == 0) {
+		if (modfind("nfscl") < 0) {
+			/* Not present in kernel, try loading it */
+			if (kldload("nfscl") < 0 ||
+			    modfind("nfscl") < 0)
+				errx(1, "nfscl is not available");
+		}
+	}
+
+	/*
+	 * Add the fqdn to the gssname, as required.
+	 */
+	if (gssname != NULL) {
+		if (strchr(gssname, '@') == NULL &&
+		    gethostname(hostname, MAXHOSTNAMELEN) == 0) {
+			snprintf(gssn, sizeof (gssn), "%s@%s", gssname,
+			    hostname);
+			gssname = gssn;
+		}
+		build_iovec(&iov, &iovlen, "gssname", gssname,
+		    strlen(gssname) + 1);
+	}
+
 	if (!getnfsargs(spec, &iov, &iovlen))
 		exit(1);
 
@@ -652,7 +701,7 @@ getnfsargs(char *spec, struct iovec **io
 	int ecode, speclen, remoteerr;
 	char *hostp, *delimp, *errstr;
 	size_t len;
-	static char nam[MNAMELEN + 1];
+	static char nam[MNAMELEN + 1], pname[MAXHOSTNAMELEN + 5];
 
 	if ((delimp = strrchr(spec, ':')) != NULL) {
 		hostp = spec;
@@ -699,7 +748,7 @@ getnfsargs(char *spec, struct iovec **io
 		hints.ai_socktype = SOCK_DGRAM;
 
 	if (getaddrinfo(hostp, portspec, &hints, &ai_nfs) != 0) {
-		hints.ai_flags = 0;
+		hints.ai_flags = AI_CANONNAME;
 		if ((ecode = getaddrinfo(hostp, portspec, &hints, &ai_nfs))
 		    != 0) {
 			if (portspec == NULL)
@@ -709,6 +758,18 @@ getnfsargs(char *spec, struct iovec **io
 				    gai_strerror(ecode));
 			return (0);
 		}
+
+		/*
+		 * For a Kerberized nfs mount where the "principal"
+		 * argument has not been set, add it here.
+		 */
+		if (got_principal == 0 && secflavor >= 0 &&
+		    secflavor != AUTH_SYS && ai_nfs->ai_canonname != NULL) {
+			snprintf(pname, sizeof (pname), "nfs@%s",
+			    ai_nfs->ai_canonname);
+			build_iovec(iov, iovlen, "principal", pname,
+			    strlen(pname) + 1);
+		}
 	}
 
 	ret = TRYRET_LOCALERR;
@@ -834,7 +895,9 @@ nfs_tryproto(struct addrinfo *ai, char *
 	}
 
 tryagain:
-	if (trymntmode == V2) {
+	if (trymntmode == V4) {
+		nfsvers = 4;
+	} else if (trymntmode == V2) {
 		nfsvers = 2;
 		mntvers = 1;
 	} else {
@@ -894,8 +957,7 @@ tryagain:
 	try.tv_sec = 10;
 	try.tv_usec = 0;
 	stat = clnt_call(clp, NFSPROC_NULL, (xdrproc_t)xdr_void, NULL,
-			 (xdrproc_t)xdr_void, NULL,
-	    try);
+			 (xdrproc_t)xdr_void, NULL, try);
 	if (stat != RPC_SUCCESS) {
 		if (stat == RPC_PROGVERSMISMATCH && trymntmode == ANY) {
 			clnt_destroy(clp);
@@ -910,6 +972,30 @@ tryagain:
 	}
 	clnt_destroy(clp);
 
+	/*
+	 * For NFSv4, there is no mount protocol.
+	 */
+	if (trymntmode == V4) {
+		/*
+		 * Store the server address in nfsargsp, making
+		 * sure to copy any locally allocated structures.
+		 */
+		addrlen = nfs_nb.len;
+		addr = malloc(addrlen);
+		if (addr == NULL)
+			err(1, "malloc");
+		bcopy(nfs_nb.buf, addr, addrlen);
+
+		build_iovec(iov, iovlen, "addr", addr, addrlen);
+		secname = sec_num_to_name(secflavor);
+		if (secname != NULL)
+			build_iovec(iov, iovlen, "sec", secname, (size_t)-1);
+		build_iovec(iov, iovlen, "nfsv4", NULL, 0);
+		build_iovec(iov, iovlen, "dirpath", spec, (size_t)-1);
+
+		return (TRYRET_SUCCESS);
+	}
+
 	/* Send the RPCMNT_MOUNT RPC to get the root filehandle. */
 	try.tv_sec = 10;
 	try.tv_usec = 0;

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 20:13:36 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C890B10656CE;
	Wed, 27 May 2009 20:13:36 +0000 (UTC) (envelope-from gnn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B5CAF8FC21;
	Wed, 27 May 2009 20:13:36 +0000 (UTC) (envelope-from gnn@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RKDaMf010717;
	Wed, 27 May 2009 20:13:36 GMT (envelope-from gnn@svn.freebsd.org)
Received: (from gnn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RKDar2010716;
	Wed, 27 May 2009 20:13:36 GMT (envelope-from gnn@svn.freebsd.org)
Message-Id: <200905272013.n4RKDar2010716@svn.freebsd.org>
From: "George V. Neville-Neil" 
Date: Wed, 27 May 2009 20:13:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192933 - head/sys/dev/cxgb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 20:13:37 -0000

Author: gnn
Date: Wed May 27 20:13:36 2009
New Revision: 192933
URL: http://svn.freebsd.org/changeset/base/192933

Log:
  Rework interrupt bringup and teardown.
  
  Calculate the exact number of vectors we'll use before calling
  pci_alloc_msix.  Don't grab nine all the time.
  
  Call cxgb_setup_interrupts once per T3, not once per port.  Ditto
  for cxgb_teardown_interrupts.
  
  Don't leak resources when interrupt setup fails in the middle.
  
  Obtained from:	Navdeep Parhar
  MFC after:	10 days

Modified:
  head/sys/dev/cxgb/cxgb_main.c

Modified: head/sys/dev/cxgb/cxgb_main.c
==============================================================================
--- head/sys/dev/cxgb/cxgb_main.c	Wed May 27 20:03:09 2009	(r192932)
+++ head/sys/dev/cxgb/cxgb_main.c	Wed May 27 20:13:36 2009	(r192933)
@@ -82,8 +82,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
-static int cxgb_setup_msix(adapter_t *, int);
-static void cxgb_teardown_msix(adapter_t *);
+static int cxgb_setup_interrupts(adapter_t *);
+static void cxgb_teardown_interrupts(adapter_t *);
 static void cxgb_init(void *);
 static void cxgb_init_locked(struct port_info *);
 static void cxgb_stop_locked(struct port_info *);
@@ -175,8 +175,6 @@ static struct cdevsw cxgb_cdevsw = {
 static devclass_t	cxgb_port_devclass;
 DRIVER_MODULE(cxgb, cxgbc, cxgb_port_driver, cxgb_port_devclass, 0, 0);
 
-#define SGE_MSIX_COUNT (SGE_QSETS + 1)
-
 /*
  * The driver uses the best interrupt scheme available on a platform in the
  * order MSI-X, MSI, legacy pin interrupts.  This parameter determines which
@@ -517,46 +515,52 @@ cxgb_controller_attach(device_t dev)
 	    (sc->msix_regs_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
 	    &sc->msix_regs_rid, RF_ACTIVE)) != NULL) {
 
-		msi_needed = sc->msi_count = SGE_MSIX_COUNT;
-
-		if (((error = pci_alloc_msix(dev, &sc->msi_count)) != 0) ||
-		    (sc->msi_count != msi_needed)) {
-			device_printf(dev, "msix allocation failed - msi_count = %d"
-			    " msi_needed=%d will try msi err=%d\n", sc->msi_count,
-			    msi_needed, error);
+		if (multiq)
+			port_qsets = min(SGE_QSETS/sc->params.nports, mp_ncpus);
+		msi_needed = sc->msi_count = sc->params.nports * port_qsets + 1;
+
+		if (pci_msix_count(dev) == 0 ||
+		    (error = pci_alloc_msix(dev, &sc->msi_count)) != 0 ||
+		    sc->msi_count != msi_needed) {
+			device_printf(dev, "alloc msix failed - "
+				      "msi_count=%d, msi_needed=%d, err=%d; "
+				      "will try MSI\n", sc->msi_count,
+				      msi_needed, error);
 			sc->msi_count = 0;
+			port_qsets = 1;
 			pci_release_msi(dev);
 			bus_release_resource(dev, SYS_RES_MEMORY,
 			    sc->msix_regs_rid, sc->msix_regs_res);
 			sc->msix_regs_res = NULL;
 		} else {
 			sc->flags |= USING_MSIX;
-			sc->cxgb_intr = t3_intr_msix;
+			sc->cxgb_intr = cxgb_async_intr;
+			device_printf(dev,
+				      "using MSI-X interrupts (%u vectors)\n",
+				      sc->msi_count);
 		}
 	}
 
 	if ((msi_allowed >= 1) && (sc->msi_count == 0)) {
 		sc->msi_count = 1;
-		if (pci_alloc_msi(dev, &sc->msi_count)) {
-			device_printf(dev, "alloc msi failed - will try INTx\n");
+		if ((error = pci_alloc_msi(dev, &sc->msi_count)) != 0) {
+			device_printf(dev, "alloc msi failed - "
+				      "err=%d; will try INTx\n", error);
 			sc->msi_count = 0;
+			port_qsets = 1;
 			pci_release_msi(dev);
 		} else {
 			sc->flags |= USING_MSI;
-			sc->irq_rid = 1;
 			sc->cxgb_intr = t3_intr_msi;
+			device_printf(dev, "using MSI interrupts\n");
 		}
 	}
 #endif
 	if (sc->msi_count == 0) {
 		device_printf(dev, "using line interrupts\n");
-		sc->irq_rid = 0;
 		sc->cxgb_intr = t3b_intr;
 	}
 
-	if ((sc->flags & USING_MSIX) && multiq)
-		port_qsets = min((SGE_QSETS/(sc)->params.nports), mp_ncpus);
-	
 	/* Create a private taskqueue thread for handling driver events */
 #ifdef TASKQUEUE_CURRENT	
 	sc->tq = taskqueue_create("cxgb_taskq", M_NOWAIT,
@@ -695,7 +699,7 @@ cxgb_controller_detach(device_t dev)
  *  3. Detaching all of the port devices created during the
  *     cxgb_controller_attach() routine.
  *  4. Removing the device children created via cxgb_controller_attach().
- *  5. Releaseing PCI resources associated with the device.
+ *  5. Releasing PCI resources associated with the device.
  *  6. Turning off the offload support, iff it was turned on.
  *  7. Destroying the mutexes created in cxgb_controller_attach().
  *
@@ -730,6 +734,8 @@ cxgb_free(struct adapter *sc)
 			device_printf(sc->dev, "failed to delete child port\n");
 	}
 
+	cxgb_teardown_interrupts(sc);
+
 #ifdef MSI_SUPPORTED
 	if (sc->flags & (USING_MSI | USING_MSIX)) {
 		device_printf(sc->dev, "releasing msi message(s)\n");
@@ -737,11 +743,12 @@ cxgb_free(struct adapter *sc)
 	} else {
 		device_printf(sc->dev, "no msi message to release\n");
 	}
-#endif
+
 	if (sc->msix_regs_res != NULL) {
 		bus_release_resource(sc->dev, SYS_RES_MEMORY, sc->msix_regs_rid,
 		    sc->msix_regs_res);
 	}
+#endif
 
 	if (sc->tq != NULL) {
 		taskqueue_free(sc->tq);
@@ -821,91 +828,116 @@ setup_sge_qsets(adapter_t *sc)
 }
 
 static void
-cxgb_teardown_msix(adapter_t *sc) 
+cxgb_teardown_interrupts(adapter_t *sc)
 {
-	int i, nqsets;
-	
-	for (nqsets = i = 0; i < (sc)->params.nports; i++) 
-		nqsets += sc->port[i].nqsets;
+	int i;
 
-	for (i = 0; i < nqsets; i++) {
-		if (sc->msix_intr_tag[i] != NULL) {
-			bus_teardown_intr(sc->dev, sc->msix_irq_res[i],
-			    sc->msix_intr_tag[i]);
-			sc->msix_intr_tag[i] = NULL;
-		}
-		if (sc->msix_irq_res[i] != NULL) {
-			bus_release_resource(sc->dev, SYS_RES_IRQ,
-			    sc->msix_irq_rid[i], sc->msix_irq_res[i]);
-			sc->msix_irq_res[i] = NULL;
+	for (i = 0; i < SGE_QSETS; i++) {
+		if (sc->msix_intr_tag[i] == NULL) {
+
+			/* Should have been setup fully or not at all */
+			KASSERT(sc->msix_irq_res[i] == NULL &&
+				sc->msix_irq_rid[i] == 0,
+				("%s: half-done interrupt (%d).", __func__, i));
+
+			continue;
 		}
+
+		bus_teardown_intr(sc->dev, sc->msix_irq_res[i],
+				  sc->msix_intr_tag[i]);
+		bus_release_resource(sc->dev, SYS_RES_IRQ, sc->msix_irq_rid[i],
+				     sc->msix_irq_res[i]);
+
+		sc->msix_irq_res[i] = sc->msix_intr_tag[i] = NULL;
+		sc->msix_irq_rid[i] = 0;
 	}
-}
 
-static int
-cxgb_setup_msix(adapter_t *sc, int msix_count)
-{
-	int i, j, k, nqsets, rid;
+	if (sc->intr_tag) {
+		KASSERT(sc->irq_res != NULL,
+			("%s: half-done interrupt.", __func__));
 
-	/* The first message indicates link changes and error conditions */
-	sc->irq_rid = 1;
-	if ((sc->irq_res = bus_alloc_resource_any(sc->dev, SYS_RES_IRQ,
-	   &sc->irq_rid, RF_SHAREABLE | RF_ACTIVE)) == NULL) {
-		device_printf(sc->dev, "Cannot allocate msix interrupt\n");
-		return (EINVAL);
+		bus_teardown_intr(sc->dev, sc->irq_res, sc->intr_tag);
+		bus_release_resource(sc->dev, SYS_RES_IRQ, sc->irq_rid,
+				     sc->irq_res);
+
+		sc->irq_res = sc->intr_tag = NULL;
+		sc->irq_rid = 0;
 	}
+}
 
-	if (bus_setup_intr(sc->dev, sc->irq_res, INTR_MPSAFE|INTR_TYPE_NET,
+static int
+cxgb_setup_interrupts(adapter_t *sc)
+{
+	struct resource *res;
+	void *tag;
+	int i, rid, err, intr_flag = sc->flags & (USING_MSI | USING_MSIX);
+
+	sc->irq_rid = intr_flag ? 1 : 0;
+	sc->irq_res = bus_alloc_resource_any(sc->dev, SYS_RES_IRQ, &sc->irq_rid,
+					     RF_SHAREABLE | RF_ACTIVE);
+	if (sc->irq_res == NULL) {
+		device_printf(sc->dev, "Cannot allocate interrupt (%x, %u)\n",
+			      intr_flag, sc->irq_rid);
+		err = EINVAL;
+		sc->irq_rid = 0;
+	} else {
+		err = bus_setup_intr(sc->dev, sc->irq_res,
+				     INTR_MPSAFE | INTR_TYPE_NET,
 #ifdef INTR_FILTERS
-		NULL,
+				     NULL,
 #endif
-		cxgb_async_intr, sc, &sc->intr_tag)) {
-		device_printf(sc->dev, "Cannot set up interrupt\n");
-		return (EINVAL);
+				     sc->cxgb_intr, sc, &sc->intr_tag);
+
+		if (err) {
+			device_printf(sc->dev,
+				      "Cannot set up interrupt (%x, %u, %d)\n",
+				      intr_flag, sc->irq_rid, err);
+			bus_release_resource(sc->dev, SYS_RES_IRQ, sc->irq_rid,
+					     sc->irq_res);
+			sc->irq_res = sc->intr_tag = NULL;
+			sc->irq_rid = 0;
+		}
 	}
-	for (i = k = 0; i < (sc)->params.nports; i++) {
-		nqsets = sc->port[i].nqsets;
-		for (j = 0; j < nqsets; j++, k++) {
-			struct sge_qset *qs = &sc->sge.qs[k];
-
-			rid = k + 2;
-			if (cxgb_debug)
-				printf("rid=%d ", rid);
-			if ((sc->msix_irq_res[k] = bus_alloc_resource_any(
-			    sc->dev, SYS_RES_IRQ, &rid,
-			    RF_SHAREABLE | RF_ACTIVE)) == NULL) {
-				device_printf(sc->dev, "Cannot allocate "
-				    "interrupt for message %d\n", rid);
-				return (EINVAL);
-			}
-			sc->msix_irq_rid[k] = rid;
-			if (bus_setup_intr(sc->dev, sc->msix_irq_res[k],
-				INTR_MPSAFE|INTR_TYPE_NET,
+
+	/* That's all for INTx or MSI */
+	if (!(intr_flag & USING_MSIX) || err)
+		return (err);
+
+	for (i = 0; i < sc->msi_count - 1; i++) {
+		rid = i + 2;
+		res = bus_alloc_resource_any(sc->dev, SYS_RES_IRQ, &rid,
+					     RF_SHAREABLE | RF_ACTIVE);
+		if (res == NULL) {
+			device_printf(sc->dev, "Cannot allocate interrupt "
+				      "for message %d\n", rid);
+			err = EINVAL;
+			break;
+		}
+
+		err = bus_setup_intr(sc->dev, res, INTR_MPSAFE | INTR_TYPE_NET,
 #ifdef INTR_FILTERS
-				NULL,
-#endif
-				t3_intr_msix, qs, &sc->msix_intr_tag[k])) {
-				device_printf(sc->dev, "Cannot set up "
-				    "interrupt for message %d\n", rid);
-				return (EINVAL);
-				
-			}
-#if 0			
-#ifdef IFNET_MULTIQUEUE			
-			if (multiq) {
-				int vector = rman_get_start(sc->msix_irq_res[k]);
-				if (bootverbose)
-					device_printf(sc->dev, "binding vector=%d to cpu=%d\n", vector, k % mp_ncpus);
-				intr_bind(vector, k % mp_ncpus);
-			}
-#endif
+				     NULL,
 #endif
+				     t3_intr_msix, &sc->sge.qs[i], &tag);
+		if (err) {
+			device_printf(sc->dev, "Cannot set up interrupt "
+				      "for message %d (%d)\n", rid, err);
+			bus_release_resource(sc->dev, SYS_RES_IRQ, rid, res);
+			break;
 		}
+
+		sc->msix_irq_rid[i] = rid;
+		sc->msix_irq_res[i] = res;
+		sc->msix_intr_tag[i] = tag;
 	}
 
-	return (0);
+	if (err)
+		cxgb_teardown_interrupts(sc);
+
+	return (err);
 }
 
+
 static int
 cxgb_port_probe(device_t dev)
 {
@@ -1075,39 +1107,12 @@ cxgb_port_attach(device_t dev)
 	bcopy(IF_LLADDR(p->ifp), p->hw_addr, ETHER_ADDR_LEN);
 	t3_sge_init_port(p);
 
-	/* If it's MSI or INTx, allocate a single interrupt for everything */
-	if ((sc->flags & USING_MSIX) == 0) {
-		if ((sc->irq_res = bus_alloc_resource_any(sc->dev, SYS_RES_IRQ,
-		   &sc->irq_rid, RF_SHAREABLE | RF_ACTIVE)) == NULL) {
-			device_printf(sc->dev, "Cannot allocate interrupt rid=%d\n",
-			    sc->irq_rid);
-			err = EINVAL;
-			goto out;
-		}
-		device_printf(sc->dev, "allocated irq_res=%p\n", sc->irq_res);
-
-		if (bus_setup_intr(sc->dev, sc->irq_res, INTR_MPSAFE|INTR_TYPE_NET,
-#ifdef INTR_FILTERS
-			NULL,
-#endif			
-			sc->cxgb_intr, sc, &sc->intr_tag)) {
-			device_printf(sc->dev, "Cannot set up interrupt\n");
-			err = EINVAL;
-			goto irq_err;
-		}
-	} else {
-		cxgb_setup_msix(sc, sc->msi_count);
-	}
-
 #if defined(LINK_ATTACH)	
 	cxgb_link_start(p);
 	t3_link_changed(sc, p->port_id);
 #endif
-out:
+
 	return (err);
-irq_err:
-	CH_ERR(sc, "request_irq failed, err %d\n", err);
-	goto out;
 }
 
 /*
@@ -1131,29 +1136,12 @@ cxgb_port_detach(device_t dev)
 		destroy_dev(p->port_cdev);
 	
 	ether_ifdetach(p->ifp);
-	printf("waiting for callout to stop ...");
-	printf("done\n");
 
 	PORT_LOCK(p);
 	if (p->ifp->if_drv_flags & IFF_DRV_RUNNING) 
 		cxgb_stop_locked(p);
 	PORT_UNLOCK(p);
 	
-	if (sc->intr_tag != NULL) {
-		bus_teardown_intr(sc->dev, sc->irq_res, sc->intr_tag);
-		sc->intr_tag = NULL;
-	}
-	if (sc->irq_res != NULL) {
-		device_printf(sc->dev, "de-allocating interrupt irq_rid=%d irq_res=%p\n",
-		    sc->irq_rid, sc->irq_res);
-		bus_release_resource(sc->dev, SYS_RES_IRQ, sc->irq_rid,
-		    sc->irq_res);
-		sc->irq_res = NULL;
-	}
-	
-	if (sc->flags & USING_MSIX) 
-		cxgb_teardown_msix(sc);
-	
 	callout_drain(&sc->cxgb_tick_ch);
 	callout_drain(&sc->sge_timer_ch);
 	
@@ -1740,12 +1728,17 @@ cxgb_up(struct adapter *sc)
 			goto out;
 
 		setup_rss(sc);
+
+		t3_intr_clear(sc);
+		err = cxgb_setup_interrupts(sc);
+		if (err)
+			goto out;
+
 		t3_add_configured_sysctls(sc);
 		sc->flags |= FULL_INIT_DONE;
 	}
 
 	t3_intr_clear(sc);
-
 	t3_sge_start(sc);
 	t3_intr_enable(sc);
 

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 22:02:55 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 27D371065672;
	Wed, 27 May 2009 22:02:55 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 13E738FC16;
	Wed, 27 May 2009 22:02:55 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RM2tOm013430;
	Wed, 27 May 2009 22:02:55 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RM2s2M013427;
	Wed, 27 May 2009 22:02:54 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Message-Id: <200905272202.n4RM2s2M013427@svn.freebsd.org>
From: Rick Macklem 
Date: Wed, 27 May 2009 22:02:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192934 - head/usr.sbin/mountd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 22:02:56 -0000

Author: rmacklem
Date: Wed May 27 22:02:54 2009
New Revision: 192934
URL: http://svn.freebsd.org/changeset/base/192934

Log:
  Modify mountd to handle the experimental nfs server as well as the
  regular one. It now takes a "-4" command line argument to force it
  to use the experimental server. Otherwise it will use the regular
  server unless the experimental server is the only one linked into
  the kernel. A third kind of line has been added to /etc/exports,
  which is specific to NFSv4 and defines where the NFSv4 tree root is
  and can be used to limit access to NFSv4 state handling operations
  that do not use any file handle.
  
  Approved by:	kib (mentor)

Modified:
  head/usr.sbin/mountd/exports.5
  head/usr.sbin/mountd/mountd.8
  head/usr.sbin/mountd/mountd.c

Modified: head/usr.sbin/mountd/exports.5
==============================================================================
--- head/usr.sbin/mountd/exports.5	Wed May 27 20:13:36 2009	(r192933)
+++ head/usr.sbin/mountd/exports.5	Wed May 27 22:02:54 2009	(r192934)
@@ -54,11 +54,11 @@ Appendix I.
 Each line in the file
 (other than comment lines that begin with a #)
 specifies the mount point(s) and export flags within one local server
-file system for one or more hosts.
+file system or the NFSv4 tree root for one or more hosts.
 A long line may be split over several lines by ending all but the
 last line with a backslash
 .Pq Ql \e .
-A host may be specified only once for each local file system on the
+A host may be specified only once for each local file or the NFSv4 tree root on the
 server and there may be only one default entry for each server
 file system that applies to all other hosts.
 The latter exports the file system to the
@@ -69,7 +69,7 @@ be used only when the file system contai
 In a mount entry,
 the first field(s) specify the directory path(s) within a server file system
 that can be mounted on by the corresponding client(s).
-There are two forms of this specification.
+There are three forms of this specification.
 The first is to list all mount points as absolute
 directory paths separated by whitespace.
 The second is to specify the pathname of the root of the file system
@@ -81,6 +81,8 @@ including regular files if the
 .Fl r
 option is used on
 .Xr mountd 8 .
+The third form has the string ``V4:'' followed by a single absolute path
+name, to sepcify the NFSv4 tree root.
 The pathnames must not have any symbolic links in them and should not have
 any
 .Dq Pa \&.
@@ -95,6 +97,9 @@ exported to the host set.
 The option flags specify whether the file system
 is exported read-only or read-write and how the client UID is mapped to
 user credentials on the server.
+For the NFSv4 tree root, the only option that can be specified in this
+section is
+.Fl sec .
 .Pp
 Export options are specified as follows:
 .Pp
@@ -282,6 +287,32 @@ on
 .Li re2
 interface.
 .Pp
+For the third form which specifies the NFSv4 tree root, the directory path
+specifies the location within the server's file system tree which is the
+root of the NFSv4 tree.
+All entries of this form must specify the same directory path.
+This location can be any directory and does not
+need to be within an exported file system. If it is not in an exported
+file system, a very limited set of operations are permitted, so that an
+NFSv4 client can traverse the tree to an exported file system.
+Although parts of the NFSv4 tree can be non-exported, the entire NFSv4 tree
+must consist of local file systems capable of being exported via NFS.
+NFSv4 does not use the mount protocol and does permit clients to cross server
+mount point boundaries, although not all clients are capable of crossing the
+mount points.
+.Pp
+The
+.Fl sec
+option on these line(s) specifies what security flavors may be used for
+NFSv4 operations that do not use file handles. Since these operations
+(SetClientID, SetClientIDConfirm, Renew, DelegPurge and ReleaseLockOnwer)
+allocate/modify state in the server, it is possible to restrict some clients to
+the use of the krb5[ip] security flavors, via this option.
+See the
+.Sx EXAMPLES
+section below.
+This third form is meaningless for NFSv2 and NFSv3 and is ignored for them.
+.Pp
 The
 .Xr mountd 8
 utility can be made to re-read the
@@ -318,6 +349,8 @@ the default remote mount-point file
 /cdrom -alldirs,quiet,ro -network 192.168.33.0 -mask 255.255.255.0
 /private -sec=krb5i
 /secret -sec=krb5p
+V4: /	-sec=krb5:krb5i:krb5p -network 131.104.48 -mask 255.255.255.0
+V4: /	-sec=sys:krb5:krb5i:krb5p grumpy.cis.uoguelph.ca
 .Ed
 .Pp
 Given that
@@ -433,6 +466,12 @@ The file system rooted at
 .Pa /secret
 will also be exported using Kerberos 5 authentication and all messages
 used to access it will be encrypted.
+.Pp
+For the experimental server, the NFSv4 tree is rooted at ``/'',
+and any client within the 131.104.48 subnet is permitted to perform NFSv4 state
+operations on the server, so long as valid Kerberos credentials are provided.
+The machine grumpy.cis.uoguelph.ca is permitted to perform NFSv4 state
+operations on the server using AUTH_SYS credentials, as well as Kerberos ones.
 .Sh SEE ALSO
 .Xr netgroup 5 ,
 .Xr mountd 8 ,

Modified: head/usr.sbin/mountd/mountd.8
==============================================================================
--- head/usr.sbin/mountd/mountd.8	Wed May 27 20:13:36 2009	(r192933)
+++ head/usr.sbin/mountd/mountd.8	Wed May 27 22:02:54 2009	(r192934)
@@ -38,7 +38,7 @@
 mount requests
 .Sh SYNOPSIS
 .Nm
-.Op Fl 2dlnr
+.Op Fl 24dlnr
 .Op Fl h Ar bindip
 .Op Fl p Ar port
 .Op Ar exportsfile ...
@@ -63,6 +63,18 @@ Allow the administrator to force clients
 version 2
 .Tn NFS
 protocol to mount file systems from this server.
+.It Fl 4
+Forces
+.Nm
+to try and start the experimental server that includes NFSv4 support in it.
+If this flag isn't specified, the experimental server will only be started
+if it is linked into the kernel and the regular one isn't.
+.br
+ie. The kernel is built with the following:
+.Bd -literal -offset indent -compact
+# options	NFSSERVER
+options		NFSD
+.Ed
 .It Fl d
 Output debugging information.
 .Nm
@@ -171,6 +183,7 @@ the current list of remote mounted file 
 .Sh SEE ALSO
 .Xr nfsstat 1 ,
 .Xr kldload 2 ,
+.Xr nfsv4 4 ,
 .Xr exports 5 ,
 .Xr nfsd 8 ,
 .Xr rpcbind 8 ,

Modified: head/usr.sbin/mountd/mountd.c
==============================================================================
--- head/usr.sbin/mountd/mountd.c	Wed May 27 20:13:36 2009	(r192933)
+++ head/usr.sbin/mountd/mountd.c	Wed May 27 22:02:54 2009	(r192934)
@@ -46,13 +46,13 @@ static char sccsid[] = "@(#)mountd.c	8.1
 __FBSDID("$FreeBSD$");
 
 #include 
-#include 
 #include 
-#include 
-#include 
-#include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -61,8 +61,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
+#include 
+
 #include 
 
 #include 
@@ -233,6 +236,11 @@ char *svcport_str = NULL;
 int opt_flags;
 static int have_v6 = 1;
 
+int v4root_phase = 0;
+char v4root_dirpath[PATH_MAX + 1];
+int run_v4server = 0;
+int has_publicfh = 0;
+
 struct pidfh *pfh = NULL;
 /* Bits for opt_flags above */
 #define	OP_MAPROOT	0x01
@@ -288,17 +296,15 @@ main(argc, argv)
 		have_v6 = 0;
 	else
 		close(s);
-	if (modfind("nfsserver") < 0) {
-		/* Not present in kernel, try loading it */
-		if (kldload("nfsserver") < 0 || modfind("nfsserver") < 0)
-			errx(1, "NFS server is not available or loadable");
-	}
 
-	while ((c = getopt(argc, argv, "2dh:lnp:r")) != -1)
+	while ((c = getopt(argc, argv, "24dh:lnp:r")) != -1)
 		switch (c) {
 		case '2':
 			force_v2 = 1;
 			break;
+		case '4':
+			run_v4server = 1;
+			break;
 		case 'n':
 			resvport_only = 0;
 			break;
@@ -343,6 +349,26 @@ main(argc, argv)
 		default:
 			usage();
 		};
+
+	/*
+	 * If the "-4" option was specified OR only the nfsd module is
+	 * found in the server, run "nfsd".
+	 * Otherwise, try and run "nfsserver".
+	 */
+	if (run_v4server > 0) {
+		if (modfind("nfsd") < 0) {
+			/* Not present in kernel, try loading it */
+			if (kldload("nfsd") < 0 || modfind("nfsd") < 0)
+				errx(1, "NFS server is not available");
+		}
+	} else if (modfind("nfsserver") < 0 && modfind("nfsd") >= 0) {
+		run_v4server = 1;
+	} else if (modfind("nfsserver") < 0) {
+		/* Not present in kernel, try loading it */
+		if (kldload("nfsserver") < 0 || modfind("nfsserver") < 0)
+			errx(1, "NFS server is not available");
+	}
+
 	argc -= optind;
 	argv += optind;
 	grphead = (struct grouplist *)NULL;
@@ -707,7 +733,7 @@ static void
 usage()
 {
 	fprintf(stderr,
-		"usage: mountd [-2] [-d] [-l] [-n] [-p ] [-r] "
+		"usage: mountd [-2] [-4] [-d] [-l] [-n] [-p ] [-r] "
 		"[-h ] [export_file ...]\n");
 	exit(1);
 }
@@ -1146,6 +1172,7 @@ get_exportlist_one()
 	char *cp, *endcp, *dirp, *hst, *usr, *dom, savedc;
 	int len, has_host, exflags, got_nondir, dirplen, netgrp;
 
+	v4root_phase = 0;
 	dirhead = (struct dirlist *)NULL;
 	while (get_line()) {
 		if (debug)
@@ -1164,6 +1191,24 @@ get_exportlist_one()
 		got_nondir = 0;
 		opt_flags = 0;
 		ep = (struct exportlist *)NULL;
+		dirp = NULL;
+
+		/*
+		 * Handle the V4 root dir.
+		 */
+		if (*cp == 'V' && *(cp + 1) == '4' && *(cp + 2) == ':') {
+			/*
+			 * V4: just indicates that it is the v4 root point,
+			 * so skip over that and set v4root_phase.
+			 */
+			if (v4root_phase > 0) {
+				syslog(LOG_ERR, "V4:duplicate line, ignored");
+				goto nextline;
+			}
+			v4root_phase = 1;
+			cp += 3;
+			nextfield(&cp, &endcp);
+		}
 
 		/*
 		 * Create new exports list entry
@@ -1191,6 +1236,13 @@ get_exportlist_one()
 			} else if (*cp == '/') {
 			    savedc = *endcp;
 			    *endcp = '\0';
+			    if (v4root_phase > 1) {
+				    if (dirp != NULL) {
+					syslog(LOG_ERR, "Multiple V4 dirs");
+					getexp_err(ep, tgrp);
+					goto nextline;
+				    }
+			    }
 			    if (check_dirpath(cp) &&
 				statfs(cp, &fsb) >= 0) {
 				if (got_nondir) {
@@ -1198,43 +1250,68 @@ get_exportlist_one()
 				    getexp_err(ep, tgrp);
 				    goto nextline;
 				}
-				if (ep) {
-				    if (ep->ex_fs.val[0] != fsb.f_fsid.val[0] ||
-					ep->ex_fs.val[1] != fsb.f_fsid.val[1]) {
+				if (v4root_phase == 1) {
+				    if (dirp != NULL) {
+					syslog(LOG_ERR, "Multiple V4 dirs");
+					getexp_err(ep, tgrp);
+					goto nextline;
+				    }
+				    if (strlen(v4root_dirpath) == 0) {
+					strlcpy(v4root_dirpath, cp,
+					    sizeof (v4root_dirpath));
+				    } else if (strcmp(v4root_dirpath, cp)
+					!= 0) {
+					syslog(LOG_ERR,
+					    "different V4 dirpath %s", cp);
 					getexp_err(ep, tgrp);
 					goto nextline;
 				    }
+				    dirp = cp;
+				    v4root_phase = 2;
+				    got_nondir = 1;
+				    ep = get_exp();
 				} else {
+				    if (ep) {
+					if (ep->ex_fs.val[0] !=
+					    fsb.f_fsid.val[0] ||
+					    ep->ex_fs.val[1] !=
+					    fsb.f_fsid.val[1]) {
+						getexp_err(ep, tgrp);
+						goto nextline;
+					}
+				    } else {
+					/*
+					 * See if this directory is already
+					 * in the list.
+					 */
+					ep = ex_search(&fsb.f_fsid);
+					if (ep == (struct exportlist *)NULL) {
+					    ep = get_exp();
+					    ep->ex_fs = fsb.f_fsid;
+					    ep->ex_fsdir = (char *)malloc
+					        (strlen(fsb.f_mntonname) + 1);
+					    if (ep->ex_fsdir)
+						strcpy(ep->ex_fsdir,
+						    fsb.f_mntonname);
+					    else
+						out_of_mem();
+					    if (debug)
+						warnx(
+						  "making new ep fs=0x%x,0x%x",
+						  fsb.f_fsid.val[0],
+						  fsb.f_fsid.val[1]);
+					} else if (debug)
+					    warnx("found ep fs=0x%x,0x%x",
+						fsb.f_fsid.val[0],
+						fsb.f_fsid.val[1]);
+				    }
+
 				    /*
-				     * See if this directory is already
-				     * in the list.
+				     * Add dirpath to export mount point.
 				     */
-				    ep = ex_search(&fsb.f_fsid);
-				    if (ep == (struct exportlist *)NULL) {
-					ep = get_exp();
-					ep->ex_fs = fsb.f_fsid;
-					ep->ex_fsdir = (char *)
-					    malloc(strlen(fsb.f_mntonname) + 1);
-					if (ep->ex_fsdir)
-					    strcpy(ep->ex_fsdir,
-						fsb.f_mntonname);
-					else
-					    out_of_mem();
-					if (debug)
-						warnx("making new ep fs=0x%x,0x%x",
-						    fsb.f_fsid.val[0],
-						    fsb.f_fsid.val[1]);
-				    } else if (debug)
-					warnx("found ep fs=0x%x,0x%x",
-					    fsb.f_fsid.val[0],
-					    fsb.f_fsid.val[1]);
+				    dirp = add_expdir(&dirhead, cp, len);
+				    dirplen = len;
 				}
-
-				/*
-				 * Add dirpath to export mount point.
-				 */
-				dirp = add_expdir(&dirhead, cp, len);
-				dirplen = len;
 			    } else {
 				getexp_err(ep, tgrp);
 				goto nextline;
@@ -1314,6 +1391,12 @@ get_exportlist_one()
 			}
 		}
 
+		if (v4root_phase == 1) {
+			syslog(LOG_ERR, "V4:root, no dirp, ignored");
+			getexp_err(ep, tgrp);
+			goto nextline;
+		}
+
 		/*
 		 * Loop through hosts, pushing the exports into the kernel.
 		 * After loop, tgrp points to the start of the list and
@@ -1329,6 +1412,12 @@ get_exportlist_one()
 		} while (grp->gr_next && (grp = grp->gr_next));
 
 		/*
+		 * For V4: don't enter in mount lists.
+		 */
+		if (v4root_phase > 0 && v4root_phase <= 2)
+			goto nextline;
+
+		/*
 		 * Success. Update the data structures.
 		 */
 		if (has_host) {
@@ -1358,6 +1447,7 @@ get_exportlist_one()
 			ep->ex_flag |= EX_LINKED;
 		}
 nextline:
+		v4root_phase = 0;
 		if (dirhead) {
 			free_dir(dirhead);
 			dirhead = (struct dirlist *)NULL;
@@ -1382,7 +1472,9 @@ get_exportlist()
 	int dirplen, num, i;
 	int iovlen;
 	int done;
+	struct nfsex_args eargs;
 
+	v4root_dirpath[0] = '\0';
 	bzero(&export, sizeof(export));
 	export.ex_flags = MNT_DELEXPORT;
 	dirp = NULL;
@@ -1411,6 +1503,21 @@ get_exportlist()
 	grphead = (struct grouplist *)NULL;
 
 	/*
+	 * and the old V4 root dir.
+	 */
+	bzero(&eargs, sizeof (eargs));
+	eargs.export.ex_flags = MNT_DELEXPORT;
+	if (run_v4server > 0 &&
+	    nfssvc(NFSSVC_V4ROOTEXPORT, (caddr_t)&eargs) < 0 &&
+	    errno != ENOENT)
+		syslog(LOG_ERR, "Can't delete exports for V4:");
+
+	/*
+	 * and clear flag that notes if a public fh has been exported.
+	 */
+	has_publicfh = 0;
+
+	/*
 	 * And delete exports that are in the kernel for all local
 	 * filesystems.
 	 * XXX: Should know how to handle all local exportable filesystems.
@@ -1491,6 +1598,12 @@ get_exportlist()
 		syslog(LOG_ERR, "can't open any exports file");
 		exit(2);
 	}
+
+	/*
+	 * If there was no public fh, clear any previous one set.
+	 */
+	if (run_v4server > 0 && has_publicfh == 0)
+		(void) nfssvc(NFSSVC_NOPUBLICFH, NULL);
 }
 
 /*
@@ -2085,7 +2198,7 @@ do_mount(struct exportlist *ep, struct g
 {
 	struct statfs fsb1;
 	struct addrinfo *ai;
-	struct export_args eap;
+	struct export_args ea, *eap;
 	char errmsg[255];
 	char *cp;
 	int done;
@@ -2093,6 +2206,12 @@ do_mount(struct exportlist *ep, struct g
 	struct iovec *iov;
 	int i, iovlen;
 	int ret;
+	struct nfsex_args nfsea;
+
+	if (run_v4server > 0)
+		eap = &nfsea.export;
+	else
+		eap = &ea;
 
 	cp = NULL;
 	savedc = '\0';
@@ -2100,57 +2219,60 @@ do_mount(struct exportlist *ep, struct g
 	iovlen = 0;
 	ret = 0;
 
-	bzero(&eap, sizeof(eap));
+	bzero(eap, sizeof (struct export_args));
 	bzero(errmsg, sizeof(errmsg));
-	eap.ex_flags = exflags;
-	eap.ex_anon = *anoncrp;
-	eap.ex_indexfile = ep->ex_indexfile;
+	eap->ex_flags = exflags;
+	eap->ex_anon = *anoncrp;
+	eap->ex_indexfile = ep->ex_indexfile;
 	if (grp->gr_type == GT_HOST)
 		ai = grp->gr_ptr.gt_addrinfo;
 	else
 		ai = NULL;
-	eap.ex_numsecflavors = ep->ex_numsecflavors;
-	for (i = 0; i < eap.ex_numsecflavors; i++)
-		eap.ex_secflavors[i] = ep->ex_secflavors[i];
-	if (eap.ex_numsecflavors == 0) {
-		eap.ex_numsecflavors = 1;
-		eap.ex_secflavors[0] = AUTH_SYS;
+	eap->ex_numsecflavors = ep->ex_numsecflavors;
+	for (i = 0; i < eap->ex_numsecflavors; i++)
+		eap->ex_secflavors[i] = ep->ex_secflavors[i];
+	if (eap->ex_numsecflavors == 0) {
+		eap->ex_numsecflavors = 1;
+		eap->ex_secflavors[0] = AUTH_SYS;
 	}
 	done = FALSE;
 
-	build_iovec(&iov, &iovlen, "fstype", NULL, 0);
-	build_iovec(&iov, &iovlen, "fspath", NULL, 0);
-	build_iovec(&iov, &iovlen, "from", NULL, 0);
-	build_iovec(&iov, &iovlen, "update", NULL, 0);
-	build_iovec(&iov, &iovlen, "export", &eap, sizeof(eap));
-	build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg));
+	if (v4root_phase == 0) {
+		build_iovec(&iov, &iovlen, "fstype", NULL, 0);
+		build_iovec(&iov, &iovlen, "fspath", NULL, 0);
+		build_iovec(&iov, &iovlen, "from", NULL, 0);
+		build_iovec(&iov, &iovlen, "update", NULL, 0);
+		build_iovec(&iov, &iovlen, "export", eap,
+		    sizeof (struct export_args));
+		build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg));
+	}
 
 	while (!done) {
 		switch (grp->gr_type) {
 		case GT_HOST:
 			if (ai->ai_addr->sa_family == AF_INET6 && have_v6 == 0)
 				goto skip;
-			eap.ex_addr = ai->ai_addr;
-			eap.ex_addrlen = ai->ai_addrlen;
-			eap.ex_masklen = 0;
+			eap->ex_addr = ai->ai_addr;
+			eap->ex_addrlen = ai->ai_addrlen;
+			eap->ex_masklen = 0;
 			break;
 		case GT_NET:
 			if (grp->gr_ptr.gt_net.nt_net.ss_family == AF_INET6 &&
 			    have_v6 == 0)
 				goto skip;
-			eap.ex_addr =
+			eap->ex_addr =
 			    (struct sockaddr *)&grp->gr_ptr.gt_net.nt_net;
-			eap.ex_addrlen =
+			eap->ex_addrlen =
 			    ((struct sockaddr *)&grp->gr_ptr.gt_net.nt_net)->sa_len;
-			eap.ex_mask =
+			eap->ex_mask =
 			    (struct sockaddr *)&grp->gr_ptr.gt_net.nt_mask;
-			eap.ex_masklen = ((struct sockaddr *)&grp->gr_ptr.gt_net.nt_mask)->sa_len;
+			eap->ex_masklen = ((struct sockaddr *)&grp->gr_ptr.gt_net.nt_mask)->sa_len;
 			break;
 		case GT_DEFAULT:
-			eap.ex_addr = NULL;
-			eap.ex_addrlen = 0;
-			eap.ex_mask = NULL;
-			eap.ex_masklen = 0;
+			eap->ex_addr = NULL;
+			eap->ex_addrlen = 0;
+			eap->ex_mask = NULL;
+			eap->ex_masklen = 0;
 			break;
 		case GT_IGNORE:
 			ret = 0;
@@ -2165,74 +2287,116 @@ do_mount(struct exportlist *ep, struct g
 		};
 
 		/*
-		 * XXX:
-		 * Maybe I should just use the fsb->f_mntonname path instead
-		 * of looping back up the dirp to the mount point??
-		 * Also, needs to know how to export all types of local
-		 * exportable filesystems and not just "ufs".
+		 * For V4:, use the nfssvc() syscall, instead of mount().
 		 */
-		iov[1].iov_base = fsb->f_fstypename; /* "fstype" */
-		iov[1].iov_len = strlen(fsb->f_fstypename) + 1;
-		iov[3].iov_base = fsb->f_mntonname; /* "fspath" */
-		iov[3].iov_len = strlen(fsb->f_mntonname) + 1;
-		iov[5].iov_base = fsb->f_mntfromname; /* "from" */
-		iov[5].iov_len = strlen(fsb->f_mntfromname) + 1;
-
-		while (nmount(iov, iovlen, fsb->f_flags) < 0) {
-			if (cp)
-				*cp-- = savedc;
-			else
-				cp = dirp + dirplen - 1;
-			if (opt_flags & OP_QUIET) {
-				ret = 1;
-				goto error_exit;
-			}
-			if (errno == EPERM) {
-				if (debug)
-					warnx("can't change attributes for %s",
-					    dirp);
-				syslog(LOG_ERR,
-				   "can't change attributes for %s", dirp);
-				ret = 1;
-				goto error_exit;
+		if (v4root_phase == 2) {
+			nfsea.fspec = v4root_dirpath;
+			if (run_v4server > 0 &&
+			    nfssvc(NFSSVC_V4ROOTEXPORT, (caddr_t)&nfsea) < 0) {
+				syslog(LOG_ERR, "Exporting V4: failed");
+				return (2);
 			}
-			if (opt_flags & OP_ALLDIRS) {
-				if (errno == EINVAL)
+		} else {
+			/*
+			 * XXX:
+			 * Maybe I should just use the fsb->f_mntonname path
+			 * instead of looping back up the dirp to the mount
+			 * point??
+			 * Also, needs to know how to export all types of local
+			 * exportable filesystems and not just "ufs".
+			 */
+			iov[1].iov_base = fsb->f_fstypename; /* "fstype" */
+			iov[1].iov_len = strlen(fsb->f_fstypename) + 1;
+			iov[3].iov_base = fsb->f_mntonname; /* "fspath" */
+			iov[3].iov_len = strlen(fsb->f_mntonname) + 1;
+			iov[5].iov_base = fsb->f_mntfromname; /* "from" */
+			iov[5].iov_len = strlen(fsb->f_mntfromname) + 1;
+	
+			while (nmount(iov, iovlen, fsb->f_flags) < 0) {
+				if (cp)
+					*cp-- = savedc;
+				else
+					cp = dirp + dirplen - 1;
+				if (opt_flags & OP_QUIET) {
+					ret = 1;
+					goto error_exit;
+				}
+				if (errno == EPERM) {
+					if (debug)
+						warnx("can't change attributes for %s",
+						    dirp);
 					syslog(LOG_ERR,
+					   "can't change attributes for %s",
+					    dirp);
+					ret = 1;
+					goto error_exit;
+				}
+				if (opt_flags & OP_ALLDIRS) {
+					if (errno == EINVAL)
+						syslog(LOG_ERR,
 		"-alldirs requested but %s is not a filesystem mountpoint",
-						dirp);
-				else
+						    dirp);
+					else
+						syslog(LOG_ERR,
+						    "could not remount %s: %m",
+						    dirp);
+					ret = 1;
+					goto error_exit;
+				}
+				/* back up over the last component */
+				while (*cp == '/' && cp > dirp)
+					cp--;
+				while (*(cp - 1) != '/' && cp > dirp)
+					cp--;
+				if (cp == dirp) {
+					if (debug)
+						warnx("mnt unsucc");
+					syslog(LOG_ERR, "can't export %s %s",
+					    dirp, errmsg);
+					ret = 1;
+					goto error_exit;
+				}
+				savedc = *cp;
+				*cp = '\0';
+				/*
+				 * Check that we're still on the same
+				 * filesystem.
+				 */
+				if (statfs(dirp, &fsb1) != 0 ||
+				    bcmp(&fsb1.f_fsid, &fsb->f_fsid,
+				    sizeof (fsb1.f_fsid)) != 0) {
+					*cp = savedc;
 					syslog(LOG_ERR,
-						"could not remount %s: %m",
-						dirp);
-				ret = 1;
-				goto error_exit;
-			}
-			/* back up over the last component */
-			while (*cp == '/' && cp > dirp)
-				cp--;
-			while (*(cp - 1) != '/' && cp > dirp)
-				cp--;
-			if (cp == dirp) {
-				if (debug)
-					warnx("mnt unsucc");
-				syslog(LOG_ERR, "can't export %s %s", dirp,
-				    errmsg);
-				ret = 1;
-				goto error_exit;
-			}
-			savedc = *cp;
-			*cp = '\0';
-			/* Check that we're still on the same filesystem. */
-			if (statfs(dirp, &fsb1) != 0 || bcmp(&fsb1.f_fsid,
-			    &fsb->f_fsid, sizeof(fsb1.f_fsid)) != 0) {
-				*cp = savedc;
-				syslog(LOG_ERR, "can't export %s %s", dirp,
-				    errmsg);
-				ret = 1;
-				goto error_exit;
+					    "can't export %s %s", dirp,
+					    errmsg);
+					ret = 1;
+					goto error_exit;
+				}
 			}
 		}
+
+		/*
+		 * For the experimental server:
+		 * If this is the public directory, get the file handle
+		 * and load it into the kernel via the nfssvc() syscall.
+		 */
+		if (run_v4server > 0 && (exflags & MNT_EXPUBLIC) != 0) {
+			fhandle_t fh;
+			char *public_name;
+
+			if (eap->ex_indexfile != NULL)
+				public_name = eap->ex_indexfile;
+			else
+				public_name = dirp;
+			if (getfh(public_name, &fh) < 0)
+				syslog(LOG_ERR,
+				    "Can't get public fh for %s", public_name);
+			else if (nfssvc(NFSSVC_PUBLICFH, (caddr_t)&fh) < 0)
+				syslog(LOG_ERR,
+				    "Can't set public fh for %s", public_name);
+			else
+				has_publicfh = 1;
+		}
 skip:
 		if (ai != NULL)
 			ai = ai->ai_next;
@@ -2688,7 +2852,7 @@ check_options(dp)
 	struct dirlist *dp;
 {
 
-	if (dp == (struct dirlist *)NULL)
+	if (v4root_phase == 0 && dp == NULL)
 	    return (1);
 	if ((opt_flags & (OP_MAPROOT | OP_MAPALL)) == (OP_MAPROOT | OP_MAPALL)) {
 	    syslog(LOG_ERR, "-mapall and -maproot mutually exclusive");
@@ -2710,6 +2874,12 @@ check_options(dp)
 	    syslog(LOG_ERR, "-alldirs has multiple directories");
 	    return (1);
 	}
+	if (v4root_phase > 0 &&
+	    (opt_flags &
+	     ~(OP_SEC | OP_MASK | OP_NET | OP_HAVEMASK | OP_MASKLEN)) != 0) {
+	    syslog(LOG_ERR,"only -sec,-net,-mask options allowed on V4:");
+	    return (1);
+	}
 	return (0);
 }
 
@@ -2871,3 +3041,4 @@ int sig;
 	rpcb_unset(RPCPROG_MNT, RPCMNT_VER3, NULL);
 	exit (0);
 }
+

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 22:12:24 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BC3BF10657B9
	for ; Wed, 27 May 2009 22:12:24 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4])
	by mx1.freebsd.org (Postfix) with ESMTP id 54C578FC1B
	for ; Wed, 27 May 2009 22:12:24 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: (qmail 2031 invoked by uid 399); 27 May 2009 22:12:19 -0000
Received: from localhost (HELO ?192.168.0.101?) (dougb@dougbarton.us@127.0.0.1)
	by localhost with ESMTPAM; 27 May 2009 22:12:19 -0000
X-Originating-IP: 127.0.0.1
X-Sender: dougb@dougbarton.us
Message-ID: <4A1DBAC0.4060801@FreeBSD.org>
Date: Wed, 27 May 2009 15:12:16 -0700
From: Doug Barton 
Organization: http://www.FreeBSD.org/
User-Agent: Thunderbird 2.0.0.21 (Windows/20090302)
MIME-Version: 1.0
To: Rick Macklem 
References: <200905272202.n4RM2s2M013427@svn.freebsd.org>
In-Reply-To: <200905272202.n4RM2s2M013427@svn.freebsd.org>
X-Enigmail-Version: 0.95.7
OpenPGP: id=D5B2F0FB
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r192934 - head/usr.sbin/mountd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 22:12:25 -0000

Rick Macklem wrote:
> Author: rmacklem
> Date: Wed May 27 22:02:54 2009
> New Revision: 192934
> URL: http://svn.freebsd.org/changeset/base/192934
> 
> Log:
>   Modify mountd to handle the experimental nfs server as well as the
>   regular one. It now takes a "-4" command line argument to force it
>   to use the experimental server.

The -4 and -6 options are traditionally used for their respective IPv
transport choices, so you might want to consider choosing a different
option.


Doug

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 22:25:26 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F03E11065676;
	Wed, 27 May 2009 22:25:26 +0000 (UTC)
	(envelope-from rmacklem@uoguelph.ca)
Received: from esa-jnhn.mail.uoguelph.ca (esa-jnhn.mail.uoguelph.ca
	[131.104.91.44])
	by mx1.freebsd.org (Postfix) with ESMTP id 5DB658FC1E;
	Wed, 27 May 2009 22:25:26 +0000 (UTC)
	(envelope-from rmacklem@uoguelph.ca)
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: ApoEABJbHUqDaFvI/2dsb2JhbADOGIQNBQ
X-IronPort-AV: E=Sophos;i="4.41,261,1241409600"; d="scan'208";a="36744407"
Received: from darling.cs.uoguelph.ca ([131.104.91.200])
	by esa-jnhn-pri.mail.uoguelph.ca with ESMTP; 27 May 2009 18:25:24 -0400
Received: from localhost (localhost.localdomain [127.0.0.1])
	by darling.cs.uoguelph.ca (Postfix) with ESMTP id DCA21940020;
	Wed, 27 May 2009 18:25:24 -0400 (EDT)
X-Virus-Scanned: amavisd-new at darling.cs.uoguelph.ca
Received: from darling.cs.uoguelph.ca ([127.0.0.1])
	by localhost (darling.cs.uoguelph.ca [127.0.0.1]) (amavisd-new,
	port 10024)
	with ESMTP id E8f1NdsMzH+w; Wed, 27 May 2009 18:25:22 -0400 (EDT)
Received: from muncher.cs.uoguelph.ca (muncher.cs.uoguelph.ca [131.104.91.102])
	by darling.cs.uoguelph.ca (Postfix) with ESMTP id A139F940062;
	Wed, 27 May 2009 18:25:22 -0400 (EDT)
Received: from localhost (rmacklem@localhost)
	by muncher.cs.uoguelph.ca (8.11.7p3+Sun/8.11.6) with ESMTP id
	n4RMQLA24054; Wed, 27 May 2009 18:26:21 -0400 (EDT)
X-Authentication-Warning: muncher.cs.uoguelph.ca: rmacklem owned process doing
	-bs
Date: Wed, 27 May 2009 18:26:21 -0400 (EDT)
From: Rick Macklem 
X-X-Sender: rmacklem@muncher.cs.uoguelph.ca
To: Doug Barton 
In-Reply-To: <4A1DBAC0.4060801@FreeBSD.org>
Message-ID: 
References: <200905272202.n4RM2s2M013427@svn.freebsd.org>
	<4A1DBAC0.4060801@FreeBSD.org>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@FreeBSD.org, Rick Macklem ,
	svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject: Re: svn commit: r192934 - head/usr.sbin/mountd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 22:25:27 -0000



On Wed, 27 May 2009, Doug Barton wrote:

> Rick Macklem wrote:
>
> The -4 and -6 options are traditionally used for their respective IPv
> transport choices, so you might want to consider choosing a different
> option.
>
Any suggestions? How about:

-e - for experimental server
-l - you're a lunatic to try and run this:-)
or ???

or whatever. It should be easy to commit a change to a different
letter. All I'd say is that it should be the same for nfsd as well.

rick


From owner-svn-src-head@FreeBSD.ORG  Wed May 27 22:41:29 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3E0841065670;
	Wed, 27 May 2009 22:41:29 +0000 (UTC)
	(envelope-from sson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2B97E8FC0A;
	Wed, 27 May 2009 22:41:28 +0000 (UTC)
	(envelope-from sson@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RMfSYg014326;
	Wed, 27 May 2009 22:41:28 GMT (envelope-from sson@svn.freebsd.org)
Received: (from sson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RMfSv9014325;
	Wed, 27 May 2009 22:41:28 GMT (envelope-from sson@svn.freebsd.org)
Message-Id: <200905272241.n4RMfSv9014325@svn.freebsd.org>
From: Stacey Son 
Date: Wed, 27 May 2009 22:41:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192937 - head/cddl/contrib/opensolaris/cmd/lockstat
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 22:41:29 -0000

Author: sson
Date: Wed May 27 22:41:28 2009
New Revision: 192937
URL: http://svn.freebsd.org/changeset/base/192937

Log:
  Fix lockstat breakage to arm/powerpc buildworld.
  Thanks to IBM char's are unsigned on arm/powerpc.
  
  Approved by:	gnn (mentor)

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

Modified: head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c
==============================================================================
--- head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c	Wed May 27 22:23:16 2009	(r192936)
+++ head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c	Wed May 27 22:41:28 2009	(r192937)
@@ -46,14 +46,18 @@
 #include 
 #include 
 
-#if !defined(sun)
-/* needed for FreeBSD */ 
+#if defined(sun)
+#define	GETOPT_EOF	EOF
+#else
+/* FreeBSD */ 
 #include 
 #include 
-typedef uintptr_t pc_t;
 
-#define mergesort(a, b, c, d)	lsmergesort(a, b, c, d)
-#endif
+#define	mergesort(a, b, c, d)	lsmergesort(a, b, c, d)
+#define	GETOPT_EOF		(-1)
+
+typedef	uintptr_t	pc_t;
+#endif /* defined(sun) */
 
 #define	LOCKSTAT_OPTSTR	"x:bths:n:d:i:l:f:e:ckwWgCHEATID:RpPo:V"
 
@@ -1059,7 +1063,7 @@ main(int argc, char **argv)
 	char *data_buf;
 	lsrec_t *lsp, **current, **first, **sort_buf, **merge_buf;
 	FILE *out = stdout;
-	char c;
+	int c;
 	pid_t child;
 	int status;
 	int i, j;
@@ -1092,7 +1096,7 @@ main(int argc, char **argv)
 
 	g_nrecs = DEFAULT_NRECS;
 
-	while ((c = getopt(argc, argv, LOCKSTAT_OPTSTR)) != EOF) {
+	while ((c = getopt(argc, argv, LOCKSTAT_OPTSTR)) != GETOPT_EOF) {
 		switch (c) {
 		case 'b':
 			g_recsize = LS_BASIC;
@@ -1386,7 +1390,7 @@ main(int argc, char **argv)
 		dfail("failed to set 'statusrate'");
 
 	optind = 1;
-	while ((c = getopt(argc, argv, LOCKSTAT_OPTSTR)) != EOF) {
+	while ((c = getopt(argc, argv, LOCKSTAT_OPTSTR)) != GETOPT_EOF) {
 		switch (c) {
 		case 'x':
 			if ((p = strchr(optarg, '=')) != NULL)

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 23:12:03 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 417B11065676;
	Wed, 27 May 2009 23:12:03 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2DC938FC08;
	Wed, 27 May 2009 23:12:03 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4RNC3MX015076;
	Wed, 27 May 2009 23:12:03 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4RNC2Nb015070;
	Wed, 27 May 2009 23:12:02 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200905272312.n4RNC2Nb015070@svn.freebsd.org>
From: Andrew Thompson 
Date: Wed, 27 May 2009 23:12:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192938 - head/sys/dev/usb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 23:12:04 -0000

Author: thompsa
Date: Wed May 27 23:12:02 2009
New Revision: 192938
URL: http://svn.freebsd.org/changeset/base/192938

Log:
  Allocate the usb serial, manufacturer and product strings rather than use char
  arrays in the usb_device struct. This also eliminates USB_HAVE_STRINGS.

Modified:
  head/sys/dev/usb/usb_core.h
  head/sys/dev/usb/usb_device.c
  head/sys/dev/usb/usb_device.h
  head/sys/dev/usb/usb_generic.c
  head/sys/dev/usb/usb_hub.c
  head/sys/dev/usb/usb_util.c

Modified: head/sys/dev/usb/usb_core.h
==============================================================================
--- head/sys/dev/usb/usb_core.h	Wed May 27 22:41:28 2009	(r192937)
+++ head/sys/dev/usb/usb_core.h	Wed May 27 23:12:02 2009	(r192938)
@@ -57,14 +57,6 @@
 #endif
 
 /*
- * The following macro defines if the code shall support any forms of
- * ASCII strings.
- */
-#ifndef USB_HAVE_STRINGS
-#define	USB_HAVE_STRINGS 1
-#endif
-
-/*
  * The following macro defines if the code shall support BUS-DMA.
  */
 #ifndef USB_HAVE_BUSDMA

Modified: head/sys/dev/usb/usb_device.c
==============================================================================
--- head/sys/dev/usb/usb_device.c	Wed May 27 22:41:28 2009	(r192937)
+++ head/sys/dev/usb/usb_device.c	Wed May 27 23:12:02 2009	(r192938)
@@ -71,9 +71,7 @@ static void	usb2_suspend_resume_sub(stru
 		    uint8_t);
 static void	usb2_clear_stall_proc(struct usb2_proc_msg *_pm);
 usb2_error_t	usb2_config_parse(struct usb2_device *, uint8_t, uint8_t);
-#if USB_HAVE_STRINGS
-static void	usb2_check_strings(struct usb2_device *);
-#endif
+static void	usb2_set_device_strings(struct usb2_device *);
 #if USB_HAVE_UGEN
 static void	usb2_notify_addq(const char *type, struct usb2_device *);
 static void	usb2_fifo_free_wrap(struct usb2_device *, uint8_t, uint8_t);
@@ -1676,32 +1674,8 @@ usb2_alloc_device(device_t parent_dev, s
 
 	/* assume 100mA bus powered for now. Changed when configured. */
 	udev->power = USB_MIN_POWER;
-
-#if USB_HAVE_STRINGS
-	/* get serial number string */
-	err = usb2_req_get_string_any
-	    (udev, NULL, (char *)scratch_ptr,
-	    scratch_size, udev->ddesc.iSerialNumber);
-
-	strlcpy(udev->serial, (char *)scratch_ptr, sizeof(udev->serial));
-
-	/* get manufacturer string */
-	err = usb2_req_get_string_any
-	    (udev, NULL, (char *)scratch_ptr,
-	    scratch_size, udev->ddesc.iManufacturer);
-
-	strlcpy(udev->manufacturer, (char *)scratch_ptr, sizeof(udev->manufacturer));
-
-	/* get product string */
-	err = usb2_req_get_string_any
-	    (udev, NULL, (char *)scratch_ptr,
-	    scratch_size, udev->ddesc.iProduct);
-
-	strlcpy(udev->product, (char *)scratch_ptr, sizeof(udev->product));
-
-	/* finish up all the strings */
-	usb2_check_strings(udev);
-#endif
+	/* fetch the vendor and product strings from the device */
+	usb2_set_device_strings(udev);
 
 	if (udev->flags.usb_mode == USB_MODE_HOST) {
 		uint8_t config_index;
@@ -2113,11 +2087,7 @@ usb2_devinfo(struct usb2_device *udev, c
 	if (udd->bDeviceClass != 0xFF) {
 		snprintf(dst_ptr, dst_len, "%s %s, class %d/%d, rev %x.%02x/"
 		    "%x.%02x, addr %d",
-#if USB_HAVE_STRINGS
 		    udev->manufacturer, udev->product,
-#else
-		    "-", "-",
-#endif
 		    udd->bDeviceClass, udd->bDeviceSubClass,
 		    (bcdUSB >> 8), bcdUSB & 0xFF,
 		    (bcdDevice >> 8), bcdDevice & 0xFF,
@@ -2125,18 +2095,13 @@ usb2_devinfo(struct usb2_device *udev, c
 	} else {
 		snprintf(dst_ptr, dst_len, "%s %s, rev %x.%02x/"
 		    "%x.%02x, addr %d",
-#if USB_HAVE_STRINGS
 		    udev->manufacturer, udev->product,
-#else
-		    "-", "-",
-#endif
 		    (bcdUSB >> 8), bcdUSB & 0xFF,
 		    (bcdDevice >> 8), bcdDevice & 0xFF,
 		    udev->address);
 	}
 }
 
-#if USB_HAVE_STRINGS
 #if USB_VERBOSE
 /*
  * Descriptions of of known vendors and devices ("products").
@@ -2155,85 +2120,74 @@ struct usb_knowndev {
 #include "usbdevs_data.h"
 #endif					/* USB_VERBOSE */
 
-/*------------------------------------------------------------------------*
- *	usb2_check_strings
- *
- * This function checks the manufacturer and product strings and will
- * fill in defaults for missing strings.
- *------------------------------------------------------------------------*/
 static void
-usb2_check_strings(struct usb2_device *udev)
+usb2_set_device_strings(struct usb2_device *udev)
 {
 	struct usb2_device_descriptor *udd = &udev->ddesc;
-	const char *vendor;
-	const char *product;
-
 #if USB_VERBOSE
 	const struct usb_knowndev *kdp;
-
 #endif
+	char temp[64];
 	uint16_t vendor_id;
 	uint16_t product_id;
 
-	usb2_trim_spaces(udev->manufacturer);
-	usb2_trim_spaces(udev->product);
+	vendor_id = UGETW(udd->idVendor);
+	product_id = UGETW(udd->idProduct);
 
-	if (udev->manufacturer[0]) {
-		vendor = udev->manufacturer;
-	} else {
-		vendor = NULL;
-	}
+	/* get serial number string */
+	bzero(temp, sizeof(temp));
+	usb2_req_get_string_any(udev, NULL, temp, sizeof(temp),
+	    udev->ddesc.iSerialNumber);
+	udev->serial = strdup(temp, M_USB);
 
-	if (udev->product[0]) {
-		product = udev->product;
-	} else {
-		product = NULL;
-	}
+	/* get manufacturer string */
+	bzero(temp, sizeof(temp));
+	usb2_req_get_string_any(udev, NULL, temp, sizeof(temp),
+	    udev->ddesc.iManufacturer);
+	usb2_trim_spaces(temp);
+	if (temp[0] != '\0')
+		udev->manufacturer = strdup(temp, M_USB);
 
-	vendor_id = UGETW(udd->idVendor);
-	product_id = UGETW(udd->idProduct);
+	/* get product string */
+	bzero(temp, sizeof(temp));
+	usb2_req_get_string_any(udev, NULL, temp, sizeof(temp),
+	    udev->ddesc.iProduct);
+	usb2_trim_spaces(temp);
+	if (temp[0] != '\0')
+		udev->product = strdup(temp, M_USB);
 
 #if USB_VERBOSE
-	if (vendor == NULL || product == NULL) {
-
-		for (kdp = usb_knowndevs;
-		    kdp->vendorname != NULL;
-		    kdp++) {
+	if (udev->manufacturer == NULL || udev->product == NULL) {
+		for (kdp = usb_knowndevs; kdp->vendorname != NULL; kdp++) {
 			if (kdp->vendor == vendor_id &&
 			    (kdp->product == product_id ||
 			    (kdp->flags & USB_KNOWNDEV_NOPROD) != 0))
 				break;
 		}
 		if (kdp->vendorname != NULL) {
-			if (vendor == NULL)
-				vendor = kdp->vendorname;
-			if (product == NULL)
-				product = (kdp->flags & USB_KNOWNDEV_NOPROD) == 0 ?
-				    kdp->productname : NULL;
+			/* XXX should use pointer to knowndevs string */
+			if (udev->manufacturer == NULL) {
+				udev->manufacturer = strdup(kdp->vendorname,
+				    M_USB);
+			}
+			if (udev->product == NULL &&
+			    (kdp->flags & USB_KNOWNDEV_NOPROD) == 0) {
+				udev->product = strdup(kdp->productname,
+				    M_USB);
+			}
 		}
 	}
 #endif
-	if (vendor && *vendor) {
-		if (udev->manufacturer != vendor) {
-			strlcpy(udev->manufacturer, vendor,
-			    sizeof(udev->manufacturer));
-		}
-	} else {
-		snprintf(udev->manufacturer,
-		    sizeof(udev->manufacturer), "vendor 0x%04x", vendor_id);
-	}
-
-	if (product && *product) {
-		if (udev->product != product) {
-			strlcpy(udev->product, product,
-			    sizeof(udev->product));
-		}
-	} else {
-		snprintf(udev->product,
-		    sizeof(udev->product), "product 0x%04x", product_id);
+	/* Provide default strings if none were found */
+	if (udev->manufacturer == NULL) {
+		snprintf(temp, sizeof(temp), "vendor 0x%04x", vendor_id);
+		udev->manufacturer = strdup(temp, M_USB);
+	}
+	if (udev->product == NULL) {
+		snprintf(temp, sizeof(temp), "product 0x%04x", product_id);
+		udev->product = strdup(temp, M_USB);
 	}
 }
-#endif
 
 /*
  * Returns:
@@ -2367,11 +2321,7 @@ usb2_notify_addq(const char *type, struc
 	    UGETW(udev->ddesc.idProduct),
 	    udev->ddesc.bDeviceClass,
 	    udev->ddesc.bDeviceSubClass,
-#if USB_HAVE_STRINGS
 	    udev->serial,
-#else
-	    "",
-#endif
 	    udev->port_no,
 	    udev->parent_hub != NULL ?
 		udev->parent_hub->ugen_name :

Modified: head/sys/dev/usb/usb_device.h
==============================================================================
--- head/sys/dev/usb/usb_device.h	Wed May 27 22:41:28 2009	(r192937)
+++ head/sys/dev/usb/usb_device.h	Wed May 27 23:12:02 2009	(r192938)
@@ -174,11 +174,9 @@ struct usb2_device {
 	struct usb2_endpoint_descriptor default_ep_desc;	/* for pipe 0 */
 	struct usb2_device_descriptor ddesc;	/* device descriptor */
 
-#if USB_HAVE_STRINGS
-	char	serial[64];		/* serial number */
-	char	manufacturer[64];	/* manufacturer string */
-	char	product[64];		/* product string */
-#endif
+	char	*serial;		/* serial number */
+	char	*manufacturer;		/* manufacturer string */
+	char	*product;		/* product string */
 };
 
 /* globals */

Modified: head/sys/dev/usb/usb_generic.c
==============================================================================
--- head/sys/dev/usb/usb_generic.c	Wed May 27 22:41:28 2009	(r192937)
+++ head/sys/dev/usb/usb_generic.c	Wed May 27 23:12:02 2009	(r192938)
@@ -801,14 +801,9 @@ usb2_gen_fill_deviceinfo(struct usb2_fif
 	di->udi_bus = device_get_unit(udev->bus->bdev);
 	di->udi_addr = udev->address;
 	di->udi_index = udev->device_index;
-#if USB_HAVE_STRINGS
-	strlcpy(di->udi_serial, udev->serial,
-	    sizeof(di->udi_serial));
-	strlcpy(di->udi_vendor, udev->manufacturer,
-	    sizeof(di->udi_vendor));
-	strlcpy(di->udi_product, udev->product,
-	    sizeof(di->udi_product));
-#endif
+	strlcpy(di->udi_serial, udev->serial, sizeof(di->udi_serial));
+	strlcpy(di->udi_vendor, udev->manufacturer, sizeof(di->udi_vendor));
+	strlcpy(di->udi_product, udev->product, sizeof(di->udi_product));
 	usb2_printBCD(di->udi_release, sizeof(di->udi_release),
 	    UGETW(udev->ddesc.bcdDevice));
 	di->udi_vendorNo = UGETW(udev->ddesc.idVendor);

Modified: head/sys/dev/usb/usb_hub.c
==============================================================================
--- head/sys/dev/usb/usb_hub.c	Wed May 27 22:41:28 2009	(r192937)
+++ head/sys/dev/usb/usb_hub.c	Wed May 27 23:12:02 2009	(r192938)
@@ -1006,11 +1006,7 @@ uhub_child_pnpinfo_string(device_t paren
 		    UGETW(res.udev->ddesc.idProduct),
 		    res.udev->ddesc.bDeviceClass,
 		    res.udev->ddesc.bDeviceSubClass,
-#if USB_HAVE_STRINGS
 		    res.udev->serial,
-#else
-		    "",
-#endif
 		    iface->idesc->bInterfaceClass,
 		    iface->idesc->bInterfaceSubClass);
 	} else {

Modified: head/sys/dev/usb/usb_util.c
==============================================================================
--- head/sys/dev/usb/usb_util.c	Wed May 27 22:41:28 2009	(r192937)
+++ head/sys/dev/usb/usb_util.c	Wed May 27 23:12:02 2009	(r192938)
@@ -78,7 +78,6 @@ device_delete_all_children(device_t dev)
 void
 device_set_usb2_desc(device_t dev)
 {
-#if USB_HAVE_STRINGS
 	struct usb2_attach_arg *uaa;
 	struct usb2_device *udev;
 	struct usb2_interface *iface;
@@ -121,7 +120,6 @@ device_set_usb2_desc(device_t dev)
 	device_set_desc_copy(dev, temp_p);
 	device_printf(dev, "<%s> on %s\n", temp_p,
 	    device_get_nameunit(udev->bus->bdev));
-#endif
 }
 
 /*------------------------------------------------------------------------*
@@ -181,7 +179,6 @@ usb2_printBCD(char *p, uint16_t p_len, u
  * This function removes spaces at the beginning and the end of the string
  * pointed to by the "p" argument.
  *------------------------------------------------------------------------*/
-#if USB_HAVE_STRINGS
 void
 usb2_trim_spaces(char *p)
 {
@@ -198,7 +195,6 @@ usb2_trim_spaces(char *p)
 			e = p;
 	*e = 0;				/* kill trailing spaces */
 }
-#endif
 
 /*------------------------------------------------------------------------*
  *	usb2_make_str_desc - convert an ASCII string into a UNICODE string

From owner-svn-src-head@FreeBSD.ORG  Wed May 27 23:28:46 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6D68B106566B;
	Wed, 27 May 2009 23:28:46 +0000 (UTC)
	(envelope-from grehan@freebsd.org)
Received: from alto.onthenet.com.au (alto.OntheNet.com.au [203.13.68.12])
	by mx1.freebsd.org (Postfix) with ESMTP id 2C9678FC22;
	Wed, 27 May 2009 23:28:45 +0000 (UTC)
	(envelope-from grehan@freebsd.org)
Received: from dommail.onthenet.com.au (dommail.OntheNet.com.au [203.13.70.57])
	by alto.onthenet.com.au (Postfix) with ESMTP id C799311AED;
	Thu, 28 May 2009 09:13:38 +1000 (EST)
Received: (from dommail.onthenet.com.au [198.95.226.224])
	by dommail.onthenet.com.au (MOS 3.8.6-GA)
	with HTTP/1.1 id ETX71003 (AUTH peterg@ptree32.com.au);
	Thu, 28 May 2009 09:13:39 +1000 (EST)
From: Peter Grehan 
To: Stacey Son , src-committers@freebsd.org,
	svn-src-all@freebsd.org, svn-src-head@freebsd.org
X-Mailer: Mirapoint Webmail Direct 3.8.6-GA
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <20090528091339.ETX71003@dommail.onthenet.com.au>
Date: Thu, 28 May 2009 09:13:39 +1000 (EST)
Cc: 
Subject: Re: svn commit: r192937 - head/cddl/contrib/opensolaris/cmd/lockstat
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 27 May 2009 23:28:46 -0000

>  Fix lockstat breakage to arm/powerpc buildworld.

 Thanks !

later,

Peter.

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 00:11:42 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.ORG
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5FC66106566B;
	Thu, 28 May 2009 00:11:42 +0000 (UTC)
	(envelope-from delphij@delphij.net)
Received: from tarsier.delphij.net (delphij-pt.tunnel.tserv2.fmt.ipv6.he.net
	[IPv6:2001:470:1f03:2c9::2])
	by mx1.freebsd.org (Postfix) with ESMTP id F17CC8FC0C;
	Thu, 28 May 2009 00:11:41 +0000 (UTC)
	(envelope-from delphij@delphij.net)
Received: from tarsier.geekcn.org (tarsier.geekcn.org [211.166.10.233])
	(using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits))
	(No client certificate requested)
	by tarsier.delphij.net (Postfix) with ESMTPS id D9FEF5C024;
	Thu, 28 May 2009 08:11:40 +0800 (CST)
Received: from localhost (tarsier.geekcn.org [211.166.10.233])
	by tarsier.geekcn.org (Postfix) with ESMTP id 653F655CDADD;
	Thu, 28 May 2009 08:11:40 +0800 (CST)
X-Virus-Scanned: amavisd-new at geekcn.org
Received: from tarsier.geekcn.org ([211.166.10.233])
	by localhost (mail.geekcn.org [211.166.10.233]) (amavisd-new,
	port 10024)
	with ESMTP id 3sFCrBabcVGU; Thu, 28 May 2009 08:10:46 +0800 (CST)
Received: from charlie.delphij.net (adsl-76-237-33-62.dsl.pltn13.sbcglobal.net
	[76.237.33.62])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by tarsier.geekcn.org (Postfix) with ESMTPSA id 1F4C855CDADA;
	Thu, 28 May 2009 08:10:39 +0800 (CST)
DomainKey-Signature: a=rsa-sha1; s=default; d=delphij.net; c=nofws; q=dns;
	h=message-id:date:from:reply-to:organization:user-agent:
	mime-version:to:cc:subject:references:in-reply-to:
	x-enigmail-version:openpgp:content-type:content-transfer-encoding;
	b=UcgYjn8V1z8gJ56OYn7Z3c6b/FGgeLU4bkGhBHhc2sAQ5Os7CpS30iXs2xbVOI9eW
	yAU6mQ34B+y7PQ63OPEwQ==
Message-ID: <4A1DD66E.4000600@delphij.net>
Date: Wed, 27 May 2009 17:10:22 -0700
From: Xin LI 
Organization: The FreeBSD Project
User-Agent: Thunderbird 2.0.0.21 (X11/20090408)
MIME-Version: 1.0
To: Doug Rabson 
References: <200905161048.n4GAmKRh057122@svn.freebsd.org>
	<4A1734DC.6080203@delphij.net>
	<7AC0926C-3FA1-4EEC-9438-643FF7D310A7@rabson.org>
In-Reply-To: <7AC0926C-3FA1-4EEC-9438-643FF7D310A7@rabson.org>
X-Enigmail-Version: 0.95.7
OpenPGP: id=18EDEBA0;
	url=http://www.delphij.net/delphij.asc
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.ORG, Doug Rabson ,
	src-committers@FreeBSD.ORG, d@delphij.net, svn-src-all@FreeBSD.ORG
Subject: [RESOLVED] Re: svn commit: r192194 - in head/sys: boot/i386/zfsboot
 boot/zfs cddl/boot/zfs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: d@delphij.net
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 00:11:42 -0000

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Doug Rabson wrote:
[...]
>>
>> I think this commit has broken booting from mirrored zpool when raidz2
>> pool is exist.  In my setup it was 4 disks:
> 
> This should be fixed in r192679.

Thanks!  This has fixed my problem.

Cheers,
- --
Xin LI 	http://www.delphij.net/
FreeBSD - The Power to Serve!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (FreeBSD)

iEYEARECAAYFAkod1mgACgkQi+vbBBjt66DqZACfYH6jFPqWd6W6+B9aTmjWN3WX
wH4AmQEtKWi14yrza7I8vpfVyfFARRU/
=fEQA
-----END PGP SIGNATURE-----

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 00:38:25 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 27558106564A;
	Thu, 28 May 2009 00:38:25 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 149848FC13;
	Thu, 28 May 2009 00:38:25 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4S0cOp2017076;
	Thu, 28 May 2009 00:38:24 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4S0cON4017067;
	Thu, 28 May 2009 00:38:24 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200905280038.n4S0cON4017067@svn.freebsd.org>
From: Xin LI 
Date: Thu, 28 May 2009 00:38:24 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192943 - head/usr.bin/truss
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 00:38:25 -0000

Author: delphij
Date: Thu May 28 00:38:24 2009
New Revision: 192943
URL: http://svn.freebsd.org/changeset/base/192943

Log:
  Correct off-by-one issue in truss(1) which happens when system call number
  is nsyscalls.
  
  PR:		bin/134916
  Submitted by:	Steven Hartland 
  MFC after:	2 weeks

Modified:
  head/usr.bin/truss/amd64-fbsd.c
  head/usr.bin/truss/amd64-fbsd32.c
  head/usr.bin/truss/amd64-linux32.c
  head/usr.bin/truss/i386-fbsd.c
  head/usr.bin/truss/i386-linux.c
  head/usr.bin/truss/ia64-fbsd.c
  head/usr.bin/truss/mips-fbsd.c
  head/usr.bin/truss/powerpc-fbsd.c
  head/usr.bin/truss/sparc64-fbsd.c

Modified: head/usr.bin/truss/amd64-fbsd.c
==============================================================================
--- head/usr.bin/truss/amd64-fbsd.c	Thu May 28 00:18:11 2009	(r192942)
+++ head/usr.bin/truss/amd64-fbsd.c	Thu May 28 00:38:24 2009	(r192943)
@@ -142,7 +142,7 @@ amd64_syscall_entry(struct trussinfo *tr
 
   fsc.number = syscall_num;
   fsc.name =
-    (syscall_num < 0 || syscall_num > nsyscalls) ?  NULL : syscallnames[syscall_num];
+    (syscall_num < 0 || syscall_num >= nsyscalls) ?  NULL : syscallnames[syscall_num];
   if (!fsc.name) {
     fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
   }

Modified: head/usr.bin/truss/amd64-fbsd32.c
==============================================================================
--- head/usr.bin/truss/amd64-fbsd32.c	Thu May 28 00:18:11 2009	(r192942)
+++ head/usr.bin/truss/amd64-fbsd32.c	Thu May 28 00:38:24 2009	(r192943)
@@ -152,7 +152,7 @@ amd64_fbsd32_syscall_entry(struct trussi
 
   fsc.number = syscall_num;
   fsc.name =
-    (syscall_num < 0 || syscall_num > nsyscalls) ? NULL :
+    (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL :
       freebsd32_syscallnames[syscall_num];
   if (!fsc.name) {
     fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);

Modified: head/usr.bin/truss/amd64-linux32.c
==============================================================================
--- head/usr.bin/truss/amd64-linux32.c	Thu May 28 00:18:11 2009	(r192942)
+++ head/usr.bin/truss/amd64-linux32.c	Thu May 28 00:38:24 2009	(r192943)
@@ -124,7 +124,7 @@ amd64_linux32_syscall_entry(struct truss
 
   fsc.number = syscall_num;
   fsc.name =
-    (syscall_num < 0 || syscall_num > nsyscalls) ? NULL : linux32_syscallnames[syscall_num];
+    (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL : linux32_syscallnames[syscall_num];
   if (!fsc.name) {
     fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
   }

Modified: head/usr.bin/truss/i386-fbsd.c
==============================================================================
--- head/usr.bin/truss/i386-fbsd.c	Thu May 28 00:18:11 2009	(r192942)
+++ head/usr.bin/truss/i386-fbsd.c	Thu May 28 00:38:24 2009	(r192943)
@@ -147,7 +147,7 @@ i386_syscall_entry(struct trussinfo *tru
 
   fsc.number = syscall_num;
   fsc.name =
-    (syscall_num < 0 || syscall_num > nsyscalls) ? NULL : syscallnames[syscall_num];
+    (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL : syscallnames[syscall_num];
   if (!fsc.name) {
     fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
   }

Modified: head/usr.bin/truss/i386-linux.c
==============================================================================
--- head/usr.bin/truss/i386-linux.c	Thu May 28 00:18:11 2009	(r192942)
+++ head/usr.bin/truss/i386-linux.c	Thu May 28 00:38:24 2009	(r192943)
@@ -124,7 +124,7 @@ i386_linux_syscall_entry(struct trussinf
 
   fsc.number = syscall_num;
   fsc.name =
-    (syscall_num < 0 || syscall_num > nsyscalls) ? NULL : linux_syscallnames[syscall_num];
+    (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL : linux_syscallnames[syscall_num];
   if (!fsc.name) {
     fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
   }

Modified: head/usr.bin/truss/ia64-fbsd.c
==============================================================================
--- head/usr.bin/truss/ia64-fbsd.c	Thu May 28 00:18:11 2009	(r192942)
+++ head/usr.bin/truss/ia64-fbsd.c	Thu May 28 00:38:24 2009	(r192943)
@@ -135,7 +135,7 @@ ia64_syscall_entry(struct trussinfo *tru
     syscall_num = (int)*parm_offset++;
 
   fsc.number = syscall_num;
-  fsc.name = (syscall_num < 0 || syscall_num > nsyscalls)
+  fsc.name = (syscall_num < 0 || syscall_num >= nsyscalls)
       ? NULL : syscallnames[syscall_num];
   if (!fsc.name) {
     fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);

Modified: head/usr.bin/truss/mips-fbsd.c
==============================================================================
--- head/usr.bin/truss/mips-fbsd.c	Thu May 28 00:18:11 2009	(r192942)
+++ head/usr.bin/truss/mips-fbsd.c	Thu May 28 00:38:24 2009	(r192943)
@@ -139,7 +139,7 @@ mips_syscall_entry(struct trussinfo *tru
 
   fsc.number = syscall_num;
   fsc.name =
-    (syscall_num < 0 || syscall_num > nsyscalls) ? NULL : syscallnames[syscall_num];
+    (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL : syscallnames[syscall_num];
   if (!fsc.name) {
     fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
   }

Modified: head/usr.bin/truss/powerpc-fbsd.c
==============================================================================
--- head/usr.bin/truss/powerpc-fbsd.c	Thu May 28 00:18:11 2009	(r192942)
+++ head/usr.bin/truss/powerpc-fbsd.c	Thu May 28 00:38:24 2009	(r192943)
@@ -149,7 +149,7 @@ powerpc_syscall_entry(struct trussinfo *
 
   fsc.number = syscall_num;
   fsc.name =
-    (syscall_num < 0 || syscall_num > nsyscalls) ? NULL : syscallnames[syscall_num];
+    (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL : syscallnames[syscall_num];
   if (!fsc.name) {
     fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
   }

Modified: head/usr.bin/truss/sparc64-fbsd.c
==============================================================================
--- head/usr.bin/truss/sparc64-fbsd.c	Thu May 28 00:18:11 2009	(r192942)
+++ head/usr.bin/truss/sparc64-fbsd.c	Thu May 28 00:38:24 2009	(r192943)
@@ -145,7 +145,7 @@ sparc64_syscall_entry(struct trussinfo *
 
   fsc.number = syscall_num;
   fsc.name =
-    (syscall_num < 0 || syscall_num > nsyscalls) ? NULL : syscallnames[syscall_num];
+    (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL : syscallnames[syscall_num];
   if (!fsc.name) {
     fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
   }

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 00:52:00 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AAC63106566B;
	Thu, 28 May 2009 00:52:00 +0000 (UTC)
	(envelope-from ken@mthelicon.com)
Received: from hercules.mthelicon.com (hercules.mthelicon.com
	[IPv6:2001:49f0:2023::2])
	by mx1.freebsd.org (Postfix) with ESMTP id 7865B8FC1F;
	Thu, 28 May 2009 00:52:00 +0000 (UTC)
	(envelope-from ken@mthelicon.com)
Received: from feathers.peganest.com (feathers.peganest.com [78.33.110.3])
	(authenticated bits=0)
	by hercules.mthelicon.com (8.14.3/8.14.3) with ESMTP id n4S0ppeQ047582
	(version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO);
	Thu, 28 May 2009 00:51:52 GMT (envelope-from ken@mthelicon.com)
From: Pegasus Mc Cleaft 
Organization: Feathers
To: svn-src-all@freebsd.org, d@delphij.net
Date: Thu, 28 May 2009 01:51:49 +0100
User-Agent: KMail/1.11.3 (FreeBSD/8.0-CURRENT; KDE/4.2.3; amd64; ; )
References: <200905161048.n4GAmKRh057122@svn.freebsd.org>
	<7AC0926C-3FA1-4EEC-9438-643FF7D310A7@rabson.org>
	<4A1DD66E.4000600@delphij.net>
In-Reply-To: <4A1DD66E.4000600@delphij.net>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200905280151.50358.ken@mthelicon.com>
Cc: svn-src-head@freebsd.org, Doug Rabson ,
	Doug Rabson , src-committers@freebsd.org
Subject: Re: [RESOLVED] Re: svn commit: r192194 - in head/sys:
	boot/i386/zfsboot boot/zfs cddl/boot/zfs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 00:52:01 -0000

On Thursday 28 May 2009 01:10:22 Xin LI wrote:
> Doug Rabson wrote:
> [...]
>
> >> I think this commit has broken booting from mirrored zpool when raidz2
> >> pool is exist.  In my setup it was 4 disks:
> >
> > This should be fixed in r192679.
>
> Thanks!  This has fixed my problem.

	Just another "Me To".. Fixed my bootup problem as well.. 

Peg

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 01:14:55 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 23624106567B;
	Thu, 28 May 2009 01:14:55 +0000 (UTC) (envelope-from zml@FreeBSD.org)
Received: from seaxch10.isilon.com (seaxch10.isilon.com [74.85.160.26])
	by mx1.freebsd.org (Postfix) with ESMTP id F40118FC23;
	Thu, 28 May 2009 01:14:54 +0000 (UTC) (envelope-from zml@FreeBSD.org)
Received: from famine.isilon.com ([10.54.190.95]) by seaxch10.isilon.com with
	Microsoft SMTPSVC(6.0.3790.1830); Wed, 27 May 2009 18:02:21 -0700
Received: from zloafman by famine.isilon.com with local (Exim 4.69)
	(envelope-from )
	id 1M9U0j-00025D-6D; Wed, 27 May 2009 18:02:21 -0700
Date: Wed, 27 May 2009 18:02:21 -0700
From: Zachary Loafman 
To: Ed Schouten 
Message-ID: <20090528010220.GF3704@isilon.com>
References: <200905271636.n4RGasNe003922@svn.freebsd.org>
	<20090527182807.GG48776@hoeg.nl>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20090527182807.GG48776@hoeg.nl>
User-Agent: Mutt/1.5.18 (2008-05-17)
X-OriginalArrivalTime: 28 May 2009 01:02:21.0482 (UTC)
	FILETIME=[F47958A0:01C9DF2F]
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r192908 - in head: share/man/man9 sys/confsys/kern
	sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 01:14:55 -0000

On Wed, May 27, 2009 at 11:28:07AM -0700, Ed Schouten wrote:
> Hi Zach,
> 
> * Zachary Loafman  wrote:
> >   head/sys/sys/queue.h
> 
> This part of the patch is not in the email, so I'll just link it here:
> 
> 	http://svn.freebsd.org/viewvc/base/head/sys/sys/queue.h?r1=191535&r2=192908
> 
> In other macros in this header file, we try to use as many _NEXT() and
> _PREV() invocations as possible, to abstract the structure field names.
> Maybe we could change _SWAP() macros to do the same?

Ed -

I started to do this, but let's run through it:

> #define STAILQ_SWAP(head1, head2, type) do {                            \
>         struct type *swap_first = STAILQ_FIRST(head1);                  \
>         struct type **swap_last = (head1)->stqh_last;                   \
>         STAILQ_FIRST(head1) = STAILQ_FIRST(head2);                      \
>         (head1)->stqh_last = (head2)->stqh_last;                        \
>         STAILQ_FIRST(head2) = swap_first;                               \
>         (head2)->stqh_last = swap_last;                                 \
>         if (STAILQ_EMPTY(head1))                                        \
>                 (head1)->stqh_last = &STAILQ_FIRST(head1);              \
>         if (STAILQ_EMPTY(head2))                                        \
>                 (head2)->stqh_last = &STAILQ_FIRST(head2);              \
> } while (0)

There is no macro that references just ->stqh_last. As it's internal to
the inner workings, I'm not sure there needs to be. The others are
macro-ized already.

> #define LIST_SWAP(head1, head2, type, field) do {                       \
>         struct type *swap_tmp = LIST_FIRST((head1));                    \
>         LIST_FIRST((head1)) = LIST_FIRST((head2));                      \
>         LIST_FIRST((head2)) = swap_tmp;                                 \
>         if ((swap_tmp = LIST_FIRST((head1))) != NULL)                   \
>                 swap_tmp->field.le_prev = &LIST_FIRST((head1));         \
>         if ((swap_tmp = LIST_FIRST((head2))) != NULL)                   \
>                 swap_tmp->field.le_prev = &LIST_FIRST((head2));         \
> } while (0)

Again, there's no macro for .le_prev. Everything else is macro-ized.

> #define TAILQ_SWAP(head1, head2, type, field) do {                      \
>         struct type *swap_first = (head1)->tqh_first;                   \
>         struct type **swap_last = (head1)->tqh_last;                    \
>         (head1)->tqh_first = (head2)->tqh_first;                        \
>         (head1)->tqh_last = (head2)->tqh_last;                          \
>         (head2)->tqh_first = swap_first;                                \
>         (head2)->tqh_last = swap_last;                                  \
>         if ((swap_first = (head1)->tqh_first) != NULL)                  \
>                 swap_first->field.tqe_prev = &(head1)->tqh_first;       \
>         else                                                            \
>                 (head1)->tqh_last = &(head1)->tqh_first;                \
>         if ((swap_first = (head2)->tqh_first) != NULL)                  \
>                 swap_first->field.tqe_prev = &(head2)->tqh_first;       \
>         else                                                            \
>                 (head2)->tqh_last = &(head2)->tqh_first;                \
> } while (0)

This is the only one where we could throw some macro replacements in. But consider this:

>         (head1)->tqh_first = (head2)->tqh_first;                        \
>         (head1)->tqh_last = (head2)->tqh_last;                          \

versus

>         TAILQ_FIRST(head1) = TAILQ_FIRST(head2);                        \
>         (head1)->tqh_last = (head2)->tqh_last;                          \

I personally find the first form clearer to skim through visually. The
second form moves 'head1' and 'head2' around. It's not like it's hard to
follow, but I think the first is clearer to read. I don't think the
TAILQ_FIRST buys you much here.

-- 
Zach Loafman | Staff Engineer | Isilon Systems

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 01:47:46 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5ABF61065675;
	Thu, 28 May 2009 01:47:46 +0000 (UTC) (envelope-from zml@FreeBSD.org)
Received: from seaxch10.isilon.com (seaxch10.isilon.com [74.85.160.26])
	by mx1.freebsd.org (Postfix) with ESMTP id 35EEA8FC2F;
	Thu, 28 May 2009 01:47:45 +0000 (UTC) (envelope-from zml@FreeBSD.org)
Received: from famine.isilon.com ([10.54.190.95]) by seaxch10.isilon.com with
	Microsoft SMTPSVC(6.0.3790.1830); Wed, 27 May 2009 18:47:26 -0700
Received: from zloafman by famine.isilon.com with local (Exim 4.69)
	(envelope-from )
	id 1M9UiM-0002RN-D6; Wed, 27 May 2009 18:47:26 -0700
Date: Wed, 27 May 2009 18:47:26 -0700
From: Zachary Loafman 
To: Ben Kaduk 
Message-ID: <20090528014726.GG3704@isilon.com>
References: <200905271636.n4RGasNe003922@svn.freebsd.org>
	<47d0403c0905271005t7f57f9b9h3d0721bbb1fbedc2@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <47d0403c0905271005t7f57f9b9h3d0721bbb1fbedc2@mail.gmail.com>
User-Agent: Mutt/1.5.18 (2008-05-17)
X-OriginalArrivalTime: 28 May 2009 01:47:26.0756 (UTC)
	FILETIME=[40F16640:01C9DF36]
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, dfr@freebsd.org
Subject: Review: fail(9) style/grammar (was Re: svn commit: r192908 ...)
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 01:47:47 -0000

On Wed, May 27, 2009 at 10:05:44AM -0700, Ben Kaduk wrote:
> Our man page style says that new sentences should start on new lines.
> (Since the '.' character is used for defining macros, and sometimes
> the processor can get confused.)

Ben -

Thanks for the pedantry! I've attached a patch that should address your
issues. (Doug, please review as mentor when you get a chance.)

This is my first man page, so I apologize for the style violations. I
fixed all the new sentence instances I could find, but I left the "e.g."
and "i.e." instances untouched. That seems like it would suffer from the
same issue, but I left them alone for now.

Is there a style(9) equivalent for man pages? I hunted for a bit, but
"man -k style" returned only style(9) and style.Makefile(9).

-- 
Zach Loafman | Staff Engineer | Isilon Systems

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 02:30:40 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 745361065670;
	Thu, 28 May 2009 02:30:40 +0000 (UTC)
	(envelope-from keramida@freebsd.org)
Received: from poseidon.ceid.upatras.gr (poseidon.ceid.upatras.gr
	[150.140.141.169])
	by mx1.freebsd.org (Postfix) with ESMTP id DDB938FC0C;
	Thu, 28 May 2009 02:30:39 +0000 (UTC)
	(envelope-from keramida@freebsd.org)
Received: from mail.ceid.upatras.gr (unknown [10.1.0.143])
	by poseidon.ceid.upatras.gr (Postfix) with ESMTP id 46A44EB539C;
	Thu, 28 May 2009 05:11:52 +0300 (EEST)
Received: from localhost (europa.ceid.upatras.gr [127.0.0.1])
	by mail.ceid.upatras.gr (Postfix) with ESMTP id DC03B450C6;
	Thu, 28 May 2009 05:11:52 +0300 (EEST)
X-Virus-Scanned: amavisd-new at ceid.upatras.gr
Received: from mail.ceid.upatras.gr ([127.0.0.1])
	by localhost (europa.ceid.upatras.gr [127.0.0.1]) (amavisd-new,
	port 10024)
	with ESMTP id MkgO5rDZRnrr; Thu, 28 May 2009 05:11:52 +0300 (EEST)
Received: from kobe.laptop (adsl226-168.kln.forthnet.gr [79.103.39.168])
	by mail.ceid.upatras.gr (Postfix) with ESMTP id 916C54509B;
	Thu, 28 May 2009 05:11:51 +0300 (EEST)
Received: from kobe.laptop (kobe.laptop [127.0.0.1])
	by kobe.laptop (8.14.3/8.14.3) with ESMTP id n4S2BpBi016728;
	Thu, 28 May 2009 05:11:51 +0300 (EEST)
	(envelope-from keramida@freebsd.org)
Received: (from keramida@localhost)
	by kobe.laptop (8.14.3/8.14.3/Submit) id n4S2BptT016727;
	Thu, 28 May 2009 05:11:51 +0300 (EEST)
	(envelope-from keramida@freebsd.org)
From: Giorgos Keramidas 
To: Xin LI 
References: <200905280038.n4S0cON4017067@svn.freebsd.org>
Date: Thu, 28 May 2009 05:11:51 +0300
In-Reply-To: <200905280038.n4S0cON4017067@svn.freebsd.org> (Xin LI's message
	of "Thu, 28 May 2009 00:38:24 +0000 (UTC)")
Message-ID: <87prdu6kns.fsf@kobe.laptop>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.94 (berkeley-unix)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r192943 - head/usr.bin/truss
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 02:30:40 -0000

On Thu, 28 May 2009 00:38:24 +0000 (UTC), Xin LI  wrote:
> Author: delphij
> Date: Thu May 28 00:38:24 2009
> New Revision: 192943
> URL: http://svn.freebsd.org/changeset/base/192943
>
> Log:
>   Correct off-by-one issue in truss(1) which happens when system call number
>   is nsyscalls.
>
>   PR:		bin/134916
>   Submitted by:	Steven Hartland 
>   MFC after:	2 weeks

Thank you!

I've been running with precisely the same patch locally for some time,
but didn't manage to get it tested well enough to commit it :-)

The only local diff I have now from /head is a minor change that wraps
lines that are at the same time already wrapped *and* too long.  If that
looks useful as a followup change please feel free to use it:

%%%
diff -r b88f7e077f9c usr.bin/truss/amd64-fbsd.c
--- a/usr.bin/truss/amd64-fbsd.c	Thu May 21 02:47:46 2009 +0000
+++ b/usr.bin/truss/amd64-fbsd.c	Thu May 28 05:10:58 2009 +0300
@@ -141,8 +141,8 @@
   }
 
   fsc.number = syscall_num;
-  fsc.name =
-    (syscall_num < 0 || syscall_num > nsyscalls) ?  NULL : syscallnames[syscall_num];
+  fsc.name = (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL :
+      syscallnames[syscall_num];
   if (!fsc.name) {
     fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
   }
diff -r b88f7e077f9c usr.bin/truss/amd64-fbsd32.c
--- a/usr.bin/truss/amd64-fbsd32.c	Thu May 21 02:47:46 2009 +0000
+++ b/usr.bin/truss/amd64-fbsd32.c	Thu May 28 05:10:58 2009 +0300
@@ -151,8 +151,7 @@
   }
 
   fsc.number = syscall_num;
-  fsc.name =
-    (syscall_num < 0 || syscall_num > nsyscalls) ? NULL :
+  fsc.name = (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL :
       freebsd32_syscallnames[syscall_num];
   if (!fsc.name) {
     fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
diff -r b88f7e077f9c usr.bin/truss/amd64-linux32.c
--- a/usr.bin/truss/amd64-linux32.c	Thu May 21 02:47:46 2009 +0000
+++ b/usr.bin/truss/amd64-linux32.c	Thu May 28 05:10:58 2009 +0300
@@ -123,8 +123,8 @@
   syscall_num = regs.r_rax;
 
   fsc.number = syscall_num;
-  fsc.name =
-    (syscall_num < 0 || syscall_num > nsyscalls) ? NULL : linux32_syscallnames[syscall_num];
+  fsc.name = (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL :
+      linux32_syscallnames[syscall_num];
   if (!fsc.name) {
     fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
   }
diff -r b88f7e077f9c usr.bin/truss/i386-fbsd.c
--- a/usr.bin/truss/i386-fbsd.c	Thu May 21 02:47:46 2009 +0000
+++ b/usr.bin/truss/i386-fbsd.c	Thu May 28 05:10:58 2009 +0300
@@ -146,8 +146,8 @@
   }
 
   fsc.number = syscall_num;
-  fsc.name =
-    (syscall_num < 0 || syscall_num > nsyscalls) ? NULL : syscallnames[syscall_num];
+  fsc.name = (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL :
+      syscallnames[syscall_num];
   if (!fsc.name) {
     fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
   }
diff -r b88f7e077f9c usr.bin/truss/i386-linux.c
--- a/usr.bin/truss/i386-linux.c	Thu May 21 02:47:46 2009 +0000
+++ b/usr.bin/truss/i386-linux.c	Thu May 28 05:10:58 2009 +0300
@@ -123,8 +123,8 @@
   syscall_num = regs.r_eax;
 
   fsc.number = syscall_num;
-  fsc.name =
-    (syscall_num < 0 || syscall_num > nsyscalls) ? NULL : linux_syscallnames[syscall_num];
+  fsc.name = (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL :
+      linux_syscallnames[syscall_num];
   if (!fsc.name) {
     fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
   }
diff -r b88f7e077f9c usr.bin/truss/ia64-fbsd.c
--- a/usr.bin/truss/ia64-fbsd.c	Thu May 21 02:47:46 2009 +0000
+++ b/usr.bin/truss/ia64-fbsd.c	Thu May 28 05:10:58 2009 +0300
@@ -135,8 +135,8 @@
     syscall_num = (int)*parm_offset++;
 
   fsc.number = syscall_num;
-  fsc.name = (syscall_num < 0 || syscall_num > nsyscalls)
-      ? NULL : syscallnames[syscall_num];
+  fsc.name = (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL :
+      syscallnames[syscall_num];
   if (!fsc.name) {
     fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
   }
diff -r b88f7e077f9c usr.bin/truss/powerpc-fbsd.c
--- a/usr.bin/truss/powerpc-fbsd.c	Thu May 21 02:47:46 2009 +0000
+++ b/usr.bin/truss/powerpc-fbsd.c	Thu May 28 05:10:58 2009 +0300
@@ -148,8 +148,8 @@
   }
 
   fsc.number = syscall_num;
-  fsc.name =
-    (syscall_num < 0 || syscall_num > nsyscalls) ? NULL : syscallnames[syscall_num];
+  fsc.name = (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL :
+      syscallnames[syscall_num];
   if (!fsc.name) {
     fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
   }
diff -r b88f7e077f9c usr.bin/truss/sparc64-fbsd.c
--- a/usr.bin/truss/sparc64-fbsd.c	Thu May 21 02:47:46 2009 +0000
+++ b/usr.bin/truss/sparc64-fbsd.c	Thu May 28 05:10:58 2009 +0300
@@ -144,8 +144,8 @@
   }
 
   fsc.number = syscall_num;
-  fsc.name =
-    (syscall_num < 0 || syscall_num > nsyscalls) ? NULL : syscallnames[syscall_num];
+  fsc.name = (syscall_num < 0 || syscall_num >= nsyscalls) ? NULL :
+      syscallnames[syscall_num];
   if (!fsc.name) {
     fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", syscall_num);
   }
%%%

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 02:39:07 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C7835106564A;
	Thu, 28 May 2009 02:39:07 +0000 (UTC) (envelope-from zml@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B52F98FC13;
	Thu, 28 May 2009 02:39:07 +0000 (UTC) (envelope-from zml@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4S2d7K7019906;
	Thu, 28 May 2009 02:39:07 GMT (envelope-from zml@svn.freebsd.org)
Received: (from zml@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4S2d748019904;
	Thu, 28 May 2009 02:39:07 GMT (envelope-from zml@svn.freebsd.org)
Message-Id: <200905280239.n4S2d748019904@svn.freebsd.org>
From: Zachary Loafman 
Date: Thu, 28 May 2009 02:39:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192949 - head/tools/regression/file/flock
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 02:39:08 -0000

Author: zml
Date: Thu May 28 02:39:07 2009
New Revision: 192949
URL: http://svn.freebsd.org/changeset/base/192949

Log:
  Add a regression test for multiple threads of the same process acquiring the same fcntl lock.
  
  Approved by:        dfr (mentor)

Modified:
  head/tools/regression/file/flock/Makefile
  head/tools/regression/file/flock/flock.c

Modified: head/tools/regression/file/flock/Makefile
==============================================================================
--- head/tools/regression/file/flock/Makefile	Thu May 28 02:17:58 2009	(r192948)
+++ head/tools/regression/file/flock/Makefile	Thu May 28 02:39:07 2009	(r192949)
@@ -4,4 +4,6 @@ PROG=	flock
 NO_MAN=
 WARNS?=	6
 
+LDADD+=	-lpthread
+
 .include 

Modified: head/tools/regression/file/flock/flock.c
==============================================================================
--- head/tools/regression/file/flock/flock.c	Thu May 28 02:17:58 2009	(r192948)
+++ head/tools/regression/file/flock/flock.c	Thu May 28 02:39:07 2009	(r192949)
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1401,6 +1402,112 @@ test15(int fd, __unused int argc, const 
 #endif
 }
 
+struct test_ctx {
+	struct flock tc_fl;
+	int tc_fd;
+};
+
+static void *
+test16_func(void *tc_in)
+{
+	uintptr_t error;
+	struct test_ctx *tc = tc_in;
+
+	error = fcntl(tc->tc_fd, F_SETLKW, &tc->tc_fl);
+
+	pthread_exit((void *)error);
+}
+
+#define THREADS 10
+
+/*
+ * Test 16 - F_SETLKW from two threads
+ *
+ * If two threads within a process are blocked on a lock and the lock
+ * is granted, make sure things are sane.
+ */
+static int
+test16(int fd, __unused int argc, const __unused char **argv)
+{
+	/*
+	 * We create a child process to hold the lock which we will
+	 * test. We use a pipe to communicate with the child.
+	 */
+	int pid;
+	int pfd[2];
+	struct test_ctx tc = { .tc_fd = fd };
+	char ch;
+	int i;
+	int error;
+	pthread_t thr[THREADS];
+
+	if (pipe(pfd) < 0)
+		err(1, "pipe");
+
+	tc.tc_fl.l_start = 0;
+	tc.tc_fl.l_len = 0;
+	tc.tc_fl.l_type = F_WRLCK;
+	tc.tc_fl.l_whence = SEEK_SET;
+
+	pid = fork();
+	if (pid < 0)
+		err(1, "fork");
+
+	if (pid == 0) {
+		/*
+		 * We are the child. We set a write lock and then
+		 * write one byte back to the parent to tell it. The
+		 * parent will kill us when its done.
+		 */
+		if (fcntl(fd, F_SETLK, &tc.tc_fl) < 0)
+			err(1, "F_SETLK (child)");
+		if (write(pfd[1], "a", 1) < 0)
+			err(1, "writing to pipe (child)");
+		pause();
+		exit(0);
+	}
+
+	/*
+	 * Wait until the child has set its lock and then perform the
+	 * test.
+	 */
+	if (read(pfd[0], &ch, 1) != 1)
+		err(1, "reading from pipe (child)");
+
+	/*
+	 * fcntl should wait until the alarm and then return -1 with
+	 * errno set to EINTR.
+	 */
+	printf("16 - F_SETLKW on locked region by two threads: ");
+
+	for (i = 0; i < THREADS; i++) {
+		error = pthread_create(&thr[i], NULL, test16_func, &tc);
+		if (error)
+			err(1, "pthread_create");
+	}
+
+	/*
+	 * Sleep, then kill the child. This makes me a little sad, but it's
+	 * tricky to tell whether the threads are all really blocked by this
+	 * point.
+	 */
+	sleep(1);
+	kill(pid, SIGTERM);
+	safe_waitpid(pid);
+	close(pfd[0]);
+	close(pfd[1]);
+
+	for (i = 0; i < THREADS; i++) {
+		void *res;
+		error = pthread_join(thr[i], &res);
+		if (error)
+			err(1, "pthread_join");
+		FAIL((uintptr_t)res != 0);
+	}
+
+	SUCCEED;
+}
+
 struct test {
 	int (*testfn)(int, int, const char **);	/* function to perform the test */
 	int num;		/* test number */
@@ -1423,6 +1530,7 @@ struct test tests[] = {
 	{	test13,		13,	1	},
 	{	test14,		14,	0	},
 	{	test15,		15,	1	},
+	{	test16,		16,	1	},
 };
 int test_count = sizeof(tests) / sizeof(tests[0]);
 

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 03:30:56 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1DFCC106566C;
	Thu, 28 May 2009 03:30:56 +0000 (UTC) (envelope-from zml@FreeBSD.org)
Received: from seaxch10.isilon.com (seaxch10.isilon.com [74.85.160.26])
	by mx1.freebsd.org (Postfix) with ESMTP id E83C18FC16;
	Thu, 28 May 2009 03:30:55 +0000 (UTC) (envelope-from zml@FreeBSD.org)
Received: from famine.isilon.com ([10.54.190.95]) by seaxch10.isilon.com with
	Microsoft SMTPSVC(6.0.3790.1830); Wed, 27 May 2009 20:30:30 -0700
Received: from zloafman by famine.isilon.com with local (Exim 4.69)
	(envelope-from )
	id 1M9WK5-0003ej-Lr; Wed, 27 May 2009 20:30:29 -0700
Date: Wed, 27 May 2009 20:30:29 -0700
From: Zachary Loafman 
To: Ben Kaduk 
Message-ID: <20090528033028.GE9388@isilon.com>
References: <200905271636.n4RGasNe003922@svn.freebsd.org>
	<47d0403c0905271005t7f57f9b9h3d0721bbb1fbedc2@mail.gmail.com>
	<20090528014726.GG3704@isilon.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="a8Wt8u1KmwUX3Y2C"
Content-Disposition: inline
In-Reply-To: <20090528014726.GG3704@isilon.com>
User-Agent: Mutt/1.5.18 (2008-05-17)
X-OriginalArrivalTime: 28 May 2009 03:30:30.0157 (UTC)
	FILETIME=[A68983D0:01C9DF44]
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, dfr@freebsd.org
Subject: Re: Review: fail(9) style/grammar (was Re: svn commit: r192908 ...)
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 03:30:56 -0000


--a8Wt8u1KmwUX3Y2C
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Wed, May 27, 2009 at 06:47:26PM -0700, Zachary Loafman wrote:
> Thanks for the pedantry! I've attached a patch that should address your
> issues. (Doug, please review as mentor when you get a chance.)

Let's pretend I actually attached a patch. :)

-- 
Zach Loafman | Staff Engineer | Isilon Systems

--a8Wt8u1KmwUX3Y2C
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
	filename="0008-Fix-style-grammar-issues-in-fail-9-man-page.patch"

>From f469a056fb1834167fe6d869026e98658908bc1c Mon Sep 17 00:00:00 2001
From: Zach Loafman 
Date: Wed, 27 May 2009 18:33:14 -0700
Subject: [PATCH] Fix style/grammar issues in fail(9) man page.

Suggested by:       Ben Kaduk
Approved by:        dfr (mentor)
---
 share/man/man9/fail.9 |   75 ++++++++++++++++++++++++++++---------------------
 1 files changed, 43 insertions(+), 32 deletions(-)

diff --git a/share/man/man9/fail.9 b/share/man/man9/fail.9
index 648f9d9..bd24b8c 100644
--- a/share/man/man9/fail.9
+++ b/share/man/man9/fail.9
@@ -48,9 +48,11 @@
 .Fn KFAIL_POINT_GOTO "parent" "name" "error_var" "label"
 .Sh DESCRIPTION
 Fail points are used to add code points where errors may be injected
-in a user controlled fashion. Fail points provide a convenient wrapper
-around user provided error injection code, providing a
-.Xr sysctl 9 MIB , and a parser for that MIB that describes how the error
+in a user controlled fashion.
+Fail points provide a convenient wrapper around user-provided error
+injection code, providing a
+.Xr sysctl 9
+MIB, and a parser for that MIB that describes how the error
 injection code should fire.
 .Pp
 The base fail point macro is
@@ -64,16 +66,19 @@ their own fail point trees), and
 .Fa name
 is the name of the MIB in that tree, and
 .Fa code
-is the error injection code. The
+is the error injection code.
+The
 .Fa code
 argument does not require braces, but it is considered good style to
-use braces for any multi-line code arguments. Inside the
+use braces for any multi-line code arguments.
+Inside the
 .Fa code
 argument, the evaluation of
 .Sy RETURN_VALUE
 is derived from the
 .Fn return
-value set in the sysctl MIB. See
+value set in the sysctl MIB.
+See
 .Sx SYSCTL SETTINGS
 below.
 .Pp
@@ -99,14 +104,14 @@ is the equivalent of
 .Sh SYSCTL VARIABLES
 The
 .Fn KFAIL_POINT_*
-macros add sysctl MIBs where specified. Many base kernel MIBs can be
-found in the
+macros add sysctl MIBs where specified.
+Many base kernel MIBs can be found in the
 .Sy debug.fail_point
 tree (referenced in code by
 .Sy DEBUG_FP
 ).
 .Pp
-The sysctl setting recognizes the following grammar:
+The sysctl variable may be set using the following grammar:
 .Pp
    ::
        ( "->"  )*
@@ -135,27 +140,30 @@ Sleep the specified number of milliseconds
 .It Sy panic
 Panic
 .It Sy break
-Break into the debugger.
+Break into the debugger, or trap if there is no debugger support
 .It Sy print
 Print that the fail point executed
 .El
 .Pp
 The % and * modifiers prior to  control when
- is executed. The % form (e.g. "1.2%") can be used to
-specify a probability that  will execute. The * form
-(e.g. "5*") can be used to specify the number of times  should
-be executed before this  is disabled. Only the last probability
-and the last count are used if multiple are specified, i.e. "1.2%2%"
-is the same as "2%". When both a probability and a count are
-specified, the probability is evaluated before the count, i.e. "2%5*"
-means "2% of the time, but only execute it 5 times total".
+ is executed.
+The % form (e.g. "1.2%") can be used to specify a
+probability that  will execute.
+The * form (e.g. "5*") can be used to specify the number of
+times  should be executed before this  is disabled.
+Only the last probability and the last count are used if multiple
+are specified, i.e. "1.2%2%" is the same as "2%".
+When both a probability and a count are specified, the probability
+is evaluated before the count, i.e. "2%5*" means "2% of the time,
+but only 5 times total".
 .Pp
-The operator -> can be used to express cascading terms. If you specify
-->, it means that if  doesn't 'execute', 
-is evaluated. For the purpose of this operator, the return() and
-print() operators are the only types that cascade. A return() term
-only cascades if the code executes, and a print() term only cascades
-when passed a non-zero argument.
+The operator -> can be used to express cascading terms.
+If you specify ->, it means that if  doesn't
+'execute',  is evaluated.
+For the purpose of this operator, the return() and print() operators
+are the only types that cascade.
+A return() term only cascades if the code executes, and a print()
+term only cascades when passed a non-zero argument.
 .Pp
 .Sh EXAMPLES
 .Bl -tag
@@ -164,29 +172,32 @@ when passed a non-zero argument.
 .Fa code
 with RETURN_VALUE set to 5.
 .It Sy sysctl debug.fail_point.foobar="2%return(5)->5%return(22)"
-2/100th of the time, execute
+2/100ths of the time, execute
 .Fa code
-with RETURN_VALUE set to 5. If that doesn't happen, 5% of the time
-execute
+with RETURN_VALUE set to 5.
+If that doesn't happen, 5% of the time execute
 .Fa code
 with RETURN_VALUE set to 22.
 .It Sy sysctl debug.fail_point.foobar="5*return(5)->0.1%return(22)"
-For 5 times, return 5. After that, 1/1000ths of the time, return 22.
+For 5 times, return 5.
+After that, 1/1000th of the time, return 22.
 .It Sy sysctl debug.fail_point.foobar="0.1%5*return(5)"
-Return 5 for 1 in 1000 executions, but only execute 5 times total.
+Return 5 for 1 in 1000 executions, but only 5 times total.
 .It Sy sysctl debug.fail_point.foobar="1%*sleep(50)"
-1/100ths of the time, sleep 50ms.
+1/100th of the time, sleep 50ms.
 .El
 .Pp
 .Sh CAVEATS
 It's easy to shoot yourself in the foot by setting fail points too
-aggressively or setting too many in combination. For example, forcing
+aggressively or setting too many in combination.
+For example, forcing
 .Fn malloc
 to fail consistently is potentially harmful to uptime.
 .Pp
 The
 .Fn sleep
-sysctl setting may not be appropriate in all situations. Currently,
+sysctl setting may not be appropriate in all situations.
+Currently,
 .Fn fail_point_eval
 does not verify whether the context is appropriate for calling
 .Fn msleep .
-- 
1.6.0.4


--a8Wt8u1KmwUX3Y2C--

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 04:03:16 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A1B0E106564A;
	Thu, 28 May 2009 04:03:16 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8FC998FC13;
	Thu, 28 May 2009 04:03:16 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4S43G76021913;
	Thu, 28 May 2009 04:03:16 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4S43GEl021912;
	Thu, 28 May 2009 04:03:16 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <200905280403.n4S43GEl021912@svn.freebsd.org>
From: Adrian Chadd 
Date: Thu, 28 May 2009 04:03:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192951 - head/sys/xen/xenbus
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 04:03:17 -0000

Author: adrian
Date: Thu May 28 04:03:16 2009
New Revision: 192951
URL: http://svn.freebsd.org/changeset/base/192951

Log:
  Don't call the watch callback if its NULL.
  
  I'm not sure what series of events is leading up to this watch event
  being received with no callback info and it should be investigated.
  I'm triggering it somehow by registering an RTC device (which will
  show up in a subsequent commit.)

Modified:
  head/sys/xen/xenbus/xenbus_xs.c

Modified: head/sys/xen/xenbus/xenbus_xs.c
==============================================================================
--- head/sys/xen/xenbus/xenbus_xs.c	Thu May 28 04:00:03 2009	(r192950)
+++ head/sys/xen/xenbus/xenbus_xs.c	Thu May 28 04:03:16 2009	(r192951)
@@ -769,10 +769,17 @@ xenwatch_thread(void *unused)
 		mtx_unlock(&watch_events_lock);
 
 		if (msg != NULL) {
-			msg->u.watch.handle->callback(
-				msg->u.watch.handle,
-				(const char **)msg->u.watch.vec,
-				msg->u.watch.vec_size);
+			/*
+			 * XXX There are messages coming in with a NULL callback.
+			 * XXX This deserves further investigation; the workaround
+			 * XXX here simply prevents the kernel from panic'ing
+			 * XXX on startup.
+			 */
+			if (msg->u.watch.handle->callback != NULL)
+				msg->u.watch.handle->callback(
+					msg->u.watch.handle,
+					(const char **)msg->u.watch.vec,
+					msg->u.watch.vec_size);
 			free(msg->u.watch.vec, M_DEVBUF);
 			free(msg, M_DEVBUF);
 		}

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 04:17:06 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 758A61065670;
	Thu, 28 May 2009 04:17:05 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 62B488FC13;
	Thu, 28 May 2009 04:17:05 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4S4H5Yp022335;
	Thu, 28 May 2009 04:17:05 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4S4H55e022333;
	Thu, 28 May 2009 04:17:05 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <200905280417.n4S4H55e022333@svn.freebsd.org>
From: Adrian Chadd 
Date: Thu, 28 May 2009 04:17:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192953 - in head/sys: conf i386/xen
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 04:17:06 -0000

Author: adrian
Date: Thu May 28 04:17:05 2009
New Revision: 192953
URL: http://svn.freebsd.org/changeset/base/192953

Log:
  Say hello to a very basic, read-only, Xen Hypervisor RTC.
  
  The hypervisor doesn't provide a single "TOD" - it instead provides a
  "start time" and a "running time". These are added together to form
  the current TOD. The TOD is in UTC.
  
  This RTC is only (initially) designed to be read at startup. There's
  some further poking that needs to happen to pick up hypervisor time
  changes (ie, by the Dom0 time being adjusted by something). This
  time adjustment currently can cause "weird stuff" in the DomU clock;
  I'll begin investigating and repairing that in subsequent commits.
  
  PR:		135008

Added:
  head/sys/i386/xen/xen_rtc.c   (contents, props changed)
Modified:
  head/sys/conf/files.i386

Modified: head/sys/conf/files.i386
==============================================================================
--- head/sys/conf/files.i386	Thu May 28 04:08:07 2009	(r192952)
+++ head/sys/conf/files.i386	Thu May 28 04:17:05 2009	(r192953)
@@ -327,6 +327,7 @@ i386/isa/atpic.c		optional atpic	
 #i386/isa/atpic_vector.s		standard
 i386/isa/clock.c		optional native
 i386/xen/clock.c		optional xen
+i386/xen/xen_rtc.c		optional xen
 i386/isa/dpms.c			optional dpms
 i386/isa/elcr.c			standard
 i386/isa/elink.c		optional ep | ie

Added: head/sys/i386/xen/xen_rtc.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/i386/xen/xen_rtc.c	Thu May 28 04:17:05 2009	(r192953)
@@ -0,0 +1,191 @@
+/*-
+ * Copyright (c) 2009 Adrian Chadd
+ * 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.
+ *
+ * $FreeBSD$
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "clock_if.h"
+
+/*
+ * Read the current hypervisor start time (wall clock) from Xen.
+ */
+static void
+xen_fetch_wallclock(struct timespec *ts)
+{ 
+        shared_info_t *s = HYPERVISOR_shared_info;
+        uint32_t ts_version;
+   
+        do {
+                ts_version = s->wc_version;
+                rmb();
+                ts->tv_sec  = s->wc_sec;
+                ts->tv_nsec = s->wc_nsec;
+                rmb();
+        }
+        while ((s->wc_version & 1) | (ts_version ^ s->wc_version));
+}
+
+/*
+ * Read the current hypervisor system uptime value from Xen.
+ */
+static void
+xen_fetch_uptime(struct timespec *ts)
+{
+        shared_info_t           *s = HYPERVISOR_shared_info;
+        struct vcpu_time_info   *src;
+	struct shadow_time_info	dst;
+        uint32_t pre_version, post_version;
+        
+        src = &s->vcpu_info[smp_processor_id()].time;
+
+        spinlock_enter();
+        do {
+                pre_version = dst.version = src->version;
+                rmb();
+                dst.system_timestamp  = src->system_time;
+                rmb();
+                post_version = src->version;
+        }
+        while ((pre_version & 1) | (pre_version ^ post_version));
+
+        spinlock_exit();
+
+	ts->tv_sec = dst.system_timestamp / 1000000000;
+	ts->tv_nsec = dst.system_timestamp % 1000000000;
+}
+
+
+static int
+xen_rtc_probe(device_t dev)
+{
+	device_set_desc(dev, "Xen Hypervisor Clock");
+	printf("[XEN] xen_rtc_probe: probing Hypervisor RTC clock\n");
+	if (! HYPERVISOR_shared_info) {
+		device_printf(dev, "No hypervisor shared page found; RTC can not start.\n");
+		return (EINVAL);
+	}
+	return (0);
+}
+
+static int
+xen_rtc_attach(device_t dev)
+{
+	printf("[XEN] xen_rtc_attach: attaching Hypervisor RTC clock\n");
+	clock_register(dev, 1000000);
+	return(0);
+}
+
+static int
+xen_rtc_settime(device_t dev __unused, struct timespec *ts)
+{
+	device_printf(dev, "[XEN] xen_rtc_settime\n");
+	/*
+	 * Don't return EINVAL here; just silently fail if the domain isn't privileged enough
+	 * to set the TOD.
+	 */
+	return(0);
+}
+
+/*
+ * The Xen time structures document the hypervisor start time and the
+ * uptime-since-hypervisor-start (in nsec.) They need to be combined
+ * in order to calculate a TOD clock.
+ */
+static int
+xen_rtc_gettime(device_t dev, struct timespec *ts)
+{
+	struct timespec w_ts, u_ts;
+
+	device_printf(dev, "[XEN] xen_rtc_gettime\n");
+	xen_fetch_wallclock(&w_ts);
+	device_printf(dev, "[XEN] xen_rtc_gettime: wallclock %ld sec; %ld nsec\n", (long int) w_ts.tv_sec, (long int) w_ts.tv_nsec);
+	xen_fetch_uptime(&u_ts);
+	device_printf(dev, "[XEN] xen_rtc_gettime: uptime %ld sec; %ld nsec\n", (long int) u_ts.tv_sec, (long int) u_ts.tv_nsec);
+
+	timespecclear(ts);
+	timespecadd(ts, &w_ts);
+	timespecadd(ts, &u_ts);
+
+	device_printf(dev, "[XEN] xen_rtc_gettime: TOD %ld sec; %ld nsec\n", (long int) ts->tv_sec, (long int) ts->tv_nsec);
+
+	return(0);
+}
+
+static void
+xen_rtc_identify(driver_t *drv, device_t parent)
+{
+        BUS_ADD_CHILD(parent, 0, "rtc", 0);
+}
+
+static device_method_t xen_rtc_methods[] = {
+	/* Device interface */
+	DEVMETHOD(device_probe,		xen_rtc_probe),
+	DEVMETHOD(device_attach,	xen_rtc_attach),
+	DEVMETHOD(device_identify,	xen_rtc_identify),
+
+	DEVMETHOD(device_detach,	bus_generic_detach),
+	DEVMETHOD(device_shutdown,	bus_generic_shutdown),
+
+	/* clock interface */
+	DEVMETHOD(clock_gettime,	xen_rtc_gettime),
+	DEVMETHOD(clock_settime,	xen_rtc_settime),
+
+	{ 0, 0 }
+};
+
+
+static driver_t xen_rtc_driver = {
+	"rtc",
+	xen_rtc_methods,
+	0
+};
+
+static devclass_t xen_rtc_devclass;
+
+DRIVER_MODULE(rtc, nexus, xen_rtc_driver, xen_rtc_devclass, 0, 0);

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 04:25:38 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CD60A1065673;
	Thu, 28 May 2009 04:25:38 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BC0218FC0C;
	Thu, 28 May 2009 04:25:38 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4S4PcTA022541;
	Thu, 28 May 2009 04:25:38 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4S4PcNI022540;
	Thu, 28 May 2009 04:25:38 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <200905280425.n4S4PcNI022540@svn.freebsd.org>
From: Marcel Moolenaar 
Date: Thu, 28 May 2009 04:25:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192954 - head/contrib/ee
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 04:25:39 -0000

Author: marcel
Date: Thu May 28 04:25:38 2009
New Revision: 192954
URL: http://svn.freebsd.org/changeset/base/192954

Log:
  char can be unsigned, like on ARM and PowerPC. Unbreak the
  build for those by propagating the type of character from
  char to int.

Modified:
  head/contrib/ee/ee.c

Modified: head/contrib/ee/ee.c
==============================================================================
--- head/contrib/ee/ee.c	Thu May 28 04:17:05 2009	(r192953)
+++ head/contrib/ee/ee.c	Thu May 28 04:25:38 2009	(r192954)
@@ -937,7 +937,7 @@ int temp_int;
 int 
 out_char(window, character, column)	/* output non-printing character */
 WINDOW *window;
-char character;
+int character;
 int column;
 {
 	int i1, i2;
@@ -985,7 +985,7 @@ int column;
 
 int 
 len_char(character, column)	/* return the length of the character	*/
-char character;
+int character;
 int column;	/* the column must be known to provide spacing for tabs	*/
 {
 	int length;

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 05:24:39 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8DFE8106566B;
	Thu, 28 May 2009 05:24:39 +0000 (UTC) (envelope-from kaduk@MIT.EDU)
Received: from biscayne-one-station.mit.edu (BISCAYNE-ONE-STATION.MIT.EDU
	[18.7.7.80]) by mx1.freebsd.org (Postfix) with ESMTP id 422338FC13;
	Thu, 28 May 2009 05:24:38 +0000 (UTC) (envelope-from kaduk@MIT.EDU)
Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
	by biscayne-one-station.mit.edu (8.13.6/8.9.2) with ESMTP id
	n4S5BIUY007784; Thu, 28 May 2009 01:11:18 -0400 (EDT)
Received: from multics.mit.edu (MULTICS.MIT.EDU [18.187.1.73])
	(authenticated bits=56) (User authenticated as kaduk@ATHENA.MIT.EDU)
	by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id n4S5BGam015887
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT);
	Thu, 28 May 2009 01:11:17 -0400 (EDT)
Received: (from kaduk@localhost) by multics.mit.edu (8.12.9.20060308)
	id n4S5BFn5022310; Thu, 28 May 2009 01:11:15 -0400 (EDT)
Date: Thu, 28 May 2009 01:11:15 -0400 (EDT)
From: Benjamin Kaduk 
To: Zachary Loafman 
In-Reply-To: <20090528014726.GG3704@isilon.com>
Message-ID: 
References: <200905271636.n4RGasNe003922@svn.freebsd.org>
	<47d0403c0905271005t7f57f9b9h3d0721bbb1fbedc2@mail.gmail.com>
	<20090528014726.GG3704@isilon.com>
User-Agent: Alpine 1.10 (GSO 962 2008-03-14)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII
X-Scanned-By: MIMEDefang 2.42
X-Spam-Flag: NO
X-Spam-Score: 0.00
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org, dfr@FreeBSD.org,
	Ben Kaduk 
Subject: Re: Review: fail(9) style/grammar (was Re: svn commit: r192908 ...)
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 05:24:40 -0000

On Wed, 27 May 2009, Zachary Loafman wrote:

> On Wed, May 27, 2009 at 10:05:44AM -0700, Ben Kaduk wrote:
>> Our man page style says that new sentences should start on new lines.
>> (Since the '.' character is used for defining macros, and sometimes
>> the processor can get confused.)
>
> Ben -
>
> Thanks for the pedantry! I've attached a patch that should address your
> issues. (Doug, please review as mentor when you get a chance.)

Thanks!

>
> This is my first man page, so I apologize for the style violations. I
> fixed all the new sentence instances I could find, but I left the "e.g."
> and "i.e." instances untouched. That seems like it would suffer from the
> same issue, but I left them alone for now.
>
> Is there a style(9) equivalent for man pages? I hunted for a bit, but
> "man -k style" returned only style(9) and style.Makefile(9).

I think that probably the closest thing would be groff_mdoc(9), but
that's not exactly a style guide ... I think most of it ends up
just being picked up gradually, so don't feel too bad about missing
a few things here and there.

Things are a bit hazy in my memory, but I think that the new
sentence-->new line may also relate to having two spaces
between sentences -- I think that (e.g.) "e.g." should be okay.

The patch in your later message looks good.

Thanks!

-Ben Kaduk

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 06:14:03 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A18CA106566C;
	Thu, 28 May 2009 06:14:03 +0000 (UTC)
	(envelope-from kientzle@freebsd.org)
Received: from kientzle.com (kientzle.com [66.166.149.50])
	by mx1.freebsd.org (Postfix) with ESMTP id 5A01C8FC15;
	Thu, 28 May 2009 06:14:03 +0000 (UTC)
	(envelope-from kientzle@freebsd.org)
Received: (from root@localhost)
	by kientzle.com (8.14.3/8.14.3) id n4S5p3qN024519;
	Wed, 27 May 2009 22:51:03 -0700 (PDT)
	(envelope-from kientzle@freebsd.org)
Received: from dark.x.kientzle.com (fw2.kientzle.com [10.123.1.2])
	by kientzle.com with SMTP id 9chw6sf4j6q4ib6nz7wq7twf5e;
	Wed, 27 May 2009 22:51:02 -0700 (PDT)
	(envelope-from kientzle@freebsd.org)
Message-ID: <4A1E2646.6040807@freebsd.org>
Date: Wed, 27 May 2009 22:51:02 -0700
From: Tim Kientzle 
User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US;
	rv:1.8.1.21) Gecko/20090409 SeaMonkey/1.1.15
MIME-Version: 1.0
To: Benjamin Kaduk 
References: <200905271636.n4RGasNe003922@svn.freebsd.org>
	<47d0403c0905271005t7f57f9b9h3d0721bbb1fbedc2@mail.gmail.com>
	<20090528014726.GG3704@isilon.com>
	
In-Reply-To: 
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: dfr@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org,
	Ben Kaduk ,
	Zachary Loafman , svn-src-head@freebsd.org
Subject: Re: Review: fail(9) style/grammar (was Re: svn commit: r192908 ...)
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 06:14:04 -0000

Benjamin Kaduk wrote:
> ... I think that the new
> sentence-->new line may also relate to having two spaces
> between sentences -- I think that (e.g.) "e.g." should be okay.

It's mostly about keeping diffs easy to read.
Changes that add, remove, or edit a single sentence
are pretty common.
If every sentence starts on a new line, then such
changes only affect a couple of lines.
Nroff will wrap paragraphs for you, so this doesn't
affect the formatted output.

The alternative is usually to word-wrap blocks
of text in your editor.  In that case, editing
even one word (and then re-wrapping) can affect
the rest of the paragraph.  This causes many-line
diffs that are a lot harder to read.

So the rule is "every sentence starts on a new line".

In particular, "e.g.," and "i.e." never start or
end a sentence, so they're unaffected by this rule.
However, I personally try to avoid Latin abbreviations
such as "e.g." and "i.e." in my own writing.
I strongly prefer "for example" to "e.g.".
For "i.e.", I generally find that it can be replaced
with a sentence break, semicolon, or even a comma splice.
Opinions differ, of course.

Tim

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 06:52:15 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0C7C6106566B;
	Thu, 28 May 2009 06:52:15 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EF7C68FC14;
	Thu, 28 May 2009 06:52:14 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4S6qEHZ025967;
	Thu, 28 May 2009 06:52:14 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4S6qEYn025966;
	Thu, 28 May 2009 06:52:14 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <200905280652.n4S6qEYn025966@svn.freebsd.org>
From: Alan Cox 
Date: Thu, 28 May 2009 06:52:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192962 - head/sys/vm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 06:52:15 -0000

Author: alc
Date: Thu May 28 06:52:14 2009
New Revision: 192962
URL: http://svn.freebsd.org/changeset/base/192962

Log:
  Revise vm_pageout_scan()'s handling of partially dirty pages.  Specifically,
  rather than unconditionally making partially dirty pages fully dirty, only
  make partially dirty pages fully dirty if the pmap says that the page has
  been modified.
  
  (This change is also a small optimization.  It eliminate an unnecessary call
  to pmap_is_modified() on pages that are mapped read only.)
  
  Suggested by:	tegge

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==============================================================================
--- head/sys/vm/vm_pageout.c	Thu May 28 06:39:11 2009	(r192961)
+++ head/sys/vm/vm_pageout.c	Thu May 28 06:52:14 2009	(r192962)
@@ -822,12 +822,13 @@ rescan0:
 		}
 
 		/*
-		 * If the upper level VM system doesn't know anything about 
-		 * the page being dirty, we have to check for it again.  As 
-		 * far as the VM code knows, any partially dirty pages are 
-		 * fully dirty.
+		 * If the upper level VM system does not believe that the page
+		 * is fully dirty, but it is mapped for write access, then we
+		 * consult the pmap to see if the page's dirty status should
+		 * be updated.
 		 */
-		if (m->dirty == 0 && !pmap_is_modified(m)) {
+		if (m->dirty != VM_PAGE_BITS_ALL &&
+		    (m->flags & PG_WRITEABLE) != 0) {
 			/*
 			 * Avoid a race condition: Unless write access is
 			 * removed from the page, another processor could
@@ -841,10 +842,10 @@ rescan0:
 			 * to the page, removing all access will be cheaper
 			 * overall.
 			 */
-			if ((m->flags & PG_WRITEABLE) != 0)
+			if (pmap_is_modified(m))
+				vm_page_dirty(m);
+			else if (m->dirty == 0)
 				pmap_remove_all(m);
-		} else {
-			vm_page_dirty(m);
 		}
 
 		if (m->valid == 0) {

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 06:52:16 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CC1A3106566C;
	Thu, 28 May 2009 06:52:16 +0000 (UTC) (envelope-from ed@hoeg.nl)
Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211])
	by mx1.freebsd.org (Postfix) with ESMTP id 6938B8FC16;
	Thu, 28 May 2009 06:52:16 +0000 (UTC) (envelope-from ed@hoeg.nl)
Received: by palm.hoeg.nl (Postfix, from userid 1000)
	id 65B9F1CE01; Thu, 28 May 2009 08:52:15 +0200 (CEST)
Date: Thu, 28 May 2009 08:52:15 +0200
From: Ed Schouten 
To: Zachary Loafman 
Message-ID: <20090528065215.GH48776@hoeg.nl>
References: <200905271636.n4RGasNe003922@svn.freebsd.org>
	<20090527182807.GG48776@hoeg.nl> <20090528010220.GF3704@isilon.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="MrRUTeZlqqNo1jQ9"
Content-Disposition: inline
In-Reply-To: <20090528010220.GF3704@isilon.com>
User-Agent: Mutt/1.5.19 (2009-01-05)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r192908 - in head: share/man/man9 sys/confsys/kern
	sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 06:52:17 -0000


--MrRUTeZlqqNo1jQ9
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi Zach,

* Zachary Loafman  wrote:
> I personally find the first form clearer to skim through visually. The
> second form moves 'head1' and 'head2' around. It's not like it's hard to
> follow, but I think the first is clearer to read. I don't think the
> TAILQ_FIRST buys you much here.

Yeah, that's true. The TAILQ uses a sentinel to terminate the list,
which means it's sometimes harder, if not impossible to do this. Leaving
it as it is right now is probably a good idea.

--=20
 Ed Schouten 
 WWW: http://80386.nl/

--MrRUTeZlqqNo1jQ9
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEARECAAYFAkoeNJ4ACgkQ52SDGA2eCwUCpACfQwseaGk3NQNonq1seZl+bNnl
NtwAn00Uyn8trE8DPt+Sqhs7qKZkotzH
=eJqy
-----END PGP SIGNATURE-----

--MrRUTeZlqqNo1jQ9--

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 07:20:52 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BBA651065673;
	Thu, 28 May 2009 07:20:52 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AA3F68FC17;
	Thu, 28 May 2009 07:20:52 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4S7Kq6S026822;
	Thu, 28 May 2009 07:20:52 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4S7KqFL026821;
	Thu, 28 May 2009 07:20:52 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <200905280720.n4S7KqFL026821@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Thu, 28 May 2009 07:20:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192966 - head/lib/libc/posix1e
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 07:20:53 -0000

Author: trasz
Date: Thu May 28 07:20:52 2009
New Revision: 192966
URL: http://svn.freebsd.org/changeset/base/192966

Log:
  Fix off by one error in acl_create_entry(3).
  
  Reviewed by:	rwatson@
  MFC after:	2 weeks

Modified:
  head/lib/libc/posix1e/acl_entry.c

Modified: head/lib/libc/posix1e/acl_entry.c
==============================================================================
--- head/lib/libc/posix1e/acl_entry.c	Thu May 28 07:15:08 2009	(r192965)
+++ head/lib/libc/posix1e/acl_entry.c	Thu May 28 07:20:52 2009	(r192966)
@@ -51,7 +51,12 @@ acl_create_entry(acl_t *acl_p, acl_entry
 
 	acl_int = &(*acl_p)->ats_acl;
 
-	if ((acl_int->acl_cnt >= ACL_MAX_ENTRIES) || (acl_int->acl_cnt < 0)) {
+	/*
+	 * +1, because we are checking if there is space left for one more
+	 * entry.
+	 */
+	if ((acl_int->acl_cnt + 1 >= ACL_MAX_ENTRIES) ||
+	    (acl_int->acl_cnt < 0)) {
 		errno = EINVAL;
 		return (-1);
 	}

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 07:26:36 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 56010106564A;
	Thu, 28 May 2009 07:26:36 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4525E8FC0A;
	Thu, 28 May 2009 07:26:36 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4S7QawX027043;
	Thu, 28 May 2009 07:26:36 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4S7QaWA027042;
	Thu, 28 May 2009 07:26:36 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <200905280726.n4S7QaWA027042@svn.freebsd.org>
From: Alan Cox 
Date: Thu, 28 May 2009 07:26:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192968 - head/sys/vm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 07:26:36 -0000

Author: alc
Date: Thu May 28 07:26:36 2009
New Revision: 192968
URL: http://svn.freebsd.org/changeset/base/192968

Log:
  Change vm_object_page_remove() such that it clears the page's dirty bits
  when it invalidates the page.
  
  Suggested by:	tegge

Modified:
  head/sys/vm/vm_object.c

Modified: head/sys/vm/vm_object.c
==============================================================================
--- head/sys/vm/vm_object.c	Thu May 28 07:22:11 2009	(r192967)
+++ head/sys/vm/vm_object.c	Thu May 28 07:26:36 2009	(r192968)
@@ -1902,8 +1902,10 @@ again:
 				pmap_remove_all(p);
 			/* Account for removal of managed, wired mappings. */
 			p->wire_count -= wirings;
-			if (!clean_only)
+			if (!clean_only) {
 				p->valid = 0;
+				vm_page_undirty(p);
+			}
 			continue;
 		}
 		if (vm_page_sleep_if_busy(p, TRUE, "vmopar"))

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 07:43:06 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B8638106564A;
	Thu, 28 May 2009 07:43:06 +0000 (UTC)
	(envelope-from brian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8C47F8FC12;
	Thu, 28 May 2009 07:43:06 +0000 (UTC)
	(envelope-from brian@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4S7h65p027453;
	Thu, 28 May 2009 07:43:06 GMT (envelope-from brian@svn.freebsd.org)
Received: (from brian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4S7h6RI027452;
	Thu, 28 May 2009 07:43:06 GMT (envelope-from brian@svn.freebsd.org)
Message-Id: <200905280743.n4S7h6RI027452@svn.freebsd.org>
From: Brian Somers 
Date: Thu, 28 May 2009 07:43:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192970 - head/etc/periodic/daily
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 07:43:07 -0000

Author: brian
Date: Thu May 28 07:43:06 2009
New Revision: 192970
URL: http://svn.freebsd.org/changeset/base/192970

Log:
  Update this script so that it handles different ruleset failures
  differently.  The output now shows the ruleset and shortens to
  slightly different text (using $daily_status_mail_rejects_shorten),
  but it should be more descriptive.
  
  PR:		35018
  Inspired by:	Mikhail Teterin - mi at aldan dot algebra dot com
  MFC after:	3 weeks

Modified:
  head/etc/periodic/daily/460.status-mail-rejects

Modified: head/etc/periodic/daily/460.status-mail-rejects
==============================================================================
--- head/etc/periodic/daily/460.status-mail-rejects	Thu May 28 07:37:49 2009	(r192969)
+++ head/etc/periodic/daily/460.status-mail-rejects	Thu May 28 07:43:06 2009	(r192970)
@@ -12,10 +12,8 @@ then
 fi
 
 case "$daily_status_mail_rejects_shorten" in
-[Yy][Ee][Ss])
-    sed_output='\4 \3...';;
-*)
-    sed_output='\2 (\3... \4)';;
+[Yy][Ee][Ss])	shorten='cut -d" " -f2,3';;
+*)		shorten=cat;;
 esac
 
 case "$daily_status_mail_rejects_enable" in
@@ -39,7 +37,8 @@ case "$daily_status_mail_rejects_enable"
 	    echo
 	    echo Checking for rejected mail hosts:
 
-	    start=`date -v-1d '+%b %e'`
+	    yesterday=$(date -v-1d '+%b %e')
+	    today=$(date '+%b %e')
 	    n=$(($daily_status_mail_rejects_logs - 2))
 	    rc=$({
 		while [ $n -ge 0 ]
@@ -57,9 +56,14 @@ case "$daily_status_mail_rejects_enable"
 		    n=$(($n - 1))
 		done
 		cat /var/log/maillog
-	    } |
-		sed -n -E "s/^$start"'.*ruleset=check_[^ ]+, +arg1=,]+).*reject=([^ ]+) .* ([^ ]+)$/'"$sed_output"'/p' |
-		sort -f | uniq -ic | sort -fnr | tee /dev/stderr | wc -l)
+	    } | sed -Ene "/^$today/q" -e "/^$yesterday/{"'
+		    s/.*ruleset=check_relay,.* relay=([^,]+), reject=([^ ]*).*/\2 check_relay \1/p
+		    t end
+                    s/.*ruleset=check_rcpt,.* arg1=,]+).* reject=([^ ]+) .* ([^ ]+)/\2 check_rcpt \1 \3/p
+		    t end
+                    s/.*ruleset=check_([^,]+),.* arg1=,]+).* reject=([^ ]+) .* ([^ ]+)/\4 check_\1 \3 \5/p
+		    :end
+		}' | eval $shorten | sort -f | uniq -ic | sort -fnr | tee /dev/stderr | wc -l)
 	    [ $rc -gt 0 ] && rc=1
 	fi;;
 

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 08:18:14 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id ED81A106568D;
	Thu, 28 May 2009 08:18:13 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DAF828FC18;
	Thu, 28 May 2009 08:18:13 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4S8IDTK028329;
	Thu, 28 May 2009 08:18:13 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4S8IDjj028328;
	Thu, 28 May 2009 08:18:13 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <200905280818.n4S8IDjj028328@svn.freebsd.org>
From: Kip Macy 
Date: Thu, 28 May 2009 08:18:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192971 - in head/sys:
	cddl/contrib/opensolaris/uts/common/rpc modules/zfs rpc xdr
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 08:18:14 -0000

Author: kmacy
Date: Thu May 28 08:18:12 2009
New Revision: 192971
URL: http://svn.freebsd.org/changeset/base/192971

Log:
  MFdevbranch 192944
   - add FreeBSD implementation of xdrmem_control needed by zfs
   - have zfs define xdr_ops using FreeBSD's definition
   - remove solaris xdr files from zfs compile

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.h
  head/sys/modules/zfs/Makefile
  head/sys/rpc/xdr.h
  head/sys/xdr/xdr_mem.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.h
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.h	Thu May 28 07:43:06 2009	(r192970)
+++ head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.h	Thu May 28 08:18:12 2009	(r192971)
@@ -121,6 +121,7 @@ typedef struct XDR {
  * Changes must be reviewed by Solaris File Sharing
  * Changes must be communicated to contract-2003-523@sun.com
  */
+#ifndef __FreeBSD__	
 struct xdr_ops {
 #ifdef __STDC__
 #if !defined(_KERNEL)
@@ -168,6 +169,28 @@ struct xdr_ops {
 #endif
 };
 
+#else /* FreeBSD */
+struct xdr_ops {
+	/* get a long from underlying stream */
+	bool_t	(*x_getint32)(struct XDR *, int32_t *);
+	/* put a long to " */
+	bool_t	(*x_putint32)(struct XDR *, const int32_t *);
+	/* get some bytes from " */
+	bool_t	(*x_getbytes)(struct XDR *, char *, u_int);
+	/* put some bytes to " */
+	bool_t	(*x_putbytes)(struct XDR *, const char *, u_int);
+	/* returns bytes off from beginning */
+	u_int	(*x_getpostn)(struct XDR *);
+	/* lets you reposition the stream */
+	bool_t  (*x_setpostn)(struct XDR *, u_int);
+	/* buf quick ptr to buffered data */
+	int32_t *(*x_inline)(struct XDR *, u_int);
+	/* free privates of this xdr_stream */
+	void	(*x_destroy)(struct XDR *);
+	bool_t	(*x_control)(struct XDR *, int, void *);
+};
+#endif
+	
 /*
  * Operations defined on a XDR handle
  *

Modified: head/sys/modules/zfs/Makefile
==============================================================================
--- head/sys/modules/zfs/Makefile	Thu May 28 07:43:06 2009	(r192970)
+++ head/sys/modules/zfs/Makefile	Thu May 28 08:18:12 2009	(r192971)
@@ -44,10 +44,10 @@ SRCS+=	list.c
 SRCS+=	nvpair_alloc_system.c
 SRCS+=	taskq.c
 
-.PATH:	${SUNW}/uts/common/rpc
-SRCS+=	opensolaris_xdr.c
-SRCS+=	opensolaris_xdr_array.c
-SRCS+=	opensolaris_xdr_mem.c
+#.PATH:	${SUNW}/uts/common/rpc
+#SRCS+=	opensolaris_xdr.c
+#SRCS+=	opensolaris_xdr_array.c
+#SRCS+=	opensolaris_xdr_mem.c
 
 .PATH:	${SUNW}/uts/common/zmod
 SRCS+=	adler32.c

Modified: head/sys/rpc/xdr.h
==============================================================================
--- head/sys/rpc/xdr.h	Thu May 28 07:43:06 2009	(r192970)
+++ head/sys/rpc/xdr.h	Thu May 28 08:18:12 2009	(r192971)
@@ -338,6 +338,22 @@ typedef struct netobj netobj;
 extern bool_t   xdr_netobj(XDR *, struct netobj *);
 
 /*
+ * These are XDR control operators
+ */
+
+#define	XDR_GET_BYTES_AVAIL 	1
+#define	XDR_PEEK		2
+#define	XDR_SKIPBYTES		3
+
+struct xdr_bytesrec {
+	bool_t xc_is_last_record;
+	size_t xc_num_avail;
+};
+
+typedef struct xdr_bytesrec xdr_bytesrec;
+
+
+/*
  * These are the public routines for the various implementations of
  * xdr streams.
  */

Modified: head/sys/xdr/xdr_mem.c
==============================================================================
--- head/sys/xdr/xdr_mem.c	Thu May 28 07:43:06 2009	(r192970)
+++ head/sys/xdr/xdr_mem.c	Thu May 28 08:18:12 2009	(r192971)
@@ -66,7 +66,8 @@ static u_int xdrmem_getpos(XDR *);
 static bool_t xdrmem_setpos(XDR *, u_int);
 static int32_t *xdrmem_inline_aligned(XDR *, u_int);
 static int32_t *xdrmem_inline_unaligned(XDR *, u_int);
-
+static bool_t xdrmem_control(XDR *xdrs, int request, void *info);
+	
 static const struct	xdr_ops xdrmem_ops_aligned = {
 	xdrmem_getlong_aligned,
 	xdrmem_putlong_aligned,
@@ -75,7 +76,8 @@ static const struct	xdr_ops xdrmem_ops_a
 	xdrmem_getpos,
 	xdrmem_setpos,
 	xdrmem_inline_aligned,
-	xdrmem_destroy
+	xdrmem_destroy,
+	xdrmem_control
 };
 
 static const struct	xdr_ops xdrmem_ops_unaligned = {
@@ -86,7 +88,8 @@ static const struct	xdr_ops xdrmem_ops_u
 	xdrmem_getpos,
 	xdrmem_setpos,
 	xdrmem_inline_unaligned,
-	xdrmem_destroy
+	xdrmem_destroy,
+	xdrmem_control
 };
 
 /*
@@ -228,3 +231,45 @@ xdrmem_inline_unaligned(XDR *xdrs, u_int
 
 	return (0);
 }
+
+static bool_t
+xdrmem_control(XDR *xdrs, int request, void *info)
+{
+	xdr_bytesrec *xptr;
+	int32_t *l;
+	int len;
+
+	switch (request) {
+
+	case XDR_GET_BYTES_AVAIL:
+		xptr = (xdr_bytesrec *)info;
+		xptr->xc_is_last_record = TRUE;
+		xptr->xc_num_avail = xdrs->x_handy;
+		return (TRUE);
+
+	case XDR_PEEK:
+		/*
+		 * Return the next 4 byte unit in the XDR stream.
+		 */
+		if (xdrs->x_handy < sizeof (int32_t))
+			return (FALSE);
+		l = (int32_t *)info;
+		*l = (int32_t)ntohl((uint32_t)
+		    (*((int32_t *)(xdrs->x_private))));
+		return (TRUE);
+
+	case XDR_SKIPBYTES:
+		/*
+		 * Skip the next N bytes in the XDR stream.
+		 */
+		l = (int32_t *)info;
+		len = RNDUP((int)(*l));
+		if (xdrs->x_handy < len)
+			return (FALSE);
+		xdrs->x_handy -= len;
+		xdrs->x_private = (char *)xdrs->x_private + len;
+		return (TRUE);
+
+	}
+	return (FALSE);
+}

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 08:22:36 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7404E106564A;
	Thu, 28 May 2009 08:22:36 +0000 (UTC) (envelope-from dfr@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 627978FC14;
	Thu, 28 May 2009 08:22:36 +0000 (UTC) (envelope-from dfr@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4S8Max9028525;
	Thu, 28 May 2009 08:22:36 GMT (envelope-from dfr@svn.freebsd.org)
Received: (from dfr@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4S8MaKf028523;
	Thu, 28 May 2009 08:22:36 GMT (envelope-from dfr@svn.freebsd.org)
Message-Id: <200905280822.n4S8MaKf028523@svn.freebsd.org>
From: Doug Rabson 
Date: Thu, 28 May 2009 08:22:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192972 - in head/sys/boot: common pc98/boot2
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 08:22:36 -0000

Author: dfr
Date: Thu May 28 08:22:36 2009
New Revision: 192972
URL: http://svn.freebsd.org/changeset/base/192972

Log:
  Some of the boot loader code only works on a ufs file system, but it
  uses the generic struct dirent, which happens to look identical to UFS's
  struct direct.  If BSD ever changes dirent then this will be a problem.
  
  Submitted by:	matthew dot fleming at isilon dot com

Modified:
  head/sys/boot/common/ufsread.c
  head/sys/boot/pc98/boot2/sys.c

Modified: head/sys/boot/common/ufsread.c
==============================================================================
--- head/sys/boot/common/ufsread.c	Thu May 28 08:18:12 2009	(r192971)
+++ head/sys/boot/common/ufsread.c	Thu May 28 08:22:36 2009	(r192972)
@@ -47,6 +47,7 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
 #include 
 #ifdef UFS_SMALL_CGBASE
 /* XXX: Revert to old (broken for over 1.5Tb filesystems) version of cgbase
@@ -93,7 +94,7 @@ static __inline int
 fsfind(const char *name, ino_t * ino)
 {
 	char buf[DEV_BSIZE];
-	struct dirent *d;
+	struct direct *d;
 	char *s;
 	ssize_t n;
 
@@ -104,7 +105,7 @@ fsfind(const char *name, ino_t * ino)
 			if (ls)
 				printf("%s ", d->d_name);
 			else if (!strcmp(name, d->d_name)) {
-				*ino = d->d_fileno;
+				*ino = d->d_ino;
 				return d->d_type;
 			}
 			s += d->d_reclen;

Modified: head/sys/boot/pc98/boot2/sys.c
==============================================================================
--- head/sys/boot/pc98/boot2/sys.c	Thu May 28 08:18:12 2009	(r192971)
+++ head/sys/boot/pc98/boot2/sys.c	Thu May 28 08:22:36 2009	(r192972)
@@ -34,7 +34,7 @@ __FBSDID("$FreeBSD$");
  */
 
 #include "boot.h"
-#include 
+#include 
 
 #if 0
 /* #define BUFSIZE 4096 */
@@ -142,7 +142,7 @@ find(char *path)
 {
 	char *rest, ch;
 	int block, off, loc, ino = ROOTINO;
-	struct dirent *dp;
+	struct direct *dp;
 	char list_only;
 
 	list_only = (path[0] == '?' && path[1] == '\0');
@@ -174,12 +174,12 @@ loop:
 			devread(iobuf, fsbtodb(fs, block_map(block)) + boff,
 				blksize(fs, &inode, block));
 		}
-		dp = (struct dirent *)(iobuf + off);
+		dp = (struct direct *)(iobuf + off);
 		loc += dp->d_reclen;
-		if (dp->d_fileno && list_only)
+		if (dp->d_ino && list_only)
 			printf("%s ", dp->d_name);
-	} while (!dp->d_fileno || strcmp(path, dp->d_name));
-	ino = dp->d_fileno;
+	} while (!dp->d_ino || strcmp(path, dp->d_name));
+	ino = dp->d_ino;
 	*(path = rest) = ch;
 	goto loop;
 }

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 10:24:27 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E80E7106566C;
	Thu, 28 May 2009 10:24:27 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D679C8FC17;
	Thu, 28 May 2009 10:24:27 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4SAOQuB032487;
	Thu, 28 May 2009 10:24:26 GMT (envelope-from des@svn.freebsd.org)
Received: (from des@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4SAOQOt032486;
	Thu, 28 May 2009 10:24:26 GMT (envelope-from des@svn.freebsd.org)
Message-Id: <200905281024.n4SAOQOt032486@svn.freebsd.org>
From: Dag-Erling Smorgrav 
Date: Thu, 28 May 2009 10:24:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192973 - head/sys/fs/pseudofs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 10:24:28 -0000

Author: des
Date: Thu May 28 10:24:26 2009
New Revision: 192973
URL: http://svn.freebsd.org/changeset/base/192973

Log:
  Use a temporary variable to avoid a duplicate strlen().
  
  Submitted by:	kib
  MFC after:	1 week

Modified:
  head/sys/fs/pseudofs/pseudofs_vnops.c

Modified: head/sys/fs/pseudofs/pseudofs_vnops.c
==============================================================================
--- head/sys/fs/pseudofs/pseudofs_vnops.c	Thu May 28 08:22:36 2009	(r192972)
+++ head/sys/fs/pseudofs/pseudofs_vnops.c	Thu May 28 10:24:26 2009	(r192973)
@@ -364,12 +364,13 @@ pfs_vptocnp(struct vop_vptocnp_args *ap)
 		}
 		bcopy(pidbuf, buf + i, len);
 	} else {
-		i -= strlen(pd->pn_name);
+		len = strlen(pd->pn_name);
+		i -= len;
 		if (i < 0) {
 			error = ENOMEM;
 			goto failed;
 		}
-		bcopy(pd->pn_name, buf + i, strlen(pd->pn_name));
+		bcopy(pd->pn_name, buf + i, len);
 	}
 
 	pn = pd->pn_parent;

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 10:59:16 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 705DC1065672;
	Thu, 28 May 2009 10:59:16 +0000 (UTC) (envelope-from ed@hoeg.nl)
Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211])
	by mx1.freebsd.org (Postfix) with ESMTP id 0DD438FC14;
	Thu, 28 May 2009 10:59:16 +0000 (UTC) (envelope-from ed@hoeg.nl)
Received: by palm.hoeg.nl (Postfix, from userid 1000)
	id 3427C1CF43; Thu, 28 May 2009 12:59:15 +0200 (CEST)
Date: Thu, 28 May 2009 12:59:15 +0200
From: Ed Schouten 
To: Marcel Moolenaar 
Message-ID: <20090528105915.GK48776@hoeg.nl>
References: <200905280425.n4S4PcNI022540@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="zYo4Elh1vtcYNvbq"
Content-Disposition: inline
In-Reply-To: <200905280425.n4S4PcNI022540@svn.freebsd.org>
User-Agent: Mutt/1.5.19 (2009-01-05)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r192954 - head/contrib/ee
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 10:59:17 -0000


--zYo4Elh1vtcYNvbq
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* Marcel Moolenaar  wrote:
> Author: marcel
> Date: Thu May 28 04:25:38 2009
> New Revision: 192954
> URL: http://svn.freebsd.org/changeset/base/192954
>=20
> Log:
>   char can be unsigned, like on ARM and PowerPC. Unbreak the
>   build for those by propagating the type of character from
>   char to int.
>=20
> Modified:
>   head/contrib/ee/ee.c

Thanks!

--=20
 Ed Schouten 
 WWW: http://80386.nl/

--zYo4Elh1vtcYNvbq
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEARECAAYFAkoeboMACgkQ52SDGA2eCwVGhgCfV7K/QEPPAUBLnb7CGIOZRUmc
K+cAnj5/u1Np/uzAO7B7ejhyRKfWilWg
=Zr6r
-----END PGP SIGNATURE-----

--zYo4Elh1vtcYNvbq--

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 15:02:21 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8AD0C106568A;
	Thu, 28 May 2009 15:02:21 +0000 (UTC) (envelope-from zml@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 789EF8FC25;
	Thu, 28 May 2009 15:02:21 +0000 (UTC) (envelope-from zml@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4SF2LAS041091;
	Thu, 28 May 2009 15:02:21 GMT (envelope-from zml@svn.freebsd.org)
Received: (from zml@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4SF2LUB041090;
	Thu, 28 May 2009 15:02:21 GMT (envelope-from zml@svn.freebsd.org)
Message-Id: <200905281502.n4SF2LUB041090@svn.freebsd.org>
From: Zachary Loafman 
Date: Thu, 28 May 2009 15:02:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192976 - head/lib/libc/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 15:02:22 -0000

Author: zml
Date: Thu May 28 15:02:21 2009
New Revision: 192976
URL: http://svn.freebsd.org/changeset/base/192976

Log:
  Revert unnecessary memset after calloc.
  
  Suggested by:       jhb
  Approved by:        dfr (mentor)

Modified:
  head/lib/libc/include/nss_tls.h

Modified: head/lib/libc/include/nss_tls.h
==============================================================================
--- head/lib/libc/include/nss_tls.h	Thu May 28 14:48:10 2009	(r192975)
+++ head/lib/libc/include/nss_tls.h	Thu May 28 15:02:21 2009	(r192976)
@@ -67,7 +67,6 @@ name##_getstate(struct name##_state **p)
 	*p = calloc(1, sizeof(**p));				\
 	if (*p == NULL)						\
 		return (ENOMEM);				\
-	memset(*p, 0, sizeof(**p));				\
 	rv = _pthread_setspecific(name##_state_key, *p);	\
 	if (rv != 0) {						\
 		free(*p);					\

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 15:02:44 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BBD2510656A6;
	Thu, 28 May 2009 15:02:44 +0000 (UTC) (envelope-from zml@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A9DED8FC22;
	Thu, 28 May 2009 15:02:44 +0000 (UTC) (envelope-from zml@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4SF2iWC041136;
	Thu, 28 May 2009 15:02:44 GMT (envelope-from zml@svn.freebsd.org)
Received: (from zml@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4SF2i0t041135;
	Thu, 28 May 2009 15:02:44 GMT (envelope-from zml@svn.freebsd.org)
Message-Id: <200905281502.n4SF2i0t041135@svn.freebsd.org>
From: Zachary Loafman 
Date: Thu, 28 May 2009 15:02:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192977 - head/lib/libc/rpc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 15:02:45 -0000

Author: zml
Date: Thu May 28 15:02:44 2009
New Revision: 192977
URL: http://svn.freebsd.org/changeset/base/192977

Log:
  Match type for socket option (in practice, unnecessary, but stylistically it's a little nicer).
  
  Suggested by:       jilles
  Approved by:        dfr (mentor)

Modified:
  head/lib/libc/rpc/svc_generic.c

Modified: head/lib/libc/rpc/svc_generic.c
==============================================================================
--- head/lib/libc/rpc/svc_generic.c	Thu May 28 15:02:21 2009	(r192976)
+++ head/lib/libc/rpc/svc_generic.c	Thu May 28 15:02:44 2009	(r192977)
@@ -199,7 +199,7 @@ svc_tli_create(fd, nconf, bindaddr, send
 	struct __rpc_sockinfo si;
 	struct sockaddr_storage ss;
 	socklen_t slen;
-	static const uint32_t true_value = 1;
+	static const int true_value = 1;
 
 	if (fd == RPC_ANYFD) {
 		if (nconf == NULL) {

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 15:02:53 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 366B610657B9;
	Thu, 28 May 2009 15:02:53 +0000 (UTC) (envelope-from zml@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 21A148FC25;
	Thu, 28 May 2009 15:02:53 +0000 (UTC) (envelope-from zml@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4SF2r3m041179;
	Thu, 28 May 2009 15:02:53 GMT (envelope-from zml@svn.freebsd.org)
Received: (from zml@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4SF2rig041178;
	Thu, 28 May 2009 15:02:53 GMT (envelope-from zml@svn.freebsd.org)
Message-Id: <200905281502.n4SF2rig041178@svn.freebsd.org>
From: Zachary Loafman 
Date: Thu, 28 May 2009 15:02:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192978 - head/share/man/man9
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 15:02:54 -0000

Author: zml
Date: Thu May 28 15:02:52 2009
New Revision: 192978
URL: http://svn.freebsd.org/changeset/base/192978

Log:
  Fix style/grammar issues in fail(9) man page.
  
  Suggested by:       Ben Kaduk
  Approved by:        dfr (mentor)

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

Modified: head/share/man/man9/fail.9
==============================================================================
--- head/share/man/man9/fail.9	Thu May 28 15:02:44 2009	(r192977)
+++ head/share/man/man9/fail.9	Thu May 28 15:02:52 2009	(r192978)
@@ -48,9 +48,11 @@
 .Fn KFAIL_POINT_GOTO "parent" "name" "error_var" "label"
 .Sh DESCRIPTION
 Fail points are used to add code points where errors may be injected
-in a user controlled fashion. Fail points provide a convenient wrapper
-around user provided error injection code, providing a
-.Xr sysctl 9 MIB , and a parser for that MIB that describes how the error
+in a user controlled fashion.
+Fail points provide a convenient wrapper around user-provided error
+injection code, providing a
+.Xr sysctl 9
+MIB, and a parser for that MIB that describes how the error
 injection code should fire.
 .Pp
 The base fail point macro is
@@ -64,16 +66,19 @@ their own fail point trees), and
 .Fa name
 is the name of the MIB in that tree, and
 .Fa code
-is the error injection code. The
+is the error injection code.
+The
 .Fa code
 argument does not require braces, but it is considered good style to
-use braces for any multi-line code arguments. Inside the
+use braces for any multi-line code arguments.
+Inside the
 .Fa code
 argument, the evaluation of
 .Sy RETURN_VALUE
 is derived from the
 .Fn return
-value set in the sysctl MIB. See
+value set in the sysctl MIB.
+See
 .Sx SYSCTL SETTINGS
 below.
 .Pp
@@ -99,14 +104,14 @@ is the equivalent of
 .Sh SYSCTL VARIABLES
 The
 .Fn KFAIL_POINT_*
-macros add sysctl MIBs where specified. Many base kernel MIBs can be
-found in the
+macros add sysctl MIBs where specified.
+Many base kernel MIBs can be found in the
 .Sy debug.fail_point
 tree (referenced in code by
 .Sy DEBUG_FP
 ).
 .Pp
-The sysctl setting recognizes the following grammar:
+The sysctl variable may be set using the following grammar:
 .Pp
    ::
        ( "->"  )*
@@ -135,27 +140,30 @@ Sleep the specified number of millisecon
 .It Sy panic
 Panic
 .It Sy break
-Break into the debugger.
+Break into the debugger, or trap if there is no debugger support
 .It Sy print
 Print that the fail point executed
 .El
 .Pp
 The % and * modifiers prior to  control when
- is executed. The % form (e.g. "1.2%") can be used to
-specify a probability that  will execute. The * form
-(e.g. "5*") can be used to specify the number of times  should
-be executed before this  is disabled. Only the last probability
-and the last count are used if multiple are specified, i.e. "1.2%2%"
-is the same as "2%". When both a probability and a count are
-specified, the probability is evaluated before the count, i.e. "2%5*"
-means "2% of the time, but only execute it 5 times total".
-.Pp
-The operator -> can be used to express cascading terms. If you specify
-->, it means that if  doesn't 'execute', 
-is evaluated. For the purpose of this operator, the return() and
-print() operators are the only types that cascade. A return() term
-only cascades if the code executes, and a print() term only cascades
-when passed a non-zero argument.
+ is executed.
+The % form (e.g. "1.2%") can be used to specify a
+probability that  will execute.
+The * form (e.g. "5*") can be used to specify the number of
+times  should be executed before this  is disabled.
+Only the last probability and the last count are used if multiple
+are specified, i.e. "1.2%2%" is the same as "2%".
+When both a probability and a count are specified, the probability
+is evaluated before the count, i.e. "2%5*" means "2% of the time,
+but only 5 times total".
+.Pp
+The operator -> can be used to express cascading terms.
+If you specify ->, it means that if  doesn't
+'execute',  is evaluated.
+For the purpose of this operator, the return() and print() operators
+are the only types that cascade.
+A return() term only cascades if the code executes, and a print()
+term only cascades when passed a non-zero argument.
 .Pp
 .Sh EXAMPLES
 .Bl -tag
@@ -164,29 +172,32 @@ when passed a non-zero argument.
 .Fa code
 with RETURN_VALUE set to 5.
 .It Sy sysctl debug.fail_point.foobar="2%return(5)->5%return(22)"
-2/100th of the time, execute
+2/100ths of the time, execute
 .Fa code
-with RETURN_VALUE set to 5. If that doesn't happen, 5% of the time
-execute
+with RETURN_VALUE set to 5.
+If that doesn't happen, 5% of the time execute
 .Fa code
 with RETURN_VALUE set to 22.
 .It Sy sysctl debug.fail_point.foobar="5*return(5)->0.1%return(22)"
-For 5 times, return 5. After that, 1/1000ths of the time, return 22.
+For 5 times, return 5.
+After that, 1/1000th of the time, return 22.
 .It Sy sysctl debug.fail_point.foobar="0.1%5*return(5)"
-Return 5 for 1 in 1000 executions, but only execute 5 times total.
+Return 5 for 1 in 1000 executions, but only 5 times total.
 .It Sy sysctl debug.fail_point.foobar="1%*sleep(50)"
-1/100ths of the time, sleep 50ms.
+1/100th of the time, sleep 50ms.
 .El
 .Pp
 .Sh CAVEATS
 It's easy to shoot yourself in the foot by setting fail points too
-aggressively or setting too many in combination. For example, forcing
+aggressively or setting too many in combination.
+For example, forcing
 .Fn malloc
 to fail consistently is potentially harmful to uptime.
 .Pp
 The
 .Fn sleep
-sysctl setting may not be appropriate in all situations. Currently,
+sysctl setting may not be appropriate in all situations.
+Currently,
 .Fn fail_point_eval
 does not verify whether the context is appropriate for calling
 .Fn msleep .

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 15:39:48 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BC3501065675;
	Thu, 28 May 2009 15:39:48 +0000 (UTC) (envelope-from des@des.no)
Received: from tim.des.no (tim.des.no [194.63.250.121])
	by mx1.freebsd.org (Postfix) with ESMTP id 7AB3D8FC1D;
	Thu, 28 May 2009 15:39:48 +0000 (UTC) (envelope-from des@des.no)
Received: from ds4.des.no (des.no [84.49.246.2])
	by smtp.des.no (Postfix) with ESMTP id 56D256D41D;
	Thu, 28 May 2009 17:39:47 +0200 (CEST)
Received: by ds4.des.no (Postfix, from userid 1001)
	id 3371D844B5; Thu, 28 May 2009 17:39:47 +0200 (CEST)
From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= 
To: Ben Kaduk 
References: <200905271636.n4RGasNe003922@svn.freebsd.org>
	<47d0403c0905271005t7f57f9b9h3d0721bbb1fbedc2@mail.gmail.com>
Date: Thu, 28 May 2009 17:39:47 +0200
In-Reply-To: <47d0403c0905271005t7f57f9b9h3d0721bbb1fbedc2@mail.gmail.com>
	(Ben Kaduk's message of "Wed, 27 May 2009 13:05:44 -0400")
Message-ID: <86tz35qlrw.fsf@ds4.des.no>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	Zachary Loafman , src-committers@freebsd.org
Subject: Re: svn commit: r192908 - in head: share/man/man9 sys/conf sys/kern
	sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 15:39:49 -0000

Ben Kaduk  writes:
> Our man page style says that new sentences should start on new lines.
> (Since the '.' character is used for defining macros, and sometimes
> the processor can get confused.)

That's not the reason - the reason is that it makes diffs easier to
read, which in turn makes it easier for our translators to keep the
translated man pages in sync.

DES
--=20
Dag-Erling Sm=C3=B8rgrav - des@des.no

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 17:12:30 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 60F8810656A8;
	Thu, 28 May 2009 17:12:30 +0000 (UTC)
	(envelope-from bmah@freebsd.org)
Received: from kaga.kitchenlab.org (unknown [IPv6:2001:470:1f04:55c::2])
	by mx1.freebsd.org (Postfix) with ESMTP id 244188FC2E;
	Thu, 28 May 2009 17:12:30 +0000 (UTC)
	(envelope-from bmah@freebsd.org)
Received: from morimoto.local ([IPv6:2001:470:1f05:888:21b:63ff:fecd:f07c])
	(authenticated bits=0)
	by kaga.kitchenlab.org (8.14.3/8.14.3) with ESMTP id n4SHCQRV023338
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Thu, 28 May 2009 10:12:27 -0700 (PDT)
	(envelope-from bmah@freebsd.org)
Message-ID: <4A1EC5FA.50601@freebsd.org>
Date: Thu, 28 May 2009 10:12:26 -0700
From: "Bruce A. Mah" 
User-Agent: Thunderbird 2.0.0.21 (Macintosh/20090302)
MIME-Version: 1.0
To: =?UTF-8?B?RGFnLUVybGluZyBTbcO4cmdyYXY=?= 
References: <200905271636.n4RGasNe003922@svn.freebsd.org>	<47d0403c0905271005t7f57f9b9h3d0721bbb1fbedc2@mail.gmail.com>
	<86tz35qlrw.fsf@ds4.des.no>
In-Reply-To: <86tz35qlrw.fsf@ds4.des.no>
X-Enigmail-Version: 0.95.7
OpenPGP: id=5ba052c3
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature";
	boundary="------------enigAE4369152595AF527FB3620B"
X-Virus-Scanned: clamav-milter 0.95.1 at kaga.kitchenlab.org
X-Virus-Status: Clean
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	Zachary Loafman , src-committers@freebsd.org,
	Ben Kaduk 
Subject: Re: svn commit: r192908 - in head: share/man/man9 sys/conf sys/kern
 sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 17:12:31 -0000

This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigAE4369152595AF527FB3620B
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

If memory serves me right, Dag-Erling Sm=C3=B8rgrav wrote:
> Ben Kaduk  writes:
>> Our man page style says that new sentences should start on new lines.
>> (Since the '.' character is used for defining macros, and sometimes
>> the processor can get confused.)
>=20
> That's not the reason - the reason is that it makes diffs easier to
> read, which in turn makes it easier for our translators to keep the
> translated man pages in sync.

My understanding is that we do this to let groff manage the whitespace
between sentences.  But your comment regarding diffs is quite valid.

Bruce.


--------------enigAE4369152595AF527FB3620B
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkoexfoACgkQ2MoxcVugUsPq/QCg5pnrsf5ByJHK3TTeOHPJnhR+
b3sAnj7H2THyer1lt3PjQgsgTIXhBWgf
=mk2P
-----END PGP SIGNATURE-----

--------------enigAE4369152595AF527FB3620B--

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 17:28:46 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E343F106575B;
	Thu, 28 May 2009 17:28:46 +0000 (UTC) (envelope-from des@des.no)
Received: from tim.des.no (tim.des.no [194.63.250.121])
	by mx1.freebsd.org (Postfix) with ESMTP id 981BC8FC08;
	Thu, 28 May 2009 17:28:46 +0000 (UTC) (envelope-from des@des.no)
Received: from ds4.des.no (des.no [84.49.246.2])
	by smtp.des.no (Postfix) with ESMTP id 70FD06D41C;
	Thu, 28 May 2009 19:28:45 +0200 (CEST)
Received: by ds4.des.no (Postfix, from userid 1001)
	id 467FC844E2; Thu, 28 May 2009 19:28:45 +0200 (CEST)
From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= 
To: "Bruce A. Mah" 
References: <200905271636.n4RGasNe003922@svn.freebsd.org>
	<47d0403c0905271005t7f57f9b9h3d0721bbb1fbedc2@mail.gmail.com>
	<86tz35qlrw.fsf@ds4.des.no> <4A1EC5FA.50601@freebsd.org>
Date: Thu, 28 May 2009 19:28:45 +0200
In-Reply-To: <4A1EC5FA.50601@freebsd.org> (Bruce A. Mah's message of "Thu, 28
	May 2009 10:12:26 -0700")
Message-ID: <86ljohqgqa.fsf@ds4.des.no>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	Zachary Loafman , src-committers@freebsd.org,
	Ben Kaduk 
Subject: Re: svn commit: r192908 - in head: share/man/man9 sys/conf sys/kern
	sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 17:28:51 -0000

"Bruce A. Mah"  writes:
> My understanding is that we do this to let groff manage the whitespace
> between sentences.

Groff doesn't need anyone's help to manage the whitespace between
sentences...

DES
--=20
Dag-Erling Sm=C3=B8rgrav - des@des.no

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 17:35:35 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 820291065673;
	Thu, 28 May 2009 17:35:35 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 564778FC1C;
	Thu, 28 May 2009 17:35:35 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4SHZZOR044758;
	Thu, 28 May 2009 17:35:35 GMT (envelope-from des@svn.freebsd.org)
Received: (from des@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4SHZZoX044757;
	Thu, 28 May 2009 17:35:35 GMT (envelope-from des@svn.freebsd.org)
Message-Id: <200905281735.n4SHZZoX044757@svn.freebsd.org>
From: Dag-Erling Smorgrav 
Date: Thu, 28 May 2009 17:35:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192983 - head/sys/cddl/boot/zfs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 17:35:35 -0000

Author: des
Date: Thu May 28 17:35:35 2009
New Revision: 192983
URL: http://svn.freebsd.org/changeset/base/192983

Log:
  Nobody spoke up, so assume my interpretation was correct and enable keyword
  expansion for this file.

Modified:
  head/sys/cddl/boot/zfs/zfssubr.c   (props changed)

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 17:36:36 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CDB4D106566C;
	Thu, 28 May 2009 17:36:36 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B769A8FC1D;
	Thu, 28 May 2009 17:36:36 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4SHaaPu044827;
	Thu, 28 May 2009 17:36:36 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4SHaavG044816;
	Thu, 28 May 2009 17:36:36 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200905281736.n4SHaavG044816@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 28 May 2009 17:36:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192984 - in head: lib/libusb sys/compat/ndis
	sys/dev/ata sys/dev/if_ndis sys/dev/sound/usb sys/dev/usb
	sys/dev/usb/controller sys/dev/usb/input sys/dev/usb/misc
	sys/dev/usb/net sys/dev...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 17:36:37 -0000

Author: thompsa
Date: Thu May 28 17:36:36 2009
New Revision: 192984
URL: http://svn.freebsd.org/changeset/base/192984

Log:
  s/usb2_/usb_/ on all C structs for the USB stack.

Modified:
  head/lib/libusb/libusb.3
  head/lib/libusb/libusb20.c
  head/lib/libusb/libusb20.h
  head/lib/libusb/libusb20_int.h
  head/lib/libusb/libusb20_ugen20.c
  head/sys/compat/ndis/subr_usbd.c
  head/sys/dev/ata/ata-usb.c
  head/sys/dev/if_ndis/if_ndis_usb.c
  head/sys/dev/if_ndis/if_ndisvar.h
  head/sys/dev/sound/usb/uaudio.c
  head/sys/dev/sound/usb/uaudioreg.h
  head/sys/dev/usb/controller/at91dci.c
  head/sys/dev/usb/controller/at91dci.h
  head/sys/dev/usb/controller/atmegadci.c
  head/sys/dev/usb/controller/atmegadci.h
  head/sys/dev/usb/controller/atmegadci_atmelarm.c
  head/sys/dev/usb/controller/avr32dci.c
  head/sys/dev/usb/controller/avr32dci.h
  head/sys/dev/usb/controller/ehci.c
  head/sys/dev/usb/controller/ehci.h
  head/sys/dev/usb/controller/musb_otg.c
  head/sys/dev/usb/controller/musb_otg.h
  head/sys/dev/usb/controller/ohci.c
  head/sys/dev/usb/controller/ohci.h
  head/sys/dev/usb/controller/uhci.c
  head/sys/dev/usb/controller/uhci.h
  head/sys/dev/usb/controller/usb_controller.c
  head/sys/dev/usb/controller/uss820dci.c
  head/sys/dev/usb/controller/uss820dci.h
  head/sys/dev/usb/input/uhid.c
  head/sys/dev/usb/input/ukbd.c
  head/sys/dev/usb/input/ums.c
  head/sys/dev/usb/misc/udbp.c
  head/sys/dev/usb/misc/ufm.c
  head/sys/dev/usb/net/if_aue.c
  head/sys/dev/usb/net/if_auereg.h
  head/sys/dev/usb/net/if_axe.c
  head/sys/dev/usb/net/if_axereg.h
  head/sys/dev/usb/net/if_cdce.c
  head/sys/dev/usb/net/if_cdcereg.h
  head/sys/dev/usb/net/if_cue.c
  head/sys/dev/usb/net/if_cuereg.h
  head/sys/dev/usb/net/if_kue.c
  head/sys/dev/usb/net/if_kuereg.h
  head/sys/dev/usb/net/if_rue.c
  head/sys/dev/usb/net/if_ruereg.h
  head/sys/dev/usb/net/if_udav.c
  head/sys/dev/usb/net/if_udavreg.h
  head/sys/dev/usb/net/usb_ethernet.c
  head/sys/dev/usb/net/usb_ethernet.h
  head/sys/dev/usb/quirk/usb_quirk.c
  head/sys/dev/usb/serial/u3g.c
  head/sys/dev/usb/serial/uark.c
  head/sys/dev/usb/serial/ubsa.c
  head/sys/dev/usb/serial/ubser.c
  head/sys/dev/usb/serial/uchcom.c
  head/sys/dev/usb/serial/ucycom.c
  head/sys/dev/usb/serial/ufoma.c
  head/sys/dev/usb/serial/uftdi.c
  head/sys/dev/usb/serial/ugensa.c
  head/sys/dev/usb/serial/uipaq.c
  head/sys/dev/usb/serial/ulpt.c
  head/sys/dev/usb/serial/umct.c
  head/sys/dev/usb/serial/umodem.c
  head/sys/dev/usb/serial/umoscom.c
  head/sys/dev/usb/serial/uplcom.c
  head/sys/dev/usb/serial/usb_serial.c
  head/sys/dev/usb/serial/usb_serial.h
  head/sys/dev/usb/serial/uslcom.c
  head/sys/dev/usb/serial/uvisor.c
  head/sys/dev/usb/serial/uvscom.c
  head/sys/dev/usb/storage/umass.c
  head/sys/dev/usb/storage/urio.c
  head/sys/dev/usb/storage/ustorage_fs.c
  head/sys/dev/usb/template/usb_template.c
  head/sys/dev/usb/template/usb_template.h
  head/sys/dev/usb/template/usb_template_cdce.c
  head/sys/dev/usb/template/usb_template_msc.c
  head/sys/dev/usb/template/usb_template_mtp.c
  head/sys/dev/usb/usb.h
  head/sys/dev/usb/usb_bus.h
  head/sys/dev/usb/usb_busdma.c
  head/sys/dev/usb/usb_busdma.h
  head/sys/dev/usb/usb_cdc.h
  head/sys/dev/usb/usb_compat_linux.c
  head/sys/dev/usb/usb_compat_linux.h
  head/sys/dev/usb/usb_controller.h
  head/sys/dev/usb/usb_core.h
  head/sys/dev/usb/usb_debug.c
  head/sys/dev/usb/usb_debug.h
  head/sys/dev/usb/usb_dev.c
  head/sys/dev/usb/usb_dev.h
  head/sys/dev/usb/usb_device.c
  head/sys/dev/usb/usb_device.h
  head/sys/dev/usb/usb_dynamic.c
  head/sys/dev/usb/usb_dynamic.h
  head/sys/dev/usb/usb_generic.c
  head/sys/dev/usb/usb_generic.h
  head/sys/dev/usb/usb_handle_request.c
  head/sys/dev/usb/usb_hid.c
  head/sys/dev/usb/usb_hid.h
  head/sys/dev/usb/usb_hub.c
  head/sys/dev/usb/usb_hub.h
  head/sys/dev/usb/usb_ioctl.h
  head/sys/dev/usb/usb_lookup.c
  head/sys/dev/usb/usb_lookup.h
  head/sys/dev/usb/usb_mbuf.c
  head/sys/dev/usb/usb_mbuf.h
  head/sys/dev/usb/usb_msctest.c
  head/sys/dev/usb/usb_msctest.h
  head/sys/dev/usb/usb_parse.c
  head/sys/dev/usb/usb_parse.h
  head/sys/dev/usb/usb_process.c
  head/sys/dev/usb/usb_process.h
  head/sys/dev/usb/usb_request.c
  head/sys/dev/usb/usb_request.h
  head/sys/dev/usb/usb_transfer.c
  head/sys/dev/usb/usb_transfer.h
  head/sys/dev/usb/usb_util.c
  head/sys/dev/usb/usbhid.h
  head/sys/dev/usb/wlan/if_rum.c
  head/sys/dev/usb/wlan/if_rumvar.h
  head/sys/dev/usb/wlan/if_uath.c
  head/sys/dev/usb/wlan/if_uathvar.h
  head/sys/dev/usb/wlan/if_upgt.c
  head/sys/dev/usb/wlan/if_upgtvar.h
  head/sys/dev/usb/wlan/if_ural.c
  head/sys/dev/usb/wlan/if_uralvar.h
  head/sys/dev/usb/wlan/if_urtw.c
  head/sys/dev/usb/wlan/if_urtwvar.h
  head/sys/dev/usb/wlan/if_zyd.c
  head/sys/dev/usb/wlan/if_zydreg.h
  head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
  head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h
  head/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c

Modified: head/lib/libusb/libusb.3
==============================================================================
--- head/lib/libusb/libusb.3	Thu May 28 17:35:35 2009	(r192983)
+++ head/lib/libusb/libusb.3	Thu May 28 17:36:36 2009	(r192984)
@@ -109,7 +109,7 @@ USB access library (libusb -lusb)
 .Ft const char *
 .Fn libusb20_dev_get_backend_name "struct libusb20_device *"
 .Ft int
-.Fn libusb20_dev_get_info "struct libusb20_device *pdev" "struct usb2_device_info *pinfo"
+.Fn libusb20_dev_get_info "struct libusb20_device *pdev" "struct usb_device_info *pinfo"
 .Ft int
 .Fn libusb20_dev_get_iface_desc "struct libusb20_device *pdev" "uint8_t iface_index" "char *buf" "uint8_t len"
 .Ft const char *
@@ -465,7 +465,7 @@ returns a zero terminated string describ
 .Pp
 .
 .Fn libusb20_dev_get_info
-retrives the BSD specific usb2_device_info structure into the memory location given by 
+retrives the BSD specific usb_device_info structure into the memory location given by 
 .Fa pinfo .
 The USB device given by
 .Fa pdev

Modified: head/lib/libusb/libusb20.c
==============================================================================
--- head/lib/libusb/libusb20.c	Thu May 28 17:35:35 2009	(r192983)
+++ head/lib/libusb/libusb20.c	Thu May 28 17:36:36 2009	(r192984)
@@ -925,7 +925,7 @@ libusb20_dev_free(struct libusb20_device
 
 int
 libusb20_dev_get_info(struct libusb20_device *pdev,
-    struct usb2_device_info *pinfo)
+    struct usb_device_info *pinfo)
 {
 	if (pinfo == NULL)
 		return (LIBUSB20_ERROR_INVALID_PARAM);

Modified: head/lib/libusb/libusb20.h
==============================================================================
--- head/lib/libusb/libusb20.h	Thu May 28 17:35:35 2009	(r192983)
+++ head/lib/libusb/libusb20.h	Thu May 28 17:36:36 2009	(r192984)
@@ -175,7 +175,7 @@ enum {
 	LIBUSB20_POWER_RESUME,
 };
 
-struct usb2_device_info;
+struct usb_device_info;
 struct libusb20_transfer;
 struct libusb20_backend;
 struct libusb20_backend_methods;
@@ -253,7 +253,7 @@ int	libusb20_dev_reset(struct libusb20_d
 int	libusb20_dev_set_power_mode(struct libusb20_device *pdev, uint8_t power_mode);
 uint8_t	libusb20_dev_get_power_mode(struct libusb20_device *pdev);
 int	libusb20_dev_set_alt_index(struct libusb20_device *pdev, uint8_t iface_index, uint8_t alt_index);
-int	libusb20_dev_get_info(struct libusb20_device *pdev, struct usb2_device_info *pinfo);
+int	libusb20_dev_get_info(struct libusb20_device *pdev, struct usb_device_info *pinfo);
 int	libusb20_dev_get_iface_desc(struct libusb20_device *pdev, uint8_t iface_index, char *buf, uint8_t len);
 
 struct LIBUSB20_DEVICE_DESC_DECODED *libusb20_dev_get_device_desc(struct libusb20_device *pdev);

Modified: head/lib/libusb/libusb20_int.h
==============================================================================
--- head/lib/libusb/libusb20_int.h	Thu May 28 17:35:35 2009	(r192983)
+++ head/lib/libusb/libusb20_int.h	Thu May 28 17:36:36 2009	(r192984)
@@ -49,7 +49,7 @@ typedef int (libusb20_root_get_quirk_nam
 typedef int (libusb20_root_add_dev_quirk_t)(struct libusb20_backend *pbe, struct libusb20_quirk *pq);
 typedef int (libusb20_root_remove_dev_quirk_t)(struct libusb20_backend *pbe, struct libusb20_quirk *pq);
 typedef int (libusb20_close_device_t)(struct libusb20_device *pdev);
-typedef int (libusb20_dev_get_info_t)(struct libusb20_device *pdev, struct usb2_device_info *pinfo);
+typedef int (libusb20_dev_get_info_t)(struct libusb20_device *pdev, struct usb_device_info *pinfo);
 typedef int (libusb20_dev_get_iface_desc_t)(struct libusb20_device *pdev, uint8_t iface_index, char *buf, uint8_t len);
 typedef int (libusb20_init_backend_t)(struct libusb20_backend *pbe);
 typedef int (libusb20_open_device_t)(struct libusb20_device *pdev, uint16_t transfer_count_max);

Modified: head/lib/libusb/libusb20_ugen20.c
==============================================================================
--- head/lib/libusb/libusb20_ugen20.c	Thu May 28 17:35:35 2009	(r192983)
+++ head/lib/libusb/libusb20_ugen20.c	Thu May 28 17:36:36 2009	(r192984)
@@ -126,8 +126,8 @@ static int
 ugen20_enumerate(struct libusb20_device *pdev, const char *id)
 {
 	const char *tmp = id;
-	struct usb2_device_descriptor ddesc;
-	struct usb2_device_info devinfo;
+	struct usb_device_descriptor ddesc;
+	struct usb_device_info devinfo;
 	uint32_t plugtime;
 	char buf[64];
 	int f;
@@ -213,7 +213,7 @@ done:
 }
 
 struct ugen20_urd_state {
-	struct usb2_read_dir urd;
+	struct usb_read_dir urd;
 	uint32_t nparsed;
 	int	f;
 	uint8_t *ptr;
@@ -298,7 +298,7 @@ ugen20_init_backend(struct libusb20_back
 static void
 ugen20_tr_release(struct libusb20_device *pdev)
 {
-	struct usb2_fs_uninit fs_uninit;
+	struct usb_fs_uninit fs_uninit;
 
 	if (pdev->nTransfer == 0) {
 		return;
@@ -316,8 +316,8 @@ ugen20_tr_release(struct libusb20_device
 static int
 ugen20_tr_renew(struct libusb20_device *pdev)
 {
-	struct usb2_fs_init fs_init;
-	struct usb2_fs_endpoint *pfse;
+	struct usb_fs_init fs_init;
+	struct usb_fs_endpoint *pfse;
 	int error;
 	uint32_t size;
 	uint16_t nMaxTransfer;
@@ -419,7 +419,7 @@ done:
 static int
 ugen20_close_device(struct libusb20_device *pdev)
 {
-	struct usb2_fs_uninit fs_uninit;
+	struct usb_fs_uninit fs_uninit;
 
 	if (pdev->privBeData) {
 		memset(&fs_uninit, 0, sizeof(fs_uninit));
@@ -447,8 +447,8 @@ static int
 ugen20_get_config_desc_full(struct libusb20_device *pdev,
     uint8_t **ppbuf, uint16_t *plen, uint8_t cfg_index)
 {
-	struct usb2_gen_descriptor gen_desc;
-	struct usb2_config_descriptor cdesc;
+	struct usb_gen_descriptor gen_desc;
+	struct usb_config_descriptor cdesc;
 	uint8_t *ptr;
 	uint16_t len;
 	int error;
@@ -542,7 +542,7 @@ static int
 ugen20_set_alt_index(struct libusb20_device *pdev,
     uint8_t iface_index, uint8_t alt_index)
 {
-	struct usb2_alt_interface alt_iface;
+	struct usb_alt_interface alt_iface;
 
 	memset(&alt_iface, 0, sizeof(alt_iface));
 
@@ -663,7 +663,7 @@ ugen20_do_request_sync(struct libusb20_d
     struct LIBUSB20_CONTROL_SETUP_DECODED *setup,
     void *data, uint16_t *pactlen, uint32_t timeout, uint8_t flags)
 {
-	struct usb2_ctl_request req;
+	struct usb_ctl_request req;
 
 	memset(&req, 0, sizeof(req));
 
@@ -688,8 +688,8 @@ ugen20_do_request_sync(struct libusb20_d
 static int
 ugen20_process(struct libusb20_device *pdev)
 {
-	struct usb2_fs_complete temp;
-	struct usb2_fs_endpoint *fsep;
+	struct usb_fs_complete temp;
+	struct usb_fs_endpoint *fsep;
 	struct libusb20_transfer *xfer;
 
 	while (1) {
@@ -739,8 +739,8 @@ static int
 ugen20_tr_open(struct libusb20_transfer *xfer, uint32_t MaxBufSize,
     uint32_t MaxFrameCount, uint8_t ep_no)
 {
-	struct usb2_fs_open temp;
-	struct usb2_fs_endpoint *fsep;
+	struct usb_fs_open temp;
+	struct usb_fs_endpoint *fsep;
 
 	memset(&temp, 0, sizeof(temp));
 
@@ -772,7 +772,7 @@ ugen20_tr_open(struct libusb20_transfer 
 static int
 ugen20_tr_close(struct libusb20_transfer *xfer)
 {
-	struct usb2_fs_close temp;
+	struct usb_fs_close temp;
 
 	memset(&temp, 0, sizeof(temp));
 
@@ -787,7 +787,7 @@ ugen20_tr_close(struct libusb20_transfer
 static int
 ugen20_tr_clear_stall_sync(struct libusb20_transfer *xfer)
 {
-	struct usb2_fs_clear_stall_sync temp;
+	struct usb_fs_clear_stall_sync temp;
 
 	memset(&temp, 0, sizeof(temp));
 
@@ -804,8 +804,8 @@ ugen20_tr_clear_stall_sync(struct libusb
 static void
 ugen20_tr_submit(struct libusb20_transfer *xfer)
 {
-	struct usb2_fs_start temp;
-	struct usb2_fs_endpoint *fsep;
+	struct usb_fs_start temp;
+	struct usb_fs_endpoint *fsep;
 
 	memset(&temp, 0, sizeof(temp));
 
@@ -839,7 +839,7 @@ ugen20_tr_submit(struct libusb20_transfe
 static void
 ugen20_tr_cancel_async(struct libusb20_transfer *xfer)
 {
-	struct usb2_fs_stop temp;
+	struct usb_fs_stop temp;
 
 	memset(&temp, 0, sizeof(temp));
 
@@ -876,7 +876,7 @@ static int
 ugen20_dev_get_iface_desc(struct libusb20_device *pdev, 
     uint8_t iface_index, char *buf, uint8_t len)
 {
-	struct usb2_gen_descriptor ugd;
+	struct usb_gen_descriptor ugd;
 
 	memset(&ugd, 0, sizeof(ugd));
 
@@ -892,7 +892,7 @@ ugen20_dev_get_iface_desc(struct libusb2
 
 static int
 ugen20_dev_get_info(struct libusb20_device *pdev,
-    struct usb2_device_info *pinfo)
+    struct usb_device_info *pinfo)
 {
 	if (ioctl(pdev->file, USB_GET_DEVICEINFO, pinfo)) {
 		return (LIBUSB20_ERROR_INVALID_PARAM);
@@ -904,7 +904,7 @@ static int
 ugen20_root_get_dev_quirk(struct libusb20_backend *pbe,
     uint16_t quirk_index, struct libusb20_quirk *pq)
 {
-	struct usb2_gen_quirk q;
+	struct usb_gen_quirk q;
 	int error;
 
 	memset(&q, 0, sizeof(q));
@@ -931,7 +931,7 @@ static int
 ugen20_root_get_quirk_name(struct libusb20_backend *pbe, uint16_t quirk_index,
     struct libusb20_quirk *pq)
 {
-	struct usb2_gen_quirk q;
+	struct usb_gen_quirk q;
 	int error;
 
 	memset(&q, 0, sizeof(q));
@@ -954,7 +954,7 @@ static int
 ugen20_root_add_dev_quirk(struct libusb20_backend *pbe,
     struct libusb20_quirk *pq)
 {
-	struct usb2_gen_quirk q;
+	struct usb_gen_quirk q;
 	int error;
 
 	memset(&q, 0, sizeof(q));
@@ -978,7 +978,7 @@ static int
 ugen20_root_remove_dev_quirk(struct libusb20_backend *pbe,
     struct libusb20_quirk *pq)
 {
-	struct usb2_gen_quirk q;
+	struct usb_gen_quirk q;
 	int error;
 
 	memset(&q, 0, sizeof(q));

Modified: head/sys/compat/ndis/subr_usbd.c
==============================================================================
--- head/sys/compat/ndis/subr_usbd.c	Thu May 28 17:35:35 2009	(r192983)
+++ head/sys/compat/ndis/subr_usbd.c	Thu May 28 17:36:36 2009	(r192984)
@@ -84,10 +84,10 @@ static usb2_callback_t usbd_ctrl_callbac
 #define	USBD_CTRL_MAX_PIPE		2
 #define	USBD_CTRL_READ_BUFFER_SP	256
 #define	USBD_CTRL_READ_BUFFER_SIZE	\
-	(sizeof(struct usb2_device_request) + USBD_CTRL_READ_BUFFER_SP)
+	(sizeof(struct usb_device_request) + USBD_CTRL_READ_BUFFER_SP)
 #define	USBD_CTRL_WRITE_BUFFER_SIZE	\
-	(sizeof(struct usb2_device_request))
-static struct usb2_config usbd_default_epconfig[USBD_CTRL_MAX_PIPE] = {
+	(sizeof(struct usb_device_request))
+static struct usb_config usbd_default_epconfig[USBD_CTRL_MAX_PIPE] = {
 	[USBD_CTRL_READ_PIPE] = {
 		.type =		UE_CONTROL,
 		.endpoint =	0x00,	/* control pipe */
@@ -115,10 +115,10 @@ static int32_t		 usbd_func_vendorclass(i
 static int32_t		 usbd_func_selconf(irp *);
 static int32_t		 usbd_func_abort_pipe(irp *);
 static usb2_error_t	 usbd_setup_endpoint(irp *, uint8_t,
-			    struct usb2_endpoint_descriptor	*);
+			    struct usb_endpoint_descriptor	*);
 static usb2_error_t	 usbd_setup_endpoint_default(irp *, uint8_t);
 static usb2_error_t	 usbd_setup_endpoint_one(irp *, uint8_t,
-			    struct ndisusb_ep *, struct usb2_config *);
+			    struct ndisusb_ep *, struct usb_config *);
 static int32_t		 usbd_func_getdesc(irp *);
 static union usbd_urb	*usbd_geturb(irp *);
 static struct ndisusb_ep*usbd_get_ndisep(irp *, usb_endpoint_descriptor_t *);
@@ -519,8 +519,8 @@ usbd_func_selconf(ip)
 	device_t dev = IRP_NDIS_DEV(ip);
 	int i, j;
 	struct ndis_softc *sc = device_get_softc(dev);
-	struct usb2_device *udev = sc->ndisusb_dev;
-	struct usb2_pipe *p = NULL;
+	struct usb_device *udev = sc->ndisusb_dev;
+	struct usb_pipe *p = NULL;
 	struct usbd_interface_information *intf;
 	struct usbd_pipe_information *pipe;
 	struct usbd_urb_select_configuration *selconf;
@@ -597,11 +597,11 @@ usbd_setup_endpoint_one(ip, ifidx, ne, e
 	irp				*ip;
 	uint8_t				ifidx;
 	struct ndisusb_ep		*ne;
-	struct usb2_config		*epconf;
+	struct usb_config		*epconf;
 {
 	device_t dev = IRP_NDIS_DEV(ip);
 	struct ndis_softc *sc = device_get_softc(dev);
-	struct usb2_xfer *xfer;
+	struct usb_xfer *xfer;
 	usb2_error_t status;
 
 	InitializeListHead(&ne->ne_active);
@@ -647,13 +647,13 @@ static usb2_error_t
 usbd_setup_endpoint(ip, ifidx, ep)
 	irp				*ip;
 	uint8_t				ifidx;
-	struct usb2_endpoint_descriptor	*ep;
+	struct usb_endpoint_descriptor	*ep;
 {
 	device_t dev = IRP_NDIS_DEV(ip);
 	struct ndis_softc *sc = device_get_softc(dev);
 	struct ndisusb_ep *ne;
-	struct usb2_config cfg;
-	struct usb2_xfer *xfer;
+	struct usb_config cfg;
+	struct usb_xfer *xfer;
 	usb2_error_t status;
 
 	/* check for non-supported transfer types */
@@ -670,7 +670,7 @@ usbd_setup_endpoint(ip, ifidx, ep)
 	KeInitializeSpinLock(&ne->ne_lock);
 	ne->ne_dirin = UE_GET_DIR(ep->bEndpointAddress) >> 7;
 
-	memset(&cfg, 0, sizeof(struct usb2_config));
+	memset(&cfg, 0, sizeof(struct usb_config));
 	cfg.type	= UE_GET_XFERTYPE(ep->bmAttributes);
 	cfg.endpoint	= UE_GET_ADDR(ep->bEndpointAddress);
 	cfg.direction	= UE_GET_DIR(ep->bEndpointAddress);
@@ -853,7 +853,7 @@ usbd_aq_getfirst(struct ndis_softc *sc, 
 }
 
 static void
-usbd_non_isoc_callback(struct usb2_xfer *xfer)
+usbd_non_isoc_callback(struct usb_xfer *xfer)
 {
 	irp *ip;
 	struct ndis_softc *sc = xfer->priv_sc;
@@ -951,7 +951,7 @@ extra:
 }
 
 static void
-usbd_ctrl_callback(struct usb2_xfer *xfer)
+usbd_ctrl_callback(struct usb_xfer *xfer)
 {
 	irp *ip;
 	struct ndis_softc *sc = xfer->priv_sc;
@@ -961,7 +961,7 @@ usbd_ctrl_callback(struct usb2_xfer *xfe
 	union usbd_urb *urb;
 	struct usbd_urb_vendor_or_class_request *vcreq;
 	uint8_t type = 0;
-	struct usb2_device_request req;
+	struct usb_device_request req;
 
 	switch (USB_GET_STATE(xfer)) {
 	case USB_ST_TRANSFERRED:
@@ -1434,7 +1434,7 @@ USBD_ParseConfigurationDescriptorEx(conf
 	int32_t intfsubclass;
 	int32_t intfproto;
 {
-	struct usb2_descriptor *next = NULL;
+	struct usb_descriptor *next = NULL;
 	usb_interface_descriptor_t *desc;
 
 	while ((next = usb2_desc_foreach(conf, next)) != NULL) {

Modified: head/sys/dev/ata/ata-usb.c
==============================================================================
--- head/sys/dev/ata/ata-usb.c	Thu May 28 17:35:35 2009	(r192983)
+++ head/sys/dev/ata/ata-usb.c	Thu May 28 17:36:36 2009	(r192984)
@@ -108,7 +108,7 @@ struct atausb2_softc {
 
 #define	ATAUSB_T_MAX ATAUSB_T_BBB_MAX
 
-	struct usb2_xfer *xfer[ATAUSB_T_MAX];
+	struct usb_xfer *xfer[ATAUSB_T_MAX];
 	caddr_t	ata_data;
 	device_t dev;
 
@@ -145,7 +145,7 @@ static usb2_callback_t atausb2_tr_error;
 
 static void atausb2_cancel_request(struct atausb2_softc *sc);
 static void atausb2_transfer_start(struct atausb2_softc *sc, uint8_t xfer_no);
-static void atausb2_t_bbb_data_clear_stall_callback(struct usb2_xfer *xfer, uint8_t next_xfer, uint8_t stall_xfer);
+static void atausb2_t_bbb_data_clear_stall_callback(struct usb_xfer *xfer, uint8_t next_xfer, uint8_t stall_xfer);
 static int ata_usbchannel_begin_transaction(struct ata_request *request);
 static int ata_usbchannel_end_transaction(struct ata_request *request);
 
@@ -160,13 +160,13 @@ static ata_locking_t ata_usbchannel_lock
  * USB frontend part
  */
 
-struct usb2_config atausb2_config[ATAUSB_T_BBB_MAX] = {
+struct usb_config atausb2_config[ATAUSB_T_BBB_MAX] = {
 
 	[ATAUSB_T_BBB_RESET1] = {
 		.type = UE_CONTROL,
 		.endpoint = 0x00,	/* Control pipe */
 		.direction = UE_DIR_ANY,
-		.mh.bufsize = sizeof(struct usb2_device_request),
+		.mh.bufsize = sizeof(struct usb_device_request),
 		.mh.flags = {},
 		.mh.callback = &atausb2_t_bbb_reset1_callback,
 		.mh.timeout = 5000,	/* 5 seconds */
@@ -177,7 +177,7 @@ struct usb2_config atausb2_config[ATAUSB
 		.type = UE_CONTROL,
 		.endpoint = 0x00,	/* Control pipe */
 		.direction = UE_DIR_ANY,
-		.mh.bufsize = sizeof(struct usb2_device_request),
+		.mh.bufsize = sizeof(struct usb_device_request),
 		.mh.flags = {},
 		.mh.callback = &atausb2_t_bbb_reset2_callback,
 		.mh.timeout = 5000,	/* 5 seconds */
@@ -188,7 +188,7 @@ struct usb2_config atausb2_config[ATAUSB
 		.type = UE_CONTROL,
 		.endpoint = 0x00,	/* Control pipe */
 		.direction = UE_DIR_ANY,
-		.mh.bufsize = sizeof(struct usb2_device_request),
+		.mh.bufsize = sizeof(struct usb_device_request),
 		.mh.flags = {},
 		.mh.callback = &atausb2_t_bbb_reset3_callback,
 		.mh.timeout = 5000,	/* 5 seconds */
@@ -219,7 +219,7 @@ struct usb2_config atausb2_config[ATAUSB
 		.type = UE_CONTROL,
 		.endpoint = 0x00,	/* Control pipe */
 		.direction = UE_DIR_ANY,
-		.mh.bufsize = sizeof(struct usb2_device_request),
+		.mh.bufsize = sizeof(struct usb_device_request),
 		.mh.flags = {},
 		.mh.callback = &atausb2_t_bbb_data_rd_cs_callback,
 		.mh.timeout = 5000,	/* 5 seconds */
@@ -239,7 +239,7 @@ struct usb2_config atausb2_config[ATAUSB
 		.type = UE_CONTROL,
 		.endpoint = 0x00,	/* Control pipe */
 		.direction = UE_DIR_ANY,
-		.mh.bufsize = sizeof(struct usb2_device_request),
+		.mh.bufsize = sizeof(struct usb_device_request),
 		.mh.flags = {},
 		.mh.callback = &atausb2_t_bbb_data_wr_cs_callback,
 		.mh.timeout = 5000,	/* 5 seconds */
@@ -278,8 +278,8 @@ MODULE_VERSION(atausb, 1);
 static int
 atausb2_probe(device_t dev)
 {
-	struct usb2_attach_arg *uaa = device_get_ivars(dev);
-	struct usb2_interface_descriptor *id;
+	struct usb_attach_arg *uaa = device_get_ivars(dev);
+	struct usb_interface_descriptor *id;
 
 	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
@@ -318,10 +318,10 @@ static int
 atausb2_attach(device_t dev)
 {
 	struct atausb2_softc *sc = device_get_softc(dev);
-	struct usb2_attach_arg *uaa = device_get_ivars(dev);
-	struct usb2_interface_descriptor *id;
+	struct usb_attach_arg *uaa = device_get_ivars(dev);
+	struct usb_interface_descriptor *id;
 	const char *proto, *subclass;
-	struct usb2_device_request request;
+	struct usb_device_request request;
 	device_t child;
 	uint16_t i;
 	uint8_t maxlun;
@@ -467,10 +467,10 @@ atausb2_transfer_start(struct atausb2_so
 }
 
 static void
-atausb2_t_bbb_reset1_callback(struct usb2_xfer *xfer)
+atausb2_t_bbb_reset1_callback(struct usb_xfer *xfer)
 {
 	struct atausb2_softc *sc = xfer->priv_sc;
-	struct usb2_device_request req;
+	struct usb_device_request req;
 
 	switch (USB_GET_STATE(xfer)) {
 	case USB_ST_TRANSFERRED:
@@ -500,21 +500,21 @@ atausb2_t_bbb_reset1_callback(struct usb
 }
 
 static void
-atausb2_t_bbb_reset2_callback(struct usb2_xfer *xfer)
+atausb2_t_bbb_reset2_callback(struct usb_xfer *xfer)
 {
 	atausb2_t_bbb_data_clear_stall_callback(xfer, ATAUSB_T_BBB_RESET3,
 	    ATAUSB_T_BBB_DATA_READ);
 }
 
 static void
-atausb2_t_bbb_reset3_callback(struct usb2_xfer *xfer)
+atausb2_t_bbb_reset3_callback(struct usb_xfer *xfer)
 {
 	atausb2_t_bbb_data_clear_stall_callback(xfer, ATAUSB_T_BBB_COMMAND,
 	    ATAUSB_T_BBB_DATA_WRITE);
 }
 
 static void
-atausb2_t_bbb_data_clear_stall_callback(struct usb2_xfer *xfer,
+atausb2_t_bbb_data_clear_stall_callback(struct usb_xfer *xfer,
     uint8_t next_xfer,
     uint8_t stall_xfer)
 {
@@ -540,7 +540,7 @@ tr_transferred:
 }
 
 static void
-atausb2_t_bbb_command_callback(struct usb2_xfer *xfer)
+atausb2_t_bbb_command_callback(struct usb_xfer *xfer)
 {
 	struct atausb2_softc *sc = xfer->priv_sc;
 	struct ata_request *request = sc->ata_request;
@@ -590,7 +590,7 @@ atausb2_t_bbb_command_callback(struct us
 }
 
 static void
-atausb2_t_bbb_data_read_callback(struct usb2_xfer *xfer)
+atausb2_t_bbb_data_read_callback(struct usb_xfer *xfer)
 {
 	struct atausb2_softc *sc = xfer->priv_sc;
 	uint32_t max_bulk = xfer->max_data_length;
@@ -640,14 +640,14 @@ atausb2_t_bbb_data_read_callback(struct 
 }
 
 static void
-atausb2_t_bbb_data_rd_cs_callback(struct usb2_xfer *xfer)
+atausb2_t_bbb_data_rd_cs_callback(struct usb_xfer *xfer)
 {
 	atausb2_t_bbb_data_clear_stall_callback(xfer, ATAUSB_T_BBB_STATUS,
 	    ATAUSB_T_BBB_DATA_READ);
 }
 
 static void
-atausb2_t_bbb_data_write_callback(struct usb2_xfer *xfer)
+atausb2_t_bbb_data_write_callback(struct usb_xfer *xfer)
 {
 	struct atausb2_softc *sc = xfer->priv_sc;
 	uint32_t max_bulk = xfer->max_data_length;
@@ -693,14 +693,14 @@ atausb2_t_bbb_data_write_callback(struct
 }
 
 static void
-atausb2_t_bbb_data_wr_cs_callback(struct usb2_xfer *xfer)
+atausb2_t_bbb_data_wr_cs_callback(struct usb_xfer *xfer)
 {
 	atausb2_t_bbb_data_clear_stall_callback(xfer, ATAUSB_T_BBB_STATUS,
 	    ATAUSB_T_BBB_DATA_WRITE);
 }
 
 static void
-atausb2_t_bbb_status_callback(struct usb2_xfer *xfer)
+atausb2_t_bbb_status_callback(struct usb_xfer *xfer)
 {
 	struct atausb2_softc *sc = xfer->priv_sc;
 	struct ata_request *request = sc->ata_request;
@@ -820,7 +820,7 @@ atausb2_cancel_request(struct atausb2_so
 }
 
 static void
-atausb2_tr_error(struct usb2_xfer *xfer)
+atausb2_tr_error(struct usb_xfer *xfer)
 {
 	struct atausb2_softc *sc = xfer->priv_sc;
 

Modified: head/sys/dev/if_ndis/if_ndis_usb.c
==============================================================================
--- head/sys/dev/if_ndis/if_ndis_usb.c	Thu May 28 17:35:35 2009	(r192983)
+++ head/sys/dev/if_ndis/if_ndis_usb.c	Thu May 28 17:36:36 2009	(r192984)
@@ -111,7 +111,7 @@ DRIVER_MODULE(ndis, uhub, ndis_driver, n
 static int
 ndisusb_devcompare(interface_type bustype, struct ndis_usb_type *t, device_t dev)
 {
-	struct usb2_attach_arg *uaa;
+	struct usb_attach_arg *uaa;
 
 	if (bustype != PNPBus)
 		return (FALSE);
@@ -134,7 +134,7 @@ static int
 ndisusb_match(device_t self)
 {
 	struct drvdb_ent *db;
-	struct usb2_attach_arg *uaa = device_get_ivars(self);
+	struct usb_attach_arg *uaa = device_get_ivars(self);
 
 	if (uaa->usb_mode != USB_MODE_HOST)
 		return (ENXIO);
@@ -159,7 +159,7 @@ ndisusb_attach(device_t self)
 {
 	const struct drvdb_ent	*db;
 	struct ndisusb_softc *dummy = device_get_softc(self);
-	struct usb2_attach_arg *uaa = device_get_ivars(self);
+	struct usb_attach_arg *uaa = device_get_ivars(self);
 	struct ndis_softc	*sc;
 	struct ndis_usb_type	*t;
 	driver_object		*drv;

Modified: head/sys/dev/if_ndis/if_ndisvar.h
==============================================================================
--- head/sys/dev/if_ndis/if_ndisvar.h	Thu May 28 17:35:35 2009	(r192983)
+++ head/sys/dev/if_ndis/if_ndisvar.h	Thu May 28 17:36:36 2009	(r192984)
@@ -121,7 +121,7 @@ struct ndis_vap {
 #define	NDISUSB_TX_TIMEOUT			10000
 struct ndisusb_xfer;
 struct ndisusb_ep {
-	struct usb2_xfer	*ne_xfer[1];
+	struct usb_xfer	*ne_xfer[1];
 	list_entry		ne_active;
 	list_entry		ne_pending;
 	kspin_lock		ne_lock;
@@ -225,7 +225,7 @@ struct ndis_softc {
 	int			ndis_tx_timer;
 	int			ndis_hang_timer;
 
-	struct usb2_device	*ndisusb_dev;
+	struct usb_device	*ndisusb_dev;
 	struct mtx		ndisusb_mtx;
 	struct ndisusb_ep	ndisusb_dread_ep;
 	struct ndisusb_ep	ndisusb_dwrite_ep;

Modified: head/sys/dev/sound/usb/uaudio.c
==============================================================================
--- head/sys/dev/sound/usb/uaudio.c	Thu May 28 17:35:35 2009	(r192983)
+++ head/sys/dev/sound/usb/uaudio.c	Thu May 28 17:36:36 2009	(r192984)
@@ -135,11 +135,11 @@ struct uaudio_chan {
 	struct pcmchan_caps pcm_cap;	/* capabilities */
 
 	struct snd_dbuf *pcm_buf;
-	const struct usb2_config *usb2_cfg;
+	const struct usb_config *usb2_cfg;
 	struct mtx *pcm_mtx;		/* lock protecting this structure */
 	struct uaudio_softc *priv_sc;
 	struct pcm_channel *pcm_ch;
-	struct usb2_xfer *xfer[UAUDIO_NCHANBUFS];
+	struct usb_xfer *xfer[UAUDIO_NCHANBUFS];
 	const struct usb2_audio_streaming_interface_descriptor *p_asid;
 	const struct usb2_audio_streaming_type1_descriptor *p_asf1d;
 	const struct usb2_audio_streaming_endpoint_descriptor *p_sed;
@@ -171,7 +171,7 @@ struct uaudio_chan {
 #define	UMIDI_BULK_SIZE  1024		/* bytes */
 
 struct umidi_sub_chan {
-	struct usb2_fifo_sc fifo;
+	struct usb_fifo_sc fifo;
 	uint8_t *temp_cmd;
 	uint8_t	temp_0[4];
 	uint8_t	temp_1[4];
@@ -194,7 +194,7 @@ struct umidi_chan {
 	struct umidi_sub_chan sub[UMIDI_CABLES_MAX];
 	struct mtx mtx;
 
-	struct usb2_xfer *xfer[UMIDI_N_TRANSFER];
+	struct usb_xfer *xfer[UMIDI_N_TRANSFER];
 
 	uint8_t	iface_index;
 	uint8_t	iface_alt_index;
@@ -218,8 +218,8 @@ struct uaudio_softc {
 	struct uaudio_chan sc_play_chan;
 	struct umidi_chan sc_midi_chan;
 
-	struct usb2_device *sc_udev;
-	struct usb2_xfer *sc_mixer_xfer[1];
+	struct usb_device *sc_udev;
+	struct usb_xfer *sc_mixer_xfer[1];
 	struct uaudio_mixer_node *sc_mixer_root;
 	struct uaudio_mixer_node *sc_mixer_curr;
 
@@ -251,7 +251,7 @@ struct uaudio_search_result {
 
 struct uaudio_terminal_node {
 	union {
-		const struct usb2_descriptor *desc;
+		const struct usb_descriptor *desc;
 		const struct usb2_audio_input_terminal *it;
 		const struct usb2_audio_output_terminal *ot;
 		const struct usb2_audio_mixer_unit_0 *mu;
@@ -317,9 +317,9 @@ static usb2_callback_t umidi_write_clear
 static usb2_callback_t umidi_bulk_write_callback;
 
 static void	uaudio_chan_fill_info_sub(struct uaudio_softc *,
-		    struct usb2_device *, uint32_t, uint16_t, uint8_t, uint8_t);
+		    struct usb_device *, uint32_t, uint16_t, uint8_t, uint8_t);
 static void	uaudio_chan_fill_info(struct uaudio_softc *,
-		    struct usb2_device *);
+		    struct usb_device *);
 static void	uaudio_mixer_add_ctl_sub(struct uaudio_softc *,
 		    struct uaudio_mixer_node *);
 static void	uaudio_mixer_add_ctl(struct uaudio_softc *,
@@ -357,25 +357,25 @@ static void	uaudio_mixer_find_inputs_sub
 static void	uaudio_mixer_find_outputs_sub(struct uaudio_terminal_node *,
 		    uint8_t, uint8_t, struct uaudio_search_result *);
 static void	uaudio_mixer_fill_info(struct uaudio_softc *,
-		    struct usb2_device *, void *);
-static uint16_t	uaudio_mixer_get(struct usb2_device *, uint8_t,
+		    struct usb_device *, void *);
+static uint16_t	uaudio_mixer_get(struct usb_device *, uint8_t,
 		    struct uaudio_mixer_node *);
 static void	uaudio_mixer_ctl_set(struct uaudio_softc *,
 		    struct uaudio_mixer_node *, uint8_t, int32_t val);
-static usb2_error_t uaudio_set_speed(struct usb2_device *, uint8_t, uint32_t);
+static usb2_error_t uaudio_set_speed(struct usb_device *, uint8_t, uint32_t);
 static int	uaudio_mixer_signext(uint8_t, int);
 static int	uaudio_mixer_bsd2value(struct uaudio_mixer_node *, int32_t val);
 static const void *uaudio_mixer_verify_desc(const void *, uint32_t);
 static void	uaudio_mixer_init(struct uaudio_softc *);
 static uint8_t	umidi_convert_to_usb(struct umidi_sub_chan *, uint8_t, uint8_t);
-static struct	umidi_sub_chan *umidi_sub_by_fifo(struct usb2_fifo *);
-static void	umidi_start_read(struct usb2_fifo *);
-static void	umidi_stop_read(struct usb2_fifo *);
-static void	umidi_start_write(struct usb2_fifo *);
-static void	umidi_stop_write(struct usb2_fifo *);
-static int	umidi_open(struct usb2_fifo *, int);
-static int	umidi_ioctl(struct usb2_fifo *, u_long cmd, void *, int);
-static void	umidi_close(struct usb2_fifo *, int);
+static struct	umidi_sub_chan *umidi_sub_by_fifo(struct usb_fifo *);
+static void	umidi_start_read(struct usb_fifo *);
+static void	umidi_stop_read(struct usb_fifo *);
+static void	umidi_start_write(struct usb_fifo *);
+static void	umidi_stop_write(struct usb_fifo *);
+static int	umidi_open(struct usb_fifo *, int);
+static int	umidi_ioctl(struct usb_fifo *, u_long cmd, void *, int);
+static void	umidi_close(struct usb_fifo *, int);
 static void	umidi_init(device_t dev);
 static int32_t	umidi_probe(device_t dev);
 static int32_t	umidi_detach(device_t dev);
@@ -388,7 +388,7 @@ static void	uaudio_mixer_dump_cluster(ui
 static const char *uaudio_mixer_get_terminal_name(uint16_t);
 #endif
 
-static const struct usb2_config
+static const struct usb_config
 	uaudio_cfg_record[UAUDIO_NCHANBUFS] = {
 	[0] = {
 		.type = UE_ISOCHRONOUS,
@@ -411,7 +411,7 @@ static const struct usb2_config
 	},
 };
 
-static const struct usb2_config
+static const struct usb_config
 	uaudio_cfg_play[UAUDIO_NCHANBUFS] = {
 	[0] = {
 		.type = UE_ISOCHRONOUS,
@@ -434,13 +434,13 @@ static const struct usb2_config
 	},
 };
 
-static const struct usb2_config
+static const struct usb_config
 	uaudio_mixer_config[1] = {
 	[0] = {
 		.type = UE_CONTROL,
 		.endpoint = 0x00,	/* Control pipe */
 		.direction = UE_DIR_ANY,
-		.bufsize = (sizeof(struct usb2_device_request) + 4),
+		.bufsize = (sizeof(struct usb_device_request) + 4),
 		.callback = &uaudio_mixer_write_cfg_callback,
 		.timeout = 1000,	/* 1 second */
 	},
@@ -466,7 +466,7 @@ uint8_t	umidi_cmd_to_len[16] = {
 	[0xF] = 1,			/* bytes */
 };
 
-static const struct usb2_config
+static const struct usb_config
 	umidi_config[UMIDI_N_TRANSFER] = {
 	[0] = {
 		.type = UE_BULK,
@@ -490,7 +490,7 @@ static const struct usb2_config
 		.type = UE_CONTROL,
 		.endpoint = 0x00,	/* Control pipe */
 		.direction = UE_DIR_ANY,
-		.bufsize = sizeof(struct usb2_device_request),
+		.bufsize = sizeof(struct usb_device_request),
 		.flags = {},
 		.callback = &umidi_write_clear_stall_callback,
 		.timeout = 1000,	/* 1 second */
@@ -501,7 +501,7 @@ static const struct usb2_config
 		.type = UE_CONTROL,
 		.endpoint = 0x00,	/* Control pipe */
 		.direction = UE_DIR_ANY,
-		.bufsize = sizeof(struct usb2_device_request),
+		.bufsize = sizeof(struct usb_device_request),
 		.flags = {},
 		.callback = &umidi_read_clear_stall_callback,
 		.timeout = 1000,	/* 1 second */
@@ -531,7 +531,7 @@ static driver_t uaudio_driver = {
 static int
 uaudio_probe(device_t dev)
 {
-	struct usb2_attach_arg *uaa = device_get_ivars(dev);
+	struct usb_attach_arg *uaa = device_get_ivars(dev);
 
 	if (uaa->usb_mode != USB_MODE_HOST)
 		return (ENXIO);
@@ -554,9 +554,9 @@ uaudio_probe(device_t dev)
 static int
 uaudio_attach(device_t dev)
 {
-	struct usb2_attach_arg *uaa = device_get_ivars(dev);
+	struct usb_attach_arg *uaa = device_get_ivars(dev);
 	struct uaudio_softc *sc = device_get_softc(dev);
-	struct usb2_interface_descriptor *id;
+	struct usb_interface_descriptor *id;
 	device_t child;
 
 	sc->sc_play_chan.priv_sc = sc;
@@ -767,18 +767,18 @@ uaudio_chan_dump_ep_desc(const usb2_endp
 #endif
 
 static void
-uaudio_chan_fill_info_sub(struct uaudio_softc *sc, struct usb2_device *udev,
+uaudio_chan_fill_info_sub(struct uaudio_softc *sc, struct usb_device *udev,
     uint32_t rate, uint16_t fps, uint8_t channels,
     uint8_t bit_resolution)
 {
-	struct usb2_descriptor *desc = NULL;
+	struct usb_descriptor *desc = NULL;
 	const struct usb2_audio_streaming_interface_descriptor *asid = NULL;
 	const struct usb2_audio_streaming_type1_descriptor *asf1d = NULL;
 	const struct usb2_audio_streaming_endpoint_descriptor *sed = NULL;
 	const usb2_endpoint_descriptor_audio_t *ed1 = NULL;
 	const usb2_endpoint_descriptor_audio_t *ed2 = NULL;
-	struct usb2_config_descriptor *cd = usb2_get_config_descriptor(udev);
-	struct usb2_interface_descriptor *id;
+	struct usb_config_descriptor *cd = usb2_get_config_descriptor(udev);
+	struct usb_interface_descriptor *id;
 	const struct uaudio_format *p_fmt;
 	struct uaudio_chan *chan;
 	uint16_t curidx = 0xFFFF;
@@ -1049,7 +1049,7 @@ uaudio_chan_fill_info_sub(struct uaudio_
 }
 
 static void
-uaudio_chan_fill_info(struct uaudio_softc *sc, struct usb2_device *udev)
+uaudio_chan_fill_info(struct uaudio_softc *sc, struct usb_device *udev)
 {
 	uint32_t rate = uaudio_default_rate;
 	uint32_t z;
@@ -1098,7 +1098,7 @@ done:
 }
 
 static void
-uaudio_chan_play_callback(struct usb2_xfer *xfer)
+uaudio_chan_play_callback(struct usb_xfer *xfer)
 {
 	struct uaudio_chan *ch = xfer->priv_sc;
 	uint32_t *p_len = xfer->frlengths;
@@ -1187,7 +1187,7 @@ tr_transferred:
 }
 
 static void
-uaudio_chan_record_callback(struct usb2_xfer *xfer)
+uaudio_chan_record_callback(struct usb_xfer *xfer)
 {
 	struct uaudio_chan *ch = xfer->priv_sc;
 	uint32_t *p_len = xfer->frlengths;
@@ -1999,7 +1999,7 @@ uaudio_mixer_verify_desc(const void *arg
 	const struct usb2_audio_processing_unit_1 *u1;
 
 	union {
-		const struct usb2_descriptor *desc;
+		const struct usb_descriptor *desc;
 		const struct usb2_audio_input_terminal *it;
 		const struct usb2_audio_output_terminal *ot;
 		const struct usb2_audio_mixer_unit_0 *mu;
@@ -2151,7 +2151,7 @@ static struct usb2_audio_cluster
 uaudio_mixer_get_cluster(uint8_t id, const struct uaudio_terminal_node *iot)
 {
 	struct usb2_audio_cluster r;
-	const struct usb2_descriptor *dp;
+	const struct usb_descriptor *dp;
 	uint8_t i;
 
 	for (i = 0; i < UAUDIO_RECURSE_LIMIT; i++) {	/* avoid infinite loops */
@@ -2618,12 +2618,12 @@ uaudio_mixer_find_outputs_sub(struct uau
 }
 
 static void
-uaudio_mixer_fill_info(struct uaudio_softc *sc, struct usb2_device *udev,
+uaudio_mixer_fill_info(struct uaudio_softc *sc, struct usb_device *udev,
     void *desc)
 {
 	const struct usb2_audio_control_descriptor *acdp;
-	struct usb2_config_descriptor *cd = usb2_get_config_descriptor(udev);
-	const struct usb2_descriptor *dp;
+	struct usb_config_descriptor *cd = usb2_get_config_descriptor(udev);
+	const struct usb_descriptor *dp;
 	const struct usb2_audio_unit *au;
 	struct uaudio_terminal_node *iot = NULL;
 	uint16_t wTotalLen;
@@ -2866,10 +2866,10 @@ done:
 }
 
 static uint16_t
-uaudio_mixer_get(struct usb2_device *udev, uint8_t what,
+uaudio_mixer_get(struct usb_device *udev, uint8_t what,
     struct uaudio_mixer_node *mc)
 {
-	struct usb2_device_request req;
+	struct usb_device_request req;
 	uint16_t val;
 	uint16_t len = MIX_SIZE(mc->type);
 	uint8_t data[4];
@@ -2903,9 +2903,9 @@ uaudio_mixer_get(struct usb2_device *ude
 }
 
 static void
-uaudio_mixer_write_cfg_callback(struct usb2_xfer *xfer)
+uaudio_mixer_write_cfg_callback(struct usb_xfer *xfer)
 {
-	struct usb2_device_request req;
+	struct usb_device_request req;
 	struct uaudio_softc *sc = xfer->priv_sc;
 	struct uaudio_mixer_node *mc = sc->sc_mixer_curr;
 	uint16_t len;
@@ -2988,9 +2988,9 @@ tr_setup:
 }
 
 static usb2_error_t
-uaudio_set_speed(struct usb2_device *udev, uint8_t endpt, uint32_t speed)
+uaudio_set_speed(struct usb_device *udev, uint8_t endpt, uint32_t speed)
 {
-	struct usb2_device_request req;
+	struct usb_device_request req;
 	uint8_t data[3];
 
 	DPRINTFN(6, "endpt=%d speed=%u\n", endpt, speed);
@@ -3182,10 +3182,10 @@ uaudio_mixer_setrecsrc(struct uaudio_sof
  *========================================================================*/
 
 static void
-umidi_read_clear_stall_callback(struct usb2_xfer *xfer)
+umidi_read_clear_stall_callback(struct usb_xfer *xfer)
 {
 	struct umidi_chan *chan = xfer->priv_sc;
-	struct usb2_xfer *xfer_other = chan->xfer[1];
+	struct usb_xfer *xfer_other = chan->xfer[1];
 
 	if (usb2_clear_stall_callback(xfer, xfer_other)) {
 		DPRINTF("stall cleared\n");
@@ -3195,7 +3195,7 @@ umidi_read_clear_stall_callback(struct u
 }
 
 static void
-umidi_bulk_read_callback(struct usb2_xfer *xfer)
+umidi_bulk_read_callback(struct usb_xfer *xfer)
 {
 	struct umidi_chan *chan = xfer->priv_sc;
 	struct umidi_sub_chan *sub;
@@ -3261,10 +3261,10 @@ tr_error:
 }
 
 static void
-umidi_write_clear_stall_callback(struct usb2_xfer *xfer)
+umidi_write_clear_stall_callback(struct usb_xfer *xfer)
 {
 	struct umidi_chan *chan = xfer->priv_sc;
-	struct usb2_xfer *xfer_other = chan->xfer[0];
+	struct usb_xfer *xfer_other = chan->xfer[0];
 
 	if (usb2_clear_stall_callback(xfer, xfer_other)) {
 		DPRINTF("stall cleared\n");
@@ -3407,7 +3407,7 @@ umidi_convert_to_usb(struct umidi_sub_ch
 }
 
 static void
-umidi_bulk_write_callback(struct usb2_xfer *xfer)
+umidi_bulk_write_callback(struct usb_xfer *xfer)
 {
 	struct umidi_chan *chan = xfer->priv_sc;
 	struct umidi_sub_chan *sub;
@@ -3507,7 +3507,7 @@ umidi_bulk_write_callback(struct usb2_xf
 }
 
 static struct umidi_sub_chan *
-umidi_sub_by_fifo(struct usb2_fifo *fifo)
+umidi_sub_by_fifo(struct usb_fifo *fifo)
 {
 	struct umidi_chan *chan = fifo->priv_sc0;
 	struct umidi_sub_chan *sub;
@@ -3521,14 +3521,14 @@ umidi_sub_by_fifo(struct usb2_fifo *fifo
 		}
 	}
 
-	panic("%s:%d cannot find usb2_fifo!\n",
+	panic("%s:%d cannot find usb_fifo!\n",
 	    __FILE__, __LINE__);
 
 	return (NULL);
 }
 
 static void
-umidi_start_read(struct usb2_fifo *fifo)
+umidi_start_read(struct usb_fifo *fifo)
 {
 	struct umidi_chan *chan = fifo->priv_sc0;
 
@@ -3536,7 +3536,7 @@ umidi_start_read(struct usb2_fifo *fifo)
 }
 
 static void
-umidi_stop_read(struct usb2_fifo *fifo)
+umidi_stop_read(struct usb_fifo *fifo)
 {

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 18:11:09 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D1EC61065675;
	Thu, 28 May 2009 18:11:09 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BFBFD8FC13;
	Thu, 28 May 2009 18:11:09 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4SIB9bu045679;
	Thu, 28 May 2009 18:11:09 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4SIB9ip045676;
	Thu, 28 May 2009 18:11:09 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <200905281811.n4SIB9ip045676@svn.freebsd.org>
From: Alan Cox 
Date: Thu, 28 May 2009 18:11:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192986 - in head/sys: fs/nfsclient fs/smbfs nfsclient
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 18:11:10 -0000

Author: alc
Date: Thu May 28 18:11:09 2009
New Revision: 192986
URL: http://svn.freebsd.org/changeset/base/192986

Log:
  Make *getpages()s' assertion on the state of each page's dirty bits
  stricter.

Modified:
  head/sys/fs/nfsclient/nfs_clbio.c
  head/sys/fs/smbfs/smbfs_io.c
  head/sys/nfsclient/nfs_bio.c

Modified: head/sys/fs/nfsclient/nfs_clbio.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clbio.c	Thu May 28 17:36:44 2009	(r192985)
+++ head/sys/fs/nfsclient/nfs_clbio.c	Thu May 28 18:11:09 2009	(r192986)
@@ -311,7 +311,7 @@ ncl_getpages(struct vop_getpages_args *a
 			 */
 			m->valid = 0;
 			vm_page_set_valid(m, 0, size - toff);
-			KASSERT((m->dirty & vm_page_bits(0, size - toff)) == 0,
+			KASSERT(m->dirty == 0,
 			    ("nfs_getpages: page %p is dirty", m));
 		} else {
 			/*

Modified: head/sys/fs/smbfs/smbfs_io.c
==============================================================================
--- head/sys/fs/smbfs/smbfs_io.c	Thu May 28 17:36:44 2009	(r192985)
+++ head/sys/fs/smbfs/smbfs_io.c	Thu May 28 18:11:09 2009	(r192986)
@@ -525,7 +525,7 @@ smbfs_getpages(ap)
 			 */
 			m->valid = 0;
 			vm_page_set_valid(m, 0, size - toff);
-			KASSERT((m->dirty & vm_page_bits(0, size - toff)) == 0,
+			KASSERT(m->dirty == 0,
 			    ("smbfs_getpages: page %p is dirty", m));
 		} else {
 			/*

Modified: head/sys/nfsclient/nfs_bio.c
==============================================================================
--- head/sys/nfsclient/nfs_bio.c	Thu May 28 17:36:44 2009	(r192985)
+++ head/sys/nfsclient/nfs_bio.c	Thu May 28 18:11:09 2009	(r192986)
@@ -214,7 +214,7 @@ nfs_getpages(struct vop_getpages_args *a
 			 */
 			m->valid = 0;
 			vm_page_set_valid(m, 0, size - toff);
-			KASSERT((m->dirty & vm_page_bits(0, size - toff)) == 0,
+			KASSERT(m->dirty == 0,
 			    ("nfs_getpages: page %p is dirty", m));
 		} else {
 			/*

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 19:43:59 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 59F18106585D;
	Thu, 28 May 2009 19:43:59 +0000 (UTC)
	(envelope-from peterjeremy@optushome.com.au)
Received: from mail16.syd.optusnet.com.au (mail16.syd.optusnet.com.au
	[211.29.132.197])
	by mx1.freebsd.org (Postfix) with ESMTP id D2E048FC16;
	Thu, 28 May 2009 19:43:58 +0000 (UTC)
	(envelope-from peterjeremy@optushome.com.au)
Received: from server.vk2pj.dyndns.org
	(c122-106-216-167.belrs3.nsw.optusnet.com.au [122.106.216.167])
	by mail16.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	n4SJhtC1004938
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Fri, 29 May 2009 05:43:56 +1000
X-Bogosity: Ham, spamicity=0.000000
Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1])
	by server.vk2pj.dyndns.org (8.14.3/8.14.3) with ESMTP id n4SJhttM093318;
	Fri, 29 May 2009 05:43:55 +1000 (EST)
	(envelope-from peter@server.vk2pj.dyndns.org)
Received: (from peter@localhost)
	by server.vk2pj.dyndns.org (8.14.3/8.14.3/Submit) id n4SJhtbA093317;
	Fri, 29 May 2009 05:43:55 +1000 (EST) (envelope-from peter)
Date: Fri, 29 May 2009 05:43:55 +1000
From: Peter Jeremy 
To: Rick Macklem 
Message-ID: <20090528194355.GB1331@server.vk2pj.dyndns.org>
References: <200905272202.n4RM2s2M013427@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="f2QGlHpHGjS2mn6Y"
Content-Disposition: inline
In-Reply-To: <200905272202.n4RM2s2M013427@svn.freebsd.org>
X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc
User-Agent: Mutt/1.5.19 (2009-01-05)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r192934 - head/usr.sbin/mountd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 19:44:03 -0000


--f2QGlHpHGjS2mn6Y
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2009-May-27 22:02:54 +0000, Rick Macklem  wrote:
>  Modify mountd to handle the experimental nfs server as well as the
>  regular one. It now takes a "-4" command line argument to force it
>  to use the experimental server.

I also feel that '-4' is likely to lead to confusion as to whether the
option refers to NFSv4 or IPv4.

How about implementing a '-V n', where 'n' indicates the NFS version
(with '-2' redefined as a deprecated equivalent to '-V 2').  This
leaves '-v' for possible future used as some sort of verbose flag and
both allows explicit specification of NFSv3 (presumably the default
will change from NFSv3 to NFSv4 at some point - by which time we need
a way to request NFSv3) as well as possible future NFS versions (NFSv5
anyone?).

--=20
Peter Jeremy

--f2QGlHpHGjS2mn6Y
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (FreeBSD)

iEYEARECAAYFAkoe6XsACgkQ/opHv/APuIdbbACgnZ/vg/gAgEZtmA7WR7XSfAs3
3CUAnRFiIMr9qncfUzDPbHNZIiMTQzt4
=8iWH
-----END PGP SIGNATURE-----

--f2QGlHpHGjS2mn6Y--

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 19:45:12 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 526111065711;
	Thu, 28 May 2009 19:45:12 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3D4A48FC0C;
	Thu, 28 May 2009 19:45:12 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4SJjCBJ047900;
	Thu, 28 May 2009 19:45:12 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4SJjBh1047893;
	Thu, 28 May 2009 19:45:11 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Message-Id: <200905281945.n4SJjBh1047893@svn.freebsd.org>
From: Rick Macklem 
Date: Thu, 28 May 2009 19:45:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192991 - in head/sys: conf modules modules/nfscl
	modules/nfscommon modules/nfsd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 19:45:13 -0000

Author: rmacklem
Date: Thu May 28 19:45:11 2009
New Revision: 192991
URL: http://svn.freebsd.org/changeset/base/192991

Log:
  Add the kernel build glue for the experimental NFS subsystem that
  includes support for NFSv4. The subsystem can optionally be linked
  into the kernel using the two options:
    NFSCL - the client
    NFSD - the server
  It is also built as three modules:
    nfscl - the client
    nfsd - the server
    nfscommon - functions shared by the client and server
  
  Approved by:	kib (mentor)

Added:
  head/sys/modules/nfscl/
  head/sys/modules/nfscl/Makefile   (contents, props changed)
  head/sys/modules/nfscommon/
  head/sys/modules/nfscommon/Makefile   (contents, props changed)
  head/sys/modules/nfsd/
  head/sys/modules/nfsd/Makefile   (contents, props changed)
Modified:
  head/sys/conf/NOTES
  head/sys/conf/files
  head/sys/conf/options
  head/sys/modules/Makefile

Modified: head/sys/conf/NOTES
==============================================================================
--- head/sys/conf/NOTES	Thu May 28 19:05:26 2009	(r192990)
+++ head/sys/conf/NOTES	Thu May 28 19:45:11 2009	(r192991)
@@ -964,6 +964,8 @@ options 	HPFS			#OS/2 File system
 options 	MSDOSFS			#MS DOS File System (FAT, FAT32)
 options 	NFSSERVER		#Network File System server
 options 	NFSLOCKD		#Network Lock Manager
+options 	NFSCL			#experimental NFS client with NFSv4
+options 	NFSD			#experimental NFS server with NFSv4
 
 # NT File System. Read-mostly, see mount_ntfs(8) for details.
 # For a full read-write NTFS support consider sysutils/fusefs-ntfs

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Thu May 28 19:05:26 2009	(r192990)
+++ head/sys/conf/files	Thu May 28 19:45:11 2009	(r192991)
@@ -1672,6 +1672,29 @@ fs/msdosfs/msdosfs_iconv.c	optional msdo
 fs/msdosfs/msdosfs_lookup.c	optional msdosfs
 fs/msdosfs/msdosfs_vfsops.c	optional msdosfs
 fs/msdosfs/msdosfs_vnops.c	optional msdosfs
+fs/nfs/nfs_commonkrpc.c		optional nfscl | nfsd
+fs/nfs/nfs_commonsubs.c		optional nfscl | nfsd
+fs/nfs/nfs_commonport.c		optional nfscl | nfsd
+fs/nfs/nfs_commonacl.c		optional nfscl | nfsd
+fs/nfsclient/nfs_clcomsubs.c	optional nfscl
+fs/nfsclient/nfs_clsubs.c	optional nfscl
+fs/nfsclient/nfs_clstate.c	optional nfscl
+fs/nfsclient/nfs_clkrpc.c	optional nfscl
+fs/nfsclient/nfs_clrpcops.c	optional nfscl
+fs/nfsclient/nfs_clvnops.c	optional nfscl
+fs/nfsclient/nfs_clnode.c	optional nfscl
+fs/nfsclient/nfs_clvfsops.c	optional nfscl
+fs/nfsclient/nfs_cllock.c	optional nfscl
+fs/nfsclient/nfs_clport.c	optional nfscl
+fs/nfsclient/nfs_clbio.c	optional nfscl
+fs/nfsclient/nfs_clnfsiod.c	optional nfscl
+fs/nfsserver/nfs_nfsdsocket.c	optional nfsd
+fs/nfsserver/nfs_nfsdsubs.c	optional nfsd
+fs/nfsserver/nfs_nfsdstate.c	optional nfsd
+fs/nfsserver/nfs_nfsdkrpc.c	optional nfsd
+fs/nfsserver/nfs_nfsdserv.c	optional nfsd
+fs/nfsserver/nfs_nfsdport.c	optional nfsd
+fs/nfsserver/nfs_nfsdcache.c	optional nfsd
 fs/ntfs/ntfs_compr.c		optional ntfs
 fs/ntfs/ntfs_iconv.c		optional ntfs_iconv
 fs/ntfs/ntfs_ihash.c		optional ntfs
@@ -2420,14 +2443,14 @@ nfsserver/nfs_srvsock.c		optional nfsser
 nfsserver/nfs_srvcache.c	optional nfsserver
 nfsserver/nfs_srvsubs.c		optional nfsserver
 nfsserver/nfs_syscalls.c	optional nfsserver
-nfs/nfs_nfssvc.c		optional nfsserver
-nlm/nlm_advlock.c		optional nfslockd nfsclient
-nlm/nlm_prot_clnt.c		optional nfslockd
-nlm/nlm_prot_impl.c		optional nfslockd
-nlm/nlm_prot_server.c		optional nfslockd
-nlm/nlm_prot_svc.c		optional nfslockd
-nlm/nlm_prot_xdr.c		optional nfslockd
-nlm/sm_inter_xdr.c		optional nfslockd
+nfs/nfs_nfssvc.c		optional nfsserver | nfscl | nfsd
+nlm/nlm_advlock.c		optional nfslockd nfsclient | nfsd nfsclient
+nlm/nlm_prot_clnt.c		optional nfslockd | nfsd
+nlm/nlm_prot_impl.c		optional nfslockd | nfsd
+nlm/nlm_prot_server.c		optional nfslockd | nfsd
+nlm/nlm_prot_svc.c		optional nfslockd | nfsd
+nlm/nlm_prot_xdr.c		optional nfslockd | nfsd
+nlm/sm_inter_xdr.c		optional nfslockd | nfsd
 # crypto support
 opencrypto/cast.c		optional crypto | ipsec
 opencrypto/criov.c		optional crypto
@@ -2447,32 +2470,32 @@ pci/intpm.c			optional intpm pci
 pci/ncr.c			optional ncr pci
 pci/nfsmb.c			optional nfsmb pci
 pci/viapm.c			optional viapm pci
-rpc/auth_none.c			optional krpc | nfslockd | nfsclient | nfsserver
-rpc/auth_unix.c			optional krpc | nfslockd | nfsclient
-rpc/authunix_prot.c		optional krpc | nfslockd | nfsclient | nfsserver
-rpc/clnt_dg.c			optional krpc | nfslockd | nfsclient
-rpc/clnt_rc.c			optional krpc | nfslockd | nfsclient
-rpc/clnt_vc.c			optional krpc | nfslockd | nfsclient | nfsserver
-rpc/getnetconfig.c		optional krpc | nfslockd | nfsclient | nfsserver
-rpc/inet_ntop.c			optional krpc | nfslockd | nfsclient | nfsserver
-rpc/inet_pton.c			optional krpc | nfslockd | nfsclient | nfsserver
-rpc/replay.c			optional krpc | nfslockd | nfsserver
-rpc/rpc_callmsg.c		optional krpc | nfslockd | nfsclient | nfsserver
-rpc/rpc_generic.c		optional krpc | nfslockd | nfsclient | nfsserver
-rpc/rpc_prot.c			optional krpc | nfslockd | nfsclient | nfsserver
-rpc/rpcb_clnt.c			optional krpc | nfslockd | nfsclient | nfsserver
-rpc/rpcb_prot.c			optional krpc | nfslockd | nfsclient | nfsserver
-rpc/svc.c			optional krpc | nfslockd | nfsserver
-rpc/svc_auth.c			optional krpc | nfslockd | nfsserver
-rpc/svc_auth_unix.c		optional krpc | nfslockd | nfsserver
-rpc/svc_dg.c			optional krpc | nfslockd | nfsserver
-rpc/svc_generic.c		optional krpc | nfslockd | nfsserver
-rpc/svc_vc.c			optional krpc | nfslockd | nfsserver
-rpc/rpcsec_gss/rpcsec_gss.c	optional krpc kgssapi | nfslockd kgssapi
-rpc/rpcsec_gss/rpcsec_gss_conf.c optional krpc kgssapi | nfslockd kgssapi
-rpc/rpcsec_gss/rpcsec_gss_misc.c optional krpc kgssapi | nfslockd kgssapi
-rpc/rpcsec_gss/rpcsec_gss_prot.c optional krpc kgssapi | nfslockd kgssapi
-rpc/rpcsec_gss/svc_rpcsec_gss.c	optional krpc kgssapi | nfslockd kgssapi
+rpc/auth_none.c			optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd
+rpc/auth_unix.c			optional krpc | nfslockd | nfsclient | nfscl | nfsd
+rpc/authunix_prot.c		optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd
+rpc/clnt_dg.c			optional krpc | nfslockd | nfsclient | nfscl | nfsd
+rpc/clnt_rc.c			optional krpc | nfslockd | nfsclient | nfscl | nfsd
+rpc/clnt_vc.c			optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd
+rpc/getnetconfig.c		optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd
+rpc/inet_ntop.c			optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd
+rpc/inet_pton.c			optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd
+rpc/replay.c			optional krpc | nfslockd | nfsserver | nfscl | nfsd
+rpc/rpc_callmsg.c		optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd
+rpc/rpc_generic.c		optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd
+rpc/rpc_prot.c			optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd
+rpc/rpcb_clnt.c			optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd
+rpc/rpcb_prot.c			optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd
+rpc/svc.c			optional krpc | nfslockd | nfsserver | nfscl | nfsd
+rpc/svc_auth.c			optional krpc | nfslockd | nfsserver | nfscl | nfsd
+rpc/svc_auth_unix.c		optional krpc | nfslockd | nfsserver | nfscl | nfsd
+rpc/svc_dg.c			optional krpc | nfslockd | nfsserver | nfscl | nfsd
+rpc/svc_generic.c		optional krpc | nfslockd | nfsserver | nfscl | nfsd
+rpc/svc_vc.c			optional krpc | nfslockd | nfsserver | nfscl | nfsd
+rpc/rpcsec_gss/rpcsec_gss.c	optional krpc kgssapi | nfslockd kgssapi | nfscl kgssapi | nfsd kgssapi
+rpc/rpcsec_gss/rpcsec_gss_conf.c optional krpc kgssapi | nfslockd kgssapi | nfscl kgssapi | nfsd kgssapi
+rpc/rpcsec_gss/rpcsec_gss_misc.c optional krpc kgssapi | nfslockd kgssapi | nfscl kgssapi | nfsd kgssapi
+rpc/rpcsec_gss/rpcsec_gss_prot.c optional krpc kgssapi | nfslockd kgssapi | nfscl kgssapi | nfsd kgssapi
+rpc/rpcsec_gss/svc_rpcsec_gss.c	optional krpc kgssapi | nfslockd kgssapi | nfscl kgssapi | nfsd kgssapi
 security/audit/audit.c		optional audit
 security/audit/audit_arg.c	optional audit
 security/audit/audit_bsm.c	optional audit

Modified: head/sys/conf/options
==============================================================================
--- head/sys/conf/options	Thu May 28 19:05:26 2009	(r192990)
+++ head/sys/conf/options	Thu May 28 19:45:11 2009	(r192991)
@@ -232,6 +232,13 @@ NFSSERVER	opt_nfs.h
 # supports modern features such as RPCSEC_GSS
 NFS_LEGACYRPC	opt_nfs.h
 
+# Use these options to compile the experimental nfs client and/or
+# server that supports NFSv4 into a kernel.
+# NFSCL - client
+# NFSD - server
+NFSCL		opt_nfs.h
+NFSD		opt_nfs.h
+
 # filesystems and libiconv bridge
 CD9660_ICONV	opt_dontuse.h
 MSDOSFS_ICONV	opt_dontuse.h

Modified: head/sys/modules/Makefile
==============================================================================
--- head/sys/modules/Makefile	Thu May 28 19:05:26 2009	(r192990)
+++ head/sys/modules/Makefile	Thu May 28 19:45:11 2009	(r192991)
@@ -185,7 +185,10 @@ SUBDIR=	${_3dfx} \
 	${_ndis} \
 	netgraph \
 	${_nfe} \
+	nfscl \
 	nfsclient \
+	nfscommon \
+	nfsd \
 	nfslockd \
 	nfsserver \
 	nfssvc \

Added: head/sys/modules/nfscl/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/modules/nfscl/Makefile	Thu May 28 19:45:11 2009	(r192991)
@@ -0,0 +1,26 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../fs/nfsclient
+KMOD=	nfscl
+SRCS=	vnode_if.h \
+	nfs_clrpcops.c \
+	nfs_clkrpc.c \
+	nfs_clstate.c \
+	nfs_clcomsubs.c \
+	nfs_clport.c \
+	nfs_clbio.c \
+	nfs_cllock.c \
+	nfs_clnfsiod.c \
+	nfs_clnode.c \
+	nfs_clsubs.c \
+	nfs_clvfsops.c \
+	nfs_clvnops.c \
+	opt_inet.h \
+	opt_inet6.h \
+	opt_bootp.h \
+	opt_nfsroot.h \
+	opt_nfs.h \
+	opt_ufs.h \
+	opt_kgssapi.h
+
+.include 

Added: head/sys/modules/nfscommon/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/modules/nfscommon/Makefile	Thu May 28 19:45:11 2009	(r192991)
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../fs/nfs 
+KMOD=	nfscommon
+SRCS=	vnode_if.h \
+	nfs_commonacl.c \
+	nfs_commonkrpc.c \
+	nfs_commonport.c \
+	nfs_commonsubs.c \
+	opt_kgssapi.h \
+	opt_ufs.h \
+	opt_inet6.h \
+	opt_nfs.h
+
+.include 

Added: head/sys/modules/nfsd/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/modules/nfsd/Makefile	Thu May 28 19:45:11 2009	(r192991)
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../fs/nfsserver
+KMOD=	nfsd
+SRCS=	vnode_if.h \
+	nfs_nfsdserv.c \
+	nfs_nfsdcache.c \
+	nfs_nfsdkrpc.c \
+	nfs_nfsdsocket.c \
+	nfs_nfsdstate.c \
+	nfs_nfsdsubs.c \
+	nfs_nfsdport.c \
+	opt_ufs.h \
+	opt_nfs.h \
+	opt_inet6.h \
+	opt_kgssapi.h
+
+.include 

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 19:55:32 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D06BF10658B2;
	Thu, 28 May 2009 19:55:32 +0000 (UTC)
	(envelope-from rmacklem@uoguelph.ca)
Received: from esa-jnhn.mail.uoguelph.ca (esa-jnhn.mail.uoguelph.ca
	[131.104.91.44])
	by mx1.freebsd.org (Postfix) with ESMTP id 212688FC19;
	Thu, 28 May 2009 19:55:32 +0000 (UTC)
	(envelope-from rmacklem@uoguelph.ca)
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: ApoEAGuJHkqDaFvG/2dsb2JhbADPDoQNBQ
X-IronPort-AV: E=Sophos;i="4.41,267,1241409600"; d="scan'208";a="36845083"
Received: from amazon.cs.uoguelph.ca ([131.104.91.198])
	by esa-jnhn-pri.mail.uoguelph.ca with ESMTP; 28 May 2009 15:55:31 -0400
Received: from localhost (localhost.localdomain [127.0.0.1])
	by amazon.cs.uoguelph.ca (Postfix) with ESMTP id 17BBE2100BD;
	Thu, 28 May 2009 15:55:31 -0400 (EDT)
X-Virus-Scanned: amavisd-new at amazon.cs.uoguelph.ca
Received: from amazon.cs.uoguelph.ca ([127.0.0.1])
	by localhost (amazon.cs.uoguelph.ca [127.0.0.1]) (amavisd-new,
	port 10024)
	with ESMTP id zNAqQRAy9PSJ; Thu, 28 May 2009 15:55:30 -0400 (EDT)
Received: from muncher.cs.uoguelph.ca (muncher.cs.uoguelph.ca [131.104.91.102])
	by amazon.cs.uoguelph.ca (Postfix) with ESMTP id 8A976210138;
	Thu, 28 May 2009 15:55:29 -0400 (EDT)
Received: from localhost (rmacklem@localhost)
	by muncher.cs.uoguelph.ca (8.11.7p3+Sun/8.11.6) with ESMTP id
	n4SJuSS09764; Thu, 28 May 2009 15:56:29 -0400 (EDT)
X-Authentication-Warning: muncher.cs.uoguelph.ca: rmacklem owned process doing
	-bs
Date: Thu, 28 May 2009 15:56:28 -0400 (EDT)
From: Rick Macklem 
X-X-Sender: rmacklem@muncher.cs.uoguelph.ca
To: Peter Jeremy 
In-Reply-To: <20090528194355.GB1331@server.vk2pj.dyndns.org>
Message-ID: 
References: <200905272202.n4RM2s2M013427@svn.freebsd.org>
	<20090528194355.GB1331@server.vk2pj.dyndns.org>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@freebsd.org, Rick Macklem ,
	svn-src-all@freebsd.org, src-committers@freebsd.org
Subject: Re: svn commit: r192934 - head/usr.sbin/mountd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 19:55:33 -0000



On Fri, 29 May 2009, Peter Jeremy wrote:

>
> I also feel that '-4' is likely to lead to confusion as to whether the
> option refers to NFSv4 or IPv4.
>
> How about implementing a '-V n', where 'n' indicates the NFS version
> (with '-2' redefined as a deprecated equivalent to '-V 2').  This
> leaves '-v' for possible future used as some sort of verbose flag and
> both allows explicit specification of NFSv3 (presumably the default
> will change from NFSv3 to NFSv4 at some point - by which time we need
> a way to request NFSv3) as well as possible future NFS versions (NFSv5
> anyone?).
>
It actually indicates which nfs server to run, not what versions of
nfs is supported, although the experimental one does NFSv4 as well as
NFSv2 and 3.

I'm about to pass a commit that changes the "-4" to "-e" along to my
mentor for approval.

rick
ps: The experimental server does have a way to restrict which versions
     of NFS it supports, via sysctl variables.


From owner-svn-src-head@FreeBSD.ORG  Thu May 28 20:00:07 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F056E1065B6E;
	Thu, 28 May 2009 20:00:06 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 9C4E88FC24;
	Thu, 28 May 2009 20:00:06 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net
	[66.111.2.69])
	by cyrus.watson.org (Postfix) with ESMTPSA id 3E33246B0D;
	Thu, 28 May 2009 16:00:06 -0400 (EDT)
Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8])
	by bigwig.baldwin.cx (Postfix) with ESMTPA id 0B2AA8A028;
	Thu, 28 May 2009 16:00:05 -0400 (EDT)
From: John Baldwin 
To: Peter Jeremy 
Date: Thu, 28 May 2009 15:59:54 -0400
User-Agent: KMail/1.9.7
References: <200905272202.n4RM2s2M013427@svn.freebsd.org>
	<20090528194355.GB1331@server.vk2pj.dyndns.org>
In-Reply-To: <20090528194355.GB1331@server.vk2pj.dyndns.org>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200905281559.55169.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1
	(bigwig.baldwin.cx); Thu, 28 May 2009 16:00:05 -0400 (EDT)
X-Virus-Scanned: clamav-milter 0.95 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE
	autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx
Cc: svn-src-head@freebsd.org, Rick Macklem ,
	svn-src-all@freebsd.org, src-committers@freebsd.org
Subject: Re: svn commit: r192934 - head/usr.sbin/mountd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 20:00:08 -0000

On Thursday 28 May 2009 3:43:55 pm Peter Jeremy wrote:
> On 2009-May-27 22:02:54 +0000, Rick Macklem  wrote:
> >  Modify mountd to handle the experimental nfs server as well as the
> >  regular one. It now takes a "-4" command line argument to force it
> >  to use the experimental server.
> 
> I also feel that '-4' is likely to lead to confusion as to whether the
> option refers to NFSv4 or IPv4.
> 
> How about implementing a '-V n', where 'n' indicates the NFS version
> (with '-2' redefined as a deprecated equivalent to '-V 2').  This
> leaves '-v' for possible future used as some sort of verbose flag and
> both allows explicit specification of NFSv3 (presumably the default
> will change from NFSv3 to NFSv4 at some point - by which time we need
> a way to request NFSv3) as well as possible future NFS versions (NFSv5
> anyone?).

The NFS server typically has not been limited to a single version.  Instead, 
the client chooses which version to use.  And the choice is really between 
the old NFSv[23] server and the new NFSv[234] server.  -V 2  or -V 3 would be 
ambiguous since both servers implement NFSv2 and NFSv3.  I'm not a huge fan 
of -4, but I'm not sure there is a better option that accurately 
reflects "--the-newer-one" or "--NFSng".

-- 
John Baldwin

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 20:21:01 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 966EE106564A;
	Thu, 28 May 2009 20:21:01 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 845658FC17;
	Thu, 28 May 2009 20:21:01 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4SKL1MA048682;
	Thu, 28 May 2009 20:21:01 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4SKL1nt048681;
	Thu, 28 May 2009 20:21:01 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200905282021.n4SKL1nt048681@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 28 May 2009 20:21:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192992 - head/lib/libusbhid
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 20:21:02 -0000

Author: thompsa
Date: Thu May 28 20:21:01 2009
New Revision: 192992
URL: http://svn.freebsd.org/changeset/base/192992

Log:
  Fix missed change from usb2_gen_descriptor to usb_gen_descriptor

Modified:
  head/lib/libusbhid/descr.c

Modified: head/lib/libusbhid/descr.c
==============================================================================
--- head/lib/libusbhid/descr.c	Thu May 28 19:45:11 2009	(r192991)
+++ head/lib/libusbhid/descr.c	Thu May 28 20:21:01 2009	(r192992)
@@ -76,7 +76,7 @@ hid_get_report_id(int fd)
 report_desc_t
 hid_get_report_desc(int fd)
 {
-	struct usb2_gen_descriptor ugd;
+	struct usb_gen_descriptor ugd;
 	report_desc_t rep;
 	void *data;
 

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 20:28:14 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 411621065673;
	Thu, 28 May 2009 20:28:14 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2E8208FC21;
	Thu, 28 May 2009 20:28:14 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4SKSEFB048856;
	Thu, 28 May 2009 20:28:14 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4SKSDxo048852;
	Thu, 28 May 2009 20:28:13 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Message-Id: <200905282028.n4SKSDxo048852@svn.freebsd.org>
From: Rick Macklem 
Date: Thu, 28 May 2009 20:28:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192993 - in head/usr.sbin: mountd nfsd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 20:28:15 -0000

Author: rmacklem
Date: Thu May 28 20:28:13 2009
New Revision: 192993
URL: http://svn.freebsd.org/changeset/base/192993

Log:
  Change the "-4" argument for nfsd and mountd to "-e" to avoid
  confusion, since it does not refer to IPv4 nor NFSv4, but to
  running the experimental server instead of the regular one.
  
  Approved by:	kib (mentor)

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

Modified: head/usr.sbin/mountd/mountd.8
==============================================================================
--- head/usr.sbin/mountd/mountd.8	Thu May 28 20:21:01 2009	(r192992)
+++ head/usr.sbin/mountd/mountd.8	Thu May 28 20:28:13 2009	(r192993)
@@ -38,7 +38,7 @@
 mount requests
 .Sh SYNOPSIS
 .Nm
-.Op Fl 24dlnr
+.Op Fl 2delnr
 .Op Fl h Ar bindip
 .Op Fl p Ar port
 .Op Ar exportsfile ...
@@ -63,7 +63,12 @@ Allow the administrator to force clients
 version 2
 .Tn NFS
 protocol to mount file systems from this server.
-.It Fl 4
+.It Fl d
+Output debugging information.
+.Nm
+will not detach from the controlling terminal and will print
+debugging messages to stderr.
+.It Fl e
 Forces
 .Nm
 to try and start the experimental server that includes NFSv4 support in it.
@@ -75,11 +80,6 @@ ie. The kernel is built with the followi
 # options	NFSSERVER
 options		NFSD
 .Ed
-.It Fl d
-Output debugging information.
-.Nm
-will not detach from the controlling terminal and will print
-debugging messages to stderr.
 .It Fl h Ar bindip
 Specify specific IP addresses to bind to for TCP and UDP requests.
 This option may be specified multiple times.

Modified: head/usr.sbin/mountd/mountd.c
==============================================================================
--- head/usr.sbin/mountd/mountd.c	Thu May 28 20:21:01 2009	(r192992)
+++ head/usr.sbin/mountd/mountd.c	Thu May 28 20:28:13 2009	(r192993)
@@ -297,12 +297,12 @@ main(argc, argv)
 	else
 		close(s);
 
-	while ((c = getopt(argc, argv, "24dh:lnp:r")) != -1)
+	while ((c = getopt(argc, argv, "2deh:lnp:r")) != -1)
 		switch (c) {
 		case '2':
 			force_v2 = 1;
 			break;
-		case '4':
+		case 'e':
 			run_v4server = 1;
 			break;
 		case 'n':
@@ -351,7 +351,7 @@ main(argc, argv)
 		};
 
 	/*
-	 * If the "-4" option was specified OR only the nfsd module is
+	 * If the "-e" option was specified OR only the nfsd module is
 	 * found in the server, run "nfsd".
 	 * Otherwise, try and run "nfsserver".
 	 */
@@ -733,7 +733,7 @@ static void
 usage()
 {
 	fprintf(stderr,
-		"usage: mountd [-2] [-4] [-d] [-l] [-n] [-p ] [-r] "
+		"usage: mountd [-2] [-d] [-e] [-l] [-n] [-p ] [-r] "
 		"[-h ] [export_file ...]\n");
 	exit(1);
 }

Modified: head/usr.sbin/nfsd/nfsd.8
==============================================================================
--- head/usr.sbin/nfsd/nfsd.8	Thu May 28 20:21:01 2009	(r192992)
+++ head/usr.sbin/nfsd/nfsd.8	Thu May 28 20:28:13 2009	(r192993)
@@ -38,7 +38,7 @@
 server
 .Sh SYNOPSIS
 .Nm
-.Op Fl ardut4
+.Op Fl ardute
 .Op Fl n Ar num_servers
 .Op Fl h Ar bindip
 .Sh DESCRIPTION
@@ -100,7 +100,7 @@ clients.
 Serve
 .Tn UDP NFS
 clients.
-.It Fl 4
+.It Fl e
 Forces
 .Nm
 to try and start the experimental server that includes NFSv4 support in it.

Modified: head/usr.sbin/nfsd/nfsd.c
==============================================================================
--- head/usr.sbin/nfsd/nfsd.c	Thu May 28 20:21:01 2009	(r192992)
+++ head/usr.sbin/nfsd/nfsd.c	Thu May 28 20:28:13 2009	(r192993)
@@ -117,7 +117,7 @@ void	usage(void);
  *	-d - unregister with rpcbind
  *	-t - support tcp nfs clients
  *	-u - support udp nfs clients
- *	-4 - forces it to run a server that supports nfsv4
+ *	-e - forces it to run a server that supports nfsv4
  * followed by "n" which is the number of nfsds' to fork off
  */
 int
@@ -144,8 +144,8 @@ main(int argc, char **argv)
 	nfsdcnt = DEFNFSDCNT;
 	unregister = reregister = tcpflag = maxsock = 0;
 	bindanyflag = udpflag = connect_type_cnt = bindhostc = 0;
-#define	GETOPT	"ah:n:rdtu4"
-#define	USAGE	"[-ardtu4] [-n num_servers] [-h bindip]"
+#define	GETOPT	"ah:n:rdtue"
+#define	USAGE	"[-ardtue] [-n num_servers] [-h bindip]"
 	while ((ch = getopt(argc, argv, GETOPT)) != -1)
 		switch (ch) {
 		case 'a':
@@ -180,7 +180,7 @@ main(int argc, char **argv)
 		case 'u':
 			udpflag = 1;
 			break;
-		case '4':
+		case 'e':
 			run_v4server = 1;
 			break;
 		default:
@@ -208,7 +208,7 @@ main(int argc, char **argv)
 	}
 
 	/*
-	 * If the "-4" option was specified OR only the nfsd module is
+	 * If the "-e" option was specified OR only the nfsd module is
 	 * found in the server, run "nfsd".
 	 * Otherwise, try and run "nfsserver".
 	 */

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 21:12:44 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 037D710656C9;
	Thu, 28 May 2009 21:12:44 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E5F428FC12;
	Thu, 28 May 2009 21:12:43 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4SLChh5049878;
	Thu, 28 May 2009 21:12:43 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4SLChm0049877;
	Thu, 28 May 2009 21:12:43 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200905282112.n4SLChm0049877@svn.freebsd.org>
From: Xin LI 
Date: Thu, 28 May 2009 21:12:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192994 - head/sys/compat/svr4
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 21:12:44 -0000

Author: delphij
Date: Thu May 28 21:12:43 2009
New Revision: 192994
URL: http://svn.freebsd.org/changeset/base/192994

Log:
  Use strlcpy().

Modified:
  head/sys/compat/svr4/svr4_misc.c

Modified: head/sys/compat/svr4/svr4_misc.c
==============================================================================
--- head/sys/compat/svr4/svr4_misc.c	Thu May 28 20:28:13 2009	(r192993)
+++ head/sys/compat/svr4/svr4_misc.c	Thu May 28 21:12:43 2009	(r192994)
@@ -370,7 +370,7 @@ again:
 			svr4_dirent.d_off = (svr4_off_t)(off + reclen);
 			svr4_dirent.d_reclen = (u_short) svr4reclen;
 		}
-		strcpy(svr4_dirent.d_name, bdp->d_name);
+		strlcpy(svr4_dirent.d_name, bdp->d_name, sizeof(svr4_dirent.d_name));
 		if ((error = copyout((caddr_t)&svr4_dirent, outp, svr4reclen)))
 			goto out;
 		inp += reclen;
@@ -511,7 +511,7 @@ again:
 		idb.d_ino = (svr4_ino_t)bdp->d_fileno;
 		idb.d_off = (svr4_off_t)off;
 		idb.d_reclen = (u_short)svr4_reclen;
-		strcpy(idb.d_name, bdp->d_name);
+		strlcpy(idb.d_name, bdp->d_name, sizeof(idb.d_name));
 		if ((error = copyout((caddr_t)&idb, outp, svr4_reclen)))
 			goto out;
 		/* advance past this real entry */

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 21:37:40 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B5F7D1065673;
	Thu, 28 May 2009 21:37:40 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A49998FC16;
	Thu, 28 May 2009 21:37:40 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4SLbebO050549;
	Thu, 28 May 2009 21:37:40 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4SLbeS6050548;
	Thu, 28 May 2009 21:37:40 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200905282137.n4SLbeS6050548@svn.freebsd.org>
From: Xin LI 
Date: Thu, 28 May 2009 21:37:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r192997 - head/usr.bin/perror
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 21:37:41 -0000

Author: delphij
Date: Thu May 28 21:37:40 2009
New Revision: 192997
URL: http://svn.freebsd.org/changeset/base/192997

Log:
  Use prototype for usage().  This makes perror(1) WARNS=6 clean.
  
  Approved by:	gnn

Modified:
  head/usr.bin/perror/perror.c

Modified: head/usr.bin/perror/perror.c
==============================================================================
--- head/usr.bin/perror/perror.c	Thu May 28 21:19:21 2009	(r192996)
+++ head/usr.bin/perror/perror.c	Thu May 28 21:37:40 2009	(r192997)
@@ -34,7 +34,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-static void usage();
+static void usage(void);
 
 int 
 main(int argc, char **argv)
@@ -62,7 +62,7 @@ main(int argc, char **argv)
 }
 
 static void 
-usage()
+usage(void)
 {
 	fprintf(stderr, "usage: perror number\n");
 	exit(1);

From owner-svn-src-head@FreeBSD.ORG  Thu May 28 23:23:49 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D6C181065677;
	Thu, 28 May 2009 23:23:49 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A9BB08FC19;
	Thu, 28 May 2009 23:23:49 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4SNNnDE053252;
	Thu, 28 May 2009 23:23:49 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4SNNnOG053250;
	Thu, 28 May 2009 23:23:49 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200905282323.n4SNNnOG053250@svn.freebsd.org>
From: Xin LI 
Date: Thu, 28 May 2009 23:23:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193008 - head/contrib/netcat
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 28 May 2009 23:23:50 -0000

Author: delphij
Date: Thu May 28 23:23:49 2009
New Revision: 193008
URL: http://svn.freebsd.org/changeset/base/193008

Log:
  Update netcat to the version carried with OpenBSD 4.5.

Modified:
  head/contrib/netcat/   (props changed)
  head/contrib/netcat/nc.1
  head/contrib/netcat/netcat.c

Modified: head/contrib/netcat/nc.1
==============================================================================
--- head/contrib/netcat/nc.1	Thu May 28 23:17:07 2009	(r193007)
+++ head/contrib/netcat/nc.1	Thu May 28 23:23:49 2009	(r193008)
@@ -1,4 +1,4 @@
-.\"     $OpenBSD: nc.1,v 1.47 2008/05/06 16:21:03 jmc Exp $
+.\"     $OpenBSD: nc.1,v 1.48 2008/09/19 13:24:41 sobrado Exp $
 .\"
 .\" Copyright (c) 1996 David Sacerdote
 .\" All rights reserved.
@@ -53,7 +53,7 @@
 .Ar port Oc Oc
 .Xc
 .Op Ar hostname
-.Op Ar port Ns Bq Ar s
+.Op Ar port
 .Ek
 .Sh DESCRIPTION
 The
@@ -275,8 +275,8 @@ unless the
 option is given
 (in which case the local host is used).
 .Pp
-.Ar port Ns Op Ar s
-can be single integers or ranges.
+.Ar port
+can be a single integer or a range of ports.
 Ranges are in the form nn-mm.
 In general,
 a destination port must be specified,

Modified: head/contrib/netcat/netcat.c
==============================================================================
--- head/contrib/netcat/netcat.c	Thu May 28 23:17:07 2009	(r193007)
+++ head/contrib/netcat/netcat.c	Thu May 28 23:23:49 2009	(r193008)
@@ -1,4 +1,4 @@
-/* $OpenBSD: netcat.c,v 1.91 2008/05/09 09:00:11 markus Exp $ */
+/* $OpenBSD: netcat.c,v 1.92 2008/09/19 13:24:41 sobrado Exp $ */
 /*
  * Copyright (c) 2001 Eric Jackson 
  *
@@ -967,14 +967,15 @@ add_ipsec_policy(int s, char *policy)
 void
 usage(int ret)
 {
+	fprintf(stderr,
 #ifdef IPSEC
-	fprintf(stderr, "usage: nc [-46DdEhklnorStUuvz] [-e policy] [-I receive_buffer_len] [-i interval]\n");
+	    "usage: nc [-46DdEhklnorStUuvz] [-e policy] [-I length] [-i interval] [-O length]\n"
 #else
-	fprintf(stderr, "usage: nc [-46DdhklnorStUuvz] [-I receive_buffer_len] [-i interval]\n");
+	    "usage: nc [-46DdhklnorStUuvz] [-I length] [-i interval] [-O length]\n"
 #endif
-	fprintf(stderr, "\t  [-O send_buffer_len] [-P proxy_username] [-p source_port]\n");
-	fprintf(stderr, "\t  [-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_protocol]\n");
-	fprintf(stderr, "\t  [-x proxy_address[:port]] [hostname] [port[s]]\n");
+	    "\t  [-P proxy_username] [-p source_port] [-s source_ip_address] [-T ToS]\n"
+	    "\t  [-w timeout] [-X proxy_protocol] [-x proxy_address[:port]] [hostname]\n"
+	    "\t  [port]\n");
 	if (ret)
 		exit(1);
 }

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 00:19:18 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0294C1065670;
	Fri, 29 May 2009 00:19:18 +0000 (UTC)
	(envelope-from asmrookie@gmail.com)
Received: from mail-fx0-f159.google.com (mail-fx0-f159.google.com
	[209.85.220.159])
	by mx1.freebsd.org (Postfix) with ESMTP id 018948FC12;
	Fri, 29 May 2009 00:19:16 +0000 (UTC)
	(envelope-from asmrookie@gmail.com)
Received: by fxm3 with SMTP id 3so1177174fxm.43
	for ; Thu, 28 May 2009 17:19:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:sender:received:in-reply-to
	:references:date:x-google-sender-auth:message-id:subject:from:to:cc
	:content-type:content-transfer-encoding;
	bh=jV03Aza6Kzx3WXy+3Y4kbNFaxZcA4R5aagvyb89JvsA=;
	b=B0+udUOx2MKQveWvKfHaVujk06ZNcOHhq0qEIGflwB18nTi3AZ2ih23vU6hC3N/HKR
	hd6+s22fgHia4HAv/xgYIi76HN9w3bmlPRyyFxIe5MF8ndinXdpJXt5YWGbYdy4O76Sl
	NKptSpCD5X0NTVlaxdWA7pHHNLH/rkFw3Uo0k=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	b=VoN0hywMpEC7W7Gio5uLCw0GWpUzSij0kSjo8gE1+WZZUAy7s/nJ4lwM9n6nRPmMpL
	xCiydswGT+/C5gnsxG6CcfSQysYrvtAo27z00T0uYXj9gre9FNwGwILeN1GKg9p2+L9g
	1vcjKmlnnJL378rORJ2xWLOe7rwWAh0GkhBls=
MIME-Version: 1.0
Sender: asmrookie@gmail.com
Received: by 10.223.113.9 with SMTP id y9mr1603199fap.61.1243556355906; Thu, 
	28 May 2009 17:19:15 -0700 (PDT)
In-Reply-To: <200905262028.n4QKSNj3072741@svn.freebsd.org>
References: <200905262028.n4QKSNj3072741@svn.freebsd.org>
Date: Fri, 29 May 2009 02:19:15 +0200
X-Google-Sender-Auth: 4ca04032b8f4352c
Message-ID: <3bbf2fe10905281719jaf93290x2b429f16dc0f4ff6@mail.gmail.com>
From: Attilio Rao 
To: Stacey Son 
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r192853 - in head/sys:
	cddl/contrib/opensolaris/uts/common/dtrace 
	cddl/dev/lockstat conf kern modules/dtrace modules/dtrace/dtraceall
	sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 00:19:18 -0000

2009/5/26 Stacey Son :
> Author: sson
> Date: Tue May 26 20:28:22 2009
> New Revision: 192853
> URL: http://svn.freebsd.org/changeset/base/192853
>
> Log:
>  Add the OpenSolaris dtrace lockstat provider.  The lockstat provider
>  adds probes for mutexes, reader/writer and shared/exclusive locks to
>  gather contention statistics and other locking information for
>  dtrace scripts, the lockstat(1M) command and other potential
>  consumers.

I have a question now.
In rwlocks, your algorithm doesn't bump spin_cnt for the adaptive
spinning in read mode.
Is that intendend? I don't think so, probabilly we should fix it by
bumping spin_cnt also in the adaptive spinning in read mode.

Thanks,
Attilio


-- 
Peace can only be achieved by understanding - A. Einstein

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 01:49:29 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7096F10656E5;
	Fri, 29 May 2009 01:49:29 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5AFB68FC24;
	Fri, 29 May 2009 01:49:29 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4T1nR2n056216;
	Fri, 29 May 2009 01:49:27 GMT (envelope-from attilio@svn.freebsd.org)
Received: (from attilio@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4T1nRJc056207;
	Fri, 29 May 2009 01:49:27 GMT (envelope-from attilio@svn.freebsd.org)
Message-Id: <200905290149.n4T1nRJc056207@svn.freebsd.org>
From: Attilio Rao 
Date: Fri, 29 May 2009 01:49:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193011 - in head: . share/man/man9
	sys/cddl/compat/opensolaris/sys sys/conf sys/kern sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 01:49:30 -0000

Author: attilio
Date: Fri May 29 01:49:27 2009
New Revision: 193011
URL: http://svn.freebsd.org/changeset/base/193011

Log:
  Reverse the logic for ADAPTIVE_SX option and enable it by default.
  Introduce for this operation the reverse NO_ADAPTIVE_SX option.
  The flag SX_ADAPTIVESPIN to be passed to sx_init_flags(9) gets suppressed
  and the new flag, offering the reversed logic, SX_NOADAPTIVE is added.
  
  Additively implements adaptive spininning for sx held in shared mode.
  The spinning limit can be handled through sysctls in order to be tuned
  while the code doesn't reach the release, after which time they should
  be dropped probabilly.
  
  This change has made been necessary by recent benchmarks where it does
  improve concurrency of workloads in presence of high contention
  (ie. ZFS).
  
  KPI breakage is documented by __FreeBSD_version bumping, manpage and
  UPDATING updates.
  
  Requested by:	jeff, kmacy
  Reviewed by:	jeff
  Tested by:	pho

Modified:
  head/UPDATING
  head/share/man/man9/sx.9
  head/sys/cddl/compat/opensolaris/sys/mutex.h
  head/sys/cddl/compat/opensolaris/sys/rwlock.h
  head/sys/conf/NOTES
  head/sys/conf/options
  head/sys/kern/kern_sx.c
  head/sys/sys/param.h
  head/sys/sys/sx.h

Modified: head/UPDATING
==============================================================================
--- head/UPDATING	Fri May 29 01:31:18 2009	(r193010)
+++ head/UPDATING	Fri May 29 01:49:27 2009	(r193011)
@@ -22,6 +22,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.
 	to maximize performance.  (To disable malloc debugging, run
 	ln -s aj /etc/malloc.conf.)
 
+20090528:
+	The compiling option ADAPTIVE_SX has been retired while it has been
+	introduced the option NO_ADAPTIVE_SX which handles the reversed logic.
+	The KPI for sx_init_flags() changes as accepting flags:
+	SX_ADAPTIVESPIN flag has been retired while the SX_NOADAPTIVE flag
+	has been introduced in order to handle the reversed logic.
+	Bump __FreeBSD_version to 800092.
+
 20090527:
 	Add support for hierarchical jails.  Remove global securelevel.
 	Bump __FreeBSD_version to 800091.

Modified: head/share/man/man9/sx.9
==============================================================================
--- head/share/man/man9/sx.9	Fri May 29 01:31:18 2009	(r193010)
+++ head/share/man/man9/sx.9	Fri May 29 01:49:27 2009	(r193011)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 25, 2007
+.Dd May 28, 2009
 .Dt SX 9
 .Os
 .Sh NAME
@@ -122,10 +122,10 @@ argument to
 specifies a set of optional flags to alter the behavior of
 .Fa sx .
 It contains one or more of the following flags:
-.Bl -tag -width SX_ADAPTIVESPIN
-.It Dv SX_ADAPTIVESPIN
-If the kernel is compiled with
-.Cd "options ADAPTIVE_SX" ,
+.Bl -tag -width SX_NOADAPTIVE
+.It Dv SX_NOADAPTIVE
+If the kernel is not compiled with
+.Cd "options NO_ADAPTIVE_SX" ,
 then lock operations for
 .Fa sx
 will spin instead of sleeping while an exclusive lock holder is executing on

Modified: head/sys/cddl/compat/opensolaris/sys/mutex.h
==============================================================================
--- head/sys/cddl/compat/opensolaris/sys/mutex.h	Fri May 29 01:31:18 2009	(r193010)
+++ head/sys/cddl/compat/opensolaris/sys/mutex.h	Fri May 29 01:49:27 2009	(r193011)
@@ -47,9 +47,9 @@ typedef enum {
 typedef struct sx	kmutex_t;
 
 #ifndef DEBUG
-#define	MUTEX_FLAGS	(SX_DUPOK | SX_NOWITNESS | SX_ADAPTIVESPIN)
+#define	MUTEX_FLAGS	(SX_DUPOK | SX_NOWITNESS)
 #else
-#define	MUTEX_FLAGS	(SX_DUPOK | SX_ADAPTIVESPIN)
+#define	MUTEX_FLAGS	(SX_DUPOK)
 #endif
 
 #define	mutex_init(lock, desc, type, arg)	do {			\

Modified: head/sys/cddl/compat/opensolaris/sys/rwlock.h
==============================================================================
--- head/sys/cddl/compat/opensolaris/sys/rwlock.h	Fri May 29 01:31:18 2009	(r193010)
+++ head/sys/cddl/compat/opensolaris/sys/rwlock.h	Fri May 29 01:49:27 2009	(r193011)
@@ -49,9 +49,9 @@ typedef enum {
 typedef	struct sx	krwlock_t;
 
 #ifndef DEBUG
-#define	RW_FLAGS	(SX_DUPOK | SX_NOWITNESS | SX_ADAPTIVESPIN)
+#define	RW_FLAGS	(SX_DUPOK | SX_NOWITNESS)
 #else
-#define	RW_FLAGS	(SX_DUPOK | SX_ADAPTIVESPIN)
+#define	RW_FLAGS	(SX_DUPOK)
 #endif
 
 #define	RW_READ_HELD(x)		(rw_read_held((x)))

Modified: head/sys/conf/NOTES
==============================================================================
--- head/sys/conf/NOTES	Fri May 29 01:31:18 2009	(r193010)
+++ head/sys/conf/NOTES	Fri May 29 01:49:27 2009	(r193011)
@@ -215,11 +215,11 @@ options 	NO_ADAPTIVE_MUTEXES
 # to disable it.
 options 	NO_ADAPTIVE_RWLOCKS
 
-# ADAPTIVE_SX changes the behavior of sx locks to spin if the thread
-# that currently owns the lock is executing on another CPU.  Note that
-# in addition to enabling this option, individual sx locks must be
-# initialized with the SX_ADAPTIVESPIN flag.
-options 	ADAPTIVE_SX
+# ADAPTIVE_SX changes the behavior of sx locks to spin if the thread that
+# currently owns the sx lock is executing on another CPU.
+# This behaviour is enabled by default, so this option can be used to
+# disable it.
+options 	NO_ADAPTIVE_SX
 
 # MUTEX_NOINLINE forces mutex operations to call functions to perform each
 # operation rather than inlining the simple cases.  This can be used to

Modified: head/sys/conf/options
==============================================================================
--- head/sys/conf/options	Fri May 29 01:31:18 2009	(r193010)
+++ head/sys/conf/options	Fri May 29 01:49:27 2009	(r193011)
@@ -60,7 +60,6 @@ KDB_UNATTENDED	opt_kdb.h
 SYSCTL_DEBUG	opt_sysctl.h
 
 # Miscellaneous options.
-ADAPTIVE_SX
 ALQ
 AUDIT		opt_global.h
 CODA_COMPAT_5	opt_coda.h
@@ -134,6 +133,7 @@ MPROF_BUFFERS	opt_mprof.h
 MPROF_HASH_SIZE	opt_mprof.h
 NO_ADAPTIVE_MUTEXES	opt_adaptive_mutexes.h
 NO_ADAPTIVE_RWLOCKS
+NO_ADAPTIVE_SX
 NO_SYSCTL_DESCR	opt_global.h
 NSWBUF_MIN	opt_swap.h
 MBUF_PACKET_ZONE_DISABLE	opt_global.h

Modified: head/sys/kern/kern_sx.c
==============================================================================
--- head/sys/kern/kern_sx.c	Fri May 29 01:31:18 2009	(r193010)
+++ head/sys/kern/kern_sx.c	Fri May 29 01:49:27 2009	(r193011)
@@ -60,12 +60,12 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
-#if !defined(SMP) && defined(ADAPTIVE_SX)
-#error "You must have SMP to enable the ADAPTIVE_SX option"
+#if defined(SMP) && !defined(NO_ADAPTIVE_SX)
+#define	ADAPTIVE_SX
 #endif
 
-CTASSERT(((SX_ADAPTIVESPIN | SX_RECURSE) & LO_CLASSFLAGS) ==
-    (SX_ADAPTIVESPIN | SX_RECURSE));
+CTASSERT(((SX_NOADAPTIVE | SX_RECURSE) & LO_CLASSFLAGS) ==
+    (SX_NOADAPTIVE | SX_RECURSE));
 
 /* Handy macros for sleep queues. */
 #define	SQ_EXCLUSIVE_QUEUE	0
@@ -133,6 +133,14 @@ struct lock_class lock_class_sx = {
 #define	_sx_assert(sx, what, file, line)
 #endif
 
+#ifdef ADAPTIVE_SX
+static u_int asx_retries = 10;
+static u_int asx_loops = 10000;
+SYSCTL_NODE(_debug, OID_AUTO, sx, CTLFLAG_RD, NULL, "sxlock debugging");
+SYSCTL_INT(_debug_sx, OID_AUTO, retries, CTLFLAG_RW, &asx_retries, 0, "");
+SYSCTL_INT(_debug_sx, OID_AUTO, loops, CTLFLAG_RW, &asx_loops, 0, "");
+#endif
+
 void
 assert_sx(struct lock_object *lock, int what)
 {
@@ -195,7 +203,7 @@ sx_init_flags(struct sx *sx, const char 
 	int flags;
 
 	MPASS((opts & ~(SX_QUIET | SX_RECURSE | SX_NOWITNESS | SX_DUPOK |
-	    SX_NOPROFILE | SX_ADAPTIVESPIN)) == 0);
+	    SX_NOPROFILE | SX_NOADAPTIVE)) == 0);
 
 	flags = LO_RECURSABLE | LO_SLEEPABLE | LO_UPGRADABLE;
 	if (opts & SX_DUPOK)
@@ -207,7 +215,7 @@ sx_init_flags(struct sx *sx, const char 
 	if (opts & SX_QUIET)
 		flags |= LO_QUIET;
 
-	flags |= opts & (SX_ADAPTIVESPIN | SX_RECURSE);
+	flags |= opts & (SX_NOADAPTIVE | SX_RECURSE);
 	sx->sx_lock = SX_LOCK_UNLOCKED;
 	sx->sx_recurse = 0;
 	lock_init(&sx->lock_object, &lock_class_sx, description, NULL, flags);
@@ -453,6 +461,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t 
 	GIANT_DECLARE;
 #ifdef ADAPTIVE_SX
 	volatile struct thread *owner;
+	u_int i, spintries = 0;
 #endif
 	uintptr_t x;
 #ifdef LOCK_PROFILING
@@ -495,24 +504,44 @@ _sx_xlock_hard(struct sx *sx, uintptr_t 
 		 * running or the state of the lock changes.
 		 */
 		x = sx->sx_lock;
-		if (!(x & SX_LOCK_SHARED) &&
-		    (sx->lock_object.lo_flags & SX_ADAPTIVESPIN)) {
-			x = SX_OWNER(x);
-			owner = (struct thread *)x;
-			if (TD_IS_RUNNING(owner)) {
-				if (LOCK_LOG_TEST(&sx->lock_object, 0))
-					CTR3(KTR_LOCK,
+		if ((sx->lock_object.lo_flags & SX_NOADAPTIVE) != 0) {
+			if ((x & SX_LOCK_SHARED) == 0) {
+				x = SX_OWNER(x);
+				owner = (struct thread *)x;
+				if (TD_IS_RUNNING(owner)) {
+					if (LOCK_LOG_TEST(&sx->lock_object, 0))
+						CTR3(KTR_LOCK,
 					    "%s: spinning on %p held by %p",
-					    __func__, sx, owner);
-				GIANT_SAVE();
-				while (SX_OWNER(sx->sx_lock) == x &&
-				    TD_IS_RUNNING(owner)) {
+						    __func__, sx, owner);
+					GIANT_SAVE();
+					while (SX_OWNER(sx->sx_lock) == x &&
+					    TD_IS_RUNNING(owner)) {
+						cpu_spinwait();
+#ifdef KDTRACE_HOOKS
+						spin_cnt++;
+#endif
+					}
+					continue;
+				}
+			} else if (SX_SHARERS(x) && spintries < asx_retries) {
+				spintries++;
+				for (i = 0; i < asx_loops; i++) {
+					if (LOCK_LOG_TEST(&sx->lock_object, 0))
+						CTR4(KTR_LOCK,
+				    "%s: shared spinning on %p with %u and %u",
+						    __func__, sx, spintries, i);
+					GIANT_SAVE();
+					x = sx->sx_lock;
+					if ((x & SX_LOCK_SHARED) == 0 ||
+					    SX_SHARERS(x) == 0)
+						break;
 					cpu_spinwait();
 #ifdef KDTRACE_HOOKS
 					spin_cnt++;
 #endif
 				}
-				continue;
+				if (i != asx_loops)
+					continue;
 			}
 		}
 #endif
@@ -538,7 +567,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t 
 		 * again.
 		 */
 		if (!(x & SX_LOCK_SHARED) &&
-		    (sx->lock_object.lo_flags & SX_ADAPTIVESPIN)) {
+		    (sx->lock_object.lo_flags & SX_NOADAPTIVE) == 0) {
 			owner = (struct thread *)SX_OWNER(x);
 			if (TD_IS_RUNNING(owner)) {
 				sleepq_release(&sx->lock_object);
@@ -752,7 +781,7 @@ _sx_slock_hard(struct sx *sx, int opts, 
 		 * the owner stops running or the state of the lock
 		 * changes.
 		 */
-		if (sx->lock_object.lo_flags & SX_ADAPTIVESPIN) {
+		if ((sx->lock_object.lo_flags & SX_NOADAPTIVE) == 0) {
 			x = SX_OWNER(x);
 			owner = (struct thread *)x;
 			if (TD_IS_RUNNING(owner)) {
@@ -796,7 +825,7 @@ _sx_slock_hard(struct sx *sx, int opts, 
 		 * changes.
 		 */
 		if (!(x & SX_LOCK_SHARED) &&
-		    (sx->lock_object.lo_flags & SX_ADAPTIVESPIN)) {
+		    (sx->lock_object.lo_flags & SX_NOADAPTIVE) == 0) {
 			owner = (struct thread *)SX_OWNER(x);
 			if (TD_IS_RUNNING(owner)) {
 				sleepq_release(&sx->lock_object);

Modified: head/sys/sys/param.h
==============================================================================
--- head/sys/sys/param.h	Fri May 29 01:31:18 2009	(r193010)
+++ head/sys/sys/param.h	Fri May 29 01:49:27 2009	(r193011)
@@ -57,7 +57,7 @@
  *		is created, otherwise 1.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 800091	/* Master, propagated to newvers */
+#define __FreeBSD_version 800092	/* Master, propagated to newvers */
 
 #ifndef LOCORE
 #include 

Modified: head/sys/sys/sx.h
==============================================================================
--- head/sys/sys/sx.h	Fri May 29 01:31:18 2009	(r193010)
+++ head/sys/sys/sx.h	Fri May 29 01:49:27 2009	(r193011)
@@ -265,7 +265,7 @@ __sx_sunlock(struct sx *sx, const char *
 #define	SX_NOPROFILE		0x02
 #define	SX_NOWITNESS		0x04
 #define	SX_QUIET		0x08
-#define	SX_ADAPTIVESPIN		0x10
+#define	SX_NOADAPTIVE		0x10
 #define	SX_RECURSE		0x20
 
 /*

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 05:37:28 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 90C7B1065675;
	Fri, 29 May 2009 05:37:28 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7F1DB8FC21;
	Fri, 29 May 2009 05:37:28 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4T5bSD8060802;
	Fri, 29 May 2009 05:37:28 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4T5bSD7060800;
	Fri, 29 May 2009 05:37:28 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200905290537.n4T5bSD7060800@svn.freebsd.org>
From: Xin LI 
Date: Fri, 29 May 2009 05:37:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193012 - head/sys/compat/svr4
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 05:37:29 -0000

Author: delphij
Date: Fri May 29 05:37:27 2009
New Revision: 193012
URL: http://svn.freebsd.org/changeset/base/193012

Log:
  Add new sysconfig bits, Fix the bogus numbering of the old bits.
  
  Submitted by:	"Pedro f. Giffuni" 
  Obtained from:	NetBSD
  PR:		kern/91293

Modified:
  head/sys/compat/svr4/svr4_misc.c
  head/sys/compat/svr4/svr4_sysconfig.h

Modified: head/sys/compat/svr4/svr4_misc.c
==============================================================================
--- head/sys/compat/svr4/svr4_misc.c	Fri May 29 01:49:27 2009	(r193011)
+++ head/sys/compat/svr4/svr4_misc.c	Fri May 29 05:37:27 2009	(r193012)
@@ -706,9 +706,6 @@ svr4_sys_sysconfig(td, uap)
 	retval = &(td->td_retval[0]);
 
 	switch (uap->name) {
-	case SVR4_CONFIG_UNUSED:
-		*retval = 0;
-		break;
 	case SVR4_CONFIG_NGROUPS:
 		*retval = NGROUPS_MAX;
 		break;
@@ -788,7 +785,45 @@ svr4_sys_sysconfig(td, uap)
 #endif
 		break;
 #endif /* NOTYET */
-
+	case SVR4_CONFIG_COHERENCY:
+		*retval = 0;	/* XXX */
+		break;
+	case SVR4_CONFIG_SPLIT_CACHE:
+		*retval = 0;	/* XXX */
+		break;
+	case SVR4_CONFIG_ICACHESZ:
+		*retval = 256;	/* XXX */
+		break;
+	case SVR4_CONFIG_DCACHESZ:
+		*retval = 256;	/* XXX */
+		break;
+	case SVR4_CONFIG_ICACHELINESZ:
+		*retval = 64;	/* XXX */
+		break;
+	case SVR4_CONFIG_DCACHELINESZ:
+		*retval = 64;	/* XXX */
+		break;
+	case SVR4_CONFIG_ICACHEBLKSZ:
+		*retval = 64;	/* XXX */
+		break;
+	case SVR4_CONFIG_DCACHEBLKSZ:
+		*retval = 64;	/* XXX */
+		break;
+	case SVR4_CONFIG_DCACHETBLKSZ:
+		*retval = 64;	/* XXX */
+		break;
+	case SVR4_CONFIG_ICACHE_ASSOC:
+		*retval = 1;	/* XXX */
+		break;
+	case SVR4_CONFIG_DCACHE_ASSOC:
+		*retval = 1;	/* XXX */
+		break;
+	case SVR4_CONFIG_MAXPID:
+		*retval = PID_MAX;
+		break;
+	case SVR4_CONFIG_STACK_PROT:
+		*retval = PROT_READ|PROT_WRITE|PROT_EXEC;
+		break;
 	default:
 		return EINVAL;
 	}

Modified: head/sys/compat/svr4/svr4_sysconfig.h
==============================================================================
--- head/sys/compat/svr4/svr4_sysconfig.h	Fri May 29 01:49:27 2009	(r193011)
+++ head/sys/compat/svr4/svr4_sysconfig.h	Fri May 29 05:37:27 2009	(r193012)
@@ -31,7 +31,7 @@
 #ifndef	_SVR4_SYSCONFIG_H_
 #define	_SVR4_SYSCONFIG_H_
 
-#define SVR4_CONFIG_UNUSED		0x01
+#define SVR4_CONFIG_UNUSED_1		0x01
 #define SVR4_CONFIG_NGROUPS		0x02
 #define SVR4_CONFIG_CHILD_MAX		0x03
 #define SVR4_CONFIG_OPEN_FILES		0x04
@@ -43,20 +43,36 @@
 #define SVR4_CONFIG_PROF_TCK		0x0a
 #define SVR4_CONFIG_NPROC_CONF		0x0b
 #define	SVR4_CONFIG_NPROC_ONLN		0x0c
-#define	SVR4_CONFIG_AIO_LISTIO_MAX	0x0e
-#define	SVR4_CONFIG_AIO_MAX		0x0f
-#define	SVR4_CONFIG_AIO_PRIO_DELTA_MAX	0x10
-#define	SVR4_CONFIG_DELAYTIMER_MAX	0x11
-#define	SVR4_CONFIG_MQ_OPEN_MAX		0x12
-#define	SVR4_CONFIG_MQ_PRIO_MAX		0x13
-#define	SVR4_CONFIG_RTSIG_MAX		0x14
-#define	SVR4_CONFIG_SEM_NSEMS_MAX	0x15
-#define	SVR4_CONFIG_SEM_VALUE_MAX	0x16
-#define	SVR4_CONFIG_SIGQUEUE_MAX	0x17
-#define	SVR4_CONFIG_SIGRT_MIN		0x18
-#define	SVR4_CONFIG_SIGRT_MAX		0x19
-#define	SVR4_CONFIG_TIMER_MAX		0x20
-#define	SVR4_CONFIG_PHYS_PAGES		0x21
-#define	SVR4_CONFIG_AVPHYS_PAGES	0x22
+#define	SVR4_CONFIG_AIO_LISTIO_MAX	0x0d
+#define	SVR4_CONFIG_AIO_MAX		0x0e
+#define	SVR4_CONFIG_AIO_PRIO_DELTA_MAX	0x0f
+#define	SVR4_CONFIG_DELAYTIMER_MAX	0x10
+#define	SVR4_CONFIG_MQ_OPEN_MAX		0x11
+#define	SVR4_CONFIG_MQ_PRIO_MAX		0x12
+#define	SVR4_CONFIG_RTSIG_MAX		0x13
+#define	SVR4_CONFIG_SEM_NSEMS_MAX	0x14
+#define	SVR4_CONFIG_SEM_VALUE_MAX	0x15
+#define	SVR4_CONFIG_SIGQUEUE_MAX	0x16
+#define	SVR4_CONFIG_SIGRT_MIN		0x17
+#define	SVR4_CONFIG_SIGRT_MAX		0x18
+#define	SVR4_CONFIG_TIMER_MAX		0x19
+#define	SVR4_CONFIG_PHYS_PAGES		0x1a
+#define	SVR4_CONFIG_AVPHYS_PAGES	0x1b
+#define	SVR4_CONFIG_COHERENCY		0x1c
+#define	SVR4_CONFIG_SPLIT_CACHE		0x1d
+#define	SVR4_CONFIG_ICACHESZ		0x1e
+#define	SVR4_CONFIG_DCACHESZ		0x1f
+#define	SVR4_CONFIG_ICACHELINESZ	0x20
+#define	SVR4_CONFIG_DCACHELINESZ	0x21
+#define	SVR4_CONFIG_ICACHEBLKSZ		0x22
+#define	SVR4_CONFIG_DCACHEBLKSZ		0x23
+#define	SVR4_CONFIG_DCACHETBLKSZ	0x24
+#define	SVR4_CONFIG_ICACHE_ASSOC	0x25
+#define	SVR4_CONFIG_DCACHE_ASSOC	0x26
+#define	SVR4_CONFIG_UNUSED_2		0x27
+#define	SVR4_CONFIG_UNUSED_3		0x28
+#define	SVR4_CONFIG_UNUSED_4		0x29
+#define	SVR4_CONFIG_MAXPID		0x2a
+#define	SVR4_CONFIG_STACK_PROT		0x2b
 
 #endif /* !_SVR4_SYSCONFIG_H_ */

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 05:51:20 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 19783106566B;
	Fri, 29 May 2009 05:51:20 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 07FD78FC0A;
	Fri, 29 May 2009 05:51:20 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4T5pJYN061121;
	Fri, 29 May 2009 05:51:19 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4T5pJkH061120;
	Fri, 29 May 2009 05:51:19 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200905290551.n4T5pJkH061120@svn.freebsd.org>
From: Xin LI 
Date: Fri, 29 May 2009 05:51:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193013 - head/sys/compat/svr4
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 05:51:20 -0000

Author: delphij
Date: Fri May 29 05:51:19 2009
New Revision: 193013
URL: http://svn.freebsd.org/changeset/base/193013

Log:
  svr4_sys_getdents64() should not assume that the cookie would exist
  everywhere.
  
  PR:		kern/91293
  Submitted by:	"Pedro f. Giffuni" 
  Obtained from:	NetBSD

Modified:
  head/sys/compat/svr4/svr4_misc.c

Modified: head/sys/compat/svr4/svr4_misc.c
==============================================================================
--- head/sys/compat/svr4/svr4_misc.c	Fri May 29 05:37:27 2009	(r193012)
+++ head/sys/compat/svr4/svr4_misc.c	Fri May 29 05:51:19 2009	(r193013)
@@ -487,7 +487,10 @@ again:
 		reclen = bdp->d_reclen;
 		if (reclen & 3)
 			panic("svr4_sys_getdents64: bad reclen");
-		off = *cookie++;	/* each entry points to the next */
+		if (cookie)
+			off = *cookie++; /* each entry points to the next */
+		else
+			off += reclen;
 		if ((off >> 32) != 0) {
 			uprintf("svr4_sys_getdents64: dir offset too large for emulated program");
 			error = EINVAL;

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 05:58:47 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8E89D1065670;
	Fri, 29 May 2009 05:58:47 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7B4378FC27;
	Fri, 29 May 2009 05:58:47 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4T5wlUm061303;
	Fri, 29 May 2009 05:58:47 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4T5wle2061296;
	Fri, 29 May 2009 05:58:47 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200905290558.n4T5wle2061296@svn.freebsd.org>
From: Xin LI 
Date: Fri, 29 May 2009 05:58:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193014 - head/sys/compat/svr4
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 05:58:48 -0000

Author: delphij
Date: Fri May 29 05:58:46 2009
New Revision: 193014
URL: http://svn.freebsd.org/changeset/base/193014

Log:
  de-register.
  
  Submitted by:	"Pedro f. Giffuni" 
  Obtained from:	NetBSD
  PR:		kern/91293

Modified:
  head/sys/compat/svr4/svr4_fcntl.c
  head/sys/compat/svr4/svr4_ioctl.c
  head/sys/compat/svr4/svr4_misc.c
  head/sys/compat/svr4/svr4_resource.c
  head/sys/compat/svr4/svr4_signal.c
  head/sys/compat/svr4/svr4_stat.c
  head/sys/compat/svr4/svr4_stream.c

Modified: head/sys/compat/svr4/svr4_fcntl.c
==============================================================================
--- head/sys/compat/svr4/svr4_fcntl.c	Fri May 29 05:51:19 2009	(r193013)
+++ head/sys/compat/svr4/svr4_fcntl.c	Fri May 29 05:58:46 2009	(r193014)
@@ -367,7 +367,7 @@ fd_truncate(td, fd, flp)
 
 int
 svr4_sys_open(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_open_args *uap;
 {
 	struct proc *p = td->td_proc;
@@ -419,7 +419,7 @@ svr4_sys_open(td, uap)
 
 int
 svr4_sys_open64(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_open64_args *uap;
 {
 	return svr4_sys_open(td, (struct svr4_sys_open_args *)uap);
@@ -427,7 +427,7 @@ svr4_sys_open64(td, uap)
 
 int
 svr4_sys_creat(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_creat_args *uap;
 {
 	char *newpath;
@@ -443,7 +443,7 @@ svr4_sys_creat(td, uap)
 
 int
 svr4_sys_creat64(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_creat64_args *uap;
 {
 	return svr4_sys_creat(td, (struct svr4_sys_creat_args *)uap);
@@ -451,7 +451,7 @@ svr4_sys_creat64(td, uap)
 
 int
 svr4_sys_llseek(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_llseek_args *uap;
 {
 	struct lseek_args ap;
@@ -472,7 +472,7 @@ svr4_sys_llseek(td, uap)
 
 int
 svr4_sys_access(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_access_args *uap;
 {
 	char *newpath;
@@ -487,7 +487,7 @@ svr4_sys_access(td, uap)
 #if defined(NOTYET)
 int
 svr4_sys_pread(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_pread_args *uap;
 {
 	struct pread_args pra;
@@ -508,7 +508,7 @@ svr4_sys_pread(td, uap)
 #if defined(NOTYET)
 int
 svr4_sys_pread64(td, v, retval)
-	register struct thread *td;
+	struct thread *td;
 	void *v; 
 	register_t *retval;
 {
@@ -532,7 +532,7 @@ svr4_sys_pread64(td, v, retval)
 #if defined(NOTYET)
 int
 svr4_sys_pwrite(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_pwrite_args *uap;
 {
 	struct pwrite_args pwa;
@@ -553,7 +553,7 @@ svr4_sys_pwrite(td, uap)
 #if defined(NOTYET)
 int
 svr4_sys_pwrite64(td, v, retval)
-	register struct thread *td;
+	struct thread *td;
 	void *v; 
 	register_t *retval;
 {
@@ -575,7 +575,7 @@ svr4_sys_pwrite64(td, v, retval)
 
 int
 svr4_sys_fcntl(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_fcntl_args *uap;
 {
 	int cmd, error, *retval;

Modified: head/sys/compat/svr4/svr4_ioctl.c
==============================================================================
--- head/sys/compat/svr4/svr4_ioctl.c	Fri May 29 05:51:19 2009	(r193013)
+++ head/sys/compat/svr4/svr4_ioctl.c	Fri May 29 05:58:46 2009	(r193014)
@@ -79,7 +79,7 @@ svr4_decode_cmd(cmd, dir, c, num, argsiz
 
 int
 svr4_sys_ioctl(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_ioctl_args *uap;
 {
 	int             *retval;

Modified: head/sys/compat/svr4/svr4_misc.c
==============================================================================
--- head/sys/compat/svr4/svr4_misc.c	Fri May 29 05:51:19 2009	(r193013)
+++ head/sys/compat/svr4/svr4_misc.c	Fri May 29 05:58:46 2009	(r193014)
@@ -121,7 +121,7 @@ static struct proc *svr4_pfind(pid_t pid
 #if defined(BOGUS)
 int
 svr4_sys_setitimer(td, uap)
-        register struct thread *td;
+        struct thread *td;
 	struct svr4_sys_setitimer_args *uap;
 {
         td->td_retval[0] = 0;
@@ -231,7 +231,7 @@ svr4_sys_getdents64(td, uap)
 	struct thread *td;
 	struct svr4_sys_getdents64_args *uap;
 {
-	register struct dirent *bdp;
+	struct dirent *bdp;
 	struct vnode *vp;
 	caddr_t inp, buf;		/* BSD-format */
 	int len, reclen;		/* BSD-format */
@@ -668,7 +668,7 @@ svr4_mknod(td, retval, path, mode, dev)
 
 int
 svr4_sys_mknod(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_mknod_args *uap;
 {
         int *retval = td->td_retval;

Modified: head/sys/compat/svr4/svr4_resource.c
==============================================================================
--- head/sys/compat/svr4/svr4_resource.c	Fri May 29 05:51:19 2009	(r193013)
+++ head/sys/compat/svr4/svr4_resource.c	Fri May 29 05:58:46 2009	(r193014)
@@ -127,7 +127,7 @@ svr4_to_native_rl(rl)
 
 int
 svr4_sys_getrlimit(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_getrlimit_args *uap;
 {
 	int rl = svr4_to_native_rl(uap->which);
@@ -174,7 +174,7 @@ svr4_sys_getrlimit(td, uap)
 
 int
 svr4_sys_setrlimit(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_setrlimit_args *uap;
 {
 	int rl = svr4_to_native_rl(uap->which);
@@ -225,7 +225,7 @@ svr4_sys_setrlimit(td, uap)
 
 int
 svr4_sys_getrlimit64(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_getrlimit64_args *uap;
 {
 	int rl = svr4_to_native_rl(uap->which);
@@ -272,7 +272,7 @@ svr4_sys_getrlimit64(td, uap)
 
 int
 svr4_sys_setrlimit64(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_setrlimit64_args *uap;
 {
 	int rl = svr4_to_native_rl(uap->which);

Modified: head/sys/compat/svr4/svr4_signal.c
==============================================================================
--- head/sys/compat/svr4/svr4_signal.c	Fri May 29 05:51:19 2009	(r193013)
+++ head/sys/compat/svr4/svr4_signal.c	Fri May 29 05:58:46 2009	(r193014)
@@ -259,7 +259,7 @@ bsd_to_svr4_sigaltstack(bss, sss)
 
 int
 svr4_sys_sigaction(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_sigaction_args *uap;
 {
 	struct svr4_sigaction isa;
@@ -301,7 +301,7 @@ svr4_sys_sigaction(td, uap)
 
 int 
 svr4_sys_sigaltstack(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_sigaltstack_args *uap;
 {
 	struct svr4_sigaltstack sss;
@@ -328,7 +328,7 @@ svr4_sys_sigaltstack(td, uap)
  */
 int
 svr4_sys_signal(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_signal_args *uap;
 {
 	struct proc *p;
@@ -493,7 +493,7 @@ svr4_sys_sigpending(td, uap)
 
 int
 svr4_sys_sigsuspend(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_sigsuspend_args *uap;
 {
 	svr4_sigset_t sss;
@@ -510,7 +510,7 @@ svr4_sys_sigsuspend(td, uap)
 
 int
 svr4_sys_kill(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_kill_args *uap;
 {
 	struct kill_args ka;
@@ -525,7 +525,7 @@ svr4_sys_kill(td, uap)
 
 int 
 svr4_sys_context(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_context_args *uap;
 {
 	struct svr4_ucontext uc;
@@ -565,7 +565,7 @@ svr4_sys_context(td, uap)
 
 int
 svr4_sys_pause(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_pause_args *uap;
 {
 	sigset_t mask;

Modified: head/sys/compat/svr4/svr4_stat.c
==============================================================================
--- head/sys/compat/svr4/svr4_stat.c	Fri May 29 05:51:19 2009	(r193013)
+++ head/sys/compat/svr4/svr4_stat.c	Fri May 29 05:58:46 2009	(r193014)
@@ -185,7 +185,7 @@ svr4_sys_stat(td, uap)
 
 int
 svr4_sys_lstat(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_lstat_args *uap;
 {
 	struct svr4_stat svr4_st;
@@ -210,7 +210,7 @@ svr4_sys_lstat(td, uap)
 
 int
 svr4_sys_fstat(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_fstat_args *uap;
 {
 	struct svr4_stat svr4_st;
@@ -228,7 +228,7 @@ svr4_sys_fstat(td, uap)
 
 int
 svr4_sys_xstat(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_xstat_args *uap;
 {
 	struct svr4_xstat svr4_st;
@@ -255,7 +255,7 @@ svr4_sys_xstat(td, uap)
 
 int
 svr4_sys_lxstat(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_lxstat_args *uap;
 {
 	struct svr4_xstat svr4_st;
@@ -282,7 +282,7 @@ svr4_sys_lxstat(td, uap)
 
 int
 svr4_sys_fxstat(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_fxstat_args *uap;
 {
 	struct svr4_xstat svr4_st;
@@ -299,7 +299,7 @@ svr4_sys_fxstat(td, uap)
 
 int
 svr4_sys_stat64(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_stat64_args *uap;
 {
 	struct svr4_stat64 svr4_st;
@@ -325,7 +325,7 @@ svr4_sys_stat64(td, uap)
 
 int
 svr4_sys_lstat64(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_lstat64_args *uap;
 {
 	struct svr4_stat64 svr4_st;
@@ -351,7 +351,7 @@ svr4_sys_lstat64(td, uap)
 
 int
 svr4_sys_fstat64(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_fstat64_args *uap;
 {
 	struct svr4_stat64 svr4_st;
@@ -368,7 +368,7 @@ svr4_sys_fstat64(td, uap)
 
 int
 svr4_ustat(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_ustat_args *uap;
 {
 	struct svr4_ustat	us;
@@ -390,7 +390,7 @@ svr4_ustat(td, uap)
 
 int
 svr4_sys_uname(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_uname_args *uap;
 {
 	struct svr4_utsname	sut;
@@ -517,7 +517,7 @@ svr4_sys_systeminfo(td, uap)
 
 int
 svr4_sys_utssys(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_utssys_args *uap;
 {
 	switch (uap->sel) {
@@ -548,7 +548,7 @@ svr4_sys_utssys(td, uap)
 
 int
 svr4_sys_utime(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_utime_args *uap;
 {
 	struct svr4_utimbuf ub;
@@ -577,7 +577,7 @@ svr4_sys_utime(td, uap)
 
 int
 svr4_sys_utimes(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_utimes_args *uap;
 {
 	char *path;
@@ -640,7 +640,7 @@ svr4_to_bsd_pathconf(name)
 
 int
 svr4_sys_pathconf(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_pathconf_args *uap;
 {
 	char *path;
@@ -666,7 +666,7 @@ svr4_sys_pathconf(td, uap)
 
 int
 svr4_sys_fpathconf(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_fpathconf_args *uap;
 {
         register_t	*retval = td->td_retval;

Modified: head/sys/compat/svr4/svr4_stream.c
==============================================================================
--- head/sys/compat/svr4/svr4_stream.c	Fri May 29 05:51:19 2009	(r193013)
+++ head/sys/compat/svr4/svr4_stream.c	Fri May 29 05:58:46 2009	(r193014)
@@ -1442,7 +1442,7 @@ svr4_stream_ioctl(fp, td, retval, fd, cm
 
 int
 svr4_sys_putmsg(td, uap)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_putmsg_args *uap;
 {
 	struct file     *fp;
@@ -1633,7 +1633,7 @@ svr4_sys_getmsg(td, uap)
 
 int
 svr4_do_getmsg(td, uap, fp)
-	register struct thread *td;
+	struct thread *td;
 	struct svr4_sys_getmsg_args *uap;
 	struct file *fp;
 {

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 06:04:26 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9C3B1106564A;
	Fri, 29 May 2009 06:04:26 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8AE9C8FC1A;
	Fri, 29 May 2009 06:04:26 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4T64Qau061464;
	Fri, 29 May 2009 06:04:26 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4T64QLb061463;
	Fri, 29 May 2009 06:04:26 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200905290604.n4T64QLb061463@svn.freebsd.org>
From: Xin LI 
Date: Fri, 29 May 2009 06:04:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193015 - head/sys/compat/svr4
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 06:04:27 -0000

Author: delphij
Date: Fri May 29 06:04:26 2009
New Revision: 193015
URL: http://svn.freebsd.org/changeset/base/193015

Log:
  copyinstr(9) takes parameter 'len' as a size_t *, not int *.
  
  PR:		kern/91293
  Submitted by:	"Pedro f. Giffuni" 
  Obtained from:	NetBSD

Modified:
  head/sys/compat/svr4/svr4_socket.c

Modified: head/sys/compat/svr4/svr4_socket.c
==============================================================================
--- head/sys/compat/svr4/svr4_socket.c	Fri May 29 05:58:46 2009	(r193014)
+++ head/sys/compat/svr4/svr4_socket.c	Fri May 29 06:04:26 2009	(r193015)
@@ -120,7 +120,8 @@ svr4_add_socket(td, path, st)
 	struct stat *st;
 {
 	struct svr4_sockcache_entry *e;
-	int len, error;
+	size_t len;
+	int error;
 
 	e = malloc(sizeof(*e), M_TEMP, M_WAITOK);
 	e->cookie = NULL;

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 06:19:37 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DC572106566B;
	Fri, 29 May 2009 06:19:37 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CAE5D8FC13;
	Fri, 29 May 2009 06:19:37 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4T6Jbug061754;
	Fri, 29 May 2009 06:19:37 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4T6JbIg061753;
	Fri, 29 May 2009 06:19:37 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200905290619.n4T6JbIg061753@svn.freebsd.org>
From: Xin LI 
Date: Fri, 29 May 2009 06:19:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193016 - head/sys/compat/svr4
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 06:19:38 -0000

Author: delphij
Date: Fri May 29 06:19:37 2009
New Revision: 193016
URL: http://svn.freebsd.org/changeset/base/193016

Log:
  Fix the sysinfo(SI_HW_SERIAL, emulation so that we actually get the
  hostid of the machine rather than always getting "0".
  
  PR:		kern/91293
  Submitted by:	"Pedro f. Giffuni" 
  Obtained from:	NetBSD

Modified:
  head/sys/compat/svr4/svr4_stat.c

Modified: head/sys/compat/svr4/svr4_stat.c
==============================================================================
--- head/sys/compat/svr4/svr4_stat.c	Fri May 29 06:04:26 2009	(r193015)
+++ head/sys/compat/svr4/svr4_stat.c	Fri May 29 06:19:37 2009	(r193016)
@@ -417,9 +417,10 @@ svr4_sys_systeminfo(td, uap)
 	int		error = 0;
 	register_t	*retval = td->td_retval;
 	size_t		len = 0;
-	char		buf[1];   /* XXX NetBSD uses 256, but that seems
-				     like awfully excessive kstack usage
-				     for an empty string... */
+	char		buf[11];   /* XXX NetBSD uses 256, but we use 11
+				     here as that seems like awfully
+				     excessive kstack usage for hostid
+				     string... */
 	u_int		rlen = uap->len;
 
 	switch (uap->what) {
@@ -448,7 +449,8 @@ svr4_sys_systeminfo(td, uap)
 		break;
 
 	case SVR4_SI_HW_SERIAL:
-		str = "0";
+		snprintf(buf, sizeof(buf), "%lu", hostid);
+		str = buf;
 		break;
 
 	case SVR4_SI_HW_PROVIDER:

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 06:27:30 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D3357106566B;
	Fri, 29 May 2009 06:27:30 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C20148FC17;
	Fri, 29 May 2009 06:27:30 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4T6RU5x061943;
	Fri, 29 May 2009 06:27:30 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4T6RUjd061942;
	Fri, 29 May 2009 06:27:30 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200905290627.n4T6RUjd061942@svn.freebsd.org>
From: Xin LI 
Date: Fri, 29 May 2009 06:27:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193017 - head/sys/compat/svr4
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 06:27:31 -0000

Author: delphij
Date: Fri May 29 06:27:30 2009
New Revision: 193017
URL: http://svn.freebsd.org/changeset/base/193017

Log:
  Implement SI_ISALIST.
  
  PR:		kern/91293
  Submitted by:	"Pedro f. Giffuni" 
  Obtained from:	NetBSD

Modified:
  head/sys/compat/svr4/svr4_stat.c

Modified: head/sys/compat/svr4/svr4_stat.c
==============================================================================
--- head/sys/compat/svr4/svr4_stat.c	Fri May 29 06:19:37 2009	(r193016)
+++ head/sys/compat/svr4/svr4_stat.c	Fri May 29 06:27:30 2009	(r193017)
@@ -448,6 +448,18 @@ svr4_sys_systeminfo(td, uap)
 		str = machine;
 		break;
 
+	case SVR4_SI_ISALIST:
+#if defined(__sparc__)
+		str = "sparcv9 sparcv9-fsmuld sparcv8 sparcv8-fsmuld sparcv7 sparc";
+#elif defined(__i386__)
+		str = "i386";
+#elif defined(__amd64__)
+		str = "amd64";
+#else
+		str = "unknown";
+#endif
+		break;
+
 	case SVR4_SI_HW_SERIAL:
 		snprintf(buf, sizeof(buf), "%lu", hostid);
 		str = buf;
@@ -463,7 +475,7 @@ svr4_sys_systeminfo(td, uap)
 		break;
 
 	case SVR4_SI_PLATFORM:
-#ifdef __i386__
+#if defined(__i386__)
 		str = "i86pc";
 #else
 		str = "unknown";

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 06:41:24 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C599E106566B;
	Fri, 29 May 2009 06:41:24 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B080E8FC1D;
	Fri, 29 May 2009 06:41:24 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4T6fOtd062261;
	Fri, 29 May 2009 06:41:24 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4T6fOnb062243;
	Fri, 29 May 2009 06:41:24 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200905290641.n4T6fOnb062243@svn.freebsd.org>
From: Ed Schouten 
Date: Fri, 29 May 2009 06:41:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193018 - in head/sys: dev/cfe dev/dcons dev/nmdm
	dev/ofw dev/rp dev/si dev/syscons dev/uart dev/usb/serial
	dev/xen/console ia64/ia64 kern sun4v/sun4v sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 06:41:25 -0000

Author: ed
Date: Fri May 29 06:41:23 2009
New Revision: 193018
URL: http://svn.freebsd.org/changeset/base/193018

Log:
  Last minute TTY API change: remove mutex argument from tty_alloc().
  
  I don't want people to override the mutex when allocating a TTY. It has
  to be there, to keep drivers like syscons happy. So I'm creating a
  tty_alloc_mutex() which can be used in those cases. tty_alloc_mutex()
  should eventually be removed.
  
  The advantage of this approach, is that we can just remove a function,
  without breaking the regular API in the future.

Modified:
  head/sys/dev/cfe/cfe_console.c
  head/sys/dev/dcons/dcons_os.c
  head/sys/dev/nmdm/nmdm.c
  head/sys/dev/ofw/ofw_console.c
  head/sys/dev/rp/rp.c
  head/sys/dev/si/si.c
  head/sys/dev/syscons/syscons.c
  head/sys/dev/syscons/sysmouse.c
  head/sys/dev/uart/uart_tty.c
  head/sys/dev/usb/serial/usb_serial.c
  head/sys/dev/xen/console/console.c
  head/sys/ia64/ia64/ssc.c
  head/sys/kern/tty.c
  head/sys/kern/tty_pts.c
  head/sys/sun4v/sun4v/hvcons.c
  head/sys/sys/tty.h

Modified: head/sys/dev/cfe/cfe_console.c
==============================================================================
--- head/sys/dev/cfe/cfe_console.c	Fri May 29 06:27:30 2009	(r193017)
+++ head/sys/dev/cfe/cfe_console.c	Fri May 29 06:41:23 2009	(r193018)
@@ -89,7 +89,7 @@ cn_drvinit(void *unused)
 
 	if (cfe_consdev.cn_pri != CN_DEAD &&
 	    cfe_consdev.cn_name[0] != '\0') {
-		tp = tty_alloc(&cfe_ttydevsw, NULL, NULL);
+		tp = tty_alloc(&cfe_ttydevsw, NULL);
 		tty_makedev(tp, NULL, "%s", output);
 		tty_makealias(tp, "cfecons");
 	}

Modified: head/sys/dev/dcons/dcons_os.c
==============================================================================
--- head/sys/dev/dcons/dcons_os.c	Fri May 29 06:27:30 2009	(r193017)
+++ head/sys/dev/dcons/dcons_os.c	Fri May 29 06:41:23 2009	(r193018)
@@ -357,7 +357,7 @@ dcons_attach_port(int port, char *name, 
 	struct tty *tp;
 
 	dc = &sc[port];
-	tp = tty_alloc(&dcons_ttydevsw, dc, NULL);
+	tp = tty_alloc(&dcons_ttydevsw, dc);
 	dc->flags = flags;
 	dc->tty   = tp;
 	tty_init_console(tp, 0);

Modified: head/sys/dev/nmdm/nmdm.c
==============================================================================
--- head/sys/dev/nmdm/nmdm.c	Fri May 29 06:27:30 2009	(r193017)
+++ head/sys/dev/nmdm/nmdm.c	Fri May 29 06:41:23 2009	(r193018)
@@ -117,11 +117,11 @@ nmdm_alloc(unsigned long unit)
 	callout_init(&ns->ns_part2.np_callout, CALLOUT_MPSAFE);
 
 	/* Create device nodes. */
-	tp = ns->ns_part1.np_tty = tty_alloc(&nmdm_class, &ns->ns_part1,
+	tp = ns->ns_part1.np_tty = tty_alloc_mutex(&nmdm_class, &ns->ns_part1,
 	    &ns->ns_mtx);
 	tty_makedev(tp, NULL, "nmdm%luA", unit);
 
-	tp = ns->ns_part2.np_tty = tty_alloc(&nmdm_class, &ns->ns_part2,
+	tp = ns->ns_part2.np_tty = tty_alloc_mutex(&nmdm_class, &ns->ns_part2,
 	    &ns->ns_mtx);
 	tty_makedev(tp, NULL, "nmdm%luB", unit);
 

Modified: head/sys/dev/ofw/ofw_console.c
==============================================================================
--- head/sys/dev/ofw/ofw_console.c	Fri May 29 06:27:30 2009	(r193017)
+++ head/sys/dev/ofw/ofw_console.c	Fri May 29 06:41:23 2009	(r193018)
@@ -95,7 +95,7 @@ cn_drvinit(void *unused)
 		 * XXX: This is a hack and it may result in two /dev/ttya
 		 * XXX: devices on platforms where the sab driver works.
 		 */
-		tp = tty_alloc(&ofw_ttydevsw, NULL, NULL);
+		tp = tty_alloc(&ofw_ttydevsw, NULL);
 		tty_makedev(tp, NULL, "%s", output);
 		tty_makealias(tp, "ofwcons");
 	}

Modified: head/sys/dev/rp/rp.c
==============================================================================
--- head/sys/dev/rp/rp.c	Fri May 29 06:27:30 2009	(r193017)
+++ head/sys/dev/rp/rp.c	Fri May 29 06:41:23 2009	(r193018)
@@ -774,7 +774,7 @@ rp_attachcommon(CONTROLLER_T *ctlp, int 
 	for(aiop=0; aiop < num_aiops; aiop++) {
 		num_chan = sGetAiopNumChan(ctlp, aiop);
 		for(chan=0; chan < num_chan; chan++, port++, rp++) {
-			rp->rp_tty = tp = tty_alloc(&rp_tty_class, rp, NULL);
+			rp->rp_tty = tp = tty_alloc(&rp_tty_class, rp);
 			rp->rp_port = port;
 			rp->rp_ctlp = ctlp;
 			rp->rp_unit = unit;

Modified: head/sys/dev/si/si.c
==============================================================================
--- head/sys/dev/si/si.c	Fri May 29 06:27:30 2009	(r193017)
+++ head/sys/dev/si/si.c	Fri May 29 06:41:23 2009	(r193018)
@@ -584,7 +584,7 @@ try_next:
 			sprintf(pp->sp_name, "si%r%r", unit,
 			    (int)(pp - sc->sc_ports));
 #endif
-			tp = pp->sp_tty = tty_alloc(&si_tty_class, pp, &Giant);
+			tp = pp->sp_tty = tty_alloc_mutex(&si_tty_class, pp, &Giant);
 			tty_makedev(tp, NULL, "A%r%r", unit, (int)(pp - sc->sc_ports));
 		}
 try_next2:

Modified: head/sys/dev/syscons/syscons.c
==============================================================================
--- head/sys/dev/syscons/syscons.c	Fri May 29 06:27:30 2009	(r193017)
+++ head/sys/dev/syscons/syscons.c	Fri May 29 06:41:23 2009	(r193018)
@@ -334,7 +334,7 @@ sc_alloc_tty(int index, int devnum)
 	stc = malloc(sizeof(struct sc_ttysoftc), M_DEVBUF, M_WAITOK);
 	stc->st_index = index;
 	stc->st_stat = NULL;
-	tp = tty_alloc(&sc_ttydevsw, stc, &Giant);
+	tp = tty_alloc_mutex(&sc_ttydevsw, stc, &Giant);
 
 	/* Create device node. */
 	tty_makedev(tp, NULL, "v%r", devnum);

Modified: head/sys/dev/syscons/sysmouse.c
==============================================================================
--- head/sys/dev/syscons/sysmouse.c	Fri May 29 06:27:30 2009	(r193017)
+++ head/sys/dev/syscons/sysmouse.c	Fri May 29 06:41:23 2009	(r193018)
@@ -164,7 +164,7 @@ static struct ttydevsw smdev_ttydevsw = 
 static void
 sm_attach_mouse(void *unused)
 {
-	sysmouse_tty = tty_alloc(&smdev_ttydevsw, NULL, NULL);
+	sysmouse_tty = tty_alloc(&smdev_ttydevsw, NULL);
 	tty_makedev(sysmouse_tty, NULL, "sysmouse");
 }
 

Modified: head/sys/dev/uart/uart_tty.c
==============================================================================
--- head/sys/dev/uart/uart_tty.c	Fri May 29 06:27:30 2009	(r193017)
+++ head/sys/dev/uart/uart_tty.c	Fri May 29 06:41:23 2009	(r193018)
@@ -356,7 +356,7 @@ uart_tty_attach(struct uart_softc *sc)
 	struct tty *tp;
 	int unit;
 
-	sc->sc_u.u_tty.tp = tp = tty_alloc(&uart_tty_class, sc, NULL);
+	sc->sc_u.u_tty.tp = tp = tty_alloc(&uart_tty_class, sc);
 
 	unit = device_get_unit(sc->sc_dev);
 

Modified: head/sys/dev/usb/serial/usb_serial.c
==============================================================================
--- head/sys/dev/usb/serial/usb_serial.c	Fri May 29 06:27:30 2009	(r193017)
+++ head/sys/dev/usb/serial/usb_serial.c	Fri May 29 06:41:23 2009	(r193018)
@@ -293,7 +293,7 @@ usb2_com_attach_tty(struct ucom_softc *s
 	int error = 0;
 	char buf[32];			/* temporary TTY device name buffer */
 
-	tp = tty_alloc(&usb2_com_class, sc, sc->sc_mtx);
+	tp = tty_alloc_mutex(&usb2_com_class, sc, sc->sc_mtx);
 	if (tp == NULL) {
 		error = ENOMEM;
 		goto done;

Modified: head/sys/dev/xen/console/console.c
==============================================================================
--- head/sys/dev/xen/console/console.c	Fri May 29 06:27:30 2009	(r193017)
+++ head/sys/dev/xen/console/console.c	Fri May 29 06:41:23 2009	(r193018)
@@ -230,7 +230,7 @@ xc_attach(device_t dev) 
 		xc_consdev.cn_putc = xccnputc_dom0;
 	} 
 
-	xccons = tty_alloc(&xc_ttydevsw, NULL, NULL);
+	xccons = tty_alloc(&xc_ttydevsw, NULL);
 	tty_makedev(xccons, NULL, "xc%r", 0);
 
 	callout_init(&xc_callout, 0);

Modified: head/sys/ia64/ia64/ssc.c
==============================================================================
--- head/sys/ia64/ia64/ssc.c	Fri May 29 06:27:30 2009	(r193017)
+++ head/sys/ia64/ia64/ssc.c	Fri May 29 06:41:23 2009	(r193018)
@@ -106,7 +106,7 @@ ssc_cnattach(void *arg)
 {
 	struct tty *tp;
 
-	tp = tty_alloc(&ssc_class, NULL, NULL);
+	tp = tty_alloc(&ssc_class, NULL);
 	tty_makedev(tp, NULL, "ssccons");
 }
 

Modified: head/sys/kern/tty.c
==============================================================================
--- head/sys/kern/tty.c	Fri May 29 06:27:30 2009	(r193017)
+++ head/sys/kern/tty.c	Fri May 29 06:41:23 2009	(r193018)
@@ -885,7 +885,14 @@ ttydevsw_deffree(void *softc)
  */
 
 struct tty *
-tty_alloc(struct ttydevsw *tsw, void *sc, struct mtx *mutex)
+tty_alloc(struct ttydevsw *tsw, void *sc)
+{
+
+	return (tty_alloc_mutex(tsw, sc, NULL));
+}
+
+struct tty *
+tty_alloc_mutex(struct ttydevsw *tsw, void *sc, struct mtx *mutex)
 {
 	struct tty *tp;
 

Modified: head/sys/kern/tty_pts.c
==============================================================================
--- head/sys/kern/tty_pts.c	Fri May 29 06:27:30 2009	(r193017)
+++ head/sys/kern/tty_pts.c	Fri May 29 06:41:23 2009	(r193018)
@@ -741,7 +741,7 @@ pts_alloc(int fflags, struct thread *td,
 	psc->pts_uidinfo = uid;
 	uihold(uid);
 
-	tp = tty_alloc(&pts_class, psc, NULL);
+	tp = tty_alloc(&pts_class, psc);
 	knlist_init(&psc->pts_inpoll.si_note, tp->t_mtx, NULL, NULL, NULL);
 	knlist_init(&psc->pts_outpoll.si_note, tp->t_mtx, NULL, NULL, NULL);
 
@@ -781,7 +781,7 @@ pts_alloc_external(int fflags, struct th
 	psc->pts_uidinfo = uid;
 	uihold(uid);
 
-	tp = tty_alloc(&pts_class, psc, NULL);
+	tp = tty_alloc(&pts_class, psc);
 	knlist_init(&psc->pts_inpoll.si_note, tp->t_mtx, NULL, NULL, NULL);
 	knlist_init(&psc->pts_outpoll.si_note, tp->t_mtx, NULL, NULL, NULL);
 

Modified: head/sys/sun4v/sun4v/hvcons.c
==============================================================================
--- head/sys/sun4v/sun4v/hvcons.c	Fri May 29 06:27:30 2009	(r193017)
+++ head/sys/sun4v/sun4v/hvcons.c	Fri May 29 06:41:23 2009	(r193018)
@@ -327,7 +327,7 @@ hvcn_dev_attach(device_t dev)
 	    hvcn_consdev.cn_name[0] == '\0') 
 		return (ENXIO);
 
-	tp = tty_alloc(&hvcn_class, NULL, NULL);
+	tp = tty_alloc(&hvcn_class, NULL);
 	tty_makedev(tp, NULL, "v%r", 1);
 	tty_makealias(tp, "hvcn");
 	

Modified: head/sys/sys/tty.h
==============================================================================
--- head/sys/sys/tty.h	Fri May 29 06:27:30 2009	(r193017)
+++ head/sys/sys/tty.h	Fri May 29 06:41:23 2009	(r193018)
@@ -152,7 +152,8 @@ struct xtty {
 #ifdef _KERNEL
 
 /* Allocation and deallocation. */
-struct tty *tty_alloc(struct ttydevsw *tsw, void *softc, struct mtx *mtx);
+struct tty *tty_alloc(struct ttydevsw *tsw, void *softc);
+struct tty *tty_alloc_mutex(struct ttydevsw *tsw, void *softc, struct mtx *mtx);
 void	tty_rel_pgrp(struct tty *tp, struct pgrp *pgrp);
 void	tty_rel_sess(struct tty *tp, struct session *sess);
 void	tty_rel_gone(struct tty *tp);

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 07:18:31 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E453B106566C;
	Fri, 29 May 2009 07:18:31 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D2FDF8FC23;
	Fri, 29 May 2009 07:18:31 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4T7IV3f063223;
	Fri, 29 May 2009 07:18:31 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4T7IVUN063222;
	Fri, 29 May 2009 07:18:31 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200905290718.n4T7IVUN063222@svn.freebsd.org>
From: Xin LI 
Date: Fri, 29 May 2009 07:18:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193021 - head/contrib/netcat
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 07:18:32 -0000

Author: delphij
Date: Fri May 29 07:18:31 2009
New Revision: 193021
URL: http://svn.freebsd.org/changeset/base/193021

Log:
  Add an EXIT STATUS section to the manual page.  Currently, nc(1)
  does not follow sysexits(3), and returns 1 for all error cases.
  
  PR:		docs/126451

Modified:
  head/contrib/netcat/nc.1

Modified: head/contrib/netcat/nc.1
==============================================================================
--- head/contrib/netcat/nc.1	Fri May 29 06:57:45 2009	(r193020)
+++ head/contrib/netcat/nc.1	Fri May 29 07:18:31 2009	(r193021)
@@ -445,6 +445,8 @@ The same example again, this time enabli
 if the proxy requires it:
 .Pp
 .Dl $ nc -x10.2.3.4:8080 -Xconnect -Pruser host.example.com 42
+.Sh EXIT STATUS
+.Ex -std
 .Sh SEE ALSO
 .Xr cat 1 ,
 .Xr ssh 1 ,

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 07:26:45 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 175A7106564A;
	Fri, 29 May 2009 07:26:45 +0000 (UTC)
	(envelope-from brian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 062468FC08;
	Fri, 29 May 2009 07:26:45 +0000 (UTC)
	(envelope-from brian@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4T7QifB063440;
	Fri, 29 May 2009 07:26:44 GMT (envelope-from brian@svn.freebsd.org)
Received: (from brian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4T7Qixe063439;
	Fri, 29 May 2009 07:26:44 GMT (envelope-from brian@svn.freebsd.org)
Message-Id: <200905290726.n4T7Qixe063439@svn.freebsd.org>
From: Brian Somers 
Date: Fri, 29 May 2009 07:26:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193022 - head/sbin/dump
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 07:26:45 -0000

Author: brian
Date: Fri May 29 07:26:44 2009
New Revision: 193022
URL: http://svn.freebsd.org/changeset/base/193022

Log:
  Make dump -W show the level correctly.
  
  PR:		129110
  Submitted by:	Mike Voorhis 
  MFC after:	3 weeks

Modified:
  head/sbin/dump/optr.c

Modified: head/sbin/dump/optr.c
==============================================================================
--- head/sbin/dump/optr.c	Fri May 29 07:18:31 2009	(r193021)
+++ head/sbin/dump/optr.c	Fri May 29 07:26:44 2009	(r193022)
@@ -406,7 +406,7 @@ lastdump(int arg)	/* w ==> just what to 
 		};
 		if (arg != 'w' || dumpme)
 			(void) printf(
-			    "%c %8s\t(%6s) Last dump: Level %c, Date %s\n",
+			    "%c %8s\t(%6s) Last dump: Level %d, Date %s\n",
 			    dumpme && (arg != 'w') ? '>' : ' ',
 			    dtwalk->dd_name,
 			    dt ? dt->fs_file : "",

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 07:34:55 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 485AF1065673;
	Fri, 29 May 2009 07:34:55 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 365418FC1E;
	Fri, 29 May 2009 07:34:55 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4T7YtW7063622;
	Fri, 29 May 2009 07:34:55 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4T7Yt2S063621;
	Fri, 29 May 2009 07:34:55 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200905290734.n4T7Yt2S063621@svn.freebsd.org>
From: Xin LI 
Date: Fri, 29 May 2009 07:34:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193023 - head/lib/libc/resolv
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 07:34:55 -0000

Author: delphij
Date: Fri May 29 07:34:54 2009
New Revision: 193023
URL: http://svn.freebsd.org/changeset/base/193023

Log:
  Add an option to enforce strict RFC 1034 compliance.
  
  PR:		kern/129477

Modified:
  head/lib/libc/resolv/res_comp.c

Modified: head/lib/libc/resolv/res_comp.c
==============================================================================
--- head/lib/libc/resolv/res_comp.c	Fri May 29 07:26:44 2009	(r193022)
+++ head/lib/libc/resolv/res_comp.c	Fri May 29 07:34:54 2009	(r193023)
@@ -148,7 +148,11 @@ dn_skipname(const u_char *ptr, const u_c
 #define digitchar(c) ((c) >= 0x30 && (c) <= 0x39)
 
 #define borderchar(c) (alphachar(c) || digitchar(c))
+#ifdef	RES_ENFORCE_RFC1034
+#define middlechar(c) (borderchar(c) || hyphenchar(c))
+#else
 #define middlechar(c) (borderchar(c) || hyphenchar(c) || underscorechar(c))
+#endif
 #define	domainchar(c) ((c) > 0x20 && (c) < 0x7f)
 
 int

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 07:44:32 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B9909106566C;
	Fri, 29 May 2009 07:44:32 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 52C738FC12;
	Fri, 29 May 2009 07:44:32 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from fledge.watson.org (fledge.watson.org [65.122.17.41])
	by cyrus.watson.org (Postfix) with ESMTPS id E953646B2C;
	Fri, 29 May 2009 03:44:31 -0400 (EDT)
Date: Fri, 29 May 2009 08:44:31 +0100 (BST)
From: Robert Watson 
X-X-Sender: robert@fledge.watson.org
To: Attilio Rao 
In-Reply-To: <200905290149.n4T1nRJc056207@svn.freebsd.org>
Message-ID: 
References: <200905290149.n4T1nRJc056207@svn.freebsd.org>
User-Agent: Alpine 2.00 (BSF 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r193011 - in head: . share/man/man9
 sys/cddl/compat/opensolaris/sys sys/conf sys/kern sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 07:44:33 -0000

On Fri, 29 May 2009, Attilio Rao wrote:

>  Reverse the logic for ADAPTIVE_SX option and enable it by default.
>  Introduce for this operation the reverse NO_ADAPTIVE_SX option.
>  The flag SX_ADAPTIVESPIN to be passed to sx_init_flags(9) gets suppressed
>  and the new flag, offering the reversed logic, SX_NOADAPTIVE is added.
>
>  Additively implements adaptive spininning for sx held in shared mode.
>  The spinning limit can be handled through sysctls in order to be tuned
>  while the code doesn't reach the release, after which time they should
>  be dropped probabilly.

The princple here has always been that sleepable locks are likely to be used 
in sleepable ways, and therefore that adaptive locking (spinning) was 
unproductive.  In light of these performance results, have you considered 
making the same change to lockmgr (assuming it's not there already)?  Also, is 
adaptive locking for sx locks disabled in Xen by default in the same was as 
mutexes?

Robert N M Watson
Computer Laboratory
University of Cambridge

>
>  This change has made been necessary by recent benchmarks where it does
>  improve concurrency of workloads in presence of high contention
>  (ie. ZFS).
>
>  KPI breakage is documented by __FreeBSD_version bumping, manpage and
>  UPDATING updates.
>
>  Requested by:	jeff, kmacy
>  Reviewed by:	jeff
>  Tested by:	pho
>
> Modified:
>  head/UPDATING
>  head/share/man/man9/sx.9
>  head/sys/cddl/compat/opensolaris/sys/mutex.h
>  head/sys/cddl/compat/opensolaris/sys/rwlock.h
>  head/sys/conf/NOTES
>  head/sys/conf/options
>  head/sys/kern/kern_sx.c
>  head/sys/sys/param.h
>  head/sys/sys/sx.h
>
> Modified: head/UPDATING
> ==============================================================================
> --- head/UPDATING	Fri May 29 01:31:18 2009	(r193010)
> +++ head/UPDATING	Fri May 29 01:49:27 2009	(r193011)
> @@ -22,6 +22,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.
> 	to maximize performance.  (To disable malloc debugging, run
> 	ln -s aj /etc/malloc.conf.)
>
> +20090528:
> +	The compiling option ADAPTIVE_SX has been retired while it has been
> +	introduced the option NO_ADAPTIVE_SX which handles the reversed logic.
> +	The KPI for sx_init_flags() changes as accepting flags:
> +	SX_ADAPTIVESPIN flag has been retired while the SX_NOADAPTIVE flag
> +	has been introduced in order to handle the reversed logic.
> +	Bump __FreeBSD_version to 800092.
> +
> 20090527:
> 	Add support for hierarchical jails.  Remove global securelevel.
> 	Bump __FreeBSD_version to 800091.
>
> Modified: head/share/man/man9/sx.9
> ==============================================================================
> --- head/share/man/man9/sx.9	Fri May 29 01:31:18 2009	(r193010)
> +++ head/share/man/man9/sx.9	Fri May 29 01:49:27 2009	(r193011)
> @@ -26,7 +26,7 @@
> .\"
> .\" $FreeBSD$
> .\"
> -.Dd November 25, 2007
> +.Dd May 28, 2009
> .Dt SX 9
> .Os
> .Sh NAME
> @@ -122,10 +122,10 @@ argument to
> specifies a set of optional flags to alter the behavior of
> .Fa sx .
> It contains one or more of the following flags:
> -.Bl -tag -width SX_ADAPTIVESPIN
> -.It Dv SX_ADAPTIVESPIN
> -If the kernel is compiled with
> -.Cd "options ADAPTIVE_SX" ,
> +.Bl -tag -width SX_NOADAPTIVE
> +.It Dv SX_NOADAPTIVE
> +If the kernel is not compiled with
> +.Cd "options NO_ADAPTIVE_SX" ,
> then lock operations for
> .Fa sx
> will spin instead of sleeping while an exclusive lock holder is executing on
>
> Modified: head/sys/cddl/compat/opensolaris/sys/mutex.h
> ==============================================================================
> --- head/sys/cddl/compat/opensolaris/sys/mutex.h	Fri May 29 01:31:18 2009	(r193010)
> +++ head/sys/cddl/compat/opensolaris/sys/mutex.h	Fri May 29 01:49:27 2009	(r193011)
> @@ -47,9 +47,9 @@ typedef enum {
> typedef struct sx	kmutex_t;
>
> #ifndef DEBUG
> -#define	MUTEX_FLAGS	(SX_DUPOK | SX_NOWITNESS | SX_ADAPTIVESPIN)
> +#define	MUTEX_FLAGS	(SX_DUPOK | SX_NOWITNESS)
> #else
> -#define	MUTEX_FLAGS	(SX_DUPOK | SX_ADAPTIVESPIN)
> +#define	MUTEX_FLAGS	(SX_DUPOK)
> #endif
>
> #define	mutex_init(lock, desc, type, arg)	do {			\
>
> Modified: head/sys/cddl/compat/opensolaris/sys/rwlock.h
> ==============================================================================
> --- head/sys/cddl/compat/opensolaris/sys/rwlock.h	Fri May 29 01:31:18 2009	(r193010)
> +++ head/sys/cddl/compat/opensolaris/sys/rwlock.h	Fri May 29 01:49:27 2009	(r193011)
> @@ -49,9 +49,9 @@ typedef enum {
> typedef	struct sx	krwlock_t;
>
> #ifndef DEBUG
> -#define	RW_FLAGS	(SX_DUPOK | SX_NOWITNESS | SX_ADAPTIVESPIN)
> +#define	RW_FLAGS	(SX_DUPOK | SX_NOWITNESS)
> #else
> -#define	RW_FLAGS	(SX_DUPOK | SX_ADAPTIVESPIN)
> +#define	RW_FLAGS	(SX_DUPOK)
> #endif
>
> #define	RW_READ_HELD(x)		(rw_read_held((x)))
>
> Modified: head/sys/conf/NOTES
> ==============================================================================
> --- head/sys/conf/NOTES	Fri May 29 01:31:18 2009	(r193010)
> +++ head/sys/conf/NOTES	Fri May 29 01:49:27 2009	(r193011)
> @@ -215,11 +215,11 @@ options 	NO_ADAPTIVE_MUTEXES
> # to disable it.
> options 	NO_ADAPTIVE_RWLOCKS
>
> -# ADAPTIVE_SX changes the behavior of sx locks to spin if the thread
> -# that currently owns the lock is executing on another CPU.  Note that
> -# in addition to enabling this option, individual sx locks must be
> -# initialized with the SX_ADAPTIVESPIN flag.
> -options 	ADAPTIVE_SX
> +# ADAPTIVE_SX changes the behavior of sx locks to spin if the thread that
> +# currently owns the sx lock is executing on another CPU.
> +# This behaviour is enabled by default, so this option can be used to
> +# disable it.
> +options 	NO_ADAPTIVE_SX
>
> # MUTEX_NOINLINE forces mutex operations to call functions to perform each
> # operation rather than inlining the simple cases.  This can be used to
>
> Modified: head/sys/conf/options
> ==============================================================================
> --- head/sys/conf/options	Fri May 29 01:31:18 2009	(r193010)
> +++ head/sys/conf/options	Fri May 29 01:49:27 2009	(r193011)
> @@ -60,7 +60,6 @@ KDB_UNATTENDED	opt_kdb.h
> SYSCTL_DEBUG	opt_sysctl.h
>
> # Miscellaneous options.
> -ADAPTIVE_SX
> ALQ
> AUDIT		opt_global.h
> CODA_COMPAT_5	opt_coda.h
> @@ -134,6 +133,7 @@ MPROF_BUFFERS	opt_mprof.h
> MPROF_HASH_SIZE	opt_mprof.h
> NO_ADAPTIVE_MUTEXES	opt_adaptive_mutexes.h
> NO_ADAPTIVE_RWLOCKS
> +NO_ADAPTIVE_SX
> NO_SYSCTL_DESCR	opt_global.h
> NSWBUF_MIN	opt_swap.h
> MBUF_PACKET_ZONE_DISABLE	opt_global.h
>
> Modified: head/sys/kern/kern_sx.c
> ==============================================================================
> --- head/sys/kern/kern_sx.c	Fri May 29 01:31:18 2009	(r193010)
> +++ head/sys/kern/kern_sx.c	Fri May 29 01:49:27 2009	(r193011)
> @@ -60,12 +60,12 @@ __FBSDID("$FreeBSD$");
> #include 
> #endif
>
> -#if !defined(SMP) && defined(ADAPTIVE_SX)
> -#error "You must have SMP to enable the ADAPTIVE_SX option"
> +#if defined(SMP) && !defined(NO_ADAPTIVE_SX)
> +#define	ADAPTIVE_SX
> #endif
>
> -CTASSERT(((SX_ADAPTIVESPIN | SX_RECURSE) & LO_CLASSFLAGS) ==
> -    (SX_ADAPTIVESPIN | SX_RECURSE));
> +CTASSERT(((SX_NOADAPTIVE | SX_RECURSE) & LO_CLASSFLAGS) ==
> +    (SX_NOADAPTIVE | SX_RECURSE));
>
> /* Handy macros for sleep queues. */
> #define	SQ_EXCLUSIVE_QUEUE	0
> @@ -133,6 +133,14 @@ struct lock_class lock_class_sx = {
> #define	_sx_assert(sx, what, file, line)
> #endif
>
> +#ifdef ADAPTIVE_SX
> +static u_int asx_retries = 10;
> +static u_int asx_loops = 10000;
> +SYSCTL_NODE(_debug, OID_AUTO, sx, CTLFLAG_RD, NULL, "sxlock debugging");
> +SYSCTL_INT(_debug_sx, OID_AUTO, retries, CTLFLAG_RW, &asx_retries, 0, "");
> +SYSCTL_INT(_debug_sx, OID_AUTO, loops, CTLFLAG_RW, &asx_loops, 0, "");
> +#endif
> +
> void
> assert_sx(struct lock_object *lock, int what)
> {
> @@ -195,7 +203,7 @@ sx_init_flags(struct sx *sx, const char
> 	int flags;
>
> 	MPASS((opts & ~(SX_QUIET | SX_RECURSE | SX_NOWITNESS | SX_DUPOK |
> -	    SX_NOPROFILE | SX_ADAPTIVESPIN)) == 0);
> +	    SX_NOPROFILE | SX_NOADAPTIVE)) == 0);
>
> 	flags = LO_RECURSABLE | LO_SLEEPABLE | LO_UPGRADABLE;
> 	if (opts & SX_DUPOK)
> @@ -207,7 +215,7 @@ sx_init_flags(struct sx *sx, const char
> 	if (opts & SX_QUIET)
> 		flags |= LO_QUIET;
>
> -	flags |= opts & (SX_ADAPTIVESPIN | SX_RECURSE);
> +	flags |= opts & (SX_NOADAPTIVE | SX_RECURSE);
> 	sx->sx_lock = SX_LOCK_UNLOCKED;
> 	sx->sx_recurse = 0;
> 	lock_init(&sx->lock_object, &lock_class_sx, description, NULL, flags);
> @@ -453,6 +461,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t
> 	GIANT_DECLARE;
> #ifdef ADAPTIVE_SX
> 	volatile struct thread *owner;
> +	u_int i, spintries = 0;
> #endif
> 	uintptr_t x;
> #ifdef LOCK_PROFILING
> @@ -495,24 +504,44 @@ _sx_xlock_hard(struct sx *sx, uintptr_t
> 		 * running or the state of the lock changes.
> 		 */
> 		x = sx->sx_lock;
> -		if (!(x & SX_LOCK_SHARED) &&
> -		    (sx->lock_object.lo_flags & SX_ADAPTIVESPIN)) {
> -			x = SX_OWNER(x);
> -			owner = (struct thread *)x;
> -			if (TD_IS_RUNNING(owner)) {
> -				if (LOCK_LOG_TEST(&sx->lock_object, 0))
> -					CTR3(KTR_LOCK,
> +		if ((sx->lock_object.lo_flags & SX_NOADAPTIVE) != 0) {
> +			if ((x & SX_LOCK_SHARED) == 0) {
> +				x = SX_OWNER(x);
> +				owner = (struct thread *)x;
> +				if (TD_IS_RUNNING(owner)) {
> +					if (LOCK_LOG_TEST(&sx->lock_object, 0))
> +						CTR3(KTR_LOCK,
> 					    "%s: spinning on %p held by %p",
> -					    __func__, sx, owner);
> -				GIANT_SAVE();
> -				while (SX_OWNER(sx->sx_lock) == x &&
> -				    TD_IS_RUNNING(owner)) {
> +						    __func__, sx, owner);
> +					GIANT_SAVE();
> +					while (SX_OWNER(sx->sx_lock) == x &&
> +					    TD_IS_RUNNING(owner)) {
> +						cpu_spinwait();
> +#ifdef KDTRACE_HOOKS
> +						spin_cnt++;
> +#endif
> +					}
> +					continue;
> +				}
> +			} else if (SX_SHARERS(x) && spintries < asx_retries) {
> +				spintries++;
> +				for (i = 0; i < asx_loops; i++) {
> +					if (LOCK_LOG_TEST(&sx->lock_object, 0))
> +						CTR4(KTR_LOCK,
> +				    "%s: shared spinning on %p with %u and %u",
> +						    __func__, sx, spintries, i);
> +					GIANT_SAVE();
> +					x = sx->sx_lock;
> +					if ((x & SX_LOCK_SHARED) == 0 ||
> +					    SX_SHARERS(x) == 0)
> +						break;
> 					cpu_spinwait();
> #ifdef KDTRACE_HOOKS
> 					spin_cnt++;
> #endif
> 				}
> -				continue;
> +				if (i != asx_loops)
> +					continue;
> 			}
> 		}
> #endif
> @@ -538,7 +567,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t
> 		 * again.
> 		 */
> 		if (!(x & SX_LOCK_SHARED) &&
> -		    (sx->lock_object.lo_flags & SX_ADAPTIVESPIN)) {
> +		    (sx->lock_object.lo_flags & SX_NOADAPTIVE) == 0) {
> 			owner = (struct thread *)SX_OWNER(x);
> 			if (TD_IS_RUNNING(owner)) {
> 				sleepq_release(&sx->lock_object);
> @@ -752,7 +781,7 @@ _sx_slock_hard(struct sx *sx, int opts,
> 		 * the owner stops running or the state of the lock
> 		 * changes.
> 		 */
> -		if (sx->lock_object.lo_flags & SX_ADAPTIVESPIN) {
> +		if ((sx->lock_object.lo_flags & SX_NOADAPTIVE) == 0) {
> 			x = SX_OWNER(x);
> 			owner = (struct thread *)x;
> 			if (TD_IS_RUNNING(owner)) {
> @@ -796,7 +825,7 @@ _sx_slock_hard(struct sx *sx, int opts,
> 		 * changes.
> 		 */
> 		if (!(x & SX_LOCK_SHARED) &&
> -		    (sx->lock_object.lo_flags & SX_ADAPTIVESPIN)) {
> +		    (sx->lock_object.lo_flags & SX_NOADAPTIVE) == 0) {
> 			owner = (struct thread *)SX_OWNER(x);
> 			if (TD_IS_RUNNING(owner)) {
> 				sleepq_release(&sx->lock_object);
>
> Modified: head/sys/sys/param.h
> ==============================================================================
> --- head/sys/sys/param.h	Fri May 29 01:31:18 2009	(r193010)
> +++ head/sys/sys/param.h	Fri May 29 01:49:27 2009	(r193011)
> @@ -57,7 +57,7 @@
>  *		is created, otherwise 1.
>  */
> #undef __FreeBSD_version
> -#define __FreeBSD_version 800091	/* Master, propagated to newvers */
> +#define __FreeBSD_version 800092	/* Master, propagated to newvers */
>
> #ifndef LOCORE
> #include 
>
> Modified: head/sys/sys/sx.h
> ==============================================================================
> --- head/sys/sys/sx.h	Fri May 29 01:31:18 2009	(r193010)
> +++ head/sys/sys/sx.h	Fri May 29 01:49:27 2009	(r193011)
> @@ -265,7 +265,7 @@ __sx_sunlock(struct sx *sx, const char *
> #define	SX_NOPROFILE		0x02
> #define	SX_NOWITNESS		0x04
> #define	SX_QUIET		0x08
> -#define	SX_ADAPTIVESPIN		0x10
> +#define	SX_NOADAPTIVE		0x10
> #define	SX_RECURSE		0x20
>
> /*
>

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 07:55:44 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B42FA106564A;
	Fri, 29 May 2009 07:55:44 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A294A8FC13;
	Fri, 29 May 2009 07:55:44 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4T7tiKS064048;
	Fri, 29 May 2009 07:55:44 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4T7tiSY064047;
	Fri, 29 May 2009 07:55:44 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200905290755.n4T7tiSY064047@svn.freebsd.org>
From: Xin LI 
Date: Fri, 29 May 2009 07:55:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193024 - head/lib/libc/net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 07:55:45 -0000

Author: delphij
Date: Fri May 29 07:55:44 2009
New Revision: 193024
URL: http://svn.freebsd.org/changeset/base/193024

Log:
  Document how to enable strict RFC 1034 enforcements.
  
  PR:		kern/129477

Modified:
  head/lib/libc/net/resolver.3

Modified: head/lib/libc/net/resolver.3
==============================================================================
--- head/lib/libc/net/resolver.3	Fri May 29 07:34:54 2009	(r193023)
+++ head/lib/libc/net/resolver.3	Fri May 29 07:55:44 2009	(r193024)
@@ -28,7 +28,7 @@
 .\"     @(#)resolver.3	8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd November 4, 2006
+.Dd May 29, 2009
 .Dt RESOLVER 3
 .Os
 .Sh NAME
@@ -401,6 +401,19 @@ function properly if the programmer atte
 .Va _res
 structure in an attempt to replace the per-thread version referred to
 by that macro.
+.Pp
+The following compile-time option can be specified to change the default
+behavior of resolver routines when necessary.
+.Bl -tag -width RES_ENFORCE_RFC1034
+.It Dv RES_ENFORCE_RFC1034
+If this symbol is defined during compile-time,
+.Fn res_search
+will enforce RFC 1034 check, namely, disallow using of underscore character
+within host names.
+This is used by the standard host lookup routines like
+.Xr gethostbyname 3 .
+For compatibility reasons this option is not enabled by default.
+.El
 .Sh RETURN VALUES
 The
 .Fn res_init

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 07:58:00 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 11EEF1065673;
	Fri, 29 May 2009 07:58:00 +0000 (UTC)
	(envelope-from prvs=1393ccfc27=brian@FreeBSD.org)
Received: from idcmail-mo1so.shaw.ca (idcmail-mo1so.shaw.ca [24.71.223.10])
	by mx1.freebsd.org (Postfix) with ESMTP id B4E3A8FC08;
	Fri, 29 May 2009 07:57:59 +0000 (UTC)
	(envelope-from prvs=1393ccfc27=brian@FreeBSD.org)
Received: from pd4ml2so-ssvc.prod.shaw.ca ([10.0.141.136])
	by pd2mo1so-svcs.prod.shaw.ca with ESMTP; 29 May 2009 01:29:35 -0600
X-Cloudmark-SP-Filtered: true
X-Cloudmark-SP-Result: v=1.0 c=0 a=6I5d2MoRAAAA:8 a=5hrBf8AH1eEvHGXCs40A:9
	a=2grhVnxJuXWJ8zhXV-_qywKRb8IA:4 a=SV7veod9ZcQA:10
	a=WJ3hkfHDukgA:10 a=V5Rq0WE4h3EA:10 a=bcIVQrGv_nEA:10
Received: from unknown (HELO store.lan.Awfulhak.org) ([174.7.23.140])
	by pd4ml2so-dmz.prod.shaw.ca with ESMTP; 29 May 2009 01:29:34 -0600
Received: from store.lan.Awfulhak.org (localhost.localdomain [127.0.0.1])
	by localhost (Email Security Appliance) with SMTP id
	79F88C433AC_A1F8EF1B; Fri, 29 May 2009 07:29:53 +0000 (GMT)
Received: from gw.Awfulhak.org (gw.lan.Awfulhak.org [172.16.0.1])
	by store.lan.Awfulhak.org (Sophos Email Appliance) with ESMTP id
	47502C460FE_A1F8EEBF; Fri, 29 May 2009 07:29:47 +0000 (GMT)
Received: from dev.lan.Awfulhak.org (brian@dev.lan.Awfulhak.org [172.16.0.5])
	by gw.Awfulhak.org (8.14.3/8.14.3) with ESMTP id n4T7TSMo059453;
	Fri, 29 May 2009 00:29:28 -0700 (PDT)
	(envelope-from brian@FreeBSD.org)
Date: Fri, 29 May 2009 00:29:27 -0700
From: Brian Somers 
To: Mike Voorhis 
Message-ID: <20090529002927.33aac038@dev.lan.Awfulhak.org>
In-Reply-To: <200905290726.n4T7Qixe063439@svn.freebsd.org>
References: <200905290726.n4T7Qixe063439@svn.freebsd.org>
X-Mailer: Claws Mail 3.7.1 (GTK+ 2.16.1; i386-portbld-freebsd8.0)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r193022 - head/sbin/dump
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 07:58:00 -0000

On Fri, 29 May 2009 07:26:44 +0000 (UTC) Brian Somers  wrote:
> Author: brian
> Date: Fri May 29 07:26:44 2009
> New Revision: 193022
> URL: http://svn.freebsd.org/changeset/base/193022
> 
> Log:
>   Make dump -W show the level correctly.
>   
>   PR:		129110
>   Submitted by:	Mike Voorhis 
>   MFC after:	3 weeks
> 
> Modified:
>   head/sbin/dump/optr.c

Urk, my apologies - I used you unobfuscated email address.

-- 
Brian Somers                                          
Don't _EVER_ lose your sense of humour !               

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 08:01:49 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3F7FE10656D9;
	Fri, 29 May 2009 08:01:49 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 979A28FC0A;
	Fri, 29 May 2009 08:01:48 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4T81mmh064217;
	Fri, 29 May 2009 08:01:48 GMT (envelope-from attilio@svn.freebsd.org)
Received: (from attilio@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4T81mf7064216;
	Fri, 29 May 2009 08:01:48 GMT (envelope-from attilio@svn.freebsd.org)
Message-Id: <200905290801.n4T81mf7064216@svn.freebsd.org>
From: Attilio Rao 
Date: Fri, 29 May 2009 08:01:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193025 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 08:01:49 -0000

Author: attilio
Date: Fri May 29 08:01:48 2009
New Revision: 193025
URL: http://svn.freebsd.org/changeset/base/193025

Log:
  The patch for r193011 was partially rejected when applied, complete it.

Modified:
  head/sys/kern/kern_sx.c

Modified: head/sys/kern/kern_sx.c
==============================================================================
--- head/sys/kern/kern_sx.c	Fri May 29 07:55:44 2009	(r193024)
+++ head/sys/kern/kern_sx.c	Fri May 29 08:01:48 2009	(r193025)
@@ -36,23 +36,25 @@
  * so should not be relied upon in combination with sx locks.
  */
 
-#include "opt_adaptive_sx.h"
 #include "opt_ddb.h"
 #include "opt_kdtrace.h"
+#include "opt_no_adaptive_sx.h"
 
 #include 
 __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 
-#ifdef ADAPTIVE_SX
+#if defined(SMP) && !defined(NO_ADAPTIVE_SX)
 #include 
 #endif
 

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 08:04:16 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 989041065675;
	Fri, 29 May 2009 08:04:16 +0000 (UTC)
	(envelope-from asmrookie@gmail.com)
Received: from mail-bw0-f213.google.com (mail-bw0-f213.google.com
	[209.85.218.213])
	by mx1.freebsd.org (Postfix) with ESMTP id 8A1688FC1E;
	Fri, 29 May 2009 08:04:14 +0000 (UTC)
	(envelope-from asmrookie@gmail.com)
Received: by bwz9 with SMTP id 9so6046146bwz.43
	for ; Fri, 29 May 2009 01:04:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:sender:received:in-reply-to
	:references:date:x-google-sender-auth:message-id:subject:from:to:cc
	:content-type:content-transfer-encoding;
	bh=3KFt7MOLgRIf6rgpnFyAHBRDs5j8vQDw7tSTB6tc5Gs=;
	b=WMZL088TrVc3FZ5j6oGwJniYN1skPnD/WfXBtd3EvhBmE2xezHmB7edZSk65P2vCDr
	aJZkntbrLOEnQ1oU9L7Tgctksn3DW6AwC2r9HFiJ3JjrfJJZzvI4RamSmFG/voTL0Ykc
	XB8SyVolU6qYvCWa260Vgjh/GglKmV6TmpkMA=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	b=kZDv8P+xcMEkQC6cfVlWQgcZFQ6aZwSZUBOg+PY6DxMZg3xaaib9VE6uoln/p9otn8
	Px+Lx0R5sEQYLZTty2mSTSXza3CJJhQGYpVPhMUQTUtIEiqvSorU6x89zDI8N1/ZWGHZ
	blkh/zw6Fm1BLH3+PBADba8LRHL6oE4ZUbIc4=
MIME-Version: 1.0
Sender: asmrookie@gmail.com
Received: by 10.223.124.147 with SMTP id u19mr1776421far.28.1243584253774; 
	Fri, 29 May 2009 01:04:13 -0700 (PDT)
In-Reply-To: 
References: <200905290149.n4T1nRJc056207@svn.freebsd.org>
	
Date: Fri, 29 May 2009 10:04:13 +0200
X-Google-Sender-Auth: 2265cca0e108a4be
Message-ID: <3bbf2fe10905290104q50d77235pe50a39a3912f6061@mail.gmail.com>
From: Attilio Rao 
To: Robert Watson 
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r193011 - in head: . share/man/man9 
	sys/cddl/compat/opensolaris/sys sys/conf sys/kern sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 08:04:17 -0000

2009/5/29 Robert Watson :
> On Fri, 29 May 2009, Attilio Rao wrote:
>
>>  Reverse the logic for ADAPTIVE_SX option and enable it by default.
>>  Introduce for this operation the reverse NO_ADAPTIVE_SX option.
>>  The flag SX_ADAPTIVESPIN to be passed to sx_init_flags(9) gets suppressed
>>  and the new flag, offering the reversed logic, SX_NOADAPTIVE is added.
>>
>>  Additively implements adaptive spininning for sx held in shared mode.
>>  The spinning limit can be handled through sysctls in order to be tuned
>>  while the code doesn't reach the release, after which time they should
>>  be dropped probabilly.
>
> The princple here has always been that sleepable locks are likely to be used
> in sleepable ways, and therefore that adaptive locking (spinning) was
> unproductive.  In light of these performance results, have you considered
> making the same change to lockmgr (assuming it's not there already)?  Also,
> is adaptive locking for sx locks disabled in Xen by default in the same was
> as mutexes?

Yes, lockmgrs are the next ones to be handled in regard of this.

I'm actually prodding key people abuout experimenting adaptive
spinning and reporting to me. Let's see if they can get some
interesting benchmark in edge cases (Xen too).

Thanks,
Attilio


-- 
Peace can only be achieved by understanding - A. Einstein

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 09:25:36 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CFC2A106564A;
	Fri, 29 May 2009 09:25:36 +0000 (UTC) (envelope-from bde@zeta.org.au)
Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au
	[211.29.132.185])
	by mx1.freebsd.org (Postfix) with ESMTP id 4C6628FC1B;
	Fri, 29 May 2009 09:25:36 +0000 (UTC) (envelope-from bde@zeta.org.au)
Received: from c122-106-151-9.carlnfd1.nsw.optusnet.com.au
	(c122-106-151-9.carlnfd1.nsw.optusnet.com.au [122.106.151.9])
	by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	n4T9PQwG020241
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Fri, 29 May 2009 19:25:28 +1000
Date: Fri, 29 May 2009 19:25:26 +1000 (EST)
From: Bruce Evans 
X-X-Sender: bde@delplex.bde.org
To: "Bruce A. Mah" 
In-Reply-To: <4A1EC5FA.50601@freebsd.org>
Message-ID: <20090529192129.B5886@delplex.bde.org>
References: <200905271636.n4RGasNe003922@svn.freebsd.org>
	<47d0403c0905271005t7f57f9b9h3d0721bbb1fbedc2@mail.gmail.com>
	<86tz35qlrw.fsf@ds4.des.no> <4A1EC5FA.50601@freebsd.org>
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED; BOUNDARY="0-1397947210-1243589126=:5886"
Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org,
	Ben Kaduk ,
	Zachary Loafman , svn-src-head@FreeBSD.org,
	=?UTF-8?B?RGFnLUVybGluZyBTbcO4cmdyYXY=?= 
Subject: Re: svn commit: r192908 - in head: share/man/man9 sys/conf sys/kern
 sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 09:25:37 -0000

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--0-1397947210-1243589126=:5886
Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE

On Thu, 28 May 2009, Bruce A. Mah wrote:

> If memory serves me right, Dag-Erling Sm=C3=B8rgrav wrote:
>> Ben Kaduk  writes:
>>> Our man page style says that new sentences should start on new lines.
>>> (Since the '.' character is used for defining macros, and sometimes
>>> the processor can get confused.)
>>
>> That's not the reason - the reason is that it makes diffs easier to
>> read, which in turn makes it easier for our translators to keep the
>> translated man pages in sync.
>
> My understanding is that we do this to let groff manage the whitespace
> between sentences.  But your comment regarding diffs is quite valid.

It is both of these, but letting groff manage the sentence breaks is more
important since it is related to the output style.

Bruce
--0-1397947210-1243589126=:5886--

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 09:40:57 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C316C1065740;
	Fri, 29 May 2009 09:40:57 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9714B8FC0C;
	Fri, 29 May 2009 09:40:57 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4T9ev9V066249;
	Fri, 29 May 2009 09:40:57 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4T9evT1066248;
	Fri, 29 May 2009 09:40:57 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200905290940.n4T9evT1066248@svn.freebsd.org>
From: Robert Watson 
Date: Fri, 29 May 2009 09:40:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193026 - head/sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 09:40:58 -0000

Author: rwatson
Date: Fri May 29 09:40:57 2009
New Revision: 193026
URL: http://svn.freebsd.org/changeset/base/193026

Log:
  Reduce vertical whitespace and other minor style tweaks.
  
  Remove unused rm_initialized() macro.

Modified:
  head/sys/sys/rmlock.h

Modified: head/sys/sys/rmlock.h
==============================================================================
--- head/sys/sys/rmlock.h	Fri May 29 08:01:48 2009	(r193025)
+++ head/sys/sys/rmlock.h	Fri May 29 09:40:57 2009	(r193026)
@@ -33,26 +33,22 @@
 #define _SYS_RMLOCK_H_
 
 #include 
-
 #include 
 #include 
 
 #ifdef _KERNEL
 
-
 void	rm_init(struct rmlock *rm, const char *name, int opts);
 void	rm_destroy(struct rmlock *rm);
 int	rm_wowned(struct rmlock *rm);
 void	rm_sysinit(void *arg);
 
-
 void	_rm_wlock_debug(struct rmlock *rm, const char *file, int line);
 void	_rm_wunlock_debug(struct rmlock *rm, const char *file, int line);
 void	_rm_rlock_debug(struct rmlock *rm, struct rm_priotracker *tracker,
-    const char *file, int line);
+	    const char *file, int line);
 void	_rm_runlock_debug(struct rmlock *rm,  struct rm_priotracker *tracker,
-    const char *file, int line);
-
+	    const char *file, int line);
 
 void	_rm_wlock(struct rmlock *rm);
 void	_rm_wunlock(struct rmlock *rm);
@@ -61,33 +57,25 @@ void	_rm_runlock(struct rmlock *rm,  str
 
 /*
  * Public interface for lock operations.
- *
  */
-
 #ifndef LOCK_DEBUG
 #error LOCK_DEBUG not defined, include  before 
 #endif
 
 #if LOCK_DEBUG > 0
-
 #define	rm_wlock(rm)	_rm_wlock_debug((rm), LOCK_FILE, LOCK_LINE)
 #define	rm_wunlock(rm)	_rm_wunlock_debug((rm), LOCK_FILE, LOCK_LINE)
 #define	rm_rlock(rm,tracker)  \
     _rm_rlock_debug((rm),(tracker), LOCK_FILE, LOCK_LINE )
 #define	rm_runlock(rm,tracker)	\
     _rm_runlock_debug((rm), (tracker), LOCK_FILE, LOCK_LINE )
-
 #else
-
 #define	rm_wlock(rm)		_rm_wlock((rm))
 #define	rm_wunlock(rm)		_rm_wunlock((rm))
 #define	rm_rlock(rm,tracker)   	_rm_rlock((rm),(tracker))
 #define	rm_runlock(rm,tracker)	_rm_runlock((rm), (tracker))
-
 #endif
 
-#define	rm_initialized(rm)	lock_initalized(&(rm)->lock_object)
-
 struct rm_args {
 	struct rmlock	*ra_rm;
 	const char 	*ra_desc;
@@ -105,6 +93,5 @@ struct rm_args {
 	SYSUNINIT(name##_rm_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE,	\
 	    rm_destroy, (rm))
 
-
 #endif /* _KERNEL */
 #endif /* !_SYS_RMLOCK_H_ */

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 09:52:14 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 25FE81065673;
	Fri, 29 May 2009 09:52:14 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 14BF78FC12;
	Fri, 29 May 2009 09:52:14 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4T9qDLe066521;
	Fri, 29 May 2009 09:52:13 GMT (envelope-from des@svn.freebsd.org)
Received: (from des@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4T9qDF6066520;
	Fri, 29 May 2009 09:52:13 GMT (envelope-from des@svn.freebsd.org)
Message-Id: <200905290952.n4T9qDF6066520@svn.freebsd.org>
From: Dag-Erling Smorgrav 
Date: Fri, 29 May 2009 09:52:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193027 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 09:52:14 -0000

Author: des
Date: Fri May 29 09:52:13 2009
New Revision: 193027
URL: http://svn.freebsd.org/changeset/base/193027

Log:
  Fix misleading comment.
  
  MFC after:	1 week

Modified:
  head/sys/kern/vfs_lookup.c

Modified: head/sys/kern/vfs_lookup.c
==============================================================================
--- head/sys/kern/vfs_lookup.c	Fri May 29 09:40:57 2009	(r193026)
+++ head/sys/kern/vfs_lookup.c	Fri May 29 09:52:13 2009	(r193027)
@@ -268,7 +268,7 @@ namei(struct nameidata *ndp)
 		vfslocked = (ndp->ni_cnd.cn_flags & GIANTHELD) != 0;
 		ndp->ni_cnd.cn_flags &= ~GIANTHELD;
 		/*
-		 * Check for symbolic link
+		 * If not a symbolic link, we're done.
 		 */
 		if ((cnp->cn_flags & ISSYMLINK) == 0) {
 			if ((cnp->cn_flags & (SAVENAME | SAVESTART)) == 0) {

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 10:02:44 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 842DC106564A;
	Fri, 29 May 2009 10:02:44 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 581038FC18;
	Fri, 29 May 2009 10:02:44 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TA2iIU066844;
	Fri, 29 May 2009 10:02:44 GMT (envelope-from des@svn.freebsd.org)
Received: (from des@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TA2ioQ066842;
	Fri, 29 May 2009 10:02:44 GMT (envelope-from des@svn.freebsd.org)
Message-Id: <200905291002.n4TA2ioQ066842@svn.freebsd.org>
From: Dag-Erling Smorgrav 
Date: Fri, 29 May 2009 10:02:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193028 - in head/sys: kern sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 10:02:45 -0000

Author: des
Date: Fri May 29 10:02:44 2009
New Revision: 193028
URL: http://svn.freebsd.org/changeset/base/193028

Log:
  Let vfs_lookup() return ENOTDIR if the path has a trailing slash and
  the last component is a symlink to something that isn't a directory.
  
  We introduce a new namei flag, TRAILINGSLASH, which is set by lookup()
  if the last component is followed by a slash.  The trailing slash is
  then stripped, as before.  If the final component is a symlink,
  lookup() will return to namei(), which will expand the symlink and
  call lookup() with the new path.  When all symlinks have been
  resolved, lookup() checks if the TRAILINGSLASH flag is set, and if it
  is, and the vnode it ended up with is not a directory, it returns
  ENOTDIR.
  
  PR:		kern/21768
  Submitted by:	Eygene Ryabinkin 
  MFC after:	3 weeks

Modified:
  head/sys/kern/vfs_lookup.c
  head/sys/sys/namei.h

Modified: head/sys/kern/vfs_lookup.c
==============================================================================
--- head/sys/kern/vfs_lookup.c	Fri May 29 09:52:13 2009	(r193027)
+++ head/sys/kern/vfs_lookup.c	Fri May 29 10:02:44 2009	(r193028)
@@ -147,6 +147,9 @@ namei(struct nameidata *ndp)
 		cnp->cn_flags &= ~LOCKSHARED;
 	fdp = p->p_fd;
 
+	/* We will set this ourselves if we need it. */
+	cnp->cn_flags &= ~TRAILINGSLASH;
+
 	/*
 	 * Get a buffer for the name to be translated, and copy the
 	 * name into the buffer.
@@ -533,6 +536,7 @@ dirloop:
 		if (*cp == '\0') {
 			trailing_slash = 1;
 			*ndp->ni_next = '\0';	/* XXX for direnter() ... */
+			cnp->cn_flags |= TRAILINGSLASH;
 		}
 	}
 	ndp->ni_next = cp;
@@ -807,14 +811,6 @@ unionlookup:
 		goto success;
 	}
 
-	/*
-	 * Check for bogus trailing slashes.
-	 */
-	if (trailing_slash && dp->v_type != VDIR) {
-		error = ENOTDIR;
-		goto bad2;
-	}
-
 nextname:
 	/*
 	 * Not a symbolic link.  If more pathname,
@@ -838,6 +834,14 @@ nextname:
 		goto dirloop;
 	}
 	/*
+	 * If we're processing a path with a trailing slash,
+	 * check that the end result is a directory.
+	 */
+	if ((cnp->cn_flags & TRAILINGSLASH) && dp->v_type != VDIR) {
+		error = ENOTDIR;
+		goto bad2;
+	}
+	/*
 	 * Disallow directory write attempts on read-only filesystems.
 	 */
 	if (rdonly &&

Modified: head/sys/sys/namei.h
==============================================================================
--- head/sys/sys/namei.h	Fri May 29 09:52:13 2009	(r193027)
+++ head/sys/sys/namei.h	Fri May 29 10:02:44 2009	(r193028)
@@ -142,7 +142,8 @@ struct nameidata {
 #define	GIANTHELD	0x02000000 /* namei() is holding giant. */
 #define	AUDITVNODE1	0x04000000 /* audit the looked up vnode information */
 #define	AUDITVNODE2 	0x08000000 /* audit the looked up vnode information */
-#define	PARAMASK	0x0ffffe00 /* mask of parameter descriptors */
+#define	TRAILINGSLASH	0x10000000 /* path ended in a slash */
+#define	PARAMASK	0x1ffffe00 /* mask of parameter descriptors */
 
 #define	NDHASGIANT(NDP)	(((NDP)->ni_cnd.cn_flags & GIANTHELD) != 0)
 

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 10:10:23 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8B2AC1065674;
	Fri, 29 May 2009 10:10:23 +0000 (UTC)
	(envelope-from weongyo@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 794428FC18;
	Fri, 29 May 2009 10:10:23 +0000 (UTC)
	(envelope-from weongyo@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TAANqD071939;
	Fri, 29 May 2009 10:10:23 GMT (envelope-from weongyo@svn.freebsd.org)
Received: (from weongyo@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TAANsC071937;
	Fri, 29 May 2009 10:10:23 GMT (envelope-from weongyo@svn.freebsd.org)
Message-Id: <200905291010.n4TAANsC071937@svn.freebsd.org>
From: Weongyo Jeong 
Date: Fri, 29 May 2009 10:10:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193029 - in head/sys/dev/usb: . wlan
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 10:10:24 -0000

Author: weongyo
Date: Fri May 29 10:10:23 2009
New Revision: 193029
URL: http://svn.freebsd.org/changeset/base/193029

Log:
  adds new device IDs.
  
  PR:		usb/135009
  Submitted by:	Bill Squire 

Modified:
  head/sys/dev/usb/usbdevs
  head/sys/dev/usb/wlan/if_uath.c

Modified: head/sys/dev/usb/usbdevs
==============================================================================
--- head/sys/dev/usb/usbdevs	Fri May 29 10:02:44 2009	(r193028)
+++ head/sys/dev/usb/usbdevs	Fri May 29 10:10:23 2009	(r193029)
@@ -709,7 +709,10 @@ product ABOCOM WUG2700		0xb21f	WUG2700
 product ACCTON USB320_EC	0x1046	USB320-EC Ethernet Adapter
 product ACCTON 2664W		0x3501	2664W
 product ACCTON 111		0x3503	T-Sinus 111 Wireless Adapter
-product ACCTON SMCWUSBG		0x4505	SMCWUSB-G
+product ACCTON SMCWUSBG_NF	0x4505	SMCWUSB-G (no firmware)
+product ACCTON SMCWUSBG		0x4506	SMCWUSB-G
+product ACCTON SMCWUSBTG2_NF	0x4507	SMCWUSBT-G2 (no firmware)
+product ACCTON SMCWUSBTG2	0x4508	SMCWUSBT-G2
 product ACCTON PRISM_GT		0x4521	PrismGT USB 2.0 WLAN
 product ACCTON SS1001		0x5046	SpeedStream Ethernet Adapter
 product ACCTON ZD1211B		0xe501	ZD1211B

Modified: head/sys/dev/usb/wlan/if_uath.c
==============================================================================
--- head/sys/dev/usb/wlan/if_uath.c	Fri May 29 10:02:44 2009	(r193028)
+++ head/sys/dev/usb/wlan/if_uath.c	Fri May 29 10:10:23 2009	(r193029)
@@ -174,6 +174,8 @@ enum {
 /* recognized device vendors/products */
 static const struct usb_device_id uath_devs[] = {
 #define	UATH_DEV(v,p) { USB_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p) }
+	UATH_DEV(ACCTON,		SMCWUSBG),
+	UATH_DEV(ACCTON,		SMCWUSBTG2),
 	UATH_DEV(ATHEROS,		AR5523),
 	UATH_DEV(ATHEROS2,		AR5523_1),
 	UATH_DEV(ATHEROS2,		AR5523_2),

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 10:51:27 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A482210656B4;
	Fri, 29 May 2009 10:51:27 +0000 (UTC)
	(envelope-from peterjeremy@optushome.com.au)
Received: from mail12.syd.optusnet.com.au (mail12.syd.optusnet.com.au
	[211.29.132.193])
	by mx1.freebsd.org (Postfix) with ESMTP id 29AFD8FC23;
	Fri, 29 May 2009 10:51:26 +0000 (UTC)
	(envelope-from peterjeremy@optushome.com.au)
Received: from server.vk2pj.dyndns.org
	(c122-106-216-167.belrs3.nsw.optusnet.com.au [122.106.216.167])
	by mail12.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	n4TApMJY018448
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Fri, 29 May 2009 20:51:24 +1000
X-Bogosity: Ham, spamicity=0.000000
Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1])
	by server.vk2pj.dyndns.org (8.14.3/8.14.3) with ESMTP id n4TApMYJ099279;
	Fri, 29 May 2009 20:51:22 +1000 (EST)
	(envelope-from peter@server.vk2pj.dyndns.org)
Received: (from peter@localhost)
	by server.vk2pj.dyndns.org (8.14.3/8.14.3/Submit) id n4TApMSQ099278;
	Fri, 29 May 2009 20:51:22 +1000 (EST) (envelope-from peter)
Date: Fri, 29 May 2009 20:51:22 +1000
From: Peter Jeremy 
To: Rick Macklem 
Message-ID: <20090529105122.GB99086@server.vk2pj.dyndns.org>
References: <200905272202.n4RM2s2M013427@svn.freebsd.org>
	<20090528194355.GB1331@server.vk2pj.dyndns.org>
	
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="dTy3Mrz/UPE2dbVg"
Content-Disposition: inline
In-Reply-To: 
X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc
User-Agent: Mutt/1.5.19 (2009-01-05)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r192934 - head/usr.sbin/mountd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 10:51:28 -0000


--dTy3Mrz/UPE2dbVg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2009-May-28 15:56:28 -0400, Rick Macklem  wrote:
>On Fri, 29 May 2009, Peter Jeremy wrote:
>> How about implementing a '-V n', where 'n' indicates the NFS version

>It actually indicates which nfs server to run, not what versions of
>nfs is supported, although the experimental one does NFSv4 as well as
>NFSv2 and 3.

Sorry.  My misunderstanding.  I should have read the commit message
more closely.

>I'm about to pass a commit that changes the "-4" to "-e" along to my
>mentor for approval.

That sounds a bit more mnemonic than '-4'.  Thanks.

--=20
Peter Jeremy

--dTy3Mrz/UPE2dbVg
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (FreeBSD)

iEYEARECAAYFAkofvioACgkQ/opHv/APuIdX3ACglxKwxTdr29Qi57fipMI0gs5Q
cSoAoKFH3GP2mYsJ8vTxZ6kGgDhfwhj+
=GPV1
-----END PGP SIGNATURE-----

--dTy3Mrz/UPE2dbVg--

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 10:52:38 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8808B1065692;
	Fri, 29 May 2009 10:52:38 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 73B668FC27;
	Fri, 29 May 2009 10:52:38 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TAqclR072781;
	Fri, 29 May 2009 10:52:38 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TAqc5q072775;
	Fri, 29 May 2009 10:52:38 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200905291052.n4TAqc5q072775@svn.freebsd.org>
From: Robert Watson 
Date: Fri, 29 May 2009 10:52:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193030 - in head: share/man/man9 sys/kern sys/net
	sys/security/mac sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 10:52:39 -0000

Author: rwatson
Date: Fri May 29 10:52:37 2009
New Revision: 193030
URL: http://svn.freebsd.org/changeset/base/193030

Log:
  Make the rmlock(9) interface a bit more like the rwlock(9) interface:
  
  - Add rm_init_flags() and accept extended options only for that variation.
  - Add a flags space specifically for rm_init_flags(), rather than borrowing
    the lock_init() flag space.
  - Define flag RM_RECURSE to use instead of LO_RECURSABLE.
  - Define flag RM_NOWITNESS to allow an rmlock to be exempt from WITNESS
    checking; this wasn't possible previously as rm_init() always passed
    LO_WITNESS when initializing an rmlock's struct lock.
  - Add RM_SYSINIT_FLAGS().
  - Rename embedded mutex in rmlocks to make it more obvious what it is.
  - Update consumers.
  - Update man page.

Modified:
  head/share/man/man9/rmlock.9
  head/sys/kern/kern_osd.c
  head/sys/kern/kern_rmlock.c
  head/sys/net/pfil.h
  head/sys/security/mac/mac_framework.c
  head/sys/sys/rmlock.h

Modified: head/share/man/man9/rmlock.9
==============================================================================
--- head/share/man/man9/rmlock.9	Fri May 29 10:10:23 2009	(r193029)
+++ head/share/man/man9/rmlock.9	Fri May 29 10:52:37 2009	(r193030)
@@ -32,6 +32,7 @@
 .Sh NAME
 .Nm rmlock ,
 .Nm rm_init ,
+.Nm rm_init_flags ,
 .Nm rm_destroy ,
 .Nm rm_rlock ,
 .Nm rm_wlock ,
@@ -45,7 +46,9 @@
 .In sys/lock.h
 .In sys/rmlock.h
 .Ft void
-.Fn rm_init "struct rmlock *rm" "const char *name" "int opts"
+.Fn rm_init "struct rmlock *rm" "const char *name"
+.Ft void
+.Fn rm_init_flags "struct rmlock *rm" "const char *name" "int opts"
 .Ft void
 .Fn rm_destroy "struct rmlock *rm"
 .Ft void
@@ -106,18 +109,33 @@ can recurse if the lock has been initial
 option, however exclusive locks are not allowed to recurse.
 .Ss Macros and Functions
 .Bl -tag -width indent
-.It Fn rm_init "struct rmlock *rm" "const char *name" "int opts"
+.It Fn rm_init "struct rmlock *rm" "const char *name"
 Initialize structure located at
 .Fa rm
 as mostly reader lock, described by
 .Fa name .
-Optionally allowing readers to recurse by setting
-.Dv LO_RECURSABLE
-in
-.Fa opts .
 The name description is used solely for debugging purposes.
 This function must be called before any other operations
 on the lock.
+.It Fn rm_init_flags "struct rmlock *rm" "const char *name" "int opts"
+Initialize the rm lock just like the
+.Fn rm_init
+function, but specifying a set of optional flags to alter the
+behaviour of
+.Fa rm ,
+through the
+.Fa opts
+argument.
+It contains one or more of the following flags:
+.Bl -tag -width ".Dv RM_NOWITNESS"
+.It Dv RM_NOWITNESS
+Instruct
+.Xr witness 4
+to ignore this lock.
+.It Dv RM_RECURSE
+Allow threads to recursively acquire exclusive locks for
+.Fa rm .
+.El
 .It Fn rm_rlock "struct rmlock *rm" "struct rm_priotracker* tracker"
 Lock
 .Fa rm

Modified: head/sys/kern/kern_osd.c
==============================================================================
--- head/sys/kern/kern_osd.c	Fri May 29 10:10:23 2009	(r193029)
+++ head/sys/kern/kern_osd.c	Fri May 29 10:52:37 2009	(r193030)
@@ -394,7 +394,7 @@ osd_init(void *arg __unused)
 		osd_nslots[i] = 0;
 		LIST_INIT(&osd_list[i]);
 		sx_init(&osd_module_lock[i], "osd_module");
-		rm_init(&osd_object_lock[i], "osd_object", 0);
+		rm_init(&osd_object_lock[i], "osd_object");
 		mtx_init(&osd_list_lock[i], "osd_list", NULL, MTX_DEF);
 		osd_destructors[i] = NULL;
 		osd_methods[i] = NULL;

Modified: head/sys/kern/kern_rmlock.c
==============================================================================
--- head/sys/kern/kern_rmlock.c	Fri May 29 10:10:23 2009	(r193029)
+++ head/sys/kern/kern_rmlock.c	Fri May 29 10:52:37 2009	(r193030)
@@ -188,14 +188,26 @@ rm_cleanIPI(void *arg)
 }
 
 void
-rm_init(struct rmlock *rm, const char *name, int opts)
+rm_init_flags(struct rmlock *rm, const char *name, int opts)
 {
+	int liflags;
 
+	liflags = 0;
+	if (!(opts & RM_NOWITNESS))
+		liflags |= LO_WITNESS;
+	if (opts & RM_RECURSE)
+		liflags |= LO_RECURSABLE;
 	rm->rm_noreadtoken = 1;
 	LIST_INIT(&rm->rm_activeReaders);
-	mtx_init(&rm->rm_lock, name, "RM_MTX",MTX_NOWITNESS);
-	lock_init(&rm->lock_object, &lock_class_rm, name, NULL,
-	    (opts & LO_RECURSABLE)| LO_WITNESS);
+	mtx_init(&rm->rm_lock, name, "rmlock_mtx", MTX_NOWITNESS);
+	lock_init(&rm->lock_object, &lock_class_rm, name, NULL, liflags);
+}
+
+void
+rm_init(struct rmlock *rm, const char *name)
+{
+
+	rm_init_flags(rm, name, 0);
 }
 
 void
@@ -216,9 +228,17 @@ rm_wowned(struct rmlock *rm)
 void
 rm_sysinit(void *arg)
 {
-
 	struct rm_args *args = arg;
-	rm_init(args->ra_rm, args->ra_desc, args->ra_opts);
+
+	rm_init(args->ra_rm, args->ra_desc);
+}
+
+void
+rm_sysinit_flags(void *arg)
+{
+	struct rm_args_flags *args = arg;
+
+	rm_init_flags(args->ra_rm, args->ra_desc, args->ra_opts);
 }
 
 static void

Modified: head/sys/net/pfil.h
==============================================================================
--- head/sys/net/pfil.h	Fri May 29 10:10:23 2009	(r193029)
+++ head/sys/net/pfil.h	Fri May 29 10:52:37 2009	(r193030)
@@ -95,7 +95,7 @@ struct pfil_head *pfil_head_get(int, u_l
 
 #define	PFIL_HOOKED(p) ((p)->ph_nhooks > 0)
 #define	PFIL_LOCK_INIT(p) \
-    rm_init(&(p)->ph_lock, "PFil hook read/write mutex", LO_RECURSABLE)
+    rm_init_flags(&(p)->ph_lock, "PFil hook read/write mutex", RM_RECURSE)
 #define	PFIL_LOCK_DESTROY(p) rm_destroy(&(p)->ph_lock)
 #define PFIL_RLOCK(p, t) rm_rlock(&(p)->ph_lock, (t))
 #define PFIL_WLOCK(p) rm_wlock(&(p)->ph_lock)

Modified: head/sys/security/mac/mac_framework.c
==============================================================================
--- head/sys/security/mac/mac_framework.c	Fri May 29 10:10:23 2009	(r193029)
+++ head/sys/security/mac/mac_framework.c	Fri May 29 10:52:37 2009	(r193030)
@@ -289,7 +289,7 @@ mac_init(void)
 	mac_labelzone_init();
 
 #ifndef MAC_STATIC
-	rm_init(&mac_policy_rm, "mac_policy_rm", 0);
+	rm_init(&mac_policy_rm, "mac_policy_rm");
 	sx_init(&mac_policy_sx, "mac_policy_sx");
 #endif
 }

Modified: head/sys/sys/rmlock.h
==============================================================================
--- head/sys/sys/rmlock.h	Fri May 29 10:10:23 2009	(r193029)
+++ head/sys/sys/rmlock.h	Fri May 29 10:52:37 2009	(r193030)
@@ -38,10 +38,18 @@
 
 #ifdef _KERNEL
 
-void	rm_init(struct rmlock *rm, const char *name, int opts);
+/*
+ * Flags passed to rm_init(9).
+ */
+#define	RM_NOWITNESS	0x00000001
+#define	RM_RECURSE	0x00000002
+
+void	rm_init(struct rmlock *rm, const char *name);
+void	rm_init_flags(struct rmlock *rm, const char *name, int opts);
 void	rm_destroy(struct rmlock *rm);
 int	rm_wowned(struct rmlock *rm);
 void	rm_sysinit(void *arg);
+void	rm_sysinit_flags(void *arg);
 
 void	_rm_wlock_debug(struct rmlock *rm, const char *file, int line);
 void	_rm_wunlock_debug(struct rmlock *rm, const char *file, int line);
@@ -79,19 +87,35 @@ void	_rm_runlock(struct rmlock *rm,  str
 struct rm_args {
 	struct rmlock	*ra_rm;
 	const char 	*ra_desc;
+};
+
+struct rm_args_flags {
+	struct rmlock	*ra_rm;
+	const char 	*ra_desc;
 	int		ra_opts;
 };
 
-#define	RM_SYSINIT(name, rm, desc, opts)       				\
+#define	RM_SYSINIT(name, rm, desc)       				\
 	static struct rm_args name##_args = {				\
 		(rm),							\
 		(desc),							\
-                (opts),							\
 	};								\
 	SYSINIT(name##_rm_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE,	\
 	    rm_sysinit, &name##_args);					\
 	SYSUNINIT(name##_rm_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE,	\
 	    rm_destroy, (rm))
 
+
+#define	RM_SYSINIT_FLAGS(name, rm, desc, opts)       			\
+	static struct rm_args name##_args = {				\
+		(rm),							\
+		(desc),							\
+                (opts),							\
+	};								\
+	SYSINIT(name##_rm_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE,	\
+	    rm_sysinit_flags, &name##_args);				\
+	SYSUNINIT(name##_rm_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE,	\
+	    rm_destroy, (rm))
+
 #endif /* _KERNEL */
 #endif /* !_SYS_RMLOCK_H_ */

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 11:57:44 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B43DF106568C;
	Fri, 29 May 2009 11:57:44 +0000 (UTC)
	(envelope-from asmrookie@gmail.com)
Received: from mail-fx0-f159.google.com (mail-fx0-f159.google.com
	[209.85.220.159])
	by mx1.freebsd.org (Postfix) with ESMTP id BC7D38FC19;
	Fri, 29 May 2009 11:57:43 +0000 (UTC)
	(envelope-from asmrookie@gmail.com)
Received: by fxm3 with SMTP id 3so1459665fxm.43
	for ; Fri, 29 May 2009 04:57:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:sender:received:in-reply-to
	:references:date:x-google-sender-auth:message-id:subject:from:to:cc
	:content-type:content-transfer-encoding;
	bh=GGihnm41lOgg8MrPVQSAt2BLk32xdTQKpbjlqeSt7zU=;
	b=bvOVrlf3F3Kj7rYLcpZ2WmztlmJ5rFYnjZWfXqfeNKiqMtxOULbF9SjmRkkNM8JSlb
	rCFjAJ+3I9kCaToxDFIyjpA5tiocLDLktKUJs3DeaiB+i0g5fsSrKieAvhUKDE+h4Jb8
	K7IdPR6jCj7wZIpPFEON41qXYyg3wEWIWIY8I=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	b=TH54EpCUzWrS9i0gYf0qrV5NCiOCmznv3iUOdGi1KaZtZR50T1jFFestMiMEe7tw4C
	iqClrlU7e/VHuCeTbzwz/UEwT5aQ3lE749wP1oFHslxUMM9zAF28OY4+cW57JtZ3t6SI
	bVNeK2l95oBI19iy7yO5AS/bOiotkOVllSmrA=
MIME-Version: 1.0
Sender: asmrookie@gmail.com
Received: by 10.223.119.5 with SMTP id x5mr1978145faq.40.1243598262755; Fri, 
	29 May 2009 04:57:42 -0700 (PDT)
In-Reply-To: <200905291052.n4TAqc5q072775@svn.freebsd.org>
References: <200905291052.n4TAqc5q072775@svn.freebsd.org>
Date: Fri, 29 May 2009 13:57:42 +0200
X-Google-Sender-Auth: c37ae948f9dfbe42
Message-ID: <3bbf2fe10905290457k7a00616dj43fc67a75d4a12b7@mail.gmail.com>
From: Attilio Rao 
To: Robert Watson 
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r193030 - in head: share/man/man9 sys/kern sys/net 
	sys/security/mac sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 11:57:45 -0000

2009/5/29 Robert Watson :
> Author: rwatson
> Date: Fri May 29 10:52:37 2009
> New Revision: 193030
> URL: http://svn.freebsd.org/changeset/base/193030
>
> Log:
>  Make the rmlock(9) interface a bit more like the rwlock(9) interface:
>
>  - Add rm_init_flags() and accept extended options only for that variation.
>  - Add a flags space specifically for rm_init_flags(), rather than borrowing
>    the lock_init() flag space.
>  - Define flag RM_RECURSE to use instead of LO_RECURSABLE.
>  - Define flag RM_NOWITNESS to allow an rmlock to be exempt from WITNESS
>    checking; this wasn't possible previously as rm_init() always passed
>    LO_WITNESS when initializing an rmlock's struct lock.
>  - Add RM_SYSINIT_FLAGS().
>  - Rename embedded mutex in rmlocks to make it more obvious what it is.
>  - Update consumers.
>  - Update man page.

Thanks!

Attilio


-- 
Peace can only be achieved by understanding - A. Einstein

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 12:33:00 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8EE5B106567A;
	Fri, 29 May 2009 12:33:00 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 625C18FC0C;
	Fri, 29 May 2009 12:33:00 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from fledge.watson.org (fledge.watson.org [65.122.17.41])
	by cyrus.watson.org (Postfix) with ESMTPS id B0A9F46B06;
	Fri, 29 May 2009 08:32:59 -0400 (EDT)
Date: Fri, 29 May 2009 13:32:59 +0100 (BST)
From: Robert Watson 
X-X-Sender: robert@fledge.watson.org
To: Attilio Rao 
In-Reply-To: <3bbf2fe10905290457k7a00616dj43fc67a75d4a12b7@mail.gmail.com>
Message-ID: 
References: <200905291052.n4TAqc5q072775@svn.freebsd.org>
	<3bbf2fe10905290457k7a00616dj43fc67a75d4a12b7@mail.gmail.com>
User-Agent: Alpine 2.00 (BSF 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r193030 - in head: share/man/man9 sys/kern sys/net
 sys/security/mac sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 12:33:01 -0000

On Fri, 29 May 2009, Attilio Rao wrote:

>>  Make the rmlock(9) interface a bit more like the rwlock(9) interface:
>>
>>  - Add rm_init_flags() and accept extended options only for that variation.
>>  - Add a flags space specifically for rm_init_flags(), rather than borrowing
>>    the lock_init() flag space.
>>  - Define flag RM_RECURSE to use instead of LO_RECURSABLE.
>>  - Define flag RM_NOWITNESS to allow an rmlock to be exempt from WITNESS
>>    checking; this wasn't possible previously as rm_init() always passed
>>    LO_WITNESS when initializing an rmlock's struct lock.
>>  - Add RM_SYSINIT_FLAGS().
>>  - Rename embedded mutex in rmlocks to make it more obvious what it is.
>>  - Update consumers.
>>  - Update man page.
>
> Thanks!

There's quite a bit more to be done with rmlocks -- among other things, lock 
assertion support is quite incomplete, and it needs to integrate with WITNESS 
better.  I probably don't have time to work on this, but perhaps for someone 
with a bit more experience with our locking primitives it would prove straight 
forward? :-)

Robert N M Watson
Computer Laboratory
University of Cambridge

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 13:36:06 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9CFDB10656B3;
	Fri, 29 May 2009 13:36:06 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8926F8FC17;
	Fri, 29 May 2009 13:36:06 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TDa6Ua076088;
	Fri, 29 May 2009 13:36:06 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TDa66k076084;
	Fri, 29 May 2009 13:36:06 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <200905291336.n4TDa66k076084@svn.freebsd.org>
From: Adrian Chadd 
Date: Fri, 29 May 2009 13:36:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193032 - in head/sys: conf i386/include/xen i386/xen
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 13:36:07 -0000

Author: adrian
Date: Fri May 29 13:36:06 2009
New Revision: 193032
URL: http://svn.freebsd.org/changeset/base/193032

Log:
  Migrate the Xen hypervisor clock reading routines into something
  sharable.

Added:
  head/sys/i386/include/xen/xen_clock_util.h   (contents, props changed)
  head/sys/i386/xen/xen_clock_util.c   (contents, props changed)
Modified:
  head/sys/conf/files.i386
  head/sys/i386/xen/xen_rtc.c

Modified: head/sys/conf/files.i386
==============================================================================
--- head/sys/conf/files.i386	Fri May 29 12:50:35 2009	(r193031)
+++ head/sys/conf/files.i386	Fri May 29 13:36:06 2009	(r193032)
@@ -327,6 +327,7 @@ i386/isa/atpic.c		optional atpic	
 #i386/isa/atpic_vector.s		standard
 i386/isa/clock.c		optional native
 i386/xen/clock.c		optional xen
+i386/xen/xen_clock_util.c	optional xen
 i386/xen/xen_rtc.c		optional xen
 i386/isa/dpms.c			optional dpms
 i386/isa/elcr.c			standard

Added: head/sys/i386/include/xen/xen_clock_util.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/i386/include/xen/xen_clock_util.h	Fri May 29 13:36:06 2009	(r193032)
@@ -0,0 +1,38 @@
+/*
+ *
+ * Copyright (c) 2009 Adrian Chadd
+ * 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.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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	__XEN_CLOCK_UTIL_H__
+#define	__XEN_CLOCK_UTIL_H__
+
+extern void xen_fetch_wallclock(struct timespec *ts);
+extern void xen_fetch_uptime(struct timespec *ts);
+
+#endif	/* __XEN_CLOCK_UTIL_H__ */

Added: head/sys/i386/xen/xen_clock_util.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/i386/xen/xen_clock_util.c	Fri May 29 13:36:06 2009	(r193032)
@@ -0,0 +1,101 @@
+/*-
+ * Copyright (c) 2009 Adrian Chadd
+ * 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.
+ *
+ * $FreeBSD$
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+/*
+ * Read the current hypervisor start time (wall clock) from Xen.
+ */
+void
+xen_fetch_wallclock(struct timespec *ts)
+{ 
+        shared_info_t *s = HYPERVISOR_shared_info;
+        uint32_t ts_version;
+   
+        do {
+                ts_version = s->wc_version;
+                rmb();
+                ts->tv_sec  = s->wc_sec;
+                ts->tv_nsec = s->wc_nsec;
+                rmb();
+        }
+        while ((s->wc_version & 1) | (ts_version ^ s->wc_version));
+}
+
+/*
+ * Read the current hypervisor system uptime value from Xen.
+ */
+void
+xen_fetch_uptime(struct timespec *ts)
+{
+        shared_info_t           *s = HYPERVISOR_shared_info;
+        struct vcpu_time_info   *src;
+	struct shadow_time_info	dst;
+        uint32_t pre_version, post_version;
+        
+        src = &s->vcpu_info[smp_processor_id()].time;
+
+        spinlock_enter();
+        do {
+                pre_version = dst.version = src->version;
+                rmb();
+                dst.system_timestamp  = src->system_time;
+                rmb();
+                post_version = src->version;
+        }
+        while ((pre_version & 1) | (pre_version ^ post_version));
+
+        spinlock_exit();
+
+	ts->tv_sec = dst.system_timestamp / 1000000000;
+	ts->tv_nsec = dst.system_timestamp % 1000000000;
+}

Modified: head/sys/i386/xen/xen_rtc.c
==============================================================================
--- head/sys/i386/xen/xen_rtc.c	Fri May 29 12:50:35 2009	(r193031)
+++ head/sys/i386/xen/xen_rtc.c	Fri May 29 13:36:06 2009	(r193032)
@@ -50,56 +50,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "clock_if.h"
-
-/*
- * Read the current hypervisor start time (wall clock) from Xen.
- */
-static void
-xen_fetch_wallclock(struct timespec *ts)
-{ 
-        shared_info_t *s = HYPERVISOR_shared_info;
-        uint32_t ts_version;
-   
-        do {
-                ts_version = s->wc_version;
-                rmb();
-                ts->tv_sec  = s->wc_sec;
-                ts->tv_nsec = s->wc_nsec;
-                rmb();
-        }
-        while ((s->wc_version & 1) | (ts_version ^ s->wc_version));
-}
-
-/*
- * Read the current hypervisor system uptime value from Xen.
- */
-static void
-xen_fetch_uptime(struct timespec *ts)
-{
-        shared_info_t           *s = HYPERVISOR_shared_info;
-        struct vcpu_time_info   *src;
-	struct shadow_time_info	dst;
-        uint32_t pre_version, post_version;
-        
-        src = &s->vcpu_info[smp_processor_id()].time;
-
-        spinlock_enter();
-        do {
-                pre_version = dst.version = src->version;
-                rmb();
-                dst.system_timestamp  = src->system_time;
-                rmb();
-                post_version = src->version;
-        }
-        while ((pre_version & 1) | (pre_version ^ post_version));
-
-        spinlock_exit();
-
-	ts->tv_sec = dst.system_timestamp / 1000000000;
-	ts->tv_nsec = dst.system_timestamp % 1000000000;
-}
+#include 
 
+#include "clock_if.h"
 
 static int
 xen_rtc_probe(device_t dev)

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 13:43:21 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E3DB7106564A;
	Fri, 29 May 2009 13:43:21 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B7EB18FC1F;
	Fri, 29 May 2009 13:43:21 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TDhLSS076259;
	Fri, 29 May 2009 13:43:21 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TDhLB9076258;
	Fri, 29 May 2009 13:43:21 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <200905291343.n4TDhLB9076258@svn.freebsd.org>
From: Adrian Chadd 
Date: Fri, 29 May 2009 13:43:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193033 - head/sys/i386/xen
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 13:43:22 -0000

Author: adrian
Date: Fri May 29 13:43:21 2009
New Revision: 193033
URL: http://svn.freebsd.org/changeset/base/193033

Log:
  Fix the Xen TOD update when the hypervisor wall clock is nudged.
  
  The "wall clock" in the current code is actually the hypervisor start time.
  The time of day is the "start time" plus the hypervisor "uptime".
  
  Large enough bumps in the dom0 clock lead to a hypervisor "bump" which is
  implemented as a bump in the start time, not the uptime. The clock.c routines
  were reading in the hypervisor start time and then using this as the TOD.
  This meant that any hypervisor time bump would cause the FreeBSD DomU to
  set its TOD to the hypervisor start time, rather than the actual TOD.
  
  This fix is a bit hacky and some reshuffling should be done later on
  to clarify what is going on. I've left the wall clock code alone.
  (The code which updates shadow_tv and shadow_tv_version.)
  A new routine adds the uptime to the shadow_tv, which is then used to
  update the TOD.
  
  I've included some debugging so it is obvious when the clock is nudged.
  
  PR:	135008

Modified:
  head/sys/i386/xen/clock.c

Modified: head/sys/i386/xen/clock.c
==============================================================================
--- head/sys/i386/xen/clock.c	Fri May 29 13:36:06 2009	(r193032)
+++ head/sys/i386/xen/clock.c	Fri May 29 13:43:21 2009	(r193033)
@@ -87,6 +87,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 /*
  * 32-bit time_t's can't reach leap years before 1904 or after 2036, so we
@@ -236,6 +237,15 @@ static void update_wallclock(void)
 
 }
 
+static void
+add_uptime_to_wallclock(void)
+{
+	struct timespec ut;
+
+	xen_fetch_uptime(&ut);
+	timespecadd(&shadow_tv, &ut);
+}
+
 /*
  * Reads a consistent set of time-base values from Xen, into a shadow data
  * area. Must be called with the xtime_lock held for writing.
@@ -331,7 +341,9 @@ clkintr(void *arg)
 	 */
 	
 	if (shadow_tv_version != HYPERVISOR_shared_info->wc_version) {
+		printf("[XEN] hypervisor wallclock nudged; nudging TOD.\n");
 		update_wallclock();
+		add_uptime_to_wallclock();
 		tc_setclock(&shadow_tv);
 	}
 	
@@ -542,6 +554,7 @@ domu_inittodr(time_t base)
 	struct timespec ts;
 
 	update_wallclock();
+	add_uptime_to_wallclock();
 	
 	RTC_LOCK;
 	
@@ -591,6 +604,7 @@ domu_resettodr(void)
 		op.u.settime.system_time = shadow->system_timestamp;
 		HYPERVISOR_dom0_op(&op);
 		update_wallclock();
+		add_uptime_to_wallclock();
 	} else if (independent_wallclock) {
 		/* notyet */
 		;

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 13:48:42 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E4AF11065674;
	Fri, 29 May 2009 13:48:42 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D293E8FC1F;
	Fri, 29 May 2009 13:48:42 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TDmghY076413;
	Fri, 29 May 2009 13:48:42 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TDmgTO076412;
	Fri, 29 May 2009 13:48:42 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <200905291348.n4TDmgTO076412@svn.freebsd.org>
From: Adrian Chadd 
Date: Fri, 29 May 2009 13:48:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193034 - head/sys/i386/include/xen
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 13:48:43 -0000

Author: adrian
Date: Fri May 29 13:48:42 2009
New Revision: 193034
URL: http://svn.freebsd.org/changeset/base/193034

Log:
  Revert to 2-clause.

Modified:
  head/sys/i386/include/xen/xen_clock_util.h

Modified: head/sys/i386/include/xen/xen_clock_util.h
==============================================================================
--- head/sys/i386/include/xen/xen_clock_util.h	Fri May 29 13:43:21 2009	(r193033)
+++ head/sys/i386/include/xen/xen_clock_util.h	Fri May 29 13:48:42 2009	(r193034)
@@ -11,8 +11,6 @@
  * 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.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 13:56:35 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0AECE1065709;
	Fri, 29 May 2009 13:56:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D1D378FC13;
	Fri, 29 May 2009 13:56:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TDuYXa076615;
	Fri, 29 May 2009 13:56:34 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TDuYaP076613;
	Fri, 29 May 2009 13:56:34 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200905291356.n4TDuYaP076613@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 29 May 2009 13:56:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193035 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 13:56:36 -0000

Author: jhb
Date: Fri May 29 13:56:34 2009
New Revision: 193035
URL: http://svn.freebsd.org/changeset/base/193035

Log:
  Tweak a few comments on adaptive spinning.

Modified:
  head/sys/kern/kern_mutex.c
  head/sys/kern/kern_rwlock.c

Modified: head/sys/kern/kern_mutex.c
==============================================================================
--- head/sys/kern/kern_mutex.c	Fri May 29 13:48:42 2009	(r193034)
+++ head/sys/kern/kern_mutex.c	Fri May 29 13:56:34 2009	(r193035)
@@ -399,8 +399,11 @@ _mtx_lock_sleep(struct mtx *m, uintptr_t
 
 #ifdef ADAPTIVE_MUTEXES
 		/*
-		 * If the current owner of the lock is executing on another
-		 * CPU quit the hard path and try to spin.
+		 * The current lock owner might have started executing
+		 * on another CPU (or the lock could have changed
+		 * owners) while we were waiting on the turnstile
+		 * chain lock.  If so, drop the turnstile lock and try
+		 * again.
 		 */
 		owner = (struct thread *)(v & ~MTX_FLAGMASK);
 		if (TD_IS_RUNNING(owner)) {

Modified: head/sys/kern/kern_rwlock.c
==============================================================================
--- head/sys/kern/kern_rwlock.c	Fri May 29 13:48:42 2009	(r193034)
+++ head/sys/kern/kern_rwlock.c	Fri May 29 13:56:34 2009	(r193035)
@@ -412,8 +412,11 @@ _rw_rlock(struct rwlock *rw, const char 
 
 #ifdef ADAPTIVE_RWLOCKS
 		/*
-		 * If the current owner of the lock is executing on another
-		 * CPU quit the hard path and try to spin.
+		 * The current lock owner might have started executing
+		 * on another CPU (or the lock could have changed
+		 * owners) while we were waiting on the turnstile
+		 * chain lock.  If so, drop the turnstile lock and try
+		 * again.
 		 */
 		if ((v & RW_LOCK_READ) == 0) {
 			owner = (struct thread *)RW_OWNER(v);
@@ -714,8 +717,11 @@ _rw_wlock_hard(struct rwlock *rw, uintpt
 
 #ifdef ADAPTIVE_RWLOCKS
 		/*
-		 * If the current owner of the lock is executing on another
-		 * CPU quit the hard path and try to spin.
+		 * The current lock owner might have started executing
+		 * on another CPU (or the lock could have changed
+		 * owners) while we were waiting on the turnstile
+		 * chain lock.  If so, drop the turnstile lock and try
+		 * again.
 		 */
 		if (!(v & RW_LOCK_READ)) {
 			owner = (struct thread *)RW_OWNER(v);

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 14:03:34 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D933F1065725;
	Fri, 29 May 2009 14:03:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BD7AD8FC24;
	Fri, 29 May 2009 14:03:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TE3Yf7076842;
	Fri, 29 May 2009 14:03:34 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TE3YiR076840;
	Fri, 29 May 2009 14:03:34 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200905291403.n4TE3YiR076840@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 29 May 2009 14:03:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193037 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 14:03:35 -0000

Author: jhb
Date: Fri May 29 14:03:34 2009
New Revision: 193037
URL: http://svn.freebsd.org/changeset/base/193037

Log:
  Remove extra cpu_spinwait() invocations.  This should really only be used
  in tight spin loops, not in these edge cases where we restart a much
  larger loop only a few times.
  
  Reviewed by:	attilio

Modified:
  head/sys/kern/kern_mutex.c
  head/sys/kern/kern_rwlock.c

Modified: head/sys/kern/kern_mutex.c
==============================================================================
--- head/sys/kern/kern_mutex.c	Fri May 29 14:02:45 2009	(r193036)
+++ head/sys/kern/kern_mutex.c	Fri May 29 14:03:34 2009	(r193037)
@@ -393,7 +393,6 @@ _mtx_lock_sleep(struct mtx *m, uintptr_t
 		 */
 		if (v == MTX_UNOWNED) {
 			turnstile_cancel(ts);
-			cpu_spinwait();
 			continue;
 		}
 
@@ -408,7 +407,6 @@ _mtx_lock_sleep(struct mtx *m, uintptr_t
 		owner = (struct thread *)(v & ~MTX_FLAGMASK);
 		if (TD_IS_RUNNING(owner)) {
 			turnstile_cancel(ts);
-			cpu_spinwait();
 			continue;
 		}
 #endif
@@ -421,7 +419,6 @@ _mtx_lock_sleep(struct mtx *m, uintptr_t
 		if ((v & MTX_CONTESTED) == 0 &&
 		    !atomic_cmpset_ptr(&m->mtx_lock, v, v | MTX_CONTESTED)) {
 			turnstile_cancel(ts);
-			cpu_spinwait();
 			continue;
 		}
 

Modified: head/sys/kern/kern_rwlock.c
==============================================================================
--- head/sys/kern/kern_rwlock.c	Fri May 29 14:02:45 2009	(r193036)
+++ head/sys/kern/kern_rwlock.c	Fri May 29 14:03:34 2009	(r193037)
@@ -350,7 +350,6 @@ _rw_rlock(struct rwlock *rw, const char 
 					    (void *)(v + RW_ONE_READER));
 				break;
 			}
-			cpu_spinwait();
 			continue;
 		}
 		lock_profile_obtain_lock_failed(&rw->lock_object,
@@ -406,7 +405,6 @@ _rw_rlock(struct rwlock *rw, const char 
 		v = rw->rw_lock;
 		if (RW_CAN_READ(v)) {
 			turnstile_cancel(ts);
-			cpu_spinwait();
 			continue;
 		}
 
@@ -422,7 +420,6 @@ _rw_rlock(struct rwlock *rw, const char 
 			owner = (struct thread *)RW_OWNER(v);
 			if (TD_IS_RUNNING(owner)) {
 				turnstile_cancel(ts);
-				cpu_spinwait();
 				continue;
 			}
 		}
@@ -443,7 +440,6 @@ _rw_rlock(struct rwlock *rw, const char 
 			if (!atomic_cmpset_ptr(&rw->rw_lock, v,
 			    v | RW_LOCK_READ_WAITERS)) {
 				turnstile_cancel(ts);
-				cpu_spinwait();
 				continue;
 			}
 			if (LOCK_LOG_TEST(&rw->lock_object, 0))
@@ -695,7 +691,6 @@ _rw_wlock_hard(struct rwlock *rw, uintpt
 			if (!(v & RW_LOCK_WRITE_SPINNER)) {
 				if (!atomic_cmpset_ptr(&rw->rw_lock, v,
 				    v | RW_LOCK_WRITE_SPINNER)) {
-					cpu_spinwait();
 					continue;
 				}
 			}
@@ -727,7 +722,6 @@ _rw_wlock_hard(struct rwlock *rw, uintpt
 			owner = (struct thread *)RW_OWNER(v);
 			if (TD_IS_RUNNING(owner)) {
 				turnstile_cancel(ts);
-				cpu_spinwait();
 				continue;
 			}
 		}
@@ -750,7 +744,6 @@ _rw_wlock_hard(struct rwlock *rw, uintpt
 				break;
 			}
 			turnstile_cancel(ts);
-			cpu_spinwait();
 			continue;
 		}
 		/*
@@ -762,7 +755,6 @@ _rw_wlock_hard(struct rwlock *rw, uintpt
 			if (!atomic_cmpset_ptr(&rw->rw_lock, v,
 			    v | RW_LOCK_WRITE_WAITERS)) {
 				turnstile_cancel(ts);
-				cpu_spinwait();
 				continue;
 			}
 			if (LOCK_LOG_TEST(&rw->lock_object, 0))

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 14:20:11 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 46CB610656C3;
	Fri, 29 May 2009 14:20:11 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 359278FC25;
	Fri, 29 May 2009 14:20:11 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TEKBmM077257;
	Fri, 29 May 2009 14:20:11 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TEKB5N077256;
	Fri, 29 May 2009 14:20:11 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200905291420.n4TEKB5N077256@svn.freebsd.org>
From: Robert Watson 
Date: Fri, 29 May 2009 14:20:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193038 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 14:20:11 -0000

Author: rwatson
Date: Fri May 29 14:20:10 2009
New Revision: 193038
URL: http://svn.freebsd.org/changeset/base/193038

Log:
  Since sched_pin() and sched_unpin() are already inlined, don't manually
  inline in rmlocks.

Modified:
  head/sys/kern/kern_rmlock.c

Modified: head/sys/kern/kern_rmlock.c
==============================================================================
--- head/sys/kern/kern_rmlock.c	Fri May 29 14:03:34 2009	(r193037)
+++ head/sys/kern/kern_rmlock.c	Fri May 29 14:20:10 2009	(r193038)
@@ -327,7 +327,7 @@ _rm_rlock(struct rmlock *rm, struct rm_p
 
 	rm_tracker_add(pc, tracker);
 
-	td->td_pinned++; /*  sched_pin(); */
+	sched_pin();
 
 	compiler_memory_barrier();
 
@@ -387,7 +387,7 @@ _rm_runlock(struct rmlock *rm, struct rm
 	pc = cpuid_to_pcpu[td->td_oncpu]; /* pcpu_find(td->td_oncpu); */
 	rm_tracker_remove(pc, tracker);
 	td->td_critnest--;
-	td->td_pinned--; /*  sched_unpin(); */
+	sched_unpin();
 
 	if (0 == (td->td_owepreempt | tracker->rmp_flags))
 		return;

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 14:25:52 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0CC3A10656C3;
	Fri, 29 May 2009 14:25:52 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EF65F8FC20;
	Fri, 29 May 2009 14:25:51 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TEPpUO077441;
	Fri, 29 May 2009 14:25:51 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TEPp7K077440;
	Fri, 29 May 2009 14:25:51 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200905291425.n4TEPp7K077440@svn.freebsd.org>
From: Robert Watson 
Date: Fri, 29 May 2009 14:25:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193039 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 14:25:52 -0000

Author: rwatson
Date: Fri May 29 14:25:51 2009
New Revision: 193039
URL: http://svn.freebsd.org/changeset/base/193039

Log:
  Minor style tweak.

Modified:
  head/sys/kern/kern_rmlock.c

Modified: head/sys/kern/kern_rmlock.c
==============================================================================
--- head/sys/kern/kern_rmlock.c	Fri May 29 14:20:10 2009	(r193038)
+++ head/sys/kern/kern_rmlock.c	Fri May 29 14:25:51 2009	(r193039)
@@ -527,7 +527,8 @@ _rm_rlock_debug(struct rmlock *rm, struc
 
 void
 _rm_runlock_debug(struct rmlock *rm,  struct rm_priotracker *tracker,
-    const char *file, int line) {
+    const char *file, int line)
+{
 
 	_rm_runlock(rm, tracker);
 }

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 15:00:04 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B2E461065690;
	Fri, 29 May 2009 15:00:04 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 994D78FC1D;
	Fri, 29 May 2009 15:00:04 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TF04Ig078213;
	Fri, 29 May 2009 15:00:04 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TF04HM078212;
	Fri, 29 May 2009 15:00:04 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <200905291500.n4TF04HM078212@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Fri, 29 May 2009 15:00:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193041 - head/sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 15:00:05 -0000

Author: trasz
Date: Fri May 29 15:00:04 2009
New Revision: 193041
URL: http://svn.freebsd.org/changeset/base/193041

Log:
  There is only one spare MNT_ flag left, and I want to use it for NFSv4 ACLs.
  Make room for additional filesystem flags now, to avoid breaking ABI later.
  
  Reviewed by:	kib@

Modified:
  head/sys/sys/mount.h

Modified: head/sys/sys/mount.h
==============================================================================
--- head/sys/sys/mount.h	Fri May 29 14:42:02 2009	(r193040)
+++ head/sys/sys/mount.h	Fri May 29 15:00:04 2009	(r193041)
@@ -167,6 +167,7 @@ struct mount {
 	int		mnt_writeopcount;	/* (i) write syscalls pending */
 	int		mnt_kern_flag;		/* (i) kernel only flags */
 	u_int		mnt_flag;		/* (i) flags shared with user */
+	u_int		mnt_xflag;		/* (i) more flags shared with user */
 	u_int		mnt_noasync;		/* (i) # noasync overrides */
 	struct vfsoptlist *mnt_opt;		/* current mount options */
 	struct vfsoptlist *mnt_optnew;		/* new options passed to fs */
@@ -221,7 +222,7 @@ void          __mnt_vnode_markerfree(str
 #endif /* _KERNEL */
 
 /*
- * User specifiable flags.
+ * User specifiable flags, stored in mnt_flag.
  */
 #define	MNT_RDONLY	0x00000001	/* read only filesystem */
 #define	MNT_SYNCHRONOUS	0x00000002	/* filesystem written synchronously */

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 15:48:44 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 00B9A106567A;
	Fri, 29 May 2009 15:48:44 +0000 (UTC)
	(envelope-from scottl@samsco.org)
Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57])
	by mx1.freebsd.org (Postfix) with ESMTP id A2D4A8FC1B;
	Fri, 29 May 2009 15:48:43 +0000 (UTC)
	(envelope-from scottl@samsco.org)
Received: from phobos.local (pooker.samsco.org [168.103.85.57])
	by pooker.samsco.org (8.14.2/8.14.2) with ESMTP id n4TFmagI060241;
	Fri, 29 May 2009 09:48:36 -0600 (MDT)
	(envelope-from scottl@samsco.org)
Message-ID: <4A2003D4.2010607@samsco.org>
Date: Fri, 29 May 2009 09:48:36 -0600
From: Scott Long 
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US;
	rv:1.8.1.13) Gecko/20080313 SeaMonkey/1.1.9
MIME-Version: 1.0
To: Edward Tomasz Napierala 
References: <200905291500.n4TF04HM078212@svn.freebsd.org>
In-Reply-To: <200905291500.n4TF04HM078212@svn.freebsd.org>
X-Enigmail-Version: 0.95.6
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-4.5 required=3.8 tests=ALL_TRUSTED,AWL,BAYES_00
	autolearn=ham version=3.1.8
X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on pooker.samsco.org
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r193041 - head/sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 15:48:44 -0000

Occasionally it's useful to be able to run older binaries on newer 
kernels.  One particularly useful place is for making releases.  Does
this change to struct mount break that?  If so, could there be any other
way to achieve what you want without the breakage?

Scott


Edward Tomasz Napierala wrote:
> Author: trasz
> Date: Fri May 29 15:00:04 2009
> New Revision: 193041
> URL: http://svn.freebsd.org/changeset/base/193041
> 
> Log:
>   There is only one spare MNT_ flag left, and I want to use it for NFSv4 ACLs.
>   Make room for additional filesystem flags now, to avoid breaking ABI later.
>   
>   Reviewed by:	kib@
> 
> Modified:
>   head/sys/sys/mount.h
> 
> Modified: head/sys/sys/mount.h
> ==============================================================================
> --- head/sys/sys/mount.h	Fri May 29 14:42:02 2009	(r193040)
> +++ head/sys/sys/mount.h	Fri May 29 15:00:04 2009	(r193041)
> @@ -167,6 +167,7 @@ struct mount {
>  	int		mnt_writeopcount;	/* (i) write syscalls pending */
>  	int		mnt_kern_flag;		/* (i) kernel only flags */
>  	u_int		mnt_flag;		/* (i) flags shared with user */
> +	u_int		mnt_xflag;		/* (i) more flags shared with user */
>  	u_int		mnt_noasync;		/* (i) # noasync overrides */
>  	struct vfsoptlist *mnt_opt;		/* current mount options */
>  	struct vfsoptlist *mnt_optnew;		/* new options passed to fs */
> @@ -221,7 +222,7 @@ void          __mnt_vnode_markerfree(str
>  #endif /* _KERNEL */
>  
>  /*
> - * User specifiable flags.
> + * User specifiable flags, stored in mnt_flag.
>   */
>  #define	MNT_RDONLY	0x00000001	/* read only filesystem */
>  #define	MNT_SYNCHRONOUS	0x00000002	/* filesystem written synchronously */


From owner-svn-src-head@FreeBSD.ORG  Fri May 29 16:04:23 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4AC44106567B;
	Fri, 29 May 2009 16:04:23 +0000 (UTC)
	(envelope-from asmrookie@gmail.com)
Received: from mail-bw0-f213.google.com (mail-bw0-f213.google.com
	[209.85.218.213])
	by mx1.freebsd.org (Postfix) with ESMTP id 40C468FC08;
	Fri, 29 May 2009 16:04:22 +0000 (UTC)
	(envelope-from asmrookie@gmail.com)
Received: by bwz9 with SMTP id 9so6331784bwz.43
	for ; Fri, 29 May 2009 09:04:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:sender:received:in-reply-to
	:references:date:x-google-sender-auth:message-id:subject:from:to:cc
	:content-type:content-transfer-encoding;
	bh=E9U+8r/Y2GKNLkF9J8G0iAHWrGVnRxm5sgA1irG36OU=;
	b=Sf10Y3eEU/OJhkDwDCij2HDKkAgsOBYjQoPnqJFn0Keuce1XHxVpmEp0Cf+nJE1PFv
	f3FGpYxpEO0X0716xiitzC42wmqn/gJVM6b6AQzIgwi7xK2d3gNvI5icgxc6yEXtOUgn
	Q7yVuJ4HuzjDGV/9jxyyXcW6diQ3Bk+npRmVY=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:cc:content-type
	:content-transfer-encoding;
	b=u13zmH4HZqLrBZFzFX0oL5wVvY0tnqoi9MtR+miS7LSW/xKKYqtz4h139vFm71XYYH
	xbkqHBxk1T80RLLlvWVmsdZ3d3FRos7Hw7HUXPN5iensLZUEcL8XOWGEUQ5Tp+/bcgId
	tEfOg+yfP94K8oIWdr2BD+LCwHaJzgqjyhZJw=
MIME-Version: 1.0
Sender: asmrookie@gmail.com
Received: by 10.223.117.194 with SMTP id s2mr2138795faq.83.1243613061237; Fri, 
	29 May 2009 09:04:21 -0700 (PDT)
In-Reply-To: <4A2003D4.2010607@samsco.org>
References: <200905291500.n4TF04HM078212@svn.freebsd.org>
	<4A2003D4.2010607@samsco.org>
Date: Fri, 29 May 2009 18:04:21 +0200
X-Google-Sender-Auth: 61117c624aa32867
Message-ID: <3bbf2fe10905290904o14800df2h2881b3e496ca06cc@mail.gmail.com>
From: Attilio Rao 
To: Scott Long 
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, Edward Tomasz Napierala 
Subject: Re: svn commit: r193041 - head/sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 16:04:23 -0000

2009/5/29 Scott Long :
> Occasionally it's useful to be able to run older binaries on newer kernels.
>  One particularly useful place is for making releases.  Does
> this change to struct mount break that?  If so, could there be any other
> way to achieve what you want without the breakage?

The struct mount is only accessible by the kernel so it doesn't break
userspace binary compatibility.

Thanks,
Attilio


-- 
Peace can only be achieved by understanding - A. Einstein

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 16:15:57 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3AEA81065675;
	Fri, 29 May 2009 16:15:57 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2910F8FC1B;
	Fri, 29 May 2009 16:15:57 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TGFvTO079927;
	Fri, 29 May 2009 16:15:57 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TGFvuq079926;
	Fri, 29 May 2009 16:15:57 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200905291615.n4TGFvuq079926@svn.freebsd.org>
From: Andrew Thompson 
Date: Fri, 29 May 2009 16:15:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193042 - head/sys/dev/usb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 16:15:57 -0000

Author: thompsa
Date: Fri May 29 16:15:56 2009
New Revision: 193042
URL: http://svn.freebsd.org/changeset/base/193042

Log:
  Free device strings.
  
  Spotted by:	HPS

Modified:
  head/sys/dev/usb/usb_device.c

Modified: head/sys/dev/usb/usb_device.c
==============================================================================
--- head/sys/dev/usb/usb_device.c	Fri May 29 15:00:04 2009	(r193041)
+++ head/sys/dev/usb/usb_device.c	Fri May 29 16:15:56 2009	(r193042)
@@ -1990,6 +1990,9 @@ usb2_free_device(struct usb_device *udev
 #endif
 
 	/* free device */
+	free(udev->serial, M_USB);
+	free(udev->manufacturer, M_USB);
+	free(udev->product, M_USB);
 	free(udev, M_USB);
 }
 

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 16:24:23 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E33E0106566B;
	Fri, 29 May 2009 16:24:23 +0000 (UTC)
	(envelope-from stas@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B767F8FC1B;
	Fri, 29 May 2009 16:24:23 +0000 (UTC)
	(envelope-from stas@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TGONNu080107;
	Fri, 29 May 2009 16:24:23 GMT (envelope-from stas@svn.freebsd.org)
Received: (from stas@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TGONLo080106;
	Fri, 29 May 2009 16:24:23 GMT (envelope-from stas@svn.freebsd.org)
Message-Id: <200905291624.n4TGONLo080106@svn.freebsd.org>
From: Stanislav Sedov 
Date: Fri, 29 May 2009 16:24:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193043 - head/contrib/ipfilter/lib
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 16:24:24 -0000

Author: stas
Date: Fri May 29 16:24:23 2009
New Revision: 193043
URL: http://svn.freebsd.org/changeset/base/193043

Log:
  - Prevent buffer overflow in IPFilter's load_http function used to load
    ipfilter tables via http by the user-level ippool utility. Previously
    the 1024-byte buffer used to store a http request coudld easily overflow
    if the length of the hostname part of the url passes exceeded 496 bytes. [1]
  - Use snprintf to prevent possieble buffer overflows in future. [2]
  - Do not try to close the descriptor twice on failure. [2]
  
  Reported by:	Maksymilian Arciemowicz  [1]
  Obtained from:	NetBSD CVS [2]
  MFC after:	2 weeks

Modified:
  head/contrib/ipfilter/lib/load_http.c

Modified: head/contrib/ipfilter/lib/load_http.c
==============================================================================
--- head/contrib/ipfilter/lib/load_http.c	Fri May 29 16:15:56 2009	(r193042)
+++ head/contrib/ipfilter/lib/load_http.c	Fri May 29 16:24:23 2009	(r193043)
@@ -14,11 +14,13 @@
 alist_t *
 load_http(char *url)
 {
-	int fd, len, left, port, endhdr, removed;
-	char *s, *t, *u, buffer[1024], *myurl;
+	char *s, *t, *u, buffer[1044], *myurl;
 	alist_t *a, *rtop, *rbot;
 	struct sockaddr_in sin;
 	struct hostent *host;
+	size_t avail;
+	int fd, len, left, port, endhdr, removed;
+	int error;
 
 	/*
 	 * More than this would just be absurd.
@@ -32,7 +34,14 @@ load_http(char *url)
 	rtop = NULL;
 	rbot = NULL;
 
-	sprintf(buffer, "GET %s HTTP/1.0\r\n", url);
+	avail = sizeof(buffer);
+	error = snprintf(buffer, avail, "GET %s HTTP/1.0\r\n", url);
+
+	/*
+	 * error is always less then avail due to the constraint on
+	 * the url length above.
+	 */
+	avail -= error;
 
 	myurl = strdup(url);
 	if (myurl == NULL)
@@ -51,7 +60,11 @@ load_http(char *url)
 	if (u != NULL)
 		s = u + 1;		/* AUTH */
 
-	sprintf(buffer + strlen(buffer), "Host: %s\r\n\r\n", s);
+	error = snprintf(buffer + strlen(buffer), avail, "Host: %s\r\n\r\n", s);
+	if (error >= avail) {
+		fprintf(stderr, "URL is too large: %s\n", url);
+		goto done;
+	}
 
 	u = strchr(s, ':');
 	if (u != NULL) {
@@ -83,16 +96,12 @@ load_http(char *url)
 	if (fd == -1)
 		goto done;
 
-	if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) == -1) {
-		close(fd);
+	if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) == -1)
 		goto done;
-	}
 
 	len = strlen(buffer);
-	if (write(fd, buffer, len) != len) {
-		close(fd);
+	if (write(fd, buffer, len) != len)
 		goto done;
-	}
 
 	s = buffer;
 	endhdr = 0;

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 16:49:45 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7608210656C3;
	Fri, 29 May 2009 16:49:45 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from pin.if.uz.zgora.pl (pin.if.uz.zgora.pl [212.109.128.251])
	by mx1.freebsd.org (Postfix) with ESMTP id 342138FC0C;
	Fri, 29 May 2009 16:49:45 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: by pin.if.uz.zgora.pl (Postfix, from userid 1001)
	id 3B14F39BA2; Fri, 29 May 2009 18:38:00 +0200 (CEST)
Date: Fri, 29 May 2009 18:38:00 +0200
From: Edward Tomasz Napierala 
To: Scott Long 
Message-ID: <20090529163800.GA80773@pin.if.uz.zgora.pl>
References: <200905291500.n4TF04HM078212@svn.freebsd.org>
	<4A2003D4.2010607@samsco.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-2
Content-Disposition: inline
In-Reply-To: <4A2003D4.2010607@samsco.org>
User-Agent: Mutt/1.5.18 (2008-05-17)
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r193041 - head/sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 16:49:46 -0000

On 0529T0948, Scott Long wrote:
> Occasionally it's useful to be able to run older binaries on newer 
> kernels.

Yes, not being able to use mount(8) from FreeBSD 7 on a kernel from
FreeBSD 8 would suck.  ;-)

> One particularly useful place is for making releases.  Does
> this change to struct mount break that?  If so, could there be any other
> way to achieve what you want without the breakage?

No, it doesn't break it.  Also, I think breaking ABI for mount(8)
because of mount flags won't be neccessary anytime soon - for mounting
and unmounting we have nmount(2), which is extensible by definition,
and to display mounted filesystems, mount(8) uses statfs(2), and f_flags
is int64_t already.

> Edward Tomasz Napierala wrote:
> > Author: trasz
> > Date: Fri May 29 15:00:04 2009
> > New Revision: 193041
> > URL: http://svn.freebsd.org/changeset/base/193041
> > 
> > Log:
> >   There is only one spare MNT_ flag left, and I want to use it for NFSv4 ACLs.
> >   Make room for additional filesystem flags now, to avoid breaking ABI later.
> >   
> >   Reviewed by:	kib@
> > 
> > Modified:
> >   head/sys/sys/mount.h
> > 
> > Modified: head/sys/sys/mount.h
> > ==============================================================================
> > --- head/sys/sys/mount.h	Fri May 29 14:42:02 2009	(r193040)
> > +++ head/sys/sys/mount.h	Fri May 29 15:00:04 2009	(r193041)
> > @@ -167,6 +167,7 @@ struct mount {
> >  	int		mnt_writeopcount;	/* (i) write syscalls pending */
> >  	int		mnt_kern_flag;		/* (i) kernel only flags */
> >  	u_int		mnt_flag;		/* (i) flags shared with user */
> > +	u_int		mnt_xflag;		/* (i) more flags shared with user */
> >  	u_int		mnt_noasync;		/* (i) # noasync overrides */
> >  	struct vfsoptlist *mnt_opt;		/* current mount options */
> >  	struct vfsoptlist *mnt_optnew;		/* new options passed to fs */
> > @@ -221,7 +222,7 @@ void          __mnt_vnode_markerfree(str
> >  #endif /* _KERNEL */
> >  
> >  /*
> > - * User specifiable flags.
> > + * User specifiable flags, stored in mnt_flag.
> >   */
> >  #define	MNT_RDONLY	0x00000001	/* read only filesystem */
> >  #define	MNT_SYNCHRONOUS	0x00000002	/* filesystem written synchronously */
> 

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


From owner-svn-src-head@FreeBSD.ORG  Fri May 29 18:10:38 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 78F3F1065676;
	Fri, 29 May 2009 18:10:38 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 18EB78FC1C;
	Fri, 29 May 2009 18:10:38 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from fledge.watson.org (fledge.watson.org [65.122.17.41])
	by cyrus.watson.org (Postfix) with ESMTPS id B34AA46B66;
	Fri, 29 May 2009 14:10:37 -0400 (EDT)
Date: Fri, 29 May 2009 19:10:37 +0100 (BST)
From: Robert Watson 
X-X-Sender: robert@fledge.watson.org
To: Attilio Rao 
In-Reply-To: <3bbf2fe10905290904o14800df2h2881b3e496ca06cc@mail.gmail.com>
Message-ID: 
References: <200905291500.n4TF04HM078212@svn.freebsd.org>
	<4A2003D4.2010607@samsco.org>
	<3bbf2fe10905290904o14800df2h2881b3e496ca06cc@mail.gmail.com>
User-Agent: Alpine 2.00 (BSF 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@freebsd.org, Scott Long ,
	src-committers@freebsd.org, Edward Tomasz Napierala ,
	svn-src-all@freebsd.org
Subject: Re: svn commit: r193041 - head/sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 18:10:39 -0000

On Fri, 29 May 2009, Attilio Rao wrote:

> 2009/5/29 Scott Long :
>> Occasionally it's useful to be able to run older binaries on newer kernels.
>>  One particularly useful place is for making releases.  Does this change to 
>> struct mount break that?  If so, could there be any other way to achieve 
>> what you want without the breakage?
>
> The struct mount is only accessible by the kernel so it doesn't break 
> userspace binary compatibility.

However, __FreeBSD_version does need to be bumped and UPDATING updated, since 
this change will break file system modules compiled against kernels using 
older versions of struct mount.

Robert N M Watson
Computer Laboratory
University of Cambridge

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 18:35:52 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3387D106564A;
	Fri, 29 May 2009 18:35:52 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 07C808FC27;
	Fri, 29 May 2009 18:35:52 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TIZpZM082883;
	Fri, 29 May 2009 18:35:51 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TIZpIQ082882;
	Fri, 29 May 2009 18:35:51 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <200905291835.n4TIZpIQ082882@svn.freebsd.org>
From: Alan Cox 
Date: Fri, 29 May 2009 18:35:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193044 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 18:35:52 -0000

Author: alc
Date: Fri May 29 18:35:51 2009
New Revision: 193044
URL: http://svn.freebsd.org/changeset/base/193044

Log:
  Modify vm_hold_load_pages() to allocate pages using VM_ALLOC_NOOBJ rather
  than using the kernel object.  This allows the elimination of page queues
  locking from vm_hold_free_pages().

Modified:
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/vfs_bio.c
==============================================================================
--- head/sys/kern/vfs_bio.c	Fri May 29 16:24:23 2009	(r193043)
+++ head/sys/kern/vfs_bio.c	Fri May 29 18:35:51 2009	(r193044)
@@ -3796,30 +3796,25 @@ vm_hold_load_pages(struct buf *bp, vm_of
 	from = round_page(from);
 	index = (from - trunc_page((vm_offset_t)bp->b_data)) >> PAGE_SHIFT;
 
-	VM_OBJECT_LOCK(kernel_object);
 	for (pg = from; pg < to; pg += PAGE_SIZE, index++) {
 tryagain:
 		/*
 		 * note: must allocate system pages since blocking here
-		 * could intefere with paging I/O, no matter which
+		 * could interfere with paging I/O, no matter which
 		 * process we are.
 		 */
-		p = vm_page_alloc(kernel_object,
-			((pg - VM_MIN_KERNEL_ADDRESS) >> PAGE_SHIFT),
-		    VM_ALLOC_NOBUSY | VM_ALLOC_SYSTEM | VM_ALLOC_WIRED);
+		p = vm_page_alloc(NULL, pg >> PAGE_SHIFT, VM_ALLOC_NOOBJ |
+		    VM_ALLOC_SYSTEM | VM_ALLOC_WIRED);
 		if (!p) {
 			atomic_add_int(&vm_pageout_deficit,
 			    (to - pg) >> PAGE_SHIFT);
-			VM_OBJECT_UNLOCK(kernel_object);
 			VM_WAIT;
-			VM_OBJECT_LOCK(kernel_object);
 			goto tryagain;
 		}
 		p->valid = VM_PAGE_BITS_ALL;
 		pmap_qenter(pg, &p, 1);
 		bp->b_pages[index] = p;
 	}
-	VM_OBJECT_UNLOCK(kernel_object);
 	bp->b_npages = index;
 }
 
@@ -3835,7 +3830,6 @@ vm_hold_free_pages(struct buf *bp, vm_of
 	to = round_page(to);
 	newnpages = index = (from - trunc_page((vm_offset_t)bp->b_data)) >> PAGE_SHIFT;
 
-	VM_OBJECT_LOCK(kernel_object);
 	for (pg = from; pg < to; pg += PAGE_SIZE, index++) {
 		p = bp->b_pages[index];
 		if (p && (index < bp->b_npages)) {
@@ -3847,13 +3841,11 @@ vm_hold_free_pages(struct buf *bp, vm_of
 			}
 			bp->b_pages[index] = NULL;
 			pmap_qremove(pg, 1);
-			vm_page_lock_queues();
-			vm_page_unwire(p, 0);
+			p->wire_count--;
 			vm_page_free(p);
-			vm_page_unlock_queues();
+			atomic_subtract_int(&cnt.v_wire_count, 1);
 		}
 	}
-	VM_OBJECT_UNLOCK(kernel_object);
 	bp->b_npages = newnpages;
 }
 

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 18:46:58 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BE25F1065673;
	Fri, 29 May 2009 18:46:58 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A84CE8FC08;
	Fri, 29 May 2009 18:46:58 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TIkw6L083155;
	Fri, 29 May 2009 18:46:58 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TIkvph083130;
	Fri, 29 May 2009 18:46:57 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200905291846.n4TIkvph083130@svn.freebsd.org>
From: Andrew Thompson 
Date: Fri, 29 May 2009 18:46:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193045 - in head/sys: compat/ndis dev/ata dev/if_ndis
	dev/sound/usb dev/usb dev/usb/controller dev/usb/input
	dev/usb/misc dev/usb/net dev/usb/serial dev/usb/storage
	dev/usb/template de...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 18:46:59 -0000

Author: thompsa
Date: Fri May 29 18:46:57 2009
New Revision: 193045
URL: http://svn.freebsd.org/changeset/base/193045

Log:
  s/usb2_/usb_/ on all typedefs for the USB stack.

Modified:
  head/sys/compat/ndis/subr_usbd.c
  head/sys/dev/ata/ata-usb.c
  head/sys/dev/if_ndis/if_ndisvar.h
  head/sys/dev/sound/usb/uaudio.c
  head/sys/dev/usb/controller/at91dci.c
  head/sys/dev/usb/controller/at91dci.h
  head/sys/dev/usb/controller/atmegadci.c
  head/sys/dev/usb/controller/atmegadci.h
  head/sys/dev/usb/controller/avr32dci.c
  head/sys/dev/usb/controller/avr32dci.h
  head/sys/dev/usb/controller/ehci.c
  head/sys/dev/usb/controller/ehci.h
  head/sys/dev/usb/controller/musb_otg.c
  head/sys/dev/usb/controller/musb_otg.h
  head/sys/dev/usb/controller/ohci.c
  head/sys/dev/usb/controller/ohci.h
  head/sys/dev/usb/controller/uhci.c
  head/sys/dev/usb/controller/uhci.h
  head/sys/dev/usb/controller/usb_controller.c
  head/sys/dev/usb/controller/uss820dci.c
  head/sys/dev/usb/controller/uss820dci.h
  head/sys/dev/usb/input/uhid.c
  head/sys/dev/usb/input/ukbd.c
  head/sys/dev/usb/input/ums.c
  head/sys/dev/usb/misc/udbp.c
  head/sys/dev/usb/misc/ufm.c
  head/sys/dev/usb/net/if_aue.c
  head/sys/dev/usb/net/if_axe.c
  head/sys/dev/usb/net/if_cdce.c
  head/sys/dev/usb/net/if_cue.c
  head/sys/dev/usb/net/if_kue.c
  head/sys/dev/usb/net/if_rue.c
  head/sys/dev/usb/net/if_udav.c
  head/sys/dev/usb/net/usb_ethernet.c
  head/sys/dev/usb/net/usb_ethernet.h
  head/sys/dev/usb/serial/u3g.c
  head/sys/dev/usb/serial/uark.c
  head/sys/dev/usb/serial/ubsa.c
  head/sys/dev/usb/serial/ubser.c
  head/sys/dev/usb/serial/uchcom.c
  head/sys/dev/usb/serial/ucycom.c
  head/sys/dev/usb/serial/ufoma.c
  head/sys/dev/usb/serial/uftdi.c
  head/sys/dev/usb/serial/ugensa.c
  head/sys/dev/usb/serial/uipaq.c
  head/sys/dev/usb/serial/ulpt.c
  head/sys/dev/usb/serial/umct.c
  head/sys/dev/usb/serial/umodem.c
  head/sys/dev/usb/serial/umoscom.c
  head/sys/dev/usb/serial/uplcom.c
  head/sys/dev/usb/serial/usb_serial.c
  head/sys/dev/usb/serial/uslcom.c
  head/sys/dev/usb/serial/uvisor.c
  head/sys/dev/usb/serial/uvscom.c
  head/sys/dev/usb/storage/umass.c
  head/sys/dev/usb/storage/urio.c
  head/sys/dev/usb/storage/ustorage_fs.c
  head/sys/dev/usb/template/usb_template.c
  head/sys/dev/usb/usb_bus.h
  head/sys/dev/usb/usb_busdma.c
  head/sys/dev/usb/usb_busdma.h
  head/sys/dev/usb/usb_compat_linux.c
  head/sys/dev/usb/usb_compat_linux.h
  head/sys/dev/usb/usb_controller.h
  head/sys/dev/usb/usb_core.h
  head/sys/dev/usb/usb_dev.c
  head/sys/dev/usb/usb_dev.h
  head/sys/dev/usb/usb_device.c
  head/sys/dev/usb/usb_device.h
  head/sys/dev/usb/usb_dynamic.c
  head/sys/dev/usb/usb_dynamic.h
  head/sys/dev/usb/usb_error.c
  head/sys/dev/usb/usb_generic.c
  head/sys/dev/usb/usb_handle_request.c
  head/sys/dev/usb/usb_hid.c
  head/sys/dev/usb/usb_hid.h
  head/sys/dev/usb/usb_hub.c
  head/sys/dev/usb/usb_hub.h
  head/sys/dev/usb/usb_lookup.c
  head/sys/dev/usb/usb_lookup.h
  head/sys/dev/usb/usb_mbuf.c
  head/sys/dev/usb/usb_mbuf.h
  head/sys/dev/usb/usb_msctest.c
  head/sys/dev/usb/usb_msctest.h
  head/sys/dev/usb/usb_process.c
  head/sys/dev/usb/usb_process.h
  head/sys/dev/usb/usb_request.c
  head/sys/dev/usb/usb_request.h
  head/sys/dev/usb/usb_transfer.c
  head/sys/dev/usb/usb_transfer.h
  head/sys/dev/usb/usb_util.c
  head/sys/dev/usb/wlan/if_rum.c
  head/sys/dev/usb/wlan/if_uath.c
  head/sys/dev/usb/wlan/if_upgt.c
  head/sys/dev/usb/wlan/if_ural.c
  head/sys/dev/usb/wlan/if_urtw.c
  head/sys/dev/usb/wlan/if_urtwvar.h
  head/sys/dev/usb/wlan/if_zyd.c
  head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
  head/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c

Modified: head/sys/compat/ndis/subr_usbd.c
==============================================================================
--- head/sys/compat/ndis/subr_usbd.c	Fri May 29 18:35:51 2009	(r193044)
+++ head/sys/compat/ndis/subr_usbd.c	Fri May 29 18:46:57 2009	(r193045)
@@ -76,8 +76,8 @@ __FBSDID("$FreeBSD$");
 #include 
 
 static driver_object usbd_driver;
-static usb2_callback_t usbd_non_isoc_callback;
-static usb2_callback_t usbd_ctrl_callback;
+static usb_callback_t usbd_non_isoc_callback;
+static usb_callback_t usbd_ctrl_callback;
 
 #define	USBD_CTRL_READ_PIPE		0
 #define	USBD_CTRL_WRITE_PIPE		1
@@ -114,10 +114,10 @@ static int32_t		 usbd_func_bulkintr(irp 
 static int32_t		 usbd_func_vendorclass(irp *);
 static int32_t		 usbd_func_selconf(irp *);
 static int32_t		 usbd_func_abort_pipe(irp *);
-static usb2_error_t	 usbd_setup_endpoint(irp *, uint8_t,
+static usb_error_t	 usbd_setup_endpoint(irp *, uint8_t,
 			    struct usb_endpoint_descriptor	*);
-static usb2_error_t	 usbd_setup_endpoint_default(irp *, uint8_t);
-static usb2_error_t	 usbd_setup_endpoint_one(irp *, uint8_t,
+static usb_error_t	 usbd_setup_endpoint_default(irp *, uint8_t);
+static usb_error_t	 usbd_setup_endpoint_one(irp *, uint8_t,
 			    struct ndisusb_ep *, struct usb_config *);
 static int32_t		 usbd_func_getdesc(irp *);
 static union usbd_urb	*usbd_geturb(irp *);
@@ -353,7 +353,7 @@ usbd_urb2nt(status)
 	return (STATUS_FAILURE);
 }
 
-/* Convert FreeBSD's usb2_error_t to USBD_STATUS  */
+/* Convert FreeBSD's usb_error_t to USBD_STATUS  */
 static int32_t
 usbd_usb2urb(int status)
 {
@@ -463,7 +463,7 @@ usbd_func_getdesc(ip)
 	uint32_t len;
 	union usbd_urb *urb;
 	usb_config_descriptor_t *cdp;
-	usb2_error_t status;
+	usb_error_t status;
 
 	urb = usbd_geturb(ip);
 	ctldesc = &urb->uu_ctldesc;
@@ -527,7 +527,7 @@ usbd_func_selconf(ip)
 	union usbd_urb *urb;
 	usb_config_descriptor_t *conf;
 	usb_endpoint_descriptor_t *edesc;
-	usb2_error_t ret;
+	usb_error_t ret;
 
 	urb = usbd_geturb(ip);
 
@@ -592,7 +592,7 @@ usbd_func_selconf(ip)
 	return USBD_STATUS_SUCCESS;
 }
 
-static usb2_error_t
+static usb_error_t
 usbd_setup_endpoint_one(ip, ifidx, ne, epconf)
 	irp				*ip;
 	uint8_t				ifidx;
@@ -602,7 +602,7 @@ usbd_setup_endpoint_one(ip, ifidx, ne, e
 	device_t dev = IRP_NDIS_DEV(ip);
 	struct ndis_softc *sc = device_get_softc(dev);
 	struct usb_xfer *xfer;
-	usb2_error_t status;
+	usb_error_t status;
 
 	InitializeListHead(&ne->ne_active);
 	InitializeListHead(&ne->ne_pending);
@@ -621,14 +621,14 @@ usbd_setup_endpoint_one(ip, ifidx, ne, e
 	return (status);
 }
 
-static usb2_error_t
+static usb_error_t
 usbd_setup_endpoint_default(ip, ifidx)
 	irp				*ip;
 	uint8_t				ifidx;
 {
 	device_t dev = IRP_NDIS_DEV(ip);
 	struct ndis_softc *sc = device_get_softc(dev);
-	usb2_error_t status;
+	usb_error_t status;
 
 	if (ifidx > 0)
 		device_printf(dev, "warning: ifidx > 0 isn't supported.\n");
@@ -643,7 +643,7 @@ usbd_setup_endpoint_default(ip, ifidx)
 	return (status);
 }
 
-static usb2_error_t
+static usb_error_t
 usbd_setup_endpoint(ip, ifidx, ep)
 	irp				*ip;
 	uint8_t				ifidx;
@@ -654,7 +654,7 @@ usbd_setup_endpoint(ip, ifidx, ep)
 	struct ndisusb_ep *ne;
 	struct usb_config cfg;
 	struct usb_xfer *xfer;
-	usb2_error_t status;
+	usb_error_t status;
 
 	/* check for non-supported transfer types */
 	if (UE_GET_XFERTYPE(ep->bmAttributes) == UE_CONTROL ||
@@ -810,7 +810,7 @@ usbd_irpcancel(dobj, ip)
 
 static void
 usbd_xfer_complete(struct ndis_softc *sc, struct ndisusb_ep *ne,
-    struct ndisusb_xfer *nx, usb2_error_t status)
+    struct ndisusb_xfer *nx, usb_error_t status)
 {
 	struct ndisusb_xferdone *nd;
 	uint8_t irql;
@@ -1122,7 +1122,7 @@ usbd_xfertask(dobj, arg)
 	struct usbd_urb_bulk_or_intr_transfer *ubi;
 	struct usbd_urb_vendor_or_class_request *vcreq;
 	union usbd_urb *urb;
-	usb2_error_t status;
+	usb_error_t status;
 	void *priv;
 
 	dev = sc->ndis_dev;

Modified: head/sys/dev/ata/ata-usb.c
==============================================================================
--- head/sys/dev/ata/ata-usb.c	Fri May 29 18:35:51 2009	(r193044)
+++ head/sys/dev/ata/ata-usb.c	Fri May 29 18:46:57 2009	(r193045)
@@ -132,16 +132,16 @@ static device_probe_t atausb2_probe;
 static device_attach_t atausb2_attach;
 static device_detach_t atausb2_detach;
 
-static usb2_callback_t atausb2_t_bbb_reset1_callback;
-static usb2_callback_t atausb2_t_bbb_reset2_callback;
-static usb2_callback_t atausb2_t_bbb_reset3_callback;
-static usb2_callback_t atausb2_t_bbb_command_callback;
-static usb2_callback_t atausb2_t_bbb_data_read_callback;
-static usb2_callback_t atausb2_t_bbb_data_rd_cs_callback;
-static usb2_callback_t atausb2_t_bbb_data_write_callback;
-static usb2_callback_t atausb2_t_bbb_data_wr_cs_callback;
-static usb2_callback_t atausb2_t_bbb_status_callback;
-static usb2_callback_t atausb2_tr_error;
+static usb_callback_t atausb2_t_bbb_reset1_callback;
+static usb_callback_t atausb2_t_bbb_reset2_callback;
+static usb_callback_t atausb2_t_bbb_reset3_callback;
+static usb_callback_t atausb2_t_bbb_command_callback;
+static usb_callback_t atausb2_t_bbb_data_read_callback;
+static usb_callback_t atausb2_t_bbb_data_rd_cs_callback;
+static usb_callback_t atausb2_t_bbb_data_write_callback;
+static usb_callback_t atausb2_t_bbb_data_wr_cs_callback;
+static usb_callback_t atausb2_t_bbb_status_callback;
+static usb_callback_t atausb2_tr_error;
 
 static void atausb2_cancel_request(struct atausb2_softc *sc);
 static void atausb2_transfer_start(struct atausb2_softc *sc, uint8_t xfer_no);

Modified: head/sys/dev/if_ndis/if_ndisvar.h
==============================================================================
--- head/sys/dev/if_ndis/if_ndisvar.h	Fri May 29 18:35:51 2009	(r193044)
+++ head/sys/dev/if_ndis/if_ndisvar.h	Fri May 29 18:46:57 2009	(r193045)
@@ -138,7 +138,7 @@ struct ndisusb_xfer {
 };
 struct ndisusb_xferdone {
 	struct ndisusb_xfer	*nd_xfer;
-	usb2_error_t		nd_status;
+	usb_error_t		nd_status;
 	list_entry		nd_donelist;
 };
 

Modified: head/sys/dev/sound/usb/uaudio.c
==============================================================================
--- head/sys/dev/sound/usb/uaudio.c	Fri May 29 18:35:51 2009	(r193044)
+++ head/sys/dev/sound/usb/uaudio.c	Fri May 29 18:46:57 2009	(r193045)
@@ -308,13 +308,13 @@ static device_probe_t uaudio_probe;
 static device_attach_t uaudio_attach;
 static device_detach_t uaudio_detach;
 
-static usb2_callback_t uaudio_chan_play_callback;
-static usb2_callback_t uaudio_chan_record_callback;
-static usb2_callback_t uaudio_mixer_write_cfg_callback;
-static usb2_callback_t umidi_read_clear_stall_callback;
-static usb2_callback_t umidi_bulk_read_callback;
-static usb2_callback_t umidi_write_clear_stall_callback;
-static usb2_callback_t umidi_bulk_write_callback;
+static usb_callback_t uaudio_chan_play_callback;
+static usb_callback_t uaudio_chan_record_callback;
+static usb_callback_t uaudio_mixer_write_cfg_callback;
+static usb_callback_t umidi_read_clear_stall_callback;
+static usb_callback_t umidi_bulk_read_callback;
+static usb_callback_t umidi_write_clear_stall_callback;
+static usb_callback_t umidi_bulk_write_callback;
 
 static void	uaudio_chan_fill_info_sub(struct uaudio_softc *,
 		    struct usb_device *, uint32_t, uint16_t, uint8_t, uint8_t);
@@ -362,7 +362,7 @@ static uint16_t	uaudio_mixer_get(struct 
 		    struct uaudio_mixer_node *);
 static void	uaudio_mixer_ctl_set(struct uaudio_softc *,
 		    struct uaudio_mixer_node *, uint8_t, int32_t val);
-static usb2_error_t uaudio_set_speed(struct usb_device *, uint8_t, uint32_t);
+static usb_error_t uaudio_set_speed(struct usb_device *, uint8_t, uint32_t);
 static int	uaudio_mixer_signext(uint8_t, int);
 static int	uaudio_mixer_bsd2value(struct uaudio_mixer_node *, int32_t val);
 static const void *uaudio_mixer_verify_desc(const void *, uint32_t);
@@ -1295,7 +1295,7 @@ uaudio_chan_init(struct uaudio_softc *sc
 	uint8_t endpoint;
 	uint8_t iface_index;
 	uint8_t alt_index;
-	usb2_error_t err;
+	usb_error_t err;
 
 	/* compute required buffer size */
 	buf_size = (ch->bytes_per_frame * UAUDIO_MINFRAMES);
@@ -2873,7 +2873,7 @@ uaudio_mixer_get(struct usb_device *udev
 	uint16_t val;
 	uint16_t len = MIX_SIZE(mc->type);
 	uint8_t data[4];
-	usb2_error_t err;
+	usb_error_t err;
 
 	if (mc->wValue[0] == -1) {
 		return (0);
@@ -2987,7 +2987,7 @@ tr_setup:
 	}
 }
 
-static usb2_error_t
+static usb_error_t
 uaudio_set_speed(struct usb_device *udev, uint8_t endpt, uint32_t speed)
 {
 	struct usb_device_request req;

Modified: head/sys/dev/usb/controller/at91dci.c
==============================================================================
--- head/sys/dev/usb/controller/at91dci.c	Fri May 29 18:35:51 2009	(r193044)
+++ head/sys/dev/usb/controller/at91dci.c	Fri May 29 18:46:57 2009	(r193045)
@@ -92,7 +92,7 @@ static at91dci_cmd_t at91dci_setup_rx;
 static at91dci_cmd_t at91dci_data_rx;
 static at91dci_cmd_t at91dci_data_tx;
 static at91dci_cmd_t at91dci_data_tx_sync;
-static void	at91dci_device_done(struct usb_xfer *, usb2_error_t);
+static void	at91dci_device_done(struct usb_xfer *, usb_error_t);
 static void	at91dci_do_poll(struct usb_bus *);
 static void	at91dci_standard_done(struct usb_xfer *);
 static void	at91dci_root_intr(struct at91dci_softc *sc);
@@ -1070,7 +1070,7 @@ at91dci_root_intr(struct at91dci_softc *
 	    sizeof(sc->sc_hub_idata));
 }
 
-static usb2_error_t
+static usb_error_t
 at91dci_standard_done_sub(struct usb_xfer *xfer)
 {
 	struct at91dci_td *td;
@@ -1137,7 +1137,7 @@ at91dci_standard_done_sub(struct usb_xfe
 static void
 at91dci_standard_done(struct usb_xfer *xfer)
 {
-	usb2_error_t err = 0;
+	usb_error_t err = 0;
 
 	DPRINTFN(13, "xfer=%p pipe=%p transfer done\n",
 	    xfer, xfer->pipe);
@@ -1184,7 +1184,7 @@ done:
  * same USB transfer!
  *------------------------------------------------------------------------*/
 static void
-at91dci_device_done(struct usb_xfer *xfer, usb2_error_t error)
+at91dci_device_done(struct usb_xfer *xfer, usb_error_t error)
 {
 	struct at91dci_softc *sc = AT9100_DCI_BUS2SC(xfer->xroot->bus);
 	uint8_t ep_no;
@@ -1355,7 +1355,7 @@ at91dci_clear_stall(struct usb_device *u
 	    (ed->bEndpointAddress & (UE_DIR_IN | UE_DIR_OUT)));
 }
 
-usb2_error_t
+usb_error_t
 at91dci_init(struct at91dci_softc *sc)
 {
 	uint32_t csr_val;
@@ -1745,7 +1745,7 @@ USB_MAKE_STRING_DESC(STRING_LANG, at91dc
 USB_MAKE_STRING_DESC(STRING_VENDOR, at91dci_vendor);
 USB_MAKE_STRING_DESC(STRING_PRODUCT, at91dci_product);
 
-static usb2_error_t
+static usb_error_t
 at91dci_roothub_exec(struct usb_device *udev,
     struct usb_device_request *req, const void **pptr, uint16_t *plength)
 {
@@ -1754,7 +1754,7 @@ at91dci_roothub_exec(struct usb_device *
 	uint16_t len;
 	uint16_t value;
 	uint16_t index;
-	usb2_error_t err;
+	usb_error_t err;
 
 	USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED);
 

Modified: head/sys/dev/usb/controller/at91dci.h
==============================================================================
--- head/sys/dev/usb/controller/at91dci.h	Fri May 29 18:35:51 2009	(r193044)
+++ head/sys/dev/usb/controller/at91dci.h	Fri May 29 18:46:57 2009	(r193045)
@@ -233,7 +233,7 @@ struct at91dci_softc {
 
 /* prototypes */
 
-usb2_error_t at91dci_init(struct at91dci_softc *sc);
+usb_error_t at91dci_init(struct at91dci_softc *sc);
 void	at91dci_uninit(struct at91dci_softc *sc);
 void	at91dci_suspend(struct at91dci_softc *sc);
 void	at91dci_resume(struct at91dci_softc *sc);

Modified: head/sys/dev/usb/controller/atmegadci.c
==============================================================================
--- head/sys/dev/usb/controller/atmegadci.c	Fri May 29 18:35:51 2009	(r193044)
+++ head/sys/dev/usb/controller/atmegadci.c	Fri May 29 18:46:57 2009	(r193045)
@@ -82,7 +82,7 @@ static atmegadci_cmd_t atmegadci_setup_r
 static atmegadci_cmd_t atmegadci_data_rx;
 static atmegadci_cmd_t atmegadci_data_tx;
 static atmegadci_cmd_t atmegadci_data_tx_sync;
-static void atmegadci_device_done(struct usb_xfer *, usb2_error_t);
+static void atmegadci_device_done(struct usb_xfer *, usb_error_t);
 static void atmegadci_do_poll(struct usb_bus *);
 static void atmegadci_standard_done(struct usb_xfer *);
 static void atmegadci_root_intr(struct atmegadci_softc *sc);
@@ -953,7 +953,7 @@ atmegadci_root_intr(struct atmegadci_sof
 	    sizeof(sc->sc_hub_idata));
  }
 
-static usb2_error_t
+static usb_error_t
 atmegadci_standard_done_sub(struct usb_xfer *xfer)
 {
 	struct atmegadci_td *td;
@@ -1020,7 +1020,7 @@ atmegadci_standard_done_sub(struct usb_x
 static void
 atmegadci_standard_done(struct usb_xfer *xfer)
 {
-	usb2_error_t err = 0;
+	usb_error_t err = 0;
 
 	DPRINTFN(13, "xfer=%p pipe=%p transfer done\n",
 	    xfer, xfer->pipe);
@@ -1067,7 +1067,7 @@ done:
  * same USB transfer!
  *------------------------------------------------------------------------*/
 static void
-atmegadci_device_done(struct usb_xfer *xfer, usb2_error_t error)
+atmegadci_device_done(struct usb_xfer *xfer, usb_error_t error)
 {
 	struct atmegadci_softc *sc = ATMEGA_BUS2SC(xfer->xroot->bus);
 	uint8_t ep_no;
@@ -1205,7 +1205,7 @@ atmegadci_clear_stall(struct usb_device 
 	    (ed->bEndpointAddress & (UE_DIR_IN | UE_DIR_OUT)));
 }
 
-usb2_error_t
+usb_error_t
 atmegadci_init(struct atmegadci_softc *sc)
 {
 	uint8_t n;
@@ -1566,7 +1566,7 @@ USB_MAKE_STRING_DESC(STRING_LANG, atmega
 USB_MAKE_STRING_DESC(STRING_VENDOR, atmegadci_vendor);
 USB_MAKE_STRING_DESC(STRING_PRODUCT, atmegadci_product);
 
-static usb2_error_t
+static usb_error_t
 atmegadci_roothub_exec(struct usb_device *udev,
     struct usb_device_request *req, const void **pptr, uint16_t *plength)
 {
@@ -1576,7 +1576,7 @@ atmegadci_roothub_exec(struct usb_device
 	uint16_t value;
 	uint16_t index;
 	uint8_t temp;
-	usb2_error_t err;
+	usb_error_t err;
 
 	USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED);
 

Modified: head/sys/dev/usb/controller/atmegadci.h
==============================================================================
--- head/sys/dev/usb/controller/atmegadci.h	Fri May 29 18:35:51 2009	(r193044)
+++ head/sys/dev/usb/controller/atmegadci.h	Fri May 29 18:46:57 2009	(r193045)
@@ -276,7 +276,7 @@ struct atmegadci_softc {
 
 /* prototypes */
 
-usb2_error_t atmegadci_init(struct atmegadci_softc *sc);
+usb_error_t atmegadci_init(struct atmegadci_softc *sc);
 void	atmegadci_uninit(struct atmegadci_softc *sc);
 void	atmegadci_suspend(struct atmegadci_softc *sc);
 void	atmegadci_resume(struct atmegadci_softc *sc);

Modified: head/sys/dev/usb/controller/avr32dci.c
==============================================================================
--- head/sys/dev/usb/controller/avr32dci.c	Fri May 29 18:35:51 2009	(r193044)
+++ head/sys/dev/usb/controller/avr32dci.c	Fri May 29 18:46:57 2009	(r193045)
@@ -82,7 +82,7 @@ static avr32dci_cmd_t avr32dci_setup_rx;
 static avr32dci_cmd_t avr32dci_data_rx;
 static avr32dci_cmd_t avr32dci_data_tx;
 static avr32dci_cmd_t avr32dci_data_tx_sync;
-static void avr32dci_device_done(struct usb_xfer *, usb2_error_t);
+static void avr32dci_device_done(struct usb_xfer *, usb_error_t);
 static void avr32dci_do_poll(struct usb_bus *);
 static void avr32dci_standard_done(struct usb_xfer *);
 static void avr32dci_root_intr(struct avr32dci_softc *sc);
@@ -924,7 +924,7 @@ avr32dci_root_intr(struct avr32dci_softc
 	    sizeof(sc->sc_hub_idata));
 }
 
-static usb2_error_t
+static usb_error_t
 avr32dci_standard_done_sub(struct usb_xfer *xfer)
 {
 	struct avr32dci_td *td;
@@ -991,7 +991,7 @@ avr32dci_standard_done_sub(struct usb_xf
 static void
 avr32dci_standard_done(struct usb_xfer *xfer)
 {
-	usb2_error_t err = 0;
+	usb_error_t err = 0;
 
 	DPRINTFN(13, "xfer=%p pipe=%p transfer done\n",
 	    xfer, xfer->pipe);
@@ -1038,7 +1038,7 @@ done:
  * same USB transfer!
  *------------------------------------------------------------------------*/
 static void
-avr32dci_device_done(struct usb_xfer *xfer, usb2_error_t error)
+avr32dci_device_done(struct usb_xfer *xfer, usb_error_t error)
 {
 	struct avr32dci_softc *sc = AVR32_BUS2SC(xfer->xroot->bus);
 	uint8_t ep_no;
@@ -1175,7 +1175,7 @@ avr32dci_clear_stall(struct usb_device *
 	    (ed->bEndpointAddress & (UE_DIR_IN | UE_DIR_OUT)));
 }
 
-usb2_error_t
+usb_error_t
 avr32dci_init(struct avr32dci_softc *sc)
 {
 	uint8_t n;
@@ -1500,7 +1500,7 @@ USB_MAKE_STRING_DESC(STRING_LANG, avr32d
 USB_MAKE_STRING_DESC(STRING_VENDOR, avr32dci_vendor);
 USB_MAKE_STRING_DESC(STRING_PRODUCT, avr32dci_product);
 
-static usb2_error_t
+static usb_error_t
 avr32dci_roothub_exec(struct usb_device *udev,
     struct usb_device_request *req, const void **pptr, uint16_t *plength)
 {
@@ -1510,7 +1510,7 @@ avr32dci_roothub_exec(struct usb_device 
 	uint16_t value;
 	uint16_t index;
 	uint32_t temp;
-	usb2_error_t err;
+	usb_error_t err;
 
 	USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED);
 

Modified: head/sys/dev/usb/controller/avr32dci.h
==============================================================================
--- head/sys/dev/usb/controller/avr32dci.h	Fri May 29 18:35:51 2009	(r193044)
+++ head/sys/dev/usb/controller/avr32dci.h	Fri May 29 18:46:57 2009	(r193045)
@@ -244,7 +244,7 @@ struct avr32dci_softc {
 
 /* prototypes */
 
-usb2_error_t avr32dci_init(struct avr32dci_softc *sc);
+usb_error_t avr32dci_init(struct avr32dci_softc *sc);
 void	avr32dci_uninit(struct avr32dci_softc *sc);
 void	avr32dci_suspend(struct avr32dci_softc *sc);
 void	avr32dci_resume(struct avr32dci_softc *sc);

Modified: head/sys/dev/usb/controller/ehci.c
==============================================================================
--- head/sys/dev/usb/controller/ehci.c	Fri May 29 18:35:51 2009	(r193044)
+++ head/sys/dev/usb/controller/ehci.c	Fri May 29 18:46:57 2009	(r193045)
@@ -94,7 +94,7 @@ extern struct usb_pipe_methods ehci_devi
 extern struct usb_pipe_methods ehci_device_isoc_hs_methods;
 
 static void ehci_do_poll(struct usb_bus *bus);
-static void ehci_device_done(struct usb_xfer *xfer, usb2_error_t error);
+static void ehci_device_done(struct usb_xfer *xfer, usb_error_t error);
 static uint8_t ehci_check_transfer(struct usb_xfer *xfer);
 static void ehci_timeout(void *arg);
 static void ehci_root_intr(ehci_softc_t *sc);
@@ -115,7 +115,7 @@ struct ehci_std_temp {
 };
 
 void
-ehci_iterate_hw_softc(struct usb_bus *bus, usb2_bus_mem_sub_cb_t *cb)
+ehci_iterate_hw_softc(struct usb_bus *bus, usb_bus_mem_sub_cb_t *cb)
 {
 	ehci_softc_t *sc = EHCI_BUS2SC(bus);
 	uint32_t i;
@@ -145,7 +145,7 @@ ehci_iterate_hw_softc(struct usb_bus *bu
 	}
 }
 
-usb2_error_t
+usb_error_t
 ehci_reset(ehci_softc_t *sc)
 {
 	uint32_t hcr;
@@ -181,7 +181,7 @@ ehci_reset(ehci_softc_t *sc)
 	return (USB_ERR_IOERROR);
 }
 
-static usb2_error_t
+static usb_error_t
 ehci_hcreset(ehci_softc_t *sc)
 {
 	uint32_t hcr;
@@ -205,7 +205,7 @@ ehci_hcreset(ehci_softc_t *sc)
 	return ehci_reset(sc);
 }
 
-usb2_error_t
+usb_error_t
 ehci_init(ehci_softc_t *sc)
 {
 	struct usb_page_search buf_res;
@@ -217,7 +217,7 @@ ehci_init(ehci_softc_t *sc)
 	uint16_t x;
 	uint16_t y;
 	uint16_t bit;
-	usb2_error_t err = 0;
+	usb_error_t err = 0;
 
 	DPRINTF("start\n");
 
@@ -1120,7 +1120,7 @@ _ehci_remove_qh(ehci_qh_t *sqh, ehci_qh_
 	return (last);
 }
 
-static usb2_error_t
+static usb_error_t
 ehci_non_isoc_done_sub(struct usb_xfer *xfer)
 {
 	ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus);
@@ -1216,7 +1216,7 @@ ehci_non_isoc_done_sub(struct usb_xfer *
 static void
 ehci_non_isoc_done(struct usb_xfer *xfer)
 {
-	usb2_error_t err = 0;
+	usb_error_t err = 0;
 
 	DPRINTFN(13, "xfer=%p pipe=%p transfer done\n",
 	    xfer, xfer->pipe);
@@ -2111,7 +2111,7 @@ ehci_isoc_hs_done(ehci_softc_t *sc, stru
  * from close and from interrupt
  */
 static void
-ehci_device_done(struct usb_xfer *xfer, usb2_error_t error)
+ehci_device_done(struct usb_xfer *xfer, usb_error_t error)
 {
 	struct usb_pipe_methods *methods = xfer->pipe->methods;
 	ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus);
@@ -2984,7 +2984,7 @@ ehci_disown(ehci_softc_t *sc, uint16_t i
 	EOWRITE4(sc, port, v | EHCI_PS_PO);
 }
 
-static usb2_error_t
+static usb_error_t
 ehci_roothub_exec(struct usb_device *udev,
     struct usb_device_request *req, const void **pptr, uint16_t *plength)
 {
@@ -2998,7 +2998,7 @@ ehci_roothub_exec(struct usb_device *ude
 	uint16_t value;
 	uint16_t index;
 	uint8_t l;
-	usb2_error_t err;
+	usb_error_t err;
 
 	USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED);
 

Modified: head/sys/dev/usb/controller/ehci.h
==============================================================================
--- head/sys/dev/usb/controller/ehci.h	Fri May 29 18:35:51 2009	(r193044)
+++ head/sys/dev/usb/controller/ehci.h	Fri May 29 18:46:57 2009	(r193045)
@@ -574,10 +574,10 @@ hc16toh(const struct ehci_softc *sc, con
 }
 #endif
 
-usb2_bus_mem_cb_t ehci_iterate_hw_softc;
+usb_bus_mem_cb_t ehci_iterate_hw_softc;
 
-usb2_error_t ehci_reset(ehci_softc_t *sc);
-usb2_error_t ehci_init(ehci_softc_t *sc);
+usb_error_t ehci_reset(ehci_softc_t *sc);
+usb_error_t ehci_init(ehci_softc_t *sc);
 void	ehci_detach(struct ehci_softc *sc);
 void	ehci_suspend(struct ehci_softc *sc);
 void	ehci_resume(struct ehci_softc *sc);

Modified: head/sys/dev/usb/controller/musb_otg.c
==============================================================================
--- head/sys/dev/usb/controller/musb_otg.c	Fri May 29 18:35:51 2009	(r193044)
+++ head/sys/dev/usb/controller/musb_otg.c	Fri May 29 18:46:57 2009	(r193045)
@@ -86,7 +86,7 @@ static musbotg_cmd_t musbotg_setup_data_
 static musbotg_cmd_t musbotg_setup_status;
 static musbotg_cmd_t musbotg_data_rx;
 static musbotg_cmd_t musbotg_data_tx;
-static void	musbotg_device_done(struct usb_xfer *, usb2_error_t);
+static void	musbotg_device_done(struct usb_xfer *, usb_error_t);
 static void	musbotg_do_poll(struct usb_bus *);
 static void	musbotg_standard_done(struct usb_xfer *);
 static void	musbotg_interrupt_poll(struct musbotg_softc *);
@@ -1321,7 +1321,7 @@ musbotg_root_intr(struct musbotg_softc *
 	    sizeof(sc->sc_hub_idata));
 }
 
-static usb2_error_t
+static usb_error_t
 musbotg_standard_done_sub(struct usb_xfer *xfer)
 {
 	struct musbotg_td *td;
@@ -1388,7 +1388,7 @@ musbotg_standard_done_sub(struct usb_xfe
 static void
 musbotg_standard_done(struct usb_xfer *xfer)
 {
-	usb2_error_t err = 0;
+	usb_error_t err = 0;
 
 	DPRINTFN(12, "xfer=%p pipe=%p transfer done\n",
 	    xfer, xfer->pipe);
@@ -1435,7 +1435,7 @@ done:
  * same USB transfer!
  *------------------------------------------------------------------------*/
 static void
-musbotg_device_done(struct usb_xfer *xfer, usb2_error_t error)
+musbotg_device_done(struct usb_xfer *xfer, usb_error_t error)
 {
 	USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED);
 
@@ -1664,7 +1664,7 @@ musbotg_clear_stall(struct usb_device *u
 	    (ed->bEndpointAddress & (UE_DIR_IN | UE_DIR_OUT)));
 }
 
-usb2_error_t
+usb_error_t
 musbotg_init(struct musbotg_softc *sc)
 {
 	struct usb_hw_ep_profile *pf;
@@ -2153,7 +2153,7 @@ USB_MAKE_STRING_DESC(STRING_LANG, musbot
 USB_MAKE_STRING_DESC(STRING_VENDOR, musbotg_vendor);
 USB_MAKE_STRING_DESC(STRING_PRODUCT, musbotg_product);
 
-static usb2_error_t
+static usb_error_t
 musbotg_roothub_exec(struct usb_device *udev,
     struct usb_device_request *req, const void **pptr, uint16_t *plength)
 {
@@ -2162,7 +2162,7 @@ musbotg_roothub_exec(struct usb_device *
 	uint16_t len;
 	uint16_t value;
 	uint16_t index;
-	usb2_error_t err;
+	usb_error_t err;
 
 	USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED);
 

Modified: head/sys/dev/usb/controller/musb_otg.h
==============================================================================
--- head/sys/dev/usb/controller/musb_otg.h	Fri May 29 18:35:51 2009	(r193044)
+++ head/sys/dev/usb/controller/musb_otg.h	Fri May 29 18:46:57 2009	(r193045)
@@ -396,7 +396,7 @@ struct musbotg_softc {
 
 /* prototypes */
 
-usb2_error_t musbotg_init(struct musbotg_softc *sc);
+usb_error_t musbotg_init(struct musbotg_softc *sc);
 void	musbotg_uninit(struct musbotg_softc *sc);
 void	musbotg_suspend(struct musbotg_softc *sc);
 void	musbotg_resume(struct musbotg_softc *sc);

Modified: head/sys/dev/usb/controller/ohci.c
==============================================================================
--- head/sys/dev/usb/controller/ohci.c	Fri May 29 18:35:51 2009	(r193044)
+++ head/sys/dev/usb/controller/ohci.c	Fri May 29 18:46:57 2009	(r193045)
@@ -94,7 +94,7 @@ extern struct usb_pipe_methods ohci_devi
 extern struct usb_pipe_methods ohci_device_isoc_methods;
 
 static void ohci_do_poll(struct usb_bus *bus);
-static void ohci_device_done(struct usb_xfer *xfer, usb2_error_t error);
+static void ohci_device_done(struct usb_xfer *xfer, usb_error_t error);
 static void ohci_timeout(void *arg);
 static uint8_t ohci_check_transfer(struct usb_xfer *xfer);
 static void ohci_root_intr(ohci_softc_t *sc);
@@ -120,7 +120,7 @@ ohci_get_hcca(ohci_softc_t *sc)
 }
 
 void
-ohci_iterate_hw_softc(struct usb_bus *bus, usb2_bus_mem_sub_cb_t *cb)
+ohci_iterate_hw_softc(struct usb_bus *bus, usb_bus_mem_sub_cb_t *cb)
 {
 	struct ohci_softc *sc = OHCI_BUS2SC(bus);
 	uint32_t i;
@@ -143,7 +143,7 @@ ohci_iterate_hw_softc(struct usb_bus *bu
 	}
 }
 
-static usb2_error_t
+static usb_error_t
 ohci_controller_init(ohci_softc_t *sc)
 {
 	struct usb_page_search buf_res;
@@ -289,7 +289,7 @@ ohci_init_ed(struct usb_page_cache *pc)
 	return (ed);
 }
 
-usb2_error_t
+usb_error_t
 ohci_init(ohci_softc_t *sc)
 {
 	struct usb_page_search buf_res;
@@ -812,7 +812,7 @@ static const char *const
 
 #endif
 
-static usb2_error_t
+static usb_error_t
 ohci_non_isoc_done_sub(struct usb_xfer *xfer)
 {
 	ohci_td_t *td;
@@ -908,7 +908,7 @@ ohci_non_isoc_done_sub(struct usb_xfer *
 static void
 ohci_non_isoc_done(struct usb_xfer *xfer)
 {
-	usb2_error_t err = 0;
+	usb_error_t err = 0;
 
 	DPRINTFN(13, "xfer=%p pipe=%p transfer done\n",
 	    xfer, xfer->pipe);
@@ -1645,7 +1645,7 @@ ohci_root_intr(ohci_softc_t *sc)
  * from close and from interrupt
  */
 static void
-ohci_device_done(struct usb_xfer *xfer, usb2_error_t error)
+ohci_device_done(struct usb_xfer *xfer, usb_error_t error)
 {
 	struct usb_pipe_methods *methods = xfer->pipe->methods;
 	ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus);
@@ -2106,7 +2106,7 @@ struct usb_hub_descriptor ohci_hubd =
 	{0},
 };
 
-static usb2_error_t
+static usb_error_t
 ohci_roothub_exec(struct usb_device *udev,
     struct usb_device_request *req, const void **pptr, uint16_t *plength)
 {
@@ -2119,7 +2119,7 @@ ohci_roothub_exec(struct usb_device *ude
 	uint16_t value;
 	uint16_t index;
 	uint8_t l;
-	usb2_error_t err;
+	usb_error_t err;
 
 	USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED);
 

Modified: head/sys/dev/usb/controller/ohci.h
==============================================================================
--- head/sys/dev/usb/controller/ohci.h	Fri May 29 18:35:51 2009	(r193044)
+++ head/sys/dev/usb/controller/ohci.h	Fri May 29 18:46:57 2009	(r193045)
@@ -352,9 +352,9 @@ typedef struct ohci_softc {
 
 } ohci_softc_t;
 
-usb2_bus_mem_cb_t ohci_iterate_hw_softc;
+usb_bus_mem_cb_t ohci_iterate_hw_softc;
 
-usb2_error_t ohci_init(ohci_softc_t *sc);
+usb_error_t ohci_init(ohci_softc_t *sc);
 void	ohci_detach(struct ohci_softc *sc);
 void	ohci_suspend(ohci_softc_t *sc);
 void	ohci_resume(ohci_softc_t *sc);

Modified: head/sys/dev/usb/controller/uhci.c
==============================================================================
--- head/sys/dev/usb/controller/uhci.c	Fri May 29 18:35:51 2009	(r193044)
+++ head/sys/dev/usb/controller/uhci.c	Fri May 29 18:46:57 2009	(r193045)
@@ -134,14 +134,14 @@ extern struct usb_pipe_methods uhci_devi
 
 static uint8_t	uhci_restart(uhci_softc_t *sc);
 static void	uhci_do_poll(struct usb_bus *);
-static void	uhci_device_done(struct usb_xfer *, usb2_error_t);
+static void	uhci_device_done(struct usb_xfer *, usb_error_t);
 static void	uhci_transfer_intr_enqueue(struct usb_xfer *);
 static void	uhci_timeout(void *);
 static uint8_t	uhci_check_transfer(struct usb_xfer *);
 static void	uhci_root_intr(uhci_softc_t *sc);
 
 void
-uhci_iterate_hw_softc(struct usb_bus *bus, usb2_bus_mem_sub_cb_t *cb)
+uhci_iterate_hw_softc(struct usb_bus *bus, usb_bus_mem_sub_cb_t *cb)
 {
 	struct uhci_softc *sc = UHCI_BUS2SC(bus);
 	uint32_t i;
@@ -424,7 +424,7 @@ uhci_init_td(struct usb_page_cache *pc)
 	return (td);
 }
 
-usb2_error_t
+usb_error_t
 uhci_init(uhci_softc_t *sc)
 {
 	uint16_t bit;
@@ -1089,7 +1089,7 @@ uhci_isoc_done(uhci_softc_t *sc, struct 
 	xfer->aframes = xfer->nframes;
 }
 
-static usb2_error_t
+static usb_error_t
 uhci_non_isoc_done_sub(struct usb_xfer *xfer)
 {
 	struct usb_page_search res;
@@ -1205,7 +1205,7 @@ uhci_non_isoc_done_sub(struct usb_xfer *
 static void
 uhci_non_isoc_done(struct usb_xfer *xfer)
 {
-	usb2_error_t err = 0;
+	usb_error_t err = 0;
 
 	DPRINTFN(13, "xfer=%p pipe=%p transfer done\n",
 	    xfer, xfer->pipe);
@@ -1857,7 +1857,7 @@ uhci_setup_standard_chain(struct usb_xfe
  */
 
 static void
-uhci_device_done(struct usb_xfer *xfer, usb2_error_t error)
+uhci_device_done(struct usb_xfer *xfer, usb_error_t error)
 {
 	struct usb_pipe_methods *methods = xfer->pipe->methods;
 	uhci_softc_t *sc = UHCI_BUS2SC(xfer->xroot->bus);
@@ -2392,7 +2392,7 @@ struct usb_hub_descriptor_min uhci_hubd_
  * outstanding "port enable change" and "connection status change"
  * events have been reset.
  */
-static usb2_error_t
+static usb_error_t
 uhci_portreset(uhci_softc_t *sc, uint16_t index)
 {
 	uint16_t port;
@@ -2493,7 +2493,7 @@ done:
 	return (USB_ERR_NORMAL_COMPLETION);
 }
 
-static usb2_error_t
+static usb_error_t
 uhci_roothub_exec(struct usb_device *udev,
     struct usb_device_request *req, const void **pptr, uint16_t *plength)
 {
@@ -2507,7 +2507,7 @@ uhci_roothub_exec(struct usb_device *ude
 	uint16_t status;
 	uint16_t change;
 	uint16_t len;
-	usb2_error_t err;
+	usb_error_t err;
 
 	USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED);
 

Modified: head/sys/dev/usb/controller/uhci.h
==============================================================================
--- head/sys/dev/usb/controller/uhci.h	Fri May 29 18:35:51 2009	(r193044)
+++ head/sys/dev/usb/controller/uhci.h	Fri May 29 18:46:57 2009	(r193045)
@@ -309,9 +309,9 @@ typedef struct uhci_softc {
 	char	sc_vendor[16];		/* vendor string for root hub */
 } uhci_softc_t;
 
-usb2_bus_mem_cb_t uhci_iterate_hw_softc;
+usb_bus_mem_cb_t uhci_iterate_hw_softc;
 
-usb2_error_t uhci_init(uhci_softc_t *sc);
+usb_error_t uhci_init(uhci_softc_t *sc);
 void	uhci_suspend(uhci_softc_t *sc);
 void	uhci_resume(uhci_softc_t *sc);
 void	uhci_reset(uhci_softc_t *sc);

Modified: head/sys/dev/usb/controller/usb_controller.c
==============================================================================
--- head/sys/dev/usb/controller/usb_controller.c	Fri May 29 18:35:51 2009	(r193044)
+++ head/sys/dev/usb/controller/usb_controller.c	Fri May 29 18:46:57 2009	(r193045)
@@ -289,7 +289,7 @@ usb2_bus_attach(struct usb_proc_msg *pm)
 	struct usb_bus *bus;
 	struct usb_device *child;
 	device_t dev;
-	usb2_error_t err;
+	usb_error_t err;
 	enum usb_dev_speed speed;
 
 	bus = ((struct usb_bus_msg *)pm)->bus;
@@ -496,7 +496,7 @@ usb2_bus_mem_flush_all_cb(struct usb_bus
  *------------------------------------------------------------------------*/
 #if USB_HAVE_BUSDMA
 void
-usb2_bus_mem_flush_all(struct usb_bus *bus, usb2_bus_mem_cb_t *cb)
+usb2_bus_mem_flush_all(struct usb_bus *bus, usb_bus_mem_cb_t *cb)
 {
 	if (cb) {
 		cb(bus, &usb2_bus_mem_flush_all_cb);
@@ -530,7 +530,7 @@ usb2_bus_mem_alloc_all_cb(struct usb_bus
  *------------------------------------------------------------------------*/
 uint8_t
 usb2_bus_mem_alloc_all(struct usb_bus *bus, bus_dma_tag_t dmat,
-    usb2_bus_mem_cb_t *cb)
+    usb_bus_mem_cb_t *cb)
 {
 	bus->alloc_failed = 0;
 
@@ -580,7 +580,7 @@ usb2_bus_mem_free_all_cb(struct usb_bus 
  *	usb2_bus_mem_free_all - factored out code
  *------------------------------------------------------------------------*/
 void
-usb2_bus_mem_free_all(struct usb_bus *bus, usb2_bus_mem_cb_t *cb)
+usb2_bus_mem_free_all(struct usb_bus *bus, usb_bus_mem_cb_t *cb)
 {
 #if USB_HAVE_BUSDMA
 	if (cb) {

Modified: head/sys/dev/usb/controller/uss820dci.c
==============================================================================
--- head/sys/dev/usb/controller/uss820dci.c	Fri May 29 18:35:51 2009	(r193044)
+++ head/sys/dev/usb/controller/uss820dci.c	Fri May 29 18:46:57 2009	(r193045)
@@ -81,7 +81,7 @@ static uss820dci_cmd_t uss820dci_setup_r
 static uss820dci_cmd_t uss820dci_data_rx;
 static uss820dci_cmd_t uss820dci_data_tx;
 static uss820dci_cmd_t uss820dci_data_tx_sync;
-static void	uss820dci_device_done(struct usb_xfer *, usb2_error_t);
+static void	uss820dci_device_done(struct usb_xfer *, usb_error_t);
 static void	uss820dci_do_poll(struct usb_bus *);
 static void	uss820dci_standard_done(struct usb_xfer *);
 static void	uss820dci_intr_set(struct usb_xfer *, uint8_t);
@@ -1054,7 +1054,7 @@ uss820dci_root_intr(struct uss820dci_sof
 	    sizeof(sc->sc_hub_idata));
 }
 
-static usb2_error_t
+static usb_error_t
 uss820dci_standard_done_sub(struct usb_xfer *xfer)
 {
 	struct uss820dci_td *td;
@@ -1121,7 +1121,7 @@ uss820dci_standard_done_sub(struct usb_x
 static void
 uss820dci_standard_done(struct usb_xfer *xfer)
 {
-	usb2_error_t err = 0;
+	usb_error_t err = 0;
 
 	DPRINTFN(13, "xfer=%p pipe=%p transfer done\n",
 	    xfer, xfer->pipe);
@@ -1168,7 +1168,7 @@ done:
  * same USB transfer!
  *------------------------------------------------------------------------*/
 static void
-uss820dci_device_done(struct usb_xfer *xfer, usb2_error_t error)
+uss820dci_device_done(struct usb_xfer *xfer, usb_error_t error)
 {
 	USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED);
 
@@ -1298,7 +1298,7 @@ uss820dci_clear_stall(struct usb_device 
 	    (ed->bEndpointAddress & (UE_DIR_IN | UE_DIR_OUT)));
 }
 
-usb2_error_t
+usb_error_t
 uss820dci_init(struct uss820dci_softc *sc)
 {
 	const struct usb_hw_ep_profile *pf;
@@ -1790,7 +1790,7 @@ USB_MAKE_STRING_DESC(STRING_LANG, uss820
 USB_MAKE_STRING_DESC(STRING_VENDOR, uss820dci_vendor);
 USB_MAKE_STRING_DESC(STRING_PRODUCT, uss820dci_product);
 
-static usb2_error_t
+static usb_error_t
 uss820dci_roothub_exec(struct usb_device *udev,
     struct usb_device_request *req, const void **pptr, uint16_t *plength)
 {
@@ -1799,7 +1799,7 @@ uss820dci_roothub_exec(struct usb_device
 	uint16_t len;
 	uint16_t value;
 	uint16_t index;
-	usb2_error_t err;
+	usb_error_t err;
 
 	USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED);
 

Modified: head/sys/dev/usb/controller/uss820dci.h
==============================================================================
--- head/sys/dev/usb/controller/uss820dci.h	Fri May 29 18:35:51 2009	(r193044)
+++ head/sys/dev/usb/controller/uss820dci.h	Fri May 29 18:46:57 2009	(r193045)
@@ -347,7 +347,7 @@ struct uss820dci_softc {
 
 /* prototypes */
 
-usb2_error_t uss820dci_init(struct uss820dci_softc *sc);
+usb_error_t uss820dci_init(struct uss820dci_softc *sc);
 void	uss820dci_uninit(struct uss820dci_softc *sc);
 void	uss820dci_suspend(struct uss820dci_softc *sc);
 void	uss820dci_resume(struct uss820dci_softc *sc);

Modified: head/sys/dev/usb/input/uhid.c
==============================================================================
--- head/sys/dev/usb/input/uhid.c	Fri May 29 18:35:51 2009	(r193044)
+++ head/sys/dev/usb/input/uhid.c	Fri May 29 18:46:57 2009	(r193045)
@@ -126,17 +126,17 @@ static device_probe_t uhid_probe;
 static device_attach_t uhid_attach;
 static device_detach_t uhid_detach;
 
-static usb2_callback_t uhid_intr_callback;
-static usb2_callback_t uhid_write_callback;
-static usb2_callback_t uhid_read_callback;
-
-static usb2_fifo_cmd_t uhid_start_read;
-static usb2_fifo_cmd_t uhid_stop_read;
-static usb2_fifo_cmd_t uhid_start_write;
-static usb2_fifo_cmd_t uhid_stop_write;
-static usb2_fifo_open_t uhid_open;
-static usb2_fifo_close_t uhid_close;
-static usb2_fifo_ioctl_t uhid_ioctl;
+static usb_callback_t uhid_intr_callback;
+static usb_callback_t uhid_write_callback;
+static usb_callback_t uhid_read_callback;
+
+static usb_fifo_cmd_t uhid_start_read;
+static usb_fifo_cmd_t uhid_stop_read;
+static usb_fifo_cmd_t uhid_start_write;
+static usb_fifo_cmd_t uhid_stop_write;
+static usb_fifo_open_t uhid_open;
+static usb_fifo_close_t uhid_close;
+static usb_fifo_ioctl_t uhid_ioctl;
 
 static struct usb_fifo_methods uhid_fifo_methods = {
 	.f_open = &uhid_open,

Modified: head/sys/dev/usb/input/ukbd.c
==============================================================================
--- head/sys/dev/usb/input/ukbd.c	Fri May 29 18:35:51 2009	(r193044)
+++ head/sys/dev/usb/input/ukbd.c	Fri May 29 18:46:57 2009	(r193045)
@@ -688,7 +688,7 @@ ukbd_attach(device_t dev)
 	int32_t unit = device_get_unit(dev);
 	keyboard_t *kbd = &sc->sc_kbd;
 	void *hid_ptr = NULL;
-	usb2_error_t err;
+	usb_error_t err;
 	uint32_t flags;
 	uint16_t n;
 	uint16_t hid_len;

Modified: head/sys/dev/usb/input/ums.c
==============================================================================
--- head/sys/dev/usb/input/ums.c	Fri May 29 18:35:51 2009	(r193044)
+++ head/sys/dev/usb/input/ums.c	Fri May 29 18:46:57 2009	(r193045)
@@ -136,17 +136,17 @@ struct ums_softc {
 
 static void ums_put_queue_timeout(void *__sc);
 

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 18:50:27 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CC3951065670;
	Fri, 29 May 2009 18:50:27 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BA8958FC1B;
	Fri, 29 May 2009 18:50:27 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TIoRRE083311;
	Fri, 29 May 2009 18:50:27 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TIoRCL083308;
	Fri, 29 May 2009 18:50:27 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <200905291850.n4TIoRCL083308@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Fri, 29 May 2009 18:50:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193047 - in head: . sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 18:50:28 -0000

Author: trasz
Date: Fri May 29 18:50:27 2009
New Revision: 193047
URL: http://svn.freebsd.org/changeset/base/193047

Log:
  Update __FreeBSD_version after addition of mnt_xflag.  Add a note
  to UPDATING.

Modified:
  head/UPDATING
  head/sys/sys/param.h

Modified: head/UPDATING
==============================================================================
--- head/UPDATING	Fri May 29 18:48:18 2009	(r193046)
+++ head/UPDATING	Fri May 29 18:50:27 2009	(r193047)
@@ -22,6 +22,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.
 	to maximize performance.  (To disable malloc debugging, run
 	ln -s aj /etc/malloc.conf.)
 
+20090529:
+	Add mnt_xflag field to 'struct mount.  File system modules
+	need to be rebuilt.
+	Bump __FreeBSD_version to 800093.
+
 20090528:
 	The compiling option ADAPTIVE_SX has been retired while it has been
 	introduced the option NO_ADAPTIVE_SX which handles the reversed logic.

Modified: head/sys/sys/param.h
==============================================================================
--- head/sys/sys/param.h	Fri May 29 18:48:18 2009	(r193046)
+++ head/sys/sys/param.h	Fri May 29 18:50:27 2009	(r193047)
@@ -57,7 +57,7 @@
  *		is created, otherwise 1.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 800092	/* Master, propagated to newvers */
+#define __FreeBSD_version 800093	/* Master, propagated to newvers */
 
 #ifndef LOCORE
 #include 

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 19:18:41 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A097A106566B;
	Fri, 29 May 2009 19:18:41 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8E1AA8FC1E;
	Fri, 29 May 2009 19:18:41 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TJIfpX084055;
	Fri, 29 May 2009 19:18:41 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TJIfUm084052;
	Fri, 29 May 2009 19:18:41 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <200905291918.n4TJIfUm084052@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Fri, 29 May 2009 19:18:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193051 - head/sbin/mksnap_ffs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 19:18:42 -0000

Author: pjd
Date: Fri May 29 19:18:41 2009
New Revision: 193051
URL: http://svn.freebsd.org/changeset/base/193051

Log:
  - Move from mount(2) to nmount(2). This should allow to convert MNT_SNAPSHOT
    flag from a mount flag to FS-specific flag.
  - Simplify usage. Instead of 'mksnap_ffs /mnt/foo /mnt/foo/snap' allow to
    give only one argument: 'mksnap_ffs /mnt/foo/snap'. Old usage is also
    accepted for now.
  - Add an example of how to mount a snapshot.

Modified:
  head/sbin/mksnap_ffs/Makefile
  head/sbin/mksnap_ffs/mksnap_ffs.8
  head/sbin/mksnap_ffs/mksnap_ffs.c

Modified: head/sbin/mksnap_ffs/Makefile
==============================================================================
--- head/sbin/mksnap_ffs/Makefile	Fri May 29 19:09:53 2009	(r193050)
+++ head/sbin/mksnap_ffs/Makefile	Fri May 29 19:18:41 2009	(r193051)
@@ -1,8 +1,13 @@
 # $FreeBSD$
 
+.PATH:	${.CURDIR}/../mount
+
 PROG=	mksnap_ffs
+SRCS=	mksnap_ffs.c getmntopts.c
 MAN=	mksnap_ffs.8
 
+CFLAGS+=-I${.CURDIR}/../mount
+
 .if defined(NOSUID)
 BINMODE=550
 .else

Modified: head/sbin/mksnap_ffs/mksnap_ffs.8
==============================================================================
--- head/sbin/mksnap_ffs/mksnap_ffs.8	Fri May 29 19:09:53 2009	(r193050)
+++ head/sbin/mksnap_ffs/mksnap_ffs.8	Fri May 29 19:18:41 2009	(r193051)
@@ -34,7 +34,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 19, 2003
+.Dd May 29, 2009
 .Dt MKSNAP_FFS 8
 .Os
 .Sh NAME
@@ -42,19 +42,12 @@
 .Nd take a file system snapshot
 .Sh SYNOPSIS
 .Nm
-.Ar mountpoint
 .Ar snapshot_name
 .Sh DESCRIPTION
 The
 .Nm
 utility creates a snapshot named
-.Ar snapshot_name
-on the file system mounted at
-.Ar mountpoint .
-The
-.Ar snapshot_name
-argument must be contained within the file system mounted at
-.Ar mountpoint .
+.Ar snapshot_name .
 .Pp
 The group ownership of the file is set to
 .Dq Li operator ;
@@ -64,9 +57,19 @@ The mode of the snapshot is set to be re
 or members of the
 .Dq Li operator
 group.
+.Sh EXAMPLES
+Create a snapshot of
+.Pa /usr/home
+file system and mount the snapshot elsewhere:
+.Bd -literal -offset indent
+mksnap_ffs /usr/home/snapshot
+mdconfig -a -t vnode -o readonly -f /usr/home/snapshot
+mount -o ro /dev/md0 /mnt/
+.Ed
 .Sh SEE ALSO
 .Xr chmod 2 ,
 .Xr chown 8 ,
+.Xr mdconfig 8,
 .Xr mount 8
 .Sh CAVEATS
 The disk full situation is not handled gracefully and may

Modified: head/sbin/mksnap_ffs/mksnap_ffs.c
==============================================================================
--- head/sbin/mksnap_ffs/mksnap_ffs.c	Fri May 29 19:09:53 2009	(r193050)
+++ head/sbin/mksnap_ffs/mksnap_ffs.c	Fri May 29 19:18:41 2009	(r193051)
@@ -44,31 +44,38 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
-void usage(void);
+static void
+usage(void)
+{
+
+	errx(EX_USAGE, "usage: mksnap_ffs snapshot_name");
+}
 
 int
 main(int argc, char **argv)
 {
-	char *dir, *cp, path[PATH_MAX];
+	char errmsg[255], path[PATH_MAX];
+	char *cp, *snapname;
 	struct statfs stfsbuf;
-	struct ufs_args args;
 	struct group *grp;
 	struct stat stbuf;
-	int fd;
+	struct iovec *iov;
+	int fd, iovlen;
 
-	if (argc != 3)
+	if (argc == 2)
+		snapname = argv[1];
+	else if (argc == 3)
+		snapname = argv[2];	/* Old usage. */
+	else
 		usage();
 
-	dir = argv[1];
-	memset(&args, 0, sizeof args);
-	args.fspec = argv[2];
-
 	/*
 	 * Check that the user running this program has permission
 	 * to create and remove a snapshot file from the directory
@@ -77,15 +84,15 @@ main(int argc, char **argv)
 	 * will not be able to remove the snapshot when they are
 	 * done with it.
 	 */
-	if (strlen(args.fspec) >= PATH_MAX)
-		errx(1, "pathname too long %s", args.fspec);
-	cp = strrchr(args.fspec, '/');
+	if (strlen(snapname) >= PATH_MAX)
+		errx(1, "pathname too long %s", snapname);
+	cp = strrchr(snapname, '/');
 	if (cp == NULL) {
 		strlcpy(path, ".", PATH_MAX);
-	} else if (cp == args.fspec) {
+	} else if (cp == snapname) {
 		strlcpy(path, "/", PATH_MAX);
 	} else {
-		strlcpy(path, args.fspec, cp - args.fspec + 1);
+		strlcpy(path, snapname, cp - snapname + 1);
 	}
 	if (statfs(path, &stfsbuf) < 0)
 		err(1, "%s", path);
@@ -104,27 +111,26 @@ main(int argc, char **argv)
 	 */
 	if ((grp = getgrnam("operator")) == NULL)
 		errx(1, "Cannot retrieve operator gid");
-	if (mount("ufs", dir, MNT_UPDATE | MNT_SNAPSHOT | stfsbuf.f_flags,
-	    &args) < 0)
-		err(1, "Cannot create %s", args.fspec);
-	if ((fd = open(args.fspec, O_RDONLY)) < 0)
-		err(1, "Cannot open %s", args.fspec);
+
+	build_iovec(&iov, &iovlen, "fstype", "ffs", 4);
+	build_iovec(&iov, &iovlen, "from", snapname, (size_t)-1);
+	build_iovec(&iov, &iovlen, "fspath", stfsbuf.f_mntonname, (size_t)-1);
+	build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg));
+	build_iovec(&iov, &iovlen, "update", NULL, 0);
+	build_iovec(&iov, &iovlen, "snapshot", NULL, 0);
+
+	if (nmount(iov, iovlen, stfsbuf.f_flags) < 0)
+		err(1, "Cannot create snapshot %s: %s", snapname, errmsg);
+	if ((fd = open(snapname, O_RDONLY)) < 0)
+		err(1, "Cannot open %s", snapname);
 	if (fstat(fd, &stbuf) != 0)
-		err(1, "Cannot stat %s", args.fspec);
+		err(1, "Cannot stat %s", snapname);
 	if ((stbuf.st_flags & SF_SNAPSHOT) == 0)
-		errx(1, "File %s is not a snapshot", args.fspec);
+		errx(1, "File %s is not a snapshot", snapname);
 	if (fchown(fd, -1, grp->gr_gid) != 0)
-		err(1, "Cannot chown %s", args.fspec);
+		err(1, "Cannot chown %s", snapname);
 	if (fchmod(fd, S_IRUSR | S_IRGRP) != 0)
-		err(1, "Cannot chmod %s", args.fspec);
+		err(1, "Cannot chmod %s", snapname);
 
 	exit(EXIT_SUCCESS);
 }
-
-void
-usage()
-{
-
-	fprintf(stderr, "usage: mksnap_ffs mountpoint snapshot_name\n");
-	exit(EX_USAGE);
-}

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 19:45:40 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 052C91065674;
	Fri, 29 May 2009 19:45:40 +0000 (UTC)
	(envelope-from maxim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E82DC8FC14;
	Fri, 29 May 2009 19:45:39 +0000 (UTC)
	(envelope-from maxim@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TJjd2Q084758;
	Fri, 29 May 2009 19:45:39 GMT (envelope-from maxim@svn.freebsd.org)
Received: (from maxim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TJjdba084757;
	Fri, 29 May 2009 19:45:39 GMT (envelope-from maxim@svn.freebsd.org)
Message-Id: <200905291945.n4TJjdba084757@svn.freebsd.org>
From: Maxim Konovalov 
Date: Fri, 29 May 2009 19:45:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193055 - head
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 19:45:40 -0000

Author: maxim
Date: Fri May 29 19:45:39 2009
New Revision: 193055
URL: http://svn.freebsd.org/changeset/base/193055

Log:
  o Add missed quotation mark.

Modified:
  head/UPDATING

Modified: head/UPDATING
==============================================================================
--- head/UPDATING	Fri May 29 19:42:32 2009	(r193054)
+++ head/UPDATING	Fri May 29 19:45:39 2009	(r193055)
@@ -23,7 +23,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.
 	ln -s aj /etc/malloc.conf.)
 
 20090529:
-	Add mnt_xflag field to 'struct mount.  File system modules
+	Add mnt_xflag field to 'struct mount'.  File system modules
 	need to be rebuilt.
 	Bump __FreeBSD_version to 800093.
 

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 20:01:51 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 16E201065670;
	Fri, 29 May 2009 20:01:51 +0000 (UTC)
	(envelope-from lulf@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 058138FC1F;
	Fri, 29 May 2009 20:01:51 +0000 (UTC)
	(envelope-from lulf@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TK1o8I085255;
	Fri, 29 May 2009 20:01:50 GMT (envelope-from lulf@svn.freebsd.org)
Received: (from lulf@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TK1oTN085254;
	Fri, 29 May 2009 20:01:50 GMT (envelope-from lulf@svn.freebsd.org)
Message-Id: <200905292001.n4TK1oTN085254@svn.freebsd.org>
From: Ulf Lilleengen 
Date: Fri, 29 May 2009 20:01:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193059 - head/sbin/fsck_ffs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 20:01:51 -0000

Author: lulf
Date: Fri May 29 20:01:50 2009
New Revision: 193059
URL: http://svn.freebsd.org/changeset/base/193059

Log:
  - Use sig_atomic_t for signal handler variables.
  
  MFC after:	1 week

Modified:
  head/sbin/fsck_ffs/fsck.h

Modified: head/sbin/fsck_ffs/fsck.h
==============================================================================
--- head/sbin/fsck_ffs/fsck.h	Fri May 29 19:50:03 2009	(r193058)
+++ head/sbin/fsck_ffs/fsck.h	Fri May 29 20:01:50 2009	(r193059)
@@ -297,8 +297,8 @@ int	lfmode;			/* lost & found directory 
 ufs2_daddr_t n_blks;		/* number of blocks in use */
 ino_t n_files;			/* number of files in use */
 
-int	got_siginfo;		/* received a SIGINFO */
-int	got_sigalarm;		/* received a SIGALRM */
+sig_atomic_t	got_siginfo;	/* received a SIGINFO */
+sig_atomic_t	got_sigalarm;	/* received a SIGALRM */
 
 #define	clearinode(dp) \
 	if (sblock.fs_magic == FS_UFS1_MAGIC) { \

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 20:11:37 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 42406106566B;
	Fri, 29 May 2009 20:11:37 +0000 (UTC)
	(envelope-from ivoras@gmail.com)
Received: from mail-ew0-f164.google.com (mail-ew0-f164.google.com
	[209.85.219.164])
	by mx1.freebsd.org (Postfix) with ESMTP id 161DA8FC17;
	Fri, 29 May 2009 20:11:35 +0000 (UTC)
	(envelope-from ivoras@gmail.com)
Received: by ewy8 with SMTP id 8so3045844ewy.43
	for ; Fri, 29 May 2009 13:11:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:sender:received:in-reply-to
	:references:from:date:x-google-sender-auth:message-id:subject:to:cc
	:content-type:content-transfer-encoding;
	bh=mo5EDxJnMZoBow43AzXoPBKwQNx1XsQzMermrQ+PjkY=;
	b=jusenxNhyROMQCv8WqLpg5ytW+9HsMKE6ewDCyjQGzMegWGdzuCLt8H6SNTDzJssSl
	veMKBnEe5c1QYR7Du8zKwCohz1u+1+jv87J5n9fYQybgGtrdgzfi8dlg1QK301XaHj0g
	RwbqlFdD1YE9+V1BKGQyt789kaIr8jdiMETVo=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:from:date
	:x-google-sender-auth:message-id:subject:to:cc:content-type
	:content-transfer-encoding;
	b=wLnS810Pdfb4rmjq697MKzy7HFgSZo6GH7Cr44xEOucV7DFZTjLj5FEqaoYiKNWs0c
	RZoqtbAFvKH187mTGxMOU6jZtqu5rSURHcYKXGcnoozVsmU/3ZuApJV/XeEpgWeA28t4
	gKGEo3t72DDANDsLlQhkzGY0S2WsKHvo2x4ns=
MIME-Version: 1.0
Sender: ivoras@gmail.com
Received: by 10.216.6.198 with SMTP id 48mr1068700wen.200.1243627895101; Fri, 
	29 May 2009 13:11:35 -0700 (PDT)
In-Reply-To: <200905291500.n4TF04HM078212@svn.freebsd.org>
References: <200905291500.n4TF04HM078212@svn.freebsd.org>
From: Ivan Voras 
Date: Fri, 29 May 2009 22:11:15 +0200
X-Google-Sender-Auth: ed929103f88d03f9
Message-ID: <9bbcef730905291311u5f39708bifbd8af9fad195965@mail.gmail.com>
To: Edward Tomasz Napierala 
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r193041 - head/sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 20:11:37 -0000

2009/5/29 Edward Tomasz Napierala :

> =C2=A0 =C2=A0 =C2=A0 =C2=A0u_int =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 mnt_f=
lag; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* (i) flags shared w=
ith user */
> + =C2=A0 =C2=A0 =C2=A0 u_int =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 mnt_xflag=
; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* (i) more flags shared =
with user */

I have a trivial question, it probably has to do more with style than
with technical issues: why not expand this variable to u_int64 instead
of introducing another variable? Atomicity of int access on 32-bit
platforms could be an answer but judging from what the variable does,
I don't see it being very relevant.

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 21:17:22 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 67EB01065706;
	Fri, 29 May 2009 21:17:22 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 56C018FC0A;
	Fri, 29 May 2009 21:17:22 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TLHMxJ087037;
	Fri, 29 May 2009 21:17:22 GMT (envelope-from jamie@svn.freebsd.org)
Received: (from jamie@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TLHM1Y087036;
	Fri, 29 May 2009 21:17:22 GMT (envelope-from jamie@svn.freebsd.org)
Message-Id: <200905292117.n4TLHM1Y087036@svn.freebsd.org>
From: Jamie Gritton 
Date: Fri, 29 May 2009 21:17:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193065 - head/usr.sbin/jail
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 21:17:22 -0000

Author: jamie
Date: Fri May 29 21:17:22 2009
New Revision: 193065
URL: http://svn.freebsd.org/changeset/base/193065

Log:
  Fix some inaccuracies in the extensible parameter addition.
  
  Approved by:	bz (mentor)

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

Modified: head/usr.sbin/jail/jail.8
==============================================================================
--- head/usr.sbin/jail/jail.8	Fri May 29 20:45:42 2009	(r193064)
+++ head/usr.sbin/jail/jail.8	Fri May 29 21:17:22 2009	(r193065)
@@ -201,7 +201,7 @@ parameters aren't in this list, this mod
 the
 .Fl c
 and
-.Fl o
+.Fl m
 options don't apply (and must not exist).
 .Pp
 Jails have a set a core parameters, and modules can add their own jail
@@ -298,7 +298,7 @@ A new jail must have either the
 parameter or
 .Va command
 pseudo-parameter set.
-.It Va cpuset
+.It Va cpuset.id
 The ID of the cpuset associated with this jail (read-only).
 .It Va dying
 This is true if the jail is in the process of shutting down (read-only).

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 21:27:13 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6067F1065678;
	Fri, 29 May 2009 21:27:13 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4A6C48FC1E;
	Fri, 29 May 2009 21:27:13 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TLRD1p087286;
	Fri, 29 May 2009 21:27:13 GMT (envelope-from jamie@svn.freebsd.org)
Received: (from jamie@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TLRCMU087261;
	Fri, 29 May 2009 21:27:12 GMT (envelope-from jamie@svn.freebsd.org)
Message-Id: <200905292127.n4TLRCMU087261@svn.freebsd.org>
From: Jamie Gritton 
Date: Fri, 29 May 2009 21:27:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193066 - in head: sys/amd64/amd64 sys/arm/arm
	sys/cddl/compat/opensolaris/kern sys/compat/linux
	sys/compat/svr4 sys/ddb sys/dev/firewire
	sys/dev/syscons/daemon sys/fs/cd9660 sys/fs/nfs...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 21:27:13 -0000

Author: jamie
Date: Fri May 29 21:27:12 2009
New Revision: 193066
URL: http://svn.freebsd.org/changeset/base/193066

Log:
  Place hostnames and similar information fully under the prison system.
  The system hostname is now stored in prison0, and the global variable
  "hostname" has been removed, as has the hostname_mtx mutex.  Jails may
  have their own host information, or they may inherit it from the
  parent/system.  The proper way to read the hostname is via
  getcredhostname(), which will copy either the hostname associated with
  the passed cred, or the system hostname if you pass NULL.  The system
  hostname can still be accessed directly (and without locking) at
  prison0.pr_host, but that should be avoided where possible.
  
  The "similar information" referred to is domainname, hostid, and
  hostuuid, which have also become prison parameters and had their
  associated global variables removed.
  
  Approved by:	bz (mentor)

Modified:
  head/sys/amd64/amd64/dump_machdep.c
  head/sys/amd64/amd64/minidump_machdep.c
  head/sys/arm/arm/dump_machdep.c
  head/sys/cddl/compat/opensolaris/kern/opensolaris.c
  head/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c
  head/sys/compat/linux/linux_misc.c
  head/sys/compat/svr4/svr4_stat.c
  head/sys/ddb/db_textdump.c
  head/sys/dev/firewire/firewire.c
  head/sys/dev/syscons/daemon/daemon_saver.c
  head/sys/fs/cd9660/cd9660_rrip.c
  head/sys/fs/nfs/nfsport.h
  head/sys/fs/nfsclient/nfs_clstate.c
  head/sys/fs/nfsclient/nfs_clvfsops.c
  head/sys/geom/vinum/geom_vinum_create.c
  head/sys/geom/vinum/geom_vinum_drive.c
  head/sys/i386/i386/dump_machdep.c
  head/sys/i386/i386/minidump_machdep.c
  head/sys/i386/ibcs2/ibcs2_socksys.c
  head/sys/ia64/ia64/dump_machdep.c
  head/sys/kern/kern_jail.c
  head/sys/kern/kern_mib.c
  head/sys/kern/kern_shutdown.c
  head/sys/kern/kern_xxx.c
  head/sys/kgssapi/gsstest.c
  head/sys/netinet6/icmp6.c
  head/sys/netinet6/in6_ifattach.c
  head/sys/nfsclient/bootp_subr.c
  head/sys/nfsclient/nfs_vfsops.c
  head/sys/nfsserver/nfs_srvkrpc.c
  head/sys/nlm/nlm_advlock.c
  head/sys/rpc/authunix_prot.c
  head/sys/sparc64/sparc64/dump_machdep.c
  head/sys/sun4v/sun4v/dump_machdep.c
  head/sys/sys/jail.h
  head/sys/sys/kernel.h
  head/sys/sys/priv.h
  head/sys/sys/vimage.h
  head/usr.sbin/jail/jail.8

Modified: head/sys/amd64/amd64/dump_machdep.c
==============================================================================
--- head/sys/amd64/amd64/dump_machdep.c	Fri May 29 21:17:22 2009	(r193065)
+++ head/sys/amd64/amd64/dump_machdep.c	Fri May 29 21:27:12 2009	(r193066)
@@ -34,7 +34,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: head/sys/amd64/amd64/minidump_machdep.c
==============================================================================
--- head/sys/amd64/amd64/minidump_machdep.c	Fri May 29 21:17:22 2009	(r193065)
+++ head/sys/amd64/amd64/minidump_machdep.c	Fri May 29 21:27:12 2009	(r193066)
@@ -34,7 +34,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: head/sys/arm/arm/dump_machdep.c
==============================================================================
--- head/sys/arm/arm/dump_machdep.c	Fri May 29 21:17:22 2009	(r193065)
+++ head/sys/arm/arm/dump_machdep.c	Fri May 29 21:27:12 2009	(r193066)
@@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris.c
==============================================================================
--- head/sys/cddl/compat/opensolaris/kern/opensolaris.c	Fri May 29 21:17:22 2009	(r193065)
+++ head/sys/cddl/compat/opensolaris/kern/opensolaris.c	Fri May 29 21:27:12 2009	(r193066)
@@ -31,11 +31,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
-#include 
 
 cpu_core_t	cpu_core[MAXCPU];
 kmutex_t	cpu_lock;
@@ -83,7 +83,7 @@ opensolaris_modevent(module_t mod __unus
 
 	switch (type) {
 	case MOD_LOAD:
-		utsname.nodename = G_hostname;
+		utsname.nodename = prison0.pr_host;
 		break;
 
 	case MOD_UNLOAD:

Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c
==============================================================================
--- head/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c	Fri May 29 21:17:22 2009	(r193065)
+++ head/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c	Fri May 29 21:27:12 2009	(r193066)
@@ -28,6 +28,7 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -57,7 +58,7 @@ ddi_strtoul(const char *str, char **nptr
 {
 
 	if (str == hw_serial) {
-		*result = hostid;
+		*result = prison0.pr_hostid;
 		return (0);
 	}
 

Modified: head/sys/compat/linux/linux_misc.c
==============================================================================
--- head/sys/compat/linux/linux_misc.c	Fri May 29 21:17:22 2009	(r193065)
+++ head/sys/compat/linux/linux_misc.c	Fri May 29 21:27:12 2009	(r193066)
@@ -64,7 +64,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 
 #include 
 
@@ -715,10 +714,10 @@ linux_times(struct thread *td, struct li
 int
 linux_newuname(struct thread *td, struct linux_newuname_args *args)
 {
-	INIT_VPROCG(TD_TO_VPROCG(td));
 	struct l_new_utsname utsname;
 	char osname[LINUX_MAX_UTSNAME];
 	char osrelease[LINUX_MAX_UTSNAME];
+	struct prison *pr;
 	char *p;
 
 #ifdef DEBUG
@@ -741,9 +740,10 @@ linux_newuname(struct thread *td, struct
 		}
 	strlcpy(utsname.machine, linux_platform, LINUX_MAX_UTSNAME);
 
-	mtx_lock(&hostname_mtx);
-	strlcpy(utsname.domainname, V_domainname, LINUX_MAX_UTSNAME);
-	mtx_unlock(&hostname_mtx);
+	pr = td->td_ucred->cr_prison;
+	mtx_lock(&pr->pr_mtx);
+	strlcpy(utsname.domainname, pr->pr_domain, LINUX_MAX_UTSNAME);
+	mtx_unlock(&pr->pr_mtx);
 
 	return (copyout(&utsname, args->buf, sizeof(utsname)));
 }

Modified: head/sys/compat/svr4/svr4_stat.c
==============================================================================
--- head/sys/compat/svr4/svr4_stat.c	Fri May 29 21:17:22 2009	(r193065)
+++ head/sys/compat/svr4/svr4_stat.c	Fri May 29 21:27:12 2009	(r193066)
@@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 
 #include 
 
@@ -386,7 +385,7 @@ svr4_ustat(td, uap)
 	return 0;
 }
 
-/*extern char ostype[], hostname[], osrelease[], version[], machine[];*/
+/*extern char ostype[], osrelease[], version[], machine[];*/
 
 int
 svr4_sys_uname(td, uap)
@@ -412,15 +411,12 @@ svr4_sys_systeminfo(td, uap)
 	struct thread *td;
 	struct svr4_sys_systeminfo_args *uap;
 {
-	INIT_VPROCG(TD_TO_VPROCG(td));
+	struct prison	*pr;
 	char		*str = NULL;
 	int		error = 0;
 	register_t	*retval = td->td_retval;
 	size_t		len = 0;
-	char		buf[11];   /* XXX NetBSD uses 256, but we use 11
-				     here as that seems like awfully
-				     excessive kstack usage for hostid
-				     string... */
+	char		buf[MAXHOSTNAMELEN];
 	u_int		rlen = uap->len;
 
 	switch (uap->what) {
@@ -429,7 +425,8 @@ svr4_sys_systeminfo(td, uap)
 		break;
 
 	case SVR4_SI_HOSTNAME:
-		str = V_hostname;
+		getcredhostname(td->td_ucred, buf, sizeof(buf));
+		str = buf;
 		break;
 
 	case SVR4_SI_RELEASE:
@@ -470,8 +467,11 @@ svr4_sys_systeminfo(td, uap)
 		break;
 
 	case SVR4_SI_SRPC_DOMAIN:
-		/* XXXRW: locking? */
-		str = V_domainname;
+		pr = td->td_ucred->cr_prison;
+		mtx_lock(&pr->pr_mtx);
+		strlcpy(buf, pr->pr_domain, sizeof(buf));
+		mtx_unlock(&pr->pr_mtx);
+		str = buf;
 		break;
 
 	case SVR4_SI_PLATFORM:

Modified: head/sys/ddb/db_textdump.c
==============================================================================
--- head/sys/ddb/db_textdump.c	Fri May 29 21:17:22 2009	(r193065)
+++ head/sys/ddb/db_textdump.c	Fri May 29 21:27:12 2009	(r193066)
@@ -68,7 +68,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 

Modified: head/sys/dev/firewire/firewire.c
==============================================================================
--- head/sys/dev/firewire/firewire.c	Fri May 29 21:17:22 2009	(r193065)
+++ head/sys/dev/firewire/firewire.c	Fri May 29 21:27:12 2009	(r193066)
@@ -39,13 +39,13 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
 
 #include 
 
@@ -723,7 +723,9 @@ fw_reset_crom(struct firewire_comm *fc)
 	crom_add_simple_text(src, root, &buf->vendor, "FreeBSD Project");
 	crom_add_entry(root, CSRKEY_HW, __FreeBSD_version);
 #endif
-	crom_add_simple_text(src, root, &buf->hw, G_hostname);
+	mtx_lock(&prison0.pr_mtx);
+	crom_add_simple_text(src, root, &buf->hw, prison0.pr_host);
+	mtx_unlock(&prison0.pr_mtx);
 }
 
 /*

Modified: head/sys/dev/syscons/daemon/daemon_saver.c
==============================================================================
--- head/sys/dev/syscons/daemon/daemon_saver.c	Fri May 29 21:17:22 2009	(r193065)
+++ head/sys/dev/syscons/daemon/daemon_saver.c	Fri May 29 21:27:12 2009	(r193066)
@@ -32,11 +32,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
-#include 
 
 #include 
 
@@ -352,11 +352,12 @@ static int
 daemon_init(video_adapter_t *adp)
 {
 
-	/* XXXRW: Locking -- these can change! */
-	messagelen = strlen(G_hostname) + 3 + strlen(ostype) + 1 + 
+	mtx_lock(&prison0.pr_mtx);
+	messagelen = strlen(prison0.pr_host) + 3 + strlen(ostype) + 1 + 
 	    strlen(osrelease);
 	message = malloc(messagelen + 1, M_DEVBUF, M_WAITOK);
-	sprintf(message, "%s - %s %s", G_hostname, ostype, osrelease);
+	sprintf(message, "%s - %s %s", prison0.pr_host, ostype, osrelease);
+	mtx_unlock(&prison0.pr_mtx);
 	blanked = 0;
 	switch (adp->va_mode) {
 	case M_PC98_80x25:

Modified: head/sys/fs/cd9660/cd9660_rrip.c
==============================================================================
--- head/sys/fs/cd9660/cd9660_rrip.c	Fri May 29 21:17:22 2009	(r193065)
+++ head/sys/fs/cd9660/cd9660_rrip.c	Fri May 29 21:27:12 2009	(r193066)
@@ -41,10 +41,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -114,11 +114,11 @@ cd9660_rrip_slink(p,ana)
 	ISO_RRIP_SLINK	*p;
 	ISO_RRIP_ANALYZE *ana;
 {
-	INIT_VPROCG(TD_TO_VPROCG(curthread));
 	ISO_RRIP_SLINK_COMPONENT *pcomp;
 	ISO_RRIP_SLINK_COMPONENT *pcompe;
 	int len, wlen, cont;
 	char *outbuf, *inbuf;
+	char hostbuf[MAXHOSTNAMELEN];
 
 	pcomp = (ISO_RRIP_SLINK_COMPONENT *)p->component;
 	pcompe = (ISO_RRIP_SLINK_COMPONENT *)((char *)p + isonum_711(p->h.length));
@@ -172,10 +172,11 @@ cd9660_rrip_slink(p,ana)
 			break;
 
 		case ISO_SUSP_CFLAG_HOST:
-			/* XXXRW: locking. */
 			/* Inserting hostname i.e. "kurt.tools.de" */
-			inbuf = V_hostname;
-			wlen = strlen(V_hostname);
+			getcredhostname(curthread->td_ucred, hostbuf,
+			    sizeof(hostbuf));
+			inbuf = hostbuf;
+			wlen = strlen(inbuf);
 			break;
 
 		case ISO_SUSP_CFLAG_CONTINUE:
@@ -225,10 +226,10 @@ cd9660_rrip_altname(p,ana)
 	ISO_RRIP_ALTNAME *p;
 	ISO_RRIP_ANALYZE *ana;
 {
-	INIT_VPROCG(TD_TO_VPROCG(curthread));
 	char *inbuf;
 	int wlen;
 	int cont;
+	char hostbuf[MAXHOSTNAMELEN];
 
 	inbuf = "..";
 	wlen = 0;
@@ -246,10 +247,10 @@ cd9660_rrip_altname(p,ana)
 		break;
 
 	case ISO_SUSP_CFLAG_HOST:
-		/* XXXRW: locking. */
 		/* Inserting hostname i.e. "kurt.tools.de" */
-		inbuf = V_hostname;
-		wlen = strlen(V_hostname);
+		getcredhostname(curthread->td_ucred, hostbuf, sizeof(hostbuf));
+		inbuf = hostbuf;
+		wlen = strlen(inbuf);
 		break;
 
 	case ISO_SUSP_CFLAG_CONTINUE:

Modified: head/sys/fs/nfs/nfsport.h
==============================================================================
--- head/sys/fs/nfs/nfsport.h	Fri May 29 21:17:22 2009	(r193065)
+++ head/sys/fs/nfs/nfsport.h	Fri May 29 21:27:12 2009	(r193066)
@@ -49,6 +49,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 

Modified: head/sys/fs/nfsclient/nfs_clstate.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clstate.c	Fri May 29 21:17:22 2009	(r193065)
+++ head/sys/fs/nfsclient/nfs_clstate.c	Fri May 29 21:27:12 2009	(r193066)
@@ -675,10 +675,16 @@ nfscl_getcl(vnode_t vp, struct ucred *cr
 	struct nfsclclient *newclp;
 	struct nfscllockowner *lp, *nlp;
 	struct nfsmount *nmp = VFSTONFS(vnode_mount(vp));
+	struct prison *pr;
+	char uuid[HOSTUUIDLEN];
 	int igotlock = 0, error, trystalecnt, clidinusedelay, i;
 	u_int16_t idlen;
 
-	idlen = strlen(hostuuid);
+	pr = cred->cr_prison;
+	mtx_lock(&pr->pr_mtx);
+	strlcpy(uuid, pr->pr_uuid, sizeof uuid);
+	mtx_unlock(&pr->pr_mtx);
+	idlen = strlen(uuid);
 	if (idlen > 0)
 		idlen += sizeof (u_int64_t);
 	else
@@ -699,7 +705,7 @@ nfscl_getcl(vnode_t vp, struct ucred *cr
 		clp->nfsc_flags = NFSCLFLAGS_INITED;
 		clp->nfsc_clientidrev = 1;
 		clp->nfsc_cbident = nfscl_nextcbident();
-		nfscl_fillclid(nmp->nm_clval, hostuuid, clp->nfsc_id,
+		nfscl_fillclid(nmp->nm_clval, uuid, clp->nfsc_id,
 		    clp->nfsc_idlen);
 		LIST_INSERT_HEAD(&nfsclhead, clp, nfsc_list);
 		nmp->nm_clp = clp;

Modified: head/sys/fs/nfsclient/nfs_clvfsops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clvfsops.c	Fri May 29 21:17:22 2009	(r193065)
+++ head/sys/fs/nfsclient/nfs_clvfsops.c	Fri May 29 21:27:12 2009	(r193066)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -368,12 +369,11 @@ int
 ncl_mountroot(struct mount *mp)
 {
 	struct thread *td = curthread;
-	INIT_VPROCG(TD_TO_VPROCG(td));
 	struct nfsv3_diskless *nd = &newnfsv3_diskless;
 	struct socket *so;
 	struct vnode *vp;
 	struct ifreq ir;
-	int error, i;
+	int error;
 	u_long l;
 	char buf[128];
 	char *cp;
@@ -477,13 +477,9 @@ ncl_mountroot(struct mount *mp)
 	 * set hostname here and then let the "/etc/rc.xxx" files
 	 * mount the right /var based upon its preset value.
 	 */
-	mtx_lock(&hostname_mtx);
-	bcopy(nd->my_hostnam, V_hostname, MAXHOSTNAMELEN);
-	V_hostname[MAXHOSTNAMELEN - 1] = '\0';
-	for (i = 0; i < MAXHOSTNAMELEN; i++)
-		if (V_hostname[i] == '\0')
-			break;
-	mtx_unlock(&hostname_mtx);
+	mtx_lock(&prison0.pr_mtx);
+	strlcpy(prison0.pr_host, nd->my_hostnam, sizeof(prison0.pr_host));
+	mtx_unlock(&prison0.pr_mtx);
 	inittodr(ntohl(nd->root_time));
 	return (0);
 }

Modified: head/sys/geom/vinum/geom_vinum_create.c
==============================================================================
--- head/sys/geom/vinum/geom_vinum_create.c	Fri May 29 21:17:22 2009	(r193065)
+++ head/sys/geom/vinum/geom_vinum_create.c	Fri May 29 21:27:12 2009	(r193066)
@@ -31,10 +31,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -157,9 +157,7 @@ gv_create_drive(struct gv_softc *sc, str
 		hdr = g_malloc(sizeof(*hdr), M_WAITOK | M_ZERO);
 		hdr->magic = GV_MAGIC;
 		hdr->config_length = GV_CFG_LEN;
-		mtx_lock(&hostname_mtx);
-		bcopy(G_hostname, hdr->label.sysname, GV_HOSTNAME_LEN);
-		mtx_unlock(&hostname_mtx);
+		getcredhostname(NULL, hdr->label.sysname, GV_HOSTNAME_LEN);
 		strlcpy(hdr->label.name, d->name, sizeof(hdr->label.name));
 		microtime(&hdr->label.date_of_birth);
 		d->hdr = hdr;

Modified: head/sys/geom/vinum/geom_vinum_drive.c
==============================================================================
--- head/sys/geom/vinum/geom_vinum_drive.c	Fri May 29 21:17:22 2009	(r193065)
+++ head/sys/geom/vinum/geom_vinum_drive.c	Fri May 29 21:27:12 2009	(r193066)
@@ -30,7 +30,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 

Modified: head/sys/i386/i386/dump_machdep.c
==============================================================================
--- head/sys/i386/i386/dump_machdep.c	Fri May 29 21:17:22 2009	(r193065)
+++ head/sys/i386/i386/dump_machdep.c	Fri May 29 21:27:12 2009	(r193066)
@@ -34,7 +34,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: head/sys/i386/i386/minidump_machdep.c
==============================================================================
--- head/sys/i386/i386/minidump_machdep.c	Fri May 29 21:17:22 2009	(r193065)
+++ head/sys/i386/i386/minidump_machdep.c	Fri May 29 21:27:12 2009	(r193066)
@@ -34,7 +34,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: head/sys/i386/ibcs2/ibcs2_socksys.c
==============================================================================
--- head/sys/i386/ibcs2/ibcs2_socksys.c	Fri May 29 21:17:22 2009	(r193065)
+++ head/sys/i386/ibcs2/ibcs2_socksys.c	Fri May 29 21:27:12 2009	(r193066)
@@ -31,10 +31,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
-#include 
 
 #include 
 #include 
@@ -152,7 +149,7 @@ ibcs2_getipdomainname(td, uap)
 	char hname[MAXHOSTNAMELEN], *dptr;
 	int len;
 
-	/* Get the domain name */
+	/* Get the domain name. */
 	getcredhostname(td->td_ucred, hname, sizeof(hname));
 
 	dptr = index(hname, '.');
@@ -174,20 +171,17 @@ ibcs2_setipdomainname(td, uap)
         struct thread *td;
         struct setipdomainname_args *uap;
 {
-	INIT_VPROCG(TD_TO_VPROCG(td));
 	char hname[MAXHOSTNAMELEN], *ptr;
 	int error, sctl[2], hlen;
 
+	/* Get the domain name */
+	getcredhostname(td->td_ucred, hname, sizeof(hname));
+
 	/* W/out a hostname a domain-name is nonsense */
-	mtx_lock(&hostname_mtx);
-	if ( strlen(V_hostname) == 0 ) {
-		mtx_unlock(&hostname_mtx);
+	if ( strlen(hname) == 0 )
 		return EINVAL;
-	}
 
 	/* Get the host's unqualified name (strip off the domain) */
-	snprintf(hname, sizeof(hname), "%s", V_hostname);
-	mtx_unlock(&hostname_mtx);
 	ptr = index(hname, '.');
 	if ( ptr != NULL ) {
 		ptr++;

Modified: head/sys/ia64/ia64/dump_machdep.c
==============================================================================
--- head/sys/ia64/ia64/dump_machdep.c	Fri May 29 21:17:22 2009	(r193065)
+++ head/sys/ia64/ia64/dump_machdep.c	Fri May 29 21:27:12 2009	(r193066)
@@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: head/sys/kern/kern_jail.c
==============================================================================
--- head/sys/kern/kern_jail.c	Fri May 29 21:17:22 2009	(r193065)
+++ head/sys/kern/kern_jail.c	Fri May 29 21:27:12 2009	(r193066)
@@ -29,6 +29,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_compat.h"
 #include "opt_ddb.h"
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -50,6 +51,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -79,7 +81,9 @@ struct prison prison0 = {
 	.pr_uref	= 1,
 	.pr_path	= "/",
 	.pr_securelevel	= -1,
+	.pr_uuid	= "00000000-0000-0000-0000-000000000000",
 	.pr_children	= LIST_HEAD_INITIALIZER(&prison0.pr_children),
+	.pr_flags	= PR_HOST,
 	.pr_allow	= PR_ALLOW_ALL,
 };
 MTX_SYSINIT(prison0, &prison0.pr_mtx, "jail mutex", MTX_DEF);
@@ -116,8 +120,9 @@ static int prison_restrict_ip6(struct pr
  */
 static char *pr_flag_names[] = {
 	[0] = "persist",
+	"host",
 #ifdef INET
-	[2] = "ip4",
+	"ip4",
 #endif
 #ifdef INET6
 	[3] = "ip6",
@@ -126,8 +131,9 @@ static char *pr_flag_names[] = {
 
 static char *pr_flag_nonames[] = {
 	[0] = "nopersist",
+	"nohost",
 #ifdef INET
-	[2] = "noip4",
+	"noip4",
 #endif
 #ifdef INET6
 	[3] = "noip6",
@@ -453,13 +459,14 @@ kern_jail_set(struct thread *td, struct 
 	struct vfsoptlist *opts;
 	struct prison *pr, *deadpr, *mypr, *ppr, *tpr;
 	struct vnode *root;
-	char *errmsg, *host, *name, *p, *path;
+	char *domain, *errmsg, *host, *name, *p, *path, *uuid;
 #if defined(INET) || defined(INET6)
 	void *op;
 #endif
+	unsigned long hid;
 	size_t namelen, onamelen;
 	int created, cuflags, descend, enforce, error, errmsg_len, errmsg_pos;
-	int gotenforce, gotslevel, fi, jid, len;
+	int gotenforce, gothid, gotslevel, fi, jid, len;
 	int slevel, vfslocked;
 #if defined(INET) || defined(INET6)
 	int ii, ij;
@@ -578,6 +585,8 @@ kern_jail_set(struct thread *td, struct 
 	else if (error != 0)
 		goto done_free;
 	else {
+		ch_flags |= PR_HOST;
+		pr_flags |= PR_HOST;
 		if (len == 0 || host[len - 1] != '\0') {
 			error = EINVAL;
 			goto done_free;
@@ -588,6 +597,61 @@ kern_jail_set(struct thread *td, struct 
 		}
 	}
 
+	error = vfs_getopt(opts, "host.domainname", (void **)&domain, &len);
+	if (error == ENOENT)
+		domain = NULL;
+	else if (error != 0)
+		goto done_free;
+	else {
+		ch_flags |= PR_HOST;
+		pr_flags |= PR_HOST;
+		if (len == 0 || domain[len - 1] != '\0') {
+			error = EINVAL;
+			goto done_free;
+		}
+		if (len > MAXHOSTNAMELEN) {
+			error = ENAMETOOLONG;
+			goto done_free;
+		}
+	}
+
+	error = vfs_getopt(opts, "host.hostuuid", (void **)&uuid, &len);
+	if (error == ENOENT)
+		uuid = NULL;
+	else if (error != 0)
+		goto done_free;
+	else {
+		ch_flags |= PR_HOST;
+		pr_flags |= PR_HOST;
+		if (len == 0 || uuid[len - 1] != '\0') {
+			error = EINVAL;
+			goto done_free;
+		}
+		if (len > HOSTUUIDLEN) {
+			error = ENAMETOOLONG;
+			goto done_free;
+		}
+	}
+
+#ifdef COMPAT_IA32
+	if (td->td_proc->p_sysent->sv_flags & SV_IA32) {
+		uint32_t hid32;
+
+		error = vfs_copyopt(opts, "host.hostid", &hid32, sizeof(hid32));
+		hid = hid32;
+	} else
+#endif
+		error = vfs_copyopt(opts, "host.hostid", &hid, sizeof(hid));
+	if (error == ENOENT)
+		gothid = 0;
+	else if (error != 0)
+		goto done_free;
+	else {
+		gothid = 1;
+		ch_flags |= PR_HOST;
+		pr_flags |= PR_HOST;
+	}
+
 	/* This might be the second time around for this option. */
 #ifdef INET
 	error = vfs_getopt(opts, "ip4.addr", &op, &ip4s);
@@ -1000,6 +1064,16 @@ kern_jail_set(struct thread *td, struct 
 		/* Set some default values, and inherit some from the parent. */
 		if (name == NULL)
 			name = "";
+		if (host != NULL || domain != NULL || uuid != NULL || gothid) {
+			if (host == NULL)
+				host = ppr->pr_host;
+			if (domain == NULL)
+				domain = ppr->pr_domain;
+			if (uuid == NULL)
+				uuid = ppr->pr_uuid;
+			if (!gothid)
+				hid = ppr->pr_hostid;
+		}
 		if (path == NULL) {
 			path = "/";
 			root = mypr->pr_root;
@@ -1436,8 +1510,50 @@ kern_jail_set(struct thread *td, struct 
 			strlcpy(pr->pr_path, path, sizeof(pr->pr_path));
 		pr->pr_root = root;
 	}
-	if (host != NULL)
-		strlcpy(pr->pr_host, host, sizeof(pr->pr_host));
+	if (PR_HOST & ch_flags & ~pr_flags) {
+		if (pr->pr_flags & PR_HOST) {
+			/*
+			 * Copy the parent's host info.  As with pr_ip4 above,
+			 * the lack of a lock on the parent is not a problem;
+			 * it is always set with allprison_lock at least
+			 * shared, and is held exclusively here.
+			 */
+			strlcpy(pr->pr_host, pr->pr_parent->pr_host,
+			    sizeof(pr->pr_host));
+			strlcpy(pr->pr_domain, pr->pr_parent->pr_domain,
+			    sizeof(pr->pr_domain));
+			strlcpy(pr->pr_uuid, pr->pr_parent->pr_uuid,
+			    sizeof(pr->pr_uuid));
+			pr->pr_hostid = pr->pr_parent->pr_hostid;
+		}
+	} else if (host != NULL || domain != NULL || uuid != NULL || gothid) {
+		/* Set this prison, and any descendants without PR_HOST. */
+		if (host != NULL)
+			strlcpy(pr->pr_host, host, sizeof(pr->pr_host));
+		if (domain != NULL)
+			strlcpy(pr->pr_domain, domain, sizeof(pr->pr_domain));
+		if (uuid != NULL)
+			strlcpy(pr->pr_uuid, uuid, sizeof(pr->pr_uuid));
+		if (gothid)
+			pr->pr_hostid = hid;
+		FOREACH_PRISON_DESCENDANT_LOCKED(pr, tpr, descend) {
+			if (tpr->pr_flags & PR_HOST)
+				descend = 0;
+			else {
+				if (host != NULL)
+					strlcpy(tpr->pr_host, pr->pr_host,
+					    sizeof(tpr->pr_host));
+				if (domain != NULL)
+					strlcpy(tpr->pr_domain, pr->pr_domain,
+					    sizeof(tpr->pr_domain));
+				if (uuid != NULL)
+					strlcpy(tpr->pr_uuid, pr->pr_uuid,
+					    sizeof(tpr->pr_uuid));
+				if (gothid)
+					tpr->pr_hostid = hid;
+			}
+		}
+	}
 	if ((tallow = ch_allow & ~pr_allow)) {
 		/* Clear allow bits in all children. */
 		FOREACH_PRISON_DESCENDANT_LOCKED(pr, tpr, descend)
@@ -1753,6 +1869,23 @@ kern_jail_get(struct thread *td, struct 
 	error = vfs_setopts(opts, "host.hostname", pr->pr_host);
 	if (error != 0 && error != ENOENT)
 		goto done_deref;
+	error = vfs_setopts(opts, "host.domainname", pr->pr_domain);
+	if (error != 0 && error != ENOENT)
+		goto done_deref;
+	error = vfs_setopts(opts, "host.hostuuid", pr->pr_uuid);
+	if (error != 0 && error != ENOENT)
+		goto done_deref;
+#ifdef COMPAT_IA32
+	if (td->td_proc->p_sysent->sv_flags & SV_IA32) {
+		uint32_t hid32 = pr->pr_hostid;
+
+		error = vfs_setopt(opts, "host.hostid", &hid32, sizeof(hid32));
+	} else
+#endif
+	error = vfs_setopt(opts, "host.hostid", &pr->pr_hostid,
+	    sizeof(pr->pr_hostid));
+	if (error != 0 && error != ENOENT)
+		goto done_deref;
 	error = vfs_setopt(opts, "enforce_statfs", &pr->pr_enforce_statfs,
 	    sizeof(pr->pr_enforce_statfs));
 	if (error != 0 && error != ENOENT)
@@ -3072,17 +3205,12 @@ jailed(struct ucred *cred)
 void
 getcredhostname(struct ucred *cred, char *buf, size_t size)
 {
-	INIT_VPROCG(cred->cr_vimage->v_procg);
+	struct prison *pr;
 
-	if (jailed(cred)) {
-		mtx_lock(&cred->cr_prison->pr_mtx);
-		strlcpy(buf, cred->cr_prison->pr_host, size);
-		mtx_unlock(&cred->cr_prison->pr_mtx);
-	} else {
-		mtx_lock(&hostname_mtx);
-		strlcpy(buf, V_hostname, size);
-		mtx_unlock(&hostname_mtx);
-	}
+	pr = (cred != NULL) ? cred->cr_prison : &prison0;
+	mtx_lock(&pr->pr_mtx);
+	strlcpy(buf, pr->pr_host, size);
+	mtx_unlock(&pr->pr_mtx);
 }
 
 /*
@@ -3683,8 +3811,16 @@ SYSCTL_JAIL_PARAM(, dying, CTLTYPE_INT |
     "B", "Jail is in the process of shutting down");
 
 SYSCTL_JAIL_PARAM_NODE(host, "Jail host info");
+SYSCTL_JAIL_PARAM(, nohost, CTLTYPE_INT | CTLFLAG_RW,
+    "BN", "Jail w/ no host info");
 SYSCTL_JAIL_PARAM_STRING(_host, hostname, CTLFLAG_RW, MAXHOSTNAMELEN,
     "Jail hostname");
+SYSCTL_JAIL_PARAM_STRING(_host, domainname, CTLFLAG_RW, MAXHOSTNAMELEN,
+    "Jail NIS domainname");
+SYSCTL_JAIL_PARAM_STRING(_host, hostuuid, CTLFLAG_RW, HOSTUUIDLEN,
+    "Jail host UUID");
+SYSCTL_JAIL_PARAM(_host, hostid, CTLTYPE_ULONG | CTLFLAG_RW,
+    "LU", "Jail host ID");
 
 SYSCTL_JAIL_PARAM_NODE(cpuset, "Jail cpuset");
 SYSCTL_JAIL_PARAM(_cpuset, id, CTLTYPE_INT | CTLFLAG_RD, "I", "Jail cpuset ID");
@@ -3762,6 +3898,9 @@ db_show_prison(struct prison *pr)
 	db_printf("\n");
 	db_printf(" enforce_statfs  = %d\n", pr->pr_enforce_statfs);
 	db_printf(" host.hostname   = %s\n", pr->pr_host);
+	db_printf(" host.domainname = %s\n", pr->pr_domain);
+	db_printf(" host.hostuuid   = %s\n", pr->pr_uuid);
+	db_printf(" host.hostid     = %lu\n", pr->pr_hostid);
 #ifdef INET
 	db_printf(" ip4s            = %d\n", pr->pr_ip4s);
 	for (ii = 0; ii < pr->pr_ip4s; ii++)

Modified: head/sys/kern/kern_mib.c
==============================================================================
--- head/sys/kern/kern_mib.c	Fri May 29 21:17:22 2009	(r193065)
+++ head/sys/kern/kern_mib.c	Fri May 29 21:27:12 2009	(r193066)
@@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 
 SYSCTL_NODE(, 0,	  sysctl, CTLFLAG_RW, 0,
 	"Sysctl internal magic");
@@ -209,71 +208,69 @@ static char	machine_arch[] = MACHINE_ARC
 SYSCTL_STRING(_hw, HW_MACHINE_ARCH, machine_arch, CTLFLAG_RD,
     machine_arch, 0, "System architecture");
 
-#ifdef VIMAGE_GLOBALS
-char hostname[MAXHOSTNAMELEN];
-#endif
-
-/*
- * This mutex is used to protect the hostname and domainname variables, and
- * perhaps in the future should also protect hostid, hostuid, and others.
- */
-struct mtx hostname_mtx;
-MTX_SYSINIT(hostname_mtx, &hostname_mtx, "hostname", MTX_DEF);
-
 static int
 sysctl_hostname(SYSCTL_HANDLER_ARGS)
 {
-	INIT_VPROCG(TD_TO_VPROCG(req->td));
-	struct prison *pr;
-	char tmphostname[MAXHOSTNAMELEN];
-	int error;
+	struct prison *pr, *cpr;
+	size_t pr_offset;
+	char tmpname[MAXHOSTNAMELEN];
+	int descend, error, len;
+
+	/*
+	 * This function can set: hostname domainname hostuuid.
+	 * Keep that in mind when comments say "hostname".
+	 */
+	pr_offset = (size_t)arg1;
+	len = arg2;
+	KASSERT(len <= sizeof(tmpname),
+	    ("length %d too long for %s", len, __func__));
 
 	pr = req->td->td_ucred->cr_prison;
-	if (pr != &prison0) {
-		if (!(pr->pr_allow & PR_ALLOW_SET_HOSTNAME) && req->newptr)
-			return (EPERM);
+	if (!(pr->pr_allow & PR_ALLOW_SET_HOSTNAME) && req->newptr)
+		return (EPERM);
+	/*
+	 * Make a local copy of hostname to get/set so we don't have to hold
+	 * the jail mutex during the sysctl copyin/copyout activities.
+	 */
+	mtx_lock(&pr->pr_mtx);
+	bcopy((char *)pr + pr_offset, tmpname, len);
+	mtx_unlock(&pr->pr_mtx);
+
+	error = sysctl_handle_string(oidp, tmpname, len, req);
+
+	if (req->newptr != NULL && error == 0) {
 		/*
-		 * Process is in jail, so make a local copy of jail
-		 * hostname to get/set so we don't have to hold the jail
-		 * mutex during the sysctl copyin/copyout activities.
+		 * Copy the locally set hostname to all jails that share
+		 * this host info.
 		 */
+		sx_slock(&allprison_lock);
+		while (!(pr->pr_flags & PR_HOST))
+			pr = pr->pr_parent;
 		mtx_lock(&pr->pr_mtx);
-		bcopy(pr->pr_host, tmphostname, MAXHOSTNAMELEN);
+		bcopy(tmpname, (char *)pr + pr_offset, len);
+		FOREACH_PRISON_DESCENDANT_LOCKED(pr, cpr, descend)
+			if (cpr->pr_flags & PR_HOST)
+				descend = 0;
+			else
+				bcopy(tmpname, (char *)cpr + pr_offset, len);
 		mtx_unlock(&pr->pr_mtx);
-
-		error = sysctl_handle_string(oidp, tmphostname,
-		    sizeof pr->pr_host, req);
-
-		if (req->newptr != NULL && error == 0) {
-			/*
-			 * Copy the locally set hostname to the jail, if
-			 * appropriate.
-			 */
-			mtx_lock(&pr->pr_mtx);
-			bcopy(tmphostname, pr->pr_host, MAXHOSTNAMELEN);
-			mtx_unlock(&pr->pr_mtx);
-		}
-	} else {
-		mtx_lock(&hostname_mtx);
-		bcopy(V_hostname, tmphostname, MAXHOSTNAMELEN);
-		mtx_unlock(&hostname_mtx);
-		error = sysctl_handle_string(oidp, tmphostname,
-		    sizeof tmphostname, req);
-		if (req->newptr != NULL && error == 0) {
-			mtx_lock(&prison0.pr_mtx);
-			mtx_lock(&hostname_mtx);
-			bcopy(tmphostname, prison0.pr_host, MAXHOSTNAMELEN);
-			bcopy(tmphostname, V_hostname, MAXHOSTNAMELEN);
-			mtx_unlock(&hostname_mtx);
-			mtx_unlock(&prison0.pr_mtx);
-		}
+		sx_sunlock(&allprison_lock);
 	}
 	return (error);
 }
 
 SYSCTL_PROC(_kern, KERN_HOSTNAME, hostname,
-       CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_PRISON|CTLFLAG_MPSAFE,
-       0, 0, sysctl_hostname, "A", "Hostname");
+    CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_PRISON | CTLFLAG_MPSAFE,
+    (void *)(offsetof(struct prison, pr_host)), MAXHOSTNAMELEN,
+    sysctl_hostname, "A", "Hostname");
+SYSCTL_PROC(_kern, KERN_NISDOMAINNAME, domainname,
+    CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_PRISON | CTLFLAG_MPSAFE,
+    (void *)(offsetof(struct prison, pr_domain)), MAXHOSTNAMELEN,
+    sysctl_hostname, "A", "Name of the current YP/NIS domain");
+SYSCTL_PROC(_kern, KERN_HOSTUUID, hostuuid,
+    CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_PRISON | CTLFLAG_MPSAFE,
+    (void *)(offsetof(struct prison, pr_uuid)), HOSTUUIDLEN,
+    sysctl_hostname, "A", "Host UUID");
 
 static int	regression_securelevel_nonmonotonic = 0;
 
@@ -341,38 +338,43 @@ SYSCTL_PROC(_kern, OID_AUTO, conftxt, CT
     0, 0, sysctl_kern_config, "", "Kernel configuration file");
 #endif
 
-#ifdef VIMAGE_GLOBALS
-char domainname[MAXHOSTNAMELEN];	/* Protected by hostname_mtx. */
-#endif
-
 static int
-sysctl_domainname(SYSCTL_HANDLER_ARGS)
+sysctl_hostid(SYSCTL_HANDLER_ARGS)
 {
-	INIT_VPROCG(TD_TO_VPROCG(req->td));
-	char tmpdomainname[MAXHOSTNAMELEN];
-	int error;
-
-	mtx_lock(&hostname_mtx);
-	bcopy(V_domainname, tmpdomainname, MAXHOSTNAMELEN);
-	mtx_unlock(&hostname_mtx);
-	error = sysctl_handle_string(oidp, tmpdomainname,
-	    sizeof tmpdomainname, req);
+	struct prison *pr, *cpr;
+	u_long tmpid;
+	int descend, error;
+
+	/*
+	 * Like sysctl_hostname, except it operates on a u_long
+	 * instead of a string, and is used only for hostid.
+	 */
+	pr = req->td->td_ucred->cr_prison;
+	if (!(pr->pr_allow & PR_ALLOW_SET_HOSTNAME) && req->newptr)
+		return (EPERM);
+	tmpid = pr->pr_hostid;
+	error = sysctl_handle_long(oidp, &tmpid, 0, req);
+
 	if (req->newptr != NULL && error == 0) {
-		mtx_lock(&hostname_mtx);
-		bcopy(tmpdomainname, V_domainname, MAXHOSTNAMELEN);
-		mtx_unlock(&hostname_mtx);
+		sx_slock(&allprison_lock);
+		while (!(pr->pr_flags & PR_HOST))
+			pr = pr->pr_parent;
+		mtx_lock(&pr->pr_mtx);
+		pr->pr_hostid = tmpid;
+		FOREACH_PRISON_DESCENDANT_LOCKED(pr, cpr, descend)
+			if (cpr->pr_flags & PR_HOST)
+				descend = 0;
+			else
+				cpr->pr_hostid = tmpid;
+		mtx_unlock(&pr->pr_mtx);
+		sx_sunlock(&allprison_lock);
 	}
 	return (error);
 }
 
-SYSCTL_PROC(_kern, KERN_NISDOMAINNAME, domainname, CTLTYPE_STRING|CTLFLAG_RW,
-       0, 0, sysctl_domainname, "A", "Name of the current YP/NIS domain");
-
-u_long hostid;
-SYSCTL_ULONG(_kern, KERN_HOSTID, hostid, CTLFLAG_RW, &hostid, 0, "Host ID");
-char hostuuid[64] = "00000000-0000-0000-0000-000000000000";
-SYSCTL_STRING(_kern, KERN_HOSTUUID, hostuuid, CTLFLAG_RW, hostuuid,
-    sizeof(hostuuid), "Host UUID");
+SYSCTL_PROC(_kern, KERN_HOSTID, hostid,
+    CTLTYPE_ULONG | CTLFLAG_RW | CTLFLAG_PRISON | CTLFLAG_MPSAFE,
+    NULL, 0, sysctl_hostid, "LU", "Host ID");
 
 SYSCTL_NODE(_kern, OID_AUTO, features, CTLFLAG_RD, 0, "Kernel Features");
 

Modified: head/sys/kern/kern_shutdown.c
==============================================================================
--- head/sys/kern/kern_shutdown.c	Fri May 29 21:17:22 2009	(r193065)
+++ head/sys/kern/kern_shutdown.c	Fri May 29 21:27:12 2009	(r193066)
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -65,7 +66,6 @@ __FBSDID("$FreeBSD$");
 #include 		/* smp_active */
 #include 
 #include 
-#include 
 
 #include 
 
@@ -693,7 +693,7 @@ mkdumpheader(struct kerneldumpheader *kd

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 22:11:23 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 066DC1065673;
	Fri, 29 May 2009 22:11:23 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E8DA68FC1C;
	Fri, 29 May 2009 22:11:22 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TMBMeQ088250;
	Fri, 29 May 2009 22:11:22 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TMBMTw088249;
	Fri, 29 May 2009 22:11:22 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200905292211.n4TMBMTw088249@svn.freebsd.org>
From: Andrew Thompson 
Date: Fri, 29 May 2009 22:11:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193068 - head/sys/dev/usb/controller
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 22:11:23 -0000

Author: thompsa
Date: Fri May 29 22:11:22 2009
New Revision: 193068
URL: http://svn.freebsd.org/changeset/base/193068

Log:
  Fix function arguments were previously they matched the typedef by accident.

Modified:
  head/sys/dev/usb/controller/usb_controller.c

Modified: head/sys/dev/usb/controller/usb_controller.c
==============================================================================
--- head/sys/dev/usb/controller/usb_controller.c	Fri May 29 21:31:44 2009	(r193067)
+++ head/sys/dev/usb/controller/usb_controller.c	Fri May 29 22:11:22 2009	(r193068)
@@ -485,7 +485,7 @@ SYSUNINIT(usb2_bus_unload, SI_SUB_KLD, S
 #if USB_HAVE_BUSDMA
 static void
 usb2_bus_mem_flush_all_cb(struct usb_bus *bus, struct usb_page_cache *pc,
-    struct usb_page *pg, uint32_t size, uint32_t align)
+    struct usb_page *pg, size_t size, size_t align)
 {
 	usb2_pc_cpu_flush(pc);
 }
@@ -510,7 +510,7 @@ usb2_bus_mem_flush_all(struct usb_bus *b
 #if USB_HAVE_BUSDMA
 static void
 usb2_bus_mem_alloc_all_cb(struct usb_bus *bus, struct usb_page_cache *pc,
-    struct usb_page *pg, uint32_t size, uint32_t align)
+    struct usb_page *pg, size_t size, size_t align)
 {
 	/* need to initialize the page cache */
 	pc->tag_parent = bus->dma_parent_tag;
@@ -570,7 +570,7 @@ usb2_bus_mem_alloc_all(struct usb_bus *b
 #if USB_HAVE_BUSDMA
 static void
 usb2_bus_mem_free_all_cb(struct usb_bus *bus, struct usb_page_cache *pc,
-    struct usb_page *pg, uint32_t size, uint32_t align)
+    struct usb_page *pg, size_t size, size_t align)
 {
 	usb2_pc_free_mem(pc);
 }

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 22:19:45 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B9DD6106566B;
	Fri, 29 May 2009 22:19:45 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A69FC8FC1F;
	Fri, 29 May 2009 22:19:45 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TMJj6Y088498;
	Fri, 29 May 2009 22:19:45 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TMJjZR088493;
	Fri, 29 May 2009 22:19:45 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200905292219.n4TMJjZR088493@svn.freebsd.org>
From: Xin LI 
Date: Fri, 29 May 2009 22:19:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193070 - in head/usr.sbin: nfscbd nfsdumpstate
	nfsrevoke nfsuserd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 22:19:46 -0000

Author: delphij
Date: Fri May 29 22:19:45 2009
New Revision: 193070
URL: http://svn.freebsd.org/changeset/base/193070

Log:
  Code cleanup for nfs4 utilities:
  
   - Mark internal routines as static;
   - Eliminate unused parameters where possible, mark __unused for others;
   - Remove unused variables;
   - Use %jd for int64_t values in printf();
   - Add appropriate %d for printf to match its parameter;
   - Rename a variable to resolve conflict with revoke(2);
  
  Reviewed by:	rmacklem
  Tested with:	make universe (bugs are mine)

Modified:
  head/usr.sbin/nfscbd/nfscbd.c
  head/usr.sbin/nfsdumpstate/nfsdumpstate.c
  head/usr.sbin/nfsrevoke/nfsrevoke.c
  head/usr.sbin/nfsuserd/Makefile
  head/usr.sbin/nfsuserd/nfsuserd.c

Modified: head/usr.sbin/nfscbd/nfscbd.c
==============================================================================
--- head/usr.sbin/nfscbd/nfscbd.c	Fri May 29 22:18:20 2009	(r193069)
+++ head/usr.sbin/nfscbd/nfscbd.c	Fri May 29 22:19:45 2009	(r193070)
@@ -73,13 +73,13 @@ int	debug = 0;
 
 pid_t children;
 
-void	nonfs(int);
-void	reapchild(int);
-void	usage(void);
-void	cleanup(int);
-void	child_cleanup(int);
-void	nfscbd_exit(int);
-void	killchildren(void);
+static void	nonfs(int);
+static void	reapchild(int);
+static void	usage(void);
+static void	cleanup(int);
+static void	child_cleanup(int);
+static void	nfscbd_exit(int);
+static void	killchildren(void);
 
 /*
  * Nfs callback server daemon.
@@ -95,23 +95,18 @@ void	killchildren(void);
  * socket from accept, pass the msgsock into the kernel via. nfssvc().
  */
 int
-main(int argc, char *argv[], char **envp)
+main(int argc, char *argv[])
 {
-	struct group *grp;
 	struct nfscbd_args nfscbdargs;
 	struct nfsd_nfscbd_args nfscbdargs2;
-	struct passwd *pwd;
-	struct ucred *cr;
 	struct sockaddr_in inetaddr, inetpeer;
-	struct timeval ktv;
 	fd_set ready, sockbits;
-	int ch, connect_type_cnt, i, len, maxsock, msgsock, error;
+	int ch, connect_type_cnt, len, maxsock, msgsock, error;
 	int nfssvc_flag, on, sock, tcpsock, ret, mustfreeai = 0;
-	char *cp, **cpp, princname[128];
+	char *cp, princname[128];
 	char myname[MAXHOSTNAMELEN], *myfqdnname = NULL;
 	struct addrinfo *aip, hints;
 	pid_t pid;
-	sigset_t signew;
 	short myport = NFSV4_CBPORT;
 
 	if (modfind("nfscl") < 0) {
@@ -320,24 +315,23 @@ main(int argc, char *argv[], char **envp
 	}
 }
 
-void
+static void
 usage(void)
 {
 
 	errx(1, "usage: nfscbd %s", USAGE);
 }
 
-void
-nonfs(int signo)
+static void
+nonfs(int signo __unused)
 {
 	syslog(LOG_ERR, "missing system call: NFS not available");
 }
 
-void
-reapchild(int signo)
+static void
+reapchild(int signo __unused)
 {
 	pid_t pid;
-	int i;
 
 	while ((pid = wait3(NULL, WNOHANG, NULL)) > 0) {
 		if (pid == children)
@@ -345,10 +339,9 @@ reapchild(int signo)
 	}
 }
 
-void
+static void
 killchildren(void)
 {
-	int i;
 
 	if (children > 0)
 		kill(children, SIGKILL);
@@ -357,8 +350,8 @@ killchildren(void)
 /*
  * Cleanup master after SIGUSR1.
  */
-void
-cleanup(int signo)
+static void
+cleanup(int signo __unused)
 {
 	nfscbd_exit(0);
 }
@@ -366,14 +359,14 @@ cleanup(int signo)
 /*
  * Cleanup child after SIGUSR1.
  */
-void
-child_cleanup(int signo)
+static void
+child_cleanup(int signo __unused)
 {
 	exit(0);
 }
 
-void
-nfscbd_exit(int status)
+static void
+nfscbd_exit(int status __unused)
 {
 	killchildren();
 	exit(status);

Modified: head/usr.sbin/nfsdumpstate/nfsdumpstate.c
==============================================================================
--- head/usr.sbin/nfsdumpstate/nfsdumpstate.c	Fri May 29 22:18:20 2009	(r193069)
+++ head/usr.sbin/nfsdumpstate/nfsdumpstate.c	Fri May 29 22:19:45 2009	(r193070)
@@ -194,7 +194,7 @@ dump_lockstate(char *fname)
 			    lp[cnt].ndlck_stateid.other[1],
 			    lp[cnt].ndlck_stateid.other[2]);
 		else
-			printf("%-11s  %17lld %17lld ",
+			printf("%-11s  %17jd %17jd ",
 			    lock_flags(lp[cnt].ndlck_flags),
 			    lp[cnt].ndlck_first,
 			    lp[cnt].ndlck_end);

Modified: head/usr.sbin/nfsrevoke/nfsrevoke.c
==============================================================================
--- head/usr.sbin/nfsrevoke/nfsrevoke.c	Fri May 29 22:18:20 2009	(r193069)
+++ head/usr.sbin/nfsrevoke/nfsrevoke.c	Fri May 29 22:19:45 2009	(r193070)
@@ -57,8 +57,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-void usage(void);
-extern int errno;
+static void usage(void);
 
 int
 main(int argc, char **argv)
@@ -66,7 +65,7 @@ main(int argc, char **argv)
 	char *cp;
 	u_char val;
 	int cnt, even;
-	struct nfsd_clid revoke;
+	struct nfsd_clid revoke_handle;
 
 	if (modfind("nfsd") < 0)
 		errx(1, "nfsd not loaded - self terminating");
@@ -80,7 +79,7 @@ main(int argc, char **argv)
 		even = 1;
 	val = 0;
 	while (*cp) {
-		if (*cp >= '0' & *cp <= '9')
+		if (*cp >= '0' && *cp <= '9')
 			val += (u_char)(*cp - '0');
 		else if (*cp >= 'A' && *cp <= 'F')
 			val += ((u_char)(*cp - 'A')) + 0xa;
@@ -92,7 +91,7 @@ main(int argc, char **argv)
 			val <<= 4;
 			even = 0;
 		} else {
-			revoke.nclid_id[cnt++] = val;
+			revoke_handle.nclid_id[cnt++] = val;
 			if (cnt > NFSV4_OPAQUELIMIT)
 				errx(1, "Clientid %s, loo long", argv[1]);
 			val = 0;
@@ -104,19 +103,19 @@ main(int argc, char **argv)
 	/*
 	 * Do the revocation system call.
 	 */
-	revoke.nclid_idlen = cnt;
+	revoke_handle.nclid_idlen = cnt;
 #ifdef DEBUG
-	printf("Idlen=%d\n", revoke.nclid_idlen);
-	for (cnt = 0; cnt < revoke.nclid_idlen; cnt++)
-		printf("%02x", revoke.nclid_id[cnt]);
+	printf("Idlen=%d\n", revoke_handle.nclid_idlen);
+	for (cnt = 0; cnt < revoke_handle.nclid_idlen; cnt++)
+		printf("%02x", revoke_handle.nclid_id[cnt]);
 	printf("\n");
 #else
-	if (nfssvc(NFSSVC_ADMINREVOKE, &revoke) < 0)
+	if (nfssvc(NFSSVC_ADMINREVOKE, &revoke_handle) < 0)
 		err(1, "Admin revoke failed");
 #endif
 }
 
-void
+static void
 usage(void)
 {
 

Modified: head/usr.sbin/nfsuserd/Makefile
==============================================================================
--- head/usr.sbin/nfsuserd/Makefile	Fri May 29 22:18:20 2009	(r193069)
+++ head/usr.sbin/nfsuserd/Makefile	Fri May 29 22:19:45 2009	(r193070)
@@ -2,5 +2,6 @@
 
 PROG=	nfsuserd
 MAN=	nfsuserd.8
+WARNS?=	3
 
 .include 

Modified: head/usr.sbin/nfsuserd/nfsuserd.c
==============================================================================
--- head/usr.sbin/nfsuserd/nfsuserd.c	Fri May 29 22:18:20 2009	(r193069)
+++ head/usr.sbin/nfsuserd/nfsuserd.c	Fri May 29 22:19:45 2009	(r193070)
@@ -66,12 +66,12 @@ __FBSDID("$FreeBSD$");
  * for NFS V4.
  */
 
-void	cleanup_term(int);
-void	usage(void);
-void	nfsuserdsrv(struct svc_req *, SVCXPRT *);
-bool_t	xdr_getid(XDR *, caddr_t);
-bool_t	xdr_getname(XDR *, caddr_t);
-bool_t	xdr_retval(XDR *, caddr_t);
+static void	cleanup_term(int);
+static void	usage(void);
+static void	nfsuserdsrv(struct svc_req *, SVCXPRT *);
+static bool_t	xdr_getid(XDR *, caddr_t);
+static bool_t	xdr_getname(XDR *, caddr_t);
+static bool_t	xdr_retval(XDR *, caddr_t);
 
 #define	MAXNAME		1024
 #define	MAXNFSUSERD	20
@@ -94,7 +94,7 @@ int defusertimeout = DEFUSERTIMEOUT;
 pid_t slaves[MAXNFSUSERD];
 
 int
-main(int argc, char *argv[], char *envp[])
+main(int argc, char *argv[])
 {
 	int i;
 	int error, len, mustfreeai = 0;
@@ -102,11 +102,10 @@ main(int argc, char *argv[], char *envp[
 	struct passwd *pwd;
 	struct group *grp;
 	int sock, one = 1;
-	SVCXPRT *udptransp, *tcptransp;
-	struct passwd *pw;
+	SVCXPRT *udptransp;
 	u_short portnum;
 	sigset_t signew;
-	char hostname[MAXHOSTNAMELEN + 1], *cp, **aliases;
+	char hostname[MAXHOSTNAMELEN + 1], *cp;
 	struct addrinfo *aip, hints;
 
 	if (modfind("nfscommon") < 0) {
@@ -166,7 +165,7 @@ main(int argc, char *argv[], char *envp[
 			i = atoi(*argv);
 			if (i < 10 || i > 100000) {
 				fprintf(stderr,
-				    "usermax out of range 10<->100000\n", i);
+				    "usermax %d out of range 10<->100000\n", i);
 				usage();
 			}
 			nid.nid_usermax = i;
@@ -178,7 +177,7 @@ main(int argc, char *argv[], char *envp[
 			i = atoi(*argv);
 			if (i < 0 || i > 100000) {
 				fprintf(stderr,
-				    "usertimeout out of range 0<->100000\n",
+				    "usertimeout %d out of range 0<->100000\n",
 				    i);
 				usage();
 			}
@@ -409,11 +408,9 @@ main(int argc, char *argv[], char *envp[
 /*
  * The nfsuserd rpc service
  */
-void
+static void
 nfsuserdsrv(struct svc_req *rqstp, SVCXPRT *transp)
 {
-	int i;
-	char *cp;
 	struct passwd *pwd;
 	struct group *grp;
 	int error;
@@ -577,7 +574,7 @@ nfsuserdsrv(struct svc_req *rqstp, SVCXP
 /*
  * Xdr routine to get an id number
  */
-bool_t
+static bool_t
 xdr_getid(XDR *xdrsp, caddr_t cp)
 {
 	struct info *ifp = (struct info *)cp;
@@ -588,7 +585,7 @@ xdr_getid(XDR *xdrsp, caddr_t cp)
 /*
  * Xdr routine to get a user name
  */
-bool_t
+static bool_t
 xdr_getname(XDR *xdrsp, caddr_t cp)
 {
 	struct info *ifp = (struct info *)cp;
@@ -607,7 +604,7 @@ xdr_getname(XDR *xdrsp, caddr_t cp)
 /*
  * Xdr routine to return the value.
  */
-bool_t
+static bool_t
 xdr_retval(XDR *xdrsp, caddr_t cp)
 {
 	struct info *ifp = (struct info *)cp;
@@ -620,8 +617,8 @@ xdr_retval(XDR *xdrsp, caddr_t cp)
 /*
  * cleanup_term() called via SIGUSR1.
  */
-void
-cleanup_term(int signo)
+static void
+cleanup_term(int signo __unused)
 {
 	int i, cnt;
 
@@ -656,7 +653,7 @@ cleanup_term(int signo)
 	exit(0);
 }
 
-void
+static void
 usage(void)
 {
 

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 23:39:17 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 59B3C1065674;
	Fri, 29 May 2009 23:39:17 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 47FFA8FC14;
	Fri, 29 May 2009 23:39:17 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TNdGsl090162;
	Fri, 29 May 2009 23:39:16 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TNdGD1090161;
	Fri, 29 May 2009 23:39:16 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200905292339.n4TNdGD1090161@svn.freebsd.org>
From: Sam Leffler 
Date: Fri, 29 May 2009 23:39:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193072 - head/sys/net80211
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 23:39:18 -0000

Author: sam
Date: Fri May 29 23:39:16 2009
New Revision: 193072
URL: http://svn.freebsd.org/changeset/base/193072

Log:
  add ieee80211_isratevalid

Modified:
  head/sys/net80211/ieee80211_phy.h

Modified: head/sys/net80211/ieee80211_phy.h
==============================================================================
--- head/sys/net80211/ieee80211_phy.h	Fri May 29 22:28:27 2009	(r193071)
+++ head/sys/net80211/ieee80211_phy.h	Fri May 29 23:39:16 2009	(r193072)
@@ -104,6 +104,12 @@ ieee80211_rate2phytype(const struct ieee
 	return rt->info[rix].phy;
 }
 
+static __inline__ int
+ieee80211_isratevalid(const struct ieee80211_rate_table *rt, uint8_t rate)
+{
+	return rt->rateCodeToIndex[rate] != (uint8_t)-1;
+}
+
 /*
  * Calculate ACK field for
  * o  non-fragment data frames

From owner-svn-src-head@FreeBSD.ORG  Fri May 29 23:41:32 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7A6C8106566B;
	Fri, 29 May 2009 23:41:32 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 688E58FC08;
	Fri, 29 May 2009 23:41:32 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4TNfWZx090255;
	Fri, 29 May 2009 23:41:32 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4TNfWVi090250;
	Fri, 29 May 2009 23:41:32 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200905292341.n4TNfWVi090250@svn.freebsd.org>
From: Sam Leffler 
Date: Fri, 29 May 2009 23:41:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193073 - in head/sys/dev: bwi iwn ral usb/wlan
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 29 May 2009 23:41:33 -0000

Author: sam
Date: Fri May 29 23:41:31 2009
New Revision: 193073
URL: http://svn.freebsd.org/changeset/base/193073

Log:
  validate tx rate(s) in the raw xmit path
  
  Tested by:	"Paul B. Mahol"  (rum, bwi)

Modified:
  head/sys/dev/bwi/if_bwi.c
  head/sys/dev/iwn/if_iwn.c
  head/sys/dev/ral/rt2560.c
  head/sys/dev/usb/wlan/if_rum.c
  head/sys/dev/usb/wlan/if_ural.c

Modified: head/sys/dev/bwi/if_bwi.c
==============================================================================
--- head/sys/dev/bwi/if_bwi.c	Fri May 29 23:39:16 2009	(r193072)
+++ head/sys/dev/bwi/if_bwi.c	Fri May 29 23:41:31 2009	(r193073)
@@ -3126,6 +3126,7 @@ bwi_encap_raw(struct bwi_softc *sc, int 
 {
 	struct ifnet *ifp = sc->sc_ifp;
 	struct ieee80211vap *vap = ni->ni_vap;
+	struct ieee80211com *ic = ni->ni_ic;
 	struct bwi_ring_data *rd = &sc->sc_tx_rdata[BWI_TX_DATA_RING];
 	struct bwi_txbuf_data *tbd = &sc->sc_tx_bdata[BWI_TX_DATA_RING];
 	struct bwi_txbuf *tb = &tbd->tbd_buf[idx];
@@ -3152,8 +3153,20 @@ bwi_encap_raw(struct bwi_softc *sc, int 
 	 * Find TX rate
 	 */
 	rate = params->ibp_rate0;
-	rate_fb = (params->ibp_try1 != 0) ?
-	    params->ibp_rate1 : params->ibp_rate0;
+	if (!ieee80211_isratevalid(ic->ic_rt, rate)) {
+		/* XXX fall back to mcast/mgmt rate? */
+		m_freem(m0);
+		return EINVAL;
+	}
+	if (params->ibp_try1 != 0) {
+		rate_fb = params->ibp_rate1;
+		if (!ieee80211_isratevalid(ic->ic_rt, rate_fb)) {
+			/* XXX fall back to rate0? */
+			m_freem(m0);
+			return EINVAL;
+		}
+	} else
+		rate_fb = rate;
 	tb->tb_rate[0] = rate;
 	tb->tb_rate[1] = rate_fb;
 	sc->sc_tx_rate = rate;

Modified: head/sys/dev/iwn/if_iwn.c
==============================================================================
--- head/sys/dev/iwn/if_iwn.c	Fri May 29 23:39:16 2009	(r193072)
+++ head/sys/dev/iwn/if_iwn.c	Fri May 29 23:41:31 2009	(r193073)
@@ -2227,6 +2227,7 @@ iwn_tx_data_raw(struct iwn_softc *sc, st
     const struct ieee80211_bpf_params *params)
 {
 	struct ieee80211vap *vap = ni->ni_vap;
+	struct ieee80211com *ic = ni->ni_ic;
 	struct iwn_tx_cmd *cmd;
 	struct iwn_cmd_data *tx;
 	struct ieee80211_frame *wh;
@@ -2263,6 +2264,11 @@ iwn_tx_data_raw(struct iwn_softc *sc, st
 
 	/* pick a tx rate */
 	rate = params->ibp_rate0;
+	if (!ieee80211_isratevalid(ic->ic_rt, rate)) {
+		/* XXX fall back to mcast/mgmt rate? */
+		m_freem(m0);
+		return EINVAL;
+	}
 
 	if (ieee80211_radiotap_active_vap(vap)) {
 		struct iwn_tx_radiotap_header *tap = &sc->sc_txtap;

Modified: head/sys/dev/ral/rt2560.c
==============================================================================
--- head/sys/dev/ral/rt2560.c	Fri May 29 23:39:16 2009	(r193072)
+++ head/sys/dev/ral/rt2560.c	Fri May 29 23:41:31 2009	(r193073)
@@ -1715,6 +1715,7 @@ rt2560_tx_raw(struct rt2560_softc *sc, s
     struct ieee80211_node *ni, const struct ieee80211_bpf_params *params)
 {
 	struct ieee80211vap *vap = ni->ni_vap;
+	struct ieee80211com *ic = ni->ni_ic;
 	struct rt2560_tx_desc *desc;
 	struct rt2560_tx_data *data;
 	bus_dma_segment_t segs[RT2560_MAX_SCATTER];
@@ -1724,9 +1725,8 @@ rt2560_tx_raw(struct rt2560_softc *sc, s
 	desc = &sc->prioq.desc[sc->prioq.cur];
 	data = &sc->prioq.data[sc->prioq.cur];
 
-	rate = params->ibp_rate0 & IEEE80211_RATE_VAL;
-	/* XXX validate */
-	if (rate == 0) {
+	rate = params->ibp_rate0;
+	if (!ieee80211_isratevalid(ic->ic_rt, rate)) {
 		/* XXX fall back to mcast/mgmt rate? */
 		m_freem(m0);
 		return EINVAL;

Modified: head/sys/dev/usb/wlan/if_rum.c
==============================================================================
--- head/sys/dev/usb/wlan/if_rum.c	Fri May 29 23:39:16 2009	(r193072)
+++ head/sys/dev/usb/wlan/if_rum.c	Fri May 29 23:41:31 2009	(r193073)
@@ -1137,6 +1137,7 @@ static int
 rum_tx_raw(struct rum_softc *sc, struct mbuf *m0, struct ieee80211_node *ni,
     const struct ieee80211_bpf_params *params)
 {
+	struct ieee80211com *ic = ni->ni_ic;
 	struct rum_tx_data *data;
 	uint32_t flags;
 	int rate, error;
@@ -1144,9 +1145,8 @@ rum_tx_raw(struct rum_softc *sc, struct 
 	RUM_LOCK_ASSERT(sc, MA_OWNED);
 	KASSERT(params != NULL, ("no raw xmit params"));
 
-	rate = params->ibp_rate0 & IEEE80211_RATE_VAL;
-	/* XXX validate */
-	if (rate == 0) {
+	rate = params->ibp_rate0;
+	if (!ieee80211_isratevalid(ic->ic_rt, rate)) {
 		m_freem(m0);
 		return EINVAL;
 	}

Modified: head/sys/dev/usb/wlan/if_ural.c
==============================================================================
--- head/sys/dev/usb/wlan/if_ural.c	Fri May 29 23:39:16 2009	(r193072)
+++ head/sys/dev/usb/wlan/if_ural.c	Fri May 29 23:41:31 2009	(r193073)
@@ -1192,6 +1192,7 @@ static int
 ural_tx_raw(struct ural_softc *sc, struct mbuf *m0, struct ieee80211_node *ni,
     const struct ieee80211_bpf_params *params)
 {
+	struct ieee80211com *ic = ni->ni_ic;
 	struct ural_tx_data *data;
 	uint32_t flags;
 	int error;
@@ -1200,9 +1201,8 @@ ural_tx_raw(struct ural_softc *sc, struc
 	RAL_LOCK_ASSERT(sc, MA_OWNED);
 	KASSERT(params != NULL, ("no raw xmit params"));
 
-	rate = params->ibp_rate0 & IEEE80211_RATE_VAL;
-	/* XXX validate */
-	if (rate == 0) {
+	rate = params->ibp_rate0;
+	if (!ieee80211_isratevalid(ic->ic_rt, rate)) {
 		m_freem(m0);
 		return EINVAL;
 	}

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 00:22:58 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B67B7106564A;
	Sat, 30 May 2009 00:22:58 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A2E7A8FC0A;
	Sat, 30 May 2009 00:22:58 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4U0Mwru091086;
	Sat, 30 May 2009 00:22:58 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4U0MvAc091062;
	Sat, 30 May 2009 00:22:57 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200905300022.n4U0MvAc091062@svn.freebsd.org>
From: Andrew Thompson 
Date: Sat, 30 May 2009 00:22:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193074 - in head/sys/dev/usb: . controller
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 00:22:59 -0000

Author: thompsa
Date: Sat May 30 00:22:57 2009
New Revision: 193074
URL: http://svn.freebsd.org/changeset/base/193074

Log:
  Revert the size_t part of the last commit for the moment, this blows up the
  USB_ADD_BYTES macro.

Modified:
  head/sys/dev/usb/controller/usb_controller.c
  head/sys/dev/usb/usb_bus.h
  head/sys/dev/usb/usb_busdma.c
  head/sys/dev/usb/usb_busdma.h
  head/sys/dev/usb/usb_compat_linux.c
  head/sys/dev/usb/usb_compat_linux.h
  head/sys/dev/usb/usb_controller.h
  head/sys/dev/usb/usb_core.h
  head/sys/dev/usb/usb_dev.c
  head/sys/dev/usb/usb_dev.h
  head/sys/dev/usb/usb_device.h
  head/sys/dev/usb/usb_hid.c
  head/sys/dev/usb/usb_hid.h
  head/sys/dev/usb/usb_hub.c
  head/sys/dev/usb/usb_hub.h
  head/sys/dev/usb/usb_lookup.c
  head/sys/dev/usb/usb_lookup.h
  head/sys/dev/usb/usb_mbuf.c
  head/sys/dev/usb/usb_mbuf.h
  head/sys/dev/usb/usb_msctest.c
  head/sys/dev/usb/usb_process.c
  head/sys/dev/usb/usb_process.h
  head/sys/dev/usb/usb_transfer.c
  head/sys/dev/usb/usb_transfer.h

Modified: head/sys/dev/usb/controller/usb_controller.c
==============================================================================
--- head/sys/dev/usb/controller/usb_controller.c	Fri May 29 23:41:31 2009	(r193073)
+++ head/sys/dev/usb/controller/usb_controller.c	Sat May 30 00:22:57 2009	(r193074)
@@ -485,7 +485,7 @@ SYSUNINIT(usb2_bus_unload, SI_SUB_KLD, S
 #if USB_HAVE_BUSDMA
 static void
 usb2_bus_mem_flush_all_cb(struct usb_bus *bus, struct usb_page_cache *pc,
-    struct usb_page *pg, size_t size, size_t align)
+    struct usb_page *pg, usb_size_t size, usb_size_t align)
 {
 	usb2_pc_cpu_flush(pc);
 }
@@ -510,7 +510,7 @@ usb2_bus_mem_flush_all(struct usb_bus *b
 #if USB_HAVE_BUSDMA
 static void
 usb2_bus_mem_alloc_all_cb(struct usb_bus *bus, struct usb_page_cache *pc,
-    struct usb_page *pg, size_t size, size_t align)
+    struct usb_page *pg, usb_size_t size, usb_size_t align)
 {
 	/* need to initialize the page cache */
 	pc->tag_parent = bus->dma_parent_tag;
@@ -570,7 +570,7 @@ usb2_bus_mem_alloc_all(struct usb_bus *b
 #if USB_HAVE_BUSDMA
 static void
 usb2_bus_mem_free_all_cb(struct usb_bus *bus, struct usb_page_cache *pc,
-    struct usb_page *pg, size_t size, size_t align)
+    struct usb_page *pg, usb_size_t size, usb_size_t align)
 {
 	usb2_pc_free_mem(pc);
 }

Modified: head/sys/dev/usb/usb_bus.h
==============================================================================
--- head/sys/dev/usb/usb_bus.h	Fri May 29 23:41:31 2009	(r193073)
+++ head/sys/dev/usb/usb_bus.h	Sat May 30 00:22:57 2009	(r193074)
@@ -87,7 +87,7 @@ struct usb_bus {
 	struct usb_device **devices;
 
 	usb_power_mask_t hw_power_state;	/* see USB_HW_POWER_XXX */
-	size_t uframe_usage[USB_HS_MICRO_FRAMES_MAX];
+	usb_size_t uframe_usage[USB_HS_MICRO_FRAMES_MAX];
 
 	uint16_t isoc_time_last;	/* in milliseconds */
 

Modified: head/sys/dev/usb/usb_busdma.c
==============================================================================
--- head/sys/dev/usb/usb_busdma.c	Fri May 29 23:41:31 2009	(r193073)
+++ head/sys/dev/usb/usb_busdma.c	Sat May 30 00:22:57 2009	(r193074)
@@ -42,7 +42,7 @@
 #include 
 
 #if USB_HAVE_BUSDMA
-static void	usb2_dma_tag_create(struct usb_dma_tag *, size_t, size_t);
+static void	usb2_dma_tag_create(struct usb_dma_tag *, usb_size_t, usb_size_t);
 static void	usb2_dma_tag_destroy(struct usb_dma_tag *);
 static void	usb2_dma_lock_cb(void *, bus_dma_lock_op_t);
 static void	usb2_pc_alloc_mem_cb(void *, bus_dma_segment_t *, int, int);
@@ -189,7 +189,7 @@ usb2_m_copy_in_cb(void *arg, void *src, 
 
 void
 usb2_m_copy_in(struct usb_page_cache *cache, usb_frlength_t dst_offset,
-    struct mbuf *m, size_t src_offset, usb_frlength_t src_len)
+    struct mbuf *m, usb_size_t src_offset, usb_frlength_t src_len)
 {
 	struct usb2_m_copy_in_arg arg = {cache, dst_offset};
 	int error;
@@ -332,7 +332,7 @@ usb2_dma_lock_cb(void *arg, bus_dma_lock
  *------------------------------------------------------------------------*/
 static void
 usb2_dma_tag_create(struct usb_dma_tag *udt,
-    size_t size, size_t align)
+    usb_size_t size, usb_size_t align)
 {
 	bus_dma_tag_t tag;
 
@@ -397,7 +397,7 @@ usb2_pc_common_mem_cb(void *arg, bus_dma
 	struct usb_dma_parent_tag *uptag;
 	struct usb_page_cache *pc;
 	struct usb_page *pg;
-	size_t rem;
+	usb_size_t rem;
 	uint8_t owned;
 
 	pc = arg;
@@ -460,7 +460,7 @@ done:
  *------------------------------------------------------------------------*/
 uint8_t
 usb2_pc_alloc_mem(struct usb_page_cache *pc, struct usb_page *pg,
-    size_t size, size_t align)
+    usb_size_t size, usb_size_t align)
 {
 	struct usb_dma_parent_tag *uptag;
 	struct usb_dma_tag *utag;
@@ -583,7 +583,7 @@ usb2_pc_free_mem(struct usb_page_cache *
  * Else: Error
  *------------------------------------------------------------------------*/
 uint8_t
-usb2_pc_load_mem(struct usb_page_cache *pc, size_t size, uint8_t sync)
+usb2_pc_load_mem(struct usb_page_cache *pc, usb_size_t size, uint8_t sync)
 {
 	/* setup page cache */
 	pc->page_offset_buf = 0;
@@ -684,7 +684,7 @@ usb2_pc_cpu_flush(struct usb_page_cache 
  * Else: Failure
  *------------------------------------------------------------------------*/
 uint8_t
-usb2_pc_dmamap_create(struct usb_page_cache *pc, size_t size)
+usb2_pc_dmamap_create(struct usb_page_cache *pc, usb_size_t size)
 {
 	struct usb_xfer_root *info;
 	struct usb_dma_tag *utag;
@@ -733,7 +733,7 @@ usb2_pc_dmamap_destroy(struct usb_page_c
  *------------------------------------------------------------------------*/
 struct usb_dma_tag *
 usb2_dma_tag_find(struct usb_dma_parent_tag *udpt,
-    size_t size, size_t align)
+    usb_size_t size, usb_size_t align)
 {
 	struct usb_dma_tag *udt;
 	uint8_t nudt;

Modified: head/sys/dev/usb/usb_busdma.h
==============================================================================
--- head/sys/dev/usb/usb_busdma.h	Fri May 29 23:41:31 2009	(r193073)
+++ head/sys/dev/usb/usb_busdma.h	Sat May 30 00:22:57 2009	(r193074)
@@ -75,7 +75,7 @@ struct usb_page_search {
 #if USB_HAVE_BUSDMA
 	bus_size_t physaddr;
 #endif
-	size_t length;
+	usb_size_t length;
 };
 
 /*
@@ -92,8 +92,8 @@ struct usb_page_cache {
 	struct usb_dma_parent_tag *tag_parent;	/* always set */
 	void   *buffer;			/* virtual buffer pointer */
 #if USB_HAVE_BUSDMA
-	size_t page_offset_buf;
-	size_t page_offset_end;
+	usb_size_t page_offset_buf;
+	usb_size_t page_offset_end;
 	uint8_t	isread:1;		/* set if we are currently reading
 					 * from the memory. Else write. */
 	uint8_t	ismultiseg:1;		/* set if we can have multiple
@@ -127,8 +127,8 @@ struct usb_dma_parent_tag {};		/* empty 
 struct usb_dma_tag {
 	struct usb_dma_parent_tag *tag_parent;
 	bus_dma_tag_t tag;
-	size_t align;
-	size_t size;
+	usb_size_t align;
+	usb_size_t size;
 };
 #else
 struct usb_dma_tag {};			/* empty struct */
@@ -139,11 +139,11 @@ struct usb_dma_tag {};			/* empty struct
 int	usb2_uiomove(struct usb_page_cache *pc, struct uio *uio,
 	    usb_frlength_t pc_offset, usb_frlength_t len);
 struct usb_dma_tag *usb2_dma_tag_find(struct usb_dma_parent_tag *udpt,
-	    size_t size, size_t align);
+	    usb_size_t size, usb_size_t align);
 uint8_t	usb2_pc_alloc_mem(struct usb_page_cache *pc, struct usb_page *pg,
-	    size_t size, size_t align);
-uint8_t	usb2_pc_dmamap_create(struct usb_page_cache *pc, size_t size);
-uint8_t	usb2_pc_load_mem(struct usb_page_cache *pc, size_t size,
+	    usb_size_t size, usb_size_t align);
+uint8_t	usb2_pc_dmamap_create(struct usb_page_cache *pc, usb_size_t size);
+uint8_t	usb2_pc_load_mem(struct usb_page_cache *pc, usb_size_t size,
 	    uint8_t sync);
 void	usb2_bdma_done_event(struct usb_dma_parent_tag *udpt);
 void	usb2_bdma_post_sync(struct usb_xfer *xfer);
@@ -166,7 +166,7 @@ void	usb2_dma_tag_unsetup(struct usb_dma
 void	usb2_get_page(struct usb_page_cache *pc, usb_frlength_t offset,
 	    struct usb_page_search *res);
 void	usb2_m_copy_in(struct usb_page_cache *cache, usb_frlength_t dst_offset,
-	    struct mbuf *m, size_t src_offset, usb_frlength_t src_len);
+	    struct mbuf *m, usb_size_t src_offset, usb_frlength_t src_len);
 void	usb2_pc_cpu_flush(struct usb_page_cache *pc);
 void	usb2_pc_cpu_invalidate(struct usb_page_cache *pc);
 void	usb2_pc_dmamap_destroy(struct usb_page_cache *pc);

Modified: head/sys/dev/usb/usb_compat_linux.c
==============================================================================
--- head/sys/dev/usb/usb_compat_linux.c	Fri May 29 23:41:31 2009	(r193073)
+++ head/sys/dev/usb/usb_compat_linux.c	Sat May 30 00:22:57 2009	(r193074)
@@ -710,7 +710,7 @@ usb_set_interface(struct usb_device *dev
  *------------------------------------------------------------------------*/
 int
 usb_setup_endpoint(struct usb_device *dev,
-    struct usb_host_endpoint *uhe, size_t bufsize)
+    struct usb_host_endpoint *uhe, usb_size_t bufsize)
 {
 	struct usb_config cfg[2];
 	uint8_t type = uhe->desc.bmAttributes & UE_XFERTYPE;
@@ -804,7 +804,7 @@ usb_linux_create_usb_device(struct usb_d
 	struct usb_interface *p_ui = NULL;
 	struct usb_host_interface *p_uhi = NULL;
 	struct usb_host_endpoint *p_uhe = NULL;
-	size_t size;
+	usb_size_t size;
 	uint16_t niface_total;
 	uint16_t nedesc;
 	uint16_t iface_no_curr;
@@ -928,7 +928,7 @@ struct urb *
 usb_alloc_urb(uint16_t iso_packets, uint16_t mem_flags)
 {
 	struct urb *urb;
-	size_t size;
+	usb_size_t size;
 
 	if (iso_packets == 0xFFFF) {
 		/*
@@ -1059,7 +1059,7 @@ usb_ifnum_to_if(struct usb_device *dev, 
  *	usb_buffer_alloc
  *------------------------------------------------------------------------*/
 void   *
-usb_buffer_alloc(struct usb_device *dev, size_t size, uint16_t mem_flags, uint8_t *dma_addr)
+usb_buffer_alloc(struct usb_device *dev, usb_size_t size, uint16_t mem_flags, uint8_t *dma_addr)
 {
 	return (malloc(size, M_USBDEV, M_WAITOK | M_ZERO));
 }
@@ -1150,7 +1150,7 @@ usb_linux_free_device(struct usb_device 
  *	usb_buffer_free
  *------------------------------------------------------------------------*/
 void
-usb_buffer_free(struct usb_device *dev, size_t size,
+usb_buffer_free(struct usb_device *dev, usb_size_t size,
     void *addr, uint8_t dma_addr)
 {
 	free(addr, M_USBDEV);

Modified: head/sys/dev/usb/usb_compat_linux.h
==============================================================================
--- head/sys/dev/usb/usb_compat_linux.h	Fri May 29 23:41:31 2009	(r193073)
+++ head/sys/dev/usb/usb_compat_linux.h	Sat May 30 00:22:57 2009	(r193074)
@@ -278,9 +278,9 @@ struct urb {
 	void   *context;		/* (in) context for completion */
 	usb_complete_t *complete;	/* (in) completion routine */
 
-	size_t transfer_buffer_length;/* (in) data buffer length */
-	size_t bsd_length_rem;
-	size_t actual_length;	/* (return) actual transfer length */
+	usb_size_t transfer_buffer_length;/* (in) data buffer length */
+	usb_size_t bsd_length_rem;
+	usb_size_t actual_length;	/* (return) actual transfer length */
 	usb_timeout_t timeout;		/* FreeBSD specific */
 
 	uint16_t transfer_flags;	/* (in) */
@@ -326,11 +326,11 @@ struct usb_host_interface *usb_altnum_to
 	    const struct usb_interface *intf, uint8_t alt_index);
 struct usb_interface *usb_ifnum_to_if(struct usb_device *dev, uint8_t iface_no);
 
-void   *usb_buffer_alloc(struct usb_device *dev, size_t size,
+void   *usb_buffer_alloc(struct usb_device *dev, usb_size_t size,
 	    uint16_t mem_flags, uint8_t *dma_addr);
 void   *usb_get_intfdata(struct usb_interface *intf);
 
-void	usb_buffer_free(struct usb_device *dev, size_t size, void *addr, uint8_t dma_addr);
+void	usb_buffer_free(struct usb_device *dev, usb_size_t size, void *addr, uint8_t dma_addr);
 void	usb_free_urb(struct urb *urb);
 void	usb_init_urb(struct urb *urb);
 void	usb_kill_urb(struct urb *urb);

Modified: head/sys/dev/usb/usb_controller.h
==============================================================================
--- head/sys/dev/usb/usb_controller.h	Fri May 29 23:41:31 2009	(r193073)
+++ head/sys/dev/usb/usb_controller.h	Sat May 30 00:22:57 2009	(r193074)
@@ -45,7 +45,7 @@ struct usb_endpoint_descriptor;
 
 /* typedefs */
 
-typedef void (usb_bus_mem_sub_cb_t)(struct usb_bus *bus, struct usb_page_cache *pc, struct usb_page *pg, size_t size, size_t align);
+typedef void (usb_bus_mem_sub_cb_t)(struct usb_bus *bus, struct usb_page_cache *pc, struct usb_page *pg, usb_size_t size, usb_size_t align);
 typedef void (usb_bus_mem_cb_t)(struct usb_bus *bus, usb_bus_mem_sub_cb_t *scb);
 
 /*
@@ -170,7 +170,7 @@ struct usb_hw_ep_scratch {
  */
 struct usb_temp_setup {
 	void   *buf;
-	size_t size;
+	usb_size_t size;
 	enum usb_dev_speed	usb_speed;
 	uint8_t	self_powered;
 	uint8_t	bNumEndpoints;

Modified: head/sys/dev/usb/usb_core.h
==============================================================================
--- head/sys/dev/usb/usb_core.h	Fri May 29 23:41:31 2009	(r193073)
+++ head/sys/dev/usb/usb_core.h	Sat May 30 00:22:57 2009	(r193074)
@@ -284,6 +284,10 @@ typedef uint32_t usb_frlength_t;	/* byte
 typedef uint32_t usb_frcount_t;	/* units */
 #endif
 
+#ifndef USB_HAVE_SIZE_T
+typedef uint32_t usb_size_t;		/* bytes */
+#endif
+
 #ifndef USB_HAVE_TICKS_T
 typedef uint32_t usb_ticks_t;		/* system defined */
 #endif

Modified: head/sys/dev/usb/usb_dev.c
==============================================================================
--- head/sys/dev/usb/usb_dev.c	Fri May 29 23:41:31 2009	(r193073)
+++ head/sys/dev/usb/usb_dev.c	Sat May 30 00:22:57 2009	(r193074)
@@ -1683,7 +1683,7 @@ usb2_fifo_attach(struct usb_device *udev
  * Else failure
  *------------------------------------------------------------------------*/
 int
-usb2_fifo_alloc_buffer(struct usb_fifo *f, size_t bufsize,
+usb2_fifo_alloc_buffer(struct usb_fifo *f, usb_size_t bufsize,
     uint16_t nbuf)
 {
 	usb2_fifo_free_buffer(f);
@@ -1748,11 +1748,11 @@ usb2_fifo_detach(struct usb_fifo_sc *f_s
 	DPRINTFN(2, "detached %p\n", f_sc);
 }
 
-size_t
+usb_size_t
 usb2_fifo_put_bytes_max(struct usb_fifo *f)
 {
 	struct usb_mbuf *m;
-	size_t len;
+	usb_size_t len;
 
 	USB_IF_POLL(&f->free_q, m);
 
@@ -1811,10 +1811,10 @@ usb2_fifo_put_data(struct usb_fifo *f, s
 
 void
 usb2_fifo_put_data_linear(struct usb_fifo *f, void *ptr,
-    size_t len, uint8_t what)
+    usb_size_t len, uint8_t what)
 {
 	struct usb_mbuf *m;
-	size_t io_len;
+	usb_size_t io_len;
 
 	while (len || (what == 1)) {
 
@@ -1848,7 +1848,7 @@ usb2_fifo_put_data_linear(struct usb_fif
 }
 
 uint8_t
-usb2_fifo_put_data_buffer(struct usb_fifo *f, void *ptr, size_t len)
+usb2_fifo_put_data_buffer(struct usb_fifo *f, void *ptr, usb_size_t len)
 {
 	struct usb_mbuf *m;
 
@@ -1950,10 +1950,10 @@ usb2_fifo_get_data(struct usb_fifo *f, s
 
 uint8_t
 usb2_fifo_get_data_linear(struct usb_fifo *f, void *ptr,
-    size_t len, size_t *actlen, uint8_t what)
+    usb_size_t len, usb_size_t *actlen, uint8_t what)
 {
 	struct usb_mbuf *m;
-	size_t io_len;
+	usb_size_t io_len;
 	uint8_t tr_data = 0;
 
 	actlen[0] = 0;
@@ -2014,7 +2014,7 @@ usb2_fifo_get_data_linear(struct usb_fif
 }
 
 uint8_t
-usb2_fifo_get_data_buffer(struct usb_fifo *f, void **pptr, size_t *plen)
+usb2_fifo_get_data_buffer(struct usb_fifo *f, void **pptr, usb_size_t *plen)
 {
 	struct usb_mbuf *m;
 

Modified: head/sys/dev/usb/usb_dev.h
==============================================================================
--- head/sys/dev/usb/usb_dev.h	Fri May 29 23:41:31 2009	(r193073)
+++ head/sys/dev/usb/usb_dev.h	Sat May 30 00:22:57 2009	(r193074)
@@ -177,16 +177,16 @@ uint32_t usb2_fifo_put_bytes_max(struct 
 void	usb2_fifo_put_data(struct usb_fifo *fifo, struct usb_page_cache *pc,
 	    usb_frlength_t offset, usb_frlength_t len, uint8_t what);
 void	usb2_fifo_put_data_linear(struct usb_fifo *fifo, void *ptr,
-	    size_t len, uint8_t what);
-uint8_t	usb2_fifo_put_data_buffer(struct usb_fifo *f, void *ptr, size_t len);
+	    usb_size_t len, uint8_t what);
+uint8_t	usb2_fifo_put_data_buffer(struct usb_fifo *f, void *ptr, usb_size_t len);
 void	usb2_fifo_put_data_error(struct usb_fifo *fifo);
 uint8_t	usb2_fifo_get_data(struct usb_fifo *fifo, struct usb_page_cache *pc,
 	    usb_frlength_t offset, usb_frlength_t len, usb_frlength_t *actlen,
 	    uint8_t what);
 uint8_t	usb2_fifo_get_data_linear(struct usb_fifo *fifo, void *ptr,
-	    size_t len, size_t *actlen, uint8_t what);
+	    usb_size_t len, usb_size_t *actlen, uint8_t what);
 uint8_t	usb2_fifo_get_data_buffer(struct usb_fifo *f, void **pptr,
-	    size_t *plen);
+	    usb_size_t *plen);
 void	usb2_fifo_get_data_error(struct usb_fifo *fifo);
 uint8_t	usb2_fifo_opened(struct usb_fifo *fifo);
 void	usb2_fifo_free(struct usb_fifo *f);

Modified: head/sys/dev/usb/usb_device.h
==============================================================================
--- head/sys/dev/usb/usb_device.h	Fri May 29 23:41:31 2009	(r193073)
+++ head/sys/dev/usb/usb_device.h	Sat May 30 00:22:57 2009	(r193074)
@@ -140,9 +140,9 @@ struct usb_device_flags {
  */
 struct usb_power_save {
 	usb_ticks_t last_xfer_time;	/* copy of "ticks" */
-	size_t type_refs[4];	/* transfer reference count */
-	size_t read_refs;		/* data read references */
-	size_t write_refs;		/* data write references */
+	usb_size_t type_refs[4];	/* transfer reference count */
+	usb_size_t read_refs;		/* data read references */
+	usb_size_t write_refs;		/* data write references */
 };
 
 /*

Modified: head/sys/dev/usb/usb_hid.c
==============================================================================
--- head/sys/dev/usb/usb_hid.c	Fri May 29 23:41:31 2009	(r193073)
+++ head/sys/dev/usb/usb_hid.c	Sat May 30 00:22:57 2009	(r193074)
@@ -105,7 +105,7 @@ hid_clear_local(struct hid_item *c)
  *	hid_start_parse
  *------------------------------------------------------------------------*/
 struct hid_data *
-hid_start_parse(const void *d, size_t len, int kindset)
+hid_start_parse(const void *d, usb_size_t len, int kindset)
 {
 	struct hid_data *s;
 
@@ -491,7 +491,7 @@ hid_get_item(struct hid_data *s, struct 
  *	hid_report_size
  *------------------------------------------------------------------------*/
 int
-hid_report_size(const void *buf, size_t len, enum hid_kind k, uint8_t *id)
+hid_report_size(const void *buf, usb_size_t len, enum hid_kind k, uint8_t *id)
 {
 	struct hid_data *d;
 	struct hid_item h;
@@ -544,7 +544,7 @@ hid_report_size(const void *buf, size_t 
  *	hid_locate
  *------------------------------------------------------------------------*/
 int
-hid_locate(const void *desc, size_t size, uint32_t u, enum hid_kind k,
+hid_locate(const void *desc, usb_size_t size, uint32_t u, enum hid_kind k,
     uint8_t index, struct hid_location *loc, uint32_t *flags, uint8_t *id)
 {
 	struct hid_data *d;
@@ -578,7 +578,7 @@ hid_locate(const void *desc, size_t size
  *	hid_get_data
  *------------------------------------------------------------------------*/
 uint32_t
-hid_get_data(const uint8_t *buf, size_t len, struct hid_location *loc)
+hid_get_data(const uint8_t *buf, usb_size_t len, struct hid_location *loc)
 {
 	uint32_t hpos = loc->pos;
 	uint32_t hsize = loc->size;
@@ -621,7 +621,7 @@ hid_get_data(const uint8_t *buf, size_t 
  *	hid_is_collection
  *------------------------------------------------------------------------*/
 int
-hid_is_collection(const void *desc, size_t size, uint32_t usage)
+hid_is_collection(const void *desc, usb_size_t size, uint32_t usage)
 {
 	struct hid_data *hd;
 	struct hid_item hi;

Modified: head/sys/dev/usb/usb_hid.h
==============================================================================
--- head/sys/dev/usb/usb_hid.h	Fri May 29 23:41:31 2009	(r193073)
+++ head/sys/dev/usb/usb_hid.h	Sat May 30 00:22:57 2009	(r193074)
@@ -74,17 +74,17 @@ struct hid_item {
 
 /* prototypes from "usb2_hid.c" */
 
-struct hid_data *hid_start_parse(const void *d, size_t len, int kindset);
+struct hid_data *hid_start_parse(const void *d, usb_size_t len, int kindset);
 void	hid_end_parse(struct hid_data *s);
 int	hid_get_item(struct hid_data *s, struct hid_item *h);
-int	hid_report_size(const void *buf, size_t len, enum hid_kind k,
+int	hid_report_size(const void *buf, usb_size_t len, enum hid_kind k,
 	    uint8_t *id);
-int	hid_locate(const void *desc, size_t size, uint32_t usage,
+int	hid_locate(const void *desc, usb_size_t size, uint32_t usage,
 	    enum hid_kind kind, uint8_t index, struct hid_location *loc,
 	    uint32_t *flags, uint8_t *id);
-uint32_t hid_get_data(const uint8_t *buf, size_t len,
+uint32_t hid_get_data(const uint8_t *buf, usb_size_t len,
 	    struct hid_location *loc);
-int	hid_is_collection(const void *desc, size_t size, uint32_t usage);
+int	hid_is_collection(const void *desc, usb_size_t size, uint32_t usage);
 struct usb_hid_descriptor *hid_get_descriptor_from_usb(
 	    struct usb_config_descriptor *cd,
 	    struct usb_interface_descriptor *id);

Modified: head/sys/dev/usb/usb_hub.c
==============================================================================
--- head/sys/dev/usb/usb_hub.c	Fri May 29 23:41:31 2009	(r193073)
+++ head/sys/dev/usb/usb_hub.c	Sat May 30 00:22:57 2009	(r193074)
@@ -1058,9 +1058,9 @@ done:
  *   The best Transaction Translation slot for an interrupt endpoint.
  *------------------------------------------------------------------------*/
 static uint8_t
-usb2_intr_find_best_slot(size_t *ptr, uint8_t start, uint8_t end)
+usb2_intr_find_best_slot(usb_size_t *ptr, uint8_t start, uint8_t end)
 {
-	size_t max = 0 - 1;
+	usb_size_t max = 0 - 1;
 	uint8_t x;
 	uint8_t y;
 
@@ -1558,7 +1558,7 @@ usb2_bus_powerd(struct usb_bus *bus)
 	usb_ticks_t temp;
 	usb_ticks_t limit;
 	usb_ticks_t mintime;
-	size_t type_refs[5];
+	usb_size_t type_refs[5];
 	uint8_t x;
 	uint8_t rem_wakeup;
 

Modified: head/sys/dev/usb/usb_hub.h
==============================================================================
--- head/sys/dev/usb/usb_hub.h	Fri May 29 23:41:31 2009	(r193073)
+++ head/sys/dev/usb/usb_hub.h	Sat May 30 00:22:57 2009	(r193074)
@@ -57,7 +57,7 @@ struct usb_hub {
 	struct usb_device *hubudev;	/* the HUB device */
 	usb_error_t (*explore) (struct usb_device *hub);
 	void   *hubsoftc;
-	size_t uframe_usage[USB_HS_MICRO_FRAMES_MAX];
+	usb_size_t uframe_usage[USB_HS_MICRO_FRAMES_MAX];
 	uint16_t portpower;		/* mA per USB port */
 	uint8_t	isoc_last_time;
 	uint8_t	nports;

Modified: head/sys/dev/usb/usb_lookup.c
==============================================================================
--- head/sys/dev/usb/usb_lookup.c	Fri May 29 23:41:31 2009	(r193073)
+++ head/sys/dev/usb/usb_lookup.c	Sat May 30 00:22:57 2009	(r193074)
@@ -42,7 +42,7 @@
  * Else: Pointer to matching entry.
  *------------------------------------------------------------------------*/
 const struct usb_device_id *
-usb2_lookup_id_by_info(const struct usb_device_id *id, size_t sizeof_id,
+usb2_lookup_id_by_info(const struct usb_device_id *id, usb_size_t sizeof_id,
     const struct usb_lookup_info *info)
 {
 	const struct usb_device_id *id_end;
@@ -121,7 +121,7 @@ done:
  * Else: Failure
  *------------------------------------------------------------------------*/
 int
-usb2_lookup_id_by_uaa(const struct usb_device_id *id, size_t sizeof_id,
+usb2_lookup_id_by_uaa(const struct usb_device_id *id, usb_size_t sizeof_id,
     struct usb_attach_arg *uaa)
 {
 	id = usb2_lookup_id_by_info(id, sizeof_id, &uaa->info);

Modified: head/sys/dev/usb/usb_lookup.h
==============================================================================
--- head/sys/dev/usb/usb_lookup.h	Fri May 29 23:41:31 2009	(r193073)
+++ head/sys/dev/usb/usb_lookup.h	Sat May 30 00:22:57 2009	(r193074)
@@ -114,9 +114,9 @@ struct usb_device_id {
   (((const uint8_t *)((did)->driver_info)) - ((const uint8_t *)0))
 
 const struct usb_device_id *usb2_lookup_id_by_info(
-	    const struct usb_device_id *id, size_t sizeof_id,
+	    const struct usb_device_id *id, usb_size_t sizeof_id,
 	    const struct usb_lookup_info *info);
 int	usb2_lookup_id_by_uaa(const struct usb_device_id *id,
-	    size_t sizeof_id, struct usb_attach_arg *uaa);
+	    usb_size_t sizeof_id, struct usb_attach_arg *uaa);
 
 #endif					/* _USB2_LOOKUP_H_ */

Modified: head/sys/dev/usb/usb_mbuf.c
==============================================================================
--- head/sys/dev/usb/usb_mbuf.c	Fri May 29 23:41:31 2009	(r193073)
+++ head/sys/dev/usb/usb_mbuf.c	Sat May 30 00:22:57 2009	(r193074)
@@ -36,12 +36,12 @@
  *------------------------------------------------------------------------*/
 void   *
 usb2_alloc_mbufs(struct malloc_type *type, struct usb_ifqueue *ifq,
-    size_t block_size, uint16_t nblocks)
+    usb_size_t block_size, uint16_t nblocks)
 {
 	struct usb_mbuf *m_ptr;
 	uint8_t *data_ptr;
 	void *free_ptr = NULL;
-	size_t alloc_size;
+	usb_size_t alloc_size;
 
 	/* align data */
 	block_size += ((-block_size) & (USB_HOST_ALIGN - 1));

Modified: head/sys/dev/usb/usb_mbuf.h
==============================================================================
--- head/sys/dev/usb/usb_mbuf.h	Fri May 29 23:41:31 2009	(r193073)
+++ head/sys/dev/usb/usb_mbuf.h	Sat May 30 00:22:57 2009	(r193074)
@@ -37,8 +37,8 @@ struct usb_mbuf {
 	struct usb_mbuf *usb2_nextpkt;
 	struct usb_mbuf *usb2_next;
 
-	size_t cur_data_len;
-	size_t max_data_len;
+	usb_size_t cur_data_len;
+	usb_size_t max_data_len;
 	uint8_t last_packet:1;
 	uint8_t unused:7;
 };
@@ -51,8 +51,8 @@ struct usb_ifqueue {
 	struct usb_mbuf *ifq_head;
 	struct usb_mbuf *ifq_tail;
 
-	size_t ifq_len;
-	size_t ifq_maxlen;
+	usb_size_t ifq_len;
+	usb_size_t ifq_maxlen;
 };
 
 #define	USB_IF_ENQUEUE(ifq, m) do {		\
@@ -97,6 +97,6 @@ struct usb_ifqueue {
 
 /* prototypes */
 void   *usb2_alloc_mbufs(struct malloc_type *type, struct usb_ifqueue *ifq,
-	    size_t block_size, uint16_t nblocks);
+	    usb_size_t block_size, uint16_t nblocks);
 
 #endif					/* _USB2_MBUF_H_ */

Modified: head/sys/dev/usb/usb_msctest.c
==============================================================================
--- head/sys/dev/usb/usb_msctest.c	Fri May 29 23:41:31 2009	(r193073)
+++ head/sys/dev/usb/usb_msctest.c	Sat May 30 00:22:57 2009	(r193074)
@@ -109,8 +109,8 @@ struct bbb_transfer {
 
 	uint8_t *data_ptr;
 
-	size_t data_len;		/* bytes */
-	size_t data_rem;		/* bytes */
+	usb_size_t data_len;		/* bytes */
+	usb_size_t data_rem;		/* bytes */
 	usb_timeout_t data_timeout;	/* ms */
 	usb_frlength_t actlen;		/* bytes */
 
@@ -435,7 +435,7 @@ bbb_status_callback(struct usb_xfer *xfe
  *------------------------------------------------------------------------*/
 static uint8_t
 bbb_command_start(struct bbb_transfer *sc, uint8_t dir, uint8_t lun,
-    void *data_ptr, size_t data_len, uint8_t cmd_len,
+    void *data_ptr, usb_size_t data_len, uint8_t cmd_len,
     usb_timeout_t data_timeout)
 {
 	sc->lun = lun;

Modified: head/sys/dev/usb/usb_process.c
==============================================================================
--- head/sys/dev/usb/usb_process.c	Fri May 29 23:41:31 2009	(r193073)
+++ head/sys/dev/usb/usb_process.c	Sat May 30 00:22:57 2009	(r193074)
@@ -243,7 +243,7 @@ usb2_proc_msignal(struct usb_process *up
 	struct usb_proc_msg *pm0 = _pm0;
 	struct usb_proc_msg *pm1 = _pm1;
 	struct usb_proc_msg *pm2;
-	size_t d;
+	usb_size_t d;
 	uint8_t t;
 
 	/* check if gone, return dummy value */

Modified: head/sys/dev/usb/usb_process.h
==============================================================================
--- head/sys/dev/usb/usb_process.h	Fri May 29 23:41:31 2009	(r193073)
+++ head/sys/dev/usb/usb_process.h	Sat May 30 00:22:57 2009	(r193074)
@@ -51,7 +51,7 @@ typedef void (usb_proc_callback_t)(struc
 struct usb_proc_msg {
 	TAILQ_ENTRY(usb_proc_msg) pm_qentry;
 	usb_proc_callback_t *pm_callback;
-	size_t pm_num;
+	usb_size_t pm_num;
 };
 
 /*
@@ -66,7 +66,7 @@ struct usb_process {
 	struct thread *up_curtd;
 	struct mtx *up_mtx;
 
-	size_t up_msg_num;
+	usb_size_t up_msg_num;
 
 	uint8_t	up_prio;
 	uint8_t	up_gone;

Modified: head/sys/dev/usb/usb_transfer.c
==============================================================================
--- head/sys/dev/usb/usb_transfer.c	Fri May 29 23:41:31 2009	(r193073)
+++ head/sys/dev/usb/usb_transfer.c	Sat May 30 00:22:57 2009	(r193074)
@@ -168,18 +168,18 @@ usb2_get_dma_delay(struct usb_bus *bus)
 #if USB_HAVE_BUSDMA
 uint8_t
 usb2_transfer_setup_sub_malloc(struct usb_setup_params *parm,
-    struct usb_page_cache **ppc, size_t size, size_t align,
-    size_t count)
+    struct usb_page_cache **ppc, usb_size_t size, usb_size_t align,
+    usb_size_t count)
 {
 	struct usb_page_cache *pc;
 	struct usb_page *pg;
 	void *buf;
-	size_t n_dma_pc;
-	size_t n_obj;
-	size_t x;
-	size_t y;
-	size_t r;
-	size_t z;
+	usb_size_t n_dma_pc;
+	usb_size_t n_obj;
+	usb_size_t x;
+	usb_size_t y;
+	usb_size_t r;
+	usb_size_t z;
 
 	USB_ASSERT(align > 1, ("Invalid alignment, 0x%08x!\n",
 	    align));

Modified: head/sys/dev/usb/usb_transfer.h
==============================================================================
--- head/sys/dev/usb/usb_transfer.h	Fri May 29 23:41:31 2009	(r193073)
+++ head/sys/dev/usb/usb_transfer.h	Sat May 30 00:22:57 2009	(r193074)
@@ -67,8 +67,8 @@ struct usb_xfer_root {
 	struct usb_bus *bus;		/* pointer to USB bus (cached) */
 	struct usb_device *udev;	/* pointer to USB device */
 
-	size_t memory_size;
-	size_t setup_refcount;
+	usb_size_t memory_size;
+	usb_size_t setup_refcount;
 #if USB_HAVE_BUSDMA
 	usb_frcount_t dma_nframes;	/* number of page caches to load */
 	usb_frcount_t dma_currframe;	/* currect page cache number */
@@ -97,7 +97,7 @@ struct usb_setup_params {
 	void   *buf;
 	usb_frlength_t *xfer_length_ptr;
 
-	size_t size[7];
+	usb_size_t size[7];
 	usb_frlength_t bufsize;
 	usb_frlength_t bufsize_max;
 
@@ -112,8 +112,8 @@ struct usb_setup_params {
 /* function prototypes */
 
 uint8_t	usb2_transfer_setup_sub_malloc(struct usb_setup_params *parm,
-	    struct usb_page_cache **ppc, size_t size, size_t align,
-	    size_t count);
+	    struct usb_page_cache **ppc, usb_size_t size, usb_size_t align,
+	    usb_size_t count);
 void	usb2_command_wrapper(struct usb_xfer_queue *pq,
 	    struct usb_xfer *xfer);
 void	usb2_pipe_enter(struct usb_xfer *xfer);

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 01:33:06 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 12663106566C;
	Sat, 30 May 2009 01:33:06 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 00D118FC19;
	Sat, 30 May 2009 01:33:06 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4U1X5G4092649;
	Sat, 30 May 2009 01:33:05 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4U1X5oT092648;
	Sat, 30 May 2009 01:33:05 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200905300133.n4U1X5oT092648@svn.freebsd.org>
From: Sam Leffler 
Date: Sat, 30 May 2009 01:33:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193079 - head/sys/dev/bwi
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 01:33:06 -0000

Author: sam
Date: Sat May 30 01:33:05 2009
New Revision: 193079
URL: http://svn.freebsd.org/changeset/base/193079

Log:
  fix typo

Modified:
  head/sys/dev/bwi/if_bwi.c

Modified: head/sys/dev/bwi/if_bwi.c
==============================================================================
--- head/sys/dev/bwi/if_bwi.c	Sat May 30 01:05:31 2009	(r193078)
+++ head/sys/dev/bwi/if_bwi.c	Sat May 30 01:33:05 2009	(r193079)
@@ -3155,14 +3155,14 @@ bwi_encap_raw(struct bwi_softc *sc, int 
 	rate = params->ibp_rate0;
 	if (!ieee80211_isratevalid(ic->ic_rt, rate)) {
 		/* XXX fall back to mcast/mgmt rate? */
-		m_freem(m0);
+		m_freem(m);
 		return EINVAL;
 	}
 	if (params->ibp_try1 != 0) {
 		rate_fb = params->ibp_rate1;
 		if (!ieee80211_isratevalid(ic->ic_rt, rate_fb)) {
 			/* XXX fall back to rate0? */
-			m_freem(m0);
+			m_freem(m);
 			return EINVAL;
 		}
 	} else

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 06:37:04 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 51FD6106566B;
	Sat, 30 May 2009 06:37:04 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4039A8FC21;
	Sat, 30 May 2009 06:37:04 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4U6b3Jc098868;
	Sat, 30 May 2009 06:37:03 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4U6b3rM098867;
	Sat, 30 May 2009 06:37:03 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <200905300637.n4U6b3rM098867@svn.freebsd.org>
From: Adrian Chadd 
Date: Sat, 30 May 2009 06:37:03 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193082 - head/sys/i386/xen
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 06:37:04 -0000

Author: adrian
Date: Sat May 30 06:37:03 2009
New Revision: 193082
URL: http://svn.freebsd.org/changeset/base/193082

Log:
  Correctly report the IPI IRQs being created; make it clear what vectors they are for.

Modified:
  head/sys/i386/xen/mp_machdep.c

Modified: head/sys/i386/xen/mp_machdep.c
==============================================================================
--- head/sys/i386/xen/mp_machdep.c	Sat May 30 05:19:10 2009	(r193081)
+++ head/sys/i386/xen/mp_machdep.c	Sat May 30 06:37:03 2009	(r193082)
@@ -480,8 +480,8 @@ xen_smp_intr_init(unsigned int cpu)
 				    smp_reschedule_interrupt,
 	    INTR_FAST|INTR_TYPE_TTY|INTR_MPSAFE, &irq);
 
-	printf("cpu=%d irq=%d vector=%d\n",
-	    cpu, rc, RESCHEDULE_VECTOR);
+	printf("[XEN] IPI cpu=%d irq=%d vector=RESCHEDULE_VECTOR (%d)\n",
+	    cpu, irq, RESCHEDULE_VECTOR);
 	
 	per_cpu(resched_irq, cpu) = irq;
 
@@ -495,8 +495,8 @@ xen_smp_intr_init(unsigned int cpu)
 		goto fail;
 	per_cpu(callfunc_irq, cpu) = irq;
 
-	printf("cpu=%d irq=%d vector=%d\n",
-	    cpu, rc, CALL_FUNCTION_VECTOR);
+	printf("[XEN] IPI cpu=%d irq=%d vector=CALL_FUNCTION_VECTOR (%d)\n",
+	    cpu, irq, CALL_FUNCTION_VECTOR);
 
 	
 	if ((cpu != 0) && ((rc = ap_cpu_initclocks(cpu)) != 0))

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 07:08:16 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A396D106564A;
	Sat, 30 May 2009 07:08:16 +0000 (UTC)
	(envelope-from kientzle@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 91DE38FC18;
	Sat, 30 May 2009 07:08:16 +0000 (UTC)
	(envelope-from kientzle@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4U78Gn6099456;
	Sat, 30 May 2009 07:08:16 GMT
	(envelope-from kientzle@svn.freebsd.org)
Received: (from kientzle@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4U78GSJ099455;
	Sat, 30 May 2009 07:08:16 GMT
	(envelope-from kientzle@svn.freebsd.org)
Message-Id: <200905300708.n4U78GSJ099455@svn.freebsd.org>
From: Tim Kientzle 
Date: Sat, 30 May 2009 07:08:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193083 - head/lib/libarchive
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 07:08:17 -0000

Author: kientzle
Date: Sat May 30 07:08:16 2009
New Revision: 193083
URL: http://svn.freebsd.org/changeset/base/193083

Log:
  Link libarchive against -lmd and -lcrypto.
  
  Thanks to Ed Schouten for the clue.

Modified:
  head/lib/libarchive/Makefile

Modified: head/lib/libarchive/Makefile
==============================================================================
--- head/lib/libarchive/Makefile	Sat May 30 06:37:03 2009	(r193082)
+++ head/lib/libarchive/Makefile	Sat May 30 07:08:16 2009	(r193083)
@@ -3,7 +3,7 @@
 
 LIB=	archive
 DPADD=	${LIBBZ2} ${LIBZ}
-LDADD=	-lbz2 -lz
+LDADD=	-lbz2 -lz -lmd
 
 # FreeBSD SHLIB_MAJOR value is managed as part of the FreeBSD system.
 # It has no real relation to the libarchive version number.
@@ -17,6 +17,7 @@ CFLAGS+=	-I${.OBJDIR}
 
 .if ${MK_OPENSSL} != "no"
 CFLAGS+=	-DWITH_OPENSSL
+LDFLAGS+=	-lcrypto
 .endif
 
 

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 07:33:32 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AED83106564A;
	Sat, 30 May 2009 07:33:32 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9D1AE8FC1A;
	Sat, 30 May 2009 07:33:32 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4U7XWjq099965;
	Sat, 30 May 2009 07:33:32 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4U7XWiE099964;
	Sat, 30 May 2009 07:33:32 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200905300733.n4U7XWiE099964@svn.freebsd.org>
From: Xin LI 
Date: Sat, 30 May 2009 07:33:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193084 - head/sys/compat/svr4
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 07:33:33 -0000

Author: delphij
Date: Sat May 30 07:33:32 2009
New Revision: 193084
URL: http://svn.freebsd.org/changeset/base/193084

Log:
  Attempt to fix build by updating hostid to follow the new world order.

Modified:
  head/sys/compat/svr4/svr4_stat.c

Modified: head/sys/compat/svr4/svr4_stat.c
==============================================================================
--- head/sys/compat/svr4/svr4_stat.c	Sat May 30 07:08:16 2009	(r193083)
+++ head/sys/compat/svr4/svr4_stat.c	Sat May 30 07:33:32 2009	(r193084)
@@ -458,7 +458,10 @@ svr4_sys_systeminfo(td, uap)
 		break;
 
 	case SVR4_SI_HW_SERIAL:
-		snprintf(buf, sizeof(buf), "%lu", hostid);
+		pr = td->td_ucred->cr_prison;
+		mtx_lock(&pr->pr_mtx);
+		snprintf(buf, sizeof(buf), "%lu", pr->pr_hostid);
+		mtx_unlock(&pr->pr_mtx);
 		str = buf;
 		break;
 

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 08:53:13 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CD364106567B;
	Sat, 30 May 2009 08:53:13 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BA39D8FC25;
	Sat, 30 May 2009 08:53:13 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4U8rDdB001661;
	Sat, 30 May 2009 08:53:13 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4U8rDol001660;
	Sat, 30 May 2009 08:53:13 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <200905300853.n4U8rDol001660@svn.freebsd.org>
From: Adrian Chadd 
Date: Sat, 30 May 2009 08:53:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193085 - head/sys/xen/evtchn
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 08:53:14 -0000

Author: adrian
Date: Sat May 30 08:53:13 2009
New Revision: 193085
URL: http://svn.freebsd.org/changeset/base/193085

Log:
  Make ipi_cpu() function as intended.
  
  IPI's in Xen are implemented through hypervisor event channels.
  The MP code creates a pair of IRQs for each base IPI per CPU
  (one for IPI function dispatch calls, one for IPI bitmap dispatch calls.)
  Using PCPU_GET() was returning the IRQ of the IPI handler for the
  current CPU; thus calls to ipi_cpu() were sending itself a message.
  Instead, looking up the IPI in the target CPU ipi-to-irq map is needed.
  
  Note: This doesn't fix Xen SMP (far from it!) but it at least
  sends IPI's to the right places. Next - sending IPIs..
  
  PR:	135069

Modified:
  head/sys/xen/evtchn/evtchn.c

Modified: head/sys/xen/evtchn/evtchn.c
==============================================================================
--- head/sys/xen/evtchn/evtchn.c	Sat May 30 07:33:32 2009	(r193084)
+++ head/sys/xen/evtchn/evtchn.c	Sat May 30 08:53:13 2009	(r193085)
@@ -225,12 +225,15 @@ evtchn_do_upcall(struct trapframe *frame
 	}
 }
 
+/*
+ * Send an IPI from the current CPU to the destination CPU.
+ */
 void
 ipi_pcpu(unsigned int cpu, int vector) 
 { 
         int irq;
 
-	irq = PCPU_GET(ipi_to_irq[vector]);
+	irq = pcpu_find(cpu)->pc_ipi_to_irq[vector];
 	
         notify_remote_via_irq(irq); 
 } 

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 10:00:07 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E59FE1065679;
	Sat, 30 May 2009 10:00:07 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from mail.cksoft.de (mail.cksoft.de [195.88.108.3])
	by mx1.freebsd.org (Postfix) with ESMTP id 9A9718FC0A;
	Sat, 30 May 2009 10:00:07 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from localhost (amavis.fra.cksoft.de [192.168.74.71])
	by mail.cksoft.de (Postfix) with ESMTP id 6905E41C70A;
	Sat, 30 May 2009 12:00:06 +0200 (CEST)
X-Virus-Scanned: amavisd-new at cksoft.de
Received: from mail.cksoft.de ([195.88.108.3])
	by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new,
	port 10024)
	with ESMTP id RmLNmBNzpLLx; Sat, 30 May 2009 12:00:06 +0200 (CEST)
Received: by mail.cksoft.de (Postfix, from userid 66)
	id 1001341C707; Sat, 30 May 2009 12:00:05 +0200 (CEST)
Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net
	[10.111.66.10])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.int.zabbadoz.net (Postfix) with ESMTP id 4583C4448E6;
	Sat, 30 May 2009 09:56:52 +0000 (UTC)
Date: Sat, 30 May 2009 09:56:52 +0000 (UTC)
From: "Bjoern A. Zeeb" 
X-X-Sender: bz@maildrop.int.zabbadoz.net
To: Xin LI 
In-Reply-To: <200905300733.n4U7XWiE099964@svn.freebsd.org>
Message-ID: <20090530095547.B3234@maildrop.int.zabbadoz.net>
References: <200905300733.n4U7XWiE099964@svn.freebsd.org>
X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r193084 - head/sys/compat/svr4
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 10:00:08 -0000

On Sat, 30 May 2009, Xin LI wrote:

> Author: delphij
> Date: Sat May 30 07:33:32 2009
> New Revision: 193084
> URL: http://svn.freebsd.org/changeset/base/193084
>
> Log:
>  Attempt to fix build by updating hostid to follow the new world order.

Thanks for fixing this.

-- 
Bjoern A. Zeeb                      The greatest risk is not taking one.

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 10:36:14 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9CC4E106564A;
	Sat, 30 May 2009 10:36:14 +0000 (UTC)
	(envelope-from jilles@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8B4FE8FC20;
	Sat, 30 May 2009 10:36:14 +0000 (UTC)
	(envelope-from jilles@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UAaEtt003708;
	Sat, 30 May 2009 10:36:14 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UAaEBp003707;
	Sat, 30 May 2009 10:36:14 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <200905301036.n4UAaEBp003707@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Sat, 30 May 2009 10:36:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193086 - head/bin/cp
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 10:36:15 -0000

Author: jilles
Date: Sat May 30 10:36:14 2009
New Revision: 193086
URL: http://svn.freebsd.org/changeset/base/193086

Log:
  Preserve file flags on symlinks in cp -Rp.
  This reported ENOSYS before.
  
  PR:		bin/111226 (part of)
  Submitted by:	Martin Kammerhofer
  Approved by:	ed (mentor)
  MFC after:	3 weeks

Modified:
  head/bin/cp/utils.c

Modified: head/bin/cp/utils.c
==============================================================================
--- head/bin/cp/utils.c	Sat May 30 08:53:13 2009	(r193085)
+++ head/bin/cp/utils.c	Sat May 30 10:36:14 2009	(r193086)
@@ -365,7 +365,7 @@ setfile(struct stat *fs, int fd)
 	if (!gotstat || fs->st_flags != ts.st_flags)
 		if (fdval ?
 		    fchflags(fd, fs->st_flags) :
-		    (islink ? (errno = ENOSYS) :
+		    (islink ? lchflags(to.p_path, fs->st_flags) :
 		    chflags(to.p_path, fs->st_flags))) {
 			warn("chflags: %s", to.p_path);
 			rval = 1;

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 10:39:16 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 151641065670;
	Sat, 30 May 2009 10:39:16 +0000 (UTC)
	(envelope-from kostikbel@gmail.com)
Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147])
	by mx1.freebsd.org (Postfix) with ESMTP id A92948FC0C;
	Sat, 30 May 2009 10:39:15 +0000 (UTC)
	(envelope-from kostikbel@gmail.com)
Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua)
	by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256)
	(Exim 4.63 (FreeBSD)) (envelope-from )
	id 1MALy5-000L8r-CZ; Sat, 30 May 2009 13:39:13 +0300
Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua
	[10.1.1.148])
	by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n4UAd6Xd005690
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Sat, 30 May 2009 13:39:06 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1])
	by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id
	n4UAd6Ah096618; Sat, 30 May 2009 13:39:06 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
Received: (from kostik@localhost)
	by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n4UAd6UR096617; 
	Sat, 30 May 2009 13:39:06 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to
	kostikbel@gmail.com using -f
Date: Sat, 30 May 2009 13:39:06 +0300
From: Kostik Belousov 
To: Tim Kientzle 
Message-ID: <20090530103906.GL1927@deviant.kiev.zoral.com.ua>
References: <200905300708.n4U78GSJ099455@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="L4mbW+vRUgyeXJBw"
Content-Disposition: inline
In-Reply-To: <200905300708.n4U78GSJ099455@svn.freebsd.org>
User-Agent: Mutt/1.4.2.3i
X-Virus-Scanned: clamav-milter 0.95.1 at skuns.kiev.zoral.com.ua
X-Virus-Status: Clean
X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00
	autolearn=ham version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on
	skuns.kiev.zoral.com.ua
X-Virus-Scanned: mail.terabit.net.ua 1MALy5-000L8r-CZ
	f8f9a48a8f5ab7083bd17af5719c3efe
X-Terabit: YES
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r193083 - head/lib/libarchive
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 10:39:16 -0000


--L4mbW+vRUgyeXJBw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, May 30, 2009 at 07:08:16AM +0000, Tim Kientzle wrote:
> Author: kientzle
> Date: Sat May 30 07:08:16 2009
> New Revision: 193083
> URL: http://svn.freebsd.org/changeset/base/193083
>=20
> Log:
>   Link libarchive against -lmd and -lcrypto.
>  =20
>   Thanks to Ed Schouten for the clue.
>=20
> Modified:
>   head/lib/libarchive/Makefile
>=20
> Modified: head/lib/libarchive/Makefile
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- head/lib/libarchive/Makefile	Sat May 30 06:37:03 2009	(r193082)
> +++ head/lib/libarchive/Makefile	Sat May 30 07:08:16 2009	(r193083)
> @@ -3,7 +3,7 @@
> =20
>  LIB=3D	archive
>  DPADD=3D	${LIBBZ2} ${LIBZ}
> -LDADD=3D	-lbz2 -lz
> +LDADD=3D	-lbz2 -lz -lmd
I think that you need to update DPADD too.

--L4mbW+vRUgyeXJBw
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEARECAAYFAkohDMkACgkQC3+MBN1Mb4hKvgCgrZv0TaRR+TBz0ubpZieGW5Yh
60cAn0WBZgojbSM2L4310oObTWMtmwWa
=7RoG
-----END PGP SIGNATURE-----

--L4mbW+vRUgyeXJBw--

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 10:42:19 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BFCB7106564A;
	Sat, 30 May 2009 10:42:19 +0000 (UTC)
	(envelope-from jilles@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9355C8FC13;
	Sat, 30 May 2009 10:42:19 +0000 (UTC)
	(envelope-from jilles@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UAgJsA003841;
	Sat, 30 May 2009 10:42:19 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UAgJG5003839;
	Sat, 30 May 2009 10:42:19 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <200905301042.n4UAgJG5003839@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Sat, 30 May 2009 10:42:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193087 - in head: bin/rm usr.bin/find
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 10:42:20 -0000

Author: jilles
Date: Sat May 30 10:42:19 2009
New Revision: 193087
URL: http://svn.freebsd.org/changeset/base/193087

Log:
  rm, find -delete: fix removing symlinks with uchg/uappnd set.
  
  Formerly, this tried to clear the flags on the symlink's target
  instead of the symlink itself.
  
  As before, this only happens for root or for the unlink(1) variant of rm.
  
  PR:		bin/111226 (part of)
  Submitted by:	Martin Kammerhofer
  Approved by:	ed (mentor)
  MFC after:	3 weeks

Modified:
  head/bin/rm/rm.c
  head/usr.bin/find/function.c

Modified: head/bin/rm/rm.c
==============================================================================
--- head/bin/rm/rm.c	Sat May 30 10:36:14 2009	(r193086)
+++ head/bin/rm/rm.c	Sat May 30 10:42:19 2009	(r193087)
@@ -234,7 +234,7 @@ rm_tree(char **argv)
 			else if (!uid &&
 				 (p->fts_statp->st_flags & (UF_APPEND|UF_IMMUTABLE)) &&
 				 !(p->fts_statp->st_flags & (SF_APPEND|SF_IMMUTABLE)) &&
-				 chflags(p->fts_accpath,
+				 lchflags(p->fts_accpath,
 					 p->fts_statp->st_flags &= ~(UF_APPEND|UF_IMMUTABLE)) < 0)
 				goto err;
 			continue;
@@ -253,7 +253,7 @@ rm_tree(char **argv)
 		if (!uid &&
 		    (p->fts_statp->st_flags & (UF_APPEND|UF_IMMUTABLE)) &&
 		    !(p->fts_statp->st_flags & (SF_APPEND|SF_IMMUTABLE)))
-			rval = chflags(p->fts_accpath,
+			rval = lchflags(p->fts_accpath,
 				       p->fts_statp->st_flags &= ~(UF_APPEND|UF_IMMUTABLE));
 		if (rval == 0) {
 			/*
@@ -368,7 +368,7 @@ rm_file(char **argv)
 		if (!uid && !S_ISWHT(sb.st_mode) &&
 		    (sb.st_flags & (UF_APPEND|UF_IMMUTABLE)) &&
 		    !(sb.st_flags & (SF_APPEND|SF_IMMUTABLE)))
-			rval = chflags(f, sb.st_flags & ~(UF_APPEND|UF_IMMUTABLE));
+			rval = lchflags(f, sb.st_flags & ~(UF_APPEND|UF_IMMUTABLE));
 		if (rval == 0) {
 			if (S_ISWHT(sb.st_mode))
 				rval = undelete(f);

Modified: head/usr.bin/find/function.c
==============================================================================
--- head/usr.bin/find/function.c	Sat May 30 10:36:14 2009	(r193086)
+++ head/usr.bin/find/function.c	Sat May 30 10:42:19 2009	(r193087)
@@ -443,7 +443,7 @@ f_delete(PLAN *plan __unused, FTSENT *en
 	if ((entry->fts_statp->st_flags & (UF_APPEND|UF_IMMUTABLE)) &&
 	    !(entry->fts_statp->st_flags & (SF_APPEND|SF_IMMUTABLE)) &&
 	    geteuid() == 0)
-		chflags(entry->fts_accpath,
+		lchflags(entry->fts_accpath,
 		       entry->fts_statp->st_flags &= ~(UF_APPEND|UF_IMMUTABLE));
 
 	/* rmdir directories, unlink everything else */

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 10:50:40 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 945971065679;
	Sat, 30 May 2009 10:50:40 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 832CA8FC2A;
	Sat, 30 May 2009 10:50:40 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UAoeow004107;
	Sat, 30 May 2009 10:50:40 GMT (envelope-from rrs@svn.freebsd.org)
Received: (from rrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UAoe02004106;
	Sat, 30 May 2009 10:50:40 GMT (envelope-from rrs@svn.freebsd.org)
Message-Id: <200905301050.n4UAoe02004106@svn.freebsd.org>
From: Randall Stewart 
Date: Sat, 30 May 2009 10:50:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193088 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 10:50:41 -0000

Author: rrs
Date: Sat May 30 10:50:40 2009
New Revision: 193088
URL: http://svn.freebsd.org/changeset/base/193088

Log:
  Make sctp_uio user to kernel structure match the
  socket-api draft. Two fields were uint32_t when they
  should have been uint16_t.
  
  Reported by Jonathan Leighton at U-del.

Modified:
  head/sys/netinet/sctp_uio.h

Modified: head/sys/netinet/sctp_uio.h
==============================================================================
--- head/sys/netinet/sctp_uio.h	Sat May 30 10:42:19 2009	(r193087)
+++ head/sys/netinet/sctp_uio.h	Sat May 30 10:50:40 2009	(r193088)
@@ -68,8 +68,8 @@ struct sctp_event_subscribe {
  * ancillary data structures
  */
 struct sctp_initmsg {
-	uint32_t sinit_num_ostreams;
-	uint32_t sinit_max_instreams;
+	uint16_t sinit_num_ostreams;
+	uint16_t sinit_max_instreams;
 	uint16_t sinit_max_attempts;
 	uint16_t sinit_max_init_timeo;
 };

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 10:56:27 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9A212106564A;
	Sat, 30 May 2009 10:56:27 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 880528FC0A;
	Sat, 30 May 2009 10:56:27 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UAuRoA004265;
	Sat, 30 May 2009 10:56:27 GMT (envelope-from rrs@svn.freebsd.org)
Received: (from rrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UAuRR7004263;
	Sat, 30 May 2009 10:56:27 GMT (envelope-from rrs@svn.freebsd.org)
Message-Id: <200905301056.n4UAuRR7004263@svn.freebsd.org>
From: Randall Stewart 
Date: Sat, 30 May 2009 10:56:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193089 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 10:56:28 -0000

Author: rrs
Date: Sat May 30 10:56:27 2009
New Revision: 193089
URL: http://svn.freebsd.org/changeset/base/193089

Log:
  Fix a small memory leak from the nr-sack code - the mapping array
  was not being freed at term of association. Also get rid of
  the MICHAELS_EXP code.

Modified:
  head/sys/netinet/sctp_pcb.c
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctp_pcb.c
==============================================================================
--- head/sys/netinet/sctp_pcb.c	Sat May 30 10:50:40 2009	(r193088)
+++ head/sys/netinet/sctp_pcb.c	Sat May 30 10:56:27 2009	(r193089)
@@ -4104,9 +4104,6 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, 
 	head = &SCTP_BASE_INFO(sctp_asochash)[SCTP_PCBHASH_ASOC(stcb->asoc.my_vtag, SCTP_BASE_INFO(hashasocmark))];
 	/* put it in the bucket in the vtag hash of assoc's for the system */
 	LIST_INSERT_HEAD(head, stcb, sctp_asocs);
-#ifdef MICHAELS_EXPERIMENT
-	sctp_delete_from_timewait(stcb->asoc.my_vtag, inp->sctp_lport, stcb->rport);
-#endif
 	SCTP_INP_INFO_WUNLOCK();
 
 	if ((err = sctp_add_remote_addr(stcb, firstaddr, SCTP_DO_SETSCOPE, SCTP_ALLOC_ASOC))) {
@@ -4119,6 +4116,10 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, 
 			SCTP_FREE(asoc->mapping_array, SCTP_M_MAP);
 			asoc->mapping_array = NULL;
 		}
+		if (asoc->nr_mapping_array) {
+			SCTP_FREE(asoc->nr_mapping_array, SCTP_M_MAP);
+			asoc->nr_mapping_array = NULL;
+		}
 		SCTP_DECR_ASOC_COUNT();
 		SCTP_TCB_LOCK_DESTROY(stcb);
 		SCTP_TCB_SEND_LOCK_DESTROY(stcb);
@@ -4881,6 +4882,10 @@ sctp_free_assoc(struct sctp_inpcb *inp, 
 		SCTP_FREE(asoc->mapping_array, SCTP_M_MAP);
 		asoc->mapping_array = NULL;
 	}
+	if (asoc->nr_mapping_array) {
+		SCTP_FREE(asoc->nr_mapping_array, SCTP_M_MAP);
+		asoc->nr_mapping_array = NULL;
+	}
 	/* the stream outs */
 	if (asoc->strmout) {
 		SCTP_FREE(asoc->strmout, SCTP_M_STRMO);
@@ -6378,21 +6383,6 @@ skip_vtag_check:
 		}
 	}
 	SCTP_INP_INFO_RUNLOCK();
-#ifdef MICHAELS_EXPERIMENT
-	/*-
-	 * Not found, ok to use the tag, add it to the time wait hash
-	 * as well this will prevent two sucessive cookies from getting
-	 * the same tag or two inits sent quickly on multi-processors.
-	 * We only keep the tag for the life of a cookie and when we
-	 * add this tag to the assoc hash we need to purge it from
-	 * the t-wait hash.
-	 */
-	SCTP_INP_INFO_WLOCK();
-	if (save_in_twait)
-		sctp_add_vtag_to_timewait(tag, TICKS_TO_SEC(inp->sctp_ep.def_cookie_life, lport, rport));
-	SCTP_INP_INFO_WUNLOCK();
-#endif
-
 	return (1);
 }
 

Modified: head/sys/netinet/sctputil.c
==============================================================================
--- head/sys/netinet/sctputil.c	Sat May 30 10:50:40 2009	(r193088)
+++ head/sys/netinet/sctputil.c	Sat May 30 10:56:27 2009	(r193089)
@@ -917,24 +917,7 @@ sctp_init_asoc(struct sctp_inpcb *m, str
 #endif
 	asoc->sb_send_resv = 0;
 	if (override_tag) {
-#ifdef MICHAELS_EXPERIMENT
-		if (sctp_is_in_timewait(override_tag, stcb->sctp_ep->sctp_lport, stcb->rport)) {
-			/*
-			 * It must be in the time-wait hash, we put it there
-			 * when we aloc one. If not the peer is playing
-			 * games.
-			 */
-			asoc->my_vtag = override_tag;
-		} else {
-			SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTPUTIL, ENOMEM);
-#ifdef INVARIANTS
-			panic("Huh is_in_timewait fails");
-#endif
-			return (ENOMEM);
-		}
-#else
 		asoc->my_vtag = override_tag;
-#endif
 	} else {
 		asoc->my_vtag = sctp_select_a_tag(m, stcb->sctp_ep->sctp_lport, stcb->rport, 1);
 	}
@@ -1159,11 +1142,12 @@ sctp_init_asoc(struct sctp_inpcb *m, str
 	asoc->nr_mapping_array_size = SCTP_INITIAL_NR_MAPPING_ARRAY;
 	SCTP_MALLOC(asoc->nr_mapping_array, uint8_t *, asoc->nr_mapping_array_size,
 	    SCTP_M_MAP);
-	/*
-	 * if (asoc->nr_mapping_array == NULL) { SCTP_FREE(asoc->strmout,
-	 * SCTP_M_STRMO); SCTP_LTRACE_ERR_RET(NULL, stcb, NULL,
-	 * SCTP_FROM_SCTPUTIL, ENOMEM); return (ENOMEM); }
-	 */
+	if (asoc->nr_mapping_array == NULL) {
+		SCTP_FREE(asoc->strmout, SCTP_M_STRMO);
+		SCTP_FREE(asoc->mapping_array, SCTP_M_MAP);
+		SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTPUTIL, ENOMEM);
+		return (ENOMEM);
+	}
 	memset(asoc->nr_mapping_array, 0, asoc->nr_mapping_array_size);
 
 	/* Now the init of the other outqueues */

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 11:14:41 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C7394106566B;
	Sat, 30 May 2009 11:14:41 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B57C38FC12;
	Sat, 30 May 2009 11:14:41 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UBEfXL006570;
	Sat, 30 May 2009 11:14:41 GMT (envelope-from rrs@svn.freebsd.org)
Received: (from rrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UBEf9C006567;
	Sat, 30 May 2009 11:14:41 GMT (envelope-from rrs@svn.freebsd.org)
Message-Id: <200905301114.n4UBEf9C006567@svn.freebsd.org>
From: Randall Stewart 
Date: Sat, 30 May 2009 11:14:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193090 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 11:14:42 -0000

Author: rrs
Date: Sat May 30 11:14:41 2009
New Revision: 193090
URL: http://svn.freebsd.org/changeset/base/193090

Log:
  Adds missing sysctl to manage the vtag_time_wait time. This will
  even allow disabling time-wait all together if you set the value
  to 0 (not advisable actually). The default remains the same
  i.e. 60 seconds.

Modified:
  head/sys/netinet/sctp_pcb.c
  head/sys/netinet/sctp_sysctl.c
  head/sys/netinet/sctp_sysctl.h

Modified: head/sys/netinet/sctp_pcb.c
==============================================================================
--- head/sys/netinet/sctp_pcb.c	Sat May 30 10:56:27 2009	(r193089)
+++ head/sys/netinet/sctp_pcb.c	Sat May 30 11:14:41 2009	(r193090)
@@ -4311,6 +4311,10 @@ sctp_add_vtag_to_timewait(uint32_t tag, 
 	struct timeval now;
 	int set, i;
 
+	if (time == 0) {
+		/* Its disabled */
+		return;
+	}
 	(void)SCTP_GETTIME_TIMEVAL(&now);
 	chain = &SCTP_BASE_INFO(vtag_timewait)[(tag % SCTP_STACK_VTAG_HASH_SIZE)];
 	set = 0;
@@ -4662,7 +4666,8 @@ sctp_free_assoc(struct sctp_inpcb *inp, 
 	}
 	/* pull from vtag hash */
 	LIST_REMOVE(stcb, sctp_asocs);
-	sctp_add_vtag_to_timewait(asoc->my_vtag, SCTP_TIME_WAIT, inp->sctp_lport, stcb->rport);
+	sctp_add_vtag_to_timewait(asoc->my_vtag, SCTP_BASE_SYSCTL(sctp_vtag_time_wait),
+	    inp->sctp_lport, stcb->rport);
 
 	/*
 	 * Now restop the timers to be sure - this is paranoia at is finest!

Modified: head/sys/netinet/sctp_sysctl.c
==============================================================================
--- head/sys/netinet/sctp_sysctl.c	Sat May 30 10:56:27 2009	(r193089)
+++ head/sys/netinet/sctp_sysctl.c	Sat May 30 11:14:41 2009	(r193090)
@@ -105,6 +105,7 @@ sctp_init_sysctls()
 	SCTP_BASE_SYSCTL(sctp_default_frag_interleave) = SCTPCTL_DEFAULT_FRAG_INTERLEAVE_DEFAULT;
 	SCTP_BASE_SYSCTL(sctp_mobility_base) = SCTPCTL_MOBILITY_BASE_DEFAULT;
 	SCTP_BASE_SYSCTL(sctp_mobility_fasthandoff) = SCTPCTL_MOBILITY_FASTHANDOFF_DEFAULT;
+	SCTP_BASE_SYSCTL(sctp_vtag_time_wait) = SCTPCTL_TIME_WAIT_DEFAULT;
 #if defined(SCTP_LOCAL_TRACE_BUF)
 	memset(&SCTP_BASE_SYSCTL(sctp_log), 0, sizeof(struct sctp_log));
 #endif
@@ -610,6 +611,8 @@ sysctl_sctp_check(SYSCTL_HANDLER_ARGS)
 		RANGECHK(SCTP_BASE_SYSCTL(sctp_logging_level), SCTPCTL_LOGGING_LEVEL_MIN, SCTPCTL_LOGGING_LEVEL_MAX);
 		RANGECHK(SCTP_BASE_SYSCTL(sctp_default_cc_module), SCTPCTL_DEFAULT_CC_MODULE_MIN, SCTPCTL_DEFAULT_CC_MODULE_MAX);
 		RANGECHK(SCTP_BASE_SYSCTL(sctp_default_frag_interleave), SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MIN, SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MAX);
+		RANGECHK(SCTP_BASE_SYSCTL(sctp_vtag_time_wait), SCTPCTL_TIME_WAIT_MIN, SCTPCTL_TIME_WAIT_MAX);
+
 #if defined(__FreeBSD__) || defined(SCTP_APPLE_MOBILITY_BASE)
 		RANGECHK(SCTP_BASE_SYSCTL(sctp_mobility_base), SCTPCTL_MOBILITY_BASE_MIN, SCTPCTL_MOBILITY_BASE_MAX);
 #endif
@@ -909,6 +912,10 @@ SYSCTL_PROC(_net_inet_sctp, OID_AUTO, na
     &SCTP_BASE_SYSCTL(sctp_inits_include_nat_friendly), 0, sysctl_sctp_check, "IU",
     SCTPCTL_NAT_FRIENDLY_DESC);
 
+SYSCTL_PROC(_net_inet_sctp, OID_AUTO, vtag_time_wait, CTLTYPE_INT | CTLFLAG_RW,
+    &SCTP_BASE_SYSCTL(sctp_vtag_time_wait), 0, sysctl_sctp_check, "IU",
+    SCTPCTL_TIME_WAIT_DESC);
+
 #ifdef SCTP_DEBUG
 SYSCTL_PROC(_net_inet_sctp, OID_AUTO, debug, CTLTYPE_INT | CTLFLAG_RW,
     &SCTP_BASE_SYSCTL(sctp_debug_on), 0, sysctl_sctp_check, "IU",

Modified: head/sys/netinet/sctp_sysctl.h
==============================================================================
--- head/sys/netinet/sctp_sysctl.h	Sat May 30 10:56:27 2009	(r193089)
+++ head/sys/netinet/sctp_sysctl.h	Sat May 30 11:14:41 2009	(r193090)
@@ -104,6 +104,7 @@ struct sctp_sysctl {
 	uint32_t sctp_udp_tunneling_for_client_enable;
 	uint32_t sctp_udp_tunneling_port;
 	uint32_t sctp_enable_sack_immediately;
+	uint32_t sctp_vtag_time_wait;
 #if defined(SCTP_DEBUG)
 	uint32_t sctp_debug_on;
 #endif
@@ -482,6 +483,13 @@ struct sctp_sysctl {
 #define SCTPCTL_NAT_FRIENDLY_INITS_DEFAULT	SCTPCTL_NAT_FRIENDLY_INITS_MIN
 
 
+/* Vtag tiem wait bits */
+#define SCTPCTL_TIME_WAIT_DESC	"Vtag time wait time 0 disables."
+#define SCTPCTL_TIME_WAIT_MIN	0
+#define SCTPCTL_TIME_WAIT_MAX	0xffffffff
+#define SCTPCTL_TIME_WAIT_DEFAULT	SCTP_TIME_WAIT
+
+
 #if defined(SCTP_DEBUG)
 /* debug: Configure debug output */
 #define SCTPCTL_DEBUG_DESC	"Configure debug output"

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 13:59:06 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 59D821065672;
	Sat, 30 May 2009 13:59:06 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 46AE38FC1D;
	Sat, 30 May 2009 13:59:06 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UDx5NM009803;
	Sat, 30 May 2009 13:59:05 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UDx5Zo009796;
	Sat, 30 May 2009 13:59:05 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <200905301359.n4UDx5Zo009796@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Sat, 30 May 2009 13:59:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193092 - in head: share/man/man9 sys/fs/nullfs
	sys/kern sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 13:59:07 -0000

Author: trasz
Date: Sat May 30 13:59:05 2009
New Revision: 193092
URL: http://svn.freebsd.org/changeset/base/193092

Log:
  Add VOP_ACCESSX, which can be used to query for newly added V*
  permissions, such as VWRITE_ACL.  For a filsystems that don't
  implement it, there is a default implementation, which works
  as a wrapper around VOP_ACCESS.
  
  Reviewed by:	rwatson@

Modified:
  head/share/man/man9/Makefile
  head/share/man/man9/VOP_ACCESS.9
  head/sys/fs/nullfs/null_vnops.c
  head/sys/kern/vfs_default.c
  head/sys/kern/vfs_subr.c
  head/sys/kern/vnode_if.src
  head/sys/sys/vnode.h

Modified: head/share/man/man9/Makefile
==============================================================================
--- head/share/man/man9/Makefile	Sat May 30 12:26:11 2009	(r193091)
+++ head/share/man/man9/Makefile	Sat May 30 13:59:05 2009	(r193092)
@@ -1288,6 +1288,7 @@ MLINKS+=vm_page_io.9 vm_page_io_finish.9
 MLINKS+=vm_page_wakeup.9 vm_page_busy.9 \
 	vm_page_wakeup.9 vm_page_flash.9
 MLINKS+=vm_page_wire.9 vm_page_unwire.9
+MLINKS+=VOP_ACCESS.9 VOP_ACCESSX.9
 MLINKS+=VOP_ATTRIB.9 VOP_GETATTR.9 \
 	VOP_ATTRIB.9 VOP_SETATTR.9
 MLINKS+=VOP_CREATE.9 VOP_MKDIR.9 \

Modified: head/share/man/man9/VOP_ACCESS.9
==============================================================================
--- head/share/man/man9/VOP_ACCESS.9	Sat May 30 12:26:11 2009	(r193091)
+++ head/share/man/man9/VOP_ACCESS.9	Sat May 30 13:59:05 2009	(r193092)
@@ -29,17 +29,20 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 24, 1996
+.Dd May 30, 2009
 .Os
 .Dt VOP_ACCESS 9
 .Sh NAME
-.Nm VOP_ACCESS
+.Nm VOP_ACCESS ,
+.Nm VOP_ACCESSX
 .Nd "check access permissions of a file or Unix domain socket"
 .Sh SYNOPSIS
 .In sys/param.h
 .In sys/vnode.h
 .Ft int
 .Fn VOP_ACCESS "struct vnode *vp" "accmode_t accmode" "struct ucred *cred" "struct thread *td"
+.Ft int
+.Fn VOP_ACCESSX "struct vnode *vp" "accmode_t accmode" "struct ucred *cred" "struct thread *td"
 .Sh DESCRIPTION
 This entry point checks the access permissions of the file against the
 given credentials.
@@ -63,6 +66,20 @@ is a mask which can contain flags descri
 .Dv VWRITE
 or
 .Dv VEXEC .
+For
+.Fn VOP_ACCESS ,
+the only flags that may be set in
+.Fa accmode
+are
+.Dv VEXEC ,
+.Dv VWRITE ,
+.Dv VREAD ,
+.Dv VADMIN
+and
+.Dv VAPPEND .
+To check for other bits, one has to use
+.Fn VOP_ACCESSX
+instead.
 .Sh LOCKS
 The vnode will be locked on entry and should remain locked on return.
 .Sh RETURN VALUES

Modified: head/sys/fs/nullfs/null_vnops.c
==============================================================================
--- head/sys/fs/nullfs/null_vnops.c	Sat May 30 12:26:11 2009	(r193091)
+++ head/sys/fs/nullfs/null_vnops.c	Sat May 30 13:59:05 2009	(r193092)
@@ -472,6 +472,32 @@ null_access(struct vop_access_args *ap)
 	return (null_bypass((struct vop_generic_args *)ap));
 }
 
+static int
+null_accessx(struct vop_accessx_args *ap)
+{
+	struct vnode *vp = ap->a_vp;
+	accmode_t accmode = ap->a_accmode;
+
+	/*
+	 * Disallow write attempts on read-only layers;
+	 * unless the file is a socket, fifo, or a block or
+	 * character device resident on the filesystem.
+	 */
+	if (accmode & VWRITE) {
+		switch (vp->v_type) {
+		case VDIR:
+		case VLNK:
+		case VREG:
+			if (vp->v_mount->mnt_flag & MNT_RDONLY)
+				return (EROFS);
+			break;
+		default:
+			break;
+		}
+	}
+	return (null_bypass((struct vop_generic_args *)ap));
+}
+
 /*
  * We handle this to eliminate null FS to lower FS
  * file moving. Don't know why we don't allow this,
@@ -720,6 +746,7 @@ null_vptofh(struct vop_vptofh_args *ap)
 struct vop_vector null_vnodeops = {
 	.vop_bypass =		null_bypass,
 	.vop_access =		null_access,
+	.vop_accessx =		null_accessx,
 	.vop_bmap =		VOP_EOPNOTSUPP,
 	.vop_getattr =		null_getattr,
 	.vop_getwritemount =	null_getwritemount,

Modified: head/sys/kern/vfs_default.c
==============================================================================
--- head/sys/kern/vfs_default.c	Sat May 30 12:26:11 2009	(r193091)
+++ head/sys/kern/vfs_default.c	Sat May 30 13:59:05 2009	(r193092)
@@ -87,6 +87,7 @@ struct vop_vector default_vnodeops = {
 	.vop_default =		NULL,
 	.vop_bypass =		VOP_EOPNOTSUPP,
 
+	.vop_accessx =		vop_stdaccessx,
 	.vop_advlock =		vop_stdadvlock,
 	.vop_advlockasync =	vop_stdadvlockasync,
 	.vop_bmap =		vop_stdbmap,
@@ -322,6 +323,22 @@ out:
 	return (found);
 }
 
+int
+vop_stdaccessx(struct vop_accessx_args *ap)
+{
+	int error;
+	accmode_t accmode = ap->a_accmode;
+
+	error = vfs_unixify_accmode(&accmode);
+	if (error != 0)
+		return (error);
+
+	if (accmode == 0)
+		return (0);
+
+	return (VOP_ACCESS(ap->a_vp, accmode, ap->a_cred, ap->a_td));
+}
+
 /*
  * Advisory record locking support
  */

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Sat May 30 12:26:11 2009	(r193091)
+++ head/sys/kern/vfs_subr.c	Sat May 30 13:59:05 2009	(r193092)
@@ -4253,3 +4253,50 @@ vfs_mark_atime(struct vnode *vp, struct 
 	if ((vp->v_mount->mnt_flag & (MNT_NOATIME | MNT_RDONLY)) == 0)
 		(void)VOP_MARKATIME(vp);
 }
+
+/*
+ * The purpose of this routine is to remove granularity from accmode_t,
+ * reducing it into standard unix access bits - VEXEC, VREAD, VWRITE,
+ * VADMIN and VAPPEND.
+ *
+ * If it returns 0, the caller is supposed to continue with the usual
+ * access checks using 'accmode' as modified by this routine.  If it
+ * returns nonzero value, the caller is supposed to return that value
+ * as errno.
+ *
+ * Note that after this routine runs, accmode may be zero.
+ */
+int
+vfs_unixify_accmode(accmode_t *accmode)
+{
+	/*
+	 * There is no way to specify explicit "deny" rule using
+	 * file mode or POSIX.1e ACLs.
+	 */
+	if (*accmode & VEXPLICIT_DENY) {
+		*accmode = 0;
+		return (0);
+	}
+
+	/*
+	 * None of these can be translated into usual access bits.
+	 * Also, the common case for NFSv4 ACLs is to not contain
+	 * either of these bits. Caller should check for VWRITE
+	 * on the containing directory instead.
+	 */
+	if (*accmode & (VDELETE_CHILD | VDELETE))
+		return (EPERM);
+
+	if (*accmode & VADMIN_PERMS) {
+		*accmode &= ~VADMIN_PERMS;
+		*accmode |= VADMIN;
+	}
+
+	/*
+	 * There is no way to deny VREAD_ATTRIBUTES, VREAD_ACL
+	 * or VSYNCHRONIZE using file mode or POSIX.1e ACL.
+	 */
+	*accmode &= ~(VSTAT_PERMS | VSYNCHRONIZE);
+
+	return (0);
+}

Modified: head/sys/kern/vnode_if.src
==============================================================================
--- head/sys/kern/vnode_if.src	Sat May 30 12:26:11 2009	(r193091)
+++ head/sys/kern/vnode_if.src	Sat May 30 13:59:05 2009	(r193092)
@@ -153,6 +153,16 @@ vop_access {
 };
 
 
+%% accessx	vp	L L L
+
+vop_accessx {
+	IN struct vnode *vp;
+	IN accmode_t accmode;
+	IN struct ucred *cred;
+	IN struct thread *td;
+};
+
+
 %% getattr	vp	L L L
 
 vop_getattr {

Modified: head/sys/sys/vnode.h
==============================================================================
--- head/sys/sys/vnode.h	Sat May 30 12:26:11 2009	(r193091)
+++ head/sys/sys/vnode.h	Sat May 30 13:59:05 2009	(r193092)
@@ -676,6 +676,7 @@ int	vop_stdlock(struct vop_lock1_args *)
 int	vop_stdputpages(struct vop_putpages_args *);
 int	vop_stdunlock(struct vop_unlock_args *);
 int	vop_nopoll(struct vop_poll_args *);
+int	vop_stdaccessx(struct vop_accessx_args *ap);
 int	vop_stdadvlock(struct vop_advlock_args *ap);
 int	vop_stdadvlockasync(struct vop_advlockasync_args *ap);
 int	vop_stdpathconf(struct vop_pathconf_args *);
@@ -766,6 +767,8 @@ void vfs_mark_atime(struct vnode *vp, st
 struct dirent;
 int vfs_read_dirent(struct vop_readdir_args *ap, struct dirent *dp, off_t off);
 
+int	vfs_unixify_accmode(accmode_t *accmode);
+
 #endif /* _KERNEL */
 
 #endif /* !_SYS_VNODE_H_ */

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 14:01:01 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 98CC9106566C;
	Sat, 30 May 2009 14:01:01 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 873C58FC0C;
	Sat, 30 May 2009 14:01:01 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UE11ZC009903;
	Sat, 30 May 2009 14:01:01 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UE11k0009901;
	Sat, 30 May 2009 14:01:01 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <200905301401.n4UE11k0009901@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Sat, 30 May 2009 14:01:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193093 - in head: . sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 14:01:02 -0000

Author: trasz
Date: Sat May 30 14:01:01 2009
New Revision: 193093
URL: http://svn.freebsd.org/changeset/base/193093

Log:
  Bump __FreeBSD_version after addition of VOP_ACCESSX(9).

Modified:
  head/UPDATING
  head/sys/sys/param.h

Modified: head/UPDATING
==============================================================================
--- head/UPDATING	Sat May 30 13:59:05 2009	(r193092)
+++ head/UPDATING	Sat May 30 14:01:01 2009	(r193093)
@@ -22,6 +22,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.
 	to maximize performance.  (To disable malloc debugging, run
 	ln -s aj /etc/malloc.conf.)
 
+20090530:
+	Add VOP_ACCESSX(9).  File system modules need to be rebuilt.
+	Bump __FreeBSD_version to 800094.
+
 20090529:
 	Add mnt_xflag field to 'struct mount'.  File system modules
 	need to be rebuilt.

Modified: head/sys/sys/param.h
==============================================================================
--- head/sys/sys/param.h	Sat May 30 13:59:05 2009	(r193092)
+++ head/sys/sys/param.h	Sat May 30 14:01:01 2009	(r193093)
@@ -57,7 +57,7 @@
  *		is created, otherwise 1.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 800093	/* Master, propagated to newvers */
+#define __FreeBSD_version 800094	/* Master, propagated to newvers */
 
 #ifndef LOCORE
 #include 

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 14:59:09 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 496281065670;
	Sat, 30 May 2009 14:59:09 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 37B318FC1B;
	Sat, 30 May 2009 14:59:09 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UEx9Yv011002;
	Sat, 30 May 2009 14:59:09 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UEx9xV011001;
	Sat, 30 May 2009 14:59:09 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <200905301459.n4UEx9xV011001@svn.freebsd.org>
From: Adrian Chadd 
Date: Sat, 30 May 2009 14:59:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193094 - head/sys/i386/xen
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 14:59:09 -0000

Author: adrian
Date: Sat May 30 14:59:08 2009
New Revision: 193094
URL: http://svn.freebsd.org/changeset/base/193094

Log:
  Don't schedule a CALL_FUNCTION_VECTOR software IPI if the IPI was signaled
  via the bitmap (and thus sent via RESCHEDULE_VECTOR.)

Modified:
  head/sys/i386/xen/mp_machdep.c

Modified: head/sys/i386/xen/mp_machdep.c
==============================================================================
--- head/sys/i386/xen/mp_machdep.c	Sat May 30 14:01:01 2009	(r193093)
+++ head/sys/i386/xen/mp_machdep.c	Sat May 30 14:59:08 2009	(r193094)
@@ -1132,10 +1132,10 @@ ipi_selected(cpumask_t cpus, u_int ipi)
 				ipi_pcpu(cpu, RESCHEDULE_VECTOR);
 			continue;
 			
+		} else {
+			KASSERT(call_data != NULL, ("call_data not set"));
+			ipi_pcpu(cpu, CALL_FUNCTION_VECTOR);
 		}
-		
-		KASSERT(call_data != NULL, ("call_data not set"));
-		ipi_pcpu(cpu, CALL_FUNCTION_VECTOR);
 	}
 }
 

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 15:14:45 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 86638106566C;
	Sat, 30 May 2009 15:14:45 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 703E88FC08;
	Sat, 30 May 2009 15:14:45 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UFEjBI011386;
	Sat, 30 May 2009 15:14:45 GMT (envelope-from attilio@svn.freebsd.org)
Received: (from attilio@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UFEi5F011371;
	Sat, 30 May 2009 15:14:44 GMT (envelope-from attilio@svn.freebsd.org)
Message-Id: <200905301514.n4UFEi5F011371@svn.freebsd.org>
From: Attilio Rao 
Date: Sat, 30 May 2009 15:14:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193096 - in head/sys: arm/xscale/ixp425 dev/bge dev/dc
	dev/e1000 dev/firewire dev/fxp dev/ixgb dev/lmc dev/mge
	dev/nfe dev/re dev/sf dev/sis dev/smc dev/ste dev/stge
	dev/tsec dev/vge d...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 15:14:46 -0000

Author: attilio
Date: Sat May 30 15:14:44 2009
New Revision: 193096
URL: http://svn.freebsd.org/changeset/base/193096

Log:
  When user_frac in the polling subsystem is low it is going to busy the
  CPU for too long period than necessary.  Additively, interfaces are kept
  polled (in the tick) even if no more packets are available.
  In order to avoid such situations a new generic mechanism can be
  implemented in proactive way, keeping track of the time spent on any
  packet and fragmenting the time for any tick, stopping the processing
  as soon as possible.
  
  In order to implement such mechanism, the polling handler needs to
  change, returning the number of packets processed.
  While the intended logic is not part of this patch, the polling KPI is
  broken by this commit, adding an int return value and the new flag
  IFCAP_POLLING_NOCOUNT (which will signal that the return value is
  meaningless for the installed handler and checking should be skipped).
  
  Bump __FreeBSD_version in order to signal such situation.
  
  Reviewed by:	emaste
  Sponsored by:	Sandvine Incorporated

Modified:
  head/sys/arm/xscale/ixp425/if_npe.c
  head/sys/arm/xscale/ixp425/ixp425_qmgr.c
  head/sys/arm/xscale/ixp425/ixp425_qmgr.h
  head/sys/dev/bge/if_bge.c
  head/sys/dev/dc/if_dc.c
  head/sys/dev/e1000/if_em.c
  head/sys/dev/firewire/if_fwe.c
  head/sys/dev/firewire/if_fwip.c
  head/sys/dev/fxp/if_fxp.c
  head/sys/dev/ixgb/if_ixgb.c
  head/sys/dev/lmc/if_lmc.c
  head/sys/dev/mge/if_mge.c
  head/sys/dev/nfe/if_nfe.c
  head/sys/dev/re/if_re.c
  head/sys/dev/sf/if_sf.c
  head/sys/dev/sis/if_sis.c
  head/sys/dev/smc/if_smc.c
  head/sys/dev/ste/if_ste.c
  head/sys/dev/stge/if_stge.c
  head/sys/dev/tsec/if_tsec.c
  head/sys/dev/vge/if_vge.c
  head/sys/dev/vr/if_vr.c
  head/sys/dev/xl/if_xl.c
  head/sys/net/if.h
  head/sys/net/if_var.h
  head/sys/pci/if_rl.c
  head/sys/sys/param.h

Modified: head/sys/arm/xscale/ixp425/if_npe.c
==============================================================================
--- head/sys/arm/xscale/ixp425/if_npe.c	Sat May 30 15:07:47 2009	(r193095)
+++ head/sys/arm/xscale/ixp425/if_npe.c	Sat May 30 15:14:44 2009	(r193096)
@@ -229,7 +229,7 @@ static void	npe_getmac(struct npe_softc 
 static void	npe_txdone(int qid, void *arg);
 static int	npe_rxbuf_init(struct npe_softc *, struct npebuf *,
 			struct mbuf *);
-static void	npe_rxdone(int qid, void *arg);
+static int	npe_rxdone(int qid, void *arg);
 static void	npeinit(void *);
 static void	npestart_locked(struct ifnet *);
 static void	npestart(struct ifnet *);
@@ -777,7 +777,7 @@ npe_activate(device_t dev)
 	 */
 	sc->rx_qid = npeconfig[sc->sc_npeid].rx_qid;
 	ixpqmgr_qconfig(sc->rx_qid, npe_rxbuf, 0,  1,
-		IX_QMGR_Q_SOURCE_ID_NOT_E, npe_rxdone, sc);
+		IX_QMGR_Q_SOURCE_ID_NOT_E, (qconfig_hand_t *)npe_rxdone, sc);
 	sc->rx_freeqid = npeconfig[sc->sc_npeid].rx_freeqid;
 	ixpqmgr_qconfig(sc->rx_freeqid,	npe_rxbuf, 0, npe_rxbuf/2, 0, NULL, sc);
 	/*
@@ -1091,7 +1091,7 @@ npe_rxbuf_init(struct npe_softc *sc, str
  * from the hardware queue and pass the frames up the
  * stack. Pass the rx buffers to the free list.
  */
-static void
+static int
 npe_rxdone(int qid, void *arg)
 {
 #define	P2V(a, dma) \
@@ -1099,6 +1099,7 @@ npe_rxdone(int qid, void *arg)
 	struct npe_softc *sc = arg;
 	struct npedma *dma = &sc->rxdma;
 	uint32_t entry;
+	int rx_npkts = 0;
 
 	while (ixpqmgr_qread(qid, &entry) == 0) {
 		struct npebuf *npe = P2V(NPE_QM_Q_ADDR(entry), dma);
@@ -1132,6 +1133,7 @@ npe_rxdone(int qid, void *arg)
 
 			ifp->if_ipackets++;
 			ifp->if_input(ifp, mrx);
+			rx_npkts++;
 		} else {
 			/* discard frame and re-use mbuf */
 			m = npe->ix_m;
@@ -1143,19 +1145,22 @@ npe_rxdone(int qid, void *arg)
 			/* XXX should not happen */
 		}
 	}
+	return (rx_npkts);
 #undef P2V
 }
 
 #ifdef DEVICE_POLLING
-static void
+static int
 npe_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
 {
 	struct npe_softc *sc = ifp->if_softc;
+	int rx_npkts = 0;
 
 	if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
-		npe_rxdone(sc->rx_qid, sc);
+		rx_npkts = npe_rxdone(sc->rx_qid, sc);
 		npe_txdone(sc->tx_doneqid, sc);	/* XXX polls both NPE's */
 	}
+	return (rx_npkts);
 }
 #endif /* DEVICE_POLLING */
 

Modified: head/sys/arm/xscale/ixp425/ixp425_qmgr.c
==============================================================================
--- head/sys/arm/xscale/ixp425/ixp425_qmgr.c	Sat May 30 15:07:47 2009	(r193095)
+++ head/sys/arm/xscale/ixp425/ixp425_qmgr.c	Sat May 30 15:14:44 2009	(r193096)
@@ -338,7 +338,7 @@ ixpqmgr_detach(device_t dev)
 
 int
 ixpqmgr_qconfig(int qId, int qEntries, int ne, int nf, int srcSel,
-    void (*cb)(int, void *), void *cbarg)
+    qconfig_hand_t *cb, void *cbarg)
 {
 	struct ixpqmgr_softc *sc = ixpqmgr_sc;
 	struct qmgrInfo *qi = &sc->qinfo[qId];

Modified: head/sys/arm/xscale/ixp425/ixp425_qmgr.h
==============================================================================
--- head/sys/arm/xscale/ixp425/ixp425_qmgr.h	Sat May 30 15:07:47 2009	(r193095)
+++ head/sys/arm/xscale/ixp425/ixp425_qmgr.h	Sat May 30 15:14:44 2009	(r193096)
@@ -229,8 +229,10 @@
 #define IX_QMGR_ENTRY2_OFFSET 1
 #define IX_QMGR_ENTRY4_OFFSET 3
 
+typedef void qconfig_hand_t(int, void *);
+
 int	ixpqmgr_qconfig(int qId, int qSizeInWords, int ne, int nf, int srcSel,
-	    void (*cb)(int, void *), void *cbarg);
+	    qconfig_hand_t *cb, void *cbarg);
 int	ixpqmgr_qwrite(int qId, uint32_t entry);
 int	ixpqmgr_qread(int qId, uint32_t *entry);
 int	ixpqmgr_qreadm(int qId, uint32_t n, uint32_t *p);

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Sat May 30 15:07:47 2009	(r193095)
+++ head/sys/dev/bge/if_bge.c	Sat May 30 15:14:44 2009	(r193096)
@@ -332,7 +332,7 @@ static int bge_get_eaddr_eeprom(struct b
 static int bge_get_eaddr(struct bge_softc *, uint8_t[]);
 
 static void bge_txeof(struct bge_softc *);
-static void bge_rxeof(struct bge_softc *);
+static int bge_rxeof(struct bge_softc *);
 
 static void bge_asf_driver_up (struct bge_softc *);
 static void bge_tick(void *);
@@ -390,7 +390,7 @@ static int bge_miibus_readreg(device_t, 
 static int bge_miibus_writereg(device_t, int, int, int);
 static void bge_miibus_statchg(device_t);
 #ifdef DEVICE_POLLING
-static void bge_poll(struct ifnet *ifp, enum poll_cmd cmd, int count);
+static int bge_poll(struct ifnet *ifp, enum poll_cmd cmd, int count);
 #endif
 
 #define	BGE_RESET_START 1
@@ -3050,18 +3050,18 @@ bge_reset(struct bge_softc *sc)
  * 2) the frame is from the standard receive ring
  */
 
-static void
+static int
 bge_rxeof(struct bge_softc *sc)
 {
 	struct ifnet *ifp;
-	int stdcnt = 0, jumbocnt = 0;
+	int rx_npkts = 0, stdcnt = 0, jumbocnt = 0;
 
 	BGE_LOCK_ASSERT(sc);
 
 	/* Nothing to do. */
 	if (sc->bge_rx_saved_considx ==
 	    sc->bge_ldata.bge_status_block->bge_idx[0].bge_rx_prod_idx)
-		return;
+		return (rx_npkts);
 
 	ifp = sc->bge_ifp;
 
@@ -3193,6 +3193,7 @@ bge_rxeof(struct bge_softc *sc)
 		BGE_UNLOCK(sc);
 		(*ifp->if_input)(ifp, m);
 		BGE_LOCK(sc);
+		rk_npkts++;
 
 		if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
 			return;
@@ -3219,6 +3220,7 @@ bge_rxeof(struct bge_softc *sc)
 	if (BGE_IS_5705_PLUS(sc))
 		ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS);
 #endif
+	return (rx_npkts);
 }
 
 static void
@@ -3271,16 +3273,17 @@ bge_txeof(struct bge_softc *sc)
 }
 
 #ifdef DEVICE_POLLING
-static void
+static int
 bge_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
 {
 	struct bge_softc *sc = ifp->if_softc;
 	uint32_t statusword;
-	
+	int rx_npkts = 0;
+
 	BGE_LOCK(sc);
 	if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
 		BGE_UNLOCK(sc);
-		return;
+		return (rx_npkts);
 	}
 
 	bus_dmamap_sync(sc->bge_cdata.bge_status_tag,
@@ -3303,7 +3306,7 @@ bge_poll(struct ifnet *ifp, enum poll_cm
 			bge_link_upd(sc);
 
 	sc->rxcycles = count;
-	bge_rxeof(sc);
+	rx_npkts = bge_rxeof(sc);
 	if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
 		BGE_UNLOCK(sc);
 		return;
@@ -3313,6 +3316,7 @@ bge_poll(struct ifnet *ifp, enum poll_cm
 		bge_start_locked(ifp);
 
 	BGE_UNLOCK(sc);
+	return (rx_npkts);
 }
 #endif /* DEVICE_POLLING */
 

Modified: head/sys/dev/dc/if_dc.c
==============================================================================
--- head/sys/dev/dc/if_dc.c	Sat May 30 15:07:47 2009	(r193095)
+++ head/sys/dev/dc/if_dc.c	Sat May 30 15:14:44 2009	(r193096)
@@ -236,7 +236,7 @@ static int dc_newbuf(struct dc_softc *, 
 static int dc_encap(struct dc_softc *, struct mbuf **);
 static void dc_pnic_rx_bug_war(struct dc_softc *, int);
 static int dc_rx_resync(struct dc_softc *);
-static void dc_rxeof(struct dc_softc *);
+static int dc_rxeof(struct dc_softc *);
 static void dc_txeof(struct dc_softc *);
 static void dc_tick(void *);
 static void dc_tx_underrun(struct dc_softc *);
@@ -2640,19 +2640,21 @@ dc_rx_resync(struct dc_softc *sc)
  * A frame has been uploaded: pass the resulting mbuf chain up to
  * the higher level protocols.
  */
-static void
+static int
 dc_rxeof(struct dc_softc *sc)
 {
 	struct mbuf *m, *m0;
 	struct ifnet *ifp;
 	struct dc_desc *cur_rx;
-	int i, total_len = 0;
+	int i, total_len, rx_npkts;
 	u_int32_t rxstat;
 
 	DC_LOCK_ASSERT(sc);
 
 	ifp = sc->dc_ifp;
 	i = sc->dc_cdata.dc_rx_prod;
+	total_len = 0;
+	rx_npkts = 0;
 
 	bus_dmamap_sync(sc->dc_ltag, sc->dc_lmap, BUS_DMASYNC_POSTREAD);
 	while (!(le32toh(sc->dc_ldata->dc_rx_list[i].dc_status) &
@@ -2706,7 +2708,7 @@ dc_rxeof(struct dc_softc *sc)
 					continue;
 				} else {
 					dc_init_locked(sc);
-					return;
+					return (rx_npkts);
 				}
 			}
 		}
@@ -2745,9 +2747,11 @@ dc_rxeof(struct dc_softc *sc)
 		DC_UNLOCK(sc);
 		(*ifp->if_input)(ifp, m);
 		DC_LOCK(sc);
+		rx_npkts++;
 	}
 
 	sc->dc_cdata.dc_rx_prod = i;
+	return (rx_npkts);
 }
 
 /*
@@ -2989,20 +2993,21 @@ dc_tx_underrun(struct dc_softc *sc)
 #ifdef DEVICE_POLLING
 static poll_handler_t dc_poll;
 
-static void
+static int
 dc_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
 {
 	struct dc_softc *sc = ifp->if_softc;
+	int rx_npkts = 0;
 
 	DC_LOCK(sc);
 
 	if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
 		DC_UNLOCK(sc);
-		return;
+		return (rx_npkts);
 	}
 
 	sc->rxcycles = count;
-	dc_rxeof(sc);
+	rx_npkts = dc_rxeof(sc);
 	dc_txeof(sc);
 	if (!IFQ_IS_EMPTY(&ifp->if_snd) &&
 	    !(ifp->if_drv_flags & IFF_DRV_OACTIVE))
@@ -3017,7 +3022,7 @@ dc_poll(struct ifnet *ifp, enum poll_cmd
 			DC_ISR_BUS_ERR);
 		if (!status) {
 			DC_UNLOCK(sc);
-			return;
+			return (rx_npkts);
 		}
 		/* ack what we have */
 		CSR_WRITE_4(sc, DC_ISR, status);
@@ -3043,6 +3048,7 @@ dc_poll(struct ifnet *ifp, enum poll_cmd
 		}
 	}
 	DC_UNLOCK(sc);
+	return (rx_npkts);
 }
 #endif /* DEVICE_POLLING */
 

Modified: head/sys/dev/e1000/if_em.c
==============================================================================
--- head/sys/dev/e1000/if_em.c	Sat May 30 15:07:47 2009	(r193095)
+++ head/sys/dev/e1000/if_em.c	Sat May 30 15:14:44 2009	(r193096)
@@ -261,7 +261,7 @@ static void	em_txeof(struct adapter *);
 static void	em_tx_purge(struct adapter *);
 static int	em_allocate_receive_structures(struct adapter *);
 static int	em_allocate_transmit_structures(struct adapter *);
-static int	em_rxeof(struct adapter *, int);
+static int	em_rxeof(struct adapter *, int, int *);
 #ifndef __NO_STRICT_ALIGNMENT
 static int	em_fixup_rx(struct adapter *);
 #endif
@@ -1653,16 +1653,20 @@ em_init(void *arg)
  *  Legacy polling routine  
  *
  *********************************************************************/
-static void
+static int
 em_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
 {
-	struct adapter *adapter = ifp->if_softc;
+	struct adapter *adapter;
 	u32		reg_icr;
+	int		rx_npkts;
+
+	adapter = ifp->if_softc;
+	rx_npkts = 0;
 
 	EM_CORE_LOCK(adapter);
 	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
 		EM_CORE_UNLOCK(adapter);
-		return;
+		return (rx_npkts);
 	}
 
 	if (cmd == POLL_AND_CHECK_STATUS) {
@@ -1677,7 +1681,7 @@ em_poll(struct ifnet *ifp, enum poll_cmd
 	}
 	EM_CORE_UNLOCK(adapter);
 
-	em_rxeof(adapter, count);
+	em_rxeof(adapter, count, &rx_npkts);
 
 	EM_TX_LOCK(adapter);
 	em_txeof(adapter);
@@ -1685,6 +1689,7 @@ em_poll(struct ifnet *ifp, enum poll_cmd
 	if (!ADAPTER_RING_EMPTY(adapter))
 		em_start_locked(ifp);
 	EM_TX_UNLOCK(adapter);
+	return (rx_npkts);
 }
 #endif /* DEVICE_POLLING */
 
@@ -1718,7 +1723,7 @@ em_intr(void *arg)
 
 	EM_TX_LOCK(adapter);
 	em_txeof(adapter);
-	em_rxeof(adapter, -1);
+	em_rxeof(adapter, -1, NULL);
 	em_txeof(adapter);
 	EM_TX_UNLOCK(adapter);
 
@@ -1771,7 +1776,7 @@ em_handle_rxtx(void *context, int pendin
 
 
 	if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
-		if (em_rxeof(adapter, adapter->rx_process_limit) != 0)
+		if (em_rxeof(adapter, adapter->rx_process_limit, NULL) != 0)
 			taskqueue_enqueue(adapter->tq, &adapter->rxtx_task);
 		EM_TX_LOCK(adapter);
 		em_txeof(adapter);
@@ -1882,7 +1887,7 @@ em_msix_rx(void *arg)
 
 	++adapter->rx_irq;
 	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) &&
-	    (em_rxeof(adapter, adapter->rx_process_limit) != 0))
+	    (em_rxeof(adapter, adapter->rx_process_limit, NULL) != 0))
 		taskqueue_enqueue(adapter->tq, &adapter->rx_task);
 	/* Reenable this interrupt */
 	E1000_WRITE_REG(&adapter->hw, E1000_IMS, EM_MSIX_RX);
@@ -1920,7 +1925,7 @@ em_handle_rx(void *context, int pending)
 	struct ifnet	*ifp = adapter->ifp;
 
 	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) &&
-	    (em_rxeof(adapter, adapter->rx_process_limit) != 0))
+	    (em_rxeof(adapter, adapter->rx_process_limit, NULL) != 0))
 		taskqueue_enqueue(adapter->tq, &adapter->rx_task);
 
 }
@@ -4461,23 +4466,26 @@ em_free_receive_structures(struct adapte
  *
  *********************************************************************/
 static int
-em_rxeof(struct adapter *adapter, int count)
+em_rxeof(struct adapter *adapter, int count, int *rx_npktsp)
 {
 	struct ifnet	*ifp = adapter->ifp;;
 	struct mbuf	*mp;
 	u8		status, accept_frame = 0, eop = 0;
 	u16 		len, desc_len, prev_len_adj;
-	int		i;
+	int		i, rx_npkts;
 	struct e1000_rx_desc   *current_desc;
 
 	EM_RX_LOCK(adapter);
 	i = adapter->next_rx_desc_to_check;
+	rx_npkts = 0;
 	current_desc = &adapter->rx_desc_base[i];
 	bus_dmamap_sync(adapter->rxdma.dma_tag, adapter->rxdma.dma_map,
 	    BUS_DMASYNC_POSTREAD);
 
 	if (!((current_desc->status) & E1000_RXD_STAT_DD)) {
 		EM_RX_UNLOCK(adapter);
+		if (rx_npktsp != NULL)
+			*rx_npktsp = rx_npkts;
 		return (0);
 	}
 
@@ -4626,6 +4634,7 @@ discard:
 			EM_RX_UNLOCK(adapter);
 			(*ifp->if_input)(ifp, m);
 			EM_RX_LOCK(adapter);
+			rx_npkts++;
 			i = adapter->next_rx_desc_to_check;
 		}
 		current_desc = &adapter->rx_desc_base[i];
@@ -4637,6 +4646,8 @@ discard:
 		i = adapter->num_rx_desc - 1;
 	E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), i);
 	EM_RX_UNLOCK(adapter);
+	if (rx_npktsp != NULL)
+		*rx_npktsp = rx_npkts;
 	if (!((current_desc->status) & E1000_RXD_STAT_DD))
 		return (0);
 

Modified: head/sys/dev/firewire/if_fwe.c
==============================================================================
--- head/sys/dev/firewire/if_fwe.c	Sat May 30 15:07:47 2009	(r193095)
+++ head/sys/dev/firewire/if_fwe.c	Sat May 30 15:14:44 2009	(r193096)
@@ -105,18 +105,19 @@ TUNABLE_INT("hw.firewire.fwe.rx_queue_le
 #ifdef DEVICE_POLLING
 static poll_handler_t fwe_poll;
 
-static void
+static int
 fwe_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
 {
 	struct fwe_softc *fwe;
 	struct firewire_comm *fc;
 
 	if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
-		return;
+		return (0);
 
 	fwe = ((struct fwe_eth_softc *)ifp->if_softc)->fwe;
 	fc = fwe->fd.fc;
 	fc->poll(fc, (cmd == POLL_AND_CHECK_STATUS)?0:1, count);
+	return (0);
 }
 #endif /* DEVICE_POLLING */
 
@@ -455,6 +456,7 @@ fwe_ioctl(struct ifnet *ifp, u_long cmd,
 				/* Disable interrupts */
 				fc->set_intr(fc, 0);
 				ifp->if_capenable |= IFCAP_POLLING;
+				ifp->if_capenable |= IFCAP_POLLING_NOCOUNT;
 				return (error);
 			}
 			if (!(ifr->ifr_reqcap & IFCAP_POLLING) &&
@@ -463,6 +465,7 @@ fwe_ioctl(struct ifnet *ifp, u_long cmd,
 				/* Enable interrupts. */
 				fc->set_intr(fc, 1);
 				ifp->if_capenable &= ~IFCAP_POLLING;
+				ifp->if_capenable &= ~IFCAP_POLLING_NOCOUNT;
 				return (error);
 			}
 		    }

Modified: head/sys/dev/firewire/if_fwip.c
==============================================================================
--- head/sys/dev/firewire/if_fwip.c	Sat May 30 15:07:47 2009	(r193095)
+++ head/sys/dev/firewire/if_fwip.c	Sat May 30 15:14:44 2009	(r193096)
@@ -112,18 +112,19 @@ TUNABLE_INT("hw.firewire.fwip.rx_queue_l
 #ifdef DEVICE_POLLING
 static poll_handler_t fwip_poll;
 
-static void
+static int
 fwip_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
 {
 	struct fwip_softc *fwip;
 	struct firewire_comm *fc;
 
 	if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
-		return;
+		return (0);
 
 	fwip = ((struct fwip_eth_softc *)ifp->if_softc)->fwip;
 	fc = fwip->fd.fc;
 	fc->poll(fc, (cmd == POLL_AND_CHECK_STATUS)?0:1, count);
+	return (0);
 }
 #endif /* DEVICE_POLLING */
 
@@ -436,7 +437,8 @@ fwip_ioctl(struct ifnet *ifp, u_long cmd
 				return(error);
 			/* Disable interrupts */
 			fc->set_intr(fc, 0);
-			ifp->if_capenable |= IFCAP_POLLING;
+			ifp->if_capenable |= IFCAP_POLLING |
+			    IFCAP_POLLING_NOCOUNT;
 			return (error);
 			
 		}
@@ -446,6 +448,7 @@ fwip_ioctl(struct ifnet *ifp, u_long cmd
 			/* Enable interrupts. */
 			fc->set_intr(fc, 1);
 			ifp->if_capenable &= ~IFCAP_POLLING;
+			ifp->if_capenable &= ~IFCAP_POLLING_NOCOUNT;
 			return (error);
 		}
 	    }

Modified: head/sys/dev/fxp/if_fxp.c
==============================================================================
--- head/sys/dev/fxp/if_fxp.c	Sat May 30 15:07:47 2009	(r193095)
+++ head/sys/dev/fxp/if_fxp.c	Sat May 30 15:14:44 2009	(r193096)
@@ -217,7 +217,7 @@ static int		fxp_resume(device_t dev);
 static void		fxp_intr(void *xsc);
 static void		fxp_rxcsum(struct fxp_softc *sc, struct ifnet *ifp,
 			    struct mbuf *m, uint16_t status, int pos);
-static void		fxp_intr_body(struct fxp_softc *sc, struct ifnet *ifp,
+static int		fxp_intr_body(struct fxp_softc *sc, struct ifnet *ifp,
 			    uint8_t statack, int count);
 static void 		fxp_init(void *xsc);
 static void 		fxp_init_body(struct fxp_softc *sc);
@@ -1619,16 +1619,17 @@ fxp_encap(struct fxp_softc *sc, struct m
 #ifdef DEVICE_POLLING
 static poll_handler_t fxp_poll;
 
-static void
+static int
 fxp_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
 {
 	struct fxp_softc *sc = ifp->if_softc;
 	uint8_t statack;
+	int rx_npkts = 0;
 
 	FXP_LOCK(sc);
 	if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
 		FXP_UNLOCK(sc);
-		return;
+		return (rx_npkts);
 	}
 
 	statack = FXP_SCB_STATACK_CXTNO | FXP_SCB_STATACK_CNA |
@@ -1639,7 +1640,7 @@ fxp_poll(struct ifnet *ifp, enum poll_cm
 		tmp = CSR_READ_1(sc, FXP_CSR_SCB_STATACK);
 		if (tmp == 0xff || tmp == 0) {
 			FXP_UNLOCK(sc);
-			return; /* nothing to do */
+			return (rx_npkts); /* nothing to do */
 		}
 		tmp &= ~statack;
 		/* ack what we can */
@@ -1647,8 +1648,9 @@ fxp_poll(struct ifnet *ifp, enum poll_cm
 			CSR_WRITE_1(sc, FXP_CSR_SCB_STATACK, tmp);
 		statack |= tmp;
 	}
-	fxp_intr_body(sc, ifp, statack, count);
+	rx_npkts = fxp_intr_body(sc, ifp, statack, count);
 	FXP_UNLOCK(sc);
+	return (rx_npkts);
 }
 #endif /* DEVICE_POLLING */
 
@@ -1805,7 +1807,7 @@ fxp_rxcsum(struct fxp_softc *sc, struct 
 	m->m_pkthdr.csum_data = csum;
 }
 
-static void
+static int
 fxp_intr_body(struct fxp_softc *sc, struct ifnet *ifp, uint8_t statack,
     int count)
 {
@@ -1813,9 +1815,12 @@ fxp_intr_body(struct fxp_softc *sc, stru
 	struct fxp_rx *rxp;
 	struct fxp_rfa *rfa;
 	int rnr = (statack & FXP_SCB_STATACK_RNR) ? 1 : 0;
+	int rx_npkts;
 	uint16_t status;
 
+	rx_npkts = 0;
 	FXP_LOCK_ASSERT(sc, MA_OWNED);
+
 	if (rnr)
 		sc->rnr++;
 #ifdef DEVICE_POLLING
@@ -1852,7 +1857,7 @@ fxp_intr_body(struct fxp_softc *sc, stru
 	 * Just return if nothing happened on the receive side.
 	 */
 	if (!rnr && (statack & FXP_SCB_STATACK_FR) == 0)
-		return;
+		return (rx_npkts);
 
 	/*
 	 * Process receiver interrupts. If a no-resource (RNR)
@@ -1944,6 +1949,7 @@ fxp_intr_body(struct fxp_softc *sc, stru
 			FXP_UNLOCK(sc);
 			(*ifp->if_input)(ifp, m);
 			FXP_LOCK(sc);
+			rx_npkts++;
 		} else {
 			/* Reuse RFA and loaded DMA map. */
 			ifp->if_iqdrops++;
@@ -1957,6 +1963,7 @@ fxp_intr_body(struct fxp_softc *sc, stru
 		    sc->fxp_desc.rx_head->rx_addr);
 		fxp_scb_cmd(sc, FXP_SCB_COMMAND_RU_START);
 	}
+	return (rx_npkts);
 }
 
 /*

Modified: head/sys/dev/ixgb/if_ixgb.c
==============================================================================
--- head/sys/dev/ixgb/if_ixgb.c	Sat May 30 15:07:47 2009	(r193095)
+++ head/sys/dev/ixgb/if_ixgb.c	Sat May 30 15:14:44 2009	(r193096)
@@ -121,7 +121,7 @@ static void     ixgb_update_stats_counte
 static void     ixgb_clean_transmit_interrupts(struct adapter *);
 static int      ixgb_allocate_receive_structures(struct adapter *);
 static int      ixgb_allocate_transmit_structures(struct adapter *);
-static void     ixgb_process_receive_interrupts(struct adapter *, int);
+static int      ixgb_process_receive_interrupts(struct adapter *, int);
 static void 
 ixgb_receive_checksum(struct adapter *,
 		      struct ixgb_rx_desc * rx_desc,
@@ -748,11 +748,12 @@ ixgb_init(void *arg)
 }
 
 #ifdef DEVICE_POLLING
-static void
+static int
 ixgb_poll_locked(struct ifnet * ifp, enum poll_cmd cmd, int count)
 {
 	struct adapter *adapter = ifp->if_softc;
 	u_int32_t       reg_icr;
+	int		rx_npkts;
 
 	IXGB_LOCK_ASSERT(adapter);
 
@@ -766,22 +767,25 @@ ixgb_poll_locked(struct ifnet * ifp, enu
 			    adapter);
 		}
 	}
-	ixgb_process_receive_interrupts(adapter, count);
+	rx_npkts = ixgb_process_receive_interrupts(adapter, count);
 	ixgb_clean_transmit_interrupts(adapter);
 
 	if (ifp->if_snd.ifq_head != NULL)
 		ixgb_start_locked(ifp);
+	return (rx_npkts);
 }
 
-static void
+static int
 ixgb_poll(struct ifnet * ifp, enum poll_cmd cmd, int count)
 {
 	struct adapter *adapter = ifp->if_softc;
+	int rx_npkts = 0;
 
 	IXGB_LOCK(adapter);
 	if (ifp->if_drv_flags & IFF_DRV_RUNNING)
-		ixgb_poll_locked(ifp, cmd, count);
+		rx_npkts = ixgb_poll_locked(ifp, cmd, count);
 	IXGB_UNLOCK(adapter);
+	return (rx_npkts);
 }
 #endif /* DEVICE_POLLING */
 
@@ -2065,7 +2069,7 @@ ixgb_free_receive_structures(struct adap
  *  count < 0.
  *
  *********************************************************************/
-static void
+static int
 ixgb_process_receive_interrupts(struct adapter * adapter, int count)
 {
 	struct ifnet   *ifp;
@@ -2079,6 +2083,7 @@ ixgb_process_receive_interrupts(struct a
 	int             i;
 	int             next_to_use = 0;
 	int             eop_desc;
+	int		rx_npkts = 0;
 	/* Pointer to the receive descriptor being examined. */
 	struct ixgb_rx_desc *current_desc;
 
@@ -2094,7 +2099,7 @@ ixgb_process_receive_interrupts(struct a
 #ifdef _SV_
 		adapter->no_pkts_avail++;
 #endif
-		return;
+		return (rx_npkts);
 	}
 	while ((current_desc->status & IXGB_RX_DESC_STATUS_DD) && (count != 0)) {
 
@@ -2168,6 +2173,7 @@ ixgb_process_receive_interrupts(struct a
 					IXGB_UNLOCK(adapter);
 					(*ifp->if_input) (ifp, adapter->fmp);
 					IXGB_LOCK(adapter);
+					rx_npkts++;
 				}
 #endif
 				adapter->fmp = NULL;
@@ -2239,7 +2245,7 @@ ixgb_process_receive_interrupts(struct a
 	/* Advance the IXGB's Receive Queue #0  "Tail Pointer" */
 	IXGB_WRITE_REG(&adapter->hw, RDT, next_to_use);
 
-	return;
+	return (rx_npkts);
 }
 
 /*********************************************************************

Modified: head/sys/dev/lmc/if_lmc.c
==============================================================================
--- head/sys/dev/lmc/if_lmc.c	Sat May 30 15:07:47 2009	(r193095)
+++ head/sys/dev/lmc/if_lmc.c	Sat May 30 15:14:44 2009	(r193096)
@@ -3960,7 +3960,7 @@ user_interrupt(softc_t *sc, int check_st
 # if (defined(__FreeBSD__) && defined(DEVICE_POLLING))
 
 /* Service the card from the kernel idle loop without interrupts. */
-static void
+static int
 fbsd_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
   {
   softc_t *sc = IFP2SC(ifp);
@@ -4828,6 +4828,7 @@ setup_ifnet(struct ifnet *ifp)
 
 # if (defined(__FreeBSD__) && defined(DEVICE_POLLING))
   ifp->if_capabilities |= IFCAP_POLLING;
+  ifp->if_capenable    |= IFCAP_POLLING_NOCOUNT;
 # if (__FreeBSD_version < 500000)
   ifp->if_capenable    |= IFCAP_POLLING;
 # endif

Modified: head/sys/dev/mge/if_mge.c
==============================================================================
--- head/sys/dev/mge/if_mge.c	Sat May 30 15:07:47 2009	(r193095)
+++ head/sys/dev/mge/if_mge.c	Sat May 30 15:14:44 2009	(r193096)
@@ -106,7 +106,7 @@ static void mge_ver_params(struct mge_so
 
 static void mge_intrs_ctrl(struct mge_softc *sc, int enable);
 static void mge_intr_rx(void *arg);
-static void mge_intr_rx_locked(struct mge_softc *sc, int count);
+static int mge_intr_rx_locked(struct mge_softc *sc, int count);
 static void mge_intr_tx(void *arg);
 static void mge_intr_tx_locked(struct mge_softc *sc);
 static void mge_intr_misc(void *arg);
@@ -569,17 +569,18 @@ mge_reinit_rx(struct mge_softc *sc)
 #ifdef DEVICE_POLLING
 static poll_handler_t mge_poll;
 
-static void
+static int
 mge_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
 {
 	struct mge_softc *sc = ifp->if_softc;
 	uint32_t int_cause, int_cause_ext;
+	int rx_npkts = 0;
 
 	MGE_GLOBAL_LOCK(sc);
 
 	if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
 		MGE_GLOBAL_UNLOCK(sc);
-		return;
+		return (rx_npkts);
 	}
 
 	if (cmd == POLL_AND_CHECK_STATUS) {
@@ -597,9 +598,10 @@ mge_poll(struct ifnet *ifp, enum poll_cm
 	}
 
 	mge_intr_tx_locked(sc);
-	mge_intr_rx_locked(sc, count);
+	rx_npkts = mge_intr_rx_locked(sc, count);
 
 	MGE_GLOBAL_UNLOCK(sc);
+	return (rx_npkts);
 }
 #endif /* DEVICE_POLLING */
 
@@ -1013,7 +1015,7 @@ mge_intr_rx(void *arg) {
 }
 
 
-static void
+static int
 mge_intr_rx_locked(struct mge_softc *sc, int count)
 {
 	struct ifnet *ifp = sc->ifp;
@@ -1021,6 +1023,7 @@ mge_intr_rx_locked(struct mge_softc *sc,
 	uint16_t bufsize;
 	struct mge_desc_wrapper* dw;
 	struct mbuf *mb;
+	int rx_npkts = 0;
 
 	MGE_RECEIVE_LOCK_ASSERT(sc);
 
@@ -1059,6 +1062,7 @@ mge_intr_rx_locked(struct mge_softc *sc,
 			MGE_RECEIVE_UNLOCK(sc);
 			(*ifp->if_input)(ifp, mb);
 			MGE_RECEIVE_LOCK(sc);
+			rx_npkts++;
 		}
 
 		dw->mge_desc->byte_count = 0;
@@ -1071,7 +1075,7 @@ mge_intr_rx_locked(struct mge_softc *sc,
 			count -= 1;
 	}
 
-	return;
+	return (rx_npkts);
 }
 
 static void

Modified: head/sys/dev/nfe/if_nfe.c
==============================================================================
--- head/sys/dev/nfe/if_nfe.c	Sat May 30 15:07:47 2009	(r193095)
+++ head/sys/dev/nfe/if_nfe.c	Sat May 30 15:14:44 2009	(r193096)
@@ -93,8 +93,8 @@ static __inline void nfe_discard_rxbuf(s
 static __inline void nfe_discard_jrxbuf(struct nfe_softc *, int);
 static int nfe_newbuf(struct nfe_softc *, int);
 static int nfe_jnewbuf(struct nfe_softc *, int);
-static int  nfe_rxeof(struct nfe_softc *, int);
-static int  nfe_jrxeof(struct nfe_softc *, int);
+static int  nfe_rxeof(struct nfe_softc *, int, int *);
+static int  nfe_jrxeof(struct nfe_softc *, int, int *);
 static void nfe_txeof(struct nfe_softc *);
 static int  nfe_encap(struct nfe_softc *, struct mbuf **);
 static void nfe_setmulti(struct nfe_softc *);
@@ -1551,23 +1551,24 @@ nfe_free_tx_ring(struct nfe_softc *sc, s
 static poll_handler_t nfe_poll;
 
 
-static void
+static int
 nfe_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
 {
 	struct nfe_softc *sc = ifp->if_softc;
 	uint32_t r;
+	int rx_npkts = 0;
 
 	NFE_LOCK(sc);
 
 	if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
 		NFE_UNLOCK(sc);
-		return;
+		return (rx_npkts);
 	}
 
 	if (sc->nfe_framesize > MCLBYTES - ETHER_HDR_LEN)
-		nfe_jrxeof(sc, count);
+		rx_npkts = nfe_jrxeof(sc, count, &rx_npkts);
 	else
-		nfe_rxeof(sc, count);
+		rx_npkts = nfe_rxeof(sc, count, &rx_npkts);
 	nfe_txeof(sc);
 	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 		taskqueue_enqueue_fast(sc->nfe_tq, &sc->nfe_tx_task);
@@ -1575,7 +1576,7 @@ nfe_poll(struct ifnet *ifp, enum poll_cm
 	if (cmd == POLL_AND_CHECK_STATUS) {
 		if ((r = NFE_READ(sc, sc->nfe_irq_status)) == 0) {
 			NFE_UNLOCK(sc);
-			return;
+			return (rx_npkts);
 		}
 		NFE_WRITE(sc, sc->nfe_irq_status, r);
 
@@ -1586,6 +1587,7 @@ nfe_poll(struct ifnet *ifp, enum poll_cm
 		}
 	}
 	NFE_UNLOCK(sc);
+	return (rx_npkts);
 }
 #endif /* DEVICE_POLLING */
 
@@ -1826,9 +1828,9 @@ nfe_int_task(void *arg, int pending)
 	domore = 0;
 	/* check Rx ring */
 	if (sc->nfe_framesize > MCLBYTES - ETHER_HDR_LEN)
-		domore = nfe_jrxeof(sc, sc->nfe_process_limit);
+		domore = nfe_jrxeof(sc, sc->nfe_process_limit, NULL);
 	else
-		domore = nfe_rxeof(sc, sc->nfe_process_limit);
+		domore = nfe_rxeof(sc, sc->nfe_process_limit, NULL);
 	/* check Tx ring */
 	nfe_txeof(sc);
 
@@ -2015,7 +2017,7 @@ nfe_jnewbuf(struct nfe_softc *sc, int id
 
 
 static int
-nfe_rxeof(struct nfe_softc *sc, int count)
+nfe_rxeof(struct nfe_softc *sc, int count, int *rx_npktsp)
 {
 	struct ifnet *ifp = sc->nfe_ifp;
 	struct nfe_desc32 *desc32;
@@ -2023,9 +2025,10 @@ nfe_rxeof(struct nfe_softc *sc, int coun
 	struct nfe_rx_data *data;
 	struct mbuf *m;
 	uint16_t flags;
-	int len, prog;
+	int len, prog, rx_npkts;
 	uint32_t vtag = 0;
 
+	rx_npkts = 0;
 	NFE_LOCK_ASSERT(sc);
 
 	bus_dmamap_sync(sc->rxq.rx_desc_tag, sc->rxq.rx_desc_map,
@@ -2115,18 +2118,21 @@ nfe_rxeof(struct nfe_softc *sc, int coun
 		NFE_UNLOCK(sc);
 		(*ifp->if_input)(ifp, m);
 		NFE_LOCK(sc);
+		rx_npkts++;
 	}
 
 	if (prog > 0)
 		bus_dmamap_sync(sc->rxq.rx_desc_tag, sc->rxq.rx_desc_map,
 		    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 
+	if (rx_npktsp != NULL)
+		*rx_npktsp = rx_npkts;
 	return (count > 0 ? 0 : EAGAIN);
 }
 
 
 static int
-nfe_jrxeof(struct nfe_softc *sc, int count)
+nfe_jrxeof(struct nfe_softc *sc, int count, int *rx_npktsp)
 {
 	struct ifnet *ifp = sc->nfe_ifp;
 	struct nfe_desc32 *desc32;
@@ -2134,9 +2140,10 @@ nfe_jrxeof(struct nfe_softc *sc, int cou
 	struct nfe_rx_data *data;
 	struct mbuf *m;
 	uint16_t flags;
-	int len, prog;
+	int len, prog, rx_npkts;
 	uint32_t vtag = 0;
 
+	rx_npkts = 0;
 	NFE_LOCK_ASSERT(sc);
 
 	bus_dmamap_sync(sc->jrxq.jrx_desc_tag, sc->jrxq.jrx_desc_map,
@@ -2227,12 +2234,15 @@ nfe_jrxeof(struct nfe_softc *sc, int cou
 		NFE_UNLOCK(sc);
 		(*ifp->if_input)(ifp, m);
 		NFE_LOCK(sc);
+		rx_npkts++;
 	}
 
 	if (prog > 0)
 		bus_dmamap_sync(sc->jrxq.jrx_desc_tag, sc->jrxq.jrx_desc_map,
 		    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 
+	if (rx_npktsp != NULL)
+		*rx_npktsp = rx_npkts;
 	return (count > 0 ? 0 : EAGAIN);
 }
 

Modified: head/sys/dev/re/if_re.c
==============================================================================
--- head/sys/dev/re/if_re.c	Sat May 30 15:07:47 2009	(r193095)
+++ head/sys/dev/re/if_re.c	Sat May 30 15:14:44 2009	(r193096)
@@ -237,11 +237,11 @@ static int re_tx_list_init	(struct rl_so
 static __inline void re_fixup_rx
 				(struct mbuf *);
 #endif
-static int re_rxeof		(struct rl_softc *);
+static int re_rxeof		(struct rl_softc *, int *);
 static void re_txeof		(struct rl_softc *);
 #ifdef DEVICE_POLLING
-static void re_poll		(struct ifnet *, enum poll_cmd, int);
-static void re_poll_locked	(struct ifnet *, enum poll_cmd, int);
+static int re_poll		(struct ifnet *, enum poll_cmd, int);
+static int re_poll_locked	(struct ifnet *, enum poll_cmd, int);
 #endif
 static int re_intr		(void *);
 static void re_tick		(void *);
@@ -1792,14 +1792,14 @@ re_rx_list_init(struct rl_softc *sc)
  * across multiple 2K mbuf cluster buffers.
  */
 static int
-re_rxeof(struct rl_softc *sc)
+re_rxeof(struct rl_softc *sc, int *rx_npktsp)
 {
 	struct mbuf		*m;
 	struct ifnet		*ifp;
 	int			i, total_len;
 	struct rl_desc		*cur_rx;
 	u_int32_t		rxstat, rxvlan;
-	int			maxpkt = 16;
+	int			maxpkt = 16, rx_npkts = 0;
 
 	RL_LOCK_ASSERT(sc);
 
@@ -1982,6 +1982,7 @@ re_rxeof(struct rl_softc *sc)
 		RL_UNLOCK(sc);
 		(*ifp->if_input)(ifp, m);
 		RL_LOCK(sc);
+		rx_npkts++;
 	}
 
 	/* Flush the RX DMA ring */
@@ -1992,6 +1993,8 @@ re_rxeof(struct rl_softc *sc)
 
 	sc->rl_ldata.rl_rx_prodidx = i;
 
+	if (rx_npktsp != NULL)
+		*rx_npktsp = rx_npkts;
 	if (maxpkt)
 		return(EAGAIN);
 
@@ -2092,26 +2095,29 @@ re_tick(void *xsc)
 }
 
 #ifdef DEVICE_POLLING
-static void
+static int
 re_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
 {
 	struct rl_softc *sc = ifp->if_softc;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 15:20:26 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5299F106570A;
	Sat, 30 May 2009 15:20:26 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 40F148FC17;
	Sat, 30 May 2009 15:20:26 +0000 (UTC)
	(envelope-from adrian@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UFKQJd011584;
	Sat, 30 May 2009 15:20:26 GMT (envelope-from adrian@svn.freebsd.org)
Received: (from adrian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UFKQZY011583;
	Sat, 30 May 2009 15:20:26 GMT (envelope-from adrian@svn.freebsd.org)
Message-Id: <200905301520.n4UFKQZY011583@svn.freebsd.org>
From: Adrian Chadd 
Date: Sat, 30 May 2009 15:20:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193098 - head/sys/i386/xen
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 15:20:26 -0000

Author: adrian
Date: Sat May 30 15:20:25 2009
New Revision: 193098
URL: http://svn.freebsd.org/changeset/base/193098

Log:
  Even though I'm not quite sure that the call_func stuff will work properly
  in all the places/cases IPI messages will be generated, at least be consistent
  with how the call_data pointer is assigned and cleared (ie, all done inside
  the spinlock.
  
  Ensure that its NULL before continuing, just to try and identify situations
  where things are going horribly wrong.

Modified:
  head/sys/i386/xen/mp_machdep.c

Modified: head/sys/i386/xen/mp_machdep.c
==============================================================================
--- head/sys/i386/xen/mp_machdep.c	Sat May 30 15:19:40 2009	(r193097)
+++ head/sys/i386/xen/mp_machdep.c	Sat May 30 15:20:25 2009	(r193098)
@@ -973,14 +973,14 @@ smp_tlb_shootdown(u_int vector, vm_offse
 	u_int ncpu;
 	struct _call_data data;
 
-	call_data = &data;
-	
 	ncpu = mp_ncpus - 1;	/* does not shootdown self */
 	if (ncpu < 1)
 		return;		/* no other cpus */
 	if (!(read_eflags() & PSL_I))
 		panic("%s: interrupts disabled", __func__);
 	mtx_lock_spin(&smp_ipi_mtx);
+	KASSERT(call_data == NULL, ("call_data isn't null?!"));
+	call_data = &data;
 	call_data->func_id = vector;
 	call_data->arg1 = addr1;
 	call_data->arg2 = addr2;
@@ -1021,6 +1021,7 @@ smp_targeted_tlb_shootdown(cpumask_t mas
 	if (!(read_eflags() & PSL_I))
 		panic("%s: interrupts disabled", __func__);
 	mtx_lock_spin(&smp_ipi_mtx);
+	KASSERT(call_data == NULL, ("call_data isn't null?!"));
 	call_data = &data;		
 	call_data->func_id = vector;
 	call_data->arg1 = addr1;

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 17:25:15 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 33BBB106564A;
	Sat, 30 May 2009 17:25:15 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 21BEB8FC13;
	Sat, 30 May 2009 17:25:15 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UHPFnE014062;
	Sat, 30 May 2009 17:25:15 GMT (envelope-from attilio@svn.freebsd.org)
Received: (from attilio@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UHPFaY014061;
	Sat, 30 May 2009 17:25:15 GMT (envelope-from attilio@svn.freebsd.org)
Message-Id: <200905301725.n4UHPFaY014061@svn.freebsd.org>
From: Attilio Rao 
Date: Sat, 30 May 2009 17:25:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193100 - head/sys/dev/bge
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 17:25:15 -0000

Author: attilio
Date: Sat May 30 17:25:14 2009
New Revision: 193100
URL: http://svn.freebsd.org/changeset/base/193100

Log:
  s/rk_npkts/rx_npkts
  
  Reported by:	zec

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Sat May 30 16:26:08 2009	(r193099)
+++ head/sys/dev/bge/if_bge.c	Sat May 30 17:25:14 2009	(r193100)
@@ -3193,7 +3193,7 @@ bge_rxeof(struct bge_softc *sc)
 		BGE_UNLOCK(sc);
 		(*ifp->if_input)(ifp, m);
 		BGE_LOCK(sc);
-		rk_npkts++;
+		rx_npkts++;
 
 		if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
 			return;

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 17:26:56 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 53E921065676;
	Sat, 30 May 2009 17:26:56 +0000 (UTC)
	(envelope-from kientzle@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 425528FC13;
	Sat, 30 May 2009 17:26:56 +0000 (UTC)
	(envelope-from kientzle@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UHQuDZ014131;
	Sat, 30 May 2009 17:26:56 GMT
	(envelope-from kientzle@svn.freebsd.org)
Received: (from kientzle@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UHQuS3014130;
	Sat, 30 May 2009 17:26:56 GMT
	(envelope-from kientzle@svn.freebsd.org)
Message-Id: <200905301726.n4UHQuS3014130@svn.freebsd.org>
From: Tim Kientzle 
Date: Sat, 30 May 2009 17:26:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193101 - head/lib/libarchive
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 17:26:56 -0000

Author: kientzle
Date: Sat May 30 17:26:55 2009
New Revision: 193101
URL: http://svn.freebsd.org/changeset/base/193101

Log:
  Include libmd and libcrypto in DPADD

Modified:
  head/lib/libarchive/Makefile

Modified: head/lib/libarchive/Makefile
==============================================================================
--- head/lib/libarchive/Makefile	Sat May 30 17:25:14 2009	(r193100)
+++ head/lib/libarchive/Makefile	Sat May 30 17:26:55 2009	(r193101)
@@ -2,7 +2,7 @@
 .include 
 
 LIB=	archive
-DPADD=	${LIBBZ2} ${LIBZ}
+DPADD=	${LIBBZ2} ${LIBZ} ${LIBMD}
 LDADD=	-lbz2 -lz -lmd
 
 # FreeBSD SHLIB_MAJOR value is managed as part of the FreeBSD system.
@@ -12,15 +12,16 @@ SHLIB_MAJOR= 4
 CFLAGS+=	-DPLATFORM_CONFIG_H=\"config_freebsd.h\"
 CFLAGS+=	-I${.OBJDIR}
 #Uncomment to build with full lzma/xz support via liblzma
+#liblzma is not (yet?) part of the FreeBSD base system
 #CFLAGS+= -I/usr/local/include -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1
 #LDADD+= -L/usr/local/lib -llzma
 
 .if ${MK_OPENSSL} != "no"
 CFLAGS+=	-DWITH_OPENSSL
-LDFLAGS+=	-lcrypto
+DPADD+=	${LIBCRYPTO}
+LDADD+=	-lcrypto
 .endif
 
-
 WARNS?=	6
 
 # Headers to be installed in /usr/include

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 17:56:19 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 778781065670;
	Sat, 30 May 2009 17:56:19 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4F86F8FC19;
	Sat, 30 May 2009 17:56:19 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UHuJHQ014763;
	Sat, 30 May 2009 17:56:19 GMT (envelope-from attilio@svn.freebsd.org)
Received: (from attilio@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UHuJhG014762;
	Sat, 30 May 2009 17:56:19 GMT (envelope-from attilio@svn.freebsd.org)
Message-Id: <200905301756.n4UHuJhG014762@svn.freebsd.org>
From: Attilio Rao 
Date: Sat, 30 May 2009 17:56:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193103 - head/sys/dev/bge
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 17:56:20 -0000

Author: attilio
Date: Sat May 30 17:56:19 2009
New Revision: 193103
URL: http://svn.freebsd.org/changeset/base/193103

Log:
  Fix return values appropriately.
  
  Tested by:	zec

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Sat May 30 17:39:50 2009	(r193102)
+++ head/sys/dev/bge/if_bge.c	Sat May 30 17:56:19 2009	(r193103)
@@ -3196,7 +3196,7 @@ bge_rxeof(struct bge_softc *sc)
 		rx_npkts++;
 
 		if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
-			return;
+			return (rx_npkts);
 	}
 
 	if (stdcnt > 0)
@@ -3309,7 +3309,7 @@ bge_poll(struct ifnet *ifp, enum poll_cm
 	rx_npkts = bge_rxeof(sc);
 	if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
 		BGE_UNLOCK(sc);
-		return;
+		return (rx_npkts);
 	}
 	bge_txeof(sc);
 	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 18:23:56 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2F97D1065674;
	Sat, 30 May 2009 18:23:56 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1DAE68FC1A;
	Sat, 30 May 2009 18:23:56 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UINtE2015350;
	Sat, 30 May 2009 18:23:55 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UINt5a015349;
	Sat, 30 May 2009 18:23:55 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200905301823.n4UINt5a015349@svn.freebsd.org>
From: Sam Leffler 
Date: Sat, 30 May 2009 18:23:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193104 - head/sys/arm/xscale/ixp425
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 18:23:56 -0000

Author: sam
Date: Sat May 30 18:23:55 2009
New Revision: 193104
URL: http://svn.freebsd.org/changeset/base/193104

Log:
  maintain existing style

Modified:
  head/sys/arm/xscale/ixp425/if_npe.c

Modified: head/sys/arm/xscale/ixp425/if_npe.c
==============================================================================
--- head/sys/arm/xscale/ixp425/if_npe.c	Sat May 30 17:56:19 2009	(r193103)
+++ head/sys/arm/xscale/ixp425/if_npe.c	Sat May 30 18:23:55 2009	(r193104)
@@ -1145,7 +1145,7 @@ npe_rxdone(int qid, void *arg)
 			/* XXX should not happen */
 		}
 	}
-	return (rx_npkts);
+	return rx_npkts;
 #undef P2V
 }
 
@@ -1160,7 +1160,7 @@ npe_poll(struct ifnet *ifp, enum poll_cm
 		rx_npkts = npe_rxdone(sc->rx_qid, sc);
 		npe_txdone(sc->tx_doneqid, sc);	/* XXX polls both NPE's */
 	}
-	return (rx_npkts);
+	return rx_npkts;
 }
 #endif /* DEVICE_POLLING */
 

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 18:39:22 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E02BF106564A;
	Sat, 30 May 2009 18:39:22 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CDE718FC14;
	Sat, 30 May 2009 18:39:22 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UIdMpF015658;
	Sat, 30 May 2009 18:39:22 GMT (envelope-from attilio@svn.freebsd.org)
Received: (from attilio@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UIdMmA015655;
	Sat, 30 May 2009 18:39:22 GMT (envelope-from attilio@svn.freebsd.org)
Message-Id: <200905301839.n4UIdMmA015655@svn.freebsd.org>
From: Attilio Rao 
Date: Sat, 30 May 2009 18:39:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193105 - in head/sys/dev: lmc nge
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 18:39:23 -0000

Author: attilio
Date: Sat May 30 18:39:22 2009
New Revision: 193105
URL: http://svn.freebsd.org/changeset/base/193105

Log:
  Unbreak build.
  
  Pointy hat to:	attilio

Modified:
  head/sys/dev/lmc/if_lmc.c
  head/sys/dev/lmc/if_lmc.h
  head/sys/dev/nge/if_nge.c

Modified: head/sys/dev/lmc/if_lmc.c
==============================================================================
--- head/sys/dev/lmc/if_lmc.c	Sat May 30 18:23:55 2009	(r193104)
+++ head/sys/dev/lmc/if_lmc.c	Sat May 30 18:39:22 2009	(r193105)
@@ -3976,12 +3976,13 @@ fbsd_poll(struct ifnet *ifp, enum poll_c
     {
     /* Last call -- reenable card interrupts. */
     WRITE_CSR(TLP_INT_ENBL, TLP_INT_TXRX);
-    return;
+    return 0;
     }
 #endif
 
   sc->quota = count;
   core_interrupt(sc, (cmd==POLL_AND_CHECK_STATUS));
+  return 0;
   }
 
 # endif  /* (__FreeBSD__ && DEVICE_POLLING) */

Modified: head/sys/dev/lmc/if_lmc.h
==============================================================================
--- head/sys/dev/lmc/if_lmc.h	Sat May 30 18:23:55 2009	(r193104)
+++ head/sys/dev/lmc/if_lmc.h	Sat May 30 18:39:22 2009	(r193105)
@@ -1571,7 +1571,7 @@ static void core_interrupt(void *, int);
 static void user_interrupt(softc_t *, int);
 #if BSD
 # if (defined(__FreeBSD__) && defined(DEVICE_POLLING))
-static void fbsd_poll(struct ifnet *, enum poll_cmd, int);
+static int fbsd_poll(struct ifnet *, enum poll_cmd, int);
 # endif
 static intr_return_t bsd_interrupt(void *);
 #endif /* BSD */

Modified: head/sys/dev/nge/if_nge.c
==============================================================================
--- head/sys/dev/nge/if_nge.c	Sat May 30 18:23:55 2009	(r193104)
+++ head/sys/dev/nge/if_nge.c	Sat May 30 18:39:22 2009	(r193105)
@@ -157,7 +157,7 @@ static int nge_encap(struct nge_softc *,
 #ifndef __NO_STRICT_ALIGNMENT
 static __inline void nge_fixup_rx(struct mbuf *);
 #endif
-static void nge_rxeof(struct nge_softc *);
+static int nge_rxeof(struct nge_softc *);
 static void nge_txeof(struct nge_softc *);
 static void nge_intr(void *);
 static void nge_tick(void *);
@@ -1575,20 +1575,21 @@ nge_fixup_rx(struct mbuf *m)
  * A frame has been uploaded: pass the resulting mbuf chain up to
  * the higher level protocols.
  */
-static void
+static int
 nge_rxeof(struct nge_softc *sc)
 {
 	struct mbuf *m;
 	struct ifnet *ifp;
 	struct nge_desc *cur_rx;
 	struct nge_rxdesc *rxd;
-	int cons, prog, total_len;
+	int cons, prog, rx_npkts, total_len;
 	uint32_t cmdsts, extsts;
 
 	NGE_LOCK_ASSERT(sc);
 
 	ifp = sc->nge_ifp;
 	cons = sc->nge_cdata.nge_rx_cons;
+	rx_npkts = 0;
 
 	bus_dmamap_sync(sc->nge_cdata.nge_rx_ring_tag,
 	    sc->nge_cdata.nge_rx_ring_map,
@@ -1734,6 +1735,7 @@ nge_rxeof(struct nge_softc *sc)
 		NGE_UNLOCK(sc);
 		(*ifp->if_input)(ifp, m);
 		NGE_LOCK(sc);
+		rx_npkts++;
 	}
 
 	if (prog > 0) {
@@ -1742,6 +1744,7 @@ nge_rxeof(struct nge_softc *sc)
 		    sc->nge_cdata.nge_rx_ring_map,
 		    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 	}
+	return (rx_npkts);
 }
 
 /*
@@ -1888,17 +1891,18 @@ nge_stats_update(struct nge_softc *sc)
 #ifdef DEVICE_POLLING
 static poll_handler_t nge_poll;
 
-static void
+static int
 nge_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
 {
 	struct nge_softc *sc;
+	int rx_npkts = 0;
 
 	sc = ifp->if_softc;
 
 	NGE_LOCK(sc);
 	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
 		NGE_UNLOCK(sc);
-		return;
+		return (rx_npkts);
 	}
 
 	/*
@@ -1909,7 +1913,7 @@ nge_poll(struct ifnet *ifp, enum poll_cm
 	 * and then call the interrupt routine.
 	 */
 	sc->rxcycles = count;
-	nge_rxeof(sc);
+	rx_npkts = nge_rxeof(sc);
 	nge_txeof(sc);
 	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 		nge_start_locked(ifp);
@@ -1921,7 +1925,7 @@ nge_poll(struct ifnet *ifp, enum poll_cm
 		status = CSR_READ_4(sc, NGE_ISR);
 
 		if ((status & (NGE_ISR_RX_ERR|NGE_ISR_RX_OFLOW)) != 0)
-			nge_rxeof(sc);
+			rx_npkts += nge_rxeof(sc);
 
 		if ((status & NGE_ISR_RX_IDLE) != 0)
 			NGE_SETBIT(sc, NGE_CSR, NGE_CSR_RX_ENABLE);
@@ -1932,6 +1936,7 @@ nge_poll(struct ifnet *ifp, enum poll_cm
 		}
 	}
 	NGE_UNLOCK(sc);
+	return (rx_npkts);
 }
 #endif /* DEVICE_POLLING */
 

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 19:23:09 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B43F01065670;
	Sat, 30 May 2009 19:23:09 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A25888FC13;
	Sat, 30 May 2009 19:23:09 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UJN9Qx016730;
	Sat, 30 May 2009 19:23:09 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UJN9S8016729;
	Sat, 30 May 2009 19:23:09 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <200905301923.n4UJN9S8016729@svn.freebsd.org>
From: Marcel Moolenaar 
Date: Sat, 30 May 2009 19:23:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193109 - head/lib/libstand
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 19:23:10 -0000

Author: marcel
Date: Sat May 30 19:23:09 2009
New Revision: 193109
URL: http://svn.freebsd.org/changeset/base/193109

Log:
  Print the returned port number when RPC_DEBUG is defined.
  This improves debugging.

Modified:
  head/lib/libstand/rpc.c

Modified: head/lib/libstand/rpc.c
==============================================================================
--- head/lib/libstand/rpc.c	Sat May 30 19:21:56 2009	(r193108)
+++ head/lib/libstand/rpc.c	Sat May 30 19:23:09 2009	(r193109)
@@ -405,17 +405,19 @@ rpc_getport(d, prog, vers)
 
 #ifdef RPC_DEBUG
 	if (debug)
-		printf("getport: prog=0x%x vers=%d\n", prog, vers);
+		printf("%s: prog=0x%x vers=%d\n", __func__, prog, vers);
 #endif
 
 	/* This one is fixed forever. */
-	if (prog == PMAPPROG)
-		return (PMAPPORT);
+	if (prog == PMAPPROG) {
+		port = PMAPPORT;
+		goto out;
+	}
 
 	/* Try for cached answer first */
 	port = rpc_pmap_getcache(d->destip, prog, vers);
 	if (port != -1)
-		return (port);
+		goto out;
 
 	args = &sdata.d;
 	args->prog = htonl(prog);
@@ -435,5 +437,10 @@ rpc_getport(d, prog, vers)
 
 	rpc_pmap_putcache(d->destip, prog, vers, port);
 
+out:
+#ifdef RPC_DEBUG
+	if (debug)
+		printf("%s: port=%u\n", __func__, port);
+#endif
 	return (port);
 }

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 19:26:36 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 40858106566B;
	Sat, 30 May 2009 19:26:36 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2E9C18FC16;
	Sat, 30 May 2009 19:26:36 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UJQaXf016841;
	Sat, 30 May 2009 19:26:36 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UJQati016840;
	Sat, 30 May 2009 19:26:36 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <200905301926.n4UJQati016840@svn.freebsd.org>
From: Kip Macy 
Date: Sat, 30 May 2009 19:26:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193110 -
	head/sys/cddl/contrib/opensolaris/uts/common/fs
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 19:26:36 -0000

Author: kmacy
Date: Sat May 30 19:26:35 2009
New Revision: 193110
URL: http://svn.freebsd.org/changeset/base/193110

Log:
  work around snapshot shutdown race reported by Henri Hennebert

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c	Sat May 30 19:23:09 2009	(r193109)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c	Sat May 30 19:26:35 2009	(r193110)
@@ -564,8 +564,13 @@ gfs_file_inactive(vnode_t *vp)
 	if (fp->gfs_parent == NULL || (vp->v_flag & V_XATTRDIR))
 		goto found;
 
-	dp = fp->gfs_parent->v_data;
-
+	/*
+	 * XXX cope with a FreeBSD-specific race wherein the parent's
+	 * snapshot data can be freed before the parent is
+	 */
+	if ((dp = fp->gfs_parent->v_data) == NULL)
+		return (NULL);
+		
 	/*
 	 * First, see if this vnode is cached in the parent.
 	 */

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 19:28:38 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 95D591065674;
	Sat, 30 May 2009 19:28:38 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 837778FC22;
	Sat, 30 May 2009 19:28:38 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UJScci016925;
	Sat, 30 May 2009 19:28:38 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UJSc04016924;
	Sat, 30 May 2009 19:28:38 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <200905301928.n4UJSc04016924@svn.freebsd.org>
From: Marcel Moolenaar 
Date: Sat, 30 May 2009 19:28:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193111 - head/sys/boot/uboot/lib
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 19:28:39 -0000

Author: marcel
Date: Sat May 30 19:28:38 2009
New Revision: 193111
URL: http://svn.freebsd.org/changeset/base/193111

Log:
  Fix NETIF_DEBUG compilation.

Modified:
  head/sys/boot/uboot/lib/net.c

Modified: head/sys/boot/uboot/lib/net.c
==============================================================================
--- head/sys/boot/uboot/lib/net.c	Sat May 30 19:26:35 2009	(r193110)
+++ head/sys/boot/uboot/lib/net.c	Sat May 30 19:28:38 2009	(r193111)
@@ -46,12 +46,6 @@ __FBSDID("$FreeBSD$");
 #include "glue.h"
 #include "libuboot.h"
 
-#define NETIF_DEBUG
-#define NETIF_VERBOSE_DEBUG
-#undef NETIF_DEBUG
-#undef NETIF_VERBOSE_DEBUG
-
-
 static int	net_probe(struct netif *, void *);
 static int	net_match(struct netif *, void *);
 static void	net_init(struct iodesc *, void *);
@@ -138,7 +132,7 @@ net_put(struct iodesc *desc, void *pkt, 
 #if defined(NETIF_DEBUG)
 	struct ether_header *eh;
 
-	printf("net_put: desc 0x%x, pkt 0x%x, len %d\n", desc, pkt, len);
+	printf("net_put: desc %p, pkt %p, len %d\n", desc, pkt, len);
 	eh = pkt;
 	printf("dst: %s ", ether_sprintf(eh->ether_dhost));
 	printf("src: %s ", ether_sprintf(eh->ether_shost));
@@ -175,7 +169,7 @@ net_get(struct iodesc *desc, void *pkt, 
 	int err, rlen;
 
 #if defined(NETIF_DEBUG)
-	printf("net_get: pkt %x, len %d, timeout %d\n", pkt, len, timeout);
+	printf("net_get: pkt %p, len %d, timeout %d\n", pkt, len, timeout);
 #endif
 	t = getsecs();
 	do {

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 19:38:51 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EB2CF106566C;
	Sat, 30 May 2009 19:38:51 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D9AF28FC0A;
	Sat, 30 May 2009 19:38:51 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UJcpWT017192;
	Sat, 30 May 2009 19:38:51 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UJcpbF017191;
	Sat, 30 May 2009 19:38:51 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <200905301938.n4UJcpbF017191@svn.freebsd.org>
From: Doug Barton 
Date: Sat, 30 May 2009 19:38:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193112 - head/etc/rc.d
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 19:38:52 -0000

Author: dougb
Date: Sat May 30 19:38:51 2009
New Revision: 193112
URL: http://svn.freebsd.org/changeset/base/193112

Log:
  As previously advertised, remove this script prior to the 8.0 branch.

Deleted:
  head/etc/rc.d/early.sh
Modified:
  head/etc/rc.d/Makefile

Modified: head/etc/rc.d/Makefile
==============================================================================
--- head/etc/rc.d/Makefile	Sat May 30 19:28:38 2009	(r193111)
+++ head/etc/rc.d/Makefile	Sat May 30 19:38:51 2009	(r193112)
@@ -9,7 +9,7 @@ FILES=	DAEMON FILESYSTEMS LOGIN NETWORKI
 	ccd cleanvar cleartmp cron \
 	ddb defaultroute devd devfs dhclient \
 	dmesg dumpon \
-	early.sh encswap \
+	encswap \
 	fsck ftp-proxy ftpd \
 	gbde geli geli2 gssd \
 	hcsecd \

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 19:39:57 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9E5401065695;
	Sat, 30 May 2009 19:39:57 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8CA488FC12;
	Sat, 30 May 2009 19:39:57 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UJdvMl017253;
	Sat, 30 May 2009 19:39:57 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UJdvP5017251;
	Sat, 30 May 2009 19:39:57 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <200905301939.n4UJdvP5017251@svn.freebsd.org>
From: Doug Barton 
Date: Sat, 30 May 2009 19:39:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193113 - head
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 19:39:58 -0000

Author: dougb
Date: Sat May 30 19:39:57 2009
New Revision: 193113
URL: http://svn.freebsd.org/changeset/base/193113

Log:
  Removal of early.sh

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==============================================================================
--- head/ObsoleteFiles.inc	Sat May 30 19:38:51 2009	(r193112)
+++ head/ObsoleteFiles.inc	Sat May 30 19:39:57 2009	(r193113)
@@ -14,6 +14,8 @@
 # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last.
 #
 
+# 20090530: removal of early.sh
+OLD_FILES+=etc/rc.d/early.sh
 # 20090527: renaming of S{LIST,TAILQ}_REMOVE_NEXT() to _REMOVE_AFTER()
 OLD_FILES+=usr/share/man/man3/SLIST_REMOVE_NEXT.3.gz
 OLD_FILES+=usr/share/man/man3/STAILQ_REMOVE_NEXT.3.gz

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 19:57:32 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 230F1106566B;
	Sat, 30 May 2009 19:57:32 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EB6DF8FC16;
	Sat, 30 May 2009 19:57:31 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UJvVOa017685;
	Sat, 30 May 2009 19:57:31 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UJvVVi017684;
	Sat, 30 May 2009 19:57:31 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200905301957.n4UJvVVi017684@svn.freebsd.org>
From: Sam Leffler 
Date: Sat, 30 May 2009 19:57:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193114 - head/sys/net80211
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 19:57:32 -0000

Author: sam
Date: Sat May 30 19:57:31 2009
New Revision: 193114
URL: http://svn.freebsd.org/changeset/base/193114

Log:
  o assert TDMA_MAXSLOTS is 2 so noone tries to blindly increase it
  o add safety belt in vdetach for failed state block allocation
  o fix dynamic change to tdma config; ERESTART may not result in
    kicking the state machine so we need to explicitly mark the
    beacon for update
  
  Sponsored by:

Modified:
  head/sys/net80211/ieee80211_tdma.c

Modified: head/sys/net80211/ieee80211_tdma.c
==============================================================================
--- head/sys/net80211/ieee80211_tdma.c	Sat May 30 19:39:57 2009	(r193113)
+++ head/sys/net80211/ieee80211_tdma.c	Sat May 30 19:57:31 2009	(r193114)
@@ -104,6 +104,11 @@ __FBSDID("$FreeBSD$");
 /* XXX probably should set a max */
 #define	TDMA_BINTVAL_VALID(_bintval)	(1 <= (_bintval))
 
+/*
+ * This code is not prepared to handle more than 2 slots.
+ */
+CTASSERT(TDMA_MAXSLOTS == 2);
+
 static void tdma_vdetach(struct ieee80211vap *vap);
 static int tdma_newstate(struct ieee80211vap *, enum ieee80211_state, int);
 static void tdma_beacon_miss(struct ieee80211vap *vap);
@@ -187,8 +192,13 @@ tdma_vdetach(struct ieee80211vap *vap)
 {
 	struct ieee80211_tdma_state *ts = vap->iv_tdma;
 
+	if (ts == NULL) {
+		/* NB: should not have touched any ic state */
+		return;
+	}
 	ts->tdma_opdetach(vap);
 	free(vap->iv_tdma, M_80211_VAP);
+	vap->iv_tdma = NULL;
 
 	setackpolicy(vap->iv_ic, 0);	/* enable ACK's */
 }
@@ -764,7 +774,7 @@ tdma_ioctl_set80211(struct ieee80211vap 
 			return EINVAL;
 		if (ireq->i_val != ts->tdma_slot) {
 			ts->tdma_slot = ireq->i_val;
-			return ERESTART;
+			goto restart;
 		}
 		break;
 	case IEEE80211_IOC_TDMA_SLOTCNT:
@@ -772,7 +782,7 @@ tdma_ioctl_set80211(struct ieee80211vap 
 			return EINVAL;
 		if (ireq->i_val != ts->tdma_slotcnt) {
 			ts->tdma_slotcnt = ireq->i_val;
-			return ERESTART;
+			goto restart;
 		}
 		break;
 	case IEEE80211_IOC_TDMA_SLOTLEN:
@@ -786,7 +796,7 @@ tdma_ioctl_set80211(struct ieee80211vap 
 			return EINVAL;
 		if (ireq->i_val != ts->tdma_slotlen) {
 			ts->tdma_slotlen = ireq->i_val;
-			return ERESTART;
+			goto restart;
 		}
 		break;
 	case IEEE80211_IOC_TDMA_BINTERVAL:
@@ -794,12 +804,15 @@ tdma_ioctl_set80211(struct ieee80211vap 
 			return EINVAL;
 		if (ireq->i_val != ts->tdma_bintval) {
 			ts->tdma_bintval = ireq->i_val;
-			return ERESTART;
+			goto restart;
 		}
 		break;
 	default:
 		return ENOSYS;
 	}
 	return 0;
+restart:
+	ieee80211_beacon_notify(vap, IEEE80211_BEACON_TDMA);
+	return ERESTART;
 }
 IEEE80211_IOCTL_SET(tdma, tdma_ioctl_set80211);

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 20:11:23 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AE8E61065672;
	Sat, 30 May 2009 20:11:23 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9C3928FC15;
	Sat, 30 May 2009 20:11:23 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UKBNBf018018;
	Sat, 30 May 2009 20:11:23 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UKBNMq018014;
	Sat, 30 May 2009 20:11:23 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200905302011.n4UKBNMq018014@svn.freebsd.org>
From: Sam Leffler 
Date: Sat, 30 May 2009 20:11:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193115 - head/sys/net80211
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 20:11:24 -0000

Author: sam
Date: Sat May 30 20:11:23 2009
New Revision: 193115
URL: http://svn.freebsd.org/changeset/base/193115

Log:
  distribute sysctl decls so global variables can be made static

Modified:
  head/sys/net80211/ieee80211_dfs.c
  head/sys/net80211/ieee80211_freebsd.c
  head/sys/net80211/ieee80211_ht.c
  head/sys/net80211/ieee80211_superg.c

Modified: head/sys/net80211/ieee80211_dfs.c
==============================================================================
--- head/sys/net80211/ieee80211_dfs.c	Sat May 30 19:57:31 2009	(r193114)
+++ head/sys/net80211/ieee80211_dfs.c	Sat May 30 20:11:23 2009	(r193115)
@@ -54,10 +54,14 @@ __FBSDID("$FreeBSD$");
 
 MALLOC_DEFINE(M_80211_DFS, "80211dfs", "802.11 DFS state");
 
-/* XXX public for sysctl hookup */
-int	ieee80211_nol_timeout = 30*60;		/* 30 minutes */
+static	int ieee80211_nol_timeout = 30*60;		/* 30 minutes */
+SYSCTL_INT(_net_wlan, OID_AUTO, nol_timeout, CTLFLAG_RW,
+	&ieee80211_nol_timeout, 0, "NOL timeout (secs)");
 #define	NOL_TIMEOUT	msecs_to_ticks(ieee80211_nol_timeout*1000)
-int	ieee80211_cac_timeout = 60;		/* 60 seconds */
+
+static	int ieee80211_cac_timeout = 60;		/* 60 seconds */
+SYSCTL_INT(_net_wlan, OID_AUTO, cac_timeout, CTLFLAG_RW,
+	&ieee80211_cac_timeout, 0, "CAC timeout (secs)");
 #define	CAC_TIMEOUT	msecs_to_ticks(ieee80211_cac_timeout*1000)
 
 void

Modified: head/sys/net80211/ieee80211_freebsd.c
==============================================================================
--- head/sys/net80211/ieee80211_freebsd.c	Sat May 30 19:57:31 2009	(r193114)
+++ head/sys/net80211/ieee80211_freebsd.c	Sat May 30 20:11:23 2009	(r193115)
@@ -61,15 +61,6 @@ int	ieee80211_debug = 0;
 SYSCTL_INT(_net_wlan, OID_AUTO, debug, CTLFLAG_RW, &ieee80211_debug,
 	    0, "debugging printfs");
 #endif
-extern int ieee80211_recv_bar_ena;
-SYSCTL_INT(_net_wlan, OID_AUTO, recv_bar, CTLFLAG_RW, &ieee80211_recv_bar_ena,
-	    0, "BAR frame processing (ena/dis)");
-extern int ieee80211_nol_timeout;
-SYSCTL_INT(_net_wlan, OID_AUTO, nol_timeout, CTLFLAG_RW,
-	&ieee80211_nol_timeout, 0, "NOL timeout (secs)");
-extern int ieee80211_cac_timeout;
-SYSCTL_INT(_net_wlan, OID_AUTO, cac_timeout, CTLFLAG_RW,
-	&ieee80211_cac_timeout, 0, "CAC timeout (secs)");
 
 MALLOC_DEFINE(M_80211_COM, "80211com", "802.11 com state");
 
@@ -174,33 +165,6 @@ ieee80211_sysctl_msecs_ticks(SYSCTL_HAND
 	return 0;
 }
 
-#ifdef IEEE80211_AMPDU_AGE
-extern int ieee80211_ampdu_age;
-SYSCTL_PROC(_net_wlan, OID_AUTO, ampdu_age, CTLTYPE_INT | CTLFLAG_RW,
-	&ieee80211_ampdu_age, 0, ieee80211_sysctl_msecs_ticks, "I",
-	"AMPDU max reorder age (ms)");
-#endif
-extern int ieee80211_addba_timeout;
-SYSCTL_PROC(_net_wlan, OID_AUTO, addba_timeout, CTLTYPE_INT | CTLFLAG_RW,
-	&ieee80211_addba_timeout, 0, ieee80211_sysctl_msecs_ticks, "I",
-	"ADDBA request timeout (ms)");
-extern int ieee80211_addba_backoff;
-SYSCTL_PROC(_net_wlan, OID_AUTO, addba_backoff, CTLTYPE_INT | CTLFLAG_RW,
-	&ieee80211_addba_backoff, 0, ieee80211_sysctl_msecs_ticks, "I",
-	"ADDBA request backoff (ms)");
-extern int ieee80211_addba_maxtries;
-SYSCTL_INT(_net_wlan, OID_AUTO, addba_maxtries, CTLTYPE_INT | CTLFLAG_RW,
-	&ieee80211_addba_maxtries, 0, "max ADDBA requests sent before backoff");
-#ifdef IEEE80211_SUPPORT_SUPERG
-extern int ieee80211_ffppsmin;
-SYSCTL_INT(_net_wlan, OID_AUTO, ffppsmin, CTLTYPE_INT | CTLFLAG_RW,
-	&ieee80211_ffppsmin, 0, "min packet rate before fast-frame staging");
-extern int ieee80211_ffagemax;
-SYSCTL_PROC(_net_wlan, OID_AUTO, ffagemax, CTLTYPE_INT | CTLFLAG_RW,
-	&ieee80211_ffagemax, 0, ieee80211_sysctl_msecs_ticks, "I",
-	"max hold time for fast-frame staging (ms)");
-#endif /* IEEE80211_SUPPORT_SUPERG */
-
 static int
 ieee80211_sysctl_inact(SYSCTL_HANDLER_ARGS)
 {
@@ -320,7 +284,7 @@ ieee80211_sysctl_vattach(struct ieee8021
 	if (vap->iv_caps & IEEE80211_C_DFS) {
 		SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
 			"radar", CTLTYPE_INT | CTLFLAG_RW, vap->iv_ic, 0,
-			ieee80211_sysctl_radar, "I", "simulare radar event");
+			ieee80211_sysctl_radar, "I", "simulate radar event");
 	}
 	vap->iv_sysctl = ctx;
 	vap->iv_oid = oid;

Modified: head/sys/net80211/ieee80211_ht.c
==============================================================================
--- head/sys/net80211/ieee80211_ht.c	Sat May 30 19:57:31 2009	(r193114)
+++ head/sys/net80211/ieee80211_ht.c	Sat May 30 20:11:23 2009	(r193115)
@@ -79,15 +79,30 @@ static const struct ieee80211_htrateset 
 	};
 
 #ifdef IEEE80211_AMPDU_AGE
-/* XXX public for sysctl hookup */
-int	ieee80211_ampdu_age = -1;	/* threshold for ampdu reorder q (ms) */
+static	int ieee80211_ampdu_age = -1;	/* threshold for ampdu reorder q (ms) */
+SYSCTL_PROC(_net_wlan, OID_AUTO, ampdu_age, CTLTYPE_INT | CTLFLAG_RW,
+	&ieee80211_ampdu_age, 0, ieee80211_sysctl_msecs_ticks, "I",
+	"AMPDU max reorder age (ms)");
 #endif
-int	ieee80211_recv_bar_ena = 1;
-int	ieee80211_addba_timeout = -1;	/* timeout waiting for ADDBA response */
-int	ieee80211_addba_backoff = -1;	/* backoff after max ADDBA requests */
-int	ieee80211_addba_maxtries = 3;	/* max ADDBA requests before backoff */
-int	ieee80211_bar_timeout = -1;	/* timeout waiting for BAR response */
-int	ieee80211_bar_maxtries = 50;	/* max BAR requests before DELBA */
+
+static	int ieee80211_recv_bar_ena = 1;
+SYSCTL_INT(_net_wlan, OID_AUTO, recv_bar, CTLFLAG_RW, &ieee80211_recv_bar_ena,
+	    0, "BAR frame processing (ena/dis)");
+
+static	int ieee80211_addba_timeout = -1;/* timeout for ADDBA response */
+SYSCTL_PROC(_net_wlan, OID_AUTO, addba_timeout, CTLTYPE_INT | CTLFLAG_RW,
+	&ieee80211_addba_timeout, 0, ieee80211_sysctl_msecs_ticks, "I",
+	"ADDBA request timeout (ms)");
+static	int ieee80211_addba_backoff = -1;/* backoff after max ADDBA requests */
+SYSCTL_PROC(_net_wlan, OID_AUTO, addba_backoff, CTLTYPE_INT | CTLFLAG_RW,
+	&ieee80211_addba_backoff, 0, ieee80211_sysctl_msecs_ticks, "I",
+	"ADDBA request backoff (ms)");
+static	int ieee80211_addba_maxtries = 3;/* max ADDBA requests before backoff */
+SYSCTL_INT(_net_wlan, OID_AUTO, addba_maxtries, CTLTYPE_INT | CTLFLAG_RW,
+	&ieee80211_addba_maxtries, 0, "max ADDBA requests sent before backoff");
+
+static	int ieee80211_bar_timeout = -1;	/* timeout waiting for BAR response */
+static	int ieee80211_bar_maxtries = 50;/* max BAR requests before DELBA */
 
 /*
  * Setup HT parameters that depends on the clock frequency.

Modified: head/sys/net80211/ieee80211_superg.c
==============================================================================
--- head/sys/net80211/ieee80211_superg.c	Sat May 30 19:57:31 2009	(r193114)
+++ head/sys/net80211/ieee80211_superg.c	Sat May 30 20:11:23 2009	(r193115)
@@ -83,9 +83,13 @@ __FBSDID("$FreeBSD$");
 #define	ETHER_HEADER_COPY(dst, src) \
 	memcpy(dst, src, sizeof(struct ether_header))
 
-/* XXX public for sysctl hookup */
-int	ieee80211_ffppsmin = 2;		/* pps threshold for ff aggregation */
-int	ieee80211_ffagemax = -1;	/* max time frames held on stage q */
+static	int ieee80211_ffppsmin = 2;	/* pps threshold for ff aggregation */
+SYSCTL_INT(_net_wlan, OID_AUTO, ffppsmin, CTLTYPE_INT | CTLFLAG_RW,
+	&ieee80211_ffppsmin, 0, "min packet rate before fast-frame staging");
+static	int ieee80211_ffagemax = -1;	/* max time frames held on stage q */
+SYSCTL_PROC(_net_wlan, OID_AUTO, ffagemax, CTLTYPE_INT | CTLFLAG_RW,
+	&ieee80211_ffagemax, 0, ieee80211_sysctl_msecs_ticks, "I",
+	"max hold time for fast-frame staging (ms)");
 
 void
 ieee80211_superg_attach(struct ieee80211com *ic)

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 21:41:54 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B2BBA1065692;
	Sat, 30 May 2009 21:41:54 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A14358FC0A;
	Sat, 30 May 2009 21:41:54 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4ULfs2d019956;
	Sat, 30 May 2009 21:41:54 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4ULfs1F019955;
	Sat, 30 May 2009 21:41:54 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <200905302141.n4ULfs1F019955@svn.freebsd.org>
From: Doug Barton 
Date: Sat, 30 May 2009 21:41:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193118 - head/etc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 21:41:55 -0000

Author: dougb
Date: Sat May 30 21:41:54 2009
New Revision: 193118
URL: http://svn.freebsd.org/changeset/base/193118

Log:
  Now that the last of the *.sh scripts are gone from the base,
  emit a warning if come across one.

Modified:
  head/etc/rc.subr

Modified: head/etc/rc.subr
==============================================================================
--- head/etc/rc.subr	Sat May 30 21:21:03 2009	(r193117)
+++ head/etc/rc.subr	Sat May 30 21:41:54 2009	(r193118)
@@ -900,8 +900,8 @@ run_rc_script()
 	eval unset ${_arg}_cmd ${_arg}_precmd ${_arg}_postcmd
 
 	case "$_file" in
-	/etc/rc.d/*.sh)			# run in current shell
-		set $_arg; . $_file
+	/etc/rc.d/*.sh)			# no longer allowed in the base
+		warn "Ignoring old-style startup script $_file"
 		;;
 	*[~#]|*.OLD|*.bak|*.orig|*,v)	# scratch file; skip
 		warn "Ignoring scratch file $_file"

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 21:46:11 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AF419106566C;
	Sat, 30 May 2009 21:46:11 +0000 (UTC)
	(envelope-from rpaulo@gmail.com)
Received: from mail-ew0-f212.google.com (mail-ew0-f212.google.com
	[209.85.219.212])
	by mx1.freebsd.org (Postfix) with ESMTP id D99338FC16;
	Sat, 30 May 2009 21:46:10 +0000 (UTC)
	(envelope-from rpaulo@gmail.com)
Received: by ewy8 with SMTP id 8so3556008ewy.43
	for ; Sat, 30 May 2009 14:46:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:received:received:sender:cc:message-id:from:to
	:in-reply-to:content-type:content-transfer-encoding:mime-version
	:subject:date:references:x-pgp-agent:x-mailer;
	bh=n/dBx8u6PwauxiRpulrZR+E4g4YX3D3Cw+6sdzA1p24=;
	b=GPHr3YUxes077sXKO28DGLErcpgEU+94yPMr7gplRzLRfZVDKCjwYZstZF68wGl8mL
	q0Ns+mM/9lF7rtKZtpldye6AT2FMXCNEL19kK/NLYyklHXkqMKip4R2/Ty9V26O/CfZI
	wVB4zCJurrtz+38IQI4h+wV6Gs+fcUPfaaiJw=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=sender:cc:message-id:from:to:in-reply-to:content-type
	:content-transfer-encoding:mime-version:subject:date:references
	:x-pgp-agent:x-mailer;
	b=TxpJyRdFq4Gc2xJF22H66zU15EkAe+bG6Q7uE7b1U6Qoi2OS/RavDgSpdWRtAgKoH2
	OhA77BzYMFQ4FLWtVsPJfzIGbQmsX3MlPfrhf/izXyKfDlFLTpZFcRMg7BTigqedqzHN
	SoWbl7xtCEzkZb4DTZXPKxUBTfIh9slgAcgNA=
Received: by 10.210.33.3 with SMTP id g3mr4288607ebg.85.1243718301167;
	Sat, 30 May 2009 14:18:21 -0700 (PDT)
Received: from epsilon.lan (bl6-153-43.dsl.telepac.pt [82.155.153.43])
	by mx.google.com with ESMTPS id 7sm4979165eyg.17.2009.05.30.14.18.20
	(version=TLSv1/SSLv3 cipher=RC4-MD5);
	Sat, 30 May 2009 14:18:20 -0700 (PDT)
Sender: Rui Paulo 
Message-Id: 
From: Rui Paulo 
To: Andrew Thompson 
In-Reply-To: <200905271927.n4RJRUH8009289@svn.freebsd.org>
Content-Type: multipart/signed; protocol="application/pgp-signature";
	micalg=pgp-sha1; boundary="Apple-Mail-7--876873087"
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0 (Apple Message framework v935.3)
Date: Sat, 30 May 2009 22:18:19 +0100
References: <200905271927.n4RJRUH8009289@svn.freebsd.org>
X-Pgp-Agent: GPGMail 1.2.0 (v56)
X-Mailer: Apple Mail (2.935.3)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r192925 - in head/sys/dev/usb: . input
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 21:46:12 -0000

This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--Apple-Mail-7--876873087
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
Content-Transfer-Encoding: 7bit


On 27 May 2009, at 20:27, Andrew Thompson wrote:

> Author: thompsa
> Date: Wed May 27 19:27:29 2009
> New Revision: 192925
> URL: http://svn.freebsd.org/changeset/base/192925
>
> Log:
>  Add support for the Apple MacBook Pro keyboard
>  - add key mappings for fn keys
>  - byte swapping for certain models
>  - Fix leds for keyboards which require an ID byte for the HID  
> output structures
>
>  Submitted by:	Hans Petter Selasky

Oh, very nice! I've failed to do this with the old usb stack.
This should work on a macbook too, right?

The eject key was easily handled on user space (at least with the old  
usb stack). Why is it being handled in kernel now?

Thanks,
--
Rui Paulo


--Apple-Mail-7--876873087
content-type: application/pgp-signature; x-mac-type=70674453;
	name=PGP.sig
content-description: This is a digitally signed message part
content-disposition: inline; filename=PGP.sig
content-transfer-encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)

iEYEARECAAYFAkohopsACgkQfD8M/ASTygIv5gCeLj4bGYhs1A3Z/UmNNcuiYI0S
c8IAn2liGZz4dCoHcPsLbg6fCfvnJBft
=5A8r
-----END PGP SIGNATURE-----

--Apple-Mail-7--876873087--

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 21:51:39 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 03941106566C;
	Sat, 30 May 2009 21:51:39 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E60608FC1A;
	Sat, 30 May 2009 21:51:38 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4ULpcsj020243;
	Sat, 30 May 2009 21:51:38 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4ULpcWb020239;
	Sat, 30 May 2009 21:51:38 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <200905302151.n4ULpcWb020239@svn.freebsd.org>
From: Doug Barton 
Date: Sat, 30 May 2009 21:51:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193119 - head/etc/rc.d
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 21:51:39 -0000

Author: dougb
Date: Sat May 30 21:51:38 2009
New Revision: 193119
URL: http://svn.freebsd.org/changeset/base/193119

Log:
  Small cleanup, add (spurious) quotation marks around the value
  for name= to make these scripts consistent with the rest.

Modified:
  head/etc/rc.d/archdep
  head/etc/rc.d/moused
  head/etc/rc.d/nscd
  head/etc/rc.d/ntpd

Modified: head/etc/rc.d/archdep
==============================================================================
--- head/etc/rc.d/archdep	Sat May 30 21:41:54 2009	(r193118)
+++ head/etc/rc.d/archdep	Sat May 30 21:51:38 2009	(r193119)
@@ -9,7 +9,7 @@
 
 . /etc/rc.subr
 
-name=archdep
+name="archdep"
 start_cmd="archdep_start"
 stop_cmd=":"
 

Modified: head/etc/rc.d/moused
==============================================================================
--- head/etc/rc.d/moused	Sat May 30 21:41:54 2009	(r193118)
+++ head/etc/rc.d/moused	Sat May 30 21:51:38 2009	(r193119)
@@ -9,7 +9,7 @@
 
 . /etc/rc.subr
 
-name=moused
+name="moused"
 rcvar=`set_rcvar`
 command="/usr/sbin/${name}"
 start_cmd="moused_start"

Modified: head/etc/rc.d/nscd
==============================================================================
--- head/etc/rc.d/nscd	Sat May 30 21:41:54 2009	(r193118)
+++ head/etc/rc.d/nscd	Sat May 30 21:51:38 2009	(r193119)
@@ -18,7 +18,7 @@
 
 . /etc/rc.subr
 
-name=nscd
+name="nscd"
 rcvar=`set_rcvar`
 
 command=/usr/sbin/nscd

Modified: head/etc/rc.d/ntpd
==============================================================================
--- head/etc/rc.d/ntpd	Sat May 30 21:41:54 2009	(r193118)
+++ head/etc/rc.d/ntpd	Sat May 30 21:51:38 2009	(r193119)
@@ -10,7 +10,7 @@
 
 . /etc/rc.subr
 
-name=ntpd
+name="ntpd"
 rcvar=`set_rcvar`
 command="/usr/sbin/${name}"
 pidfile="/var/run/${name}.pid"

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 22:04:19 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 377671065675;
	Sat, 30 May 2009 22:04:18 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DEA5F8FC1A;
	Sat, 30 May 2009 22:04:18 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UM4Ibu020687;
	Sat, 30 May 2009 22:04:18 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UM4InV020686;
	Sat, 30 May 2009 22:04:18 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <200905302204.n4UM4InV020686@svn.freebsd.org>
From: Marcel Moolenaar 
Date: Sat, 30 May 2009 22:04:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193123 - head/sys/modules/geom/geom_part/geom_part_ebr
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 22:04:22 -0000

Author: marcel
Date: Sat May 30 22:04:18 2009
New Revision: 193123
URL: http://svn.freebsd.org/changeset/base/193123

Log:
  g_part_ebr.c includes opt_geom.h

Modified:
  head/sys/modules/geom/geom_part/geom_part_ebr/Makefile

Modified: head/sys/modules/geom/geom_part/geom_part_ebr/Makefile
==============================================================================
--- head/sys/modules/geom/geom_part/geom_part_ebr/Makefile	Sat May 30 22:00:30 2009	(r193122)
+++ head/sys/modules/geom/geom_part/geom_part_ebr/Makefile	Sat May 30 22:04:18 2009	(r193123)
@@ -6,6 +6,7 @@ KMOD=	geom_part_ebr
 SRCS=	g_part_ebr.c
 
 SRCS+=	bus_if.h device_if.h g_part_if.h
+SRCS+=	opt_geom.h
 
 MFILES=	kern/bus_if.m kern/device_if.m geom/part/g_part_if.m
 

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 22:06:59 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0C6A3106566B;
	Sat, 30 May 2009 22:06:59 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EF62A8FC15;
	Sat, 30 May 2009 22:06:58 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UM6wv4020787;
	Sat, 30 May 2009 22:06:58 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UM6w9V020786;
	Sat, 30 May 2009 22:06:58 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <200905302206.n4UM6w9V020786@svn.freebsd.org>
From: Alan Cox 
Date: Sat, 30 May 2009 22:06:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193124 - head/sys/vm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 22:06:59 -0000

Author: alc
Date: Sat May 30 22:06:58 2009
New Revision: 193124
URL: http://svn.freebsd.org/changeset/base/193124

Log:
  Add assertions in two places where a page's valid or dirty bits are changed.

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==============================================================================
--- head/sys/vm/vm_page.c	Sat May 30 22:04:18 2009	(r193123)
+++ head/sys/vm/vm_page.c	Sat May 30 22:06:58 2009	(r193124)
@@ -566,10 +566,13 @@ vm_page_sleep(vm_page_t m, const char *m
 void
 vm_page_dirty(vm_page_t m)
 {
+
 	KASSERT((m->flags & PG_CACHED) == 0,
 	    ("vm_page_dirty: page in cache!"));
 	KASSERT(!VM_PAGE_IS_FREE(m),
 	    ("vm_page_dirty: page is free!"));
+	KASSERT(m->valid == VM_PAGE_BITS_ALL,
+	    ("vm_page_dirty: page is invalid!"));
 	m->dirty = VM_PAGE_BITS_ALL;
 }
 
@@ -1891,6 +1894,13 @@ vm_page_set_valid(vm_page_t m, int base,
 		    DEV_BSIZE - (endoff & (DEV_BSIZE - 1)));
 
 	/*
+	 * Assert that no previously invalid block that is now being validated
+	 * is already dirty. 
+	 */
+	KASSERT((~m->valid & vm_page_bits(base, size) & m->dirty) == 0,
+	    ("vm_page_set_valid: page %p is dirty", m)); 
+
+	/*
 	 * Set valid bits inclusive of any overlap.
 	 */
 	m->valid |= vm_page_bits(base, size);

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 22:11:13 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1BB21106566C;
	Sat, 30 May 2009 22:11:13 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E3CD38FC0C;
	Sat, 30 May 2009 22:11:12 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UMBCEK020911;
	Sat, 30 May 2009 22:11:12 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UMBC7R020910;
	Sat, 30 May 2009 22:11:12 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Message-Id: <200905302211.n4UMBC7R020910@svn.freebsd.org>
From: Rick Macklem 
Date: Sat, 30 May 2009 22:11:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193125 - head/sys/fs/nfsclient
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 22:11:13 -0000

Author: rmacklem
Date: Sat May 30 22:11:12 2009
New Revision: 193125
URL: http://svn.freebsd.org/changeset/base/193125

Log:
  Add a check to v_type == VREG for the recently modified code that
  does NFSv4 Closes in the experimental client's VOP_INACTIVE().
  I also replaced a bunch of ap->a_vp with a local copy of vp,
  because I thought that made it more readable.
  
  Approved by:	kib (mentor)

Modified:
  head/sys/fs/nfsclient/nfs_clnode.c

Modified: head/sys/fs/nfsclient/nfs_clnode.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clnode.c	Sat May 30 22:06:58 2009	(r193124)
+++ head/sys/fs/nfsclient/nfs_clnode.c	Sat May 30 22:11:12 2009	(r193125)
@@ -185,35 +185,35 @@ ncl_inactive(struct vop_inactive_args *a
 {
 	struct nfsnode *np;
 	struct sillyrename *sp;
+	struct vnode *vp = ap->a_vp;
 
-	np = VTONFS(ap->a_vp);
-	if (prtactive && vrefcnt(ap->a_vp) != 0)
-		vprint("ncl_inactive: pushing active", ap->a_vp);
+	np = VTONFS(vp);
+	if (prtactive && vrefcnt(vp) != 0)
+		vprint("ncl_inactive: pushing active", vp);
 
-	if (NFS_ISV4(ap->a_vp)) {
+	if (NFS_ISV4(vp) && vp->v_type == VREG) {
 		/*
 		 * Since mmap()'d files do I/O after VOP_CLOSE(), the NFSv4
 		 * Close operations are delayed until now. Any dirty buffers
 		 * must be flushed before the close, so that the stateid is
 		 * available for the writes.
 		 */
-		if (nfscl_mustflush(ap->a_vp))
-			(void) ncl_flush(ap->a_vp, MNT_WAIT, NULL, ap->a_td,
-			    1);
-		(void) nfsrpc_close(ap->a_vp, 1, ap->a_td);
+		if (nfscl_mustflush(vp))
+			(void) ncl_flush(vp, MNT_WAIT, NULL, ap->a_td, 1);
+		(void) nfsrpc_close(vp, 1, ap->a_td);
 	}
 
-	if (ap->a_vp->v_type != VDIR) {
+	if (vp->v_type != VDIR) {
 		sp = np->n_sillyrename;
 		np->n_sillyrename = NULL;
 	} else
 		sp = NULL;
 	if (sp) {
-		(void)ncl_vinvalbuf(ap->a_vp, 0, ap->a_td, 1);
+		(void) ncl_vinvalbuf(vp, 0, ap->a_td, 1);
 		/*
 		 * Remove the silly file that was rename'd earlier
 		 */
-		ncl_removeit(sp, ap->a_vp);
+		ncl_removeit(sp, vp);
 		crfree(sp->s_cred);
 		vrele(sp->s_dvp);
 		FREE((caddr_t)sp, M_NEWNFSREQ);

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 22:15:55 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9D6D8106564A;
	Sat, 30 May 2009 22:15:55 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8C4898FC1F;
	Sat, 30 May 2009 22:15:55 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UMFtRa021021;
	Sat, 30 May 2009 22:15:55 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UMFt2p021020;
	Sat, 30 May 2009 22:15:55 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <200905302215.n4UMFt2p021020@svn.freebsd.org>
From: Alan Cox 
Date: Sat, 30 May 2009 22:15:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193126 - head/sys/vm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 22:15:56 -0000

Author: alc
Date: Sat May 30 22:15:55 2009
New Revision: 193126
URL: http://svn.freebsd.org/changeset/base/193126

Log:
  Eliminate a stale comment and the two remaining uses of the "register"
  keyword in this file.

Modified:
  head/sys/vm/vm_page.h

Modified: head/sys/vm/vm_page.h
==============================================================================
--- head/sys/vm/vm_page.h	Sat May 30 22:11:12 2009	(r193125)
+++ head/sys/vm/vm_page.h	Sat May 30 22:15:55 2009	(r193126)
@@ -92,10 +92,6 @@
  *	Fields in this structure are locked either by the lock on the
  *	object that the page belongs to (O) or by the lock on the page
  *	queues (P).
- *
- *	The 'valid' and 'dirty' fields are distinct.  A page may have dirty
- *	bits set without having associated valid bits set.  This is used by
- *	NFS to implement piecemeal writes.
  */
 
 TAILQ_HEAD(pglist, vm_page);
@@ -308,13 +304,13 @@ void vm_pageq_remove(vm_page_t m);
 void vm_page_activate (vm_page_t);
 vm_page_t vm_page_alloc (vm_object_t, vm_pindex_t, int);
 vm_page_t vm_page_grab (vm_object_t, vm_pindex_t, int);
-void vm_page_cache (register vm_page_t);
+void vm_page_cache(vm_page_t);
 void vm_page_cache_free(vm_object_t, vm_pindex_t, vm_pindex_t);
 void vm_page_cache_remove(vm_page_t);
 void vm_page_cache_transfer(vm_object_t, vm_pindex_t, vm_object_t);
 int vm_page_try_to_cache (vm_page_t);
 int vm_page_try_to_free (vm_page_t);
-void vm_page_dontneed (register vm_page_t);
+void vm_page_dontneed(vm_page_t);
 void vm_page_deactivate (vm_page_t);
 void vm_page_insert (vm_page_t, vm_object_t, vm_pindex_t);
 vm_page_t vm_page_lookup (vm_object_t, vm_pindex_t);

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 22:23:59 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 20B76106564A;
	Sat, 30 May 2009 22:23:59 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E848B8FC23;
	Sat, 30 May 2009 22:23:58 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UMNwRa021310;
	Sat, 30 May 2009 22:23:58 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UMNwUl021307;
	Sat, 30 May 2009 22:23:58 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <200905302223.n4UMNwUl021307@svn.freebsd.org>
From: Kip Macy 
Date: Sat, 30 May 2009 22:23:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193128 - in head/sys:
	cddl/contrib/opensolaris/uts/common/fs/zfs modules/zfs rpc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 22:23:59 -0000

Author: kmacy
Date: Sat May 30 22:23:58 2009
New Revision: 193128
URL: http://svn.freebsd.org/changeset/base/193128

Log:
  fix xdrmem_control to be safe in an if statement
  fix zfs to depend on krpc
  remove xdr from zfs makefile
  
  Submitted by:	dchagin@freebsd.org

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
  head/sys/modules/zfs/Makefile
  head/sys/rpc/xdr.h

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c	Sat May 30 22:16:29 2009	(r193127)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c	Sat May 30 22:23:58 2009	(r193128)
@@ -3121,3 +3121,4 @@ static moduledata_t zfs_mod = {
 };
 DECLARE_MODULE(zfsctrl, zfs_mod, SI_SUB_VFS, SI_ORDER_ANY);
 MODULE_DEPEND(zfsctrl, opensolaris, 1, 1, 1);
+MODULE_DEPEND(zfsctrl, krpc, 1, 1, 1);

Modified: head/sys/modules/zfs/Makefile
==============================================================================
--- head/sys/modules/zfs/Makefile	Sat May 30 22:16:29 2009	(r193127)
+++ head/sys/modules/zfs/Makefile	Sat May 30 22:23:58 2009	(r193128)
@@ -44,11 +44,6 @@ SRCS+=	list.c
 SRCS+=	nvpair_alloc_system.c
 SRCS+=	taskq.c
 
-#.PATH:	${SUNW}/uts/common/rpc
-#SRCS+=	opensolaris_xdr.c
-#SRCS+=	opensolaris_xdr_array.c
-#SRCS+=	opensolaris_xdr_mem.c
-
 .PATH:	${SUNW}/uts/common/zmod
 SRCS+=	adler32.c
 SRCS+=	opensolaris_crc32.c

Modified: head/sys/rpc/xdr.h
==============================================================================
--- head/sys/rpc/xdr.h	Sat May 30 22:16:29 2009	(r193127)
+++ head/sys/rpc/xdr.h	Sat May 30 22:23:58 2009	(r193128)
@@ -216,8 +216,8 @@ xdr_putint32(XDR *xdrs, int32_t *ip)
 		(*(xdrs)->x_ops->x_destroy)(xdrs)
 
 #define XDR_CONTROL(xdrs, req, op)			\
-	if ((xdrs)->x_ops->x_control)			\
-		(*(xdrs)->x_ops->x_control)(xdrs, req, op)
+	(((xdrs)->x_ops->x_control == NULL) ? (FALSE) :	\
+		(*(xdrs)->x_ops->x_control)(xdrs, req, op))
 #define xdr_control(xdrs, req, op) XDR_CONTROL(xdrs, req, op)
 
 /*

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 22:31:53 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DE89B1065718;
	Sat, 30 May 2009 22:31:53 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 228CA8FC15;
	Sat, 30 May 2009 22:31:53 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UMVrGo021579;
	Sat, 30 May 2009 22:31:53 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UMVrKP021578;
	Sat, 30 May 2009 22:31:53 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <200905302231.n4UMVrKP021578@svn.freebsd.org>
From: Doug Barton 
Date: Sat, 30 May 2009 22:31:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193131 - head/sys/geom/label
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 22:31:55 -0000

Author: dougb
Date: Sat May 30 22:31:52 2009
New Revision: 193131
URL: http://svn.freebsd.org/changeset/base/193131

Log:
  Crank the debug level necessary to display the "Label foo is removed"
  and "Label for provider ..." messages up from 0 to 1.

Modified:
  head/sys/geom/label/g_label.c

Modified: head/sys/geom/label/g_label.c
==============================================================================
--- head/sys/geom/label/g_label.c	Sat May 30 22:31:46 2009	(r193130)
+++ head/sys/geom/label/g_label.c	Sat May 30 22:31:52 2009	(r193131)
@@ -104,7 +104,7 @@ static void
 g_label_orphan(struct g_consumer *cp)
 {
 
-	G_LABEL_DEBUG(0, "Label %s removed.",
+	G_LABEL_DEBUG(1, "Label %s removed.",
 	    LIST_FIRST(&cp->geom->provider)->name);
 	g_slice_orphan(cp);
 }
@@ -113,7 +113,7 @@ static void
 g_label_spoiled(struct g_consumer *cp)
 {
 
-	G_LABEL_DEBUG(0, "Label %s removed.",
+	G_LABEL_DEBUG(1, "Label %s removed.",
 	    LIST_FIRST(&cp->geom->provider)->name);
 	g_slice_spoiled(cp);
 }
@@ -181,7 +181,7 @@ g_label_create(struct gctl_req *req, str
 	g_access(cp, -1, 0, 0);
 	g_slice_config(gp, 0, G_SLICE_CONFIG_SET, (off_t)0, mediasize,
 	    pp->sectorsize, name);
-	G_LABEL_DEBUG(0, "Label for provider %s is %s.", pp->name, name);
+	G_LABEL_DEBUG(1, "Label for provider %s is %s.", pp->name, name);
 	return (gp);
 }
 
@@ -203,7 +203,7 @@ g_label_destroy(struct g_geom *gp, boole
 			return (EBUSY);
 		}
 	} else {
-		G_LABEL_DEBUG(0, "Label %s removed.",
+		G_LABEL_DEBUG(1, "Label %s removed.",
 		    LIST_FIRST(&gp->provider)->name);
 	}
 	g_slice_spoiled(LIST_FIRST(&gp->consumer));

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 22:51:48 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C7399106566C;
	Sat, 30 May 2009 22:51:48 +0000 (UTC) (envelope-from rink@rink.nu)
Received: from mx1.rink.nu (gloom.rink.nu [213.34.49.2])
	by mx1.freebsd.org (Postfix) with ESMTP id 89E498FC0C;
	Sat, 30 May 2009 22:51:48 +0000 (UTC) (envelope-from rink@rink.nu)
Received: from localhost (localhost [127.0.0.1])
	by mx1.rink.nu (Postfix) with ESMTP id 6074C6D43D;
	Sun, 31 May 2009 00:33:45 +0200 (CEST)
X-Virus-Scanned: amavisd-new at rink.nu
Received: from mx1.rink.nu ([213.34.49.2])
	by localhost (gloom.rink.nu [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 7IYylnnnIlH1; Sun, 31 May 2009 00:33:42 +0200 (CEST)
Received: by mx1.rink.nu (Postfix, from userid 1000)
	id 181876D43B; Sun, 31 May 2009 00:33:42 +0200 (CEST)
Date: Sun, 31 May 2009 00:33:42 +0200
From: Rink Springer 
To: Doug Barton 
Message-ID: <20090530223342.GA50137@rink.nu>
References: <200905302231.n4UMVrKP021578@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <200905302231.n4UMVrKP021578@svn.freebsd.org>
User-Agent: Mutt/1.5.18 (2008-05-17)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r193131 - head/sys/geom/label
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 22:51:49 -0000

On Sat, May 30, 2009 at 10:31:53PM +0000, Doug Barton wrote:
> Log:
>   Crank the debug level necessary to display the "Label foo is removed"
>   and "Label for provider ..." messages up from 0 to 1.

Thank you!

-- 
Rink P.W. Springer                                - http://rink.nu
"Doom, gloom and despair. I like it!"
- Tiresias

From owner-svn-src-head@FreeBSD.ORG  Sat May 30 23:52:24 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 55184106566B;
	Sat, 30 May 2009 23:52:24 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 28A0E8FC15;
	Sat, 30 May 2009 23:52:24 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UNqOXc023390;
	Sat, 30 May 2009 23:52:24 GMT (envelope-from attilio@svn.freebsd.org)
Received: (from attilio@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UNqNx2023387;
	Sat, 30 May 2009 23:52:23 GMT (envelope-from attilio@svn.freebsd.org)
Message-Id: <200905302352.n4UNqNx2023387@svn.freebsd.org>
From: Attilio Rao 
Date: Sat, 30 May 2009 23:52:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r193138 - in head: . sys/kern sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 30 May 2009 23:52:24 -0000

Author: attilio
Date: Sat May 30 23:52:23 2009
New Revision: 193138
URL: http://svn.freebsd.org/changeset/base/193138

Log:
  Remove the now invalid (and possibly unused) debug.mpsafevfs
  sysctl/tunable.
  
  Reviewed by:	emaste
  Sponsored by:	Sandvine Incorporated

Modified:
  head/UPDATING
  head/sys/kern/vfs_subr.c
  head/sys/sys/mount.h

Modified: head/UPDATING
==============================================================================
--- head/UPDATING	Sat May 30 23:51:02 2009	(r193137)
+++ head/UPDATING	Sat May 30 23:52:23 2009	(r193138)
@@ -23,6 +23,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.
 	ln -s aj /etc/malloc.conf.)
 
 20090530:
+	Remove the tunable/sysctl debug.mpsafevfs as its initial purpose
+	is no more valid.
+
+20090530:
 	Add VOP_ACCESSX(9).  File system modules need to be rebuilt.
 	Bump __FreeBSD_version to 800094.
 

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Sat May 30 23:51:02 2009	(r193137)
+++ head/sys/kern/vfs_subr.c	Sat May 30 23:52:23 2009	(r193138)
@@ -115,15 +115,6 @@ static int	vfs_knllocked(void *arg);
 static void	destroy_vpollinfo(struct vpollinfo *vi);
 
 /*
- * Enable Giant pushdown based on whether or not the vm is mpsafe in this
- * build.  Without mpsafevm the buffer cache can not run Giant free.
- */
-int mpsafe_vfs = 1;
-TUNABLE_INT("debug.mpsafevfs", &mpsafe_vfs);
-SYSCTL_INT(_debug, OID_AUTO, mpsafevfs, CTLFLAG_RD, &mpsafe_vfs, 0,
-    "MPSAFE VFS");
-
-/*
  * Number of vnodes in existence.  Increased whenever getnewvnode()
  * allocates a new vnode, decreased on vdestroy() called on VI_DOOMed
  * vnode.

Modified: head/sys/sys/mount.h
==============================================================================
--- head/sys/sys/mount.h	Sat May 30 23:51:02 2009	(r193137)
+++ head/sys/sys/mount.h	Sat May 30 23:52:23 2009	(r193138)
@@ -619,10 +619,8 @@ vfs_statfs_t	__vfs_statfs;
 	({if (*(MP)->mnt_op->vfs_susp_clean != NULL)		\
 	       (*(MP)->mnt_op->vfs_susp_clean)(MP); })
 
-extern int mpsafe_vfs;
-
 #define	VFS_NEEDSGIANT_(MP)						\
-    (!mpsafe_vfs || ((MP) != NULL && ((MP)->mnt_kern_flag & MNTK_MPSAFE) == 0))
+    ((MP) != NULL && ((MP)->mnt_kern_flag & MNTK_MPSAFE) == 0)
 
 #define	VFS_NEEDSGIANT(MP) __extension__				\
 ({									\